Compare commits

..

20 Commits

Author SHA1 Message Date
1cd3283ba5 1.迁移接口,简化部署模块 2026-07-02 14:11:49 +08:00
ce9b2b62d9 1.调整适配辽宁现场新能源场站 2026-07-01 15:14:57 +08:00
wr
687f878b5f 1.解决有功功率趋势统计调用ataprocessboot接口改造 2026-07-01 11:27:46 +08:00
764a7b1953 1.调整适配辽宁现场新能源场站 2026-07-01 10:28:50 +08:00
xy
26fa401acb Merge remote-tracking branch 'origin/main' 2026-06-29 11:44:49 +08:00
xy
88a99dbe9c fix(sys-dic-tree): 修复字典树查询状态过滤问题
- 在字典树查询中添加状态过滤条件 a.status = 0
- 确保只返回状态为可用的数据记录
- 修复了可能导致无效数据被查询到的逻辑缺陷
2026-06-29 11:44:38 +08:00
ae14d9a820 1.调整适配辽宁现场新能源场站 2026-06-29 10:38:13 +08:00
xy
709262c2b4 fix(auth): 解决非手机号注册用户查询异常及自动登录接口配置问题
- 在AppInfoSetController中添加空值检查,抛出业务异常提示非手机号注册用户需联系管理员
- 修改AuthController中自动登录接口为POST方法并更新相关参数配置
- 更新用户权限类型参数验证范围从0-2扩展到0-3以支持更多权限类型
2026-06-26 15:22:56 +08:00
e2e7669d47 1.限值负序电流调整 2026-06-26 11:52:29 +08:00
83907cd3ee 1.bug调整 2026-06-25 18:27:44 +08:00
xy
5a0e990f90 refactor(service): 移除线路治理状态设置逻辑
- 注释掉线路治理状态的条件判断代码
- 删除未治理和已治理状态的设置逻辑
- 保留其他线路信息设置功能
2026-06-25 15:52:50 +08:00
f00af22b33 1.台账增加默认排序
2.增加场站/用户监测规模接口
2026-06-23 21:30:27 +08:00
xy
7f13d3576d feat(user): 添加手机号重复注册检查并调整默认消息设置
- 添加手机号唯一性验证逻辑,防止重复注册
- 新增 REGISTER_PHONE_REPEAT 业务异常枚举
- 调整新用户默认消息配置:harmonicInfo从1改为0
- 调整新用户默认消息配置:runInfo从1改为0
- 调整新用户默认消息配置:alarmInfo从1改为0
2026-06-22 19:58:41 +08:00
xy
c4f5d1b543 refactor(dict): 重构字典类型查询方法参数类型
- 将 queryDictType 方法的 lineId 参数从 String 类型改为 Integer 类型
- 更新接口定义中的参数类型声明
- 修改控制器层方法签名以匹配新的参数类型
- 调整业务逻辑中对参数的处理方式,从字符串末尾字符判断改为整数比较
- 移除不再需要的 SysDicTreePOMapper 导入
- 更新 API 文档注解中的参数描述信息
2026-06-22 13:45:54 +08:00
xy
6451cfeb88 refactor(gateway): 移除CS系统应用版本获取接口配置
- 移除 /cs-system-boot/appVersion/getLastData 接口路径配置
- 清理相关的历史数据分析接口配置项
- 优化网关路由规则避免不必要的路径暴露
2026-06-18 15:44:52 +08:00
xy
6eedee7783 fix(user): 修复用户注册逻辑并更新Redis键格式
- 修改设备模板和监测点位置的Redis键格式,统一添加冒号后缀
- 移除未使用的ResponseEntity导入
- 简化用户注册流程,移除重复的手机号验证逻辑
- 在网关配置中添加新的白名单接口路径
2026-06-18 15:29:05 +08:00
hzj
21fe98db49 修改生成报告画图采样率 2026-06-18 10:21:07 +08:00
hzj
bf9779c06e 暂态原因计算问题 2026-06-17 16:06:29 +08:00
cdf
368103cad5 Merge remote-tracking branch 'origin/main' 2026-06-17 14:21:17 +08:00
cdf
507a7f7a09 辽宁CAS统一认证兼容 2026-06-17 14:19:52 +08:00
57 changed files with 1616 additions and 730 deletions

View File

@@ -129,10 +129,10 @@ public class EventRelevantAnalysisController extends BaseController {
@PostMapping("/updateEventToAss") @PostMapping("/updateEventToAss")
@ApiOperation("把暂降事件添加到指定事件中去") @ApiOperation("把暂降事件添加到指定事件中去")
public HttpResult<Page<AdvanceEventDetailVO>> updateEventToAss(@RequestBody Map<String,Object> map){ public HttpResult<Page<AdvanceEventDetailVO>> updateEventToAss(@RequestBody Map<String,Object> map){
String methodDescribe = getMethodDescribe("updateEventToAss");
if(!map.containsKey("eventId") || !map.containsKey("assId")){ if(!map.containsKey("eventId") || !map.containsKey("assId")){
throw new BusinessException("参数异常"); throw new BusinessException("参数异常");
} }
String methodDescribe = getMethodDescribe("updateEventToAss");
List<String> eventIds = (List<String>) map.get("eventId"); List<String> eventIds = (List<String>) map.get("eventId");
if(CollectionUtil.isEmpty(eventIds)){ if(CollectionUtil.isEmpty(eventIds)){
throw new BusinessException("暂降事件不可为空"); throw new BusinessException("暂降事件不可为空");

View File

@@ -25,6 +25,8 @@ import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* @author hongawen * @author hongawen
@@ -42,9 +44,13 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final Lock lock = new ReentrantLock();
@Override @Override
public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) { public EventAnalysisDTO analysisCauseAndType(EventAnalysisDTO eventAnalysis) {
//由于计算原因是异步操作这里需要加锁不然JNI调用ddl文件会存在内存Invalid memory access
lock.lock();
try {
WaveDataDTO waveDataDTO; WaveDataDTO waveDataDTO;
String waveName = eventAnalysis.getWaveName(); String waveName = eventAnalysis.getWaveName();
String wlFilePath = eventAnalysis.getWlFilePath(); String wlFilePath = eventAnalysis.getWlFilePath();
@@ -181,6 +187,9 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
} }
System.out.println("暂降原因分析完毕==============="); System.out.println("暂降原因分析完毕===============");
System.out.println("cause:" + eventAnalysis); System.out.println("cause:" + eventAnalysis);
} finally {
lock.unlock(); // 释放锁
}
return eventAnalysis; return eventAnalysis;
} }

View File

@@ -177,12 +177,6 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
} }
disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date); disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
@@ -223,231 +217,12 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
relevantLogMapper.insert(entityPqsRelevance); relevantLogMapper.insert(entityPqsRelevance);
log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + ""); log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "");
} }
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void processEvents(LocalDateTime startTime, LocalDateTime endTime) {
//
// TimeInterval timeInterval = new TimeInterval();
//
//
// Map<String, Map<String, Integer>> nodeSort = new HashMap<>();
// Map<String, EntityMtrans> entityMtransMap = getNodeInfo();
//
//
//
//
//
// for (Map.Entry<String, Map<String, Integer>> m : nodeSort) {
// List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
// Set<Map.Entry<String, Integer>> mapValue = m.getValue().entrySet();
// FinalData.NODE_NUM = m.getValue().size();
//
// for (Map.Entry<String, Integer> mm : mapValue) {
// for (int i = 0; i < entityGroupEvtDatas.length; i++) {
// if (entityGroupEvtDatas[i].getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtDatas[i].getSagReason())) {
// entityGroupEvtDatas[i].setNode(mm.getValue());
// list.add(entityGroupEvtDatas[i]);
// }
// }
//
// // 筛选不在矩阵中的事件id
// Iterator<EntityGroupEvtData> iterator = list3.iterator();
// while (iterator.hasNext()) {
// EntityGroupEvtData entityGroupEvtData = iterator.next();
//
// if (entityGroupEvtData.getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtData.getSagReason())) {
// iterator.remove();
// }
// }
// }
//
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
// Collections.sort(list);
// list.toArray(entityGroupEvtData);
//
// for (Map.Entry<String, JSONObject> mEntry : setMtrans) {
// if (mEntry.getKey().equals(m.getKey())) {
// *//**//********************************************************************
// * 算法最多处理1000条数据超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
// *********************************************************************//**//*
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
//
// for (int i = 0; i < circulation; i++) {
// int to = 0;
//
// if (i == circulation - 1) {
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
// ? entityGroupEvtData.length
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
// } else {
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
// }
//
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
// i * FinalData.MAX_EVT_NUM, to);
// JSONObject entityMtrans = mEntry.getValue();
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, (EntityMtrans) JSONObject.toBean(entityMtrans, EntityMtrans.class));
// // 处理分析结果
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
// }
// }
// }
// }
//
//
// DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
// if (Objects.isNull(dictData)) {
// throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
// }
//
//
// LocalDateTime date = LocalDateTime.now();
// HandleEvent handleEvent = new HandleEvent();
// // 分析的事件进行处理
// List<EntityGroupEvtData> baseList = handleEvent.getData(startTime, endTime);
// if (CollectionUtil.isEmpty(baseList)) {
// throw new BusinessException("当前时间段暂无可分析事件");
// }
//
// // 传入的处理事件根据物理隔绝进行分组
//
// List<EntityLogic> strategyList = relevantLogMapper.getLogic();
//
// if (CollectionUtil.isNotEmpty(strategyList)) {
// List<SagEvent> listSagEvent = new ArrayList<>();
// List<EventAssObj> listEventAssObj = new ArrayList<>();
//
// Map<String, List<String>> strategyToBusBarMap = new HashMap<>(32);
//
// Map<String, EntityMtrans> mapRedis = new HashMap<>(32);
//
// Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
// strategyMap.forEach((key, list) -> {
// List<String> before = list.stream().map(EntityLogic::getNodeBefore).distinct().collect(Collectors.toList());
// List<String> after = list.stream().map(EntityLogic::getNodeNext).distinct().collect(Collectors.toList());
// before.addAll(after);
// before = before.stream().distinct().collect(Collectors.toList());
// strategyToBusBarMap.put(key, before);
//
// FinalData.NODE_NUM = before.size();
// EntityMtrans entityMtrans = new EntityMtrans();
// handleEvent.create_matrixcata(list, entityMtrans);
//
// mapRedis.put(key, entityMtrans);
// });
//
// strategyToBusBarMap.forEach((lastKey, lastVal) -> {
// int index = 1;
// List<EntityGroupEvtData> list = new ArrayList<>();
// for (EntityGroupEvtData entityGroupEvtData : baseList) {
// if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
// entityGroupEvtData.setNode(index++);
// list.add(entityGroupEvtData);
// }
// }
//
// baseList.removeIf(entityGroupEvtData -> lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
//
//
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
// Collections.sort(list);
// list.toArray(entityGroupEvtData);
//
// mapRedis.forEach((mKey, mVal) -> {
// if (mKey.equals(lastKey)) {
// //算法最多处理1000条数据超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
//
// for (int i = 0; i < circulation; i++) {
// int to;
// if (i == circulation - 1) {
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
// ? entityGroupEvtData.length
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
// } else {
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
// }
//
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
// i * FinalData.MAX_EVT_NUM, to);
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, mVal);
// // 处理分析结果
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
// }
// }
// });
//
// });
//
//
//
// //事件ID不在矩阵中结果集为基础以时标为标准进行归集处理 注意:三相与(单相/两相)互斥
//
// disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
//
//
// int listSize = listEventAssObj.size();
// int toIndex = 1000;
// for (int i = 0; i < listSize; i += 1000) {
// //作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
// if (i + 1000 > listSize) {
// toIndex = listSize - i;
// }
// //分割lst
// List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
// //写入添加方法,需要写你的新增方法把newList分切后的数据新增进入数据库。
// rmpEventDetailAssMapper.insertEventAssData(newList);
// }
//
// List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
// for (int i = 0; i < listSagEvent.size(); i++) {
// RmpEventDetailPO rmp = new RmpEventDetailPO();
// rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
// rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
// rmp.setDealTime(listSagEvent.get(i).getDealTime());
// eventUpdateList.add(rmp);
// if ((i + 1) % 1000 == 0) {
// this.updateBatchById(eventUpdateList);
// eventUpdateList.clear();
// } else if (i == listSagEvent.size() - 1) {
// this.updateBatchById(eventUpdateList);
// }
// }
//
// // 增加策略记录
// String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
// PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
// entityPqsRelevance.setContentDes(describe);
// entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
// entityPqsRelevance.setTimeId(date);
// relevantLogMapper.insert(entityPqsRelevance);
//
// } else {
// throw new BusinessException("当前无变压器策略,请先配置策略");
// }
//
// log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
// }
@Override @Override
public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) { public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) {
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData(); List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
@@ -493,6 +268,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
} }
/** /**
* 四舍五入保留两位小数 * 四舍五入保留两位小数
*/ */
@@ -504,6 +280,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
//保留2位小数 //保留2位小数
return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
} }
@Override @Override
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) { public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime()); List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
@@ -620,6 +397,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
.in(RmpEventDetailPO::getEventId, eventId); .in(RmpEventDetailPO::getEventId, eventId);
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO(); RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
rmpEventDetailPO.setEventassIndex(assId); rmpEventDetailPO.setEventassIndex(assId);
rmpEventDetailPO.setDealTime(LocalDateTime.now());
eventAdvanceMapper.update(rmpEventDetailPO, lambdaUpdateWrapper); eventAdvanceMapper.update(rmpEventDetailPO, lambdaUpdateWrapper);
return true; return true;
} }

