112 Commits

Author SHA1 Message Date
xy
ed10b12e79 微调 2024-09-03 20:19:22 +08:00
xy
fbd15ca353 APP用户相关接口调整 2024-09-03 19:22:39 +08:00
xy
2c79cc72c9 微调 2024-09-03 18:21:59 +08:00
cdf
69157a138b 1.监督计划功能调整 2024-09-02 16:38:53 +08:00
guofeihu
3377bcf488 有功功率趋势区间excel导出 2024-09-02 14:36:14 +08:00
wr
e93f8b4da8 1.解决技术监督申报人问题
2.技术监督全流程删除
2024-09-02 11:53:27 +08:00
guofeihu
e13b1f156e 有功功率趋势2 2024-08-29 16:30:46 +08:00
guofeihu
ee1f36617d Merge remote-tracking branch 'origin/master' 2024-08-29 16:24:47 +08:00
guofeihu
9534882845 pom回退 2024-08-29 16:23:25 +08:00
cdf
5d28504f20 1.审计日志处理2 2024-08-29 16:01:32 +08:00
cdf
7559b94959 1.审计日志处理2 2024-08-29 15:59:56 +08:00
cdf
14b072b5e7 1.审计日志处理2 2024-08-29 15:54:32 +08:00
cdf
0a121a3cf5 1.审计日志处理 2024-08-29 15:39:16 +08:00
cdf
476993db15 1.接口日志类型调整 2024-08-28 19:55:36 +08:00
guofeihu
cccc7953ed Merge remote-tracking branch 'origin/master' 2024-08-28 11:29:26 +08:00
guofeihu
aa0982fb81 有功功率趋势 2024-08-28 11:28:20 +08:00
cdf
07e481bc11 1.缓慢接口调整 2024-08-28 09:52:44 +08:00
wr
b766e77c42 1.解决地址问题
2.解决技术监督管理填报人错误问题,并解决展示问题
2024-08-27 11:44:52 +08:00
xy
cbf310a5a1 Merge remote-tracking branch 'origin/master' 2024-08-27 09:36:18 +08:00
xy
49dd915e27 微调 2024-08-27 09:35:51 +08:00
cdf
ed145dd7ff 1.系统日志加载缓慢问题
2.其他代码问题
2024-08-26 16:03:58 +08:00
cdf
00fd701122 1.pms微调 2024-08-26 13:47:24 +08:00
cdf
6236243284 1.pms无线趋势图实时数据功能 2024-08-26 10:27:28 +08:00
cdf
6dc1b415dc 1.pms公共连接点功能 2024-08-24 20:47:15 +08:00
hanyong
f4fd509d12 类名重复,删除后重新引用 2024-08-23 16:15:55 +08:00
wr
6e8a188172 1.修改列表模板名称 2024-08-23 11:49:07 +08:00
guofeihu
ceb95be340 Merge remote-tracking branch 'origin/master' 2024-08-23 11:16:25 +08:00
guofeihu
21f4466580 高低电压穿越相关接口走算法模块 2024-08-23 11:15:41 +08:00
e50f587bb8 提交文件校验 2024-08-23 11:12:20 +08:00
7727e9e2bf 提交文件校验 2024-08-23 11:10:29 +08:00
wr
043b8f9a71 1.解决省级用户,可查看市级待提交和审核不通过数据
2.pms增加数据单位管理
2024-08-22 16:52:09 +08:00
guofeihu
af058896dc Merge remote-tracking branch 'origin/master' 2024-08-22 15:26:22 +08:00
guofeihu
957af09daa 高低电压穿越及有功功率趋势算法 2024-08-22 15:25:44 +08:00
cdf
d28a8f8fb1 1.pms趋势图处理
2.device模块调整
2024-08-22 09:27:49 +08:00
guofeihu
f27a107bba 更新监测点时新增新能源站字段 2024-08-22 09:08:09 +08:00
wr
bddd1efef3 1.excel通用导出模板,解决时间格式不是文本问题
2.解决部分部门查询问题
2024-08-20 16:23:00 +08:00
guofeihu
003880619e surverytest新增otherreport字段 2024-08-20 15:15:56 +08:00
guofeihu
053183cdd0 新能源场站高低电压穿越统计 2024-08-20 09:36:35 +08:00
c2af7e708c system针对审计日志的微调 2024-08-19 19:55:12 +08:00
guofeihu
f36b3f9ee9 新能源场站高低电压穿越业务新增根据ID查询基本信息方法 2024-08-19 18:58:34 +08:00
wr
25ee513246 1.技术监督通用文件表调整
2.终端检测导入功能调整
3.技术监督计划增加其他附件上传
2024-08-19 16:19:23 +08:00
xy
9e23373878 1.间谐波显示处理
2.超标数据处理
2024-08-19 14:16:32 +08:00
guofeihu
971ae03dcf 新能源场站高低电压穿越融合台账业务 2024-08-16 14:27:05 +08:00
wr
68c0b72710 1.解决技术监督计划部门过滤bug
2.终端模板导入
3.台账关联干扰源管理,信息修改
2024-08-16 12:30:30 +08:00
guofeihu
8bc94ea9a8 Merge remote-tracking branch 'origin/master' 2024-08-16 10:24:40 +08:00
guofeihu
b30ad02ac1 新能源场站高低电压穿越新增下拉用于测点台账时维护 2024-08-16 10:23:45 +08:00
f22748ef8f 1.河北新增公共连接点预处理算法 2024-08-16 09:30:15 +08:00
guofeihu
813af67b9b Merge remote-tracking branch 'origin/master' 2024-08-14 17:34:56 +08:00
guofeihu
758964d9a8 新能源场站增删改查接口 2024-08-14 17:33:47 +08:00
xy
360a73c04e 微调 2024-08-14 14:03:45 +08:00
wr
dbf43633ff 1.excel公共导出模板调整,解决下拉框最大字符255问题,才用隐藏表单来设置下拉框
2.解决冀北试运行报告bug部分
3.解决数据完整性,小数点问题
4.终端监测导出模板和导入功能编写,
2024-08-14 11:44:34 +08:00
1ed56bbac1 1.修改因redis导致的报错 2024-08-14 09:07:10 +08:00
xy
7c943244b3 微调 2024-08-14 08:50:20 +08:00
a492609b36 1.去除influxdb生成每日日表数据代码 2024-08-13 11:18:41 +08:00
1f18c71eb7 1.pms上送 2024-08-13 10:45:59 +08:00
2319895ff4 1.pms电能质量报表
2.园区功能接口
3.自定义报表(部分)
2024-08-13 10:45:06 +08:00
xy
a6f9e30d54 微调 2024-08-12 20:14:21 +08:00
guofeihu
4cff5e90a2 DictTreeController中补充缺失的delete接口 2024-08-09 15:08:18 +08:00
88f7efbc86 1.用户下拉接口增加属性 2024-08-09 13:20:35 +08:00
1d41b1af12 1.实体类调整 2024-08-09 08:38:22 +08:00
wr
3b5442ecf5 1.解决台账数据缺少变电站个别信息
2.解决技术监督台账管理终端信息
3.增加全景展示稳态9指标数据
2024-08-08 16:26:22 +08:00
xy
3ec984752f 微调 2024-08-07 17:08:24 +08:00
wr
99021d3c9c 1.试运行报告微调
2.全景展示稳态超标9指标扩展
3.技术监督变电站台账调整
4.调整登录名正则表达式增加._
2024-08-07 11:50:04 +08:00
xy
b608aab3bd 添加单位 2024-08-06 18:41:42 +08:00
xy
f54ce5ae3c 微调 2024-08-02 16:01:25 +08:00
wr
3a589962a5 1.试运行报告微调 2024-08-01 16:04:24 +08:00
wr
e54df08dca 1.调整变电站台账模糊搜索功能 2024-08-01 14:48:15 +08:00
055c762415 1.真实ip获取 2024-08-01 13:19:50 +08:00
wr
cdbb4fe428 1.解决pq公共方法查询监测点信息,母线,终端等信息
2.解决device模块swagger页面出不来问题
3.技术监督变电站台账接口增加
4.监测点试运行报告增加,间谐波电压和暂态列表
2024-08-01 11:41:19 +08:00
hzj
d972bbef80 终端入网检测
1.终端入网检测添加经纬度的录入功能;

2.同步台账时,不是系统电站的需要将经纬度同步

二、监测点台账录入

1.关联终端下拉框里面的数据展示终端编号,不展示终端名称
2024-07-31 15:19:51 +08:00
1d664fee19 1.pom提交 2024-07-29 14:14:15 +08:00
eb10a16799 1.用能代码提交 2024-07-29 13:58:36 +08:00
6e85a72b7d 1.用能代码提交 2024-07-29 13:57:20 +08:00
59b56a39dc 1.用能代码提交
2.系统并发bug修改
2024-07-29 13:56:28 +08:00
da387cc39d 手动判断access是否过期 2024-07-29 11:48:52 +08:00
hzj
9d4215afb5 bug修改 2024-07-25 15:19:44 +08:00
35e3d098a9 添加nacos用户名密码 2024-07-25 13:36:52 +08:00
61bbbed153 用能空调定时关机策略 2024-07-25 13:35:39 +08:00
0fe103d01e 用能代码提交 2024-07-24 20:12:42 +08:00
d64b15a8e6 监督计划代码调整 2024-07-24 14:55:23 +08:00
xy
3ed732affd 新增用能定时任务 2024-07-24 13:45:59 +08:00
128925a5d6 用能代码提交 2024-07-24 13:15:59 +08:00
311b2844ba 用能代码提交 2024-07-24 11:32:25 +08:00
xy
7dc2cde6ed 方法引入调整 2024-07-24 11:08:55 +08:00
wr
8b1074c172 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java
2024-07-24 09:46:55 +08:00
wr
67ad03ddbe 1.审批流程中审批不通过会造成俩条数据bug解决
2.解决公共方法,变电站信息台账数据量不准确问题,增加变电数据判断
3.技术监督-干扰源治理验收报告逻辑校验
4.技术监督-台账联调,增加治理验收和入网评估报告验证
2024-07-24 09:43:06 +08:00
24e937e331 解决重复日志输出 2024-07-23 16:31:37 +08:00
xy
89ece63f2e 1.电能质量在线监测需求调整
2.变电站台账功能(待完善)
2024-07-23 14:28:07 +08:00
1e79bbdcb0 河北安全测评整改需求 2024-07-22 14:22:16 +08:00
ec051827ac 河北安全测评整改需求 2024-07-22 13:53:04 +08:00
xy
6fa63a7f3e 微调 2024-07-19 15:55:40 +08:00
a9aa0785da Merge remote-tracking branch 'origin/master' 2024-07-18 10:40:55 +08:00
23e7288609 工作流参数调整 2024-07-18 10:40:50 +08:00
hzj
a573c17886 bug修改 2024-07-17 10:53:44 +08:00
be8edfd4cf 工作流参数调整 2024-07-17 08:39:32 +08:00
30b4f03f6b 调整相别名称 2024-07-16 14:52:52 +08:00
wr
ee41b0a554 1.技术监督试运行bug修改
2.审核不通过展示表单信息和审核信息
2024-07-16 09:33:05 +08:00
xy
458b2347ed 接口调整 2024-07-16 09:21:10 +08:00
hzj
c1bfc2347f 密码规则配置功能 2024-07-15 17:28:36 +08:00
eba02ffcf3 动态枚举内容功能增加 2024-07-15 17:23:41 +08:00
2921145336 动态枚举内容功能增加 2024-07-15 15:55:39 +08:00
hzj
9de6981cd5 密码规则配置功能 2024-07-12 13:22:53 +08:00
cdf
fb58b13c91 1.字典树调整 2024-07-10 15:52:51 +08:00
hzj
e12e5d90c8 修改influxdb包的字段,类引起的修改 2024-07-10 09:08:49 +08:00
wr
075205d4b9 1.技术监督试运行bug修改和全景问题接口调整 2024-07-09 13:55:07 +08:00
xy
1af8fcc72f 1.在线监测详情接口
2.在线监测查询接口调整
2024-07-09 10:15:23 +08:00
wr
6ec0ef54e9 1.技术监督试运行,不通过整体预告警单流程 2024-07-05 09:01:12 +08:00
xy
fd23719a41 终端周期检测代码调整 2024-07-03 14:18:49 +08:00
xy
306200791a 微调 2024-07-02 20:32:18 +08:00
xy
e6a1874abf 技术监督测试管理新增报告上传、审核报告查看 2024-07-02 19:19:08 +08:00
wr
8502421b91 1.技术监督试运行评估-试运行结束后生成试运行报告接线图片调整有则展示,没有则默认 2024-07-02 18:23:20 +08:00
wr
50cd5d3895 1.技术监督试运行评估-试运行结束后生成试运行报告
2.技术监督计划管理,权限调整为负责地市进行信息修改
3.调整常态化干扰源用户信息更新逻辑
4.调整谐波报告数据请求格式
2024-07-02 16:55:08 +08:00
433 changed files with 16361 additions and 3103 deletions

View File

@@ -43,16 +43,20 @@
<!-- <middle.server.url>10.95.53.49</middle.server.url>--> <!-- <middle.server.url>10.95.53.49</middle.server.url>-->
<middle.server.url>192.168.1.22</middle.server.url> <middle.server.url>192.168.1.22</middle.server.url>
<!--微服务模块发布地址--> <!--微服务模块发布地址-->
<service.server.url>127.0.0.1</service.server.url> <service.server.url>192.168.1.127</service.server.url>
<!--docker仓库地址--> <!--docker仓库地址-->
<docker.server.url>192.168.1.22</docker.server.url> <docker.server.url>192.168.1.22</docker.server.url>
<!--nacos的ip:port--> <!--nacos的ip:port-->
<nacos.url>${middle.server.url}:18848</nacos.url> <nacos.url>${middle.server.url}:18848</nacos.url>
<!--nacos开启鉴权后的用户名-->
<nacos.username>nacos</nacos.username>
<!--nacos的ip:port-->
<nacos.password>nacos</nacos.password>
<!--服务器发布内容为空--> <!--服务器发布内容为空-->
<!-- <nacos.namespace></nacos.namespace>--> <!-- <nacos.namespace></nacos.namespace>-->
<!-- <nacos.namespace>1dd11af6-e668-41fd-a663-02a05705304d</nacos.namespace>--> <!-- <nacos.namespace>1dd11af6-e668-41fd-a663-02a05705304d</nacos.namespace>-->
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>--> <!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
<nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace> <nacos.namespace>ddcae5af-ac35-4fc4-9804-962de94dfc61</nacos.namespace>
<!-- sentinel:port--> <!-- sentinel:port-->
<sentinel.url>${middle.server.url}:8080</sentinel.url> <sentinel.url>${middle.server.url}:8080</sentinel.url>
<!--网关地址主要用于配置swagger中认证token--> <!--网关地址主要用于配置swagger中认证token-->

View File

