有效-日数据逻辑开发,增加cors跨域过滤器
This commit is contained in:
@@ -13,11 +13,17 @@ spring:
|
|||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
# server-addr: 172.16.15.103:8848
|
||||||
|
# username: nacos
|
||||||
|
# password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
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:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
# server-addr: 172.16.15.103:8848
|
||||||
|
# username: nacos
|
||||||
|
# password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@@ -13,11 +13,17 @@ spring:
|
|||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
# 配置中心地址
|
||||||
|
# server-addr: 172.16.15.103:8848
|
||||||
|
# username: nacos
|
||||||
|
# password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@@ -14,10 +14,14 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 172.16.15.103:8848
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public class TableScheduleConfig {
|
|||||||
public void calculate95BandwidthDaily() {
|
public void calculate95BandwidthDaily() {
|
||||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||||
epsInitialTrafficDataService.calculate95BandwidthDaily(queryParam);
|
epsInitialTrafficDataService.calculate95BandwidthDaily(queryParam);
|
||||||
|
// 有效-95带宽值/日
|
||||||
|
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam);
|
||||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||||
epsInitialTrafficDataService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails);
|
epsInitialTrafficDataService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.ruoyi.system.domain;
|
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.annotation.Excel;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收益方式修改记录对象 eps_method_change_record
|
* 收益方式修改记录对象 eps_method_change_record
|
||||||
@@ -11,6 +12,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
|||||||
* @author gyt
|
* @author gyt
|
||||||
* @date 2025-08-15
|
* @date 2025-08-15
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class EpsMethodChangeRecord extends BaseEntity
|
public class EpsMethodChangeRecord extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -33,68 +35,23 @@ public class EpsMethodChangeRecord extends BaseEntity
|
|||||||
/** 创建人 */
|
/** 创建人 */
|
||||||
@Excel(name = "修改人")
|
@Excel(name = "修改人")
|
||||||
private String creatBy;
|
private String creatBy;
|
||||||
|
/** 收益方式(1.流量,2包端) */
|
||||||
|
private String revenueMethod;
|
||||||
|
|
||||||
public void setId(Long id)
|
/** 流量网口 */
|
||||||
{
|
private String trafficPort;
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
/** 包端带宽值 */
|
||||||
{
|
private BigDecimal packageBandwidth;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeName(String nodeName)
|
/** 业务名称 */
|
||||||
{
|
private String businessName;
|
||||||
this.nodeName = nodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeName()
|
/** 业务代码(12位) */
|
||||||
{
|
private String businessCode;
|
||||||
return nodeName;
|
/** 开始时间 */
|
||||||
}
|
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 startTime;
|
||||||
/** 结束时间 */
|
/** 结束时间 */
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
/** 业务是否有变化 */
|
||||||
|
private String changed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,10 @@ public interface AllInterfaceNameMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AllInterfaceName> getAllSwitchSn(AllInterfaceName interfaceName);
|
List<AllInterfaceName> getAllSwitchSn(AllInterfaceName interfaceName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量编辑
|
||||||
|
* @param records
|
||||||
|
*/
|
||||||
|
void batchUpdate(List<AllInterfaceName> records);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ public interface EpsInitialTrafficDataService {
|
|||||||
* @return 初始流量数据列表
|
* @return 初始流量数据列表
|
||||||
*/
|
*/
|
||||||
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData queryParam);
|
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData queryParam);
|
||||||
|
/**
|
||||||
|
* 计算95带宽值-有效/日
|
||||||
|
* @param queryParam 查询参数实体
|
||||||
|
* @return 流量数据列表
|
||||||
|
*/
|
||||||
|
void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam);
|
||||||
/**
|
/**
|
||||||
* 计算95带宽值
|
* 计算95带宽值
|
||||||
* @param queryParam 查询参数实体
|
* @param queryParam 查询参数实体
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.common.core.utils.DateUtils;
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
import com.ruoyi.system.domain.AllInterfaceName;
|
import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
import com.ruoyi.system.mapper.*;
|
||||||
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.service.EpsInitialTrafficDataService;
|
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||||
import com.ruoyi.system.util.TableRouterUtil;
|
import com.ruoyi.system.util.TableRouterUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -22,6 +16,8 @@ import java.math.RoundingMode;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.regex.Matcher;
|
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 Pattern SPEED_PATTERN = Pattern.compile("(\\d+\\.?\\d*)\\s*(\\S*)");
|
||||||
|
|
||||||
|
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
@Autowired
|
@Autowired
|
||||||
private EpsInitialTrafficDataMapper epsInitialTrafficDataMapper;
|
private EpsInitialTrafficDataMapper epsInitialTrafficDataMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -42,6 +40,10 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
|||||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
private AllInterfaceNameMapper allInterfaceNameMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
||||||
|
@Autowired
|
||||||
|
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||||
|
@Autowired
|
||||||
|
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||||
@Override
|
@Override
|
||||||
public void createNextMonthTables() {
|
public void createNextMonthTables() {
|
||||||
LocalDate nextMonth = LocalDate.now().plusMonths(1);
|
LocalDate nextMonth = LocalDate.now().plusMonths(1);
|
||||||
@@ -197,24 +199,111 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有业务变动的 计算有效95带宽值/日
|
||||||
|
* @param queryParam
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void calculate95BandwidthDaily(EpsInitialTrafficData queryParam) {
|
public void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam) {
|
||||||
Date now = DateUtils.getNowDate();
|
// 1. 获取所有设备SN列表
|
||||||
Calendar calendar = Calendar.getInstance();
|
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName());
|
||||||
calendar.add(Calendar.HOUR_OF_DAY, -24);
|
|
||||||
Date startDate = calendar.getTime();
|
// 2. 获取昨天的日期范围(北京时间)
|
||||||
// 格式化时间
|
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||||
String startTime = sdf.format(startDate);
|
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
|
||||||
String endTime = sdf.format(now);
|
|
||||||
|
// 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.setStartTime(startTime);
|
||||||
queryParam.setEndTime(endTime);
|
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");
|
queryParam.setRevenueMethod("1");
|
||||||
// 查询所有的服务器sn
|
// 查询所有的服务器sn
|
||||||
AllInterfaceName allInterfaceName = new AllInterfaceName();
|
AllInterfaceName allInterfaceName = new AllInterfaceName();
|
||||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(allInterfaceName);
|
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(allInterfaceName);
|
||||||
for (AllInterfaceName interfaceName : snList) {
|
for (AllInterfaceName interfaceName : snList) {
|
||||||
queryParam.setServiceSn(interfaceName.getDeviceSn());
|
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())) {
|
||||||
|
|
||||||
|
}else{
|
||||||
// 查询原始数据
|
// 查询原始数据
|
||||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||||
if(!dataList.isEmpty()){
|
if(!dataList.isEmpty()){
|
||||||
@@ -249,11 +338,12 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
|||||||
bandwidth.setBandwidthType("1");
|
bandwidth.setBandwidthType("1");
|
||||||
bandwidth.setBandwidthResult(dailyResult);
|
bandwidth.setBandwidthResult(dailyResult);
|
||||||
bandwidth.setBandwidth95Daily(dailyResult);
|
bandwidth.setBandwidth95Daily(dailyResult);
|
||||||
bandwidth.setCreateTime(startDate);
|
bandwidth.setCreateTime(DateUtils.parseDate(startTimeStr));
|
||||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam) {
|
public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam) {
|
||||||
Date now = DateUtils.getNowDate();
|
Date now = DateUtils.getNowDate();
|
||||||
@@ -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
|
* @param speedWithUnit
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,6 +92,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
|||||||
String revenueMethod = getMethodName(serverRevenueConfig.getRevenueMethod());
|
String revenueMethod = getMethodName(serverRevenueConfig.getRevenueMethod());
|
||||||
//现在的收益方式
|
//现在的收益方式
|
||||||
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
|
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
|
||||||
|
if(serverRevenueConfig.getBusinessCode() != null){
|
||||||
|
if(!serverRevenueConfig.getBusinessCode().equals(epsServerRevenueConfig.getBusinessCode())){
|
||||||
|
epsServerRevenueConfig.setChanged("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
// 修改条数
|
// 修改条数
|
||||||
int rows = epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
|
int rows = epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
|
||||||
if(rows>=0){
|
if(rows>=0){
|
||||||
@@ -128,6 +131,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
|||||||
",带宽值设置为"+epsServerRevenueConfig.getPackageBandwidth()+"Mbps,"+"业务为"+epsServerRevenueConfig.getBusinessName();
|
",带宽值设置为"+epsServerRevenueConfig.getPackageBandwidth()+"Mbps,"+"业务为"+epsServerRevenueConfig.getBusinessName();
|
||||||
}
|
}
|
||||||
changeRecord.setChangeContent(content);
|
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);
|
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||||
}
|
}
|
||||||
@@ -210,31 +218,60 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
|
|||||||
|
|
||||||
// 批量查询已存在的接口名称
|
// 批量查询已存在的接口名称
|
||||||
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
||||||
Set<String> existingNameSet = existingNames.stream()
|
// 转为 Map<接口名称, 数据库记录> 便于快速查找
|
||||||
.map(AllInterfaceName::getInterfaceName)
|
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
|
||||||
|
|
||||||
// 筛选出需要新增的接口名称
|
// 分类处理:新增列表 vs 更新列表
|
||||||
List<AllInterfaceName> newNames = trafficDataList.stream()
|
List<AllInterfaceName> namesToInsert = new ArrayList<>();
|
||||||
.filter(data -> !existingNameSet.contains(data.getName()))
|
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
|
||||||
.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());
|
|
||||||
|
|
||||||
// 批量插入新接口名称
|
trafficDataList.forEach(data -> {
|
||||||
if (!newNames.isEmpty()) {
|
String name = data.getName();
|
||||||
allInterfaceNameMapper.batchInsert(newNames);
|
if (StringUtils.isBlank(name)) {
|
||||||
log.info("接口名称表-新增接口名称数量:{}", newNames.size());
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,32 +171,62 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
|
|
||||||
// 批量查询已存在的接口名称
|
// 批量查询已存在的接口名称
|
||||||
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames);
|
||||||
Set<String> existingNameSet = existingNames.stream()
|
Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
|
||||||
.map(AllInterfaceName::getInterfaceName)
|
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity()));
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
// 筛选出需要新增的接口名称
|
// 分类处理:新增列表 vs 更新列表
|
||||||
List<AllInterfaceName> newNames = initialSwitchInfoDetails.stream()
|
List<AllInterfaceName> namesToInsert = new ArrayList<>();
|
||||||
.filter(data -> !existingNameSet.contains(data.getName()))
|
List<AllInterfaceName> namesToUpdate = new ArrayList<>();
|
||||||
.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());
|
|
||||||
|
|
||||||
// 批量插入新接口名称
|
initialSwitchInfoDetails.forEach(data -> {
|
||||||
if (!newNames.isEmpty()) {
|
String name = data.getName();
|
||||||
allInterfaceNameMapper.batchInsert(newNames);
|
if (StringUtils.isBlank(name)) {
|
||||||
log.info("接口名称表-新增交换机接口名称数量:{}", newNames.size());
|
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:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
# 配置中心地址
|
||||||
|
# server-addr: 172.16.15.103:8848
|
||||||
|
# username: nacos
|
||||||
|
# password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@@ -189,4 +189,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
group by switch_sn
|
group by switch_sn
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
@@ -13,10 +13,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="creatBy" column="creat_by" />
|
<result property="creatBy" column="creat_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<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>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEpsMethodChangeRecordVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
|
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
|
||||||
@@ -26,7 +31,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="changeContent != null and changeContent != ''"> and change_content like concat('%', #{changeContent}, '%')</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="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||||
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</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>
|
</where>
|
||||||
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEpsMethodChangeRecordById" parameterType="Long" resultMap="EpsMethodChangeRecordResult">
|
<select id="selectEpsMethodChangeRecordById" parameterType="Long" resultMap="EpsMethodChangeRecordResult">
|
||||||
@@ -45,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="creatBy != null">creat_by,</if>
|
<if test="creatBy != null">creat_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<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>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
@@ -55,6 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="creatBy != null">#{creatBy},</if>
|
<if test="creatBy != null">#{creatBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<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>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -68,6 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="creatBy != null">creat_by = #{creatBy},</if>
|
<if test="creatBy != null">creat_by = #{creatBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</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>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="changed" column="changed" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEpsServerRevenueConfigVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
|
<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="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
|
||||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</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="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||||
|
<if test="changed != null and changed != ''"> and changed = #{changed}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="changed != null">changed,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">#{id},</if>
|
<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="createBy != null">#{createBy},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="changed != null">#{changed},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -102,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="changed != null">changed = #{changed},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -15,9 +15,15 @@ spring:
|
|||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 127.0.0.1:8848
|
||||||
|
# server-addr: 172.16.15.103:8848
|
||||||
|
# username: nacos
|
||||||
|
# password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@@ -14,10 +14,14 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
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:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 172.16.15.103:8848
|
||||||
|
username: nacos
|
||||||
|
password: nacos
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
Reference in New Issue
Block a user