View File

@@ -66,6 +66,13 @@
<artifactId>common-oss</artifactId> <artifactId>common-oss</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<!--辽宁调度现场单点登录-->
<dependency>
<groupId>com.sgcc.epri.auth</groupId>
<artifactId>sso-client-base</artifactId>
<version>2.1.1 </version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -0,0 +1,26 @@
package com.njcn.auth.config;
/**
* pqs
*
* @author cdf
* @date 2026/6/8
*/
import com.sgcc.epri.auth.config.EnableSSOClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
/**
* 仅控制 SSO 客户端开关,不影响任何其他功能
*/
@Configuration
@ConditionalOnProperty(
prefix = "cas.client", // 配置前缀
name = "enabled", // 配置项名称
havingValue = "true", // 值为true才生效
matchIfMissing = false // 不配置默认关闭
)
@EnableSSOClient
public class LnSsoClientConfig {
}

View File

@@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http http
.authorizeRequests() .authorizeRequests()
.antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/judgeToken/heBei","/oauth/autoLogin").permitAll() .antMatchers("/oauth/getPublicKey","/oauth/logout","/auth/getImgCode","/judgeToken/guangZhou","/judgeToken/heBei","/oauth/autoLogin","/oauth/lnLogin","/oauth/lnCheck","/oauth/lnRefreshToken").permitAll()
// @link https://gitee.com/xiaoym/knife4j/issues/I1Q5X6 (接口文档knife4j需要放行的规则) // @link https://gitee.com/xiaoym/knife4j/issues/I1Q5X6 (接口文档knife4j需要放行的规则)
.antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll() .antMatchers("/webjars/**","/doc.html","/swagger-resources/**","/v2/api-docs").permitAll()
.anyRequest().authenticated() .anyRequest().authenticated()

View File

@@ -25,13 +25,17 @@ import com.njcn.user.pojo.po.UserStrategy;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.RequestUtil; import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.RestTemplateUtil; import com.njcn.web.utils.RestTemplateUtil;
import com.sgcc.epri.auth.session.HttpSessionManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint; import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint;
import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException;
@@ -39,6 +43,10 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.security.KeyPair; import java.security.KeyPair;
import java.security.Principal; import java.security.Principal;
@@ -55,7 +63,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/oauth") @RequestMapping("/oauth")
@AllArgsConstructor @RequiredArgsConstructor
public class AuthController extends BaseController { public class AuthController extends BaseController {
@@ -71,6 +79,11 @@ public class AuthController extends BaseController {
private final UserTokenService userTokenService; private final UserTokenService userTokenService;
@Value("${cas.redirect-url:http://10.21.30.11:8088/#/login?flag=1}")
private String redirectUrl;
private String UsernamePrefix = "CAS_";
@ApiIgnore @ApiIgnore
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.AUTHENTICATE) @OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.AUTHENTICATE)
@@ -91,7 +104,6 @@ public class AuthController extends BaseController {
String methodDescribe = getMethodDescribe("postAccessToken"); String methodDescribe = getMethodDescribe("postAccessToken");
String username = parameters.get(SecurityConstants.USERNAME); String username = parameters.get(SecurityConstants.USERNAME);
String grantType = parameters.get(SecurityConstants.GRANT_TYPE); String grantType = parameters.get(SecurityConstants.GRANT_TYPE);
if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA) || grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) { if (grantType.equalsIgnoreCase(SecurityConstants.GRANT_CAPTCHA) || grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
username = DesUtils.aesDecrypt(username); username = DesUtils.aesDecrypt(username);
@@ -143,7 +155,7 @@ public class AuthController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.LOGOUT) @OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.LOGOUT)
@ApiOperation("用户登出系统") @ApiOperation("用户登出系统")
@DeleteMapping("/logout") @DeleteMapping("/logout")
public HttpResult<Object> logout() { public HttpResult<Object> logout(HttpServletRequest request, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("logout"); String methodDescribe = getMethodDescribe("logout");
String userIndex = RequestUtil.getUserIndex(); String userIndex = RequestUtil.getUserIndex();
String username = RequestUtil.getUsername(); String username = RequestUtil.getUsername();
@@ -165,6 +177,24 @@ public class AuthController extends BaseController {
long lifeTime = Math.abs(refreshTokenExpire.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); long lifeTime = Math.abs(refreshTokenExpire.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")));
redisUtil.saveByKeyWithExpire(blackUserKey, blackUsers, lifeTime); redisUtil.saveByKeyWithExpire(blackUserKey, blackUsers, lifeTime);
} }
// 以下代码是辽宁登出代码,关键:使 Session 失效
request.getSession().invalidate();
// 清除 JSESSIONID
Cookie jsessionidCookie = new Cookie("JSESSIONID", null);
jsessionidCookie.setMaxAge(0);
jsessionidCookie.setPath("/");
response.addCookie(jsessionidCookie);
// 清除 loginUser Cookie关键
Cookie loginUserCookie = new Cookie("loginUser", null);
loginUserCookie.setMaxAge(0);
loginUserCookie.setPath("/");
response.addCookie(loginUserCookie);
log.info("登出成功。。。。。。。。。。。。。。。。");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@@ -191,7 +221,7 @@ public class AuthController extends BaseController {
@ApiIgnore @ApiIgnore
public HttpResult<Object> autoLogin(@RequestParam String phone) { public HttpResult<Object> autoLogin(@RequestParam String phone) {
String methodDescribe = getMethodDescribe("autoLogin"); String methodDescribe = getMethodDescribe("autoLogin");
String userUrl = "http://127.0.0.1:10214/oauth/token"; String userUrl = "http://127.0.0.1:20214/oauth/token";
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(userUrl) UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(userUrl)
.queryParam("grant_type", "sms_code") .queryParam("grant_type", "sms_code")
.queryParam("client_id", "njcnapp") .queryParam("client_id", "njcnapp")
@@ -202,4 +232,134 @@ public class AuthController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Objects.requireNonNull(RestTemplateUtil.post(uri, HttpResult.class).getBody()).getData(), methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Objects.requireNonNull(RestTemplateUtil.post(uri, HttpResult.class).getBody()).getData(), methodDescribe);
} }
/**
* 【电科院CAS调控云单点登录适配】
* 这个只用来匹配
*/
@ApiIgnore
@GetMapping("/lnLogin")
@ApiOperation("获取ln系统用户token")
public HttpResult<Object> lnLogin(@RequestParam String clientId, @RequestParam String clientSecret, HttpServletRequest request, HttpServletResponse response) throws HttpRequestMethodNotSupportedException {
log.info("进入lnLogin++++++++++++++++++");
String methodDescribe = getMethodDescribe("lnLogin");
// 读取CAS信息
String userName = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.AUTH_USER_KEY));
String userId = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.USER_ID_KEY));
String owner = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.USER_OWNER));
String name = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.USER_NAME_CHN));
String employeeId = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.USER_EMPLOYEE_ID));
log.info("userName:{}", userName);
log.info("userId:{}", userId);
log.info("owner:{}", owner);
log.info("name:{}", name);
log.info("employeeId:{}", employeeId);
if ("null".equals(userName)) {
throw new BusinessException(UserResponseEnum.LN_AUTH_ERROR);
}
// 2. 【关键】用户名前面加上"CAS_"前缀让UserDetailsService识别
String casUsername = userName;
// 2. 直接构造 OAuth2 必要参数(跳过所有密码/加密校验)
Map<String, String> parameters = new HashMap<>();
parameters.put("grant_type", "password"); // 固定密码模式
parameters.put("client_id", clientId); // 你的客户端ID
parameters.put("client_secret", clientSecret); // 你的客户端秘钥
parameters.put("username", userName); // 统一认证传过来的用户名
parameters.put("password", "@#001njcnpqs");
// 3. 直接调用 OAuth2 生成 Token跳过所有登录校验
Authentication authentication = new UsernamePasswordAuthenticationToken(
clientId, clientSecret, Collections.emptyList()
);
OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(authentication, parameters).getBody();
// 获取过期时间(秒数)
int expiresIn = oAuth2AccessToken.getExpiresIn();
log.info("token过期时间: {} 秒", expiresIn);
log.info("token过期时间: {} 分钟", expiresIn / 60);
log.info("token过期时间: {} 小时", expiresIn / 3600);
log.info("====== 免密登录成功返回token给前端 ======");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, oAuth2AccessToken, methodDescribe);
}
/**
* 重点:
* 这个接口 不加 白名单
* 访问它 → 自动跳CAS → 登录成功 → 重定向到登录页
*/
@GetMapping("/lnCheck")
@ApiOperation("检查CAS是否登录")
public void lnToken(HttpServletRequest request, HttpServletResponse response) throws IOException {
log.info("进入lnCheck。。。。");
response.sendRedirect(redirectUrl);
}
/**
*/
@GetMapping("/lnRefreshToken")
@ApiOperation("刷新token")
public HttpResult<Object> lnRefreshToken(
@RequestParam String refreshToken,
@RequestParam String clientId,
@RequestParam String clientSecret,
HttpServletRequest request,
HttpServletResponse response) throws HttpRequestMethodNotSupportedException {
log.info("进入lnRefreshToken开始刷新token");
String methodDescribe = getMethodDescribe("lnRefreshToken");
// ========== 【前置优先校验CAS会话是否过期】 ==========
String userName = String.valueOf(HttpSessionManager.getAttribute(request, HttpSessionManager.AUTH_USER_KEY));
if ("null".equals(userName)) {
log.error("CAS会话已过期跳转登录页");
throw new BusinessException(UserResponseEnum.LN_AUTH_ERROR);
}
// 1. 先尝试用refresh_token正常刷新
Map<String, String> parameters = new HashMap<>();
parameters.put("grant_type", "refresh_token");
parameters.put("refresh_token", refreshToken);
parameters.put("client_id", clientId);
parameters.put("client_secret", clientSecret);
Authentication authentication = new UsernamePasswordAuthenticationToken(
clientId, clientSecret, Collections.emptyList()
);
try {
OAuth2AccessToken newAccessToken = tokenEndpoint.postAccessToken(authentication, parameters).getBody();
log.info("refresh_token刷新成功");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, newAccessToken, methodDescribe);
} catch (Exception e) {
log.warn("refresh_token刷新失败尝试回退到CAS会话重新签发token", e);
}
// 3. CAS会话有效重新签发token等同于重新登录
log.info("CAS会话有效为用户[{}]重新签发token", userName);
String casUsername = userName;
Map<String, String> reLoginParams = new HashMap<>();
reLoginParams.put("grant_type", "password");
reLoginParams.put("client_id", clientId);
reLoginParams.put("client_secret", clientSecret);
reLoginParams.put("username", userName);
reLoginParams.put("password", "@#001njcnpqs");
Authentication reAuth = new UsernamePasswordAuthenticationToken(
clientId, clientSecret, Collections.emptyList()
);
OAuth2AccessToken oAuth2AccessToken = tokenEndpoint.postAccessToken(reAuth, reLoginParams).getBody();
log.info("CAS回退重签token成功userName:{}", userName);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, oAuth2AccessToken, methodDescribe);
}
} }

View File