@@ -41,7 +41,7 @@ public class ResponsibilityController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/responsibilityList") @PostMapping("/responsibilityList")
@ApiOperation("列表分页") @ApiOperation("查询责任划分列表分页")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<Page<RespDataDTO>> responsibilityList(@RequestBody @Validated BaseParam queryParam) { public HttpResult<Page<RespDataDTO>> responsibilityList(@RequestBody @Validated BaseParam queryParam) {
String methodDescribe = getMethodDescribe("responsibilityList"); String methodDescribe = getMethodDescribe("responsibilityList");

View File

@@ -47,7 +47,7 @@ public class UserDataController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/userDataList") @PostMapping("/userDataList")
@ApiOperation("列表分页") @ApiOperation("查询用户列表分页")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true) @ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<Page<RespUserData>> userDataList(@RequestBody @Validated BaseParam queryParam) { public HttpResult<Page<RespUserData>> userDataList(@RequestBody @Validated BaseParam queryParam) {
String methodDescribe = getMethodDescribe("userDataList"); String methodDescribe = getMethodDescribe("userDataList");

View File

@@ -10,6 +10,7 @@ import com.njcn.advance.mapper.carrycapacity.CarryCapacityUserPOMapper;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam; import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityUserParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO; import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService; import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
import com.njcn.common.pojo.constant.LogInfo;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.user.api.UserFeignClient; import com.njcn.user.api.UserFeignClient;
import com.njcn.user.pojo.vo.UserVO; import com.njcn.user.pojo.vo.UserVO;
@@ -77,7 +78,7 @@ public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUse
page.getRecords().stream().forEach(temp->{ page.getRecords().stream().forEach(temp->{
UserVO user = userFeignClient.getUserById(temp.getCreateBy()).getData(); UserVO user = userFeignClient.getUserById(temp.getCreateBy()).getData();
temp.setCreateBy(user.getName()); temp.setCreateBy(Objects.isNull(user)? LogInfo.UNKNOWN_USER:user.getName());
}); });
return page; return page;
} }

View File

@@ -31,7 +31,7 @@ import com.njcn.influx.deprecated.InfluxDBPublicParam;
import com.njcn.influx.imapper.DataHarmPowerPMapper; import com.njcn.influx.imapper.DataHarmPowerPMapper;
import com.njcn.influx.imapper.DataHarmPowerQMapper; import com.njcn.influx.imapper.DataHarmPowerQMapper;
import com.njcn.influx.imapper.DataVMapper; import com.njcn.influx.imapper.DataVMapper;
import com.njcn.influx.imapper.IDataIMapper; import com.njcn.influx.imapper.DataIMapper;
import com.njcn.influx.pojo.bo.CarryCapcityData; import com.njcn.influx.pojo.bo.CarryCapcityData;
import com.njcn.influx.pojo.po.DataI; import com.njcn.influx.pojo.po.DataI;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
@@ -74,14 +74,14 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
private final DataHarmPowerQMapper dataHarmPowerQMapper; private final DataHarmPowerQMapper dataHarmPowerQMapper;
private final DataHarmPowerPMapper dataHarmPowerPMapper; private final DataHarmPowerPMapper dataHarmPowerPMapper;
private final DataVMapper dataVMapper; private final DataVMapper dataVMapper;
private final IDataIMapper dataIMapper; private final DataIMapper dataIMapper;
private final CarryCapacityStrategyPOService carryCapacityStrategyPOService; private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
private final CarryCapacityDataPOService carryCapacityDataPOService; private final CarryCapacityDataPOService carryCapacityDataPOService;
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final CarryCapacityResultPOService carryCapacityResultPOService; private final CarryCapacityResultPOService carryCapacityResultPOService;
private final CarryCapacityUserPOService carryCapacityUserPOService; private final CarryCapacityUserPOService carryCapacityUserPOService;
private static final double DEFAULTVALUE=3141.5926; private static final double DEFAULTVALUE=3.1415926;
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
@@ -152,7 +152,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
缺失布置3.1415926后边更具3.1415926个数来判断数据完整性,及进行数据补充*/ 缺失布置3.1415926后边更具3.1415926个数来判断数据完整性,及进行数据补充*/
//有功功率 //有功功率
String SqlP1 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlP1 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerPList = dataHarmPowerPMapper.getSqlResult(SqlP1); dataHarmPowerPList = dataHarmPowerPMapper.getSqlResult(SqlP1);
//数据校验 //数据校验
@@ -172,7 +172,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
//无功功率 //无功功率
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1); dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
//数据缺失填补 //数据缺失填补
//数据校验 //数据校验
@@ -201,7 +201,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
, formatter) + " 23:59:00"; , formatter) + " 23:59:00";
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2); dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
//数据校验 //数据校验
if(CollectionUtil.isEmpty(dataHarmPowerP2List)){ if(CollectionUtil.isEmpty(dataHarmPowerP2List)){
@@ -220,7 +220,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
//无功功率 //无功功率
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2); dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
//数据校验 //数据校验
//数据校验 //数据校验
@@ -240,7 +240,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
//电压 //电压
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2); dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
//数据校验 //数据校验
//数据校验 //数据校验
@@ -325,7 +325,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
if(CollectionUtil.isEmpty(dataHarmPowerQList)){ if(CollectionUtil.isEmpty(dataHarmPowerQList)){
//无功功率 //无功功率
String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlQ1 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + startTime + "'and time <= '" +endTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1); dataHarmPowerQList = dataHarmPowerQMapper.getSqlResult(SqlQ1);
if(CollectionUtil.isEmpty(dataHarmPowerQList)){ if(CollectionUtil.isEmpty(dataHarmPowerQList)){
throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND); throw new BusinessException(AdvanceResponseEnum.DATA_NOT_FOUND);
@@ -796,7 +796,7 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
, formatter) + " 23:59:00"; , formatter) + " 23:59:00";
String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlP2 = "select mean(p)*1000 as value from data_harmpower_p where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2); dataHarmPowerP2List = dataHarmPowerPMapper.getSqlResult(SqlP2);
//数据校验 //数据校验
if(CollectionUtil.isEmpty(dataHarmPowerP2List)){ if(CollectionUtil.isEmpty(dataHarmPowerP2List)){
@@ -818,14 +818,14 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
//无功功率 //无功功率
String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlQ2 = "select mean(q)*1000 as value from data_harmpower_q where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2); dataHarmPowerQ2List = dataHarmPowerQMapper.getSqlResult(SqlQ2);
//数据校验 //数据校验
//数据缺失填补 //数据缺失填补
linearInterpolation(dataHarmPowerQ2List); linearInterpolation(dataHarmPowerQ2List);
//电压 //电压
String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+ String SqlU2 = "select mean(rms)*1000 as value from data_v where value_type='CP95' and phasic_type!='T' and line_id='"+lineId+
"' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(3.1415926)"+InfluxDBPublicParam.TIME_ZONE; "' and time >= '" + forwardStartTime + "'and time <= '" +forwardEndTime + "'"+"group by time("+timeInterval+"m) ,* fill(0.0031415926)"+InfluxDBPublicParam.TIME_ZONE;
dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2); dataHarmPowerU2List = dataVMapper.getSqlResult(SqlU2);
//数据校验 //数据校验
@@ -1163,24 +1163,31 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
*/ */
public static void linearInterpolation(List<CarryCapcityData> data) { public static void linearInterpolation(List<CarryCapcityData> data) {
for (int i = 0; i < data.size(); i++) {
if (data.get(i).getValue() == DEFAULTVALUE ||Objects.isNull(data.get(i).getValue())) {
data.stream().collect(Collectors.groupingBy(CarryCapcityData::getPhaseType)).forEach((k,v)->{
for (int i = 0; i < v.size(); i++) {
if (v.get(i).getValue() == DEFAULTVALUE ||Objects.isNull(v.get(i).getValue())) {
int prevIndex = i - 1; int prevIndex = i - 1;
int nextIndex = i + 1; int nextIndex = i + 1;
while (prevIndex >= 0 && (data.get(prevIndex).getValue() == DEFAULTVALUE|| Objects.isNull(data.get(prevIndex).getValue()))) { while (prevIndex >= 0 && (v.get(prevIndex).getValue() == DEFAULTVALUE|| Objects.isNull(v.get(prevIndex).getValue()))) {
prevIndex--; prevIndex--;
} }
while (nextIndex < data.size() && (data.get(nextIndex).getValue() == DEFAULTVALUE|| Objects.isNull(data.get(nextIndex).getValue()))) { while (nextIndex < v.size() && (v.get(nextIndex).getValue() == DEFAULTVALUE|| Objects.isNull(v.get(nextIndex).getValue()))) {
nextIndex++; nextIndex++;
} }
if (prevIndex >= 0 && nextIndex < data.size()) { if (prevIndex >= 0 && nextIndex < v.size()) {
double slope = (data.get(nextIndex).getValue() - data.get(prevIndex).getValue()) / (nextIndex - prevIndex); double slope = (v.get(nextIndex).getValue() - v.get(prevIndex).getValue()) / (nextIndex - prevIndex);
data.get(i).setValue(data.get(prevIndex).getValue() + slope * (i - prevIndex)); v.get(i).setValue(v.get(prevIndex).getValue() + slope * (i - prevIndex));
} else { } else {
data.get(i).setValue(DEFAULTVALUE); v.get(i).setValue(DEFAULTVALUE);
} }
} }
} }
});
} }
/** /**
@@ -1192,72 +1199,76 @@ public class CarryCapcityServiceImpl implements CarryCapcityService {
*/ */
public static void linearInterpolationI(List<DataI> data) { public static void linearInterpolationI(List<DataI> data) {
for (int i = 0; i < data.size(); i++) { data.stream().collect(Collectors.groupingBy(DataI::getPhaseType)).forEach((k,v)->{
if (data.get(i).getI2() == DEFAULTVALUE||Objects.isNull(data.get(i).getI2())) { for (int i = 0; i < v.size(); i++) {
if (v.get(i).getI2() == DEFAULTVALUE||Objects.isNull(v.get(i).getI2())) {
int prevIndex = i - 1; int prevIndex = i - 1;
int nextIndex = i + 1; int nextIndex = i + 1;
while (prevIndex >= 0 && (data.get(prevIndex).getI2() == DEFAULTVALUE||Objects.isNull(data.get(prevIndex).getI2()))) { while (prevIndex >= 0 && (v.get(prevIndex).getI2() == DEFAULTVALUE||Objects.isNull(v.get(prevIndex).getI2()))) {
prevIndex--; prevIndex--;
} }
while (nextIndex < data.size() && (data.get(nextIndex).getI2() == DEFAULTVALUE||Objects.isNull(data.get(nextIndex).getI2()))) { while (nextIndex < v.size() && (v.get(nextIndex).getI2() == DEFAULTVALUE||Objects.isNull(v.get(nextIndex).getI2()))) {
nextIndex++; nextIndex++;
} }
if (prevIndex >= 0 && nextIndex < data.size()) { if (prevIndex >= 0 && nextIndex < v.size()) {
double slope = (data.get(nextIndex).getI2() - data.get(prevIndex).getI2()) / (nextIndex - prevIndex); double slope = (v.get(nextIndex).getI2() - v.get(prevIndex).getI2()) / (nextIndex - prevIndex);
data.get(i).setI2(data.get(prevIndex).getI2() + slope * (i - prevIndex)); v.get(i).setI2(v.get(prevIndex).getI2() + slope * (i - prevIndex));
data.get(i).setI3(data.get(prevIndex).getI3() + slope * (i - prevIndex)); v.get(i).setI3(v.get(prevIndex).getI3() + slope * (i - prevIndex));
data.get(i).setI4(data.get(prevIndex).getI4() + slope * (i - prevIndex)); v.get(i).setI4(v.get(prevIndex).getI4() + slope * (i - prevIndex));
data.get(i).setI5(data.get(prevIndex).getI5() + slope * (i - prevIndex)); v.get(i).setI5(v.get(prevIndex).getI5() + slope * (i - prevIndex));
data.get(i).setI6(data.get(prevIndex).getI6() + slope * (i - prevIndex)); v.get(i).setI6(v.get(prevIndex).getI6() + slope * (i - prevIndex));
data.get(i).setI7(data.get(prevIndex).getI7() + slope * (i - prevIndex)); v.get(i).setI7(v.get(prevIndex).getI7() + slope * (i - prevIndex));
data.get(i).setI8(data.get(prevIndex).getI8() + slope * (i - prevIndex)); v.get(i).setI8(v.get(prevIndex).getI8() + slope * (i - prevIndex));
data.get(i).setI9(data.get(prevIndex).getI9() + slope * (i - prevIndex)); v.get(i).setI9(v.get(prevIndex).getI9() + slope * (i - prevIndex));
data.get(i).setI10(data.get(prevIndex).getI10() + slope * (i - prevIndex)); v.get(i).setI10(v.get(prevIndex).getI10() + slope * (i - prevIndex));
data.get(i).setI11(data.get(prevIndex).getI11() + slope * (i - prevIndex)); v.get(i).setI11(v.get(prevIndex).getI11() + slope * (i - prevIndex));
data.get(i).setI12(data.get(prevIndex).getI12() + slope * (i - prevIndex)); v.get(i).setI12(v.get(prevIndex).getI12() + slope * (i - prevIndex));
data.get(i).setI13(data.get(prevIndex).getI13() + slope * (i - prevIndex)); v.get(i).setI13(v.get(prevIndex).getI13() + slope * (i - prevIndex));
data.get(i).setI14(data.get(prevIndex).getI14() + slope * (i - prevIndex)); v.get(i).setI14(v.get(prevIndex).getI14() + slope * (i - prevIndex));
data.get(i).setI15(data.get(prevIndex).getI15() + slope * (i - prevIndex)); v.get(i).setI15(v.get(prevIndex).getI15() + slope * (i - prevIndex));
data.get(i).setI16(data.get(prevIndex).getI16() + slope * (i - prevIndex)); v.get(i).setI16(v.get(prevIndex).getI16() + slope * (i - prevIndex));
data.get(i).setI17(data.get(prevIndex).getI17() + slope * (i - prevIndex)); v.get(i).setI17(v.get(prevIndex).getI17() + slope * (i - prevIndex));
data.get(i).setI18(data.get(prevIndex).getI18() + slope * (i - prevIndex)); v.get(i).setI18(v.get(prevIndex).getI18() + slope * (i - prevIndex));
data.get(i).setI19(data.get(prevIndex).getI19() + slope * (i - prevIndex)); v.get(i).setI19(v.get(prevIndex).getI19() + slope * (i - prevIndex));
data.get(i).setI20(data.get(prevIndex).getI20() + slope * (i - prevIndex)); v.get(i).setI20(v.get(prevIndex).getI20() + slope * (i - prevIndex));
data.get(i).setI21(data.get(prevIndex).getI21() + slope * (i - prevIndex)); v.get(i).setI21(v.get(prevIndex).getI21() + slope * (i - prevIndex));
data.get(i).setI22(data.get(prevIndex).getI22() + slope * (i - prevIndex)); v.get(i).setI22(v.get(prevIndex).getI22() + slope * (i - prevIndex));
data.get(i).setI23(data.get(prevIndex).getI23() + slope * (i - prevIndex)); v.get(i).setI23(v.get(prevIndex).getI23() + slope * (i - prevIndex));
data.get(i).setI24(data.get(prevIndex).getI24() + slope * (i - prevIndex)); v.get(i).setI24(v.get(prevIndex).getI24() + slope * (i - prevIndex));
data.get(i).setI25(data.get(prevIndex).getI25() + slope * (i - prevIndex)); v.get(i).setI25(v.get(prevIndex).getI25() + slope * (i - prevIndex));
} else { } else {
data.get(i).setI2(DEFAULTVALUE); v.get(i).setI2(DEFAULTVALUE);
data.get(i).setI3(DEFAULTVALUE); v.get(i).setI3(DEFAULTVALUE);
data.get(i).setI4(DEFAULTVALUE); v.get(i).setI4(DEFAULTVALUE);
data.get(i).setI5(DEFAULTVALUE); v.get(i).setI5(DEFAULTVALUE);
data.get(i).setI6(DEFAULTVALUE); v.get(i).setI6(DEFAULTVALUE);
data.get(i).setI7(DEFAULTVALUE); v.get(i).setI7(DEFAULTVALUE);
data.get(i).setI8(DEFAULTVALUE); v.get(i).setI8(DEFAULTVALUE);
data.get(i).setI9(DEFAULTVALUE); v.get(i).setI9(DEFAULTVALUE);
data.get(i).setI10(DEFAULTVALUE); v.get(i).setI10(DEFAULTVALUE);
data.get(i).setI11(DEFAULTVALUE); v.get(i).setI11(DEFAULTVALUE);
data.get(i).setI12(DEFAULTVALUE); v.get(i).setI12(DEFAULTVALUE);
data.get(i).setI13(DEFAULTVALUE); v.get(i).setI13(DEFAULTVALUE);
data.get(i).setI14(DEFAULTVALUE); v.get(i).setI14(DEFAULTVALUE);
data.get(i).setI15(DEFAULTVALUE); v.get(i).setI15(DEFAULTVALUE);
data.get(i).setI16(DEFAULTVALUE); v.get(i).setI16(DEFAULTVALUE);
data.get(i).setI17(DEFAULTVALUE); v.get(i).setI17(DEFAULTVALUE);
data.get(i).setI18(DEFAULTVALUE); v.get(i).setI18(DEFAULTVALUE);
data.get(i).setI19(DEFAULTVALUE); v.get(i).setI19(DEFAULTVALUE);
data.get(i).setI20(DEFAULTVALUE); v.get(i).setI20(DEFAULTVALUE);
data.get(i).setI21(DEFAULTVALUE); v.get(i).setI21(DEFAULTVALUE);
data.get(i).setI22(DEFAULTVALUE); v.get(i).setI22(DEFAULTVALUE);
data.get(i).setI23(DEFAULTVALUE); v.get(i).setI23(DEFAULTVALUE);
data.get(i).setI24(DEFAULTVALUE); v.get(i).setI24(DEFAULTVALUE);
data.get(i).setI25(DEFAULTVALUE); v.get(i).setI25(DEFAULTVALUE);
} }
} }
} }
});
} }
/** /**

View File

@@ -289,7 +289,7 @@ public class ResponsibilityAlgorithm {
//EK计算用于后续计算FK不含背景的用户责任指标、HK包含背景的用户责任指标 //EK计算用于后续计算FK不含背景的用户责任指标、HK包含背景的用户责任指标
//float **EKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 //float **EKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
//for (int i = 0; i < TL; i++) //for (int i = 0; i < TL; i++)
//EKarr[i] = (float *)malloc(TL * sizeof(float)); //EKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
float[][] EKarr; float[][] EKarr;
EKarr = dyEKCom(simCor, Pdata, width, P, TL); EKarr = dyEKCom(simCor, Pdata, width, P, TL);
@@ -303,7 +303,7 @@ public class ResponsibilityAlgorithm {
//不含背景的用户谐波责任指标 //不含背景的用户谐波责任指标
//float **FKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 //float **FKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
//for (int i = 0; i < TL; i++) //for (int i = 0; i < TL; i++)
//FKarr[i] = (float *)malloc(TL * sizeof(float)); //FKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
float[][] FKarr; float[][] FKarr;
FKarr = DyFKCom(EKdata, width, P, TL); FKarr = DyFKCom(EKdata, width, P, TL);
RealMatrix FKdata = MatrixUtils.createRealMatrix(slcorlength, P); RealMatrix FKdata = MatrixUtils.createRealMatrix(slcorlength, P);
@@ -316,7 +316,7 @@ public class ResponsibilityAlgorithm {
//包含背景的谐波责任指标 //包含背景的谐波责任指标
//float **HKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 //float **HKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间
//for (int i = 0; i < TL; i++) //for (int i = 0; i < TL; i++)
//HKarr[i] = (float *)malloc(TL * sizeof(float)); //HKarr[i] = (float *)malloc(TL * Float.SIZE / Byte.SIZE);
float[][] HKarr; float[][] HKarr;
HKarr = DyHKCom(bjCore, EKdata, width, P, TL); HKarr = DyHKCom(bjCore, EKdata, width, P, TL);
RealMatrix HKdata = MatrixUtils.createRealMatrix(slcorlength, (P + 1)); RealMatrix HKdata = MatrixUtils.createRealMatrix(slcorlength, (P + 1));

View File

@@ -1,20 +1,27 @@
package com.njcn.auth.controller; package com.njcn.auth.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONObject;
import com.nimbusds.jose.jwk.JWKSet; import com.nimbusds.jose.jwk.JWKSet;
import com.nimbusds.jose.jwk.RSAKey; import com.nimbusds.jose.jwk.RSAKey;
import com.njcn.auth.service.UserTokenService; import com.njcn.auth.service.UserTokenService;
import com.njcn.auth.utils.AuthPubUtil;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType; import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.constant.SecurityConstants; import com.njcn.common.pojo.constant.SecurityConstants;
import com.njcn.common.pojo.dto.UserTokenInfo; import com.njcn.common.pojo.dto.UserTokenInfo;
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.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.common.utils.sm.DesUtils; import com.njcn.common.utils.sm.DesUtils;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import com.njcn.user.api.PassWordRuleFeugnClient;
import com.njcn.user.api.UserFeignClient; import com.njcn.user.api.UserFeignClient;
import com.njcn.user.enums.UserResponseEnum;
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;
@@ -39,6 +46,7 @@ import java.security.interfaces.RSAPublicKey;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author hongawen * @author hongawen
@@ -59,11 +67,13 @@ public class AuthController extends BaseController {
private final UserFeignClient userFeignClient; private final UserFeignClient userFeignClient;
private final PassWordRuleFeugnClient passWordRuleFeugnClient;
private final UserTokenService userTokenService; private final UserTokenService userTokenService;
@ApiIgnore @ApiIgnore
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.AUTHENTICATE) @OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.AUTHENTICATE)
@ApiOperation("登录认证") @ApiOperation("登录认证")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = SecurityConstants.GRANT_TYPE, defaultValue = "password", value = "授权模式", required = true), @ApiImplicitParam(name = SecurityConstants.GRANT_TYPE, defaultValue = "password", value = "授权模式", required = true),
@@ -80,6 +90,8 @@ public class AuthController extends BaseController {
public Object postAccessToken(@ApiIgnore Principal principal, @RequestParam @ApiIgnore Map<String, String> parameters) throws HttpRequestMethodNotSupportedException { public Object postAccessToken(@ApiIgnore Principal principal, @RequestParam @ApiIgnore Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
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);
@@ -87,6 +99,28 @@ public class AuthController extends BaseController {
//短信方式登录,将手机号赋值为用户名 //短信方式登录,将手机号赋值为用户名
username = parameters.get(SecurityConstants.PHONE); username = parameters.get(SecurityConstants.PHONE);
} }
//判断当前登录是否超过最大并发数
UserStrategy data = passWordRuleFeugnClient.getUserStrategy().getData();
String onlineUserKey = SecurityConstants.TOKEN_ONLINE_PREFIX;
List<UserTokenInfo> onLineUser = (List<UserTokenInfo>) redisUtil.getLikeListAllValues(onlineUserKey);
if(CollectionUtil.isNotEmpty(onLineUser)){
String finalUsername = username;
onLineUser = onLineUser.stream().filter(item->{
JSONObject jsonObject = AuthPubUtil.getLoginByToken(item.getRefreshToken());
String login = jsonObject.getStr(SecurityConstants.USER_NAME_KEY);
long exp = Long.parseLong(jsonObject.getStr(SecurityConstants.JWT_EXP));
long now = Calendar.getInstance().getTimeInMillis()/1000;
return (exp > now) && !login.equals(finalUsername);
}).collect(Collectors.toList());
}
Integer maxNum = data.getMaxNum();
if((CollectionUtil.isNotEmpty(onLineUser)?onLineUser.size():0)>=maxNum){
throw new BusinessException(UserResponseEnum.LOGIN_USER_OVERLIMIT);
}
if (grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) { if (grantType.equalsIgnoreCase(SecurityConstants.REFRESH_TOKEN_KEY)) {
//如果是刷新token需要去黑名单校验 //如果是刷新token需要去黑名单校验
userTokenService.judgeRefreshToken(parameters.get(SecurityConstants.REFRESH_TOKEN_KEY)); userTokenService.judgeRefreshToken(parameters.get(SecurityConstants.REFRESH_TOKEN_KEY));
@@ -106,6 +140,7 @@ public class AuthController extends BaseController {
} }
} }
@OperateInfo(info = LogEnum.SYSTEM_SERIOUS, operateType = OperateType.LOGOUT)
@ApiOperation("用户登出系统") @ApiOperation("用户登出系统")
@DeleteMapping("/logout") @DeleteMapping("/logout")
public HttpResult<Object> logout() { public HttpResult<Object> logout() {

View File

@@ -104,8 +104,8 @@ public class UserTokenService {
redisUtil.saveByKeyWithExpire(onlineUserKey, userTokenInfo, refreshLifeTime.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"))); redisUtil.saveByKeyWithExpire(onlineUserKey, userTokenInfo, refreshLifeTime.plusMinutes(5L).toEpochSecond(ZoneOffset.of("+8")) - LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")));
//记录成功登录后的信息 //记录成功登录后的信息
LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, nickName, ip, "登录认证", OperateType.AUTHENTICATE, 1, "", 0, 1, generalInfo.getMicroServiceName(), userIndex,LocalDateTime.now()); //LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, nickName, ip, "登录认证", OperateType.AUTHENTICATE, 1, "", 0, 1, generalInfo.getMicroServiceName(), userIndex,LocalDateTime.now());
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false); //publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
} }
/** /**

View File

@@ -1,9 +1,12 @@
package com.njcn.auth.utils; package com.njcn.auth.utils;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import okhttp3.*; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.nimbusds.jose.JWSObject;
import com.njcn.common.pojo.constant.SecurityConstants;
import lombok.SneakyThrows;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -28,4 +31,13 @@ public class AuthPubUtil {
return String.join("", textList); return String.join("", textList);
} }
@SneakyThrows
public static JSONObject getLoginByToken(String token){
JWSObject jwsObject = JWSObject.parse(token);
String payload = jwsObject.getPayload().toString();
JSONObject jsonObject = JSONUtil.parseObj(payload);
return jsonObject;
}
} }

View File

@@ -5,7 +5,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import java.util.Collection;
import java.util.Map;
@Schema(description = "管理后台 - 不通过流程任务的 Request VO") @Schema(description = "管理后台 - 不通过流程任务的 Request VO")
@Data @Data
@@ -21,4 +22,9 @@ public class BpmTaskRejectParam {
@NotBlank(message = "审批意见不能为空") @NotBlank(message = "审批意见不能为空")
private String reason; private String reason;
@ApiModelProperty("抄送的用户编号数组")
private Collection<String> copyUserIds;
@ApiModelProperty("变量实例(动态表单)")
private Map<String, Object> variables;
} }

View File

@@ -0,0 +1,27 @@
package com.njcn.bpm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
/**
* 统筹流程实例的公共方案
* @author hongawen
* @version 1.0.0
* @date 2024年06月12日 18:14
*/
public interface IBpmReasonService<T> extends IService<T> {
/**
* 根据业务id实时更新当前业务流程状态
* @param businessId 实际业务id
* @param status 流程实例当前状态具体参考BpmTaskStatusEnum枚举
*/
void updateProcessStatus(String businessId,String reason, Integer status);
/**
* 根据业务id获取历史审批id以及该任务的重要信息
* @param businessId 业务流程id
*/
BpmInstanceInfo getInstanceInfo(String businessId);
}

View File

@@ -35,6 +35,12 @@ public class BpmProcessInstanceStatusEvent extends ApplicationEvent {
*/ */
private String businessKey; private String businessKey;
/**
* 审核消息
* 例如说,请假
*/
private String reason;
public BpmProcessInstanceStatusEvent(Object source) { public BpmProcessInstanceStatusEvent(Object source) {
super(source); super(source);
} }

View File

@@ -31,7 +31,7 @@ public class BpmSupervisionStatusListener implements ApplicationListener<BpmPro
* @param event 事件 * @param event 事件
*/ */
protected void onEvent(BpmProcessInstanceStatusEvent event) { protected void onEvent(BpmProcessInstanceStatusEvent event) {
businessCommonFeignClient.updateProcessStatus(event.getProcessDefinitionKey(),event.getBusinessKey(), event.getStatus()); businessCommonFeignClient.updateProcessStatus(event.getProcessDefinitionKey(),event.getBusinessKey(),event.getReason(), event.getStatus());
} }
} }

