1.调整河北pms国网上送主配网逻辑
2.技术监督调整
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.njcn.process.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
@@ -9,13 +8,14 @@ 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.prepare.harmonic.api.line.ThsSuperviseClient;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.vo.SuperviseVo;
|
||||
import com.njcn.process.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.FileParam;
|
||||
import com.njcn.process.pojo.param.ThsSuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.process.service.ThsSuperviseService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -50,20 +50,45 @@ public class ThsSuperviseController extends BaseController {
|
||||
private ThsSuperviseService thsSuperviseService;
|
||||
@Autowired
|
||||
private ThsOverRunLogService thsOverRunLogService;
|
||||
@Autowired
|
||||
private ThsSuperviseClient thsSuperviseClient;
|
||||
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("预警/告警事务生成")
|
||||
@ApiOperation("预警/告警事务生成手动")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/initSuperviseHand")
|
||||
public HttpResult<SuperviceRunLogVo> initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
String methodDescribe = getMethodDescribe("initSuperviseHand");
|
||||
SuperviceRunLogVo result = thsSuperviseService.initSuperviseHand(superviseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("预警/告警事务生成自动")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/initSupervise")
|
||||
public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
String methodDescribe = getMethodDescribe("initSupervise");
|
||||
HttpResult<String> superviceRunLogVoHttpResult = thsSuperviseClient.initSupervise(superviseParam);
|
||||
SuperviceRunLogVo superviceRunLogVo = JSON.parseObject(superviceRunLogVoHttpResult.getData(), SuperviceRunLogVo.class);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, superviceRunLogVo, methodDescribe);
|
||||
SuperviceRunLogVo result = thsSuperviseService.initSupervise(superviseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("技术监督单详细列表")
|
||||
@ApiImplicitParam(name = "thsSuperviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/queryPage")
|
||||
public HttpResult<Page<ThsSupervise>> queryPage(@RequestBody @Validated ThsSuperviseParam thsSuperviseParam) {
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
Page<ThsSupervise> page = thsSuperviseService.queryPage(thsSuperviseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@ApiOperation("保存技术监督监测点")
|
||||
@ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true)
|
||||
@@ -167,10 +192,10 @@ public class ThsSuperviseController extends BaseController {
|
||||
@ApiOperation("技术监督首页")
|
||||
@ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true)
|
||||
@PostMapping("/superviseIndex")
|
||||
public HttpResult<Page<ThsSuperviseVo>> superviseIndex(@RequestBody SuperviseDto superviseDto) {
|
||||
Page<ThsSuperviseVo> pageResult = thsSuperviseService.superviseIndex(superviseDto);
|
||||
public HttpResult<ThsSuperviseVo> superviseIndex(@RequestBody SuperviseDto superviseDto) {
|
||||
ThsSuperviseVo resultList = thsSuperviseService.superviseIndex(superviseDto);
|
||||
String methodDescribe = getMethodDescribe("superviseIndex");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pageResult, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resultList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,5 +208,8 @@ public class ThsSuperviseController extends BaseController {
|
||||
HttpServletResponse resp = thsSuperviseService.downloadFeedBackFile(fileParam, request, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.process.pojo.po.ThsDeptAlarm;
|
||||
import com.njcn.process.pojo.po.ThsDeptMonitor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-03-10
|
||||
*/
|
||||
public interface ThsDeptMonitorMapper extends BaseMapper<ThsDeptMonitor> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.njcn.process.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviseVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
@@ -24,5 +26,8 @@ public interface ThsSuperviseMapper extends BaseMapper<ThsSupervise> {
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<SuperviseVo> querySuperviseList(Page<SuperviseVo> page, @Param("param") SuperviseDto superviseDto);
|
||||
List<SuperviseVo> querySuperviseList(@Param("param") SuperviseDto superviseDto);
|
||||
|
||||
|
||||
Page<SuperviseVo> querySupervisePage(@Param("page")Page<SuperviseVo> page,@Param("param") SuperviseDto superviseDto);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.param.StrategyParam;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategy;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -47,6 +47,16 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
*/
|
||||
List<String> getMonitorTagDetail(@Param("id") String id);
|
||||
|
||||
|
||||
/***
|
||||
* 获取监测点
|
||||
* @author wr
|
||||
* @date 2023-03-10 13:46
|
||||
* @param id
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getMonitorIds(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 查询策略的集合
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,31 @@
|
||||
<mapper namespace="com.njcn.process.mapper.ThsSuperviseMapper">
|
||||
<!--查询技术监督列表-->
|
||||
<select id="querySuperviseList" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
|
||||
resultType="com.njcn.prepare.harmonic.pojo.vo.SuperviseVo">
|
||||
resultType="com.njcn.process.pojo.vo.SuperviseVo">
|
||||
select ts.*,ass.pro_index as deploymentId,exec_index as execId from ths_supervise ts
|
||||
left join ths_flowable_ass ass on ts.sup_index = ass.ths_index
|
||||
where 1=1
|
||||
<if test="param.searchValue != null and param.searchValue != ''">
|
||||
AND ts.name like CONCAT(CONCAT('%', #{param.searchValue}), '%')
|
||||
</if>
|
||||
<if test="param.searchBeginTime != null and param.searchBeginTime != ''">
|
||||
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{param.searchBeginTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="param.searchEndTime != null and param.searchEndTime != ''">
|
||||
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') <= DATE_FORMAT(#{param.searchEndTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="param.searchState != null">
|
||||
AND ts.progress=#{param.searchState}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND ts.type=#{param.type}
|
||||
</if>
|
||||
order by ts.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="querySupervisePage" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
|
||||
resultType="com.njcn.process.pojo.vo.SuperviseVo">
|
||||
select ts.*,ass.pro_index as deploymentId,exec_index as execId from ths_supervise ts
|
||||
left join ths_flowable_ass ass on ts.sup_index = ass.ths_index
|
||||
where 1=1
|
||||
|
||||
@@ -31,12 +31,19 @@
|
||||
column="{id = id}"
|
||||
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getStrategyDetail">
|
||||
</collection>
|
||||
<collection
|
||||
property="monitorIds"
|
||||
column="{id = id}"
|
||||
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getMonitorIds">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="selectUpdateStrategy" resultMap="StrategyResultMap">
|
||||
SELECT
|
||||
ts.Id AS id,
|
||||
ts.NAME AS NAME,
|
||||
ts.Grade AS grade,
|
||||
ts.dept_id,
|
||||
ts.type,
|
||||
ts.Operation AS operation
|
||||
FROM
|
||||
ths_warn_strategy ts
|
||||
@@ -52,7 +59,7 @@
|
||||
Warn_Id = #{id} and ts.Type=1
|
||||
</select>
|
||||
<!--查询策略的集合-->
|
||||
<select id="selectStrategyList" parameterType="com.njcn.prepare.harmonic.pojo.param.SuperviseParam"
|
||||
<select id="selectStrategyList" parameterType="com.njcn.process.pojo.param.SuperviseParam"
|
||||
resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo">
|
||||
select
|
||||
tws.id,
|
||||
@@ -60,12 +67,9 @@
|
||||
tws.grade,
|
||||
tws.operation,
|
||||
tws.type,
|
||||
Monitor_Id as monitorId,
|
||||
tda.dept_Id as deptId
|
||||
tws.dept_Id as deptId
|
||||
from
|
||||
ths_warn_strategy tws
|
||||
INNER join ths_dept_alarm tda on
|
||||
tws.Id = tda.Alarm_Id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="param.initType==0">
|
||||
@@ -76,12 +80,11 @@
|
||||
</when>
|
||||
</choose>
|
||||
<if test="param.deptId !=null and param.deptId !=''">
|
||||
and tda.Dept_Id=#{param.deptId}
|
||||
and tws.Dept_Id=#{param.deptId}
|
||||
</if>
|
||||
<if test="param.type !=null">
|
||||
and tda.type=#{param.type}
|
||||
and tws.type=#{param.type}
|
||||
</if>
|
||||
and tws.Big_Type=1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -94,4 +97,13 @@
|
||||
Warn_Id = #{id} and ts.Type=0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getMonitorIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
Ass_Id
|
||||
FROM
|
||||
ths_warn_strategy_ass ts
|
||||
WHERE
|
||||
Warn_Id = #{id} and ts.Type=2
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.njcn.process.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.vo.SuperviseVo;
|
||||
import com.njcn.process.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.FileParam;
|
||||
import com.njcn.process.pojo.param.ThsSuperviseParam;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -91,7 +95,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto);
|
||||
ThsSuperviseVo superviseIndex(SuperviseDto superviseDto);
|
||||
|
||||
/**
|
||||
* 下载反馈文件
|
||||
@@ -101,4 +105,19 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @return
|
||||
*/
|
||||
HttpServletResponse downloadFeedBackFile(FileParam fileParam, HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成预警单告警单
|
||||
* @author cdf
|
||||
* @date 2024/1/29
|
||||
*/
|
||||
SuperviceRunLogVo initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
|
||||
|
||||
SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
|
||||
|
||||
Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.enums.ProgressEnum;
|
||||
import com.njcn.process.mapper.ThsOverRunLogMapper;
|
||||
import com.njcn.process.mapper.ThsSuperviseMapper;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -12,29 +13,44 @@ 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.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.CommMonitorInfoDTO;
|
||||
import com.njcn.device.biz.pojo.param.MonitorGetParam;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.vo.SuperviseVo;
|
||||
import com.njcn.process.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.harmonic.annotaion.HarCurrent;
|
||||
import com.njcn.harmonic.annotaion.HarVoltage;
|
||||
import com.njcn.harmonic.annotaion.InterharVoltage;
|
||||
import com.njcn.process.enums.*;
|
||||
import com.njcn.process.mapper.*;
|
||||
import com.njcn.process.pojo.param.FileParam;
|
||||
import com.njcn.process.pojo.param.ThsSuperviseParam;
|
||||
import com.njcn.process.pojo.po.FlowableAss;
|
||||
import com.njcn.process.pojo.po.ThsAlarmFormwork;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.process.service.ThsSuperviseService;
|
||||
import com.njcn.process.service.flowable.IFlowDefinitionService;
|
||||
import com.njcn.process.service.flowable.IFlowTaskService;
|
||||
import com.njcn.process.utils.ReadPatientExcelUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
@@ -53,13 +69,18 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.Adler32;
|
||||
import java.util.zip.CheckedOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static com.njcn.process.enums.SteadyIndicatorEnum.Negative_Voltage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@@ -74,7 +95,7 @@ import java.util.zip.ZipOutputStream;
|
||||
public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService {
|
||||
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
|
||||
|
||||
private final ThsWarnStrategyMapper thsWarnStrategyMapper;
|
||||
@@ -87,7 +108,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
|
||||
private final ThsSuperviseMapper thsSuperviseMapper;
|
||||
|
||||
private final ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
private final ThsOverRunLogService thsOverRunLogService;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@@ -104,6 +125,13 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
|
||||
private final FlowableAssMapper flowableAssMapper;
|
||||
|
||||
private final ThsDeptMonitorMapper thsDeptMonitorMapper;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
|
||||
private final RStatLimitRateDClient rStatLimitRateDClient;
|
||||
|
||||
|
||||
/**
|
||||
* 构建技术监督名称
|
||||
*
|
||||
@@ -135,7 +163,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsSupervise.setModifyTime(date);
|
||||
thsSupervise.setSupIndex(IdUtil.simpleUUID());
|
||||
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
|
||||
this.thsSuperviseMapper.insert(thsSupervise);
|
||||
this.save(thsSupervise);
|
||||
//TODO 解决工作流写死问题
|
||||
Map<String, Object> mapParam = new HashMap<>();
|
||||
String proInId = "";
|
||||
@@ -150,7 +178,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
|
||||
thsOverRunLog.setCreateTime(date);
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
this.thsOverRunLogMapper.insert(thsOverRunLog);
|
||||
thsOverRunLogService.save(thsOverRunLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,12 +188,12 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
Integer pageNum = PageFactory.getPageNum(superviseDto);
|
||||
Integer pageSize = PageFactory.getPageSize(superviseDto);
|
||||
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
|
||||
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto);
|
||||
Page<SuperviseVo> page = thsSuperviseMapper.querySupervisePage(superviseVoPage,superviseDto);
|
||||
List<SuperviseVo> pageRecords = page.getRecords();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseVo.getSupIndex()));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseVo.getSupIndex()));
|
||||
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
|
||||
List<String> alarmTickets = thsOverRunLogs.stream().filter(r -> StringUtils.isNotBlank(r.getAlarmTicket())).map(ThsOverRunLog::getAlarmTicket).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(alarmTickets)) {
|
||||
@@ -199,7 +227,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
|
||||
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
|
||||
superviseDto.getDeleteIds().forEach(id -> {
|
||||
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
|
||||
thsOverRunLogService.remove(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
|
||||
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id));
|
||||
|
||||
//删除同时删除工作流程
|
||||
@@ -223,20 +251,20 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
|
||||
|
||||
if (files != null && files.length == 1) {
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(id);
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
|
||||
thsOverRunLog.setId(id);
|
||||
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
|
||||
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
|
||||
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
|
||||
}
|
||||
if (files != null && files.length > 1) {
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType);
|
||||
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
|
||||
}
|
||||
|
||||
//判断当监督单下面的监测点报告都被上传则认为流程完成
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
List<String> fileNames = thsOverRunLogs.stream().filter(item-> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
|
||||
if(fileNames.size() == thsOverRunLogs.size()){
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
@@ -354,7 +382,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsOverRunLog.setReviseFeedback(path);
|
||||
break;
|
||||
}
|
||||
thsOverRunLogMapper.updateById(thsOverRunLog);
|
||||
thsOverRunLogService.updateById(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +436,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsSupervise.setProgress(ProgressEnum.REVISE_FEEDBACK.getCode());
|
||||
thsOverRunLog.setReviseNotice(thsAlarmFormwork.getPath());
|
||||
}
|
||||
thsOverRunLogMapper.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
thsOverRunLogService.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
|
||||
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
@@ -423,47 +451,48 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto) {
|
||||
Integer pageNum = PageFactory.getPageNum(superviseDto);
|
||||
Integer pageSize = PageFactory.getPageSize(superviseDto);
|
||||
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
|
||||
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto);
|
||||
List<SuperviseVo> pageRecords = page.getRecords();
|
||||
Page<ThsSuperviseVo> thsSuperviseVoPage = new Page<>(pageNum, pageSize);
|
||||
thsSuperviseVoPage.setTotal(superviseVoPage.getTotal());
|
||||
public ThsSuperviseVo superviseIndex(SuperviseDto superviseDto) {
|
||||
List<SuperviseVo> querySuperviseList = thsSuperviseMapper.querySuperviseList(superviseDto);
|
||||
|
||||
|
||||
ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
if (CollectionUtil.isNotEmpty(querySuperviseList)) {
|
||||
for (SuperviseVo superviseVo : querySuperviseList) {
|
||||
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
|
||||
//处理预警类型
|
||||
|
||||
Date modifyTime = superviseVo.getModifyTime();
|
||||
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
|
||||
superviseVo.setProgressTime(progressTime.intValue());
|
||||
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
|
||||
case START:
|
||||
case ALARM_TICKET_ISSUE:
|
||||
if (progressTime >= 1) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (progressTime >= 10) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else if (progressTime >= 8) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
|
||||
} else if (progressTime >= 5) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
if (Objects.nonNull(modifyTime)) {
|
||||
|
||||
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
|
||||
superviseVo.setProgressTime(progressTime.intValue());
|
||||
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
|
||||
case START:
|
||||
|
||||
case ALARM_TICKET_ISSUE:
|
||||
if (progressTime >= 1) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (progressTime >= 10) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else if (progressTime >= 8) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
|
||||
} else if (progressTime >= 5) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
thsSuperviseVo.setSuperviseVoList(pageRecords);
|
||||
thsSuperviseVo.setSuperviseVoList(querySuperviseList);
|
||||
//分组计算每种流程状态的数量
|
||||
Map<Integer, List<SuperviseVo>> map = pageRecords.stream().collect(Collectors.groupingBy(SuperviseVo::getProgress));
|
||||
Map<Integer, List<SuperviseVo>> map = querySuperviseList.stream().collect(Collectors.groupingBy(SuperviseVo::getProgress));
|
||||
for (Map.Entry<Integer, List<SuperviseVo>> entry : map.entrySet()) {
|
||||
Integer code = entry.getKey();
|
||||
switch (ProgressEnum.getProgressEnumByCode(code)) {
|
||||
@@ -491,7 +520,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
}
|
||||
//分组计算预/告警单数量
|
||||
Map<Integer, List<SuperviseVo>> typeMap = pageRecords.stream().collect(Collectors.groupingBy(SuperviseVo::getType));
|
||||
Map<Integer, List<SuperviseVo>> typeMap = querySuperviseList.stream().collect(Collectors.groupingBy(SuperviseVo::getType));
|
||||
for (Map.Entry<Integer, List<SuperviseVo>> entry : typeMap.entrySet()) {
|
||||
Integer code = entry.getKey();
|
||||
switch (AlarmTypeEnum.getAlarmTypeEnumByCode(code)) {
|
||||
@@ -504,8 +533,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
}
|
||||
}
|
||||
thsSuperviseVoPage.setRecords(Collections.singletonList(thsSuperviseVo));
|
||||
return thsSuperviseVoPage;
|
||||
return thsSuperviseVo;
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +543,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (ticketTypeEnum == null) {
|
||||
throw new BusinessException("上传单据参数类型错误!");
|
||||
}
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, fileParam.getIds()));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, fileParam.getIds()));
|
||||
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
|
||||
Map<String, String> filePathMap = new HashedMap();
|
||||
switch (ticketTypeEnum) {
|
||||
@@ -536,6 +564,259 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成预警单告警单(自动)
|
||||
* @author cdf
|
||||
* @date 2024/1/29
|
||||
*/
|
||||
@Override
|
||||
public SuperviceRunLogVo initSupervise(SuperviseParam superviseParam) {
|
||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
|
||||
List<ThsSupervise> thsSuperviseListPO = new ArrayList<>();
|
||||
List<ThsOverRunLog> allThsLogPO = new ArrayList<>();
|
||||
|
||||
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
List<DictData> dictTargetList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
|
||||
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
|
||||
//按部门进行分组
|
||||
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
||||
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
|
||||
|
||||
Map<String, List<ThsStrategyVo>> deptMap = oneLevel.stream().collect(Collectors.groupingBy(ThsStrategyVo::getDeptId));
|
||||
for (Map.Entry<String, List<ThsStrategyVo>> entry : deptMap.entrySet()) {
|
||||
String depId = entry.getKey();
|
||||
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(depId).getData();
|
||||
Dept dept = deptFeignClient.getDeptById(depId).getData();
|
||||
|
||||
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
|
||||
|
||||
ThsSupervise thsSupervise = null;
|
||||
List<ThsStrategyVo> deptStrategyList = entry.getValue();
|
||||
if (CollectionUtil.isNotEmpty(deptStrategyList)) {
|
||||
//遍历当前部门下面的所有策略
|
||||
for (ThsStrategyVo oneStrategyVo : deptStrategyList) {
|
||||
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
||||
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
|
||||
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
|
||||
|
||||
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
||||
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
||||
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
||||
|
||||
MonitorGetParam monitorGetParam = new MonitorGetParam();
|
||||
monitorGetParam.setTagList(tagIds);
|
||||
monitorGetParam.setMonitorIds(monitorIds);
|
||||
monitorGetParam.setDeptIds(deptAllIds);
|
||||
//TODO 需要校验
|
||||
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
|
||||
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity()));
|
||||
|
||||
List<String> temIds= commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
|
||||
|
||||
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
|
||||
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList());
|
||||
|
||||
//判断指标是否在策略中
|
||||
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){
|
||||
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){
|
||||
List<String> descriptionList = new ArrayList<>();
|
||||
Integer[] count = {0};
|
||||
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count);
|
||||
|
||||
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){
|
||||
//与
|
||||
boolean res = limitBoolMap.containsValue(false);
|
||||
if(res){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
//或
|
||||
boolean res = limitBoolMap.containsValue(true);
|
||||
if(!res){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//到这一步说明符合策略保留该条数据,开始组装实体
|
||||
if(Objects.isNull(thsSupervise)){
|
||||
thsSupervise = new ThsSupervise();
|
||||
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
|
||||
|
||||
thsSuperviseListPO.add(thsSupervise);
|
||||
}
|
||||
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count);
|
||||
|
||||
}
|
||||
allThsLogPO.addAll(thsOverRunLogList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())){
|
||||
if(CollectionUtil.isNotEmpty(thsSuperviseListPO)){
|
||||
this.saveBatch(thsSuperviseListPO);
|
||||
thsOverRunLogService.saveBatch(allThsLogPO);
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
superviceRunLogVo.setOverRunLog(allThsLogPO);
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) {
|
||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
|
||||
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||
|
||||
List<DictData> dictTargetList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
||||
|
||||
|
||||
if (InitTypeEnum.MANUAL.getCode().equals(superviseParam.getInitType()) && StringUtils.isBlank(superviseParam.getDeptId())) {
|
||||
throw new BusinessException(CommonResponseEnum.INVALID_PARAMETER.getMessage());
|
||||
}
|
||||
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
|
||||
//按部门进行分组
|
||||
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
||||
ThsSupervise thsSupervise = null;
|
||||
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
|
||||
if (CollectionUtil.isNotEmpty(oneLevel)) {
|
||||
//遍历当前部门下面的所有策略
|
||||
for (ThsStrategyVo oneStrategyVo : oneLevel) {
|
||||
|
||||
Dept dept = deptFeignClient.getDeptById(oneStrategyVo.getDeptId()).getData();
|
||||
|
||||
|
||||
|
||||
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
||||
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
|
||||
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
|
||||
|
||||
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
||||
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
||||
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
||||
|
||||
MonitorGetParam monitorGetParam = new MonitorGetParam();
|
||||
monitorGetParam.setTagList(tagIds);
|
||||
monitorGetParam.setMonitorIds(monitorIds);
|
||||
|
||||
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(oneStrategyVo.getDeptId()).getData();
|
||||
monitorGetParam.setDeptIds(deptAllIds);
|
||||
//TODO 需要校验
|
||||
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
|
||||
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity()));
|
||||
|
||||
List<String> temIds= commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
|
||||
|
||||
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
|
||||
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList());
|
||||
|
||||
//判断指标是否在策略中
|
||||
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){
|
||||
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){
|
||||
|
||||
List<String> descriptionList = new ArrayList<>();
|
||||
Integer[] count = {0};
|
||||
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count);
|
||||
|
||||
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){
|
||||
//与
|
||||
boolean res = limitBoolMap.containsValue(false);
|
||||
if(res){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
//或
|
||||
boolean res = limitBoolMap.containsValue(true);
|
||||
if(!res){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//到这一步说明符合策略保留该条数据,开始组装实体
|
||||
if(Objects.isNull(thsSupervise)){
|
||||
thsSupervise = new ThsSupervise();
|
||||
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
|
||||
}
|
||||
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
superviceRunLogVo.setOverRunLog(thsOverRunLogList);
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam) {
|
||||
return this.page(new Page<>(thsSuperviseParam.getPageNum(),thsSuperviseParam.getPageSize()),new LambdaQueryWrapper<ThsSupervise>()
|
||||
.between(ThsSupervise::getCreateTime,DateUtil.beginOfDay(DateUtil.parse(thsSuperviseParam.getStartTime())),DateUtil.endOfDay(DateUtil.parse(thsSuperviseParam.getEndTime())))
|
||||
.eq(ThsSupervise::getDeptId,thsSuperviseParam.getDeptId()));
|
||||
}
|
||||
|
||||
public void buildSuperviseData(String yesterday,Dept dept ,SuperviseParam superviseParam,ThsStrategyVo steady,Integer initType, ThsSupervise thsSupervise) {
|
||||
if (thsSupervise != null && StringUtils.isBlank(thsSupervise.getSupIndex())) {
|
||||
thsSupervise.setName(yesterday+dept.getName()+AlarmTypeEnum.getAlarmTypeEnumByCode(superviseParam.getType()).getMessage());
|
||||
thsSupervise.setSupIndex(IdUtil.simpleUUID());
|
||||
thsSupervise.setDeptId(steady.getDeptId());
|
||||
thsSupervise.setCreateTime(new Date());
|
||||
thsSupervise.setType(steady.getType());
|
||||
thsSupervise.setCreateUser(RequestUtil.getUsername());
|
||||
thsSupervise.setProgress(ProgressEnum.START.getCode());
|
||||
thsSupervise.setCreateType(initType);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildOverRunLog(ThsSupervise thsSupervise, CommMonitorInfoDTO monitor,List<String> descriptionList,List<ThsOverRunLog> thsOverRunLogs,Integer[] count) {
|
||||
ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
|
||||
thsOverRunLog.setId(IdUtil.simpleUUID());
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
thsOverRunLog.setLineIndex(monitor.getId());
|
||||
thsOverRunLog.setName(monitor.getPowerStationName() + "_" + monitor.getName() + "_" + DateUtil.today() + "_" + monitor.getId());
|
||||
thsOverRunLog.setUpdateTime(new Date());
|
||||
thsOverRunLog.setCreateTime(new Date());
|
||||
thsOverRunLog.setDescription(StringUtils.join(descriptionList, ","));
|
||||
thsOverRunLog.setCompanyName(monitor.getPowerStationName());
|
||||
thsOverRunLog.setLineIndexName(monitor.getName());
|
||||
thsOverRunLog.setOverTime(count[0]);
|
||||
thsOverRunLogs.add(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
private List<ThsWarnStrategyAss> queryWarnStrategyAss(String warnId, TypeEnum typeEnum) {
|
||||
return thsWarnStrategyAssMapper.selectList(new LambdaQueryWrapper<ThsWarnStrategyAss>()
|
||||
.eq(ThsWarnStrategyAss::getWarnId, warnId)
|
||||
.eq(ThsWarnStrategyAss::getType, typeEnum.getCode()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量下载.zip文件
|
||||
*
|
||||
@@ -548,7 +829,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
private HttpServletResponse dowloadZipFile(FileParam fileParam, Map<String, String> filePathMap, HttpServletRequest request, HttpServletResponse response, TicketTypeEnum ticketTypeEnum) {
|
||||
try {
|
||||
if (CollectionUtil.isNotEmpty(filePathMap)) {
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(fileParam.getIds().get(0));
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(fileParam.getIds().get(0));
|
||||
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsOverRunLog.getSupIndex()).last("limit 1"));
|
||||
//改为自己的名称
|
||||
String fileName = thsSupervise.getName() + ".zip";
|
||||
@@ -563,7 +844,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
// 用于将数据压缩成Zip文件格式
|
||||
ZipOutputStream zos = new ZipOutputStream(csum);
|
||||
for (Map.Entry<String, String> entry : filePathMap.entrySet()) {
|
||||
ThsOverRunLog runLog = thsOverRunLogMapper.selectById(entry.getKey());
|
||||
ThsOverRunLog runLog = thsOverRunLogService.getById(entry.getKey());
|
||||
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
|
||||
pmsMonitorParam.setMonitorIds(Collections.singletonList(runLog.getLineIndex()));
|
||||
HttpResult<List<PmsMonitorDTO>> monitorInfoListByCond = monitorClient.getMonitorInfoListByCond(pmsMonitorParam);
|
||||
@@ -605,96 +886,106 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
/**
|
||||
* 判断监测数据是否超标
|
||||
*
|
||||
* @param limitRate
|
||||
* @param steady
|
||||
* @param rStatLimitRateDPO
|
||||
* @param dictTargetList
|
||||
*/
|
||||
// private Map<String, Object> verifyLimit(LimitRate limitRate, SourceSteadyIndicator steady) {
|
||||
// if (limitRate != null) {
|
||||
// List<String> steadyIndicator = steady.getSteadyIndicator();
|
||||
// Map<String, Object> limitBoolMap = new HashedMap();
|
||||
// List<String> descriptionList = new ArrayList<>();
|
||||
// steadyIndicator.forEach(id -> {
|
||||
// HttpResult<DictData> dicDataById = dicDataFeignClient.getDicDataById(id);
|
||||
// if (CommonResponseEnum.SUCCESS.getCode().equals(dicDataById.getCode()) && dicDataById.getData() != null) {
|
||||
// SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dicDataById.getData().getCode());
|
||||
// if (null != steadyIndicatorEnum) {
|
||||
// switch (steadyIndicatorEnum) {
|
||||
// case Negative_Voltage://负序电压不平衡度
|
||||
// if (limitRate.getUbalanceOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Negative_Voltage.getMessage().concat(limitRate.getUbalanceOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Interhar_Voltage://间谐波电压
|
||||
// Integer interharVoltageOvertime = this.maxOverTime(limitRate, InterharVoltage.class);
|
||||
// if (interharVoltageOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Neg_Current://负序电流
|
||||
// if (limitRate.getINegOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(limitRate.getINegOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Fre_Deviation://频率偏差
|
||||
// if (limitRate.getFreqDevOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(limitRate.getFreqDevOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Voltage_Dev://电压偏差
|
||||
// if (limitRate.getVoltageDevOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(limitRate.getVoltageDevOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Har_Current://谐波电流
|
||||
// Integer harCurrentOvertime = this.maxOverTime(limitRate, HarCurrent.class);
|
||||
// if (harCurrentOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Voltage_Fluc://电压波动与闪变
|
||||
// if (limitRate.getFlickerOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(limitRate.getFlickerOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Har_Voltage://谐波电压
|
||||
// Integer harVoltageOvertime = this.maxOverTime(limitRate, HarVoltage.class);
|
||||
// if (harVoltageOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// limitBoolMap.put(DESCRIPTION, descriptionList);
|
||||
// return limitBoolMap;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
private Map<String, Boolean> verifyLimit(RStatLimitRateDPO rStatLimitRateDPO,List<DictData> dictTargetList,List<String> descriptionList,Integer[] count) {
|
||||
|
||||
|
||||
Map<String, Boolean> limitBoolMap = new HashMap<>();
|
||||
for(DictData dic : dictTargetList){
|
||||
SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode());
|
||||
switch (steadyIndicatorEnum) {
|
||||
case Negative_Voltage://负序电压不平衡度
|
||||
if (rStatLimitRateDPO.getUbalanceOvertime() > 0) {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), true);
|
||||
descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getUbalanceOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Interhar_Voltage://间谐波电压
|
||||
Integer interharVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, InterharVoltage.class);
|
||||
if (interharVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
count[0] = count[0]+interharVoltageOvertime;
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Neg_Current://负序电流
|
||||
if (rStatLimitRateDPO.getINegOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getINegOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Fre_Deviation://频率偏差
|
||||
if (rStatLimitRateDPO.getFreqDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFreqDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Dev://电压偏差
|
||||
if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getVoltageDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Current://谐波电流
|
||||
Integer harCurrentOvertime = this.maxOverTime(rStatLimitRateDPO, HarCurrent.class);
|
||||
if (harCurrentOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
count[0] = count[0]+harCurrentOvertime;
|
||||
|
||||
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Fluc://电压波动与闪变
|
||||
if (rStatLimitRateDPO.getFlickerOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFlickerOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Voltage://谐波电压
|
||||
Integer harVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, HarVoltage.class);
|
||||
if (harVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次"));
|
||||
count[0] = count[0]+harVoltageOvertime;
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Thd_V://畸变
|
||||
if (rStatLimitRateDPO.getUaberranceOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Thd_V.getMessage().concat(rStatLimitRateDPO.getUaberranceOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getUaberranceOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return limitBoolMap;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取越限最大值
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -66,11 +67,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
|
||||
@Override
|
||||
public List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param) {
|
||||
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
|
||||
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
|
||||
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.eq(ThsWarnStrategy::getDeptId,param.getDeptId())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
|
||||
);
|
||||
}
|
||||
@@ -81,16 +83,16 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
List<ThsWarnStrategy> one = this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
.eq(ThsWarnStrategy::getName, param.getName())
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.or(param.getBigType()==0,wrapper ->
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.or(param.getBigType() == 0, wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
)
|
||||
);
|
||||
if (CollectionUtil.isNotEmpty(one)) {
|
||||
if(one.size()>1||one.get(0).getName().equals(param.getName())){
|
||||
if (one.size() > 1 || one.get(0).getName().equals(param.getName())) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
@@ -106,20 +108,37 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean bindStrategy(StrategyParam.BindParam param) {
|
||||
List<ThsWarnStrategyAss> assList = new ArrayList<>();
|
||||
//删除之前绑定信息
|
||||
thsWarnStrategyAssService.removeById(param.getId());
|
||||
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setOperation(param.getOperation());
|
||||
thsWarnStrategy.setName(param.getStrategyName());
|
||||
thsWarnStrategy.setDeptId(param.getDeptId());
|
||||
thsWarnStrategy.setGrade(param.getGrade());
|
||||
thsWarnStrategy.setType(param.getStrategyType());
|
||||
thsWarnStrategy.setState(DataStateEnum.ENABLE.getCode());
|
||||
if (StrUtil.isBlank(param.getId())) {
|
||||
//新增
|
||||
thsWarnStrategy.setId(IdUtil.simpleUUID());
|
||||
this.save(thsWarnStrategy);
|
||||
} else {
|
||||
//修改
|
||||
//删除之前绑定信息
|
||||
thsWarnStrategy.setId(param.getId());
|
||||
thsWarnStrategyAssService.removeById(param.getId());
|
||||
this.updateById(thsWarnStrategy);
|
||||
}
|
||||
//监测点标签绑定
|
||||
add(assList, param.getId(), 0, param.getMonitorTag());
|
||||
if (CollectionUtil.isNotEmpty(param.getMonitorTag())) {
|
||||
add(assList, thsWarnStrategy.getId(), 0, param.getMonitorTag());
|
||||
}
|
||||
//监测点
|
||||
if (CollectionUtil.isNotEmpty(param.getMonitorIds())) {
|
||||
add(assList, thsWarnStrategy.getId(), 2, param.getMonitorIds());
|
||||
}
|
||||
//指标类型绑定
|
||||
add(assList, param.getId(), 1, param.getIndicatorTypes());
|
||||
|
||||
add(assList,thsWarnStrategy.getId(), 1, param.getIndicatorTypes());
|
||||
thsWarnStrategyAssService.saveBatch(assList);
|
||||
ThsWarnStrategy warnStrategy = new ThsWarnStrategy();
|
||||
warnStrategy.setId(param.getId());
|
||||
warnStrategy.setOperation(param.getOperation());
|
||||
return this.updateById(warnStrategy);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,12 +153,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getName, param.getName())
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
)
|
||||
.or(param.getBigType()==0,wrapper ->
|
||||
wrapper.eq( ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.or(param.getBigType() == 0, wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
|
||||
@@ -147,7 +166,7 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
|
||||
);
|
||||
if (CollectionUtil.isNotEmpty(one)) {
|
||||
if(one.size()>1||one.get(0).getName().equals(param.getName())){
|
||||
if (one.size() > 1 || one.get(0).getName().equals(param.getName())) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
@@ -198,16 +217,16 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
thsDeptAlarmService.remove(lambdaQueryWrapper);
|
||||
|
||||
//信息添加
|
||||
List<ThsDeptAlarm> info=new ArrayList();
|
||||
List<String> alarmIds= param.getAlarmId();
|
||||
List<String> monitorIds= param.getMonitorId();
|
||||
String deptId= param.getDeptId();
|
||||
Integer type= param.getType();
|
||||
List<ThsDeptAlarm> info = new ArrayList();
|
||||
List<String> alarmIds = param.getAlarmId();
|
||||
List<String> monitorIds = param.getMonitorId();
|
||||
String deptId = param.getDeptId();
|
||||
Integer type = param.getType();
|
||||
//便利信息
|
||||
ThsDeptAlarm alarm;
|
||||
for (String s : alarmIds) {
|
||||
for (String monitorId : monitorIds) {
|
||||
alarm=new ThsDeptAlarm();
|
||||
alarm = new ThsDeptAlarm();
|
||||
alarm.setDeptId(deptId);
|
||||
alarm.setType(type);
|
||||
alarm.setAlarmId(s);
|
||||
@@ -220,15 +239,15 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public StrategyParam.MonitorTree echoMonitor(String org,Integer type,Integer grade) {
|
||||
public StrategyParam.MonitorTree echoMonitor(String org, Integer type, Integer grade) {
|
||||
List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>()
|
||||
.eq(ThsDeptAlarm::getDeptId, org)
|
||||
.eq(ThsDeptAlarm::getType, type)
|
||||
.eq(ThsDeptAlarm::getGrade, grade)
|
||||
.eq(ThsDeptAlarm::getDeptId, org)
|
||||
.eq(ThsDeptAlarm::getType, type)
|
||||
.eq(ThsDeptAlarm::getGrade, grade)
|
||||
);
|
||||
StrategyParam.MonitorTree tree=new StrategyParam.MonitorTree();
|
||||
StrategyParam.MonitorTree tree = new StrategyParam.MonitorTree();
|
||||
List<String> collect = list.stream().map(ThsDeptAlarm::getAlarmId).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtil.isNotEmpty(collect)){
|
||||
if (CollectionUtil.isNotEmpty(collect)) {
|
||||
tree.setId(collect.get(0));
|
||||
}
|
||||
tree.setChildren(list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList()));
|
||||
@@ -240,13 +259,13 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
public Boolean delStrategy(String ids) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(ids), "id为空,不能删除");
|
||||
ThsWarnStrategy byId = this.getById(ids);
|
||||
if(ObjectUtil.isNull(byId)){
|
||||
if (ObjectUtil.isNull(byId)) {
|
||||
throw new BusinessException(ProcessResponseEnum.QUERY_IS_EMPTY);
|
||||
}
|
||||
if(byId.getState() == 1){
|
||||
if (byId.getState() == 1) {
|
||||
throw new BusinessException(ProcessResponseEnum.ENABLED_CANNOT_BE_DELETED);
|
||||
}
|
||||
// thsWarnStrategyAssService.removeById(ids);
|
||||
thsWarnStrategyAssService.removeById(ids);
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setId(ids);
|
||||
thsWarnStrategy.setState(0);
|
||||
@@ -319,14 +338,14 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
StrategyParam.MonitorTree power = new StrategyParam.MonitorTree();
|
||||
//生成随机数
|
||||
RandomDataGenerator randomDataGenerator = new RandomDataGenerator();
|
||||
power.setId(split[0]+randomDataGenerator.nextInt(1,9));
|
||||
power.setName("变电站名称: "+split[1]);
|
||||
power.setId(split[0] + randomDataGenerator.nextInt(1, 9));
|
||||
power.setName("变电站名称: " + split[1]);
|
||||
//监测点信息
|
||||
List<StrategyParam.Monitor> monitors = new ArrayList();
|
||||
for (PmsMonitorDTO dto : value) {
|
||||
StrategyParam.Monitor childMonitor = new StrategyParam.Monitor();
|
||||
childMonitor.setId(dto.getId());
|
||||
childMonitor.setName("监测点名称: "+dto.getName());
|
||||
childMonitor.setName("监测点名称: " + dto.getName());
|
||||
monitors.add(childMonitor);
|
||||
}
|
||||
power.setChildren(monitors);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.process.utils;
|
||||
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
Reference in New Issue
Block a user