@@ -55,3 +55,22 @@ mybatis-plus:
mqtt: mqtt:
client-id: @artifactId@${random.value} client-id: @artifactId@${random.value}
cas:
client:
# true 开启 false 关闭
enabled: false
redirect-url: http://PQMonitoring.dcloud.ln.dc.sgcc.com.cn/#/login?flag=1
server-url-prefix: http://privilege-epri.dcloud.ln.dc.sgcc.com.cn/cas
server-login-url: http://privilege-epri.dcloud.ln.dc.sgcc.com.cn/cas/login
client-host-url: http://PQMonitoring.dcloud.ln.dc.sgcc.com.cn:80
validation-type: CAS
#白名单设置
# /oauth/lnLogin$|/pqs-auth/oauth/lnLogin|/oauth/lnRefreshToken$|/pqs-auth/oauth/lnRefreshToken
sso:
whiteList: .*/oauth/lnLogin.*|.*/pqs-auth/oauth/lnLogin.*|.*/oauth/lnRefreshToken.*|.*/pqs-auth/oauth/lnRefreshToken.*

View File

@@ -13,7 +13,7 @@ public interface AppRedisKey {
/** /**
* 设备模板前缀 * 设备模板前缀
*/ */
String MODEL = "MODEL"; String MODEL = "MODEL:";
/** /**
@@ -39,7 +39,7 @@ public interface AppRedisKey {
/** /**
* 监测点位置数据 * 监测点位置数据
*/ */
String LINE_POSITION = "LINEPOSITION"; String LINE_POSITION = "LINEPOSITION:";
/** /**
* rocketMQ消费key * rocketMQ消费key

View File

@@ -53,7 +53,7 @@ public class COverlimitUtil {
uHarm(overlimit, voltageLevel); uHarm(overlimit, voltageLevel);
threeVoltageUnbalance(overlimit); threeVoltageUnbalance(overlimit);
interharmonicCurrent(overlimit, voltageLevel); interharmonicCurrent(overlimit, voltageLevel);
negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
//谐波电流限值 //谐波电流限值
int lineType; int lineType;
if (voltageLevel >= DicDataEnum.KV220.getValue()) { if (voltageLevel >= DicDataEnum.KV220.getValue()) {
@@ -72,7 +72,6 @@ public class COverlimitUtil {
} }
// 1. 配网 lineType = 1 // 1. 配网 lineType = 1
if (Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) { if (Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
overlimit.setINeg(PLACEHOLDER);
Float[] iHarmTem = new Float[49]; Float[] iHarmTem = new Float[49];
// 配网-电网侧(powerFlag=0) / 配网Ⅱ类:直接基准限值,不折算 // 配网-电网侧(powerFlag=0) / 配网Ⅱ类:直接基准限值,不折算
@@ -103,8 +102,7 @@ public class COverlimitUtil {
else { else {
iHarm(overlimit, voltageLevel, pc, dc, sc); iHarm(overlimit, voltageLevel, pc, dc, sc);
} }
// 主网统一计算负序电流
negativeSequenceCurrent(overlimit, voltageLevel, sc);
} }
return overlimit; return overlimit;
} }

View File

@@ -111,7 +111,6 @@ public class LineDetail{
/** /**
* 监测点对象名称 * 监测点对象名称
*/ */
@Deprecated
private String objName; private String objName;
/** /**
@@ -171,19 +170,16 @@ public class LineDetail{
/** /**
* 监测点拥有者 * 监测点拥有者
*/ */
@Deprecated
private String owner; private String owner;
/** /**
* 拥有者职务 * 拥有者职务
*/ */
@Deprecated
private String ownerDuty; private String ownerDuty;
/** /**
* 拥有者联系方式 * 拥有者联系方式
*/ */
@Deprecated
private String ownerTel; private String ownerTel;
/** /**

View File

@@ -90,7 +90,7 @@ public class LineIntegrityDataController extends BaseController {
String methodDescribe = getMethodDescribe("getIntegrityByLineIds"); String methodDescribe = getMethodDescribe("getIntegrityByLineIds");
if(CollUtil.isNotEmpty(lineIds)){ if(CollUtil.isNotEmpty(lineIds)){
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>(); QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
queryWrapper.select("sum(real_time) as realTime,sum(due_time) as dueTime,sum(real_time)/sum(due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index"); queryWrapper.select("sum(real_time) as realTime,sum(due_time) as dueTime,avg(real_time*1.0/due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index");
List<RStatIntegrityD> rStatIntegrityDList = irStatIntegrityDService.list(queryWrapper); List<RStatIntegrityD> rStatIntegrityDList = irStatIntegrityDService.list(queryWrapper);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatIntegrityDList, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatIntegrityDList, methodDescribe);
} }

View File

@@ -1504,9 +1504,12 @@
<select id="getCustomDetailByLineId" resultType="map"> <select id="getCustomDetailByLineId" resultType="map">
SELECT line.id AS lineId, SELECT line.id AS lineId,
CONCAT(CONCAT(CONCAT(sub.NAME, '_'), vo.NAME), CONCAT('_', line.NAME)) AS lineName, CASE
CONCAT(CONCAT(COALESCE(detail.pt1, 'N/A'), ':'), COALESCE(detail.pt2, 'N/A')) AS pt, WHEN detail.obj_id IS NOT NULL AND detail.obj_id != '' THEN CONCAT(obj.PROJECT_NAME,'_', line.NAME)
CONCAT(CONCAT(COALESCE(detail.ct1, 'N/A'), ':'), COALESCE(detail.ct2, 'N/A')) AS ct, ELSE CONCAT(sub.NAME, '_', vo.NAME, '_', line.NAME)
END AS lineName,
CONCAT(detail.pt1, ':', detail.pt2) AS pt,
CONCAT(detail.ct1, ':', detail.ct2) AS ct,
detail.Dev_Capacity AS Dev_Capacity, detail.Dev_Capacity AS Dev_Capacity,
detail.Short_Capacity AS Short_Capacity, detail.Short_Capacity AS Short_Capacity,
detail.Standard_Capacity AS Standard_Capacity, detail.Standard_Capacity AS Standard_Capacity,
@@ -1521,6 +1524,7 @@
JOIN pq_device pqd ON pqd.id = dev.id JOIN pq_device pqd ON pqd.id = dev.id
JOIN sys_dict_data dic ON vg.scale = dic.id JOIN sys_dict_data dic ON vg.scale = dic.id
JOIN pq_line sub ON sub.id = dev.pid JOIN pq_line sub ON sub.id = dev.pid
LEFT JOIN SUPERVISION_USER_REPORT obj on detail.obj_id = obj.id
WHERE line.id = #{lineId} WHERE line.id = #{lineId}
</select> </select>

View File

@@ -162,6 +162,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
lineDetailDataVO.setDevId(device.getId()); lineDetailDataVO.setDevId(device.getId());
lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName()); lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName());
lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName()); lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
lineDetailDataVO.setObjId(lineDetail.getObjId());
lineDetailDataVO.setObjName(lineDetail.getObjName()); lineDetailDataVO.setObjName(lineDetail.getObjName());
lineDetailDataVO.setId(lineDetail.getNum()); lineDetailDataVO.setId(lineDetail.getNum());
lineDetailDataVO.setPtType(PubUtils.ptType(lineDetail.getPtType())); lineDetailDataVO.setPtType(PubUtils.ptType(lineDetail.getPtType()));
@@ -992,6 +993,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
areaLineInfoVO.setSubName(newUserReportVO.getProjectName()); areaLineInfoVO.setSubName(newUserReportVO.getProjectName());
areaLineInfoVO.setLat(newUserReportVO.getLatitude()); areaLineInfoVO.setLat(newUserReportVO.getLatitude());
areaLineInfoVO.setLng(newUserReportVO.getLongitude()); areaLineInfoVO.setLng(newUserReportVO.getLongitude());
areaLineInfoVO.setObjName(newUserReportVO.getProjectName());
} }
} }
} }

View File

@@ -69,7 +69,7 @@
select select
if(sum(real_time*1.0)/sum(due_time)*100>100, if(sum(real_time*1.0)/sum(due_time)*100>100,
100, 100,
IFNULL(ROUND( sum(real_time)/sum(due_time)*100,2),0)) IFNULL(ROUND( sum(real_time*1.0)/sum(due_time)*100,2),0))
as integrityRate as integrityRate
from from
r_stat_integrity_d r_stat_integrity_d

View File

@@ -636,18 +636,16 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
} }
}, executor); }, executor);
CompletableFuture<List<EventEigDetail>> eigFuture = CompletableFuture.supplyAsync(() ->
waveService.eventDetailEigenvalue(index, line.getPtType()), executor
);
// 等待所有异步任务完成并获取结果(无超时,但可加) // 等待所有异步任务完成并获取结果(无超时,但可加)
CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture, eigFuture); CompletableFuture<Void> allFutures = CompletableFuture.allOf(instantFuture, rmsFuture);
allFutures.join(); // 阻塞直到个任务都完成 allFutures.join(); // 阻塞直到2个任务都完成
// 获取结果此时所有任务已完成get()不会阻塞) // 获取结果此时所有任务已完成get()不会阻塞)
String imageShun64 = instantFuture.get(); String imageShun64 = instantFuture.get();
String rmsShun64 = rmsFuture.get(); String rmsShun64 = rmsFuture.get();
List<EventEigDetail> eventDetailEigenvalue = eigFuture.get(); List<EventEigDetail> eventDetailEigenvalue = waveService.eventDetailEigenvalue(index, line.getPtType());
// 主线程顺序调用 WordUtil 方法(保证线程安全) // 主线程顺序调用 WordUtil 方法(保证线程安全)
wordUtil.translateShun(index, imageShun64); wordUtil.translateShun(index, imageShun64);
wordUtil.translateRms(index, rmsShun64); wordUtil.translateRms(index, rmsShun64);

View File

@@ -181,7 +181,8 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
}else { }else {
rmpEventDetailPO.setFileFlag(1); rmpEventDetailPO.setFileFlag(1);
} }
//默认给0经过高级算法在赋值
rmpEventDetailPO.setDealFlag(0);
rmpEventDetailPO.setEventDescribe(" "); rmpEventDetailPO.setEventDescribe(" ");
//如果不为空,说明是二次上传波形文件了; //如果不为空,说明是二次上传波形文件了;

View File

@@ -62,7 +62,7 @@ public class WaveServiceImpl implements WaveService {
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) { if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1); waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 2);
} catch (Exception e) { } catch (Exception e) {
try { try {
InputStream cfgStreamLower = fileStorageUtil.getFileStream(wavePath + GeneralConstant.CFG_LOWER); InputStream cfgStreamLower = fileStorageUtil.getFileStream(wavePath + GeneralConstant.CFG_LOWER);
@@ -70,7 +70,7 @@ public class WaveServiceImpl implements WaveService {
if (Objects.isNull(cfgStreamLower) || Objects.isNull(datStreamLower)) { if (Objects.isNull(cfgStreamLower) || Objects.isNull(datStreamLower)) {
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND); throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
} }
waveDataDTO = waveFileComponent.getComtrade(cfgStreamLower, datStreamLower, 1); waveDataDTO = waveFileComponent.getComtrade(cfgStreamLower, datStreamLower, 2);
} catch (Exception e1) { } catch (Exception e1) {
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID); throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
} }

View File

@@ -44,7 +44,7 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AuthGlobalFilter implements GlobalFilter, Ordered { public class AuthGlobalFilter implements GlobalFilter, Ordered {
private final static List<String> USER_AGENT_IP = Arrays.asList("/pqs-auth/auth/getImgCode", "/pqs-auth/oauth/token", "/user-boot/user/generateSm2Key", "/user-boot/user/updateFirstPassword", "/user-boot/appUser/resetPsd"); private final static List<String> USER_AGENT_IP = Arrays.asList("/pqs-auth/auth/getImgCode", "/pqs-auth/oauth/token", "/user-boot/user/generateSm2Key", "/user-boot/user/updateFirstPassword", "/user-boot/appUser/resetPsd","/pqs-auth/oauth/lnLogin","/pqs-auth/oauth/lnCheck","/pqs-auth/oauth/lnRefreshToken");
private final RedisUtil redisUtil; private final RedisUtil redisUtil;

View File

@@ -223,6 +223,9 @@ whitelist:
- /user-boot/appUser/resetPsd - /user-boot/appUser/resetPsd
- /pqs-auth/oauth/logout - /pqs-auth/oauth/logout
- /pqs-auth/oauth/token - /pqs-auth/oauth/token
- /pqs-auth/oauth/lnLogin
- /pqs-auth/oauth/lnCheck
- /pqs-auth/oauth/lnRefreshToken
- /pqs-auth/oauth/autoLogin - /pqs-auth/oauth/autoLogin
- /pqs-auth/auth/getImgCode - /pqs-auth/auth/getImgCode
- /pqs-auth/oauth/getPublicKey - /pqs-auth/oauth/getPublicKey

View File

@@ -1,283 +1,3 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: "@name@"
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10215
spring: spring:
application: profiles:
name: @artifactId@ active: @spring.profiles.active@
main:
allow-bean-definition-overriding: true
#nacos注册中心以及配置中心的指定
cloud:
nacos:
discovery:
ip: @service.server.url@
server-addr: @nacos.url@
username: @nacos.username@
password: @nacos.password@
namespace: @nacos.namespace@
config:
server-addr: @nacos.url@
username: @nacos.username@
password: @nacos.password@
namespace: @nacos.namespace@
file-extension: yaml
shared-configs:
- data-id: share-config.yaml
refresh: true
- data-id: share-config-datasource-db.yaml
refresh: true
gateway:
globalcors:
corsConfigurations:
'[/**]':
allowCredentials: true
exposedHeaders: "Content-Disposition,Content-Type,Cache-Control"
allowedHeaders: "*"
allowedOrigins: "*"
allowedMethods: "*"
discovery:
locator:
# 开启自动代理 (自动装载从配置中心serviceId)
enabled: true
# 服务id为true --> 这样小写服务就可访问了
lower-case-service-id: true
routes:
- id: pqs-auth
uri: lb://pqs-auth
predicates:
- Path=/pqs-auth/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: user-boot
uri: lb://user-boot
predicates:
- Path=/user-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: device-boot
uri: lb://device-boot
predicates:
- Path=/device-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: system-boot
uri: lb://system-boot
predicates:
- Path=/system-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: harmonic-boot
uri: lb://harmonic-boot
predicates:
- Path=/harmonic-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: energy-boot
uri: lb://energy-boot
predicates:
- Path=/energy-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: event-boot
uri: lb://event-boot
predicates:
- Path=/event-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: quality-boot
uri: lb://quality-boot
predicates:
- Path=/quality-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: harmonic-prepare
uri: lb://harmonic-prepare
predicates:
- Path=/harmonic-prepare/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: process-boot
uri: lb://process-boot
predicates:
- Path=/process-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: prepare-boot
uri: lb://prepare-boot
predicates:
- Path=/prepare-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: algorithm-boot
uri: lb://algorithm-boot
predicates:
- Path=/algorithm-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: access-boot
uri: lb://access-boot
predicates:
- Path=/access-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: cs-device-boot
uri: lb://cs-device-boot
predicates:
- Path=/cs-device-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: cs-system-boot
uri: lb://cs-system-boot
predicates:
- Path=/cs-system-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: cs-warn-boot
uri: lb://cs-warn-boot
predicates:
- Path=/cs-warn-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: cs-harmonic-boot
uri: lb://cs-harmonic-boot
predicates:
- Path=/cs-harmonic-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: advance-boot
uri: lb://advance-boot
predicates:
- Path=/advance-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: bpm-boot
uri: lb://bpm-boot
predicates:
- Path=/bpm-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: supervision-boot
uri: lb://supervision-boot
predicates:
- Path=/supervision-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
- id: cs-report-boot
uri: lb://cs-report-boot
predicates:
- Path=/cs-report-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
#河北国网总部调用省侧接口,路径总部统一规定
- id: hb_pms_down
uri: lb://harmonic-boot
predicates:
- Path=/IndexAnalysis/**
- Path=/pms-tech-powerquality-start/**
- id: zl-event-boot
uri: lb://zl-event-boot
predicates:
- Path=/zl-event-boot/**
filters:
- SwaggerHeaderFilter
- StripPrefix=1
#项目日志的配置
logging:
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
whitelist:
urls:
- /user-boot/user/generateSm2Key
- /user-boot/theme/getTheme
- /user-boot/user/updateFirstPassword
- /user-boot/appUser/authCode
- /user-boot/appUser/register
- /user-boot/appUser/resetPsd
- /pqs-auth/oauth/logout
- /pqs-auth/oauth/token
- /pqs-auth/oauth/autoLogin
- /pqs-auth/auth/getImgCode
- /pqs-auth/oauth/getPublicKey
- /pqs-auth/judgeToken/heBei
- /pqs-auth/judgeToken/guangZhou
- /webjars/**
- /actuator/**
- /doc.html
- /swagger-resources/**
- /*/v2/api-docs
- /favicon.ico
- /system-boot/theme/getTheme
- /system-boot/image/toStream
- /system-boot/file/download
- /cs-system-boot/appinfo/queryAppInfoByType
- /system-boot/dictType/dictDataCache
- /system-boot/file/**
- /system-boot/area/**
- /bpm-boot/**
- /harmonic-boot/comAccess/getComAccessData
- /harmonic-boot/harmonic/getHistoryResult
- /event-boot/transient/getTransientAnalyseWave
# - /**
#开始
# - /advance-boot/**
# - /device-boot/**
# - /system-boot/**
# - /harmonic-boot/**
# - /energy-boot/**
# - /event-boot/**
# - /quality-boot/**
# - /harmonic-prepare/**
# - /process-boot/**
# - /bpm-boot/**
# - /system-boot/**
# - /supervision-boot/**
# - /user-boot/**
# - /harmonic-boot/**
# - /cs-device-boot/**
#结束
- /user-boot/user/listAllUserByDeptId
- /IndexAnalysis/**
#mqtt:
# client-id: @artifactId@${random.value}

View File

@@ -64,19 +64,7 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- 多数据源切换当数据源为oracle时需要使用 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<!-- 多数据源切换当数据源为oracle时需要使用 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic-datasource.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.oracle.database.jdbc</groupId> <groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId> <artifactId>ojdbc8</artifactId>
@@ -122,7 +110,6 @@
<groupId>com.njcn.platform</groupId> <groupId>com.njcn.platform</groupId>
<artifactId>data-processing-api</artifactId> <artifactId>data-processing-api</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -64,7 +64,7 @@ public class PowerStatisticsController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getTargetByTime") @PostMapping("/getTargetByTime")
@ApiOperation("点击越限列表时间查询指标的详细数据") @ApiOperation("点击越限列表时间查询指标的详细数据")
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getTargetByTime"); String methodDescribe = getMethodDescribe("getTargetByTime");
List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTimeDetail(powerStatisticsParam); List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTimeDetail(powerStatisticsParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe);
@@ -73,14 +73,14 @@ public class PowerStatisticsController extends BaseController {
@ResponseBody @ResponseBody
@ApiOperation("导出区间数据") @ApiOperation("导出区间数据")
@PostMapping(value = "exportExcelRangTemplate") @PostMapping(value = "exportExcelRangTemplate")
public void exportExcelRangTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) { public void exportExcelRangTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
powerStatisticsService.exportExcelRangTemplate(powerStatisticsParam,response); powerStatisticsService.exportExcelRangTemplate(powerStatisticsParam,response);
} }
@ResponseBody @ResponseBody
@ApiOperation("导出指标越限列表数据") @ApiOperation("导出指标越限列表数据")
@PostMapping(value = "exportExcelListTemplate") @PostMapping(value = "exportExcelListTemplate")
public void exportExcelListTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) { public void exportExcelListTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
powerStatisticsService.exportExcelListTemplate(powerStatisticsParam,response); powerStatisticsService.exportExcelListTemplate(powerStatisticsParam,response);
} }

View File

@@ -0,0 +1,11 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//import com.njcn.dataProcess.po.influx.DataHarmrateI;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//
///**
// * @author xy
// */
//public interface DataHarmRateIMapper extends InfluxDbBaseMapper<DataHarmrateI> {
//
//}

View File

@@ -0,0 +1,11 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//import com.njcn.dataProcess.po.influx.DataHarmrateV;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//
///**
// * @author xy
// */
//public interface DataHarmRateVMapper extends InfluxDbBaseMapper<DataHarmrateV> {
//
//}

View File

@@ -0,0 +1,16 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//import com.njcn.dataProcess.po.influx.DataI;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//
//
///**
// * @author hongawen
// * @version 1.0
// * @data 2024/11/7 18:49
// */
//public interface DataIMapper extends InfluxDbBaseMapper<DataI> {
//
//
//
//}

View File

@@ -0,0 +1,17 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//
//import com.njcn.dataProcess.po.influx.DataInharmV;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//
///**
// * <p>
// * Mapper 接口
// * </p>
// *
// * @author hongawen
// * @since 2023-12-28
// */
//public interface DataInharmVMapper extends InfluxDbBaseMapper<DataInharmV> {
//
//}

View File

@@ -0,0 +1,17 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//
//import com.njcn.dataProcess.po.influx.DataPlt;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//
///**
// * <p>
// * Mapper 接口
// * </p>
// *
// * @author hongawen
// * @since 2023-12-28
// */
//public interface DataPltMapper extends InfluxDbBaseMapper<DataPlt> {
//
//}

View File

@@ -0,0 +1,27 @@
//package com.njcn.harmonic.mapper.influxdb;
//
//import com.njcn.dataProcess.dto.LineDataVFiveItemDTO;
//import com.njcn.dataProcess.dto.MeasurementCountDTO;
//import com.njcn.dataProcess.po.influx.DataV;
//import com.njcn.influx.base.InfluxDbBaseMapper;
//import com.njcn.influx.query.InfluxQueryWrapper;
//
//import java.util.List;
//
///**
// * @author hongawen
// * @version 1.0
// * @data 2024/11/7 18:49
// */
//public interface DataVMapper extends InfluxDbBaseMapper<DataV> {
//
//
// List<LineDataVFiveItemDTO> queryDataValue(InfluxQueryWrapper dataVQueryWrapper);
//
//
// List<MeasurementCountDTO> getMeasurementCount(InfluxQueryWrapper influxQueryWrapper);
//
//
//
//
//}

View File

@@ -2,6 +2,8 @@ package com.njcn.harmonic.service;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailTimeDto;
import com.njcn.harmonic.pojo.param.LimitCalendarQueryParam; import com.njcn.harmonic.pojo.param.LimitCalendarQueryParam;
import com.njcn.harmonic.pojo.param.LimitExtentDayQueryParam; import com.njcn.harmonic.pojo.param.LimitExtentDayQueryParam;
import com.njcn.harmonic.pojo.param.LimitExtentQueryParam; import com.njcn.harmonic.pojo.param.LimitExtentQueryParam;
@@ -27,4 +29,12 @@ public interface IRStatLimitRateDetailDService extends IService<RStatLimitRateDe
List<LimitProbabilityVO> limitProbabilityData(LimitProbabilityQueryParam param); List<LimitProbabilityVO> limitProbabilityData(LimitProbabilityQueryParam param);
List<LimitTimeProbabilityVO> limitTimeProbabilityData(LimitProbabilityQueryParam param); List<LimitTimeProbabilityVO> limitTimeProbabilityData(LimitProbabilityQueryParam param);
/**
* 稳态超标时间
* @param lineParam
* @return
*/
List<DataLimitRateDetailTimeDto> getLimitRateDetailTime(LineCountEvaluateParam lineParam);
} }