View File

@@ -4,6 +4,8 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.dto.PageResult; import com.njcn.bpm.pojo.dto.PageResult;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam; import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
import com.njcn.bpm.pojo.param.task.BpmTaskRejectParam;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.delegate.event.FlowableCancelledEvent;
import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
@@ -146,6 +148,13 @@ public interface IBpmProcessInstanceService {
*/ */
void updateProcessInstanceReject(String id, String reason); void updateProcessInstanceReject(String id, String reason);
/**
* 更新 ProcessInstance 拓展记录为不通过
*
* @param id 流程编号
* @param reason 理由。例如说,审批不通过时,需要传递该值
*/
void updateProcessInstanceFromReject(String id, String reason, TaskService taskService, BpmTaskRejectParam bpmTaskRejectParam);
/** /**
* 用于测试过程删除流程,正式环境慎用 * 用于测试过程删除流程,正式环境慎用
* @author cdf * @author cdf

View File

@@ -1,6 +1,7 @@
package com.njcn.bpm.service.task.impl; package com.njcn.bpm.service.task.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@@ -13,6 +14,7 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.dto.PageResult; import com.njcn.bpm.pojo.dto.PageResult;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam; import com.njcn.bpm.pojo.param.instance.BpmProcessInstancePageParam;
import com.njcn.bpm.pojo.param.task.BpmTaskRejectParam;
import com.njcn.bpm.service.IBpmProcessDefinitionService; import com.njcn.bpm.service.IBpmProcessDefinitionService;
import com.njcn.bpm.service.task.IBpmProcessInstanceService; import com.njcn.bpm.service.task.IBpmProcessInstanceService;
import com.njcn.bpm.strategy.BpmTaskCandidateStartUserSelectStrategy; import com.njcn.bpm.strategy.BpmTaskCandidateStartUserSelectStrategy;
@@ -30,6 +32,7 @@ import org.flowable.bpmn.model.UserTask;
import org.flowable.common.engine.impl.identity.Authentication; import org.flowable.common.engine.impl.identity.Authentication;
import org.flowable.engine.HistoryService; import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.delegate.event.FlowableCancelledEvent;
import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.repository.ProcessDefinition;
@@ -90,7 +93,6 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
} }
@Override @Override
public List<ProcessInstance> getProcessInstances(Set<String> ids) { public List<ProcessInstance> getProcessInstances(Set<String> ids) {
return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list(); return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list();
@@ -285,18 +287,30 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
@Override @Override
public void updateProcessInstanceWhenApprove(ProcessInstance instance) { public void updateProcessInstanceWhenApprove(ProcessInstance instance) {
//判断传入参数是否是,不通过信息不通过则需要更新流程信息为不通过
Integer processInstanceStatus = BpmProcessInstanceStatusEnum.APPROVE.getStatus();
Map<String, Object> processVariables = instance.getProcessVariables();
if (processVariables.containsKey(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS)) {
Integer stata =Integer.valueOf(processVariables.get(BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS).toString());
if (BpmProcessInstanceStatusEnum.REJECT.getStatus()==stata) {
processInstanceStatus = BpmProcessInstanceStatusEnum.REJECT.getStatus();
}
}
// 1. 更新流程实例 status // 1. 更新流程实例 status
runtimeService.setVariable(instance.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, runtimeService.setVariable(instance.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS,
BpmProcessInstanceStatusEnum.APPROVE.getStatus()); processInstanceStatus);
// 2. 发送流程被【通过】的消息 // 2. 发送流程被【通过】的消息
// messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceApproveMessage(instance)); // messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceApproveMessage(instance));
// 3. 发送流程实例的状态事件 // 3. 发送流程实例的状态事件
// 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance // 注意:此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance
// 在审核不通过时,会触该信息,设置在审核通过时,才发送
if(BpmProcessInstanceStatusEnum.APPROVE.getStatus()==processInstanceStatus){
HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId()); HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId());
processInstanceEventPublisher.sendProcessInstanceResultEvent( processInstanceEventPublisher.sendProcessInstanceResultEvent(
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, BpmProcessInstanceStatusEnum.APPROVE.getStatus())); BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, processInstanceStatus));
}
} }
@Override @Override
@@ -314,7 +328,31 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService
// 4. 发送流程实例的状态事件 // 4. 发送流程实例的状态事件
processInstanceEventPublisher.sendProcessInstanceResultEvent( processInstanceEventPublisher.sendProcessInstanceResultEvent(
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, BpmProcessInstanceStatusEnum.REJECT.getStatus())); BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, reason, BpmProcessInstanceStatusEnum.REJECT.getStatus()));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateProcessInstanceFromReject(String id, String reason, TaskService taskService, BpmTaskRejectParam bpmTaskRejectParam) {
// 1. 更新流程实例 status
runtimeService.setVariable(id, BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, BpmProcessInstanceStatusEnum.REJECT.getStatus());
// 2. 删除流程实例,以实现驳回任务时,取消整个审批流程
ProcessInstance processInstance = getProcessInstance(id);
// 3.3 调用 BPM complete 去完成任务
// 其中variables 是存储动态表单到 local 任务级别。过滤一下,避免 ProcessInstance 系统级的变量被占用
if (CollectionUtil.isNotEmpty(bpmTaskRejectParam.getVariables())) {
Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(bpmTaskRejectParam.getVariables());
taskService.complete(bpmTaskRejectParam.getId(), variables, true);
} else {
taskService.complete(bpmTaskRejectParam.getId());
}
//这是删除所有信息,
// deleteProcessInstance(id, StrUtil.format(BpmDeleteReasonEnum.REJECT_TASK.format(reason)));
// 4. 发送流程实例的状态事件
processInstanceEventPublisher.sendProcessInstanceResultEvent(
BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, reason, BpmProcessInstanceStatusEnum.REJECT.getStatus()));
} }
public void deleteProcessInstance(String id, String reason) { public void deleteProcessInstance(String id, String reason) {

View File

@@ -346,7 +346,7 @@ public class BpmTaskServiceImpl implements IBpmTaskService {
BpmCommentTypeEnum.REJECT.formatComment(bpmTaskRejectParam.getReason())); BpmCommentTypeEnum.REJECT.formatComment(bpmTaskRejectParam.getReason()));
// 3. 更新流程实例,审批不通过! // 3. 更新流程实例,审批不通过!
processInstanceService.updateProcessInstanceReject(instance.getProcessInstanceId(), bpmTaskRejectParam.getReason()); processInstanceService.updateProcessInstanceFromReject(instance.getProcessInstanceId(), bpmTaskRejectParam.getReason(), taskService, bpmTaskRejectParam);
} }
/** /**

View File

@@ -105,12 +105,13 @@ public interface BpmProcessInstanceConvert {
return bpmProcessInstanceStatusEvent; return bpmProcessInstanceStatusEvent;
} }
default BpmProcessInstanceStatusEvent buildProcessInstanceStatusEvent(Object source, ProcessInstance instance, Integer status) { default BpmProcessInstanceStatusEvent buildProcessInstanceStatusEvent(Object source, ProcessInstance instance,String reason, Integer status) {
BpmProcessInstanceStatusEvent bpmProcessInstanceStatusEvent = new BpmProcessInstanceStatusEvent(source); BpmProcessInstanceStatusEvent bpmProcessInstanceStatusEvent = new BpmProcessInstanceStatusEvent(source);
bpmProcessInstanceStatusEvent.setId(instance.getId()); bpmProcessInstanceStatusEvent.setId(instance.getId());
bpmProcessInstanceStatusEvent.setStatus(status); bpmProcessInstanceStatusEvent.setStatus(status);
bpmProcessInstanceStatusEvent.setProcessDefinitionKey(instance.getProcessDefinitionKey()); bpmProcessInstanceStatusEvent.setProcessDefinitionKey(instance.getProcessDefinitionKey());
bpmProcessInstanceStatusEvent.setBusinessKey(instance.getBusinessKey()); bpmProcessInstanceStatusEvent.setBusinessKey(instance.getBusinessKey());
bpmProcessInstanceStatusEvent.setReason(reason);
return bpmProcessInstanceStatusEvent; return bpmProcessInstanceStatusEvent;
} }

View File

@@ -21,18 +21,17 @@ public class GenerateCode {
private static final String TARGET_DIR = "D://code"; private static final String TARGET_DIR = "D://code";
private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/pqsinfo_jb"; private static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/pqsinfo";
// private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase"; // private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase";
private static final String USERNAME = "root"; private static final String USERNAME = "root";
private static final String PASSWORD = "njcnpqs"; private static final String PASSWORD = "123456";
public static void main(String[] args) { public static void main(String[] args) {
List<Module> modules = Stream.of( List<Module> modules = Stream.of(
new Module("hongawen", "com.njcn.supervision", "survey", Stream.of( new Module("xy", "com.njcn.supervision", "survey", Stream.of(
"supervision_survey_plan", "supervision_line_warning"
"supervision_survey_test"
).collect(Collectors.toList()), "supervision_") ).collect(Collectors.toList()), "supervision_")
).collect(Collectors.toList()); ).collect(Collectors.toList());
generateJavaFile(modules); generateJavaFile(modules);

View File

@@ -41,7 +41,7 @@ public interface PatternRegex {
/** /**
* 登录名只能输入3-16位的英文字母或数字 * 登录名只能输入3-16位的英文字母或数字
*/ */
String LOGIN_NAME_REGEX = "[a-zA-Z0-9_]{3,16}"; String LOGIN_NAME_REGEX = "^[a-zA-Z_.]{1}[a-zA-Z0-9_.]{2,15}$";
/** /**
* 手机号必须有11位并且为数字是正常的手机·号码开头 * 手机号必须有11位并且为数字是正常的手机·号码开头

View File

@@ -75,4 +75,6 @@ public class LogInfoDTO implements Serializable {
@JsonSerialize(using = LocalDateTimeSerializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime; private LocalDateTime createTime;
} }

View File

@@ -84,6 +84,8 @@ public enum CommonResponseEnum {
FILE_EXIST("A0096", "文件已存在"), FILE_EXIST("A0096", "文件已存在"),
FILE_NAME_ERROR("A0096", "文件格式有误"),
FILE_SIZE_ERROR("A0096", "文件过大"), FILE_SIZE_ERROR("A0096", "文件过大"),
FILE_XLSX_ERROR("A0096", "请上传excel文件"), FILE_XLSX_ERROR("A0096", "请上传excel文件"),
@@ -103,12 +105,18 @@ public enum CommonResponseEnum {
ADVANCE_RESPONSE_ENUM("A00105", "终端响应枚举类型"), ADVANCE_RESPONSE_ENUM("A00105", "终端响应枚举类型"),
DYNAMIC_RESPONSE_ENUM("A00002", "动态枚举内容"),
; ;
private final String code; private final String code;
private final String message; private String message;
public void setMessage(String message) {
this.message = message;
}
CommonResponseEnum(String code, String message) { CommonResponseEnum(String code, String message) {
this.code = code; this.code = code;

View File

@@ -1,6 +1,7 @@
package com.njcn.common.utils; package com.njcn.common.utils;
import cn.hutool.core.text.StrPool; import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedReader; import java.io.BufferedReader;
@@ -56,5 +57,115 @@ public class FileUtil {
} }
} }
/**
* 判断文件是否为word格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsWord(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"doc", "docx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为pdf格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsPdf(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"pdf"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为excel格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsExcel(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"xls", "xlsx"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 判断文件是否为excel格式
*
* @param fileName 文件名
*/
public static boolean judgeFileIsZip(String fileName) {
// 检查文件名是否为空
if (StrUtil.isBlank(fileName)) {
return false;
}
// 获取文件扩展名
String fileExtension = getFileExtension(fileName);
// 定义支持的文件类型
String[] allowedExtensions = {"zip", "rar"};
// 检查扩展名是否在允许的列表中
for (String ext : allowedExtensions) {
if (ext.equalsIgnoreCase(fileExtension)) {
return true;
}
}
return false;
}
/**
* 从文件名中提取扩展名
*
* @param fileName 文件名
* @return 扩展名
*/
private static String getFileExtension(String fileName) {
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex == -1) {
return "";
}
return fileName.substring(dotIndex + 1);
}
} }

View File

@@ -61,7 +61,7 @@ public class DataTest {
} }
public static void main(String[] args) { public static void main(String[] args) {
InfluxDbUtils influxDBUtil = new InfluxDbUtils("admin", "123456", "http://192.168.1.18:8086", "pqsbase_sjzx", ""); InfluxDbUtils influxDBUtil = new InfluxDbUtils("root", "123456", "http://127.0.0.1:8086", "pqsadmin_jb", "");
insert(influxDBUtil); insert(influxDBUtil);
} }
@@ -72,16 +72,88 @@ public class DataTest {
//单条数据插入 //单条数据插入
public static void insert(InfluxDbUtils influxDBUtil) { public static void insert(InfluxDbUtils influxDBUtil) {
// Map<String, String> tags = new HashMap<>();
// long time = Long.parseLong("1719921600000");
// tags.put("line_id", "82a9bad93e784c37135db4589794e6b0");
// tags.put("phasic_type", "A");
// tags.put("value_type","CP95");
// tags.put("quality_flag","0");
//
// Map<String, Object> fields = new HashMap<>();
// fields.put("i_2",0);
// fields.put("i_3",0);
// fields.put("i_4",0);
// fields.put("i_5",6.02);
// fields.put("i_6",0);
// fields.put("i_7",0);
// fields.put("i_8",0);
// fields.put("i_9",0);
// fields.put("i_10",0);
// fields.put("i_11",0);
// fields.put("i_12",0);
// fields.put("i_13",0);
// fields.put("i_14",0);
// fields.put("i_15",3.25);
// fields.put("i_16",0);
// fields.put("i_17",0);
// fields.put("i_18",0);
// fields.put("i_19",0);
// fields.put("i_20",0);
// fields.put("i_21",0);
// fields.put("i_22",0);
// fields.put("i_23",0);
// fields.put("i_24",3.52);
// fields.put("i_25",0);
// influxDBUtil.insert("data_i", tags, fields, time, TimeUnit.MILLISECONDS);
Map<String, String> tags = new HashMap<>(); Map<String, String> tags = new HashMap<>();
long time = Long.parseLong("1675958400000"); long time = Long.parseLong("1719842400000");
tags.put("dev_id", "57d121d45a26f3cc1d7b6ba541f895c0"); tags.put("line_id", "ebdf6cbc275c5d7ed8104fcb3792fb0a");
tags.put("phasic_type", "A");
tags.put("value_type","CP95");
tags.put("quality_flag","0");
Map<String, Object> fields = new HashMap<>(); Map<String, Object> fields = new HashMap<>();
fields.put("v_1",10.0);
fields.put("v_2",0);
fields.put("v_3",0);
fields.put("v_4",0);
fields.put("v_5",6.02);
fields.put("v_6",0);
fields.put("v_7",0);
fields.put("v_8",0);
fields.put("v_9",0);
fields.put("v_10",0);
fields.put("v_11",0);
fields.put("v_12",0);
fields.put("v_13",0);
fields.put("v_14",0);
fields.put("v_15",3.25);
fields.put("v_16",0);
fields.put("v_17",0);
fields.put("v_18",0);
fields.put("v_19",0);
fields.put("v_20",0);
fields.put("v_21",0);
fields.put("v_22",0);
fields.put("v_23",0);
fields.put("v_24",3.52);
fields.put("v_25",0);
influxDBUtil.insert("data_inharm_v", tags, fields, time, TimeUnit.MILLISECONDS);
// Map<String, String> tags = new HashMap<>();
// long time = Long.parseLong("1675958400000");
// tags.put("dev_id", "57d121d45a26f3cc1d7b6ba541f895c0");
// Map<String, Object> fields = new HashMap<>();
// fields.put("due",1440); // fields.put("due",1440);
// fields.put("real",1200); // fields.put("real",1200);
fields.put("online_min", 0); // fields.put("online_min", 0);
fields.put("offline_min", 1440); // fields.put("offline_min", 1440);
fields.put("online_rate", 0.0000); // fields.put("online_rate", 0.0000);
influxDBUtil.insert("pqs_onlinerate", tags, fields, time, TimeUnit.MILLISECONDS); // influxDBUtil.insert("pqs_onlinerate", tags, fields, time, TimeUnit.MILLISECONDS);
// long time = Long.parseLong("1655135328135"); // long time = Long.parseLong("1655135328135");
// Map<String, String> tags = new HashMap<>(); // Map<String, String> tags = new HashMap<>();
// // tags.put("line_id", "127fad1dcb0077ac2979141b8473a5e4"); // // tags.put("line_id", "127fad1dcb0077ac2979141b8473a5e4");

View File

@@ -12,6 +12,11 @@ public interface OssPath {
*/ */
String WAVE_DIR="comtrade/"; String WAVE_DIR="comtrade/";
/***
* 下载文件
*/
String DOWNLOAD_DIR="download/";
/*** /***
* 稳态报表 * 稳态报表
*/ */
@@ -136,4 +141,9 @@ public interface OssPath {
*/ */
String ONLINE_REPORT="onlineReport/"; String ONLINE_REPORT="onlineReport/";
/**
* 系统上传文件至装置内,文件存储路径
*/
String SYSTEM_TO_DEV="systemToDev/";
} }

View File

@@ -2,18 +2,15 @@ package com.njcn.poi.excel;
import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.export.ExcelExportService;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import com.njcn.web.utils.HttpServletUtil; import com.njcn.web.utils.HttpServletUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.DVConstraint;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFDataValidation; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint; import org.apache.poi.xssf.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -21,10 +18,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Collection; import java.util.*;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* @author hongawen * @author hongawen
@@ -116,11 +110,31 @@ public class ExcelUtil {
response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/octet-stream;charset=UTF-8"); response.setContentType("application/octet-stream;charset=UTF-8");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, dataSet); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, dataSet);
setTopLevel(workbook, pullDowns);
if (CollUtil.isNotEmpty(pullDowns)) { if (CollUtil.isNotEmpty(pullDowns)) {
int num = 1;
CellStyle cellStyle = workbook.createCellStyle();
DataFormat format = workbook.createDataFormat();
cellStyle.setDataFormat(format.getFormat("@"));
for (PullDown pullDown : pullDowns) { for (PullDown pullDown : pullDowns) {
if (pullDown.getIsText()) {
ExcelUtil.selectListText(workbook, pullDown.getFirstCol(),cellStyle);
} else {
String colName = numberToExcelColumn(num);
int sum = pullDown.getStrings().stream().mapToInt(String::length).sum();
if (sum == 0) {
continue;
}
if (sum > 255) {
ExcelUtil.selectListMaxLength(workbook, pullDown.getFirstCol(), pullDown.getLastCol(), pullDown.getStrings().size(), colName);
num++;
} else {
ExcelUtil.selectList(workbook, pullDown.getFirstCol(), pullDown.getLastCol(), pullDown.getStrings().toArray(new String[]{})); ExcelUtil.selectList(workbook, pullDown.getFirstCol(), pullDown.getLastCol(), pullDown.getStrings().toArray(new String[]{}));
} }
} }
}
}
Sheet sheetAt = workbook.getSheetAt(0); Sheet sheetAt = workbook.getSheetAt(0);
//获取列数 //获取列数
int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells(); int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells();
@@ -239,6 +253,45 @@ public class ExcelUtil {
sheet.addValidationData(validation); sheet.addValidationData(validation);
} }
/**
* @param workbook
* @param firstCol
* @param lastCol
* @param colName 列A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
* @Description: 当下拉框超过最大字符255设置隐藏表单来进行展示
* @Author: wr
* @Date: 2024/8/13 15:07
*/
public static void selectListMaxLength(Workbook workbook, int firstCol, int lastCol, int row, String colName) {
Sheet sheet = workbook.getSheetAt(0);
// 生成下拉列表
// 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列
CellRangeAddressList regions = new CellRangeAddressList(2, 65535, firstCol, lastCol);
String strFormula = workbook.getSheetName(1) + "!$" + colName + "$1:$" + colName + "$" + row;
XSSFDataValidationConstraint hiddentConstraint = new XSSFDataValidationConstraint(DataValidationConstraint.ValidationType.LIST, strFormula);
// 数据有效性对象
DataValidationHelper help = new XSSFDataValidationHelper((XSSFSheet) sheet);
DataValidation validation = help.createValidation(hiddentConstraint, regions);
sheet.addValidationData(validation);
}
/**
* @Description:
* @param workbook
* @param firstCol
* @Author: wr
* @Date: 2024/8/20 10:44
*/
public static void selectListText(Workbook workbook, int firstCol,CellStyle cellStyle) {
Sheet sheet = workbook.getSheetAt(0);
for (int i = 2; i < 65535; i++) {
Row row = sheet.getRow(i);
if(ObjectUtil.isNull(row)){
row = sheet.createRow(i);
}
Cell cell = row.createCell(firstCol);
cell.setCellStyle(cellStyle);
}
}
/** /**
* 指定名称、数据下载报表(带指定标题将*显示比必填信息),带有下拉信息 * 指定名称、数据下载报表(带指定标题将*显示比必填信息),带有下拉信息
@@ -340,5 +393,66 @@ public class ExcelUtil {
sheet.addValidationData(validation); sheet.addValidationData(validation);
} }
/**
* 设置隐藏表单来进行下拉框
*
* @param workbook
* @param pullDowns
*/
private static void setTopLevel(Workbook workbook, List<PullDown> pullDowns) {
int num = 0;
for (PullDown pullDown : pullDowns) {
if (!pullDown.getIsText()) {
int sum = pullDown.getStrings().stream().mapToInt(String::length).sum();
if (sum == 0) {
continue;
}
if (sum > 255) {
// 创建隐藏sheet
String hiddenSheetName = "hiddenSheetA";
if (num == 0) {
workbook.createSheet(hiddenSheetName);
}
//false展示隐藏sheet ,true不展示隐藏sheet
workbook.setSheetHidden(workbook.getSheetIndex(workbook.getSheet(hiddenSheetName)), true);
Sheet sheet = workbook.getSheet(hiddenSheetName);
if (num == 0) {
//sheet.getLastRowNum无法区分 有一行和没有 所以这里先建一行
sheet.createRow(0);
}
Row row; //创建数据行
sheet.setColumnWidth(num, 4000); //设置每列的列宽
for (int j = 0; j < pullDown.getStrings().size(); j++) {
if (sheet.getLastRowNum() < j) {
row = sheet.createRow(j); //创建数据行
} else {
row = sheet.getRow(j);
}
//设置对应单元格的值
row.createCell(num).setCellValue(pullDown.getStrings().get(j));
}
num++;
}
}
}
}
/**
* 获取根据数值获取列字母(1=A,2=B,3=C,.......,27=AA)
*
* @param n
* @return
*/
public static String numberToExcelColumn(int n) {
CellReference cellRef = new CellReference(0, n - 1, false, false); // Row and column are 0-based
int colIndex = cellRef.getCol();
StringBuilder columnName = new StringBuilder();
while (colIndex >= 0) {
columnName.insert(0, (char) ('A' + (colIndex % 26)));
colIndex /= 26;
colIndex--;
}
return columnName.toString();
}
} }

View File

@@ -14,8 +14,13 @@ public class PullDown {
//起始列 //起始列
private Integer firstCol; private Integer firstCol;
//结束列 //结束列
private Integer lastCol; private Integer lastCol;
//是否设置单元格(文本)
private Boolean isText = false;
//属性值 //属性值
private List<String> strings; private List<String> strings;
} }

