有效-日数据逻辑开发,增加cors跨域过滤器
This commit is contained in:
@@ -13,11 +13,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 服务注册地址
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: ${spring.cloud.nacos.config.username}
|
||||
# password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.gateway.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.web.cors.reactive.CorsUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig
|
||||
{
|
||||
private static final String ALLOWED_HEADERS = "*";
|
||||
private static final String ALLOWED_METHODS = "GET,POST,PUT,DELETE,OPTIONS,HEAD";
|
||||
private static final String ALLOWED_ORIGIN = "*";
|
||||
private static final String ALLOWED_EXPOSE = "*";
|
||||
private static final String MAX_AGE = "18000L";
|
||||
|
||||
@Bean
|
||||
public WebFilter corsFilter()
|
||||
{
|
||||
return (ServerWebExchange ctx, WebFilterChain chain) -> {
|
||||
ServerHttpRequest request = ctx.getRequest();
|
||||
if (CorsUtils.isCorsRequest(request))
|
||||
{
|
||||
ServerHttpResponse response = ctx.getResponse();
|
||||
HttpHeaders headers = response.getHeaders();
|
||||
headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS);
|
||||
headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
|
||||
headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN);
|
||||
headers.add("Access-Control-Expose-Headers", ALLOWED_EXPOSE);
|
||||
headers.add("Access-Control-Max-Age", MAX_AGE);
|
||||
headers.add("Access-Control-Allow-Credentials", "true");
|
||||
if (request.getMethod() == HttpMethod.OPTIONS)
|
||||
{
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
return Mono.empty();
|
||||
}
|
||||
}
|
||||
return chain.filter(ctx);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 服务注册地址
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: ${spring.cloud.nacos.config.username}
|
||||
# password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -13,11 +13,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: ${spring.cloud.nacos.config.username}
|
||||
# password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 配置中心地址
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -14,10 +14,14 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.16.15.103:8848
|
||||
username: ${spring.cloud.nacos.config.username}
|
||||
password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.16.15.103:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -30,6 +30,8 @@ public class TableScheduleConfig {
|
||||
public void calculate95BandwidthDaily() {
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
epsInitialTrafficDataService.calculate95BandwidthDaily(queryParam);
|
||||
// 有效-95带宽值/日
|
||||
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam);
|
||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||
epsInitialTrafficDataService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 收益方式修改记录对象 eps_method_change_record
|
||||
@@ -11,6 +12,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
* @author gyt
|
||||
* @date 2025-08-15
|
||||
*/
|
||||
@Data
|
||||
public class EpsMethodChangeRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -33,68 +35,23 @@ public class EpsMethodChangeRecord extends BaseEntity
|
||||
/** 创建人 */
|
||||
@Excel(name = "修改人")
|
||||
private String creatBy;
|
||||
/** 收益方式(1.流量,2包端) */
|
||||
private String revenueMethod;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
/** 流量网口 */
|
||||
private String trafficPort;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 包端带宽值 */
|
||||
private BigDecimal packageBandwidth;
|
||||
|
||||
public void setNodeName(String nodeName)
|
||||
{
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
/** 业务名称 */
|
||||
private String businessName;
|
||||
|
||||
public String getNodeName()
|
||||
{
|
||||
return nodeName;
|
||||
}
|
||||
/** 业务代码(12位) */
|
||||
private String businessCode;
|
||||
/** 开始时间 */
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
|
||||
public void setChangeContent(String changeContent)
|
||||
{
|
||||
this.changeContent = changeContent;
|
||||
}
|
||||
|
||||
public String getChangeContent()
|
||||
{
|
||||
return changeContent;
|
||||
}
|
||||
|
||||
public void setHardwareSn(String hardwareSn)
|
||||
{
|
||||
this.hardwareSn = hardwareSn;
|
||||
}
|
||||
|
||||
public String getHardwareSn()
|
||||
{
|
||||
return hardwareSn;
|
||||
}
|
||||
|
||||
public void setCreatBy(String creatBy)
|
||||
{
|
||||
this.creatBy = creatBy;
|
||||
}
|
||||
|
||||
public String getCreatBy()
|
||||
{
|
||||
return creatBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("nodeName", getNodeName())
|
||||
.append("changeContent", getChangeContent())
|
||||
.append("hardwareSn", getHardwareSn())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("creatBy", getCreatBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public class EpsServerRevenueConfig extends BaseEntity
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
/** 业务是否有变化 */
|
||||
private String changed;
|
||||
}
|
||||
|
||||
@@ -87,4 +87,10 @@ public interface AllInterfaceNameMapper
|
||||
* @return
|
||||
*/
|
||||
List<AllInterfaceName> getAllSwitchSn(AllInterfaceName interfaceName);
|
||||
|
||||
/**
|
||||
* 批量编辑
|
||||
* @param records
|
||||
*/
|
||||
void batchUpdate(List<AllInterfaceName> records);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,12 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return 初始流量数据列表
|
||||
*/
|
||||
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData queryParam);
|
||||
/**
|
||||
* 计算95带宽值-有效/日
|
||||
* @param queryParam 查询参数实体
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam);
|
||||
/**
|
||||
* 计算95带宽值
|
||||
* @param queryParam 查询参数实体
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.AllInterfaceName;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
import com.ruoyi.system.domain.InitialSwitchInfoDetails;
|
||||
import com.ruoyi.system.mapper.AllInterfaceNameMapper;
|
||||
import com.ruoyi.system.mapper.EpsInitialTrafficDataMapper;
|
||||
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
|
||||
import com.ruoyi.system.mapper.InitialSwitchInfoDetailsMapper;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.util.TableRouterUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -22,6 +16,8 @@ import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -34,6 +30,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
|
||||
|
||||
private static final Pattern SPEED_PATTERN = Pattern.compile("(\\d+\\.?\\d*)\\s*(\\S*)");
|
||||
|
||||
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
@Autowired
|
||||
private EpsInitialTrafficDataMapper epsInitialTrafficDataMapper;
|
||||
@Autowired
|
||||
@@ -42,6 +40,10 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
||||
@Autowired
|
||||
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
||||
@Autowired
|
||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Override
|
||||
public void createNextMonthTables() {
|
||||
LocalDate nextMonth = LocalDate.now().plusMonths(1);
|
||||
@@ -197,60 +199,148 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 有业务变动的 计算有效95带宽值/日
|
||||
* @param queryParam
|
||||
*/
|
||||
@Override
|
||||
public void calculate95BandwidthDaily(EpsInitialTrafficData queryParam) {
|
||||
Date now = DateUtils.getNowDate();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.HOUR_OF_DAY, -24);
|
||||
Date startDate = calendar.getTime();
|
||||
// 格式化时间
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String startTime = sdf.format(startDate);
|
||||
String endTime = sdf.format(now);
|
||||
public void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam) {
|
||||
// 1. 获取所有设备SN列表
|
||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName());
|
||||
|
||||
// 2. 获取昨天的日期范围(北京时间)
|
||||
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
|
||||
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
|
||||
|
||||
// 3. 遍历每个设备
|
||||
for (AllInterfaceName interfaceName : snList) {
|
||||
queryParam.setServiceSn(interfaceName.getDeviceSn());
|
||||
|
||||
// 4. 检查设备是否有业务变更
|
||||
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
|
||||
revenueConfig.setHardwareSn(interfaceName.getDeviceSn());
|
||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(revenueConfig);
|
||||
|
||||
if (!changedList.isEmpty() &&
|
||||
"1".equals(changedList.get(0).getChanged()) &&
|
||||
"1".equals(changedList.get(0).getRevenueMethod())) {
|
||||
|
||||
// 5. 获取业务变更记录(按时间降序)
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setHardwareSn(interfaceName.getDeviceSn());
|
||||
changeQuery.setStartTime(dailyStartTime);
|
||||
changeQuery.setEndTime(dailyEndTime);
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordMapper
|
||||
.selectEpsMethodChangeRecordList(changeQuery);
|
||||
|
||||
if (!records.isEmpty()) {
|
||||
// 确保按时间降序排列
|
||||
records.sort((r1, r2) -> r2.getCreateTime().compareTo(r1.getCreateTime()));
|
||||
|
||||
// 6. 计算各时间段95值
|
||||
calculateTimeSegments95(queryParam, records, dailyStartTime, dailyEndTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算设备各时间段的95带宽值
|
||||
*/
|
||||
private void calculateTimeSegments95(EpsInitialTrafficData queryParam,
|
||||
List<EpsMethodChangeRecord> records,
|
||||
String dailyStartTime,
|
||||
String dailyEndTime) {
|
||||
// 1. 处理变更时间段(从最新到最早)
|
||||
String endTime = records.get(0).getCreateTime() + "";
|
||||
for (int i = 1; i < records.size(); i++) {
|
||||
String startTime = records.get(i).getCreateTime() + "";
|
||||
calculateSegment95(queryParam, startTime, endTime);
|
||||
endTime = startTime; // 移动时间窗口
|
||||
}
|
||||
|
||||
// 2. 处理最早变更前的时间段(昨天00:00:00 ~ 最早变更时间)
|
||||
String earliestChangeTime = records.get(records.size()-1).getCreateTime() + "";
|
||||
calculateSegment95(queryParam, dailyStartTime, earliestChangeTime);
|
||||
|
||||
// 3. 处理最后变更后的时间段(最新变更时间 ~ 昨天23:59:59)
|
||||
calculateSegment95(queryParam, endTime, dailyEndTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算单个时间段的95带宽值
|
||||
*/
|
||||
private void calculateSegment95(EpsInitialTrafficData queryParam, String startTime, String endTime) {
|
||||
queryParam.setStartTime(startTime);
|
||||
queryParam.setEndTime(endTime);
|
||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||
if (!dataList.isEmpty()) {
|
||||
calculate95BandwidthDaily(dataList);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void calculate95BandwidthDaily(EpsInitialTrafficData queryParam) {
|
||||
// 1. 获取昨天的日期(北京时间)
|
||||
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
|
||||
// 2. 定义时间范围字符串
|
||||
String startTimeStr = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||
String endTimeStr = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
|
||||
queryParam.setStartTime(startTimeStr);
|
||||
queryParam.setEndTime(endTimeStr);
|
||||
queryParam.setRevenueMethod("1");
|
||||
// 查询所有的服务器sn
|
||||
AllInterfaceName allInterfaceName = new AllInterfaceName();
|
||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(allInterfaceName);
|
||||
for (AllInterfaceName interfaceName : snList) {
|
||||
queryParam.setServiceSn(interfaceName.getDeviceSn());
|
||||
// 查询原始数据
|
||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
// 1. 提取 outSpeed 并转换为 Mbps
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> parseSpeedToMbps(data.getOutSpeed()))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
// 4. 检查设备是否有业务变更
|
||||
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
|
||||
revenueConfig.setHardwareSn(interfaceName.getDeviceSn());
|
||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(revenueConfig);
|
||||
|
||||
// 2. 计算 95% 位置(向上取整)
|
||||
int total = speedsInMbps.size();
|
||||
int position = (int) Math.ceil(0.95 * total) - 1; // 转换为 0-based 索引
|
||||
if (position < 0){
|
||||
position = 0;
|
||||
}
|
||||
if (position >= total){
|
||||
position = total - 1;
|
||||
}
|
||||
if (!changedList.isEmpty() &&
|
||||
"1".equals(changedList.get(0).getChanged()) &&
|
||||
"1".equals(changedList.get(0).getRevenueMethod())) {
|
||||
|
||||
// 3. 获取 95 值并四舍五入到两位小数
|
||||
BigDecimal percentile95 = speedsInMbps.get(position);
|
||||
BigDecimal dailyResult = percentile95.setScale(2, RoundingMode.HALF_UP);
|
||||
// 服务器信息
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
// 落入带宽计算结果表
|
||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||
bandwidth.setHardwareSn(epsInitialTrafficData.getServiceSn());
|
||||
bandwidth.setNodeName(epsInitialTrafficData.getNodeName());
|
||||
bandwidth.setBusinessId(epsInitialTrafficData.getBusinessId());
|
||||
bandwidth.setBusinessName(epsInitialTrafficData.getBusinessName());
|
||||
bandwidth.setResourceType("1");
|
||||
bandwidth.setBandwidthType("1");
|
||||
bandwidth.setBandwidthResult(dailyResult);
|
||||
bandwidth.setBandwidth95Daily(dailyResult);
|
||||
bandwidth.setCreateTime(startDate);
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||
}else{
|
||||
// 查询原始数据
|
||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
// 1. 提取 outSpeed 并转换为 Mbps
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> parseSpeedToMbps(data.getOutSpeed()))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 计算 95% 位置(向上取整)
|
||||
int total = speedsInMbps.size();
|
||||
int position = (int) Math.ceil(0.95 * total) - 1; // 转换为 0-based 索引
|
||||
if (position < 0){
|
||||
position = 0;
|
||||
}
|
||||
if (position >= total){
|
||||
position = total - 1;
|
||||
}
|
||||
|
||||
// 3. 获取 95 值并四舍五入到两位小数
|
||||
BigDecimal percentile95 = speedsInMbps.get(position);
|
||||
BigDecimal dailyResult = percentile95.setScale(2, RoundingMode.HALF_UP);
|
||||
// 服务器信息
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
// 落入带宽计算结果表
|
||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||
bandwidth.setHardwareSn(epsInitialTrafficData.getServiceSn());
|
||||
bandwidth.setNodeName(epsInitialTrafficData.getNodeName());
|
||||
bandwidth.setBusinessId(epsInitialTrafficData.getBusinessId());
|
||||
bandwidth.setBusinessName(epsInitialTrafficData.getBusinessName());
|
||||
bandwidth.setResourceType("1");
|
||||
bandwidth.setBandwidthType("1");
|
||||
bandwidth.setBandwidthResult(dailyResult);
|
||||
bandwidth.setBandwidth95Daily(dailyResult);
|
||||
bandwidth.setCreateTime(DateUtils.parseDate(startTimeStr));
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,6 +408,45 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算有效-日95带宽值
|
||||
* @param dataList
|
||||
*/
|
||||
private void calculate95BandwidthDaily(List<EpsInitialTrafficData> dataList){
|
||||
// 1. 提取 outSpeed 并转换为 Mbps
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> parseSpeedToMbps(data.getOutSpeed()))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 计算 95% 位置(向上取整)
|
||||
int total = speedsInMbps.size();
|
||||
int position = (int) Math.ceil(0.95 * total) - 1; // 转换为 0-based 索引
|
||||
if (position < 0){
|
||||
position = 0;
|
||||
}
|
||||
if (position >= total){
|
||||
position = total - 1;
|
||||
}
|
||||
|
||||
// 3. 获取 95 值并四舍五入到两位小数
|
||||
BigDecimal percentile95 = speedsInMbps.get(position);
|
||||
BigDecimal dailyResult = percentile95.setScale(2, RoundingMode.HALF_UP);
|
||||
// 服务器信息
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
// 落入带宽计算结果表
|
||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||
bandwidth.setHardwareSn(epsInitialTrafficData.getServiceSn());
|
||||
bandwidth.setNodeName(epsInitialTrafficData.getNodeName());
|
||||
bandwidth.setBusinessId(epsInitialTrafficData.getBusinessId());
|
||||
bandwidth.setBusinessName(epsInitialTrafficData.getBusinessName());
|
||||
bandwidth.setResourceType("1");
|
||||
bandwidth.setBandwidthType("5");
|
||||
bandwidth.setBandwidthResult(dailyResult);
|
||||
bandwidth.setEffectiveBandwidth95Daily(dailyResult);
|
||||
bandwidth.setCreateTime(DateUtils.parseDate(epsInitialTrafficData.getStartTime()));
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||
}
|
||||
/**
|
||||
* 单位换算
|
||||
* @param speedWithUnit
|
||||
|
||||
@@ -17,10 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -94,6 +92,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
||||
String revenueMethod = getMethodName(serverRevenueConfig.getRevenueMethod());
|
||||
//现在的收益方式
|
||||
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
|
||||
if(serverRevenueConfig.getBusinessCode() != null){
|
||||
if(!serverRevenueConfig.getBusinessCode().equals(epsServerRevenueConfig.getBusinessCode())){
|
||||
epsServerRevenueConfig.setChanged("1");
|
||||
}
|
||||
}
|
||||
// 修改条数
|
||||
int rows = epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
|
||||
if(rows>=0){
|
||||
@@ -128,6 +131,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
||||
",带宽值设置为"+epsServerRevenueConfig.getPackageBandwidth()+"Mbps,"+"业务为"+epsServerRevenueConfig.getBusinessName();
|
||||
}
|
||||
changeRecord.setChangeContent(content);
|
||||
changeRecord.setBusinessCode(epsServerRevenueConfig.getBusinessCode());
|
||||
changeRecord.setBusinessName(epsServerRevenueConfig.getBusinessName());
|
||||
changeRecord.setRevenueMethod(epsServerRevenueConfig.getRevenueMethod());
|
||||
changeRecord.setPackageBandwidth(epsServerRevenueConfig.getPackageBandwidth());
|
||||
changeRecord.setTrafficPort(epsServerRevenueConfig.getTrafficPort());
|
||||
// 添加操作记录
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||
}
|
||||
@@ -210,31 +218,60 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
||||
|
||||
// 批量查询已存在的接口名称
|
||||
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
||||
Set<String> existingNameSet = existingNames.stream()
|
||||
.map(AllInterfaceName::getInterfaceName)
|
||||
.collect(Collectors.toSet());
|
||||
// 转为 Map<接口名称, 数据库记录> 便于快速查找
|
||||
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
|
||||
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
|
||||
|
||||
// 筛选出需要新增的接口名称
|
||||
List<AllInterfaceName> newNames = trafficDataList.stream()
|
||||
.filter(data -> !existingNameSet.contains(data.getName()))
|
||||
.map(data -> {
|
||||
AllInterfaceName name = new AllInterfaceName();
|
||||
name.setInterfaceName(data.getName());
|
||||
name.setClientId(data.getClientId());
|
||||
name.setResourceType("1");
|
||||
name.setDeviceSn(data.getServiceSn());
|
||||
name.setNodeName(data.getNodeName());
|
||||
name.setBusinessCode(data.getBusinessId());
|
||||
name.setBusinessName(data.getBusinessName());
|
||||
return name;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 分类处理:新增列表 vs 更新列表
|
||||
List<AllInterfaceName> namesToInsert = new ArrayList<>();
|
||||
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
|
||||
|
||||
// 批量插入新接口名称
|
||||
if (!newNames.isEmpty()) {
|
||||
allInterfaceNameMapper.batchInsert(newNames);
|
||||
log.info("接口名称表-新增接口名称数量:{}", newNames.size());
|
||||
trafficDataList.forEach(data -> {
|
||||
String name = data.getName();
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 构造新记录(需更新的字段)
|
||||
AllInterfaceName newRecord = new AllInterfaceName();
|
||||
newRecord.setInterfaceName(name);
|
||||
newRecord.setClientId(data.getClientId());
|
||||
newRecord.setResourceType("1"); // 固定值
|
||||
newRecord.setDeviceSn(data.getServiceSn());
|
||||
newRecord.setNodeName(data.getNodeName());
|
||||
newRecord.setBusinessCode(data.getBusinessId());
|
||||
newRecord.setBusinessName(data.getBusinessName());
|
||||
|
||||
// 判断是否需要更新
|
||||
if (existingNameMap.containsKey(name)) {
|
||||
AllInterfaceName oldRecord = existingNameMap.get(name);
|
||||
if (isRecordChanged(oldRecord, newRecord)) {
|
||||
newRecord.setId(oldRecord.getId()); // 保留原ID
|
||||
namesToUpdate.add(newRecord);
|
||||
}
|
||||
} else {
|
||||
namesToInsert.add(newRecord);
|
||||
}
|
||||
});
|
||||
|
||||
// 批量操作数据库
|
||||
if (!namesToInsert.isEmpty()) {
|
||||
allInterfaceNameMapper.batchInsert(namesToInsert);
|
||||
log.info("新增接口名称数量:{}", namesToInsert.size());
|
||||
}
|
||||
|
||||
if (!namesToUpdate.isEmpty()) {
|
||||
allInterfaceNameMapper.batchUpdate(namesToUpdate);
|
||||
log.info("更新接口名称数量:{}", namesToUpdate.size());
|
||||
}
|
||||
}
|
||||
// 辅助方法:检查记录是否有变化
|
||||
private boolean isRecordChanged(AllInterfaceName oldRecord, AllInterfaceName newRecord) {
|
||||
return !Objects.equals(oldRecord.getClientId(), newRecord.getClientId()) ||
|
||||
!Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) ||
|
||||
!Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) ||
|
||||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
|
||||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName());
|
||||
}
|
||||
/**
|
||||
* 批量删除服务器收益方式配置
|
||||
|
||||
@@ -14,9 +14,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -172,32 +171,62 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
|
||||
// 批量查询已存在的接口名称
|
||||
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
||||
Set<String> existingNameSet = existingNames.stream()
|
||||
.map(AllInterfaceName::getInterfaceName)
|
||||
.collect(Collectors.toSet());
|
||||
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
|
||||
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
|
||||
|
||||
// 筛选出需要新增的接口名称
|
||||
List<AllInterfaceName> newNames = initialSwitchInfoDetails.stream()
|
||||
.filter(data -> !existingNameSet.contains(data.getName()))
|
||||
.map(data -> {
|
||||
AllInterfaceName name = new AllInterfaceName();
|
||||
name.setInterfaceName(data.getName());
|
||||
name.setClientId(data.getClientId());
|
||||
name.setResourceType("2");
|
||||
name.setDeviceSn(data.getServerSn());
|
||||
name.setNodeName(data.getServerName());
|
||||
name.setServerPort(data.getServerPort());
|
||||
name.setInterfaceDeviceType(data.getInterfaceDeviceType());
|
||||
name.setSwitchName(data.getSwitchName());
|
||||
name.setSwitchSn(data.getSwitchSn());
|
||||
return name;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
// 分类处理:新增列表 vs 更新列表
|
||||
List<AllInterfaceName> namesToInsert = new ArrayList<>();
|
||||
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
|
||||
|
||||
// 批量插入新接口名称
|
||||
if (!newNames.isEmpty()) {
|
||||
allInterfaceNameMapper.batchInsert(newNames);
|
||||
log.info("接口名称表-新增交换机接口名称数量:{}", newNames.size());
|
||||
initialSwitchInfoDetails.forEach(data -> {
|
||||
String name = data.getName();
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllInterfaceName record = new AllInterfaceName();
|
||||
record.setInterfaceName(name);
|
||||
record.setClientId(data.getClientId());
|
||||
record.setResourceType("2");
|
||||
record.setDeviceSn(data.getServerSn());
|
||||
record.setNodeName(data.getServerName());
|
||||
record.setServerPort(data.getServerPort());
|
||||
record.setInterfaceDeviceType(data.getInterfaceDeviceType());
|
||||
record.setSwitchName(data.getSwitchName());
|
||||
record.setSwitchSn(data.getSwitchSn());
|
||||
|
||||
// 判断是否需要更新
|
||||
if (existingNameMap.containsKey(name)) {
|
||||
AllInterfaceName existingRecord = existingNameMap.get(name);
|
||||
if (isRecordChanged(existingRecord, record)) {
|
||||
record.setId(existingRecord.getId()); // 保留原ID
|
||||
namesToUpdate.add(record);
|
||||
}
|
||||
} else {
|
||||
namesToInsert.add(record);
|
||||
}
|
||||
});
|
||||
|
||||
// 批量操作数据库
|
||||
if (!namesToInsert.isEmpty()) {
|
||||
allInterfaceNameMapper.batchInsert(namesToInsert);
|
||||
log.info("新增接口名称数量:{}", namesToInsert.size());
|
||||
}
|
||||
|
||||
if (!namesToUpdate.isEmpty()) {
|
||||
allInterfaceNameMapper.batchUpdate(namesToUpdate);
|
||||
log.info("更新接口名称数量:{}", namesToUpdate.size());
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:检查记录是否有变化
|
||||
private boolean isRecordChanged(AllInterfaceName oldRecord, AllInterfaceName newRecord) {
|
||||
return !Objects.equals(oldRecord.getClientId(), newRecord.getClientId()) ||
|
||||
!Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) ||
|
||||
!Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) ||
|
||||
!Objects.equals(oldRecord.getServerPort(), newRecord.getServerPort()) ||
|
||||
!Objects.equals(oldRecord.getInterfaceDeviceType(), newRecord.getInterfaceDeviceType()) ||
|
||||
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
|
||||
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,17 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 服务注册地址
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: ${spring.cloud.nacos.config.username}
|
||||
# password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# 配置中心地址
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -189,4 +189,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
group by switch_sn
|
||||
</select>
|
||||
<update id="batchUpdate">
|
||||
<foreach collection="list" item="item" separator=";">
|
||||
UPDATE all_interface_name
|
||||
SET
|
||||
business_code = #{item.businessCode},
|
||||
business_name = #{item.businessName},
|
||||
update_time = now(),
|
||||
client_id = #{item.clientId},
|
||||
device_sn = #{item.deviceSn},
|
||||
node_name = #{item.nodeName},
|
||||
server_port = #{item.serverPort},
|
||||
interface_device_type = #{item.interfaceDeviceType},
|
||||
switch_name = #{item.switchName},
|
||||
switch_sn = #{item.switchSn}
|
||||
WHERE id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.EpsMethodChangeRecordMapper">
|
||||
|
||||
|
||||
<resultMap type="EpsMethodChangeRecord" id="EpsMethodChangeRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="nodeName" column="node_name" />
|
||||
@@ -13,22 +13,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="creatBy" column="creat_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="revenueMethod" column="revenue_method" />
|
||||
<result property="trafficPort" column="traffic_port" />
|
||||
<result property="packageBandwidth" column="package_bandwidth" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="businessCode" column="business_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEpsMethodChangeRecordVo">
|
||||
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by from eps_method_change_record
|
||||
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by, revenue_method, traffic_port, package_bandwidth, business_name, business_code from eps_method_change_record
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
|
||||
<include refid="selectEpsMethodChangeRecordVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
|
||||
<if test="changeContent != null and changeContent != ''"> and change_content like concat('%', #{changeContent}, '%')</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</if>
|
||||
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
|
||||
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
|
||||
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectEpsMethodChangeRecordById" parameterType="Long" resultMap="EpsMethodChangeRecordResult">
|
||||
<include refid="selectEpsMethodChangeRecordVo"/>
|
||||
where id = #{id}
|
||||
@@ -45,7 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatBy != null">creat_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<if test="revenueMethod != null">revenue_method,</if>
|
||||
<if test="trafficPort != null">traffic_port,</if>
|
||||
<if test="packageBandwidth != null">package_bandwidth,</if>
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="businessCode != null">business_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="nodeName != null">#{nodeName},</if>
|
||||
@@ -55,7 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatBy != null">#{creatBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
<if test="revenueMethod != null">#{revenueMethod},</if>
|
||||
<if test="trafficPort != null">#{trafficPort},</if>
|
||||
<if test="packageBandwidth != null">#{packageBandwidth},</if>
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="businessCode != null">#{businessCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEpsMethodChangeRecord" parameterType="EpsMethodChangeRecord">
|
||||
@@ -68,6 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatBy != null">creat_by = #{creatBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
|
||||
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
|
||||
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="businessCode != null">business_code = #{businessCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@@ -77,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEpsMethodChangeRecordByIds" parameterType="String">
|
||||
delete from eps_method_change_record where id in
|
||||
delete from eps_method_change_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
|
||||
@@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="changed" column="changed" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEpsServerRevenueConfigVo">
|
||||
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time from eps_server_revenue_config
|
||||
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed from eps_server_revenue_config
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
|
||||
@@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="changed != null and changed != ''"> and changed = #{changed}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="changed != null">changed,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -83,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="changed != null">#{changed},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -102,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="changed != null">changed = #{changed},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -15,9 +15,15 @@ spring:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: ${spring.cloud.nacos.config.username}
|
||||
# password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
# server-addr: 172.16.15.103:8848
|
||||
# username: nacos
|
||||
# password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@@ -14,10 +14,14 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.16.15.103:8848
|
||||
username: ${spring.cloud.nacos.config.username}
|
||||
password: ${spring.cloud.nacos.config.password}
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
server-addr: 172.16.15.103:8848
|
||||
username: nacos
|
||||
password: nacos
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
Reference in New Issue
Block a user