View File

@@ -10,7 +10,6 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.njcn.dataProcess.api.*;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.*; import com.njcn.dataProcess.pojo.dto.*;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
@@ -18,11 +17,11 @@ import com.njcn.device.pq.api.OverLimitClient;
import com.njcn.harmonic.constant.Param; import com.njcn.harmonic.constant.Param;
import com.njcn.harmonic.pojo.param.PowerStatisticsParam; import com.njcn.harmonic.pojo.param.PowerStatisticsParam;
import com.njcn.harmonic.pojo.vo.*; import com.njcn.harmonic.pojo.vo.*;
import com.njcn.harmonic.service.IRStatLimitRateDetailDService;
import com.njcn.harmonic.service.activepowerrange.PowerStatisticsService; import com.njcn.harmonic.service.activepowerrange.PowerStatisticsService;
import com.njcn.harmonic.service.activepowerrange.RActivePowerRangeService; import com.njcn.harmonic.service.activepowerrange.RActivePowerRangeService;
import com.njcn.influx.service.CommonService; import com.njcn.harmonic.service.influxdb.*;
import com.njcn.poi.util.PoiUtil; import com.njcn.poi.util.PoiUtil;
import com.njcn.system.api.EpdFeignClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
@@ -54,14 +53,14 @@ import java.util.stream.Collectors;
public class PowerStatisticsServiceImpl implements PowerStatisticsService { public class PowerStatisticsServiceImpl implements PowerStatisticsService {
private final RActivePowerRangeService rActivePowerRangeService; private final RActivePowerRangeService rActivePowerRangeService;
private final IRStatLimitRateDetailDService irStatLimitRateDetailDService;
private final DecimalFormat dftwo = new DecimalFormat(Param.DECIMAL_FORMATTWOSTR); private final DecimalFormat dftwo = new DecimalFormat(Param.DECIMAL_FORMATTWOSTR);
private final DataVFeignClient dataVFeignClient; private final IDataV dataV;
private final DataIFeignClient dataIFeignClient; private final IDataI dataI;
private final DataPltFeignClient dataPltFeignClient; private final IDataPlt dataPlt;
private final DataInharmVFeignClient dataInharmVFeignClient; private final IDataInHarmV dataInHarmV;
private final DataHarmRateVFeignClient dataHarmRateVFeignClient; private final IDataHarmRateV dataHarmRateV;
private final OverLimitClient overLimitClient; private final OverLimitClient overLimitClient;
private final DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
private List<String> times = Arrays.asList("0~10%", "10~20%", "20~30%", "30~40%", "40~50%", "50~60%", "60~70%", "70~80%", "80~90%", "90~100%"); private List<String> times = Arrays.asList("0~10%", "10~20%", "20~30%", "30~40%", "40~50%", "50~60%", "60~70%", "70~80%", "80~90%", "90~100%");
@@ -111,7 +110,9 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
lineCountEvaluateParam.setStartTime(powerStatisticsParam.getSearchBeginTime()); lineCountEvaluateParam.setStartTime(powerStatisticsParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(powerStatisticsParam.getSearchEndTime()); lineCountEvaluateParam.setEndTime(powerStatisticsParam.getSearchEndTime());
//获取超标数据 //获取超标数据
List<DataLimitRateDetailTimeDto> dtoList = dataLimitRateDetailFeignClient.getLimitRateDetailTimeList(lineCountEvaluateParam).getData();
List<DataLimitRateDetailTimeDto> dtoList = irStatLimitRateDetailDService.getLimitRateDetailTime(lineCountEvaluateParam);
Map<String, DataLimitRateDetailTimeDto> timeDateMap = dtoList.stream().collect(Collectors.toMap(x -> x.getTime(), Function.identity())); Map<String, DataLimitRateDetailTimeDto> timeDateMap = dtoList.stream().collect(Collectors.toMap(x -> x.getTime(), Function.identity()));
List<String> timeId = rActivePowerRangePO.getTimeId(); List<String> timeId = rActivePowerRangePO.getTimeId();
String times = reflexObjValue(rActivePowerRangePO, "minsTime" + powerStatisticsParam.getField()).toString().replace("null", ""); String times = reflexObjValue(rActivePowerRangePO, "minsTime" + powerStatisticsParam.getField()).toString().replace("null", "");
@@ -155,11 +156,11 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
String time = param.getSearchBeginTime(); String time = param.getSearchBeginTime();
if ("1".equals(param.getStatisticalId())) { if ("1".equals(param.getStatisticalId())) {
//电压数据 //电压数据
List<DataVDto> dataVAllTime = dataVFeignClient.getRawData(evaluateParam).getData(); List<DataVDto> dataVAllTime = dataV.getRawData(evaluateParam);
//闪变数据 //闪变数据
List<DataPltDto> dataFlickerAllTime = dataPltFeignClient.getRawData(evaluateParam).getData(); List<DataPltDto> dataFlickerAllTime = dataPlt.getRawData(evaluateParam);
//电流数据 //电流数据
List<DataIDto> dataIList = dataIFeignClient.getRawData(evaluateParam).getData(); List<DataIDto> dataIList = dataI.getRawData(evaluateParam);
//电压偏差 //电压偏差
if ("Dev".equals(param.getCode()) || StrUtil.isBlank(param.getCode())) { if ("Dev".equals(param.getCode()) || StrUtil.isBlank(param.getCode())) {
addThdData(info, overlimit.getVoltageDev(), "vuDev", dataVAllTime, "电压上偏差","%",time); addThdData(info, overlimit.getVoltageDev(), "vuDev", dataVAllTime, "电压上偏差","%",time);
@@ -189,17 +190,17 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
} }
if ("2".equals(param.getStatisticalId())) { if ("2".equals(param.getStatisticalId())) {
//谐波数据 //谐波数据
List<DataHarmDto> dataVHarmList = dataHarmRateVFeignClient.getRawData(evaluateParam).getData(); List<DataHarmDto> dataVHarmList = dataHarmRateV.getRawData(evaluateParam);
addThdData(info, overlimit, "getUharm", "v", 2, 26, dataVHarmList, "谐波电压","%",time); addThdData(info, overlimit, "getUharm", "v", 2, 26, dataVHarmList, "谐波电压","%",time);
} }
if ("3".equals(param.getStatisticalId())) { if ("3".equals(param.getStatisticalId())) {
//电流数据 //电流数据
List<DataIDto> dataIList = dataIFeignClient.getRawData(evaluateParam).getData(); List<DataIDto> dataIList = dataI.getRawData(evaluateParam);
addThdData(info, overlimit, "getUharm", "i", 2, 26, dataIList, "谐波电流","A",time); addThdData(info, overlimit, "getUharm", "i", 2, 26, dataIList, "谐波电流","A",time);
} }
if ("4".equals(param.getStatisticalId())) { if ("4".equals(param.getStatisticalId())) {
//间谐波数据 //间谐波数据
List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(evaluateParam).getData(); List<DataHarmDto> dataVInHarmList = dataInHarmV.getRawData(evaluateParam);
addThdData(info, overlimit, "getInuharm", "v", 1, 17, dataVInHarmList, "间谐波电压","%",time); addThdData(info, overlimit, "getInuharm", "v", 1, 17, dataVInHarmList, "间谐波电压","%",time);
} }
return info; return info;

View File

@@ -577,7 +577,7 @@ public class GridServiceImpl implements IGridService {
//筛选出9项指标(电压偏差、频率偏差、电压总谐波畸变率、电压闪变、三相电压不平衡度、负序电流、谐波电流、间谐波电压、谐波电压)超标监测点 //筛选出9项指标(电压偏差、频率偏差、电压总谐波畸变率、电压闪变、三相电压不平衡度、负序电流、谐波电流、间谐波电压、谐波电压)超标监测点
long allNum = list2.stream().filter(o -> o.getAllOvertime() > 0 || o.getFlickerAllTime() > 0 ).count(); long allNum = list2.stream().filter(o -> o.getAllOvertime() > 0 || o.getFlickerAllTime() > 0 ).count();
detail.setOverNum((int) allNum); detail.setOverNum((int) allNum);
detail.setOverRatio(PubUtils.doubleRound(2, detail.getOverNum() * 100.0 / detail.getOnlineNum())); detail.setOverRatio(detail.getOnlineNum() == 0 ? 0 : PubUtils.doubleRound(2, detail.getOverNum() * 100.0 / detail.getOnlineNum()));
//筛选出电压偏差超标监测点 //筛选出电压偏差超标监测点
long num1 = list2.stream().filter(o -> o.getFreqDevOvertime() > 0).count(); long num1 = list2.stream().filter(o -> o.getFreqDevOvertime() > 0).count();
Integer day1 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetVO::getFreqDevOvertime)).get().getFreqDevOvertime(); Integer day1 = list2.stream().max(Comparator.comparingInt(RStatLimitTargetVO::getFreqDevOvertime)).get().getFreqDevOvertime();

View File

@@ -167,12 +167,16 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
List<GridDiagramVO.StatisticsData> statisticsData = new ArrayList<>(); List<GridDiagramVO.StatisticsData> statisticsData = new ArrayList<>();
List<GridDiagramVO.StatisticsData> gwStatisticsData = new ArrayList<>(); List<GridDiagramVO.StatisticsData> gwStatisticsData = new ArrayList<>();
List<String> idsList = new ArrayList<>();
int allNum = 0;
for(String voltage:voltageIds){ for(String voltage:voltageIds){
GridDiagramVO.StatisticsData voltageItem = new GridDiagramVO.StatisticsData(); GridDiagramVO.StatisticsData voltageItem = new GridDiagramVO.StatisticsData();
voltageItem.setColumnName(voltage); voltageItem.setColumnName(voltage);
if(voltageMonitorMap.containsKey(voltage)){ if(voltageMonitorMap.containsKey(voltage)){
List<String> ids = voltageMonitorMap.get(voltage).stream().map(LineDevGetDTO::getObjId).distinct().collect(Collectors.toList()); List<String> ids = voltageMonitorMap.get(voltage).stream().map(LineDevGetDTO::getObjId).distinct().collect(Collectors.toList());
voltageItem.setNumOne((long)ids.size()); voltageItem.setNumOne((long)ids.size());
allNum+=ids.size();
idsList.addAll(ids);
voltageItem.setNumOneList(ids); voltageItem.setNumOneList(ids);
}else { }else {
voltageItem.setNumOne(0L); voltageItem.setNumOne(0L);
@@ -180,6 +184,10 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
} }
statisticsData.add(voltageItem); statisticsData.add(voltageItem);
} }
GridDiagramVO.StatisticsData dataSum = new GridDiagramVO.StatisticsData();
dataSum.setNumOneList(idsList);
dataSum.setNumOne((long)allNum);
statisticsData.add(dataSum);
lineStatistics.setData(statisticsData); lineStatistics.setData(statisticsData);
gwLineStatistics.setData(gwStatisticsData); gwLineStatistics.setData(gwStatisticsData);

View File

@@ -186,12 +186,12 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
mainLineVO.setLineId(lineId); mainLineVO.setLineId(lineId);
if (linePO != null) { if (linePO != null) {
mainLineVO.setLineName(linePO.getName()); mainLineVO.setLineName(linePO.getName());
if (linePO.getGovern().equals(0)) { // if (linePO.getGovern().equals(0)) {
mainLineVO.setGovern("未治理"); // mainLineVO.setGovern("未治理");
} // }
if (linePO.getGovern().equals(1)) { // if (linePO.getGovern().equals(1)) {
mainLineVO.setGovern("已治理"); // mainLineVO.setGovern("已治理");
} // }
mainLineVO.setObjType(linePO.getMonitorObj()); mainLineVO.setObjType(linePO.getMonitorObj());
DictData dictData = dicDataFeignClient.getDicDataById(linePO.getMonitorObj()).getData(); DictData dictData = dicDataFeignClient.getDicDataById(linePO.getMonitorObj()).getData();
if (dictData != null) { if (dictData != null) {

View File

@@ -1,18 +1,23 @@
package com.njcn.harmonic.service.impl; package com.njcn.harmonic.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.lang.Pair; import cn.hutool.core.lang.Pair;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.csdevice.api.CsLineFeignClient; import com.njcn.csdevice.api.CsLineFeignClient;
import com.njcn.csdevice.pojo.po.CsLinePO; import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.AbnormalData;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailTimeDto;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.api.OverLimitClient; import com.njcn.device.pq.api.OverLimitClient;
import com.njcn.harmonic.pojo.param.LimitCalendarQueryParam; import com.njcn.harmonic.pojo.param.LimitCalendarQueryParam;
@@ -30,10 +35,13 @@ import com.njcn.harmonic.service.IRStatLimitRateDetailDService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -381,6 +389,76 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
return result; return result;
} }
@Override
public List<DataLimitRateDetailTimeDto> getLimitRateDetailTime(LineCountEvaluateParam lineParam) {
List<DataLimitRateDetailTimeDto> info = new ArrayList<>();
LambdaQueryWrapper<RStatLimitRateDetailDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()), RStatLimitRateDetailDPO::getLineId, lineParam.getLineId())
.between(RStatLimitRateDetailDPO::getTime, lineParam.getStartTime(),lineParam.getEndTime())
// .le(RStatLimitRateDetailDPO::getTime, )
// .orderByAsc(RStatLimitRateDetailDPO::getTime)
;
List<RStatLimitRateDetailDPO> list = this.list(lambdaQueryWrapper);
DataLimitRateDetailTimeDto dto;
for (RStatLimitRateDetailDPO detailD : list) {
dto = new DataLimitRateDetailTimeDto();
dto.setLineId(detailD.getLineId());
dto.setTime(detailD.getTime().format((DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))));
dto.setFlickerOvertime(toList(detailD.getFlickerOvertime()));
dto.setFreqDevOvertime(toList(detailD.getFreqDevOvertime()));
dto.setVoltageDevOvertime(toList(detailD.getVoltageDevOvertime()));
dto.setUbalanceOvertime(toList(detailD.getUbalanceOvertime()));
dto.setUaberranceOvertime(toList(detailD.getUaberranceOvertime()));
dto.setINegOvertime(toList(detailD.getINegOvertime()));
dto.setUharmOvertime(toList(detailD,2,25,"getUharm"));
dto.setIharmOvertime(toList(detailD,2,25,"getIharm"));
dto.setInuharmOvertime(toList(detailD,1,16,"getInuharm"));
info.add(dto);
}
return info;
}
private List<String> toList(RStatLimitRateDetailDPO detailD,Integer start, Integer end, String targetName){
List<AbnormalData.Json> json = new ArrayList<>();
for (int i = start; i <= end; i++) {
// 构造方法名
String methodName = targetName + i + "Overtime";
try {
// 获取 DataHarmDto 类的 getVx 方法
Method getVMethod = RStatLimitRateDetailDPO.class.getMethod(methodName);
String value = (String) getVMethod.invoke(detailD);
if(StrUtil.isNotBlank(value)){
json.addAll(JSON.parseArray(value, AbnormalData.Json.class));
}
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
return getString(json);
}
private List<String> toList(String json){
List<AbnormalData.Json> jsons = JSON.parseArray(json, AbnormalData.Json.class);
return getString(jsons);
}
private List<String> getString(List<AbnormalData.Json> jsons) {
if (CollUtil.isNotEmpty(jsons)){
List<String> times = jsons.stream().map(AbnormalData.Json::getTime).collect(Collectors.toList());
String join = String.join(",", times);
String[] split = join.split(",");
return Arrays.stream(split).distinct().collect(Collectors.toList());
}
return new ArrayList<>();
}
/** /**
* 设置LimitExtentVO的最大值和相关信息 * 设置LimitExtentVO的最大值和相关信息
*/ */

View File

@@ -0,0 +1,26 @@
package com.njcn.harmonic.service.influxdb;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.dataProcess.dto.DataHarmrateVDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.dataProcess.pojo.dto.DataHarmRateVDto;
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
import java.util.List;
/**
* @author xy
*/
public interface IDataHarmRateV {
/**
* 获取原始数据
* @param lineParam
* @return
*/
List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.harmonic.service.influxdb;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataIDto;
import java.util.List;
/**
* Description:
* Date: 2024/11/18 11:17【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface IDataI {
/**
* 获取原始数据
* @param lineParam
* @return
*/
List<DataIDto> getRawData(LineCountEvaluateParam lineParam);
}

View File

@@ -0,0 +1,32 @@
package com.njcn.harmonic.service.influxdb;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.dataProcess.dto.DataInharmVDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.dataProcess.pojo.dto.DataInHarmVDto;
import com.njcn.dataProcess.pojo.dto.DataVDto;
import com.njcn.dataProcess.pojo.po.RStatDataInHarmVD;
import java.util.List;
/**
* Description:
* Date: 2024/11/18 13:27【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface IDataInHarmV {
/**
* 获取原始数据
* @param lineParam
* @return
*/
List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam);
}

View File

@@ -0,0 +1,31 @@
package com.njcn.harmonic.service.influxdb;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.dataProcess.dto.DataPltDTO;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
import com.njcn.dataProcess.pojo.dto.DataPltDto;
import com.njcn.dataProcess.pojo.dto.DataVDto;
import com.njcn.dataProcess.pojo.po.RStatDataPltD;
import java.util.List;
/**
* Description:
* Date: 2024/11/18 11:17【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface IDataPlt {
/**
* 获取原始数据
* @param lineParam
* @return
*/
List<DataPltDto> getRawData(LineCountEvaluateParam lineParam);
}

View File

@@ -0,0 +1,24 @@
package com.njcn.harmonic.service.influxdb;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataVDto;
import java.util.List;
/**
* @author hongawen
* @version 1.0
* @data 2024/11/7 10:54
*/
public interface IDataV {
/**
* 获取原始数据
* @param lineParam
* @return
*/
List<DataVDto> getRawData(LineCountEvaluateParam lineParam);
}

View File

@@ -0,0 +1,159 @@
package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.harmonic.service.influxdb.IDataHarmRateV;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.DataHarmRateVMapper;
import com.njcn.influx.pojo.po.DataHarmRateV;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author xy
*/
@Service
@RequiredArgsConstructor
public class InfluxdbDataHarmRateVImpl implements IDataHarmRateV {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
private final DataHarmRateVMapper DataHarmRateVMapper;
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
put("M", "T");
}};
private final RedisUtil redisUtil;
private static final Set<String> LINE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("AB", "BC", "CA", "T")));
private static final Set<String> PHASE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("A", "B", "C", "T")));
@Override
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>();
List<DataHarmRateV> list = getMinuteData(lineParam);
list.forEach(item->{
DataHarmDto dto = new DataHarmDto();
BeanUtils.copyProperties(item,dto);
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
result.add(dto);
});
return result;
}
/**
* 按监测点集合、时间条件获取分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
* 需要进行剔除异常数据时,这里会有三种情况判断
* 1.无异常数据,则直接返回集合;
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/
public List<DataHarmRateV> getMinuteData(LineCountEvaluateParam lineParam) {
List<DataHarmRateV> dataList;
List<DataHarmRateV> result = new ArrayList<>();
List<DataHarmRateV> data = new ArrayList<>();
//获取监测点、接线方式数据
Type type = new TypeToken<Map<String, Integer>>(){}.getType();
Map<String, Integer> map = new Gson().fromJson(
String.valueOf(redisUtil.getObjectByKey("wlLineDetail")),
type
);
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmRateV.class);
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataHarmRateV::getLineId, lineParam.getLineId())
.select(DataHarmRateV::getLineId)
.select(DataHarmRateV::getPhaseType)
.select(DataHarmRateV::getValueType)
.select(DataHarmRateV::getQualityFlag)
.select(DataHarmRateV::getAbnormalFlag)
.between(DataHarmRateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataHarmRateV::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataHarmRateV::getPhaseType,lineParam.getPhasicType());
}
List<DataHarmRateV> list = DataHarmRateVMapper.selectByQueryWrapper(influxQueryWrapper);
if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) {
dataList = list.stream().filter(item -> Objects.isNull(item.getAbnormalFlag())).collect(Collectors.toList());
} else {
dataList = list;
}
Map<String,List<DataHarmRateV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataHarmRateV::getLineId));
//有异常数据
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
List<DataHarmRateV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
}
//没有异常数据,则使用原数据
else {
result.addAll(v);
}
});
}
//没有异常数据,则使用原数据
else {
result.addAll(dataList);
}
}
if (CollectionUtil.isNotEmpty(result)) {
if (!Objects.isNull(map)) {
//现根据监测点分组,然后根据接线方式排除多于数据,在修改相别
Map<String, List<DataHarmRateV>> lineMap = result.stream().collect(Collectors.groupingBy(DataHarmRateV::getLineId));
lineMap.forEach((k,v)->{
if (Objects.isNull(map.get(k))) {
return;
}
Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
List<DataHarmRateV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
data.addAll(result2);
});
} else {
data.addAll(result);
}
if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) {
item.setPhaseType(newType);
}
});
}
}
return data;
}
}

View File

@@ -0,0 +1,135 @@
package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataIDto;
import com.njcn.harmonic.service.influxdb.IDataI;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.DataIMapper;
import com.njcn.influx.pojo.po.DataI;
import com.njcn.influx.query.InfluxQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author wr
* @description
* @date 2026/7/1 10:49
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class InfluxdbDataIImpl implements IDataI {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
private final DataIMapper dataIMapper;
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
put("M", "T");
}};
@Override
public List<DataIDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataIDto> result = new ArrayList<>();
List<DataI> list = getMinuteDataI(lineParam);;
list.forEach(item->{
DataIDto dto = new DataIDto();
BeanUtils.copyProperties(item,dto);
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
result.add(dto);
});
return result;
}
/**
* 按监测点集合、时间条件获取dataI分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
* 需要进行剔除异常数据时,这里会有三种情况判断
* 1.无异常数据,则直接返回集合;
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/
public List<DataI> getMinuteDataI(LineCountEvaluateParam lineParam) {
List<DataI> dataList;
List<DataI> result = new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
.select(DataI::getLineId)
.select(DataI::getPhaseType)
.select(DataI::getValueType)
.select(DataI::getINeg)
.select(DataI::getIPos)
.select(DataI::getIThd)
.select(DataI::getIUnbalance)
.select(DataI::getIZero)
.select(DataI::getRms)
.select(DataI::getQualityFlag)
.select(DataI::getAbnormalFlag)
.between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataI::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataI::getPhaseType,lineParam.getPhasicType());
}
List<DataI> list = dataIMapper.selectByQueryWrapper(influxQueryWrapper);
if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) {
dataList = list.stream().filter(item -> Objects.isNull(item.getAbnormalFlag())).collect(Collectors.toList());
} else {
dataList = list;
}
Map<String,List<DataI>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataI::getLineId));
//有异常数据
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
List<DataI> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
}
//没有异常数据,则使用原数据
else {
result.addAll(v);
}
});
}
//没有异常数据,则使用原数据
else {
result.addAll(dataList);
}
}
if (CollectionUtil.isNotEmpty(result)) {
result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) {
item.setPhaseType(newType);
}
});
}
return result;
}
}

View File

@@ -0,0 +1,132 @@
package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
import com.njcn.harmonic.service.influxdb.IDataInHarmV;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.DataInHarmVMapper;
import com.njcn.influx.pojo.po.DataInHarmV;
import com.njcn.influx.query.InfluxQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2024/11/18 14:33【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class InfluxdbDataInharmVImpl implements IDataInHarmV {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
private final DataInHarmVMapper DataInHarmVMapper;
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
put("M", "T");
}};
@Override
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataHarmDto> result = new ArrayList<>();
List<DataInHarmV> list = getMinuteData(lineParam);
list.forEach(item->{
DataHarmDto dto = new DataHarmDto();
BeanUtils.copyProperties(item,dto);
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
result.add(dto);
});
return result;
}
/**
* 按监测点集合、时间条件获取dataI分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
* 需要进行剔除异常数据时,这里会有三种情况判断
* 1.无异常数据,则直接返回集合;
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/
public List<DataInHarmV> getMinuteData(LineCountEvaluateParam lineParam) {
List<DataInHarmV> dataList;
List<DataInHarmV> result = new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmV.class);
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataInHarmV::getLineId, lineParam.getLineId())
.select(DataInHarmV::getLineId)
.select(DataInHarmV::getPhaseType)
.select(DataInHarmV::getValueType)
.select(DataInHarmV::getQualityFlag)
.select(DataInHarmV::getAbnormalFlag)
.between(DataInHarmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataInHarmV::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataInHarmV::getPhaseType,lineParam.getPhasicType());
}
List<DataInHarmV> list = DataInHarmVMapper.selectByQueryWrapper(influxQueryWrapper);
if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) {
dataList = list.stream().filter(item -> Objects.isNull(item.getAbnormalFlag())).collect(Collectors.toList());
} else {
dataList = list;
}
Map<String,List<DataInHarmV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataInHarmV::getLineId));
//有异常数据
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
List<DataInHarmV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
}
//没有异常数据,则使用原数据
else {
result.addAll(v);
}
});
}
//没有异常数据,则使用原数据
else {
result.addAll(dataList);
}
}
if (CollectionUtil.isNotEmpty(result)) {
result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) {
item.setPhaseType(newType);
}
});
}
return result;
}
}

View File

@@ -0,0 +1,157 @@
package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.influx.pojo.po.DataPlt;
import com.njcn.dataProcess.pojo.dto.DataPltDto;
import com.njcn.harmonic.service.influxdb.IDataPlt;
import com.njcn.influx.imapper.DataPltMapper;
import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
/**
* Description:
* Date: 2024/11/18 14:33【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class InfluxdbDataPltImpl implements IDataPlt {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
private final DataPltMapper dataPltMapper;
private final RedisUtil redisUtil;
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
put("M", "T");
}};
private static final Set<String> LINE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("AB", "BC", "CA", "T")));
private static final Set<String> PHASE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("A", "B", "C", "T")));
@Override
public List<DataPltDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataPltDto> result = new ArrayList<>();
List<DataPlt> list = getMinuteDataPlt(lineParam);
list.forEach(item->{
DataPltDto dto = new DataPltDto();
BeanUtils.copyProperties(item,dto);
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
result.add(dto);
});
return result;
}
/**
* 按监测点集合、时间条件获取dataI分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
* 需要进行剔除异常数据时,这里会有三种情况判断
* 1.无异常数据,则直接返回集合;
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/
public List<DataPlt> getMinuteDataPlt(LineCountEvaluateParam lineParam) {
List<DataPlt> dataList;
List<DataPlt> result = new ArrayList<>();
List<DataPlt> data = new ArrayList<>();
//获取监测点、接线方式数据
Type type = new TypeToken<Map<String, Integer>>(){}.getType();
Map<String, Integer> map = new Gson().fromJson(
String.valueOf(redisUtil.getObjectByKey("wlLineDetail")),
type
);
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
influxQueryWrapper.regular(DataPlt::getLineId, lineParam.getLineId())
.select(DataPlt::getLineId)
.select(DataPlt::getPhaseType)
.select(DataPlt::getPlt)
.select(DataPlt::getQualityFlag)
.select(DataPlt::getAbnormalFlag)
.between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataPlt::getQualityFlag,"0");
if(CollUtil.isNotEmpty(lineParam.getPhasicType())){
influxQueryWrapper.regular(DataV::getPhaseType,lineParam.getPhasicType());
}
List<DataPlt> list = dataPltMapper.selectByQueryWrapper(influxQueryWrapper);
if(CollUtil.isNotEmpty(list)){
//过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) {
dataList = list.stream().filter(item -> Objects.isNull(item.getAbnormalFlag())).collect(Collectors.toList());
} else {
dataList = list;
}
Map<String,List<DataPlt>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataPlt::getLineId));
//有异常数据
if (CollectionUtil.isNotEmpty(lineParam.getAbnormalTime())) {
lineMap.forEach((k,v)->{
List<String> timeList = lineParam.getAbnormalTime().get(k);
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
List<DataPlt> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
}
//没有异常数据,则使用原数据
else {
result.addAll(v);
}
});
}
//没有异常数据,则使用原数据
else {
result.addAll(dataList);
}
}
if (CollectionUtil.isNotEmpty(result)) {
if (!Objects.isNull(map)) {
//现根据监测点分组,然后根据接线方式排除多于数据,在修改相别
Map<String, List<DataPlt>> lineMap = result.stream().collect(Collectors.groupingBy(DataPlt::getLineId));
lineMap.forEach((k,v)->{
if (Objects.isNull(map.get(k))) {
return;
}
Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
List<DataPlt> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
data.addAll(result2);
});
} else {
data.addAll(result);
}
if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) {
item.setPhaseType(newType);
}
});
}
}
return data;
}
}

View File

@@ -0,0 +1,221 @@
package com.njcn.harmonic.service.influxdb.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataVDto;
import com.njcn.harmonic.service.influxdb.IDataV;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.DataVMapper;
import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.redis.utils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Type;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author wr
* @description
* @date 2026/7/1 10:49
*/
@Slf4j
@Service
public class InfluxdbDataVImpl implements IDataV {
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A");
put("BC", "B");
put("CA", "C");
put("M", "T");
}};
@Resource
private DataVMapper dataVMapper;
@Resource
private RedisUtil redisUtil;
private static final Set<String> LINE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("AB", "BC", "CA", "T")));
private static final Set<String> PHASE_VOLTAGE_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList("A", "B", "C", "T")));
@Override
public List<DataVDto> getRawData(LineCountEvaluateParam lineParam) {
List<DataVDto> result = new ArrayList<>();
List<DataV> list = getMinuteDataV(lineParam);
if (CollectionUtil.isNotEmpty(list)) {
list.forEach(item -> {
DataVDto dto = new DataVDto();
BeanUtils.copyProperties(item, dto);
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
result.add(dto);
});
}
return result;
}
/**
* 按监测点集合、时间条件获取dataV分钟数据
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
* 剔除异常数据,这里会有三种情况判断
* 1.无异常数据,则直接返回集合;
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
* 3.全是异常数据,则使用异常数据进行计算,但是日表中需要标记出来,此数据有异常
*/
public List<DataV> getMinuteDataV(LineCountEvaluateParam lineParam) {
List<DataV> result = new ArrayList<>();
List<DataV> data = new ArrayList<>();
//获取监测点、接线方式数据
Type type = new TypeToken<Map<String, Integer>>(){}.getType();
Map<String, Integer> map = new Gson().fromJson(
String.valueOf(redisUtil.getObjectByKey("wlLineDetail")),
type
);
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
.select(DataV::getLineId)
.select(DataV::getPhaseType)
.select(DataV::getValueType)
.select(DataV::getFreq)
.select(DataV::getFreqDev)
.select(DataV::getRms)
.select(DataV::getRmsLvr)
.select(DataV::getVNeg)
.select(DataV::getVPos)
.select(DataV::getVThd)
.select(DataV::getVUnbalance)
.select(DataV::getVZero)
.select(DataV::getVlDev)
.select(DataV::getVuDev)
.select(DataV::getQualityFlag)
.select(DataV::getAbnormalFlag)
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataV::getQualityFlag, "0");
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
influxQueryWrapper.regular(DataV::getPhaseType, lineParam.getPhasicType());
}
quality(result, influxQueryWrapper, lineParam);
if (CollectionUtil.isNotEmpty(result)) {
if (!Objects.isNull(map)) {
//现根据监测点分组,然后根据接线方式排除多于数据,在修改相别
Map<String, List<DataV>> lineMap = result.stream().collect(Collectors.groupingBy(DataV::getLineId));
lineMap.forEach((k,v)->{
if (Objects.isNull(map.get(k))) {
return;
}
//这边需要特殊处理下,将线电压数据赋值
Map<String, DataV> lineVoltageIndex = v.stream()
.filter(d -> PHASE_MAPPING.containsKey(d.getPhaseType()))
.filter(d -> d.getRmsLvr() != null)
.collect(Collectors.toMap(
d -> buildKey(d.getTime(), d.getValueType(), d.getPhaseType()),
Function.identity(),
(existing, replacement) -> existing
));
v.stream()
.filter(d -> PHASE_VOLTAGE_TYPES.contains(d.getPhaseType()))
.forEach(phaseData -> {
// 根据当前相电压反查对应的线电压相别
String targetLinePhasic = getReverseLinePhasic(phaseData.getPhaseType());
if (targetLinePhasic == null) {
return;
}
String key = buildKey(phaseData.getTime(), phaseData.getValueType(), targetLinePhasic);
DataV matchedLineData = lineVoltageIndex.get(key);
if (matchedLineData != null && matchedLineData.getRmsLvr() != null) {
phaseData.setRmsLvr(matchedLineData.getRmsLvr());
}
});
Integer conType = map.get(k);
Set<String> validPhasicTypes = (conType != 0) ? LINE_VOLTAGE_TYPES : PHASE_VOLTAGE_TYPES;
List<DataV> result2 = v.stream().filter(item -> validPhasicTypes.contains(item.getPhaseType())).collect(Collectors.toList());
data.addAll(result2);
});
} else {
data.addAll(result);
}
if (CollectionUtil.isNotEmpty(data)) {
data.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhaseType());
if (newType != null) {
item.setPhaseType(newType);
}
});
}
}
return data;
}
private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) {
List<DataV> dataList;
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
if (CollUtil.isNotEmpty(list)) {
//过滤掉暂态事件影响的数据 true过滤 false不过滤
if (lineParam.getDataType()) {
dataList = list.stream().filter(item -> Objects.isNull(item.getAbnormalFlag())).collect(Collectors.toList());
} else {
dataList = list;
}
Map<String, List<DataV>> lineMap = dataList.stream().collect(Collectors.groupingBy(DataV::getLineId));
//有异常数据
Map<String, List<String>> timeMap = lineParam.getAbnormalTime();
if (CollectionUtil.isNotEmpty(timeMap)) {
lineMap.forEach((k, v) -> {
List<String> timeList = timeMap.get(k);
//有异常数据,当前监测点自身的异常数据
if (CollectionUtil.isNotEmpty(timeList)) {
List<DataV> filterList = v.stream().filter(item -> !timeList.contains(DATE_TIME_FORMATTER.format(item.getTime()))).collect(Collectors.toList());
//1.过滤掉异常数据后还有正常数据,则用正常数据计算
if (CollectionUtil.isNotEmpty(filterList)) {
result.addAll(filterList);
}
//2.过滤掉异常数据后没有正常数据,则用所有异常数据计算,但是需要标记数据为异常的
else {
v.parallelStream().forEach(item -> item.setQualityFlag("1"));
result.addAll(v);
}
}
//没有异常数据,则使用原数据
else {
result.addAll(v);
}
});
}
//没有异常数据,则使用原数据
else {
result.addAll(dataList);
}
}
}
private static String buildKey(Object time, Object valueType, Object phasicType) {
return time + "|" + valueType + "|" + phasicType;
}
private static String getReverseLinePhasic(String phaseType) {
if (phaseType == null) {
return null;
}
switch (phaseType) {
case "A":
return "AB";
case "B":
return "BC";
case "C":
return "CA";
default:
return null;
}
}
}