View File

@@ -74,4 +74,18 @@ public interface AppRedisKey {
*/ */
String FILE_WAITING="fileWaitingKey:"; String FILE_WAITING="fileWaitingKey:";
/**
* 工程信息
*/
String PROJECT_INFO="projectInfoKey:";
String FILE_INFO="fileInfoKey:";
String DEVICE_ROOT_PATH="deviceRootPathKey:";
String DEVICE_MID="deviceMidKey:";
String UPLOAD = "uploadKey:";
String DOWNLOAD = "downloadKey:";
} }

View File

@@ -34,7 +34,13 @@ public enum RedisKeyEnum {
/*** /***
* MQ消息key缓存时间默认72小时 * 60 * 60 * MQ消息key缓存时间默认72小时 * 60 * 60
*/ */
ROCKET_MQ_KEY("ROCKET_MQ", 259200L); ROCKET_MQ_KEY("ROCKET_MQ", 259200L),
/***
* 存放用户的角色关系
*/
USER_ROLE_TYPE_KEY("USER_ROLE_TYPE_KEY", -1L);
private final String key; private final String key;

View File

@@ -51,7 +51,13 @@ public class FeignConfig {
//对结果进行转换 //对结果进行转换
HttpResult<Object> result = PubUtils.json2obj(bodyStr, type); HttpResult<Object> result = PubUtils.json2obj(bodyStr, type);
//如果返回错误,且为内部错误,则直接抛出异常 //如果返回错误,且为内部错误,则直接抛出异常
CommonResponseEnum commonResponseEnum = EnumUtils.getCommonResponseEnumByCode(result.getCode()); CommonResponseEnum commonResponseEnum;
if(result.getCode().equals(CommonResponseEnum.DYNAMIC_RESPONSE_ENUM.getCode())){
commonResponseEnum = CommonResponseEnum.DYNAMIC_RESPONSE_ENUM;
commonResponseEnum.setMessage(result.getMessage());
}else{
commonResponseEnum = EnumUtils.getCommonResponseEnumByCode(result.getCode());
}
switch (commonResponseEnum) { switch (commonResponseEnum) {
case SUCCESS: case SUCCESS:
return result; return result;

View File

@@ -42,6 +42,11 @@ public enum GWSendEnum {
WORK_ORDER_FEEDBACK("workOrderFeedBack", "/pms-ghq-powerquality-start/powerQuality/workOrder/receiveFeedbackInfo"), WORK_ORDER_FEEDBACK("workOrderFeedBack", "/pms-ghq-powerquality-start/powerQuality/workOrder/receiveFeedbackInfo"),
PARK_AND_STATION("parkAndStation", "/pms-ghq-powerquality-start/powerQuality/park/create"), PARK_AND_STATION("parkAndStation", "/pms-ghq-powerquality-start/powerQuality/park/create"),
REPORT_CREATE("reportCreate", "/pms-ghq-powerquality-start/powerQuality/report/create"),
COMM_POINT("commPoint","/pms-ghq-powerquality-start/powerQuality/publicConnection/pqBusMonitorDataStatisticalCreate")
; ;

View File

@@ -22,6 +22,10 @@ public class SendParam {
@ApiModelProperty(value = "统计日期") @ApiModelProperty(value = "统计日期")
private String statisticalDate; private String statisticalDate;
private String statisticalType;
private String isAppend;
@ApiModelProperty(value = "上报参数") @ApiModelProperty(value = "上报参数")
private List stats; private List stats;
} }

View File

@@ -49,6 +49,7 @@ public class LogServiceImpl implements ILogService {
private final MqttPublisher publisher; private final MqttPublisher publisher;
/** /**
* 异步记录controller中返回的信息内容 * 异步记录controller中返回的信息内容
* *
@@ -84,10 +85,12 @@ public class LogServiceImpl implements ILogService {
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false); publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
//推送审计消息功能 //推送审计消息功能
if(severity!=0){ if(severity!=0){
if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)){
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false); publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
//发送邮箱功能 //发送邮箱功能
if(severity==2&&logInfoDTO.getResult()==0){ if(severity==2&&logInfoDTO.getResult()==0){
publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false); //publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
}
} }
} }
//如果存在设备日志注解,则记录设备日志 //如果存在设备日志注解,则记录设备日志
@@ -167,10 +170,12 @@ public class LogServiceImpl implements ILogService {
private void auditPush(Integer severity, LogInfoDTO logInfoDTO) { private void auditPush(Integer severity, LogInfoDTO logInfoDTO) {
//推送审计消息功能 //推送审计消息功能
if(severity !=0){ if(severity !=0){
if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false); publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
//发送邮箱功能 //发送邮箱功能
if (severity == 2 && logInfoDTO.getResult() == 0) { if (severity == 2 && logInfoDTO.getResult() == 0) {
publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false); //publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
}
} }
} }
} }

View File

@@ -343,6 +343,20 @@ public class RequestUtil {
return StrUtil.isBlank(loginName) ? LogInfo.UNKNOWN_USER : loginName; return StrUtil.isBlank(loginName) ? LogInfo.UNKNOWN_USER : loginName;
} }
/**
* ServerHttpRequest获取在网关中存储的用户昵称
*/
public static String getLoginNameByPayload(HttpServletRequest request) {
String loginName = LogInfo.UNKNOWN_USER;
JSONObject jwtPayload = getJwtPayload(request);
if (Objects.nonNull(jwtPayload)) {
String loginNameTemp = jwtPayload.getString(SecurityConstants.USER_NAME_KEY);
loginName = StrUtil.isBlank(loginNameTemp) ? LogInfo.UNKNOWN_USER : loginNameTemp;
}
return loginName;
}
/** /**
* ServerHttpRequest获取在网关中存储的用户昵称 * ServerHttpRequest获取在网关中存储的用户昵称
*/ */

View File

@@ -96,8 +96,8 @@ public enum DeviceResponseEnum {
SAME_ALARM_STRATEGY("A0361","当前等级策略已存在"), SAME_ALARM_STRATEGY("A0361","当前等级策略已存在"),
LINE_GRADE_INDEX_ERR("A0362","异常等级索引"), LINE_GRADE_INDEX_ERR("A0362","异常等级索引"),
LINE_GRADE_LESS("A0363","监测点等级策略缺失"), LINE_GRADE_LESS("A0363","监测点等级策略缺失"),
FLOW_UPDATE("A0364","默认类型必须存在一个") FLOW_UPDATE("A0364","默认类型必须存在一个"),
NEWSTATION_IS_BIND_LINE("A0365","已绑定监测点")
; ;

View File

@@ -34,4 +34,7 @@ public class LineDTO {
@ApiModelProperty(name = "objType",value = "对象类型") @ApiModelProperty(name = "objType",value = "对象类型")
private String objType; private String objType;
@ApiModelProperty(name = "新能源场站信息ID")
private String newStationId;
} }

View File

@@ -3,6 +3,7 @@ package com.njcn.device.biz.pojo.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@@ -30,6 +31,16 @@ public class SubGetBase implements Serializable {
*/ */
private String voltageLevel; private String voltageLevel;
/**
* 经度
*/
private BigDecimal lng;
/**
* 纬度
*/
private BigDecimal lat;
/** /**
* 部门 * 部门
*/ */

View File

@@ -6,10 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pms.api.fallback.MonitorClientFallbackFactory; import com.njcn.device.pms.api.fallback.MonitorClientFallbackFactory;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam; import com.njcn.device.pms.pojo.param.*;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam; import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO; import com.njcn.device.pms.pojo.vo.MonitorVO;
@@ -92,4 +89,7 @@ public interface MonitorClient {
*/ */
@PostMapping("/monitorTypicalList") @PostMapping("/monitorTypicalList")
HttpResult<Page<TypicalSourceOnLine>> monitorTypicalList(@RequestBody TypicalSourceParam param); HttpResult<Page<TypicalSourceOnLine>> monitorTypicalList(@RequestBody TypicalSourceParam param);
@PostMapping("/getMonitorListByParam")
HttpResult<List<Monitor>> getMonitorListByParam(@RequestBody MonitorParam monitorParam);
} }

View File

@@ -7,10 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam; import com.njcn.device.pms.pojo.param.*;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam; import com.njcn.device.pms.pojo.param.gw.TypicalSourceParam;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO; import com.njcn.device.pms.pojo.vo.MonitorVO;
@@ -83,6 +80,12 @@ public class MonitorClientFallbackFactory implements FallbackFactory<MonitorClie
log.error("{}异常,降级处理,异常为:{}", "典型源荷下穿监测点信息接口 ", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "典型源荷下穿监测点信息接口 ", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<Monitor>> getMonitorListByParam(MonitorParam monitorParam) {
log.error("{}异常,降级处理,异常为:{}", "根据条件查询监测点 ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -0,0 +1,58 @@
package com.njcn.device.pms.pojo.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class RunMonitorStatisticalDTO {
private String objId;
private String provinceOrg;
private String provinceOrgName;
private String cityOrg;
private String cityOrgName;
private String maintOrg;
private String maintOrgName;
private String monitorName;
private String monitorVoltageLevel;
private String monitorId;
private String monitorStatus;
private Date monitorOperateDate;
private Date monitorStopDate;
private String substationId;
private String substationName;
private String busId;
private String busName;
private String outLineIntervalId;
private String outLineIntervalName;
private String monitorObjTypeBig;
private String monitorObjTypeSmall;
private String monitorTag;
private String monitorObjName;
private String monitorObjId;
private String isLine;
private BigDecimal minShortCapacity;
private BigDecimal supplyEquipCapacity;
private BigDecimal userProtocolCapacity;
private String terminalCode;
private String terminalManufacturer;
private String terminalModel;
private String terminalManufactureNum;
private String terminalConnect;
private String neutralGround;
private String evtType;
private String statisticalType;
private String statisticalDate;
private String isMonitorOnline;
private String isTerminalOnline;
private Integer onlineMonitorNum;
private Integer runMonitorNum;
private BigDecimal onlineMonitorRate;
private Long expectCollectNum;
private Long actualCollectNum;
private BigDecimal dataFullRate;
}

View File

@@ -65,7 +65,6 @@ public class PowerDistributionareaParam {
private String regionalism; private String regionalism;
@ApiModelProperty(name = "regionalism", value = "设备地区特征") @ApiModelProperty(name = "regionalism", value = "设备地区特征")
@NotBlank(message = "设备地区特征不可为空")
private String devRegionalism; private String devRegionalism;
@ApiModelProperty(name = "ifRuralPowerGrid", value = "是否农网0-否1") @ApiModelProperty(name = "ifRuralPowerGrid", value = "是否农网0-否1")

View File

@@ -0,0 +1,120 @@
package com.njcn.device.pms.pojo.vo;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2023/8/21 10:16
*/
@Data
public class DeviceUnitVo {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "编号")
private String id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "频率")
private String unitFrequency;
@ApiModelProperty(value = "频率偏差")
private String unitFrequencyDev;
@ApiModelProperty(value = "相电压有效值")
private String phaseVoltage;
@ApiModelProperty(value = "线电压有效值")
private String lineVoltage;
@ApiModelProperty(value = "电压上偏差")
private String voltageDev;
@ApiModelProperty(value = "电压下偏差")
private String uvoltageDev;
@ApiModelProperty(value = "电流有效值")
private String ieffective;
@ApiModelProperty(value = "单相有功功率")
private String singleP;
@ApiModelProperty(value = "单相视在功率")
private String singleViewP;
@ApiModelProperty(value = "单相无功功率")
private String singleNoP;
@ApiModelProperty(value = "总有功功率")
private String totalActiveP;
@ApiModelProperty(value = "总视在功率")
private String totalViewP;
@ApiModelProperty(value = "总无功功率")
private String totalNoP;
@ApiModelProperty(value = "相(线)电压基波有效值")
private String vfundEffective;
@ApiModelProperty(value = "基波电流")
private String ifund;
@ApiModelProperty(value = "基波有功功率")
private String fundActiveP;
@ApiModelProperty(value = "基波无功功率")
private String fundNoP;
@ApiModelProperty(value = "电压总谐波畸变率")
private String vdistortion;
@ApiModelProperty(value = "250次谐波电压含有率")
private String vharmonicRate;
@ApiModelProperty(value = "250次谐波电流有效值")
private String iharmonic;
@ApiModelProperty(value = "250次谐波有功功率")
private String pharmonic;
@ApiModelProperty(value = "0.549.5次间谐波电流有效值")
private String iiharmonic;
@ApiModelProperty(value = "正序电压")
private String positiveV;
@ApiModelProperty(value = "运行状态")
private String devFlag;
@ApiModelProperty(value = "零序负序电压")
private String noPositiveV;
@ApiModelProperty(value = "子集数据")
List<?> children;
@Data
public static class DeviceUnit extends PqsDeviceUnit {
@ApiModelProperty(value = "编号")
private String id;
@ApiModelProperty(value = "父节点")
private String pid;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "运行状态")
private String devFlag;
@ApiModelProperty(value = "子集数据")
List<?> children;
}
}

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.controller.ledgerManger; package com.njcn.device.pms.controller.ledgerManger;
import cn.hutool.core.date.TimeInterval; import cn.hutool.core.date.TimeInterval;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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;
@@ -14,12 +15,15 @@ import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.biz.pojo.param.SubstationParam; import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit; import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.mapper.majornetwork.PqsDeviceUnitMapper;
import com.njcn.device.pms.pojo.po.DistributionMonitor;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal; import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.service.ledgerManger.CommTerminalService; import com.njcn.device.pms.service.ledgerManger.CommTerminalService;
import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService; import com.njcn.device.pms.service.majornetwork.IDistributionMonitorService;
import com.njcn.device.pms.service.majornetwork.IMonitorService; import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.pms.service.majornetwork.ITerminalService; import com.njcn.device.pms.service.majornetwork.ITerminalService;
import com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@@ -56,6 +60,8 @@ public class CommTerminalController extends BaseController {
private final ITerminalService terminalService; private final ITerminalService terminalService;
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
/** /**
* 通过部门获取所有子集部门所拥有的监测点 * 通过部门获取所有子集部门所拥有的监测点
@@ -269,6 +275,9 @@ public class CommTerminalController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe);
} }
/**
* 获取实际,投运,谐波系统 的监测点
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getRunMonitorIds") @GetMapping("/getRunMonitorIds")
@ApiOperation("获取投运谐波系统所有监测点") @ApiOperation("获取投运谐波系统所有监测点")
@@ -279,20 +288,6 @@ public class CommTerminalController extends BaseController {
} }
/**
* 获取实际,投运,谐波系统 的监测点
* @author cdf
* @date 2023/9/18
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getRunMonitorList")
@ApiOperation("获取实际,投运,谐波系统 的监测点")
public HttpResult<List<String>> getRunMonitorList() {
String methodDescribe = getMethodDescribe("getRunMonitorList");
List<String> result = commTerminalService.getOneMonitorIds();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
/** /**
* 根据监测点集合获取监测点详情 * 根据监测点集合获取监测点详情
* @author cdf * @author cdf
@@ -334,7 +329,25 @@ public class CommTerminalController extends BaseController {
@ApiImplicitParam(name = "lineId", value = "实体", required = true) @ApiImplicitParam(name = "lineId", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) { public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("lineUnitDetail"); String methodDescribe = getMethodDescribe("lineUnitDetail");
PqsDeviceUnit pqsDeviceUnit = new PqsDeviceUnit(); String devId;
if(lineId.contains("pmswifi_")){
DistributionMonitor distributionMonitor = iDistributionMonitorService.getOne(new LambdaQueryWrapper<DistributionMonitor>().eq(DistributionMonitor::getMonitorId,lineId));
if(Objects.isNull(distributionMonitor)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new PqsDeviceUnit(), methodDescribe);
}
devId = distributionMonitor.getTerminalId();
}else {
Monitor monitor = monitorService.getById(lineId);
if(Objects.isNull(monitor)){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new PqsDeviceUnit(), methodDescribe);
}
devId = monitor.getTerminalId();
}
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(devId);
if(Objects.isNull(pqsDeviceUnit)){
pqsDeviceUnit = new PqsDeviceUnit();
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
} }

View File

@@ -0,0 +1,84 @@
package com.njcn.device.pms.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 数据单位管理
* </p>
*
* @author wr
* @since 2023-08-21
*/
@RestController
@Api(tags = "数据单位管理")
@RequestMapping("/pq/pqsDeviceUnit")
@RequiredArgsConstructor
public class PqsDeviceUnitController extends BaseController {
private final IPqsDeviceUnitService iPqsDeviceUnitService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/nodeTree")
@ApiOperation("数据单位查询树")
@ApiImplicitParam(name = "devFlag", value = "实体", required = true)
public HttpResult<List<DeviceUnitVo>> nodeTree(String devFlag) {
String methodDescribe = getMethodDescribe("nodeTree");
List<DeviceUnitVo> pqsDeviceUnitVos = iPqsDeviceUnitService.nodeList(devFlag);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnitVos, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/saveDeviceUnit")
@ApiOperation("数据单位修改")
@ApiImplicitParam(name = "unit", value = "实体", required = true)
public HttpResult<Boolean> saveDeviceUnit(@RequestBody PqsDeviceUnit unit) {
String methodDescribe = getMethodDescribe("saveDeviceUnit");
Boolean aBoolean = iPqsDeviceUnitService.saveDeviceUnit(unit);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, aBoolean, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/lineUnitDetail")
@ApiOperation("根据监测点id获取数据单位")
@ApiImplicitParam(name = "lineID", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineID") String lineID) {
String methodDescribe = getMethodDescribe("lineUnitDetail");
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.lineUnitDetail(lineID);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/devUnitDetail")
@ApiOperation("根据终端id获取数据单位")
@ApiImplicitParam(name = "devID", value = "实体", required = true)
public HttpResult<PqsDeviceUnit> devUnitDetail(@RequestParam("devID") String devID) {
String methodDescribe = getMethodDescribe("devUnitDetail");
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.devUnitDetail(devID);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
}
}

View File

@@ -0,0 +1,14 @@
package com.njcn.device.pms.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo;
/**
* pqs
*
* @author cdf
* @date 2024/8/21
*/
public interface PqsDeviceUnitMapper extends BaseMapper<PqsDeviceUnit> {
}

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.PqsDeviceUnitMapper">
<select id="deviceUnitList" resultType="com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo$DeviceUnit">
SELECT
dev.id as id,
dev.pid as pid,
dev.NAME as `name`,
pd.Run_Flag as devFlag,
b.*
FROM
pq_line dev
INNER JOIN pq_device pd ON dev.id = pd.id and dev.State = 1
LEFT JOIN pqs_device_unit b ON dev.id = b.dev_index
<where>
<if test="devFlag!=null and devFlag!='' ">
pd.Run_Flag = #{devFlag}
</if>
</where>
</select>
<select id="deviceUnitByID" resultType="com.njcn.device.biz.pojo.po.PqsDeviceUnit">
SELECT
unit.*
FROM
pq_line line
INNER JOIN pq_line vo ON vo.id = line.pid
INNER JOIN pq_line dev ON dev.id = vo.pid
INNER JOIN pq_device pd ON pd.id = dev.id
LEFT JOIN pqs_device_unit unit ON unit.DEV_INDEX = dev.id
<where>
line.State = 1
<if test="ids!=null and ids!='' ">
and line.id = #{ids}
</if>
</where>
</select>
</mapper>

View File

@@ -85,7 +85,7 @@ public class PmsParkServiceImpl extends ServiceImpl<PmsParkMapper, PmsParkPO> im
public Page<PmsParkPO> pageList(PmsParkParam.PmsParkQuery parkQuery) { public Page<PmsParkPO> pageList(PmsParkParam.PmsParkQuery parkQuery) {
List<String> deptCodes = deptFeignClient.getDepSonSelfCodetByDeptId(parkQuery.getMaintOrg()).getData(); List<String> deptCodes = deptFeignClient.getDepSonSelfCodetByDeptId(parkQuery.getMaintOrg()).getData();
LambdaQueryWrapper<PmsParkPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PmsParkPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(PmsParkPO::getMaintOrg, deptCodes); lambdaQueryWrapper.in(PmsParkPO::getMaintOrg, deptCodes).orderByDesc(PmsParkPO::getCreateTime,PmsParkPO::getCityOrgName);
return this.page(new Page<>(PageFactory.getPageNum(parkQuery), PageFactory.getPageSize(parkQuery)), lambdaQueryWrapper); return this.page(new Page<>(PageFactory.getPageNum(parkQuery), PageFactory.getPageSize(parkQuery)), lambdaQueryWrapper);
} }
@@ -140,7 +140,7 @@ public class PmsParkServiceImpl extends ServiceImpl<PmsParkMapper, PmsParkPO> im
List<String> ids = deptFeignClient.getDepSonSelfCodetByCode(param.getCityOrg()).getData(); List<String> ids = deptFeignClient.getDepSonSelfCodetByCode(param.getCityOrg()).getData();
LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PmsMidLedger> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.select(PmsMidLedger::getName,PmsMidLedger::getOperationName,PmsMidLedger::getId).in(PmsMidLedger::getOperationId,ids).eq(PmsMidLedger::getLevel,0); lambdaQueryWrapper.select(PmsMidLedger::getName,PmsMidLedger::getOperationName,PmsMidLedger::getId).in(PmsMidLedger::getSectionId,ids).eq(PmsMidLedger::getLevel,0);
List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper); List<PmsMidLedger> pmsMidLedgerList = pmsMidLedgerMapper.selectList(lambdaQueryWrapper);
return pmsMidLedgerList; return pmsMidLedgerList;
} }

View File

@@ -0,0 +1,55 @@
package com.njcn.device.pms.service.majornetwork;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author wr
* @since 2023-08-21
*/
public interface IPqsDeviceUnitService extends IService<PqsDeviceUnit> {
/**
* @param devFlag
* @Description: 查询数据单位树
* @return: java.util.List<com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo>
* @Author: wr
* @Date: 2023/8/21 13:58
*/
List<DeviceUnitVo> nodeList(String devFlag);
/**
* @param unit
* @Description: 添加数据终端
* @return: java.lang.Boolean
* @Author: wr
* @Date: 2023/8/21 14:01
*/
Boolean saveDeviceUnit(PqsDeviceUnit unit);
/**
* @param lineID
* @Description: 根据监测点id查询数据单位
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
* @Author: wr
* @Date: 2023/8/21 14:02
*/
PqsDeviceUnit lineUnitDetail(String lineID);
/**
* @param devID
* @Description: 根据终端id查询数据单位
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
* @Author: wr
* @Date: 2023/8/21 14:02
*/
PqsDeviceUnit devUnitDetail(String devID);
}

View File

@@ -312,6 +312,14 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(monitorParam.getOrgId()).getData(); List<String> deptIds = deptFeignClient.getDepSonSelfCodetByDeptId(monitorParam.getOrgId()).getData();
lambdaQueryWrapper.in(Monitor::getOrgId, deptIds).eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode()); lambdaQueryWrapper.in(Monitor::getOrgId, deptIds).eq(Monitor::getStatus, DataStateEnum.ENABLE.getCode());
} }
//是否上送国网测点
if(Objects.nonNull(monitorParam.getIsUpToGrid())){
lambdaQueryWrapper.eq(Monitor::getIsUpToGrid, DataStateEnum.ENABLE.getCode());
}
//运行状态
if(StrUtil.isNotBlank(monitorParam.getMonitorState())){
lambdaQueryWrapper.eq(Monitor::getMonitorState,monitorParam.getMonitorState());
}
return this.list(lambdaQueryWrapper); return this.list(lambdaQueryWrapper);
} }
@@ -1242,7 +1250,7 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
List<DictData> wireList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData(); List<DictData> wireList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_CONNECT.getCode()).getData();
Map<String, DictData> wireListMap = wireList.stream().collect(Collectors.toMap(DictData::getName, Function.identity())); Map<String, DictData> wireListMap = wireList.stream().collect(Collectors.toMap(DictData::getName, Function.identity()));
DictData potentialDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.VOLTAGE_TRANSFORMER.getName(), DicDataEnum.Cap_V.getName()).getData(); DictData potentialDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.Cap_V.getCode(),DicDataTypeEnum.VOLTAGE_TRANSFORMER.getCode()).getData();
DictData neutralDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.Neutral_Point.getName(), DicDataEnum.Ground_Res.getName()).getData(); DictData neutralDic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.Neutral_Point.getName(), DicDataEnum.Ground_Res.getName()).getData();