View File

@@ -115,6 +115,9 @@ public class CustomReportServiceImpl implements CustomReportService {
private final String STR_FOUR = "%"; private final String STR_FOUR = "%";
private final String UVOLTAGE_DEV = "UVOLTAGE_DEV"; private final String UVOLTAGE_DEV = "UVOLTAGE_DEV";
private final String VOLTAGE_DEV = "VOLTAGE_DEV"; private final String VOLTAGE_DEV = "VOLTAGE_DEV";
private final String PT = "PT";
private final String CT = "CT";
@Override @Override
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) { public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
@@ -126,6 +129,8 @@ public class CustomReportServiceImpl implements CustomReportService {
DeviceUnitCommDTO deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class); DeviceUnitCommDTO deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
Map<String,String> finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData()); Map<String,String> finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
finalTerminalMap.put(PT,formatSciNumber(finalTerminalMap.getOrDefault(PT,"N/A")));
finalTerminalMap.put(CT,formatSciNumber(finalTerminalMap.getOrDefault(CT,"N/A")));
customReportTableService.getCustomReport(reportSearchParam,finalTerminalMap,deviceUnitCommDTO, response); customReportTableService.getCustomReport(reportSearchParam,finalTerminalMap,deviceUnitCommDTO, response);
} else { } else {
//浙江无线报表 //浙江无线报表
@@ -1462,6 +1467,28 @@ public class CustomReportServiceImpl implements CustomReportService {
} }
} }
/**
* 解析科学计数字符串,转为完整数字文本,原有小数原样保留
* @param numStr 数据库返回字符串123.00 / 1.234E+08 / N/A
* @return 标准数字字符串
*/
public String formatSciNumber(String numStr) {
// 空值或占位符直接返回
if (numStr == null || "N/A".equals(numStr.trim())) {
return numStr;
}
// 判断是否为科学计数格式
if (numStr.toLowerCase().contains("e")) {
// BigDecimal 可完美解析科学计数,输出完整数字,保留全部小数位
String [] split =numStr.split(":");
BigDecimal one = new BigDecimal(split[0]);
BigDecimal two = new BigDecimal(split[1]);
return (one.toPlainString().concat(":").concat(two.toPlainString()));
}
return numStr;
}
} }