View File

@@ -0,0 +1,128 @@
package com.njcn.device.pms.service.majornetwork.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pms.mapper.majornetwork.PqsDeviceUnitMapper;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
import com.njcn.device.pms.service.majornetwork.IMonitorService;
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
import com.njcn.device.pms.service.majornetwork.ITerminalService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author wr
* @since 2023-08-21
*/
@Service
@RequiredArgsConstructor
public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, PqsDeviceUnit> implements IPqsDeviceUnitService {
private final ITerminalService terminalService;
private final IMonitorService monitorService;
@Override
public List<DeviceUnitVo> nodeList(String devFlag) {
List<DeviceUnitVo> pqsDeviceUnitVos = new ArrayList<>();
List<PmsTerminal> list = terminalService.list(new LambdaQueryWrapper<PmsTerminal>()
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
.eq(StrUtil.isNotBlank(devFlag), PmsTerminal::getTerminalState, devFlag)
);
if(CollUtil.isEmpty(list)){
return pqsDeviceUnitVos;
}
List<String> terminal = list.stream().map(PmsTerminal::getId).collect(Collectors.toList());
//获取所有终端信息
List<PqsDeviceUnit> pqsDeviceUnits = this.listByIds(terminal);
Map<String, PqsDeviceUnit> unitMap = pqsDeviceUnits.stream().collect(Collectors.toMap(PqsDeviceUnit::getDevIndex, Function.identity()));
Map<String, List<PmsTerminal>> orgMap = list.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
orgMap.forEach((key, value) -> {
DeviceUnitVo unitVo = new DeviceUnitVo();
unitVo.setId(key);
unitVo.setName(value.get(0).getOrgName());
Map<String, List<PmsTerminal>> subMap = value.stream().collect(Collectors.groupingBy(PmsTerminal::getPowerStationId));
List<DeviceUnitVo> subUnitVos = new ArrayList<>();
subMap.forEach((subKey, subValue) -> {
DeviceUnitVo subUnitVo = new DeviceUnitVo();
subUnitVo.setId(subKey);
subUnitVo.setName(subValue.get(0).getPowerrName());
Map<String, List<PmsTerminal>> terMap = subValue.stream().collect(Collectors.groupingBy(PmsTerminal::getId));
List<DeviceUnitVo.DeviceUnit> terUnitVos = new ArrayList<>();
terMap.forEach((terKey, terValue) -> {
for (PmsTerminal pmsTerminal : terValue) {
DeviceUnitVo.DeviceUnit terUnitVo = new DeviceUnitVo.DeviceUnit();
terUnitVo.setId(pmsTerminal.getId());
terUnitVo.setName(pmsTerminal.getName());
terUnitVo.setDevFlag(pmsTerminal.getTerminalState());
PqsDeviceUnit pqsDeviceUnit;
if (unitMap.containsKey(terKey)) {
pqsDeviceUnit = unitMap.get(terKey);
} else {
pqsDeviceUnit = new PqsDeviceUnit();
}
BeanUtil.copyProperties(pqsDeviceUnit,terUnitVo);
terUnitVos.add(terUnitVo);
}
});
subUnitVo.setChildren(terUnitVos);
subUnitVos.add(subUnitVo);
});
unitVo.setChildren(subUnitVos);
pqsDeviceUnitVos.add(unitVo);
});
return pqsDeviceUnitVos;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean saveDeviceUnit(PqsDeviceUnit unit) {
PqsDeviceUnit byId = this.getById(unit.getDevIndex());
if (ObjectUtil.isNotNull(byId)) {
return this.updateById(unit);
}
return this.save(unit);
}
@Override
public PqsDeviceUnit lineUnitDetail(String lineID) {
Monitor byId = monitorService.getById(lineID);
if (ObjectUtil.isNotNull(byId)) {
PqsDeviceUnit unit = this.getById(byId.getTerminalId());
if (ObjectUtil.isNotNull(unit)) {
return unit;
}
return new PqsDeviceUnit();
}
return new PqsDeviceUnit();
}
@Override
public PqsDeviceUnit devUnitDetail(String devID) {
PqsDeviceUnit byId = this.getById(devID);
if (ObjectUtil.isNotNull(byId)) {
return byId;
}
return new PqsDeviceUnit();
}
}

View File

@@ -7,7 +7,6 @@ import com.njcn.device.pq.pojo.po.DeptLine;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -19,7 +18,10 @@ import java.util.Map;
@FeignClient(value = ServerInfo.DEVICE,path = "/deptLine",fallbackFactory = DeptLineFeignClientFallbackFactory.class,contextId = "deptLine") @FeignClient(value = ServerInfo.DEVICE,path = "/deptLine",fallbackFactory = DeptLineFeignClientFallbackFactory.class,contextId = "deptLine")
public interface DeptLineFeignClient { public interface DeptLineFeignClient {
@PostMapping("/getLineByDeptId") @PostMapping("/getLineByDeptId")
HttpResult<List<String>> getLineByDeptId(String id); HttpResult<List<String>> getLineByDeptId(@RequestParam("id")String id);
@PostMapping("/getLineByDeptIdAndNewStation")
HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id")String id);
@PostMapping("/selectDeptBindLines") @PostMapping("/selectDeptBindLines")
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids); HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);

View File

@@ -0,0 +1,36 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.DeviceFeignClientFallbackFactory;
import com.njcn.device.pq.api.fallback.LineFeignClientFallbackFactory;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author xy
*/
@FeignClient(
value = ServerInfo.DEVICE,
path = "/dev",
fallbackFactory = DeviceFeignClientFallbackFactory.class,
contextId = "dev")
public interface DeviceFeignClient {
/**
* 技术监督修改装置定检时间
*
* @param devId 监测点id
* @param thisTimeCheck 起始时间
* @param nextTimeCheck 结束时间
* @return 终端状态信息
*/
@PostMapping("/updateDevCheckTime")
@ApiOperation("技术监督修改装置定检时间")
HttpResult<String> updateDevCheckTime(@RequestParam("devId") String devId,
@RequestParam("thisTimeCheck") String thisTimeCheck,
@RequestParam("nextTimeCheck") String nextTimeCheck);
}

View File

@@ -353,4 +353,12 @@ public interface LineFeignClient {
@PostMapping("/getReportLineInfo") @PostMapping("/getReportLineInfo")
HttpResult<List<ReportLineInfoVo>> getReportLineInfo(@RequestBody List<String> ids); HttpResult<List<ReportLineInfoVo>> getReportLineInfo(@RequestBody List<String> ids);
/**
* 根据监测点名称和电网侧变电站名称模糊搜索
* @param param
* @return
*/
@PostMapping("/getByName")
HttpResult<List<LineDetail>> getByName(@RequestBody LineBaseQueryParam param);
} }

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.NewStationClientFallbackFactory;
import com.njcn.device.pq.pojo.po.NewStation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 新能源场站高低电压穿越Feign客户端
* @author guofeihu
* @date 2024-08-14
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/newStation", fallbackFactory = NewStationClientFallbackFactory.class, contextId = "newStation")
public interface NewStationClient {
/**
* 根据ID获取新能源场站高低电压穿越表信息
*
* @return
*/
@GetMapping("/selectById")
HttpResult<NewStation> selectById(@RequestParam(name = "id") String id);
}

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.PqsTerminalLogsClientFallbackFactory;
import com.njcn.device.pq.pojo.po.Node;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;
/**
* @Description:
* @Author: wr
* @Date: 2024/8/13 10:14
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/node", fallbackFactory = PqsTerminalLogsClientFallbackFactory.class, contextId = "node")
public interface NodeClient {
@ApiOperation("获取全部前置机")
@GetMapping("/nodeAllList")
HttpResult<List<Node>> nodeAllList();
}

View File

@@ -7,8 +7,10 @@ import com.njcn.device.pq.pojo.param.SyncTerminalParam;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@@ -31,11 +33,23 @@ public interface TerminalBaseClient {
*/ */
@PostMapping("/getSubstationById") @PostMapping("/getSubstationById")
HttpResult<List<Line>> getSubstationById(@RequestBody List<String> list); HttpResult<List<Line>> getSubstationById(@RequestBody List<String> list);
/*
冀北技术监督台账同步
*/
/**
* 冀北技术监督台账同步
*/
@ApiOperation("终端/母线/监测点同步操作") @ApiOperation("终端/母线/监测点同步操作")
@PostMapping("terminalSync") @PostMapping("terminalSync")
HttpResult<String> terminalSync( @RequestBody SyncTerminalParam syncTerminalParam); HttpResult<String> terminalSync( @RequestBody SyncTerminalParam syncTerminalParam);
/**
* 监测点和装置同步成运行状态
*/
@GetMapping("/terminalSyncRunFly")
HttpResult<Boolean> terminalSyncRunFly(@RequestParam("lineId") String lineId);
/**
* 监测点信息删除
*/
@GetMapping("/terminalSyncDeleteFly")
HttpResult<Boolean> terminalSyncDeleteFly(@RequestParam("lineId") String lineId);
} }

View File

@@ -39,6 +39,12 @@ public class DeptLineFeignClientFallbackFactory implements FallbackFactory<DeptL
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<String>> getLineByDeptIdAndNewStation(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据部门id获取绑定的监测点且再根据NewStation进行过滤", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public HttpResult<Boolean> selectDeptBindLines(List<String> ids) { public HttpResult<Boolean> selectDeptBindLines(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "部门Ids集合查询是否绑定", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "部门Ids集合查询是否绑定", throwable.toString());

View File

@@ -0,0 +1,36 @@
package com.njcn.device.pq.api.fallback;
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.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.DeviceFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author xy
*/
@Slf4j
@Component
public class DeviceFeignClientFallbackFactory implements FallbackFactory<DeviceFeignClient> {
@Override
public DeviceFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new DeviceFeignClient() {
@Override
public HttpResult<String> updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck) {
log.error("{}异常,降级处理,异常为:{}", "技术监督修改装置定检时间", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -281,6 +281,12 @@ public class LineFeignClientFallbackFactory implements FallbackFactory<LineFeign
log.error("{}异常,降级处理,异常为:{}", "根据监测点id获取预告警单基础信息: ", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "根据监测点id获取预告警单基础信息: ", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<LineDetail>> getByName(LineBaseQueryParam param) {
log.error("{}异常,降级处理,异常为:{}", "根据监测点名称和电网侧变电站名称模糊搜索: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -0,0 +1,39 @@
package com.njcn.device.pq.api.fallback;
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.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.NewStationClient;
import com.njcn.device.pq.pojo.po.NewStation;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* 新能源场站高低电压穿越管理熔断降级
* @author guofeihu
* @date 2024-08-14
*/
@Slf4j
@Component
public class NewStationClientFallbackFactory implements FallbackFactory<NewStationClient> {
@Override
public NewStationClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new NewStationClient() {
@Override
public HttpResult<NewStation> selectById(String id) {
log.error("{}异常,降级处理,异常为:{}", "根据ID获取新能源场站高低电压穿越表信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,46 @@
package com.njcn.device.pq.api.fallback;
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.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.NodeClient;
import com.njcn.device.pq.api.PqsTerminalLogsClient;
import com.njcn.device.pq.pojo.po.Node;
import com.njcn.device.pq.pojo.po.PqsTerminalLogs;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zbj
* @version 1.0.0
* @date 2023年04月13日 13:34
*/
@Slf4j
@Component
public class NodeClientFallbackFactory implements FallbackFactory<NodeClient> {
@Override
public NodeClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new NodeClient()
{
@Override
public HttpResult<List<Node>> nodeAllList() {
log.error("{}异常,降级处理,异常为:{}", "获取全部前置机", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -44,6 +44,18 @@ public class TerminalBaseClientFallbackFactory implements FallbackFactory<Termin
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<Boolean> terminalSyncRunFly(String lineId) {
log.error("{}异常,降级处理,异常为:{}", "监测点和装置同步成运行状态", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> terminalSyncDeleteFly(String lineId) {
log.error("{}异常,降级处理,异常为:{}", "监测点信息删除", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };

View File

@@ -1,6 +1,11 @@
package com.njcn.device.pq.constant; package com.njcn.device.pq.constant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author qijian * @author qijian
*/ */
@@ -21,4 +26,44 @@ public interface Param {
Integer WEEK = 4; Integer WEEK = 4;
Integer DAY = 5; Integer DAY = 5;
//以下四个固定ID用于某些业务判断
//字典(sys_dict_data):电压暂升的ID
String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0";
//字典(sys_dict_data):电压暂降的ID
String LOWEREVENT = "c37861896dafab0883321e1d508caa51";
//字典(sys_dict_data):光伏电站的ID
String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e";
//字典(sys_dict_data):风电场的ID
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
/**
* 以下的四个Map为有功功率页面查看指标详情的四个指标分组下的具体指标(指标对应的可能不对 到时候直接改map里的key即可)
* 页面展示的指标名称 对应 的表ele_epd_pqd中的名称
* map的key为的表ele_epd_pqd中的名称value为页面上展示的名称
*/
Map<String,String> DATABSEMAP = new HashMap(){{
put("频率偏差","频率偏差");
put("线电压偏差","电压偏差");
put("相电压长时闪变","长时闪变");
put("线电压总有效值","谐波电压");
put("电流总有效值","谐波电流");
put("相电压总有效值","间谐波电压");
put("电压负序不平衡度","负序电压不平衡度");
put("电流负序不平衡度","负序电流");
put("总稳态指标","三相总有功功率");
put("相电压谐波总畸变率","电压总谐波畸变率");
}};
Map<String,String> UHARMMAP = new HashMap(){{
put("相电压谐波含有率序列","电压");
}};
Map<String,String> IHARMMAP = new HashMap(){{
put("谐波电流有效值","电流");
}};
Map<String,String> INTERHARMONICMAP = new HashMap(){{
put("间谐波电压有效值序列","间谐波电压含有率");
}};
} }

View File

@@ -11,8 +11,15 @@ import lombok.Data;
@Data @Data
public class LineDataQualityDTO { public class LineDataQualityDTO {
/**
* 监测点id
*/
private String lineId; private String lineId;
/**
* 监测点名称
*/
private String lineName;
/** /**
* 在线率 * 在线率

View File

@@ -188,6 +188,7 @@ public class LineParam {
@ApiModelProperty(name = "updateFlag",value = "修改标识") @ApiModelProperty(name = "updateFlag",value = "修改标识")
private Integer updateFlag; private Integer updateFlag;
@ApiModelProperty(name = "newStationId",value = "新能源场站信息ID")
private String newStationId;
} }

View File

@@ -0,0 +1,68 @@
package com.njcn.device.pq.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 新能源场站高低电压穿越表查询类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Data
public class NewStationQueryParam extends BaseParam {
@ApiModelProperty("id")
private String id;
@ApiModelProperty("新能源场站名称")
private String name;
@ApiModelProperty("新能源场站类型")
private String stationType;
@ApiModelProperty("电压等级Guid")
private String scale;
@ApiModelProperty("额定有功功率")
private String ratedPower;
@ApiModelProperty("经度")
private String longitude;
@ApiModelProperty("维度")
private String latitude;
@Data
public static class NewStationEdit{
@ApiModelProperty("id")
private String id;
@NotBlank(message = "新能源场站名称不能为空")
@ApiModelProperty("新能源场站名称(*)")
private String name;
@NotBlank(message = "新能源场站类型不能为空")
@ApiModelProperty("新能源场站类型(*)")
private String stationType;
@ApiModelProperty("电压等级Guid")
private String scale;
@NotBlank(message = "额定有功功率不能为空")
@ApiModelProperty("额定有功功率(*)")
private String ratedPower;
@NotBlank(message = "经度不能为空")
@ApiModelProperty("经度(*)")
private String longitude;
@NotBlank(message = "维度不能为空")
@ApiModelProperty("维度(*)")
private String latitude;
}
}

View File

@@ -180,6 +180,11 @@ public class LineDetail{
*/ */
private Integer runFlag; private Integer runFlag;
/**
* 新能源场站信息ID
*/
private String newStationId;
/** /**
* 通讯状态 * 通讯状态
*/ */

View File

@@ -0,0 +1,62 @@
package com.njcn.device.pq.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import lombok.Getter;
import lombok.Setter;
/**
* <p>
* 新能源场站高低电压穿越表实体类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Getter
@Setter
@TableName("pq_new_station")
public class NewStation extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 新能源场站名称
*/
private String name;
/**
* 关联new_station_type字典表新能源场站类型风电场、光伏电站
*/
private String stationType;
/**
* 关联Dev_Voltage_Stand字典表电压等级Guid
*/
private String scale;
/**
* 额定有功功率
*/
private String ratedPower;
/**
* 经度
*/
private String longitude;
/**
* 维度
*/
private String latitude;
/**
* 状态0-删除 1-正常
*/
private Integer state;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.device.pq.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wr
* @description
* @date 2024/8/15 14:13
*/
@Data
public class DevAndLine {
@ApiModelProperty("终端id")
private String devId;
@ApiModelProperty("终端名称")
private String devName;
@ApiModelProperty("监测点集合")
private List<Line> lineList;
@Data
public static class Line {
@ApiModelProperty("监测点id")
private String lineId;
@ApiModelProperty("监测点名称")
private String lineName;
}
}

View File

@@ -41,6 +41,7 @@ public class DevDetail {
private Integer comFlag; private Integer comFlag;
@ApiModelProperty("定检时间") @ApiModelProperty("定检时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate nextTimeCheck; private LocalDate nextTimeCheck;
} }

View File

@@ -121,4 +121,7 @@ public class LineDetailDataVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime; private LocalDateTime updateTime;
@ApiModelProperty(name = "新能源场站信息ID")
private String newStationId;
} }

View File

@@ -121,6 +121,7 @@ public class LineVO implements Serializable {
@ApiModelProperty(name = "sort",value = "排序",required = true) @ApiModelProperty(name = "sort",value = "排序",required = true)
private Integer sort; private Integer sort;
@ApiModelProperty(name = "newStationId",value = "新能源场站信息ID")
private String newStationId;
} }

View File

@@ -50,4 +50,7 @@ public class ReportLineInfoVo implements Serializable {
@ApiModelProperty("超标天数") @ApiModelProperty("超标天数")
private Integer overDays; private Integer overDays;
@ApiModelProperty("电网标志0-电网侧1-非电网侧)")
private Integer powerFlag;
} }

View File

@@ -112,6 +112,15 @@ public class DeptLineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineByDeptIdAndNewStation")
@ApiOperation("根据部门id获取绑定的监测点且再根据NewStation进行过滤")
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation");
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineDetailByDeptId") @PostMapping("/getLineDetailByDeptId")
@ApiOperation("部门Id获取绑定监测点详情") @ApiOperation("部门Id获取绑定监测点详情")

View File

@@ -167,4 +167,13 @@ public class DeviceController extends BaseController {
Console.log("string payload : {}", payload); Console.log("string payload : {}", payload);
} }
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/updateDevCheckTime")
@ApiOperation("技术监督修改装置定检时间")
public HttpResult<String> updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck) {
String methodDescribe = getMethodDescribe("updateDevCheckTime");
iDeviceService.updateDevCheckTime(devId,thisTimeCheck,nextTimeCheck);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "success", methodDescribe);
}
} }

View File

@@ -418,12 +418,8 @@ public class LineController extends BaseController {
@ApiImplicitParam(name = "deviceInfoParam", value = "监测点查询条件", required = true) @ApiImplicitParam(name = "deviceInfoParam", value = "监测点查询条件", required = true)
}) })
public HttpResult<List<DeptLineCountVO>> getDeptLineCount(@RequestBody @Validated DeviceInfoParam deviceInfoParam) { public HttpResult<List<DeptLineCountVO>> getDeptLineCount(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("getDeptLineCount"); String methodDescribe = getMethodDescribe("getDeptLineCount");
List<DeptLineCountVO> deptLineCountVOS = new ArrayList<> (); List<DeptLineCountVO> deptLineCountVOS = lineService.getDeptLineCount(deviceInfoParam);
deptLineCountVOS = lineService.getDeptLineCount(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptLineCountVOS, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, deptLineCountVOS, methodDescribe);
} }
@@ -509,7 +505,6 @@ public class LineController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据装置部门和模糊搜索获取装置详情") @ApiOperation("根据装置部门和模糊搜索获取装置详情")
@ApiImplicitParam(name = "id", value = "装置id", required = true)
@PostMapping("/getDeptDeviceDetailData") @PostMapping("/getDeptDeviceDetailData")
HttpResult<List<LineDetailVO.Detail>> getDeptDeviceDetailData(@RequestBody DataParam param){ HttpResult<List<LineDetailVO.Detail>> getDeptDeviceDetailData(@RequestBody DataParam param){
String methodDescribe = getMethodDescribe("getDeptDeviceDetailData"); String methodDescribe = getMethodDescribe("getDeptDeviceDetailData");
@@ -534,4 +529,21 @@ public class LineController extends BaseController {
List<ReportLineInfoVo> result = lineService.getReportLineInfo(ids); List<ReportLineInfoVo> result = lineService.getReportLineInfo(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据监测点名称和电网侧变电站名称模糊搜索")
@PostMapping("/getByName")
HttpResult<List<LineDetail>> getByName(@RequestBody LineBaseQueryParam param){
String methodDescribe = getMethodDescribe("getByName");
List<LineDetail> list = lineService.getByName(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("获取部门下终端信息和终端下监测点信息")
@GetMapping("/getByDeptDevLine")
HttpResult<List<DevAndLine>> getByDeptDevLine(String id){
String methodDescribe = getMethodDescribe("getByDeptDevLine");
List<DevAndLine> list = lineService.getByDeptDevLine(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
} }

View File

@@ -0,0 +1,89 @@
package com.njcn.device.pq.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.service.INewStationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 前端控制器
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Api(tags = "新能源场站高低电压穿越表管理")
@Slf4j
@RestController
@RequestMapping("/newStation")
@RequiredArgsConstructor
public class NewStationController extends BaseController {
private final INewStationService iNewStationService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.QUERY)
@PostMapping("/queryPage")
@ApiOperation("新能源场站高低电压穿越表分页查询")
public HttpResult<Page<NewStation>> queryPage(@RequestBody @Validated NewStationQueryParam newStationQueryParam){
String methodDescribe = getMethodDescribe("queryPage");
Page<NewStation> page = iNewStationService.queryPage(newStationQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
@PostMapping("/editNewStation")
@ApiOperation("新能源场站高低电压穿越信息更新")
public HttpResult<Boolean> editNewStation(@RequestBody @Validated NewStationQueryParam.NewStationEdit newStationEdit) {
String methodDescribe = getMethodDescribe("editNewStation");
LogUtil.njcnDebug(log, "{},更新对象为:{}", methodDescribe, newStationEdit);
iNewStationService.editNewStation(newStationEdit);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
@DeleteMapping("/delNewStation")
@ApiOperation("新能源场站高低电压穿越信息删除")
public HttpResult<Boolean> delNewStation(@RequestParam(name = "ids") String ids) {
String methodDescribe = getMethodDescribe("delNewStation");
LogUtil.njcnDebug(log, "{}删除的Id的集合为{}", methodDescribe, ids);
iNewStationService.delNewStation(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@GetMapping("/selectDown")
@ApiOperation("获取新能源场站高低电压穿越信息下拉框(用于监测点维护界面)")
public HttpResult<List<Map>> selectDown(@RequestParam(name = "name",required = false) String name) {
String methodDescribe = getMethodDescribe("selectDown");
LogUtil.njcnDebug(log, "{},远程搜索值为:{}", methodDescribe, name);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectDown(name), methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@GetMapping("/selectById")
@ApiOperation("根据ID获取新能源场站高低电压穿越表信息")
public HttpResult<NewStation> selectById(@RequestParam(name = "id") String id) {
String methodDescribe = getMethodDescribe("selectById");
LogUtil.njcnDebug(log, "{}id值为{}", methodDescribe, id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, iNewStationService.selectById(id), methodDescribe);
}
}

View File

@@ -12,10 +12,6 @@ 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.device.biz.enums.DeviceResponseEnum; import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.mapper.LineDetailMapper;
import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.mapper.OverlimitMapper;
import com.njcn.device.pq.mapper.VoltageMapper;
import com.njcn.device.pq.pojo.bo.DeviceType; import com.njcn.device.pq.pojo.bo.DeviceType;
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel; import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
@@ -27,7 +23,6 @@ import com.njcn.device.pq.pojo.vo.TerminalVO;
import com.njcn.device.pq.service.TerminalBaseService; import com.njcn.device.pq.service.TerminalBaseService;
import com.njcn.device.pq.service.impl.GeneralDeviceService; import com.njcn.device.pq.service.impl.GeneralDeviceService;
import com.njcn.poi.util.PoiUtil; import com.njcn.poi.util.PoiUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -60,23 +55,6 @@ import java.util.stream.Stream;
public class TerminalBaseController extends BaseController { public class TerminalBaseController extends BaseController {
private final TerminalBaseService terminalBaseService; private final TerminalBaseService terminalBaseService;
private final LineDetailMapper lineDetailMapper;
private final OverlimitMapper overlimitMapper;
private final DicDataFeignClient dicDataFeignClient;
private final LineMapper lineMapper;
private final VoltageMapper voltageMapper;
private final GeneralDeviceService generalDeviceService; private final GeneralDeviceService generalDeviceService;
@@ -143,17 +121,34 @@ public class TerminalBaseController extends BaseController {
} }
@ApiOperation("终端/母线/监测点同步操作") @ApiOperation("变电站/终端/母线/监测点同步操作")
@OperateInfo(operateType = OperateType.ADD, info = LogEnum.BUSINESS_MEDIUM) @OperateInfo(operateType = OperateType.ADD, info = LogEnum.BUSINESS_MEDIUM)
@PostMapping("terminalSync") @PostMapping("terminalSync")
public HttpResult<String> terminalSync(@Valid @RequestBody SyncTerminalParam syncTerminalParam) { public HttpResult<String> terminalSync(@Valid @RequestBody SyncTerminalParam syncTerminalParam) {
String methodDescribe = getMethodDescribe("terminalSync"); String methodDescribe = getMethodDescribe("terminalSync");
String substation = terminalBaseService.terminalSync(syncTerminalParam);
String subtation = terminalBaseService.terminalSync(syncTerminalParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substation, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subtation, methodDescribe);
} }
@ApiOperation("监测点和装置同步成运行状态")
@OperateInfo(operateType = OperateType.ADD, info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("/terminalSyncRunFly")
public HttpResult<Boolean> terminalSyncRunFly(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("terminalSyncRunFly");
Boolean b = terminalBaseService.terminalSyncRunFly(lineId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
}
@ApiOperation("监测点信息删除")
@OperateInfo(operateType = OperateType.ADD, info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("/terminalSyncDeleteFly")
public HttpResult<Boolean> terminalSyncDeleteFly(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("terminalSyncDeleteFly");
Boolean b = terminalBaseService.terminalSyncDeleteFly(lineId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
}
/** /**
* 终端修改操作 * 终端修改操作
* *

View File

@@ -82,4 +82,6 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam); List<SubGetBase> selectSubStationList(@Param("param") SubstationParam substationParam);
List<String> getLineByDeptIdAndNewStation(@Param("id") String id);
} }

View File

@@ -62,4 +62,9 @@ public interface LineDetailMapper extends BaseMapper<LineDetail> {
* @return 结果 * @return 结果
*/ */
List<LineDetail> getLineDetailByIds(@Param("ids") List<String> Ids); List<LineDetail> getLineDetailByIds(@Param("ids") List<String> Ids);
/**
* 判断该新能源场站信息是否绑定了测点ID
*/
Integer checkExistsLineByNewStationId(@Param("newStationId") String newStationId);
} }

View File

@@ -17,6 +17,7 @@ import com.njcn.device.pq.pojo.dto.OverLimitLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO; import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.WarningSubstationDTO; import com.njcn.device.pq.pojo.dto.WarningSubstationDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam; import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
@@ -555,4 +556,9 @@ public interface LineMapper extends BaseMapper<Line> {
List<LineDetailVO.noDataLineInfo> getNoDataLine(@Param("time")String time); List<LineDetailVO.noDataLineInfo> getNoDataLine(@Param("time")String time);
List<ReportLineInfoVo> getReportLineInfo(@Param("ids")List<String> ids); List<ReportLineInfoVo> getReportLineInfo(@Param("ids")List<String> ids);
List<Line> getSubByCondition(@Param("subIds") List<String> subIds, @Param("scale") List<SimpleDTO> scale);
List<LineDetail> selectByName(@Param("param") LineBaseQueryParam param);
} }

View File

@@ -0,0 +1,26 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 Mapper 接口
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
public interface NewStationMapper extends BaseMapper<NewStation> {
Page<NewStation> queryPage(IPage<NewStation> page, @Param("newStationQueryParam") NewStationQueryParam newStationQueryParam);
List<Map> selectDown( @Param("name") String name);
}

View File

@@ -31,7 +31,8 @@
device.com_flag comFlag, device.com_flag comFlag,
1 as lineType, 1 as lineType,
0 as type, 0 as type,
lineDetail.monitor_flag as isUpToGrid lineDetail.monitor_flag as isUpToGrid,
point.name pointName
</if> </if>
<!--母线--> <!--母线-->
<if test="type == 2"> <if test="type == 2">
@@ -97,11 +98,11 @@
<select id="orgSubStationInfoGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase$Extend"> <select id="orgSubStationInfoGet" resultType="com.njcn.device.biz.pojo.dto.TerminalGetBase$Extend">
select select
DISTINCT DISTINCT
point.id lineId,
pq_dept_line.id unitId, pq_dept_line.id unitId,
substation.id ledgerId, substation.id ledgerId,
substation.name subName, substation.name subName,
sub.Scale voltageLevel, sub.Scale voltageLevel,
point.id lineId,
lineDetail.Monitor_Flag as monitorFlag lineDetail.Monitor_Flag as monitorFlag
from pq_dept_line pq_dept_line from pq_dept_line pq_dept_line
inner join pq_line point on pq_dept_line.line_id = point.id inner join pq_line point on pq_dept_line.line_id = point.id
@@ -110,7 +111,7 @@
inner join pq_line dev on voltage.pid = dev.id inner join pq_line dev on voltage.pid = dev.id
inner join pq_device device on dev.id = device.id inner join pq_device device on dev.id = device.id
inner join pq_line substation on dev.pid = substation.id inner join pq_line substation on dev.pid = substation.id
inner join pq_substation sub on sub.id = substation.id left join pq_substation sub on sub.id = substation.id
where device.Dev_Model = 1 where device.Dev_Model = 1
and point.state = 1 and point.state = 1
and device.Run_Flag = 0 and device.Run_Flag = 0
@@ -155,7 +156,9 @@
substation.id id, substation.id id,
substation.name name, substation.name name,
pq_dept_line.id orgId, pq_dept_line.id orgId,
sub.Scale voltageLevel sub.Scale voltageLevel,
sub.lng lng,
sub.lat lat
from pq_dept_line pq_dept_line from pq_dept_line pq_dept_line
inner join pq_line point on pq_dept_line.line_id = point.id inner join pq_line point on pq_dept_line.line_id = point.id
inner join pq_line_detail lineDetail on point.id = lineDetail.id inner join pq_line_detail lineDetail on point.id = lineDetail.id
@@ -191,4 +194,11 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getLineByDeptIdAndNewStation" resultType="string">
select pdl.Line_Id from pq_dept_line pdl
inner join pq_line_detail pld on pdl.Line_Id = pld.Id
where pdl.Id = #{id}
and exists (select 1 from pq_new_station pns where pns.id = pld.New_Station_Id and pns.state = 1)
</select>
</mapper> </mapper>

View File

@@ -41,7 +41,8 @@
select select
a.name lineName, a.name lineName,
c.Time_Interval, c.Time_Interval,
e.name scale e.name scale,
c.New_Station_Id newStationId
from pq_line a from pq_line a
inner join pq_line b on a.pid = b.id inner join pq_line b on a.pid = b.id
inner join pq_line_detail c on a.id = c.id inner join pq_line_detail c on a.id = c.id
@@ -96,4 +97,9 @@
set run_flag = #{runFlag} set run_flag = #{runFlag}
where id = #{id} where id = #{id}
</update> </update>
<select id="checkExistsLineByNewStationId" resultType="int">
select count(1) from pq_line pl inner join pq_line_detail pld
on pl.id = pld.id and pl.State = 1 and pld.New_Station_Id = #{newStationId}
</select>
</mapper> </mapper>

View File

@@ -268,7 +268,8 @@
pq_line t1 , pq_line t1 ,
pq_line_detail t2 pq_line_detail t2
where where
t1.id = t2.id t1.state = 1
and t1.id = t2.id
and and
t1.id in t1.id in
<foreach collection="ids" separator="," open="(" close=")" item="item"> <foreach collection="ids" separator="," open="(" close=")" item="item">
@@ -307,7 +308,7 @@
FROM FROM
pq_line t1, pq_line t1,
pq_device t2 pq_device t2
WHERE <where>
t1.id = t2.id t1.id = t2.id
<if test="deviceType.devModel!=null and deviceType.devModel.size()!=0"> <if test="deviceType.devModel!=null and deviceType.devModel.size()!=0">
AND t2.Dev_Model in AND t2.Dev_Model in
@@ -339,10 +340,14 @@
#{item.id} #{item.id}
</foreach> </foreach>
</if> </if>
<if test="devIds!=null and devIds.size()!=0">
AND t1.id IN AND t1.id IN
<foreach collection="devIds" open="(" close=")" item="item" separator=","> <foreach collection="devIds" open="(" close=")" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
</if>
</where>
</select> </select>
@@ -352,19 +357,25 @@
from from
pq_line t1 , pq_line t1 ,
pq_voltage t2 pq_voltage t2
where <where>
t1.id = t2.id t1.id = t2.id
and <if test="voltageIds!=null and voltageIds.size()!=0">
t1.id in and t1.id in
<foreach collection="voltageIds" separator="," open="(" close=")" item="item"> <foreach collection="voltageIds" separator="," open="(" close=")" item="item">
#{item} #{item}
</foreach> </foreach>
</if>
<if test="scale!=null and scale.size()!=0"> <if test="scale!=null and scale.size()!=0">
AND t2.scale in AND t2.scale in
<foreach collection="scale" open="(" close=")" item="item" separator=","> <foreach collection="scale" open="(" close=")" item="item" separator=",">
#{item.id} #{item.id}
</foreach> </foreach>
</if> </if>
</where>
</select> </select>
<select id="getVoltageIdByScale" resultType="String"> <select id="getVoltageIdByScale" resultType="String">
@@ -1420,7 +1431,8 @@
vg.Scale AS voltageLevel, vg.Scale AS voltageLevel,
pqd.Run_Flag as runFlag, pqd.Run_Flag as runFlag,
detail.PT_Type AS ptType, detail.PT_Type AS ptType,
detail.PT_Phase_Type AS ptPhaseType detail.PT_Phase_Type AS ptPhaseType,
detail.New_Station_Id AS newStationId
FROM FROM
pq_line line, pq_line line,
pq_line_detail detail, pq_line_detail detail,
@@ -1701,7 +1713,8 @@
pd.IP ip, pd.IP ip,
pld.Short_Capacity shortCapacity, pld.Short_Capacity shortCapacity,
pld.Dev_Capacity devCapacity, pld.Dev_Capacity devCapacity,
pld.Deal_Capacity dealCapacity pld.Deal_Capacity dealCapacity,
pld.Power_Flag powerFlag
from from
pq_line pl pq_line pl
left join pq_line_detail pld on pl.Id = pld.Id left join pq_line_detail pld on pl.Id = pld.Id
@@ -1713,12 +1726,54 @@
left join pq_voltage pv on pv.Id = pl2.Id left join pq_voltage pv on pv.Id = pl2.Id
left join pq_device pd on pl3.Id = pd.Id left join pq_device pd on pl3.Id = pd.Id
left join sys_dict_data sdd on pv.`Scale` = sdd.Id left join sys_dict_data sdd on pv.`Scale` = sdd.Id
where <where>
<if test="ids!=null and ids.size() > 0"> <if test="ids!=null and ids.size() > 0">
pl.Id IN pl.Id IN
<foreach collection="ids" item="item" open="(" close=")" separator=","> <foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if> </if>
</where>
</select>
<select id="getSubByCondition" resultType="com.njcn.device.pq.pojo.po.Line">
select
t1.*
from
pq_line t1
left join pq_substation t2 on t1.id = t2.id
<where>
<if test="subIds!=null and subIds.size()!=0">
AND t1.id in
<foreach collection="subIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
<if test="scale!=null and scale.size()!=0">
AND t2.scale in
<foreach collection="scale" open="(" close=")" item="item" separator=",">
#{item.id}
</foreach>
</if>
</where>
</select>
<select id="selectByName" resultType="com.njcn.device.pq.pojo.po.LineDetail">
select
t2.*
from
pq_line t1 ,
pq_line_detail t2
<where>
t1.id = t2.id and t2.Run_Flag=0
<if test="param.lineIds!=null and param.lineIds.size()!=0">
AND t1.id in
<foreach collection="param.lineIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="param.searchValue!=null and param.searchValue!=''">
AND (t1.name like CONCAT('%', #{param.searchValue}, '%') or t2.Power_Substation_Name like CONCAT('%', #{param.searchValue}, '%'))
</if>
</where>
</select> </select>
</mapper> </mapper>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pq.mapper.NewStationMapper">
<resultMap id="BaseResultMap" type="com.njcn.device.pq.pojo.po.NewStation">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="station_type" jdbcType="VARCHAR" property="stationType"/>
<result column="scale" jdbcType="VARCHAR" property="scale" />
<result column="rated_power" jdbcType="VARCHAR" property="ratedPower" />
<result column="longitude" jdbcType="VARCHAR" property="longitude" />
<result column="latitude" jdbcType="INTEGER" property="latitude" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap>
<select id="queryPage" resultMap="BaseResultMap">
select * from pq_new_station ns
where ns.state = 1
<if test="newStationQueryParam.name != null and newStationQueryParam.name !=''">
and ns.name like concat('%',#{newStationQueryParam.name},'%')
</if>
<if test="newStationQueryParam.stationType != null and newStationQueryParam.stationType !=''">
and ns.station_type = #{newStationQueryParam.stationType}
</if>
<if test="newStationQueryParam.scale != null and newStationQueryParam.scale !=''">
and ns.scale = #{newStationQueryParam.scale}
</if>
</select>
<select id="selectDown" parameterType="string" resultType="map">
select id as value,name from pq_new_station ns
where state = 1
<if test="name != null and name !=''">
and ns.name like concat('%',#{name},'%')
</if>
</select>
</mapper>

View File

@@ -67,7 +67,13 @@ public interface DeptLineService extends IService<DeptLine> {
*/ */
List<String> getLineByDeptId(String id); List<String> getLineByDeptId(String id);
/**
* 功能描述: 根据部门id获取绑定的监测点且再根据NewStation进行过滤
* @param id,type
* @author guofeihu
* @date 2024/8/19
*/
List<String> getLineByDeptIdAndNewStation(String id);
/** /**
* @Description: 根据部门id获取所有子集部门所包含的部门信息 * @Description: 根据部门id获取所有子集部门所包含的部门信息

View File

@@ -125,4 +125,12 @@ public interface IDeviceService extends IService<Device> {
* @Date: 2023/8/17 9:24 * @Date: 2023/8/17 9:24
*/ */
String restartDev(List<String> devList); String restartDev(List<String> devList);
/**
* @param devId 装置id
* @param thisTimeCheck 本次定检时间
* @param nextTimeCheck 下次定检时间
* @Description: 技术监督修改装置定检时间
*/
void updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck);
} }

View File

@@ -0,0 +1,55 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 服务类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
public interface INewStationService extends IService<NewStation> {
/**
* 新能源场站高低电压穿越表分页查询
* @param newStationQueryParam
* @return
*/
Page<NewStation> queryPage(NewStationQueryParam newStationQueryParam);
/***
* 新能源场站高低电压穿越表更新
* @param newStationEdit
* @return Boolean
*/
Boolean editNewStation(NewStationQueryParam.NewStationEdit newStationEdit) ;
/***
* 新能源场站高低电压穿越表删除
* @param ids
* @return Boolean
*/
Boolean delNewStation(String ids);
/***
* 获取新能源场站高低电压穿越信息下拉框(用于监测点维护界面)
* @param name
* @return List
*/
List<Map> selectDown(String name);
/***
* 根据ID获取新能源场站高低电压穿越表信息
* @param id
* @return NewStation
*/
NewStation selectById(String id);
}

View File

@@ -7,12 +7,10 @@ import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO; import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO; import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DataParam; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.pojo.po.LineDetail;
import com.njcn.device.pq.pojo.po.TopMsgPO; import com.njcn.device.pq.pojo.po.TopMsgPO;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
@@ -224,4 +222,13 @@ public interface LineService extends IService<Line> {
List<LineDetailVO.noDataLineInfo> getNoDataLine(); List<LineDetailVO.noDataLineInfo> getNoDataLine();
List<ReportLineInfoVo> getReportLineInfo(List<String> ids); List<ReportLineInfoVo> getReportLineInfo(List<String> ids);
List<LineDetail> getByName(LineBaseQueryParam param);
/**
* 获取部门下终端信息和终端下监测点信息
* @param id
* @return
*/
List<DevAndLine> getByDeptDevLine(String id);
} }

View File

@@ -132,6 +132,14 @@ public interface TerminalBaseService {
*/ */
List<Line> getVoltageByCondition(List<String> voltageIds, List<SimpleDTO> scale); List<Line> getVoltageByCondition(List<String> voltageIds, List<SimpleDTO> scale);
/**
* 查询变电站信息
*
* @param subIds 变电站索引
* @param scale 电压等级
*/
List<Line> getSubByCondition(List<String> subIds, List<SimpleDTO> scale);
/** /**
* 根据指定电压等级查询母线id * 根据指定电压等级查询母线id
* *
@@ -243,4 +251,18 @@ public interface TerminalBaseService {
* @Date: 2024/5/29 * @Date: 2024/5/29
*/ */
String terminalSync(SyncTerminalParam syncTerminalParam); String terminalSync(SyncTerminalParam syncTerminalParam);
/**
* 监测点和装置同步成运行状态
* @param lineId
* @return
*/
Boolean terminalSyncRunFly(String lineId);
/**
* 监测数据删除
* @param lineId
* @return
*/
Boolean terminalSyncDeleteFly(String lineId);
} }

View File

@@ -12,6 +12,7 @@ import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO; import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.service.DeptLineService; import com.njcn.device.pq.service.DeptLineService;
import com.njcn.device.pq.constant.Param;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.pojo.param.DeptLineParam; import com.njcn.web.pojo.param.DeptLineParam;
@@ -88,6 +89,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
return this.lambdaQuery().in(DeptLine::getId, id).list().stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList()); return this.lambdaQuery().in(DeptLine::getId, id).list().stream().map(DeptLine::getLineId).distinct().collect(Collectors.toList());
} }
@Override
public List<String> getLineByDeptIdAndNewStation(String id) {
return this.baseMapper.getLineByDeptIdAndNewStation(id);
}
@Override @Override
public List<String> getLineNodeByDeptId(String id) { public List<String> getLineNodeByDeptId(String id) {
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData(); List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pq.mapper.DevVersionMapper; import com.njcn.device.pq.mapper.DevVersionMapper;
import com.njcn.device.pq.mapper.DeviceMapper; import com.njcn.device.pq.mapper.DeviceMapper;
@@ -397,5 +398,14 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
return "命令发送成功"; return "命令发送成功";
} }
@Override
public void updateDevCheckTime(String devId, String thisTimeCheck, String nextTimeCheck) {
LambdaUpdateWrapper<Device> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Device::getId, devId)
.set(Device::getThisTimeCheck, thisTimeCheck)
.set(Device::getNextTimeCheck, nextTimeCheck);
this.update(updateWrapper);
}
} }

View File

@@ -417,25 +417,22 @@ public class GeneralDeviceService {
return generalDeviceDTO; return generalDeviceDTO;
} }
//筛选出终端id理论上监测点的pids中第个id为终端id //1.筛选出母线id理论上监测点的pids中第个id为母线id 联查: pq_line t1 ,pq_voltage t2
List<String> devIds = lines.stream().map(line -> { List<String> voltageIds=lines.stream().map(Line::getPid).collect(Collectors.toList());
String[] idsArray = line.getPids().split(",");
return idsArray[4];
}).collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
deviceType,
deviceInfoParam.getManufacturer());
//筛选出母线id理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
List<String> voltageIds = lines.stream().map(line -> {
String[] idsArray = line.getPids().split(",");
return idsArray[5];
}).collect(Collectors.toList());
//再根据电压等级筛选合法母线信息 //再根据电压等级筛选合法母线信息
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, deviceInfoParam.getScale());
deviceInfoParam.getScale());
//2.筛选出终端id理论上监测点的pids中第五个id为终端id
List<String> devIds=voltages.stream().map(Line::getPid).collect(Collectors.toList());
// 再根据终端条件筛选合法终端信息 联查pq_line t1,pq_device t2
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
//3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds=devices.stream().map(Line::getPid).collect(Collectors.toList());
List<Line> sub = terminalBaseService.getSubByCondition(subIds, deviceInfoParam.getScale());
//筛选最终的数据 //筛选最终的数据
dealDeviceData(generalDeviceDTO, lines, devices, voltages); dealDeviceData(generalDeviceDTO, lines, devices, voltages, sub);
return generalDeviceDTO; return generalDeviceDTO;
} }
@@ -447,15 +444,18 @@ public class GeneralDeviceService {
* @param devices 筛选后的终端信息 * @param devices 筛选后的终端信息
* @param voltages 筛选后的母线信息 * @param voltages 筛选后的母线信息
*/ */
private void dealDeviceData(GeneralDeviceDTO generalDeviceDTO, List<Line> lines, List<Line> devices, List<Line> voltages) { private void dealDeviceData(GeneralDeviceDTO generalDeviceDTO, List<Line> lines, List<Line> devices, List<Line> voltages, List<Line> sub) {
List<String> gdIndexes = new ArrayList<>(), subIndexes = new ArrayList<>(), deviceIndexes = new ArrayList<>(), voltageIndexes = new ArrayList<>(), lineIndexes = new ArrayList<>(); List<String> gdIndexes = new ArrayList<>(), subIndexes = new ArrayList<>(), deviceIndexes = new ArrayList<>(), voltageIndexes = new ArrayList<>(), lineIndexes = new ArrayList<>();
List<String> devIds = devices.stream().map(Line::getId).distinct().collect(Collectors.toList()); List<String> devIds = devices.stream().map(Line::getId).distinct().collect(Collectors.toList());
List<String> volIds = voltages.stream().map(Line::getId).distinct().collect(Collectors.toList()); List<String> volIds = voltages.stream().map(Line::getId).distinct().collect(Collectors.toList());
List<String> subIds = sub.stream().map(Line::getId).distinct().collect(Collectors.toList());
for (Line line : lines) { for (Line line : lines) {
String[] idsArray = line.getPids().split(","); String[] idsArray = line.getPids().split(",");
//监测点同时满足条件筛选后的终端、母线信息,才是最终的结果 //监测点同时满足条件筛选后的终端、母线信息,才是最终的结果
if (devIds.contains(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]) && if (devIds.contains(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]) &&
volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()])) { volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()])&&
subIds.contains(idsArray[LineBaseEnum.SUB_LEVEL.getCode()])
) {
gdIndexes.add(idsArray[LineBaseEnum.GD_LEVEL.getCode()]); gdIndexes.add(idsArray[LineBaseEnum.GD_LEVEL.getCode()]);
subIndexes.add(idsArray[LineBaseEnum.SUB_LEVEL.getCode()]); subIndexes.add(idsArray[LineBaseEnum.SUB_LEVEL.getCode()]);
deviceIndexes.add(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]); deviceIndexes.add(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]);

View File

@@ -282,6 +282,9 @@ public class GridDiagramServiceImpl implements GridDiagramService {
@Override @Override
public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) { public Map<String, Long> getGridDiagramDevTendency(GridDiagramParam param, Integer type) {
param.getDeviceInfoParam().setLineRunFlag(0); param.getDeviceInfoParam().setLineRunFlag(0);
if(type==3){
param.getDeviceInfoParam().setPowerFlag(0);
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(param.getDeviceInfoParam(), Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
Map<String, Long> map = new LinkedHashMap<>(); Map<String, Long> map = new LinkedHashMap<>();
DateField dateField; DateField dateField;
@@ -296,12 +299,14 @@ public class GridDiagramServiceImpl implements GridDiagramService {
//根据步进单位获取起始日期时间和结束日期时间的时间区间集合 //根据步进单位获取起始日期时间和结束日期时间的时间区间集合
List<DateTime> dateTimes = DateUtil.rangeToList(parse, DateUtil.parse(param.getSearchEndTime()), dateField); List<DateTime> dateTimes = DateUtil.rangeToList(parse, DateUtil.parse(param.getSearchEndTime()), dateField);
List<Date> times; List<Date> times;
//终端分布趋势
if (4 == type) { if (4 == type) {
List<String> devIDs = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList()); List<String> devIDs = generalDeviceDTOList.stream().flatMap(x -> x.getDeviceIndexes().stream()).distinct().collect(Collectors.toList());
List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>().select(Device::getLoginTime).in(CollUtil.isNotEmpty(devIDs), Device::getId, devIDs).eq(Device::getRunFlag, 0)); List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>().select(Device::getLoginTime).in(CollUtil.isNotEmpty(devIDs), Device::getId, devIDs).eq(Device::getRunFlag, 0));
times = list.stream().map(x -> Date.from(x.getLoginTime().atStartOfDay(ZoneId.systemDefault()).toInstant())).collect(Collectors.toList()); times = list.stream().map(x -> Date.from(x.getLoginTime().atStartOfDay(ZoneId.systemDefault()).toInstant())).collect(Collectors.toList());
} else { } else {
List<String> ids; List<String> ids;
//监测点分布趋势
if (type == 3) { if (type == 3) {
ids = generalDeviceDTOList.stream().flatMap(x -> x.getSubIndexes().stream()).distinct().collect(Collectors.toList()); ids = generalDeviceDTOList.stream().flatMap(x -> x.getSubIndexes().stream()).distinct().collect(Collectors.toList());
} else { } else {
@@ -310,13 +315,29 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<Line> list = lineService.list(new LambdaQueryWrapper<Line>().in(CollUtil.isNotEmpty(ids), Line::getId, ids).eq(Line::getState, DataStateEnum.ENABLE.getCode()).eq(Line::getLevel, type)); List<Line> list = lineService.list(new LambdaQueryWrapper<Line>().in(CollUtil.isNotEmpty(ids), Line::getId, ids).eq(Line::getState, DataStateEnum.ENABLE.getCode()).eq(Line::getLevel, type));
times = list.stream().map(x -> Date.from(x.getCreateTime().atZone(ZoneId.systemDefault()).toInstant())).collect(Collectors.toList()); times = list.stream().map(x -> Date.from(x.getCreateTime().atZone(ZoneId.systemDefault()).toInstant())).collect(Collectors.toList());
} }
for (DateTime dateTime : dateTimes) { long num =0;
for (int i = 0; i < dateTimes.size(); i++) {
if(i==0){
if (1 == param.getType()) { if (1 == param.getType()) {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(dateTime), DateUtil.endOfYear(dateTime))).count(); long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(DateUtil.parse("1970-01-01 00:00:00")), DateUtil.endOfYear(dateTimes.get(0)))).count();
map.put(dateTime.toString().substring(0, 4), count); num=num+count;
map.put(dateTimes.get(0).toString().substring(0, 4), num);
} else { } else {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfMonth(dateTime), DateUtil.endOfMonth(dateTime))).count(); long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(DateUtil.parse("1970-01-01 00:00:00")), DateUtil.endOfMonth(dateTimes.get(0)))).count();
map.put(dateTime.toString().substring(0, 7), count); num=num+count;
map.put(dateTimes.get(0).toString().substring(0, 7), num);
}
}else{
int finalI = i;
if (1 == param.getType()) {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfYear(dateTimes.get(finalI)), DateUtil.endOfYear(dateTimes.get(finalI)))).count();
num=num+count;
map.put(dateTimes.get(finalI).toString().substring(0, 4), num);
} else {
long count = times.stream().filter(x -> DateUtil.isIn(x, DateUtil.beginOfMonth(dateTimes.get(finalI)), DateUtil.endOfMonth(dateTimes.get(finalI)))).count();
num=num+count;
map.put(dateTimes.get(finalI).toString().substring(0, 7), num);
}
} }
} }
return map; return map;

View File

@@ -490,7 +490,7 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
} else { } else {
groupLine = childrenData.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid)); groupLine = childrenData.stream().collect(Collectors.groupingBy(LineIntegrityDataVO::getPid));
} }
targetData = targetData.stream().peek(lineAdministrationTree -> { targetData.stream().peek(lineAdministrationTree -> {
List<Double> data = new ArrayList<>(); List<Double> data = new ArrayList<>();
List<LineIntegrityDataVO> childList = new ArrayList<>(); List<LineIntegrityDataVO> childList = new ArrayList<>();
Set<String> pids = groupLine.keySet(); Set<String> pids = groupLine.keySet();
@@ -514,7 +514,8 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl<LineIntegrityDataM
} }
//父级完整性匹配 //父级完整性匹配
if (CollectionUtil.isNotEmpty(data)){ if (CollectionUtil.isNotEmpty(data)){
double avg = data.stream().collect(Collectors.averagingDouble(x -> x)); BigDecimal reduce = data.stream().map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
double avg = reduce.divide(new BigDecimal(data.size()),6,RoundingMode.HALF_UP).doubleValue();
lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(avg)); lineAdministrationTree.setIntegrityData(DataStatisticsUtil.dataLimits(avg));
} else { } else {
lineAdministrationTree.setIntegrityData(3.14159); lineAdministrationTree.setIntegrityData(3.14159);

View File

@@ -26,10 +26,7 @@ import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO; import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO; import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.DataParam; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.param.PqsParam;
import com.njcn.device.pq.pojo.param.TerminalMainQueryParam;
import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.po.*;
import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.service.DeptLineService; import com.njcn.device.pq.service.DeptLineService;
@@ -504,10 +501,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData(); List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue)); Map<String, String> dicMap = data.stream().collect(Collectors.toMap(DictData::getId, DictData::getValue));
LineDTO lineDTO = this.baseMapper.selectLineDetail(id); LineDTO lineDTO = this.baseMapper.selectLineDetail(id);
if(lineDTO != null){
if(dicMap.containsKey(lineDTO.getVoltageLevel())){ if(dicMap.containsKey(lineDTO.getVoltageLevel())){
lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel())); lineDTO.setVoltageLevel(dicMap.get(lineDTO.getVoltageLevel()));
return lineDTO; return lineDTO;
} }
}
return null; return null;
} }
@@ -694,6 +693,40 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
return this.baseMapper.getReportLineInfo(ids); return this.baseMapper.getReportLineInfo(ids);
} }
@Override
public List<LineDetail> getByName(LineBaseQueryParam param) {
return this.baseMapper.selectByName(param);
}
@Override
public List<DevAndLine> getByDeptDevLine(String id) {
List<DevAndLine> info=new ArrayList<>();
List<String> ids = deptFeignClient.getDepSonIdtByDeptId(id).getData();
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
List<String> lineIDs = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(lineIDs)){
List<LineDetailVO.Detail> deptDeviceDetailData = this.baseMapper.getDeptDeviceDetailData(lineIDs, null, 3);
if(CollUtil.isNotEmpty(deptDeviceDetailData)){
Map<String, List<LineDetailVO.Detail>> collect = deptDeviceDetailData.stream().collect(Collectors.groupingBy(LineDetailVO.Detail::getDevId));
collect.forEach((k,v)->{
DevAndLine devAndLine = new DevAndLine();
List<DevAndLine.Line> lineList=new ArrayList<>();
devAndLine.setDevId(k);
devAndLine.setDevName(v.get(0).getDevName());
v.stream().distinct().forEach(v1->{
DevAndLine.Line line = new DevAndLine.Line();
line.setLineId(v1.getLineId());
line.setLineName(v1.getLineName());
lineList.add(line);
});
devAndLine.setLineList(lineList);
info.add(devAndLine);
});
}
}
return info;
}
@Override @Override
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) { public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList()); return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());