View File

@@ -92,7 +92,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
}}; }};
@Override @Override
public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) { public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
TimeInterval timeInterval = new TimeInterval(); TimeInterval timeInterval = new TimeInterval();
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId()); ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
if (Objects.isNull(excelRptTemp)) { if (Objects.isNull(excelRptTemp)) {
@@ -100,7 +100,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
} }
if (Objects.isNull(reportSearchParam.getCustomType())) { if (Objects.isNull(reportSearchParam.getCustomType())) {
//通用报表 //通用报表
analyzeReport(reportSearchParam, excelRptTemp, newMap, deviceUnitCommDTO, response); analyzeReport(reportSearchParam, excelRptTemp, ledgerMap, deviceUnitCommDTO, response);
log.info("报表执行时间{}秒", timeInterval.intervalSecond()); log.info("报表执行时间{}秒", timeInterval.intervalSecond());
} }
@@ -565,7 +565,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
* @date 2023/10/8 * @date 2023/10/8
*/ */
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) { private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
//定义一个线程集合 //定义一个线程集合
List<Future<?>> futures = new ArrayList<>(); List<Future<?>> futures = new ArrayList<>();
//指标 //指标
@@ -651,13 +651,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
phaseMap.forEach((phaseKey, phaseVal) -> { phaseMap.forEach((phaseKey, phaseVal) -> {
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT); StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) { if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap); assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) { } else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap); assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) { } else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap); assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) { } else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap); assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
} }
}); });
@@ -681,7 +681,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
//处理指标最终判定合格还是不合格 //处理指标最终判定合格还是不合格
dealTargetResult(assNoPassMap, limitTargetMapX, endList); dealTargetResult(assNoPassMap, limitTargetMapX, endList);
} }
resultAssemble(endList, reportSearchParam, newMap, deviceUnitCommDTO, jsonArray); resultAssemble(endList, reportSearchParam, ledgerMap, deviceUnitCommDTO, jsonArray);
//导出自定义报表 //导出自定义报表
downReport(jsonArray, response); downReport(jsonArray, response);
} }
@@ -1305,6 +1305,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList()); data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
} else { } else {
// 兼容达梦数据库方法 // 兼容达梦数据库方法
if(Objects.nonNull(mapList.get(0))) {
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0)); Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
for (ReportTemplateDTO item : data) { for (ReportTemplateDTO item : data) {
if (map.containsKey(item.getItemName())) { if (map.containsKey(item.getItemName())) {
@@ -1370,6 +1371,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
} }
} }
} }
}
if (endList != null) { if (endList != null) {
endList.addAll(data); endList.addAll(data);
} }
@@ -1486,7 +1488,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
} else if (v.charAt(0) == '&') { } else if (v.charAt(0) == '&') {
//结论 //结论
String tem = v.replace(STR_THREE, "").toUpperCase(); String tem = v.replace(STR_THREE, "").toUpperCase();
if (finalTerminalMap.size() > 0) { if (!finalTerminalMap.isEmpty()) {
if ("STATIS_TIME".equals(tem)) { if ("STATIS_TIME".equals(tem)) {
//如何时间是大于当前时间则用当前时间 //如何时间是大于当前时间则用当前时间
String localTime = InfluxDbSqlConstant.END_TIME; String localTime = InfluxDbSqlConstant.END_TIME;

View File

@@ -10,9 +10,11 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.DeviceUnitClient; import com.njcn.device.pq.api.DeviceUnitClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO; import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO; import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO; import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
@@ -48,6 +50,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* pqs * pqs
@@ -132,7 +135,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
if (ObjectUtil.isNull(lineDto)) { if (ObjectUtil.isNull(lineDto)) {
throw new BusinessException(CommonResponseEnum.NO_DATA); throw new BusinessException(CommonResponseEnum.NO_DATA);
} }
if(StrUtil.isNotBlank(lineDto.getObjId())){
bdname = lineDto.getObjName();
name = lineDto.getLineName();
}else {
bdname = lineDto.getBdName(); bdname = lineDto.getBdName();
}
areaName = lineDto.getAreaName(); areaName = lineDto.getAreaName();
if("冀北".equals(areaName)){ if("冀北".equals(areaName)){
areaName="国网"+areaName; areaName="国网"+areaName;

View File

@@ -64,11 +64,11 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>prepare-api</artifactId> <artifactId>prepare-api</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>process-api</artifactId> <artifactId>process-api</artifactId>

View File

@@ -9,7 +9,6 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.system.mapper.SysDicTreePOMapper;
import com.njcn.system.pojo.param.DictTreeParam; import com.njcn.system.pojo.param.DictTreeParam;
import com.njcn.system.pojo.po.SysDicTreePO; import com.njcn.system.pojo.po.SysDicTreePO;
import com.njcn.system.pojo.vo.DictTreeVO; import com.njcn.system.pojo.vo.DictTreeVO;
@@ -190,15 +189,15 @@ public class DictTreeController extends BaseController {
@GetMapping("/queryDictType") @GetMapping("/queryDictType")
@ApiOperation("获取指标类型") @ApiOperation("获取指标类型")
@ApiImplicitParams ({ @ApiImplicitParams ({
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true), @ApiImplicitParam(name = "lineType", value = "0:治理监测点 1:电能质量监测点", required = true),
@ApiImplicitParam(name = "conType", value = "接线方式", required = true) @ApiImplicitParam(name = "conType", value = "接线方式", required = true)
}) })
public HttpResult<List<SysDicTreePO>> queryDictType(@RequestParam @Validated String lineId, @RequestParam(required = false) @Validated Integer conType) { public HttpResult<List<SysDicTreePO>> queryDictType(@RequestParam @Validated Integer lineType, @RequestParam(required = false) @Validated Integer conType) {
String methodDescribe = getMethodDescribe("queryDictType"); String methodDescribe = getMethodDescribe("queryDictType");
if (conType == null) { if (conType == null) {
throw new BusinessException("监测点缺失接线方式"); throw new BusinessException("监测点缺失接线方式");
} }
List<SysDicTreePO> result = sysDicTreePOService.queryDictType(lineId,conType); List<SysDicTreePO> result = sysDicTreePOService.queryDictType(lineType,conType);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }

View File

@@ -15,5 +15,6 @@
sys_dic_tree b sys_dic_tree b
WHERE WHERE
b.pids LIKE concat('%',#{id},'%') and a.id = b.pid) b.pids LIKE concat('%',#{id},'%') and a.id = b.pid)
AND a.status = 0
</select> </select>
</mapper> </mapper>

View File

@@ -71,5 +71,5 @@ public interface SysDicTreePOService extends IService<SysDicTreePO> {
*/ */
List<SysDicTreePO> queryByCodeList(String code); List<SysDicTreePO> queryByCodeList(String code);
List<SysDicTreePO> queryDictType(String lineId, Integer conType); List<SysDicTreePO> queryDictType(Integer lineType, Integer conType);
} }

View File

@@ -190,15 +190,14 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
} }
@Override @Override
public List<SysDicTreePO> queryDictType(String lineId, Integer conType) { public List<SysDicTreePO> queryDictType(Integer lineType, Integer conType) {
DictTreeVO vo = queryByCode("Statistical_Type"); DictTreeVO vo = queryByCode("Statistical_Type");
LambdaQueryWrapper<SysDicTreePO> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SysDicTreePO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysDicTreePO::getPid,vo.getId()) queryWrapper.eq(SysDicTreePO::getPid,vo.getId())
.eq(SysDicTreePO::getStatus,0) .eq(SysDicTreePO::getStatus,0)
.orderByAsc(SysDicTreePO::getSort); .orderByAsc(SysDicTreePO::getSort);
char lastChar = lineId.charAt(lineId.length() - 1);
//治理APF指标 //治理APF指标
if (Objects.equals(lastChar,'0')) { if (Objects.equals(lineType,0)) {
queryWrapper.eq(SysDicTreePO::getType,3); queryWrapper.eq(SysDicTreePO::getType,3);
} }
//通用指标 //通用指标

View File

@@ -105,6 +105,8 @@ public enum UserResponseEnum {
REFERRAL_CODE_LAPSE("A0119","角色推荐码失效,请联系管理员"), REFERRAL_CODE_LAPSE("A0119","角色推荐码失效,请联系管理员"),
REFERRAL_CODE_ERROR("A0119","角色推荐码错误,请联系管理员"), REFERRAL_CODE_ERROR("A0119","角色推荐码错误,请联系管理员"),
LN_AUTH_ERROR("A0121","统一认证过期,请重新认证"),
; ;
private final String code; private final String code;

View File

@@ -62,7 +62,7 @@ public class UserParam {
@ApiModelProperty("用户权限类型") @ApiModelProperty("用户权限类型")
@NotNull(message = UserValidMessage.CASUAL_USER_NOT_BLANK) @NotNull(message = UserValidMessage.CASUAL_USER_NOT_BLANK)
@Range(min = 0, max = 2, message = UserValidMessage.PARAM_FORMAT_ERROR) @Range(min = 0, max = 3, message = UserValidMessage.PARAM_FORMAT_ERROR)
private Integer type; private Integer type;
@ApiModelProperty("短信通知") @ApiModelProperty("短信通知")

View File

@@ -4,6 +4,7 @@ package com.njcn.user.controller.app;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.user.pojo.param.AppInfoSetParam; import com.njcn.user.pojo.param.AppInfoSetParam;
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* <p> * <p>
@@ -58,6 +60,9 @@ public class AppInfoSetController extends BaseController {
public HttpResult<AppInfoSet> queryByUserId(){ public HttpResult<AppInfoSet> queryByUserId(){
String methodDescribe = getMethodDescribe("queryByUserId"); String methodDescribe = getMethodDescribe("queryByUserId");
AppInfoSet appInfoSet = appInfoSetService.lambdaQuery().eq(AppInfoSet::getUserId, RequestUtil.getUserIndex()).one(); AppInfoSet appInfoSet = appInfoSetService.lambdaQuery().eq(AppInfoSet::getUserId, RequestUtil.getUserIndex()).one();
if (Objects.isNull(appInfoSet)) {
throw new BusinessException("非手机号注册的用户,需联系管理员添加配置!");
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appInfoSet, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, appInfoSet, methodDescribe);
} }

View File

@@ -25,7 +25,6 @@ import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -105,13 +104,11 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
if (StringUtils.isBlank(devCode)) { if (StringUtils.isBlank(devCode)) {
throw new BusinessException(UserResponseEnum.DEV_CODE_WRONG); throw new BusinessException(UserResponseEnum.DEV_CODE_WRONG);
} }
judgeCode(phone, code); User user = this.lambdaQuery().eq(User::getPhone,phone).one();
String password = null;
//先根据手机号查询是否已被注册
User user = this.lambdaQuery().eq(User::getPhone,phone).ne(User::getState,0).one();
if (!Objects.isNull(user)){ if (!Objects.isNull(user)){
throw new BusinessException(UserResponseEnum.REGISTER_PHONE_REPEAT); throw new BusinessException(UserResponseEnum.REGISTER_PHONE_REPEAT);
} else { }
judgeCode(phone, code);
//新增用户配置表 //新增用户配置表
UserSet userSet = userSetService.addAppUserSet(); UserSet userSet = userSetService.addAppUserSet();
//新增用户表 //新增用户表
@@ -122,22 +119,21 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
//消息默认配置 //消息默认配置
AppInfoSet appInfoSet = new AppInfoSet(); AppInfoSet appInfoSet = new AppInfoSet();
appInfoSet.setUserId(newUser.getId()); appInfoSet.setUserId(newUser.getId());
appInfoSet.setHarmonicInfo(1); appInfoSet.setHarmonicInfo(0);
appInfoSet.setEventInfo(1); appInfoSet.setEventInfo(1);
appInfoSet.setRunInfo(1); appInfoSet.setRunInfo(0);
appInfoSet.setAlarmInfo(1); appInfoSet.setAlarmInfo(0);
appInfoSet.setIticFunction(0); appInfoSet.setIticFunction(0);
appInfoSet.setF47Function(0); appInfoSet.setF47Function(0);
appInfoSetService.save(appInfoSet); appInfoSetService.save(appInfoSet);
//发送用户初始密码 //发送用户初始密码
password = redisUtil.getStringByKey(newUser.getId()); String password = redisUtil.getStringByKey(newUser.getId());
String content = SmsUtil.getLianTongMessageTemplate("3", password); String content = SmsUtil.getLianTongMessageTemplate("3", password);
smsSendService.sendSmsWithRetry(phone,content,"verify_code"); smsSendService.sendSmsWithRetry(phone,content,"verify_code");
redisUtil.delete(newUser.getId()); redisUtil.delete(newUser.getId());
//删除验证码 //删除验证码
deleteCode(phone); deleteCode(phone);
} }
}
@Override @Override
public void modifyPsd(String userId, String phone, String code, String password, String devCode) { public void modifyPsd(String userId, String phone, String code, String password, String devCode) {