View File

@@ -0,0 +1,89 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pq.mapper.LineDetailMapper;
import com.njcn.device.pq.mapper.NewStationMapper;
import com.njcn.device.pq.pojo.param.NewStationQueryParam;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.service.INewStationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
* 新能源场站高低电压穿越表 服务实现类
* </p>
*
* @author guofeihu
* @since 2024-08-14
*/
@Service
@RequiredArgsConstructor
public class NewStationServiceImpl extends ServiceImpl<NewStationMapper, NewStation> implements INewStationService {
private final LineDetailMapper lineDetailMapper;
@Override
public Page<NewStation> queryPage(NewStationQueryParam newStationQueryParam) {
Page<NewStation> returnpage = new Page<> (newStationQueryParam.getPageNum(),newStationQueryParam.getPageSize());
returnpage = this.getBaseMapper().queryPage(returnpage,newStationQueryParam);
return returnpage;
}
@Override
public Boolean editNewStation(NewStationQueryParam.NewStationEdit newStationEdit) {
NewStation newStation = new NewStation();
BeanUtil.copyProperties(newStationEdit, newStation);
newStation.setState(1);
boolean result ;
if(newStation.getId() != null){
result = this.updateById(newStation);
}else{
newStation.setId(IdUtil.simpleUUID());
result = this.save(newStation);
}
return result;
}
@Override
public Boolean delNewStation(String ids) {
List<String> listIds = Arrays.asList(ids.split(","));
//判断该新能源场站信息是否绑定了测点ID
for(String id : listIds){
if(lineDetailMapper.checkExistsLineByNewStationId(id)!=0){
LambdaUpdateWrapper<NewStation> queryWrapper = new LambdaUpdateWrapper<>();
queryWrapper.eq(NewStation::getId,id);
NewStation newStation = this.baseMapper.selectOne(queryWrapper);
throw new BusinessException(newStation == null?"":newStation.getName()+DeviceResponseEnum.NEWSTATION_IS_BIND_LINE.getMessage());
}
}
LambdaUpdateWrapper<NewStation> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.set(NewStation::getState,0)
.in(NewStation::getId, listIds);
boolean update = this.update(lambdaUpdateWrapper);
return update;
}
@Override
public List<Map> selectDown(String name) {
return this.baseMapper.selectDown(name);
}
@Override
public NewStation selectById(String id) {
LambdaQueryWrapper<NewStation> lambdaUpdateWrapper = new LambdaQueryWrapper<>();
lambdaUpdateWrapper.eq(NewStation::getId,id).eq(NewStation::getState,1);
return this.baseMapper.selectOne(lambdaUpdateWrapper);
}
}

View File

@@ -85,6 +85,7 @@ public class RStatIntegrityDServiceImpl extends ServiceImpl<RStatIntegrityDMappe
for(Line item : lineList){ for(Line item : lineList){
LineDataQualityDTO lineDataQualityDTO = new LineDataQualityDTO(); LineDataQualityDTO lineDataQualityDTO = new LineDataQualityDTO();
lineDataQualityDTO.setLineId(item.getId()); lineDataQualityDTO.setLineId(item.getId());
lineDataQualityDTO.setLineName(item.getName());
if(onlineMap.containsKey(item.getPid())){ if(onlineMap.containsKey(item.getPid())){
lineDataQualityDTO.setOnlineRate(Double.valueOf(onlineMap.get(item.getPid()).getOnlineRate())); lineDataQualityDTO.setOnlineRate(Double.valueOf(onlineMap.get(item.getPid()).getOnlineRate()));
}else { }else {
@@ -95,6 +96,7 @@ public class RStatIntegrityDServiceImpl extends ServiceImpl<RStatIntegrityDMappe
}else { }else {
lineDataQualityDTO.setIntegrityRate(0.00); lineDataQualityDTO.setIntegrityRate(0.00);
} }
result.add(lineDataQualityDTO);
} }
return result; return result;
} }

View File

@@ -118,6 +118,11 @@ public class RunManageServiceImpl implements RunManageService {
DeviceInfoParam deviceInfoParam = new DeviceInfoParam(); DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
BeanUtil.copyProperties(runManageParam, deviceInfoParam); BeanUtil.copyProperties(runManageParam, deviceInfoParam);
deviceInfoParam.setServerName("pqs-common"); deviceInfoParam.setServerName("pqs-common");
if(CollUtil.isNotEmpty(runManageParam.getRunFlag())){
if(runManageParam.getRunFlag().get(0)==0){
deviceInfoParam.setLineRunFlag(0);
}
}
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(generalDeviceDTOList)) { if (CollectionUtils.isEmpty(generalDeviceDTOList)) {
throw new BusinessException("当前部门没有装置台账"); throw new BusinessException("当前部门没有装置台账");

View File

@@ -5,12 +5,15 @@ import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.text.StrBuilder; import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.config.GeneralInfo; import com.njcn.common.config.GeneralInfo;
import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.common.pojo.dto.SimpleDTO;
@@ -21,6 +24,8 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.LogUtil; import com.njcn.common.utils.LogUtil;
import com.njcn.common.utils.PubUtils; import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.enums.DeviceResponseEnum; import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.biz.enums.RunFlagEnum;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.po.DeviceBak; import com.njcn.device.biz.pojo.po.DeviceBak;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.biz.utils.COverlimitUtil; import com.njcn.device.biz.utils.COverlimitUtil;
@@ -108,9 +113,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final GeneralInfo generalInfo;
/** /**
* 终端新增操作 * 终端新增操作
* *
@@ -1489,6 +1491,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
return this.baseMapper.getVoltageByCondition(voltageIds, scale); return this.baseMapper.getVoltageByCondition(voltageIds, scale);
} }
@Override
public List<Line> getSubByCondition(List<String> subIds, List<SimpleDTO> scale) {
return this.baseMapper.getSubByCondition(subIds, scale);
}
@Override @Override
public List<String> getVoltageIdByScale(List<String> voltageIds, String scale) { public List<String> getVoltageIdByScale(List<String> voltageIds, String scale) {
return this.baseMapper.getVoltageIdByScale(voltageIds, scale); return this.baseMapper.getVoltageIdByScale(voltageIds, scale);
@@ -1882,13 +1889,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
Device deviceDetail = new Device(); Device deviceDetail = new Device();
BeanUtils.copyProperties(deviceParam, deviceDetail); BeanUtils.copyProperties(deviceParam, deviceDetail);
deviceDetail.setId(device.getId()); deviceDetail.setId(device.getId());
deviceDetail.setRunFlag(0); deviceDetail.setRunFlag(3);
deviceDetail.setCallFlag(0); deviceDetail.setCallFlag(0);
deviceDetail.setComFlag(0); deviceDetail.setComFlag(0);
deviceDetail.setCheckFlag(1); deviceDetail.setCheckFlag(1);
deviceDetail.setThisTimeCheck(PubUtils.localDateFormat(deviceParam.getThisTimeCheck())); deviceDetail.setThisTimeCheck(PubUtils.localDateFormat(deviceParam.getThisTimeCheck()));
deviceDetail.setNextTimeCheck(PubUtils.localDateFormat(deviceParam.getNextTimeCheck())); deviceDetail.setNextTimeCheck(PubUtils.localDateFormat(deviceParam.getNextTimeCheck()));
deviceDetail.setLoginTime(PubUtils.localDateFormat(deviceParam.getNextTimeCheck())); deviceDetail.setLoginTime(PubUtils.localDateFormat(deviceParam.getLoginTime()));
deviceDetail.setUpdateTime(LocalDateTime.now()); deviceDetail.setUpdateTime(LocalDateTime.now());
//处理装置识别码秘钥 //处理装置识别码秘钥
@@ -1947,7 +1954,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
LineDetail lineDetail = new LineDetail(); LineDetail lineDetail = new LineDetail();
BeanUtils.copyProperties(lineParam, lineDetail); BeanUtils.copyProperties(lineParam, lineDetail);
lineDetail.setId(line.getId()); lineDetail.setId(line.getId());
lineDetail.setRunFlag(0); lineDetail.setRunFlag(3);
//判断国网监测点id //判断国网监测点id
if (StrUtil.isNotBlank(lineDetail.getMonitorId())) { if (StrUtil.isNotBlank(lineDetail.getMonitorId())) {
lineDetail.setMonitorFlag(1); lineDetail.setMonitorFlag(1);
@@ -1987,6 +1994,40 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
return subIndex; return subIndex;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean terminalSyncRunFly(String lineId) {
LineDTO lineDTO = this.baseMapper.selectLineDetail(lineId);
if(ObjectUtil.isNotNull(lineDTO)){
lineDetailMapper.update(null,new LambdaUpdateWrapper<LineDetail>()
.set(LineDetail::getRunFlag, 0)
.eq(LineDetail::getId, lineDTO.getLineId())
);
deviceMapper.update(null,new LambdaUpdateWrapper<Device>()
.set(Device::getRunFlag, 0)
.eq(Device::getId, lineDTO.getDevId())
);
}
return false;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean terminalSyncDeleteFly(String lineId) {
LineDTO lineDTO = this.baseMapper.selectLineDetail(lineId);
if(ObjectUtil.isNotNull(lineDTO)){
//删除监测点详细信息
lineDetailMapper.updateLineRunFlag(lineDTO.getLineId(), RunFlagEnum.QUIT.getStatus());
//todo 删除监测点信息
this.removeById(lineDTO.getLineId());
//todo 删除部门监测点关系
deptLineMapper.delete(new LambdaQueryWrapper<DeptLine>()
.eq(DeptLine::getLineId, lineDTO.getLineId()));
}
return false;
}
private String saveTerminalInfo(List<OracleTerminalExcel> oracleTerminalExcels, List<OverLimitExcel> overLimitExcels) { private String saveTerminalInfo(List<OracleTerminalExcel> oracleTerminalExcels, List<OverLimitExcel> overLimitExcels) {
List<OracleTerminalExcel.OracleTerminalExcelMsg> oracleTerminalExcelMsg = new ArrayList<>(); List<OracleTerminalExcel.OracleTerminalExcelMsg> oracleTerminalExcelMsg = new ArrayList<>();
@@ -2084,6 +2125,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
LambdaQueryWrapper<DeviceBak> deviceBakLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DeviceBak> deviceBakLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceBakLambdaQueryWrapper.eq(DeviceBak::getDevId, oracleTerminalExcel.getDeviceId()); deviceBakLambdaQueryWrapper.eq(DeviceBak::getDevId, oracleTerminalExcel.getDeviceId());
List<DeviceBak> deviceBaks = deviceBakService.list(deviceBakLambdaQueryWrapper); List<DeviceBak> deviceBaks = deviceBakService.list(deviceBakLambdaQueryWrapper);
List<String> devIds = deviceBaks.stream().map(DeviceBak::getId).collect(Collectors.toList()); List<String> devIds = deviceBaks.stream().map(DeviceBak::getId).collect(Collectors.toList());
List<Line> devList = new ArrayList<>(); List<Line> devList = new ArrayList<>();
if(!CollectionUtil.isEmpty(devIds)){ if(!CollectionUtil.isEmpty(devIds)){
@@ -2174,6 +2216,79 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
} }
} }
}else{
//先查询终端id是否存在存在则修改不存在这添加
//判断是否因为改了终端名称导致没有查到数据
// LambdaQueryWrapper<DeviceBak> deviceBakLambdaQueryWrapper = new LambdaQueryWrapper<>();
// deviceBakLambdaQueryWrapper.eq(DeviceBak::getDevId, temp.getId());
// DeviceBak byId = deviceBakService.getById(deviceBakLambdaQueryWrapper);
// if(Objects.isNull(byId)){
//插入新旧终端ID中间表
DeviceBak deviceBak = new DeviceBak();
deviceBak.setId(temp.getId());
deviceBak.setDevId(oracleTerminalExcel.getDeviceId());
deviceBakService.saveOrUpdate(deviceBak);
// }else{
// if(!byId.getDevId().equals(oracleTerminalExcel.getDeviceId())){
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "终端关系数据存入Oracle和excl不一样" + oracleTerminalExcel.getLineNum() + "需要排查"));
// continue;
// }
// }
//更新终端信息
List<Device> existIp = deviceMapper.getDeviceBySubId(pids.get(LineBaseEnum.SUB_LEVEL.getCode()), oracleTerminalExcel.getIp(), oracleTerminalExcel.getPort(), null);
if (CollectionUtil.isNotEmpty(existIp)) {
Device device = existIp.get(0);
if (!device.getId().equalsIgnoreCase(temp.getId())) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "IP地址" + oracleTerminalExcel.getIp() + "已存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
}
//处理终端厂家
DictData manufacturer = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName(),oracleTerminalExcel.getManufacturer()).getData();
if (Objects.isNull(manufacturer)) {
//在终端厂家字典内新增一条记录
manufacturer = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_MANUFACTURER.getName(), oracleTerminalExcel.getManufacturer()).getData();
}
Device device = new Device();
BeanUtils.copyProperties(oracleTerminalExcel, device);
device.setId(temp.getId());
device.setManufacturer(manufacturer.getId());
device.setIp(oracleTerminalExcel.getIp());
//处理前置ID
Node node = nodeService.getNodeByNodeName(oracleTerminalExcel.getNodeName());
if (Objects.isNull(node)) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "前置名:" + oracleTerminalExcel.getNodeName() + "不存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
device.setNodeId(node.getId());
String oracleDevType = oracleTerminalExcel.getDevType().toUpperCase();
String frontType = getComType(oracleDevType);
if (StringUtils.isBlank(frontType)) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "前置类型不存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
//处理前置类型
DictData frontTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.FRONT_TYPE.getName(), frontType).getData();
if (Objects.isNull(frontTypeDicData)) {
//在通讯类型字典内新增一条记录
frontTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.FRONT_TYPE.getName(), frontType).getData();
}
device.setFrontType(frontTypeDicData.getId());
String devType = oracleDevType.replace("_" + frontType, "");
//处理终端类型
DictData devTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_TYPE.getName(),devType).getData();
if (Objects.isNull(devTypeDicData)) {
//在终端类型字典内新增一条记录
devTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_TYPE.getName(), devType).getData();
}
device.setDevType(devTypeDicData.getId());
deviceMapper.updateById(device);
} }
//添加终端索引 //添加终端索引
pids.add(temp.getId()); pids.add(temp.getId());
@@ -2215,6 +2330,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
//添加母线索引 //添加母线索引
pids.add(temp.getId()); pids.add(temp.getId());
/* /*
* 处理监测点 * 处理监测点
* 1、判断是否存在不存在则插入 * 1、判断是否存在不存在则插入
@@ -2227,6 +2344,65 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
temp = queryLine(lineLambdaQueryWrapper, lineName, pids.get(LineBaseEnum.SUB_V_LEVEL.getCode()), LineBaseEnum.LINE_LEVEL.getCode(), DataStateEnum.ENABLE.getCode()); temp = queryLine(lineLambdaQueryWrapper, lineName, pids.get(LineBaseEnum.SUB_V_LEVEL.getCode()), LineBaseEnum.LINE_LEVEL.getCode(), DataStateEnum.ENABLE.getCode());
if (Objects.nonNull(temp)) { if (Objects.nonNull(temp)) {
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "监测点名称重复,请联系管理员")); // oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "监测点名称重复,请联系管理员"));
LineBak lineBak = new LineBak();
lineBak.setId(temp.getId());
lineBak.setLineId(oracleTerminalExcel.getId());
lineBakService.saveOrUpdate(lineBak);
//修改监测点信息
LineDetail lineDetail = new LineDetail();
BeanUtils.copyProperties(oracleTerminalExcel, lineDetail);
lineDetail.setId(temp.getId());
//判断监测点号是否已被占用
List<LineDetail> lineDetails = lineDetailMapper.getLineDetail(pids.get(LineBaseEnum.DEVICE_LEVEL.getCode()), Stream.of(oracleTerminalExcel.getLineNum()).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(lineDetails)) {
LineDetail lineDetail1 = lineDetails.get(0);
if (lineDetail1.getId().equalsIgnoreCase(temp.getId())) {
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "监测点线路号:" + oracleTerminalExcel.getLineNum() + "已存在"));
//删除刚刚新增装置信息
this.baseMapper.deleteById(temp.getId());
continue;
}
}
//获取该监测点的限值数据
// List<OverLimitExcel> overLimitList = overLimitExcels.stream()
// .filter(overLimitExcel -> overLimitExcel.getId().equals(oracleTerminalExcel.getId()))
// .collect(Collectors.toList());
// if (CollectionUtil.isEmpty(overLimitList)) {
// oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "没有找到该监测点的限值数据"));
// //删除刚刚新增装置信息
// this.baseMapper.deleteById(temp.getId());
// continue;
// }
lineDetail.setNum(oracleTerminalExcel.getLineNum());
//干扰源类型
DictData loadTypeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName(),oracleTerminalExcel.getLoadType()).getData();
if (Objects.isNull(loadTypeDicData)) {
//在电压等级内新增一条记录
loadTypeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName(), oracleTerminalExcel.getLoadType()).getData();
}
lineDetail.setLoadType(loadTypeDicData.getId());
//行业类型
DictData businessDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName(),oracleTerminalExcel.getBusinessType()).getData();
if (Objects.isNull(businessDicData)) {
//在电压等级内新增一条记录
businessDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.BUSINESS_TYPE.getName(), oracleTerminalExcel.getBusinessType()).getData();
}
lineDetail.setBusinessType(businessDicData.getId());
if (StringUtils.isBlank(oracleTerminalExcel.getMonitorId())) {
lineDetail.setMonitorFlag(0);
} else {
lineDetail.setMonitorFlag(1);
}
//终端等级,为空不处理,可以为空
if (StringUtils.isNotBlank(oracleTerminalExcel.getLineGrade())) {
DictData lineGradeDicData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.DEV_LEVEL.getName(),oracleTerminalExcel.getLineGrade()).getData();
if (Objects.isNull(lineGradeDicData)) {
//在电压等级内新增一条记录
lineGradeDicData = dicDataFeignClient.addDicData(DicDataTypeEnum.DEV_LEVEL.getName(), oracleTerminalExcel.getLineGrade()).getData();
}
lineDetail.setLineGrade(lineGradeDicData.getId());
}
lineDetailMapper.updateById(lineDetail);
} else { } else {
//判断是否因为改了终端名称导致没有查到数据 //判断是否因为改了终端名称导致没有查到数据
LambdaQueryWrapper<LineBak> lineBakLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LineBak> lineBakLambdaQueryWrapper = new LambdaQueryWrapper<>();

Some files were not shown because too many files have changed in this diff Show More