diff --git a/pqs-advance/advance-api/pom.xml b/pqs-advance/advance-api/pom.xml index dcc9f55f9..b1e0f522e 100644 --- a/pqs-advance/advance-api/pom.xml +++ b/pqs-advance/advance-api/pom.xml @@ -70,5 +70,16 @@ cglib 3.3.0 + + + org.ejml + ejml-simple + 0.41 + + + org.apache.commons + commons-math3 + 3.6.1 + diff --git a/pqs-advance/advance-api/src/main/java/com/njcn/advance/enums/AdvanceResponseEnum.java b/pqs-advance/advance-api/src/main/java/com/njcn/advance/enums/AdvanceResponseEnum.java index dd1363d24..6e34eed28 100644 --- a/pqs-advance/advance-api/src/main/java/com/njcn/advance/enums/AdvanceResponseEnum.java +++ b/pqs-advance/advance-api/src/main/java/com/njcn/advance/enums/AdvanceResponseEnum.java @@ -65,6 +65,12 @@ public enum AdvanceResponseEnum { EVENT_DATA_MISS("A0102","没有可供参考的暂降数据"), + WIN_DATA_ERROR("A0102","算法校验窗宽超限"), + + DATA_ERROR("A0102","算法校验数据长度超限"), + + INIT_DATA_ERROR("A0102","算法初始化数据失败"), + USER_HAS_PRODUCT("A0102","当前用户存在生产线"), PRODUCT_HAS_MACHINE("A0102","当前生产线存在设备"), diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/CacheQvvrData.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/CacheQvvrData.java index 4958089da..5d90ea4ad 100644 --- a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/CacheQvvrData.java +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/CacheQvvrData.java @@ -26,9 +26,9 @@ public class CacheQvvrData implements Serializable { private float[] harmData; - private PDataStruct[] FKdata; + private float[][] fKData; - private HKDataStruct[] HKdata; + private float[][] hKData; private List names; diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrDataEntity.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrDataEntity.java new file mode 100644 index 000000000..7fdf73884 --- /dev/null +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrDataEntity.java @@ -0,0 +1,54 @@ +package com.njcn.advance.model.responsibility; + + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class QvvrDataEntity implements Serializable { + + public static final int MAX_P_NODE= 200; //功率节点个数限制,按200个限制 + public static final int MAX_P_NUM= 96 * 100; //功率数据按15分钟间隔,100天处理 + public static final int MAX_HARM_NUM= 1440 * 100; //谐波数据按一分钟间隔,100天处理 + public static final int MAX_WIN_LEN=96 * 10; //按15分钟算10天 + public static final int MIN_WIN_LEN = 4; //按15分钟算1小时 + + + //输入参数 + public int calFlag; //计算标志,0默认用电压和功率数据计算相关系数和责任,1用代入的动态相关系数计算责任 + public int harmNum; //谐波数据个数 + public int pNum; //功率数据个数 + public int pNode; //功率负荷节点数 + public int win; //数据窗大小 + public int resNum; //代入的责任数据个数 + public float harmMk; //谐波电压门槛 + public float harmData[]; //谐波数据序列 + public float [][] pData; //功率数据序列 + public float [][] simData; //动态相关系数数据序列,可作为输入或者输出 + public float [][] fKData; //不包含背景动态谐波责任数据序列,可作为输入或者输出 + public float [][] hKData; //包含背景动态谐波责任数据序列,可作为输入或者输出 + public float [] core; //典则相关系数 + public float [] bjCore; //包含背景典则相关系数 + + //输出结果 + public int calOk; //是否计算正确标志,置位0表示未计算,置位1表示计算完成 + public float [] sumFKdata;//不包含背景谐波责任 + public float [] sumHKdata;//包含背景谐波责任 + + public QvvrDataEntity() { + calFlag = 0; + harmData = new float[MAX_HARM_NUM]; + pData = new float[MAX_P_NUM][MAX_P_NODE]; + simData = new float[MAX_P_NUM][MAX_P_NODE]; + fKData = new float[MAX_P_NUM][MAX_P_NODE]; + hKData = new float[MAX_P_NUM][MAX_P_NODE+1]; + core = new float[MAX_P_NUM]; + bjCore = new float[MAX_P_NUM]; + sumFKdata = new float[MAX_P_NODE]; + sumHKdata = new float[MAX_P_NODE + 1]; + } + + + +} diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrStruct.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrStruct.java index 0225caa1b..bd8a3459d 100644 --- a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrStruct.java +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/model/responsibility/QvvrStruct.java @@ -7,10 +7,10 @@ import java.util.Arrays; import java.util.List; public class QvvrStruct extends HIKSDKStructure implements Serializable { - public static final int MAX_P_NODE= 200; //功率节点个数限制,按200个限制 - public static final int MAX_P_NUM= 96 * 100; //功率数据按15分钟间隔,100天处理 - public static final int MAX_HARM_NUM= 1440 * 100; //谐波数据按一分钟间隔,100天处理 - public static final int MAX_WIN_LEN=96 * 10; //按15分钟算10天 + public static final int MAX_P_NODE = 200; //功率节点个数限制,按200个限制 + public static final int MAX_P_NUM = 96 * 100; //功率数据按15分钟间隔,100天处理 + public static final int MAX_HARM_NUM = 1440 * 100; //谐波数据按一分钟间隔,100天处理 + public static final int MAX_WIN_LEN = 96 * 10; //按15分钟算10天 public static final int MIN_WIN_LEN = 4; //按15分钟算1小时 @@ -193,8 +193,13 @@ public class QvvrStruct extends HIKSDKStructure implements Serializable { this.sim_data = sim_data; } -// @Override -// protected List getFieldOrder() { -// return Arrays.asList(new String[]{"sumFKdata", "sumHKdata"}); -// } + @Override + protected List getFieldOrder() { + return Arrays.asList( + "cal_flag", "harm_num", "p_num", "p_node", "win", + "res_num", "harm_mk", "harm_data", "p_data", "sim_data", + "FKdata", "HKdata", "Core", "BjCore", "cal_ok", + "sumFKdata", + "sumHKdata"); + } } diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/responsibility/impl/RespDataServiceImpl.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/responsibility/impl/RespDataServiceImpl.java index 86d843b3a..b3290f472 100644 --- a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/responsibility/impl/RespDataServiceImpl.java +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/service/responsibility/impl/RespDataServiceImpl.java @@ -18,10 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.advance.enums.AdvanceResponseEnum; import com.njcn.advance.mapper.responsibility.RespDataMapper; -import com.njcn.advance.model.responsibility.CacheQvvrData; -import com.njcn.advance.model.responsibility.HKDataStruct; -import com.njcn.advance.model.responsibility.PDataStruct; -import com.njcn.advance.model.responsibility.QvvrStruct; +import com.njcn.advance.model.responsibility.*; import com.njcn.advance.pojo.bo.responsibility.*; import com.njcn.advance.pojo.dto.responsibility.CustomerData; import com.njcn.advance.pojo.dto.responsibility.CustomerResponsibility; @@ -31,10 +28,10 @@ import com.njcn.advance.pojo.param.ResponsibilityCalculateParam; import com.njcn.advance.pojo.param.ResponsibilitySecondCalParam; import com.njcn.advance.pojo.po.responsibility.RespData; import com.njcn.advance.pojo.po.responsibility.RespDataResult; -import com.njcn.advance.pojo.po.responsibility.RespUserData; import com.njcn.advance.service.responsibility.IRespDataResultService; import com.njcn.advance.service.responsibility.IRespDataService; import com.njcn.advance.service.responsibility.IRespUserDataService; +import com.njcn.advance.utils.ResponsibilityAlgorithm; import com.njcn.advance.utils.ResponsibilityCallDllOrSo; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.exception.BusinessException; @@ -104,7 +101,7 @@ public class RespDataServiceImpl extends ServiceImpl i //没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序 queryWrapper.orderBy(true, false, "pqs_resp_data.create_time"); } - queryWrapper.between("pqs_resp_data.create_time", queryParam.getSearchBeginTime(), queryParam.getSearchEndTime()); + queryWrapper.between("pqs_resp_data.create_time",DateUtil.beginOfDay(DateUtil.parse(queryParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(queryParam.getSearchEndTime()))); } queryWrapper.eq("pqs_resp_data.state", DataStateEnum.ENABLE.getCode()); Page page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper); @@ -185,69 +182,67 @@ public class RespDataServiceImpl extends ServiceImpl i names.add(userName); } //然后开始组装数据 - PDataStruct[] pData = new PDataStruct[QvvrStruct.MAX_P_NUM]; + float[][] pData = new float[QvvrDataEntity.MAX_P_NUM][QvvrDataEntity.MAX_P_NODE]; for (int i = 0; i < names.size(); i++) { //当前某用户测量节点的所有数据 List userDataExcelBodies1 = originalPData.get(names.get(i)); for (int k = 0; k < userDataExcelBodies1.size(); k++) { - PDataStruct pDataStruct = pData[k]; + float[] pDataStruct = pData[k]; if (pDataStruct == null) { - pDataStruct = new PDataStruct(); + pDataStruct = new float[QvvrDataEntity.MAX_P_NODE]; } - float[] p = pDataStruct.getP(); + float[] p = pDataStruct; p[i] = userDataExcelBodies1.get(k).getWork().floatValue(); pData[k] = pDataStruct; } } //至此功率数据也组装完毕,调用友谊提供的接口 - QvvrStruct qvvrStruct = null; - try { - qvvrStruct = new QvvrStruct(); - } catch (Exception exception) { - exception.printStackTrace(); - } - qvvrStruct.cal_flag = 0; - qvvrStruct.p_node = pNode; - qvvrStruct.p_num = pNum; - qvvrStruct.win = win; - qvvrStruct.harm_num = harmNum; - qvvrStruct.harm_mk = harmMk; - qvvrStruct.p_data = pData; - qvvrStruct.harm_data = respHarmData.getHarmData(); - ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response"); - responsibilityCallDllOrSo.setPath(); - ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE; - try { - responsibilityLibrary.harm_response(qvvrStruct); - } catch (Exception exception) { - exception.printStackTrace(); - } + QvvrDataEntity qvvrDataEntity = new QvvrDataEntity(); + qvvrDataEntity.calFlag = 0; + qvvrDataEntity.pNode = pNode; + qvvrDataEntity.pNum = pNum; + qvvrDataEntity.win = win; + qvvrDataEntity.harmNum = harmNum; + qvvrDataEntity.harmMk = harmMk; + qvvrDataEntity.pData = pData; + qvvrDataEntity.harmData = respHarmData.getHarmData(); +// ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response"); +// responsibilityCallDllOrSo.setPath(); +// ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE; +// try { +// responsibilityLibrary.harm_response(qvvrStruct); +// } catch (Exception exception) { +// exception.printStackTrace(); +// } + + ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm(); + qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity); //至此接口调用结束,开始组装动态责任数据和用户责任量化结果 //首先判断cal_ok的标识位是否为1,为0表示程序没有计算出结果 - if (qvvrStruct.cal_ok == 0) { + if (qvvrDataEntity.calOk == 0) { throw new BusinessException(AdvanceResponseEnum.RESPONSIBILITY_PARAMETER_ERROR); } //没问题后,先玩动态责任数据 - CustomerData[] customerDatas = new CustomerData[qvvrStruct.p_node]; - PDataStruct[] fKdata/*无背景的动态责任数据*/ = qvvrStruct.getFKdata(); + CustomerData[] customerDatas = new CustomerData[qvvrDataEntity.pNode]; + float[][] fKdata/*无背景的动态责任数据*/ = qvvrDataEntity.getFKData(); //第一个时间节点是起始时间+win窗口得到的时间 Date sTime = DateUtil.parse(dateStr.get(0).concat(" 00:00:00"), DatePattern.NORM_DATETIME_PATTERN); Calendar calendar = Calendar.getInstance(); calendar.setTime(sTime); calendar.add(Calendar.MINUTE, (win - 1) * userIntervalTime); List timeDatas = new ArrayList<>(); - for (int i = 0; i < qvvrStruct.p_num - qvvrStruct.win; i++) { + for (int i = 0; i < qvvrDataEntity.pNum - qvvrDataEntity.win; i++) { calendar.add(Calendar.MINUTE, userIntervalTime); //一个时间点所有的用户数据 - PDataStruct fKdatum = fKdata[i]; - for (int k = 0; k < qvvrStruct.p_node; k++) { + float[] fKdatum = fKdata[i]; + for (int k = 0; k < qvvrDataEntity.pNode; k++) { CustomerData customerData = customerDatas[k]; if (null == customerData) { customerData = new CustomerData(); customerData.setCustomerName(names.get(k)); } List valueDatas = customerData.getValueDatas(); - Float valueTemp = fKdatum.getP()[k]; + Float valueTemp = fKdatum[k]; if (valueTemp.isNaN()) { valueTemp = 0.0f; } @@ -273,7 +268,7 @@ public class RespDataServiceImpl extends ServiceImpl i customerDataTemp.put(name, customerData); } //动态数据组装完成后,开始组装责任数据 - List customerResponsibilities = getCustomerResponsibilityData(names, qvvrStruct.sumFKdata, qvvrStruct.p_node); + List customerResponsibilities = getCustomerResponsibilityData(names, qvvrDataEntity.sumFKdata, qvvrDataEntity.pNode); //根据前十的用户数据,获取这些用户的动态责任数据 List customerData = new ArrayList<>(); for (CustomerResponsibility customerResponsibility : customerResponsibilities) { @@ -378,9 +373,10 @@ public class RespDataServiceImpl extends ServiceImpl i String customerPath = fileStorageUtil.uploadStream(customerStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json")); respDataResult.setUserDetailData(customerPath); //调用qvvr生成的中间数据 - CacheQvvrData cacheQvvrData = new CacheQvvrData(qvvrStruct.getP_node(), qvvrStruct.getHarm_num(), qvvrStruct.getHarm_data(), qvvrStruct.FKdata, qvvrStruct.HKdata, names, userIntervalTime, qvvrStruct.win, userIntervalTime, respHarmData.getHarmTime()); - JSONObject cacheQvvrDataDataJson = (JSONObject) JSONObject.toJSON(cacheQvvrData); - InputStream cacheQvvrDataStream = IoUtil.toStream(cacheQvvrDataDataJson.toString(), CharsetUtil.UTF_8); + CacheQvvrData cacheQvvrData = new CacheQvvrData(qvvrDataEntity.getPNode(), qvvrDataEntity.getHarmNum(), qvvrDataEntity.getHarmData(), qvvrDataEntity.fKData, qvvrDataEntity.hKData, names, userIntervalTime, qvvrDataEntity.win, userIntervalTime, respHarmData.getHarmTime()); +// JSONObject cacheQvvrDataDataJson = (JSONObject) JSONObject.toJSON(cacheQvvrData); + String cacheJson = PubUtils.obj2json(cacheQvvrData); + InputStream cacheQvvrDataStream = IoUtil.toStream(cacheJson, CharsetUtil.UTF_8); String cacheQvvrDataPath = fileStorageUtil.uploadStream(cacheQvvrDataStream, OssPath.RESPONSIBILITY_USER_RESULT_DATA, FileUtil.generateFileName("json")); respDataResult.setQvvrData(cacheQvvrDataPath); //用户前10数据存储 @@ -422,7 +418,9 @@ public class RespDataServiceImpl extends ServiceImpl i try { InputStream fileStream = fileStorageUtil.getFileStream(respDataResultTemp.getQvvrData()); String qvvrDataStr = IoUtil.read(fileStream, CharsetUtil.UTF_8); - cacheQvvrData = JSONObject.parseObject(qvvrDataStr, CacheQvvrData.class); +// cacheQvvrData = JSONObject.parseObject(qvvrDataStr, CacheQvvrData.class); + cacheQvvrData = PubUtils.json2obj(qvvrDataStr,CacheQvvrData.class); + } catch (Exception exception) { throw new BusinessException(AdvanceResponseEnum.RESP_RESULT_DATA_NOT_FOUND); } @@ -443,25 +441,25 @@ public class RespDataServiceImpl extends ServiceImpl i //间隔中的时间长度 int minus = timeEndIndex - timeStartIndex + 1; //组装参数 - QvvrStruct qvvrStruct = new QvvrStruct(); - qvvrStruct.cal_flag = 1; - qvvrStruct.p_node = cacheQvvrData.getPNode(); - qvvrStruct.harm_mk = responsibilitySecondCalParam.getLimitValue(); - qvvrStruct.win = win; + QvvrDataEntity qvvrDataEntity = new QvvrDataEntity(); + qvvrDataEntity.calFlag = 1; + qvvrDataEntity.pNode = cacheQvvrData.getPNode(); + qvvrDataEntity.harmMk = responsibilitySecondCalParam.getLimitValue(); + qvvrDataEntity.win = win; int resNum; - PDataStruct[] FKdata = new PDataStruct[9600]; - HKDataStruct[] HKdata = new HKDataStruct[9600]; + float[][] FKdata = new float[9600][QvvrDataEntity.MAX_P_NODE]; + float[][] HKdata = new float[9600][QvvrDataEntity.MAX_P_NODE + 1]; float[] harmData = new float[1440 * 100]; - PDataStruct[] fKdataOriginal = cacheQvvrData.getFKdata(); - HKDataStruct[] hKdataOriginal = cacheQvvrData.getHKdata(); + float[][] fKdataOriginal = cacheQvvrData.getFKData(); + float[][] hKdataOriginal = cacheQvvrData.getHKData(); float[] harmDataOriginal = cacheQvvrData.getHarmData(); //如果起始索引与截止索引的差值等于时间轴的长度,则说明用户没有选择限值时间,直接带入全部的原始数据,参与计算即可 if (minus == times.size()) { - qvvrStruct.harm_num = cacheQvvrData.getHarmNum(); - qvvrStruct.res_num = cacheQvvrData.getHarmNum() - cacheQvvrData.getWin(); - qvvrStruct.setFKdata(cacheQvvrData.getFKdata()); - qvvrStruct.setHKdata(cacheQvvrData.getHKdata()); - qvvrStruct.harm_data = cacheQvvrData.getHarmData(); + qvvrDataEntity.harmNum = cacheQvvrData.getHarmNum(); + qvvrDataEntity.resNum = cacheQvvrData.getHarmNum() - cacheQvvrData.getWin(); + qvvrDataEntity.setFKData(cacheQvvrData.getFKData()); + qvvrDataEntity.setHKData(cacheQvvrData.getHKData()); + qvvrDataEntity.harmData = cacheQvvrData.getHarmData(); } else { if (win == 4) { //当窗口为4时,两个时间限制范围在最小公倍数为15时,最起码有5个有效时间点,在最小公倍数为30时,最起码有3个有效时间点 @@ -497,33 +495,39 @@ public class RespDataServiceImpl extends ServiceImpl i } else { throw new BusinessException(AdvanceResponseEnum.CALCULATE_INTERVAL_ERROR); } - qvvrStruct.res_num = resNum; - qvvrStruct.harm_num = minus; + qvvrDataEntity.resNum = resNum; + qvvrDataEntity.harmNum = minus; //因为限值时间实际是含头含尾的,所以harmNum需要索引差值+1 for (int i = timeStartIndex; i <= timeEndIndex; i++) { harmData[i - timeStartIndex] = harmDataOriginal[i]; } - qvvrStruct.harm_data = harmData; + qvvrDataEntity.harmData = harmData; //FKData与HKData的值则等于resNum for (int i = timeStartIndex; i < timeStartIndex + resNum; i++) { FKdata[i - timeStartIndex] = fKdataOriginal[i]; HKdata[i - timeStartIndex] = hKdataOriginal[i]; } - qvvrStruct.setFKdata(FKdata); - qvvrStruct.setHKdata(HKdata); + qvvrDataEntity.setFKData(FKdata); + qvvrDataEntity.setHKData(HKdata); } - ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response"); - responsibilityCallDllOrSo.setPath(); - ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE; - responsibilityLibrary.harm_response(qvvrStruct); - if (qvvrStruct.cal_ok == 0) { +// ResponsibilityCallDllOrSo responsibilityCallDllOrSo = new ResponsibilityCallDllOrSo("harm_response"); +// responsibilityCallDllOrSo.setPath(); +// ResponsibilityCallDllOrSo.ResponsibilityLibrary responsibilityLibrary = ResponsibilityCallDllOrSo.ResponsibilityLibrary.INSTANTCE; +// responsibilityLibrary.harm_response(qvvrStruct); +// if (qvvrStruct.cal_ok == 0) { +// throw new BusinessException(AdvanceResponseEnum.RESPONSIBILITY_PARAMETER_ERROR); +// } + ResponsibilityAlgorithm responsibilityAlgorithm = new ResponsibilityAlgorithm(); + qvvrDataEntity = responsibilityAlgorithm.getResponsibilityResult(qvvrDataEntity); + if (qvvrDataEntity.calOk == 0) { throw new BusinessException(AdvanceResponseEnum.RESPONSIBILITY_PARAMETER_ERROR); } + //没问题后,先玩动态责任数据 List names = cacheQvvrData.getNames(); - CustomerData[] customerDatas = new CustomerData[qvvrStruct.p_node]; - PDataStruct[] fKdata/*无背景的动态责任数据*/ = qvvrStruct.getFKdata(); + CustomerData[] customerDatas = new CustomerData[qvvrDataEntity.pNode]; + float[][] fKdata/*无背景的动态责任数据*/ = qvvrDataEntity.getFKData(); //第一个时间节点是起始时间+win窗口得到的时间 Date sTime = new Date(); sTime.setTime(times.get(timeStartIndex)); @@ -531,18 +535,18 @@ public class RespDataServiceImpl extends ServiceImpl i calendar.setTime(sTime); calendar.add(Calendar.MINUTE, (win - 1) * minMultiple); List timeDatas = new ArrayList<>(); - for (int i = 0; i < qvvrStruct.harm_num - qvvrStruct.win; i++) { + for (int i = 0; i < qvvrDataEntity.harmNum - qvvrDataEntity.win; i++) { calendar.add(Calendar.MINUTE, minMultiple); //一个时间点所有的用户数据 - PDataStruct fKdatum = fKdata[i]; - for (int k = 0; k < qvvrStruct.p_node; k++) { + float[] fKdatum = fKdata[i]; + for (int k = 0; k < qvvrDataEntity.pNode; k++) { CustomerData customerData = customerDatas[k]; if (null == customerData) { customerData = new CustomerData(); customerData.setCustomerName(names.get(k)); } List valueDatas = customerData.getValueDatas(); - Float valueTemp = fKdatum.getP()[k]; + Float valueTemp = fKdatum[k]; if (valueTemp.isNaN()) { valueTemp = 0.0f; } @@ -568,8 +572,8 @@ public class RespDataServiceImpl extends ServiceImpl i customerDataTemp.put(name, customerData); } //调用程序接口后,首先组装责任量化结果 - float[] sumFKdata = qvvrStruct.sumFKdata; - List customerResponsibilities = getCustomerResponsibilityData(names, sumFKdata, qvvrStruct.p_node); + float[] sumFKdata = qvvrDataEntity.sumFKdata; + List customerResponsibilities = getCustomerResponsibilityData(names, sumFKdata, qvvrDataEntity.pNode); //根据前十的用户数据,获取这些用户的动态责任数据 List customerData = new ArrayList<>(); diff --git a/pqs-advance/advance-boot/src/main/java/com/njcn/advance/utils/ResponsibilityAlgorithm.java b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/utils/ResponsibilityAlgorithm.java new file mode 100644 index 000000000..9f7d0d05a --- /dev/null +++ b/pqs-advance/advance-boot/src/main/java/com/njcn/advance/utils/ResponsibilityAlgorithm.java @@ -0,0 +1,765 @@ +package com.njcn.advance.utils; + +import cn.hutool.core.bean.BeanUtil; +import com.njcn.advance.enums.AdvanceResponseEnum; +import com.njcn.advance.model.responsibility.QvvrDataEntity; +import com.njcn.common.pojo.exception.BusinessException; +import org.apache.commons.math3.linear.*; +import org.ejml.data.DMatrixRMaj; +import org.ejml.dense.row.CommonOps_DDRM; +import org.ejml.dense.row.factory.DecompositionFactory_DDRM; +import org.ejml.interfaces.decomposition.EigenDecomposition_F64; +import org.ejml.simple.SimpleMatrix; + +import java.util.Arrays; + +/** + * 责任量化的算法细节: + * 此代码用以计算刻度不等两序列之间的动态相关系数与动态谐波责任指标; + * 随机数生成器生成原始谐波U数据,一维数组长度为LL;生成原始负荷PE数据,二维数组,(行)长度为TL,(列)宽度为P(表示P个负荷公司); + * 只能识别 U数据长度 为PE数据长度的 JIANGE倍,也即无法自动判别时间间隔,需人为定义; + * Width用以控制动态相关系数的计算窗宽; + * 使用库中函数进行矩阵构造与计算; + * 最终的到结果为:向量Core为动态典则相关系数 + * 矩阵simCor为剥离背景后的动态相关系数,其中每列为每一用户负荷 + * 矩阵HKdata为使用simCor计算的动态谐波责任指标,其中每列为每一用户负荷 + * 向量sumHKdata为超限额的谐波时,不同用户的长时谐波责任指标; + * 函数说明:cov(a,b)计算协方差; + * SXX(a,width)计算(行)长度为width序列的方差矩阵; + * SXY(a,b,width)计算长度为width两序列的协方差矩阵; + * TransCancor(Ma,Vb,width)计算长度为width的矩阵a与向量b的典则相关系数; + * SlideCanCor(a,b,width)计算a与b的在 窗宽 width下 的动态典则相关系数; + * SlideCor(a,b,slidecancor,width)计算a,b,在窗宽 width 下 典则相关剥离背景后的动态相关系数。 + * + * 算法很多代码没有注释,这些代码翻译的友谊的C代码,不清楚实际逻辑 + */ +public class ResponsibilityAlgorithm { + + static int P = 21; + static int TL = 671; + static int LL = 3355; + static int JIANGE = 5; + static int wdith = 96; + static float XIANE = 0; + static int RES_NUM = 0; + + static QvvrDataEntity qvvrResult; + + + public QvvrDataEntity getResponsibilityResult(QvvrDataEntity qvvrParam) { + int i, j; + if (qvvrParam != null) { + // 计算责任 + harm_res(qvvrParam.calFlag, qvvrParam); + // 输出结果 + qvvrParam.calOk = qvvrResult.calOk; + if (qvvrParam.calOk == 1) { + // 长时越限谐波责任 + for (i = 0; i < qvvrParam.pNode; i++) + qvvrParam.sumFKdata[i] = qvvrResult.sumFKdata[i]; + for (i = 0; i < (qvvrParam.pNode + 1); i++) + qvvrParam.sumHKdata[i] = qvvrResult.sumHKdata[i]; + // 如果是原始功率数据和谐波数据代入计算,将动态相关系数和动态谐波责任输出 + if (qvvrParam.calFlag == 0) { + qvvrParam.resNum = qvvrResult.resNum; + for (i = 0; i < qvvrResult.resNum; i++) { + qvvrParam.core[i] = qvvrResult.core[i]; + qvvrParam.bjCore[i] = qvvrResult.bjCore[i]; + for (j = 0; j < qvvrParam.pNode; j++) { + qvvrParam.fKData[i][j] = qvvrResult.fKData[i][j]; + qvvrParam.simData[i][j] = qvvrResult.simData[i][j]; + } + for (j = 0; j < (qvvrParam.pNode + 1); j++) + qvvrParam.hKData[i][j] = qvvrResult.hKData[i][j]; + } + } + } + } + return qvvrParam; + } + + + public static int harm_res(int calFlag, QvvrDataEntity qvvrParam) { + if (calFlag == 0) { + harm_res_all(qvvrParam); + } else if (calFlag == 1) { + harm_res_part(qvvrParam); + } + return 0; + } + + static int harm_res_part(QvvrDataEntity qvvrParam) { + int ret = 0; + //缓冲大小初始化 + ret = data_init_part(qvvrParam); + if (ret != 0) { + qvvrResult.calOk = 0; +// System.out.printf("data init err,exit\r\n"); + throw new BusinessException(AdvanceResponseEnum.DATA_ERROR); + } + int colK = P + 1; + RealMatrix HKdata = MatrixUtils.createRealMatrix(RES_NUM, colK); + for (int i = 0; i < P + 1; i++) { + for (int j = 0; j < RES_NUM; j++) { + HKdata.setEntry(j, i, qvvrResult.hKData[j][i]); + } + } + + RealVector Udata = new ArrayRealVector(TL); + for (int j = 0; j < TL; j++) { + Udata.setEntry(j, qvvrResult.harmData[j]); + } + + float[] arrHKsum = SumHK(HKdata, Udata, wdith, colK, TL); + RealVector sumHKdata = new ArrayRealVector(colK); + for (int i = 0; i < colK; i++) { + sumHKdata.setEntry(i, 0); + } + + float sum_hk = 0; + for (int i = 0; i < colK; i++) { + sumHKdata.setEntry(i, arrHKsum[i]); + sum_hk += sumHKdata.getEntry(i); + qvvrResult.sumHKdata[i] = (float) sumHKdata.getEntry(i); + } + + RealMatrix FKdata = MatrixUtils.createRealMatrix(RES_NUM, P); + for (int i = 0; i < P; i++) { + for (int j = 0; j < RES_NUM; j++) { + FKdata.setEntry(j, i, qvvrResult.fKData[j][i]); + } + } + + colK = P; + arrHKsum = SumHK(FKdata, Udata, wdith, colK, TL); + RealVector sumFKdata = new ArrayRealVector(colK); + for (int i = 0; i < colK; i++) { + sumFKdata.setEntry(i, 0); + } + + float sum_fk = 0; + for (int i = 0; i < colK; i++) { + sumFKdata.setEntry(i, arrHKsum[i]); + sum_fk += sumFKdata.getEntry(i); + qvvrResult.sumFKdata[i] = (float) sumFKdata.getEntry(i); + } + + qvvrResult.calOk = 1; + return 0; + } + + static int data_init_part(QvvrDataEntity qvvrParam) { + qvvrResult = new QvvrDataEntity(); + //输入数据处理 + BeanUtil.copyProperties(qvvrParam, qvvrResult); +// if ((qvvrResult.resNum + qvvrResult.win) != qvvrResult.harmNum) { +// System.out.printf("数据未对齐...\r\n"); +// return -1; +// } + RES_NUM = qvvrResult.resNum; + P = qvvrResult.pNode; + TL = qvvrResult.win + qvvrResult.resNum; + wdith = qvvrResult.win; + XIANE = qvvrResult.harmMk; + + if ((wdith < QvvrDataEntity.MIN_WIN_LEN) || (wdith > QvvrDataEntity.MAX_WIN_LEN)) { + System.out.printf("窗宽超限...\r\n"); + throw new BusinessException(AdvanceResponseEnum.WIN_DATA_ERROR); + } + + if ((P > QvvrDataEntity.MAX_P_NODE) || (TL > QvvrDataEntity.MAX_P_NUM)) { + System.out.printf("数据长度超限...\r\n"); + throw new BusinessException(AdvanceResponseEnum.DATA_ERROR); + } + for (int i = 0; i < RES_NUM; i++) { + for (int j = 0; j < P; j++) { + qvvrResult.fKData[i][j] = qvvrParam.fKData[i][j]; + } + for (int j = 0; j < P + 1; j++) { + qvvrResult.hKData[i][j] = qvvrParam.hKData[i][j]; + } + } + + // 复制 qvvrParam + for (int i = 0; i < TL; i++) { + qvvrResult.harmData[i] = qvvrParam.harmData[i]; + } + return 0; + } + + static int harm_res_all(QvvrDataEntity qvvrParam) { + int ret = 0; + //缓冲大小初始化 + ret = data_init_all(qvvrParam); + if (ret != 0) { + qvvrResult.calOk = 0; + System.out.printf("data init err,exit\r\n"); + throw new BusinessException(AdvanceResponseEnum.INIT_DATA_ERROR); + } + //测试数据申请空间 + float[][] a = new float[TL][]; + for (int i = 0; i < TL; i++) { + a[i] = new float[P]; + } + + float[] b = new float[LL]; + float[] u = new float[TL]; + + for (int i = 0; i < TL; i++) { + for (int j = 0; j < P; j++) { + a[i][j] = qvvrResult.pData[i][j]; + } + } + for (int i = 0; i < LL; i++) { + b[i] = qvvrResult.harmData[i]; + } + + for (int i = 0; i < LL; i += JIANGE) { + float tempt = 0.0f; + for (int j = 0; j < JIANGE; j++) { + tempt += b[i + j]; + } + b[i] = tempt / JIANGE; + } + int width = wdith; + int slcorlength = TL - width; + + //剥离背景谐波后的动态相关系数计算 + //数据格式转换 + // 创建矩阵Pdata并复制数据 + double[][] PdataArray = new double[TL][P]; + for (int i = 0; i < TL; i++) { + for (int j = 0; j < P; j++) { + PdataArray[i][j] = a[i][j]; + } + } + RealMatrix Pdata = new Array2DRowRealMatrix(PdataArray); + // 创建向量Udata并复制数据 + double[] UdataArray = new double[TL]; + for (int i = 0; i < TL; i++) { + UdataArray[i] = b[i * JIANGE]; + } + RealVector Udata = new ArrayRealVector(UdataArray); + for (int i = 0; i < TL; i++) { + u[i] = (float) UdataArray[i]; + } + + //动态典则相关系数数组获得 并转化为向量 + + float[] cancorrelation = SlideCanCor(a, u, width, P, TL); + + RealVector Core = new ArrayRealVector(slcorlength); + RealVector bjCore = new ArrayRealVector(slcorlength); + for (int i = 0; i < slcorlength; i++) { + Core.setEntry(i, cancorrelation[i]); + qvvrResult.core[i] = (float) Core.getEntry(i); + } + for (int i = 0; i < slcorlength; i++) { + bjCore.setEntry(i, 1 - cancorrelation[i]); + qvvrResult.bjCore[i] = (float) bjCore.getEntry(i); + } + + float[] y = new float[TL]; + float[] xe = new float[TL]; + float[] slidecor; + RealVector temptPe = new ArrayRealVector(TL); + RealVector temptU = new ArrayRealVector(TL); + RealMatrix simCor = new Array2DRowRealMatrix(slcorlength, P); + + // 格式转换 + temptU = Udata.getSubVector(0, TL); + for (int m = 0; m < TL; m++) { + y[m] = (float) temptU.getEntry(m); + } + // 格式转换、计算系数、格式转换 + for (int i = 0; i < P; i++) { + temptPe = Pdata.getColumnVector(i); + for (int m = 0; m < TL; m++) { + xe[m] = (float) temptPe.getEntry(m); + } + slidecor = slideCor(xe, y, cancorrelation, width, TL); // 计算每个用户负荷与用户谐波的动态相关系数 + + for (int j = 0; j < slcorlength; j++) { + simCor.setEntry(j, i, slidecor[j]); + qvvrResult.simData[j][i] = (float) simCor.getEntry(j, i); + } + } + + //动态谐波责任指标计算 + //EK计算,用于后续计算FK(不含背景的用户责任指标)、HK(包含背景的用户责任指标) + //float **EKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 + //for (int i = 0; i < TL; i++) + //EKarr[i] = (float *)malloc(TL * sizeof(float)); + + float[][] EKarr; + EKarr = dyEKCom(simCor, Pdata, width, P, TL); + RealMatrix EKdata = MatrixUtils.createRealMatrix(slcorlength, P); + for (int i = 0; i < slcorlength; i++) { + for (int j = 0; j < P; j++) { + EKdata.setEntry(i, j, EKarr[i][j]); + } + } + + //不含背景的用户谐波责任指标 + //float **FKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 + //for (int i = 0; i < TL; i++) + //FKarr[i] = (float *)malloc(TL * sizeof(float)); + float[][] FKarr; + FKarr = DyFKCom(EKdata, width, P, TL); + RealMatrix FKdata = MatrixUtils.createRealMatrix(slcorlength, P); + for (int i = 0; i < slcorlength; i++) { + for (int j = 0; j < P; j++) { + FKdata.setEntry(i, j, FKarr[i][j]); + } + } + qvvrResult.fKData=FKarr; + //包含背景的谐波责任指标 + //float **HKarr = (float **)malloc(TL * sizeof(float *));//先申请P个指针型字节的空间 + //for (int i = 0; i < TL; i++) + //HKarr[i] = (float *)malloc(TL * sizeof(float)); + float[][] HKarr; + HKarr = DyHKCom(bjCore, EKdata, width, P, TL); + RealMatrix HKdata = MatrixUtils.createRealMatrix(slcorlength, (P + 1)); + for (int i = 0; i < slcorlength; i++) { + for (int j = 0; j < (P + 1); j++) { + HKdata.setEntry(i, j, HKarr[i][j]); + qvvrResult.hKData[i][j] = (float) HKdata.getEntry(i, j); + } + } + qvvrResult.resNum = slcorlength; + + + //超限额长时谐波责任指标计算 + float[] arrHKsum = new float[TL]; + int colK = P + 1;//FKdata时为P + arrHKsum = SumHK(HKdata, Udata, width, colK, TL);//可更改FKdata,表示为不包含背景时的长时责任划分 + RealVector sumHKdata = new ArrayRealVector(colK); + for (int i = 0; i < colK; i++) { + sumHKdata.setEntry(i, 0); + } + + float sum_hk = 0; + for (int i = 0; i < colK; i++) { + sumHKdata.setEntry(i, arrHKsum[i]); + sum_hk += sumHKdata.getEntry(i); + qvvrResult.sumHKdata[i] = (float) sumHKdata.getEntry(i); + } + + colK = P;//FKdata时为P + arrHKsum = SumHK(FKdata, Udata, width, colK, TL);//可更改FKdata,表示为不包含背景时的长时责任划分 + RealVector sumFKdata = new ArrayRealVector(colK); + + for (int i = 0; i < colK; i++) { + sumFKdata.setEntry(i, 0); + } + float sum_fk = 0; + for (int i = 0; i < colK; i++) { + sumFKdata.setEntry(i, arrHKsum[i]); + sum_fk += sumFKdata.getEntry(i); + qvvrResult.sumFKdata[i] = (float) sumHKdata.getEntry(i); + } + //结果输出 + qvvrResult.calOk = 1; + return 0; + } + + + + static int data_init_all(QvvrDataEntity qvvrParam) { + qvvrResult = new QvvrDataEntity(); + //输入数据处理 + BeanUtil.copyProperties(qvvrParam, qvvrResult); + P = qvvrResult.pNode; + TL = qvvrResult.pNum; + LL = qvvrResult.harmNum; + JIANGE = qvvrResult.harmNum / qvvrResult.pNum; + wdith = qvvrResult.win; + XIANE = qvvrResult.harmMk; + + if ((JIANGE * TL != LL) || (JIANGE < 1)) { + return -1; + } + if ((wdith < QvvrDataEntity.MIN_WIN_LEN) || (wdith > QvvrDataEntity.MAX_WIN_LEN)) { +// System.out.printf("窗宽超限...\r\n"); + throw new BusinessException(AdvanceResponseEnum.EVENT_DATA_MISS); + } +// if (TL < (2 * wdith)) { +// System.out.printf("窗宽和数据长度不匹配...\r\n"); +// return -1; +// } + + if ((P > QvvrDataEntity.MAX_P_NODE) || (TL > QvvrDataEntity.MAX_P_NUM) || (LL > QvvrDataEntity.MAX_HARM_NUM)) { + System.out.printf("数据长度超限...\r\n"); + throw new BusinessException(AdvanceResponseEnum.EVENT_DATA_MISS); + } + + + float[][] clone = new float[qvvrParam.getPData().length][]; + for (int i = 0; i < qvvrParam.getPData().length; i++) { + clone[i] = Arrays.copyOf(qvvrParam.getPData()[i], qvvrParam.getPData()[i].length); + } + qvvrResult.setPData(clone); + + + for (int i = 0; i < LL; i++) { + qvvrResult.getHarmData()[i] = qvvrParam.getHarmData()[i]; + } + //System.out.printf("win = %d\r\n",wdith); + return 0; + } + + + public static float[] SlideCanCor(float[][] x, float[] y, int width, int p_num, int tl_num) { + int slcorlength = tl_num - width; + float[][] a = new float[width][p_num]; + for (int i = 0; i < width; i++) { + a[i] = new float[p_num]; + } + float[] b = new float[width]; + + float[][] sxxmatrix = new float[p_num][p_num]; + for (int i = 0; i < p_num; i++) { + sxxmatrix[i] = new float[p_num]; + } + float[] sxymatrix = new float[tl_num]; + float[] x1 = new float[tl_num]; + float[] x2 = new float[tl_num]; + float[] x3 = new float[tl_num]; + float[][] xx = new float[width][p_num]; + for (int i = 0; i < width; i++) { + xx[i] = new float[p_num]; + } + float[] yy = new float[width]; + + RealMatrix Pdata = new Array2DRowRealMatrix(tl_num, p_num); + RealVector Udata = new ArrayRealVector(tl_num); + for (int i = 0; i < tl_num; i++) { + for (int j = 0; j < p_num; j++) { + Pdata.setEntry(i, j, x[i][j]); + } + Udata.setEntry(i, y[i]); + } + + RealMatrix temptP = new Array2DRowRealMatrix(width, p_num); + RealVector temptU = new ArrayRealVector(width); + float[] slideCancor = new float[tl_num]; + for (int i = 0; i < slcorlength; i++) { + temptU = Udata.getSubVector(i, width); + temptP = Pdata.getSubMatrix(i, i + width - 1, 0, p_num - 1); + slideCancor[i] = TransCancor(temptP, temptU, width, p_num, tl_num, sxxmatrix, sxymatrix, x1, x2, x3, xx, yy); + } + + return slideCancor; + } + + + public static float TransCancor(RealMatrix a, RealVector b, int width, int p_num, int tl_num, + float[][] sxxMatrix, float[] sxyMatrix, float[] x1, float[] x2, + float[] x3, float[][] x, float[] y) { + float syymatrix; + for (int i = 0; i < width; i++) { + for (int j = 0; j < p_num; j++) { + x[i][j] = (float) a.getEntry(i, j); + } + y[i] = (float) b.getEntry(i); + } + // 假设的SXX函数,需要根据实际实现来调整 + sxxMatrix = SXX(x, width, p_num, tl_num, sxxMatrix, x1, x2); + syymatrix = cov(y, y, width); // 假设的COV函数,需要根据实际实现来调整 + if (syymatrix == 0) { + syymatrix = 0.00001F; + } + // 假设的SXY函数,需要根据实际实现来调整 + sxyMatrix = SXY(x, y, width, p_num, tl_num, sxyMatrix, x3); + +// +// RealMatrix A = MatrixUtils.createRealMatrix(p_num, p_num); +// RealMatrix invSXX = MatrixUtils.createRealMatrix(p_num, p_num); +// RealMatrix I = MatrixUtils.createRealIdentityMatrix(p_num); // I is an identity matrix +// +// // 二维数组转为矩阵 +// for (int i = 0; i < p_num; i++) { +// for (int j = 0; j < p_num; j++) { +// A.setEntry(i, j, sxxMatrix[i][j]); +// } +// } +// +// // 使用 LU 分解方法计算矩阵 invSXX +// invSXX = new LUDecomposition(A).getSolver().solve(I); + + // 创建 p_num × p_num 的矩阵 A + SimpleMatrix A = new SimpleMatrix(p_num, p_num); + + // 创建 p_num × p_num 的逆矩阵 invSXX + SimpleMatrix invSXX = new SimpleMatrix(p_num, p_num); + + // 创建 p_num × p_num 的单位矩阵 I + SimpleMatrix I = SimpleMatrix.identity(p_num); + + // 二维数组转为矩阵 A + for (int i = 0; i < p_num; i++) { + for (int j = 0; j < p_num; j++) { + A.set(i, j, sxxMatrix[i][j]); + } + } + + // 使用 LU 分解方法计算矩阵 invSXX + invSXX = A.invert().mult(I); + + // 创建长度为 p_num 的向量 sXYMa_Eigen + DMatrixRMaj sXYMa_Eigen = new DMatrixRMaj(p_num, 1); + for (int i = 0; i < p_num; i++) { + sXYMa_Eigen.set(i, 0, sxyMatrix[i]); + } + + // 计算 Umatrix + DMatrixRMaj Umatrix = new DMatrixRMaj(p_num, p_num); + CommonOps_DDRM.multOuter(sXYMa_Eigen, Umatrix); // 外积 + CommonOps_DDRM.divide(Umatrix, syymatrix); // 矩阵按标量除法 + CommonOps_DDRM.divide(Umatrix, syymatrix); // 再次按标量除法 + + // 计算特征值 + EigenDecomposition_F64 eigenDecomposition = DecompositionFactory_DDRM.eig(p_num, false); + eigenDecomposition.decompose(Umatrix); + + float corrMax = 0; + for (int i = 0; i < p_num; i++) { + float absCorr = (float) Math.abs(eigenDecomposition.getEigenvalue(i).getReal()); + if (absCorr > corrMax) { + corrMax = absCorr; + } + } + + float cancor = (float) Math.sqrt(corrMax); + if (cancor >= 1) { + cancor = 1; + } + + return cancor; + } + + + public static float[][] SXX(float[][] x, int width, int p_num, int tl_num, float[][] sxxmatrix, float[] x1, float[] x2) { + int i, j, m; + for (i = 0; i < p_num; i++) { + for (j = 0; j < p_num; j++) { + for (m = 0; m < width; m++) { + x1[m] = x[m][i]; + x2[m] = x[m][j]; + } + sxxmatrix[i][j] = cov(x1, x2, width); + } + } + return sxxmatrix; + } + + public static float[] SXY(float[][] x, float[] y, int width, int p_num, int tl_num, float[] sxymatrix, float[] x1) { + int i, m; + for (i = 0; i < p_num; i++) { + for (m = 0; m < width; m++) { + x1[m] = x[m][i]; + } + sxymatrix[i] = cov(x1, y, width); + } + return sxymatrix; + } + + public static float cov(float[] x, float[] y, int width) { + float d1, d2, d3, d4; + float mx, my; + float cov; + int i; + int xlength = width; + int ylength = width; + d1 = d2 = d3 = d4 = mx = my = 0.0f; + for (i = 0; i < xlength; i++) { + mx += x[i]; + my += y[i]; + } + mx = mx / xlength; + my = my / ylength; + for (i = 0; i < xlength; i++) { + d1 += (x[i] - mx) * (y[i] - my); + } + cov = d1 / (xlength - 1); + return cov; + } + + public static float[] slideCor(float[] x, float[] y, float[] slidecor, int width, int tlNum) { + int slcorLength = tlNum - width; + float[] slcor = new float[tlNum]; // 注意调整数组大小根据实际需要 + + // 动态相关系数 + for (int i = 0; i < slcorLength; i++) { + float[] temptp = new float[width]; + float[] temptq = new float[width]; + for (int j = 0; j < width; j++) { + temptp[j] = x[i + j]; + temptq[j] = y[i + j] * slidecor[i]; + } + slcor[i] = pearCor(temptq, temptp, width); + } + + return slcor; + } + + public static float pearCor(float[] x, float[] y, int count) { + float d1 = 0, d2 = 0, d3 = 0, d4 = 0; + float mx = 0, my = 0; + float result = 0; + + // 计算x和y的平均值 + for (int i = 0; i < count; i++) { + mx += x[i]; + my += y[i]; + } + mx /= count; + my /= count; + + // 计算相关系数的数据组成部分 + for (int i = 0; i < count; i++) { + d1 += (x[i] - mx) * (y[i] - my); + d2 += (x[i] - mx) * (x[i] - mx); + d3 += (y[i] - my) * (y[i] - my); + } + d4 = (float) Math.sqrt(d2 * d3); + + if (d4 == 0) { + // 除数为0时,相关系数为0 + result = 0; + } else { + result = d1 / d4; + } + + return result; + } + + private static float[][] dyEKCom(RealMatrix Dydata, RealMatrix Pdata, int width, int p_num, int tl_num) { + int slg = tl_num - width; + RealMatrix AKdata = MatrixUtils.createRealMatrix(slg, p_num); + RealMatrix SumP = MatrixUtils.createRealMatrix(slg, 1); + RealMatrix EKdata = MatrixUtils.createRealMatrix(slg, p_num); + + for (int i = 0; i < slg; i++) { + SumP.setEntry(i, 0, 0); + for (int j = 0; j < p_num; j++) { + float sumPValue = (float) (SumP.getEntry(i, 0) + Pdata.getEntry(i, j)); + SumP.setEntry(i, 0, sumPValue); + } + for (int j = 0; j < p_num; j++) { + float AKdataValue = (float) (Dydata.getEntry(i, j) * (Pdata.getEntry(i, j) / SumP.getEntry(i, 0))); + AKdata.setEntry(i, j, AKdataValue); + } + } + for (int i = 0; i < slg; i++) { + float maxdata = Float.MIN_VALUE; + float mindata = Float.MAX_VALUE; + for (int j = 0; j < p_num; j++) { + maxdata = Math.max(maxdata, (float) AKdata.getEntry(i, j)); + mindata = Math.min(mindata, (float) AKdata.getEntry(i, j)); + } + for (int j = 0; j < p_num; j++) { + EKdata.setEntry(i, j, (AKdata.getEntry(i, j) - mindata) / (maxdata - mindata)); + } + } + + float[][] arrEK = new float[slg][p_num]; + for (int i = 0; i < slg; i++) { + for (int j = 0; j < p_num; j++) { + arrEK[i][j] = (float) EKdata.getEntry(i, j); + } + } + return arrEK; + } + + private static float[][] DyFKCom(RealMatrix EKdata, int width, int p_num, int tl_num) { + int slg = tl_num - width; + RealMatrix FKdata = MatrixUtils.createRealMatrix(slg, p_num); + ArrayRealVector SumEK = new ArrayRealVector(slg); + + for (int i = 0; i < slg; i++) { + SumEK.setEntry(i, 0); + for (int j = 0; j < p_num; j++) { + float sumEKValue = (float) (SumEK.getEntry(i) + EKdata.getEntry(i, j)); + SumEK.setEntry(i, sumEKValue); + } + for (int j = 0; j < p_num; j++) { + float FKdataValue = (float) (EKdata.getEntry(i, j) / SumEK.getEntry(i)); + FKdata.setEntry(i, j, FKdataValue); + } + } + + float[][] arrFK = new float[tl_num][p_num]; + for (int i = 0; i < slg; i++) { + for (int j = 0; j < p_num; j++) { + arrFK[i][j] = (float) FKdata.getEntry(i, j); + } + } + return arrFK; + } + + private static float[][] DyHKCom(RealVector cancordata, RealMatrix EKdata, int width, int p_num, int tl_num) { + int slg = tl_num - width; + RealMatrix HKdata = MatrixUtils.createRealMatrix(slg, p_num + 1); + RealMatrix newEK = MatrixUtils.createRealMatrix(slg, p_num + 1); + ArrayRealVector SumEK = new ArrayRealVector(slg); + + for (int i = 0; i < slg; i++) { + for (int j = 0; j < p_num; j++) { + newEK.setEntry(i, j, EKdata.getEntry(i, j)); + } + newEK.setEntry(i, p_num, cancordata.getEntry(i)); + } + + for (int i = 0; i < slg; i++) { + SumEK.setEntry(i, 0); + for (int j = 0; j < p_num + 1; j++) { + float sumEKValue = (float) (SumEK.getEntry(i) + newEK.getEntry(i, j)); + SumEK.setEntry(i, sumEKValue); + } + for (int j = 0; j < p_num + 1; j++) { + float HKdataValue = (float) (newEK.getEntry(i, j) / SumEK.getEntry(i)); + HKdata.setEntry(i, j, HKdataValue); + } + } + + float[][] arrHK = new float[tl_num][p_num + 1]; + for (int i = 0; i < slg; i++) { + for (int j = 0; j < p_num + 1; j++) { + arrHK[i][j] = (float) HKdata.getEntry(i, j); + } + } + return arrHK; + } + + private static float[] SumHK(RealMatrix HKdata, RealVector Udata, int width, int colK, int tl_num) { + int P1 = colK; + RealVector HKSum = new ArrayRealVector(P1); + int slg = tl_num - width; + int coutt = 0; + + for (int j = 0; j < P1; j++) { + HKSum.setEntry(j, 0); + coutt = 0; + for (int i = 0; i < slg; i++) { + if (Udata.getEntry(i) > XIANE) { + float HKdataEntry = (float) HKdata.getEntry(i, j); + HKSum.setEntry(j, HKSum.getEntry(j) + HKdataEntry); + coutt++; + } + } + } + + float[] arrHKsum = new float[P1]; + for (int i = 0; i < P1; i++) { + arrHKsum[i] = 0; + } + for (int i = 0; i < P1; i++) { + if (coutt > 0) { + arrHKsum[i] = (float) (100 * (HKSum.getEntry(i) / coutt)); + } + } + return arrHKsum; + } + +} diff --git a/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/pojo/param/BpmFormParam.java b/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/pojo/param/BpmFormParam.java index 54581548a..22e5b61a9 100644 --- a/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/pojo/param/BpmFormParam.java +++ b/pqs-bpm/bpm-api/src/main/java/com/njcn/bpm/pojo/param/BpmFormParam.java @@ -27,7 +27,7 @@ public class BpmFormParam implements Serializable { * 状态 */ @ApiModelProperty("表单状态") - @NotBlank(message = "表单状态不能为空") +// @NotBlank(message = "表单状态不能为空") private Integer status; /** @@ -42,7 +42,7 @@ public class BpmFormParam implements Serializable { * */ @ApiModelProperty("表单项的数组-JSON 字符串的数组") - @NotBlank(message = "表单项的数组不能为空") +// @NotBlank(message = "表单项的数组不能为空") private List fields; /** diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmModelController.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmModelController.java index e5ce65829..779276bcf 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmModelController.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmModelController.java @@ -98,7 +98,7 @@ public class BpmModelController extends BaseController { } @GetMapping("/getById") - @Operation(summary = "获得模型") + @ApiOperation("根据id获取模型") @OperateInfo(info = LogEnum.BUSINESS_COMMON) @Parameter(name = "id", description = "编号", required = true) public HttpResult getById(String id) { @@ -111,7 +111,6 @@ public class BpmModelController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, BpmModelConvert.INSTANCE.buildModel(model, bpmnBytes), methodDescribe); } - @Operation(summary = "新建模型") @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) @PostMapping("/add") @ApiOperation("新建模型") @@ -146,7 +145,7 @@ public class BpmModelController extends BaseController { @PostMapping("/deploy") - @Operation(summary = "部署模型") + @ApiOperation("部署模型") @Parameter(name = "id", description = "编号", required = true) public HttpResult deployModel(String id) { String methodDescribe = getMethodDescribe("deployModel"); @@ -164,7 +163,7 @@ public class BpmModelController extends BaseController { // } // @GetMapping("/delete") - @Operation(summary = "删除模型") + @ApiOperation("删除模型") @Parameter(name = "id", description = "编号", required = true, example = "1024") public HttpResult deleteModel(String id) { String methodDescribe = getMethodDescribe("deleteModel"); diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmProcessInstanceController.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmProcessInstanceController.java index 0a71f1c9d..bcba69d74 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmProcessInstanceController.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/controller/BpmProcessInstanceController.java @@ -33,6 +33,7 @@ import com.njcn.web.factory.PageFactory; import com.njcn.web.utils.RequestUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import lombok.RequiredArgsConstructor; @@ -202,4 +203,14 @@ public class BpmProcessInstanceController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, instanceId, methodDescribe); } + + @ApiOperation(value = "删除流程实例(会删除已经审核的流程慎用)") + @GetMapping(value = "/deleteInstance") + public HttpResult delete(@ApiParam(value = "流程实例ID", required = true) @RequestParam String instanceIds) { + String methodDescribe = getMethodDescribe("delete"); + processInstanceService.delete(instanceIds,"测试删除"); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); + + } + } diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineDebugStatusListener.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineDebugStatusListener.java new file mode 100644 index 000000000..d5e757c8f --- /dev/null +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineDebugStatusListener.java @@ -0,0 +1,27 @@ +package com.njcn.bpm.listener.business; + +import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent; +import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener; +import com.njcn.supervision.api.TempLineDebugFeignClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + + +@Component +public class BpmTempLineDebugStatusListener extends BpmProcessInstanceStatusEventListener { + + @Resource + private TempLineDebugFeignClient tempLineDebugFeignClient; + + @Override + protected String getProcessDefinitionKey() { + return "temp_line_debug"; + } + + @Override + protected void onEvent(BpmProcessInstanceStatusEvent event) { + tempLineDebugFeignClient.updateStatus(event.getBusinessKey(), event.getStatus()); + } + +} diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineStatusListener.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineStatusListener.java index f913516af..f46aed92c 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineStatusListener.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmTempLineStatusListener.java @@ -16,7 +16,7 @@ public class BpmTempLineStatusListener extends BpmProcessInstanceStatusEventList @Override protected String getProcessDefinitionKey() { - return "temp_line_info_add"; + return "line_info_add"; } @Override diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalStatusListener.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalStatusListener.java new file mode 100644 index 000000000..7ca16c39b --- /dev/null +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalStatusListener.java @@ -0,0 +1,28 @@ +package com.njcn.bpm.listener.business; + +import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent; +import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener; +import com.njcn.supervision.api.UserReportFeignClient; +import com.njcn.supervision.api.UserReportNormalFeignClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + + +@Component +public class BpmUserReportNormalStatusListener extends BpmProcessInstanceStatusEventListener { + + @Resource + private UserReportNormalFeignClient userReportNormalFeignClient; + + @Override + protected String getProcessDefinitionKey() { + return "user_go_net"; + } + + @Override + protected void onEvent(BpmProcessInstanceStatusEvent event) { + userReportNormalFeignClient.updateUserReportNormalStatus(event.getBusinessKey(), event.getStatus()); + } + +} diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalTreatStatusListener.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalTreatStatusListener.java new file mode 100644 index 000000000..2179bce18 --- /dev/null +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/listener/business/BpmUserReportNormalTreatStatusListener.java @@ -0,0 +1,27 @@ +package com.njcn.bpm.listener.business; + +import com.njcn.bpm.listener.BpmProcessInstanceStatusEvent; +import com.njcn.bpm.listener.BpmProcessInstanceStatusEventListener; +import com.njcn.supervision.api.UserReportNormalFeignClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + + +@Component +public class BpmUserReportNormalTreatStatusListener extends BpmProcessInstanceStatusEventListener { + + @Resource + private UserReportNormalFeignClient userReportNormalFeignClient; + + @Override + protected String getProcessDefinitionKey() { + return "user_treat_check"; + } + + @Override + protected void onEvent(BpmProcessInstanceStatusEvent event) { + userReportNormalFeignClient.updateUserReportNormalStatus(event.getBusinessKey(), event.getStatus()); + } + +} diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/IBpmProcessInstanceService.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/IBpmProcessInstanceService.java index 41b5cd5fb..4736dbb7f 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/IBpmProcessInstanceService.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/IBpmProcessInstanceService.java @@ -146,4 +146,11 @@ public interface IBpmProcessInstanceService { */ void updateProcessInstanceReject(String id, String reason); + /** + * 用于测试过程删除流程,正式环境慎用 + * @author cdf + * @date 2024/5/20 + */ + void delete(String id, String reason); + } diff --git a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java index 445556135..b6f6d5513 100644 --- a/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java +++ b/pqs-bpm/bpm-boot/src/main/java/com/njcn/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java @@ -316,8 +316,35 @@ public class BpmProcessInstanceServiceImpl implements IBpmProcessInstanceService BpmProcessInstanceConvert.INSTANCE.buildProcessInstanceStatusEvent(this, processInstance, BpmProcessInstanceStatusEnum.REJECT.getStatus())); } - private void deleteProcessInstance(String id, String reason) { + public void deleteProcessInstance(String id, String reason) { runtimeService.deleteProcessInstance(id, reason); } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String instanceId, String deleteReason) { + + // 查询历史数据 + HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(instanceId); + if (historicProcessInstance.getEndTime() != null) { + historyService.deleteHistoricProcessInstance(historicProcessInstance.getId()); + return; + } + // 删除流程实例 + runtimeService.deleteProcessInstance(instanceId, deleteReason); + // 删除历史流程实例 + historyService.deleteHistoricProcessInstance(instanceId); + } + + + public HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId) { + HistoricProcessInstance historicProcessInstance = + historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); + if (Objects.isNull(historicProcessInstance)) { + throw new BusinessException("流程实例不存在: " + processInstanceId); + } + return historicProcessInstance; + } + } diff --git a/pqs-common/common-autocode/src/main/java/com/njcn/autocode/utils/GenerateCode.java b/pqs-common/common-autocode/src/main/java/com/njcn/autocode/utils/GenerateCode.java index d8e27c393..f5a235d3f 100644 --- a/pqs-common/common-autocode/src/main/java/com/njcn/autocode/utils/GenerateCode.java +++ b/pqs-common/common-autocode/src/main/java/com/njcn/autocode/utils/GenerateCode.java @@ -21,7 +21,7 @@ public class GenerateCode { private static final String TARGET_DIR = "D://code"; - private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/bpm"; + private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/pqsinfo_jb"; // private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase"; private static final String USERNAME = "root"; @@ -30,9 +30,9 @@ public class GenerateCode { public static void main(String[] args) { List modules = Stream.of( - new Module("hongawen", "com.njcn.bpm", "", Stream.of( - "bpm_sign" - ).collect(Collectors.toList()), "") + new Module("hongawen", "com.njcn.supervision", "leaflet", Stream.of( + "supervision_warning_leaflet" + ).collect(Collectors.toList()), "supervision_") ).collect(Collectors.toList()); generateJavaFile(modules); } diff --git a/pqs-common/common-web/src/main/java/com/njcn/web/filter/XssRequestWrapper.java b/pqs-common/common-web/src/main/java/com/njcn/web/filter/XssRequestWrapper.java index 7b42387b2..59e8e0595 100644 --- a/pqs-common/common-web/src/main/java/com/njcn/web/filter/XssRequestWrapper.java +++ b/pqs-common/common-web/src/main/java/com/njcn/web/filter/XssRequestWrapper.java @@ -34,7 +34,7 @@ import java.util.stream.Stream; @Slf4j public class XssRequestWrapper extends HttpServletRequestWrapper { - private final static String[] WHITE_PARAMETER_NAME = {"password", "mxContent", "docContent", "bgImage","fileContent","flowableXml","bpmnXml"}; + private final static String[] WHITE_PARAMETER_NAME = {"password", "mxContent", "docContent", "bgImage","fileContent","flowableXml","bpmnXml","fields"}; public XssRequestWrapper(HttpServletRequest request) { diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/param/DeptGetLineParam.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/param/DeptGetLineParam.java index 571caa035..4a64b261b 100644 --- a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/param/DeptGetLineParam.java +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/param/DeptGetLineParam.java @@ -1,8 +1,10 @@ package com.njcn.device.biz.pojo.param; +import com.njcn.web.constant.ValidMessage; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.hibernate.validator.constraints.Range; import javax.validation.constraints.NotBlank; @@ -30,6 +32,13 @@ public class DeptGetLineParam { private Boolean monitorStateRunning=true; @ApiModelProperty(name = "isUpToGrid",value = "0.非送国网 1.需要送国网的") - private Integer isUpToGrid; + private Integer isUpToGrid; + /** + * 0-电网侧 + * 1-非电网侧 + */ + @ApiModelProperty("电网侧标识") + @Range(min = 0, max = 2, message = "电网侧标识" + ValidMessage.PARAM_FORMAT_ERROR) + private Integer powerFlag; } diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/GridDiagramVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/GridDiagramVO.java index 4ad49ef49..09ca7e8fa 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/GridDiagramVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/GridDiagramVO.java @@ -21,10 +21,10 @@ public class GridDiagramVO { private List gwInfo; @ApiModelProperty(name = "data", value = "总信息") - private Double data; + private List data; @ApiModelProperty(name = "gwData", value = "国网总信息") - private Double gwData; + private List gwData; @Data public static class LineStatistics { @ApiModelProperty(name = "orgId", value = "单位id") @@ -138,4 +138,48 @@ public class GridDiagramVO { @ApiModelProperty(name = "onLineRate", value = "数据在线率") private Float onLineRate; } + + @Data + public static class AreaData { + + @ApiModelProperty(name = "orgId", value = "单位id") + private String orgId; + + @ApiModelProperty(name = "orgName", value = "单位名称") + private String orgName; + + @ApiModelProperty(name = "lineNum", value = "监测点个数") + private Integer lineNum; + + @ApiModelProperty(name = "lineList", value = "监测点集合") + private List lineList; + + @ApiModelProperty(name = "onlineNum", value = "在线监测点个数") + private Integer onlineNum; + + @ApiModelProperty(name = "onlineList", value = "在线监测点集合") + private List onlineList; + + @ApiModelProperty(name = "alarm", value = "告警监测点个数") + private Integer alarm; + + @ApiModelProperty(name = "onLineNumList", value = "告警监测点信息") + private List alarmList; + + @ApiModelProperty(name = "subNum", value = "变电站个数") + private Integer subNum; + + @ApiModelProperty(name = "alarmSubNum", value = "告警变电站数量") + private Integer alarmSubNum; + + @ApiModelProperty(name = "alarmSubList", value = "告警变电站监测点数量") + private List alarmSubList; + + @ApiModelProperty(name = "deviceNum", value = "终端个数") + private Integer deviceNum; + + @ApiModelProperty(name = "onDevice", value = "在线终端数量") + private Integer onDevice; + + } } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/GridDiagramController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/GridDiagramController.java index 9b0ab0618..b1833303b 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/GridDiagramController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/GridDiagramController.java @@ -55,6 +55,7 @@ public class GridDiagramController extends BaseController { @ApiOperation("变电站趋势分析") public HttpResult> getGridDiagramSubTendency(@RequestBody GridDiagramParam param){ String methodDescribe = getMethodDescribe("getGridDiagramSubTendency"); + param.getDeviceInfoParam().setPowerFlag(0); Map gridDiagramDevTendency = gridDiagramService.getGridDiagramDevTendency(param,3); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gridDiagramDevTendency, methodDescribe); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java index 7748a3957..aa88cd11a 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/DeptLineMapper.java @@ -76,7 +76,7 @@ public interface DeptLineMapper extends BaseMapper { List orgSubStationGet(@Param("list")List devType); - List orgSubStationInfoGet(@Param("list")List devType); + List orgSubStationInfoGet(@Param("list")List devType,@Param("powerFlag")Integer powerFlag); List getLineIdByDeptIds(@Param("deptIds")List deptIds,@Param("runFlag")List runFlag,@Param("dataType")List dataType); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml index b31b4e35c..7f4bd914d 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/DeptLineMapper.xml @@ -110,10 +110,14 @@ inner join pq_substation sub on sub.id = substation.id where device.Dev_Model = 1 and point.state = 1 + and device.Run_Flag = 0 and device.Dev_Data_Type in #{item} + + and lineDetail.Power_Flag = #{powerFlag} + SELECT - linedetail.Num AS id, - line.NAME AS lineName, - area.NAME AS areaName, - gd.NAME AS gdName, - sub.NAME AS bdName, - scaleId.Name as scale, - manufacturerId.name as manufacturer, - dev.name as devName, - device.IP as ip, - case device.Run_Flag when 0 then "投运" - when 1 then "热备用" - when 2 then "停运" - end as runFlag, - case device.Com_Flag when 0 then "中断" - when 1 then "正常" - end as comFlag, - loadtypeId.Name as loadType, - businesstypeId.name as businessType, - IFNULL(linedetail.Obj_Name,"/") as objName, - case linedetail.PT_Type when 0 then "星型接线" - when 1 then "三角型接线" - when 2 then "开口三角型接线" - end as ptType, - CONCAT(linedetail.PT1,"/", linedetail.PT2) as pt, - CONCAT(linedetail.CT1,"/", linedetail.CT2) as ct, - linedetail.Standard_Capacity as standardCapacity, - linedetail.Short_Capacity as shortCapacity, - linedetail.Dev_Capacity as devCapacity, - linedetail.Deal_Capacity as dealCapacity, - over.Freq_Dev as freqDev, - over.Voltage_Dev as voltageDev, - over.Uvoltage_Dev as uvoltageDev, - over.Ubalance as ubalance, - over.I_Neg as iNeg, - over.Flicker as flicker, - over.Uaberrance as uaberrance, - over.Uharm_3 as oddHarm, - over.Uharm_2 as evenHarm, - over.Iharm_2 as iharm2, - over.Iharm_3 as iharm3, - over.Iharm_4 as iharm4, - over.Iharm_5 as iharm5, - over.Iharm_6 as iharm6, - over.Iharm_7 as iharm7, - over.Iharm_8 as iharm8, - over.Iharm_9 as iharm9, - over.Iharm_10 as iharm10, - over.Iharm_11 as iharm11, - over.Iharm_12 as iharm12, - over.Iharm_13 as iharm13, - over.Iharm_14 as iharm14, - over.Iharm_15 as iharm15, - over.Iharm_16 as iharm16, - over.Iharm_17 as iharm17, - over.Iharm_18 as iharm18, - over.Iharm_19 as iharm19, - over.Iharm_20 as iharm20, - over.Iharm_21 as iharm21, - over.Iharm_22 as iharm22, - over.Iharm_23 as iharm23, - over.Iharm_24 as iharm24, - over.Iharm_25 as iharm25, - over.InUharm_1 as inUharm, - over.InUharm_16 as inUharm16 + linedetail.Num AS id, + line.NAME AS lineName, + area.NAME AS areaName, + gd.NAME AS gdName, + sub.NAME AS bdName, + scaleId.Name as scale, + manufacturerId.name as manufacturer, + dev.name as devName, + device.IP as ip, + case device.Run_Flag when 0 then "投运" + when 1 then "热备用" + when 2 then "停运" + end as runFlag, + case device.Com_Flag when 0 then "中断" + when 1 then "正常" + end as comFlag, + loadtypeId.Name as loadType, + businesstypeId.name as businessType, + IFNULL(linedetail.Obj_Name,"/") as objName, + case linedetail.PT_Type when 0 then "星型接线" + when 1 then "三角型接线" + when 2 then "开口三角型接线" + end as ptType, + CONCAT(linedetail.PT1,"/", linedetail.PT2) as pt, + CONCAT(linedetail.CT1,"/", linedetail.CT2) as ct, + linedetail.Standard_Capacity as standardCapacity, + linedetail.Short_Capacity as shortCapacity, + linedetail.Dev_Capacity as devCapacity, + linedetail.Deal_Capacity as dealCapacity, + overlimit.Freq_Dev as freqDev, + overlimit.Voltage_Dev as voltageDev, + overlimit.Uvoltage_Dev as uvoltageDev, + overlimit.Ubalance as ubalance, + overlimit.I_Neg as iNeg, + overlimit.Flicker as flicker, + overlimit.Uaberrance as uaberrance, + overlimit.Uharm_3 as oddHarm, + overlimit.Uharm_2 as evenHarm, + overlimit.Iharm_2 as iharm2, + overlimit.Iharm_3 as iharm3, + overlimit.Iharm_4 as iharm4, + overlimit.Iharm_5 as iharm5, + overlimit.Iharm_6 as iharm6, + overlimit.Iharm_7 as iharm7, + overlimit.Iharm_8 as iharm8, + overlimit.Iharm_9 as iharm9, + overlimit.Iharm_10 as iharm10, + overlimit.Iharm_11 as iharm11, + overlimit.Iharm_12 as iharm12, + overlimit.Iharm_13 as iharm13, + overlimit.Iharm_14 as iharm14, + overlimit.Iharm_15 as iharm15, + overlimit.Iharm_16 as iharm16, + overlimit.Iharm_17 as iharm17, + overlimit.Iharm_18 as iharm18, + overlimit.Iharm_19 as iharm19, + overlimit.Iharm_20 as iharm20, + overlimit.Iharm_21 as iharm21, + overlimit.Iharm_22 as iharm22, + overlimit.Iharm_23 as iharm23, + overlimit.Iharm_24 as iharm24, + overlimit.Iharm_25 as iharm25, + overlimit.InUharm_1 as inUharm, + overlimit.InUharm_16 as inUharm16 FROM pq_line line INNER JOIN pq_line vol ON vol.Id = line.Pid INNER JOIN pq_line dev ON dev.Id = vol.Pid @@ -89,7 +89,7 @@ INNER JOIN pq_line gd ON gd.Id = sub.Pid INNER JOIN pq_line areaId ON areaId.Id = gd.Pid INNER JOIN sys_area area ON area.Id = areaId.NAME - INNER JOIN pq_overlimit over ON over.Id = line.Id + INNER JOIN pq_overlimit overlimit ON overlimit.Id = line.Id INNER JOIN pq_voltage voltage ON voltage.Id = vol.Id INNER JOIN sys_dict_data scaleId ON scaleId.Id = voltage.Scale INNER JOIN pq_device device ON device.Id = dev.Id @@ -114,10 +114,10 @@ OR line.NAME LIKE #{searchValueLike} ORDER BY - gdName, - bdName, - devNAME, - objName; + gdName, + bdName, + devNAME, + objName; + + diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/RStatLimitTargetDMapper.xml b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/RStatLimitTargetDMapper.xml index 6893e57eb..aa1583f3b 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/RStatLimitTargetDMapper.xml +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/RStatLimitTargetDMapper.xml @@ -237,7 +237,7 @@ from ( SELECT my_index, - sum( all_time ) AS allCount + sum( all_time )+sum( flicker_all_time )AS allCount FROM r_stat_limit_target_d @@ -282,4 +282,93 @@ group by my_index + diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/IRStatLimitTargetDService.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/IRStatLimitTargetDService.java index 95e455a03..105f8e81a 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/IRStatLimitTargetDService.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/IRStatLimitTargetDService.java @@ -1,8 +1,10 @@ package com.njcn.harmonic.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO; +import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO; import java.util.List; @@ -23,4 +25,11 @@ public interface IRStatLimitTargetDService extends IService */ List getLinesTarget(StatSubstationBizBaseParam param); + + /** + * 根据监测点查询一个月各指标越线超标天数 + * @param param + * @return + */ + RStatLimitTargetVO getGridDiagramTargetData(StatisticsBizBaseParam param); } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/GridServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/GridServiceImpl.java index a93b6cfde..e5ac3169b 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/GridServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/GridServiceImpl.java @@ -91,6 +91,7 @@ public class GridServiceImpl implements IGridService { if (lineDetailMap.containsKey(item.getArea())) { AssessVo assessVo = new AssessVo(); assessVo.setName(item.getName()); + assessVo.setCode(item.getCode()); List ll = lineDetailMap.get(item.getArea()).stream().map(LineDetail::getId).collect(Collectors.toList()); List deptAssessList = assesList.stream().filter(it->ll.contains(it.getLineId())).collect(Collectors.toList()); List communicateList = BeanUtil.copyToList(deptAssessList,PqsComasses.class); @@ -310,6 +311,7 @@ public class GridServiceImpl implements IGridService { List list2 = getList2(lineList,param.getStartTime(),param.getEndTime()); List list3 = getList3(lineList,param.getStartTime(),param.getEndTime()); List list4 = getList4(lineList,param.getStartTime(),param.getEndTime()); + List list5 = getList5(lineList,param.getStartTime(),param.getEndTime()); if (CollUtil.isNotEmpty(list1)) { List d = list1.stream().map(o->o.getFreqDev().doubleValue()).collect(Collectors.toList()); double avg = d.stream().collect(Collectors.averagingDouble(x->x)); @@ -328,7 +330,7 @@ public class GridServiceImpl implements IGridService { vo3.setAvg(PubUtils.doubleRound(2,avg)); vo3.setSd(targetSd(d,avg)); } - if (CollUtil.isNotEmpty(list1)) { + if (CollUtil.isNotEmpty(list5)) { List d = list1.stream().map(o -> o.getVUnbalance().doubleValue()).collect(Collectors.toList()); double avg = d.stream().collect(Collectors.averagingDouble(x -> x)); vo4.setAvg(PubUtils.doubleRound(2,avg)); @@ -545,7 +547,7 @@ public class GridServiceImpl implements IGridService { } /** - * 获取监测点频率偏差 T相最大值\获取监测点三相电压不平衡度 T相最大值 + * 获取监测点频率偏差 T相最大值 */ public List getList1(List lineList, String startTime, String endTime) { return statDataVDMapper.getFreqDev(lineList,startTime,endTime); @@ -572,6 +574,13 @@ public class GridServiceImpl implements IGridService { return statDataPltDMapper.getPlt(lineList,startTime,endTime); } + /** + * 获取监测点三相电压不平衡度 T相 CP95 + */ + public List getList5(List lineList, String startTime, String endTime) { + return statDataVDMapper.getUnbalance(lineList,startTime,endTime); + } + /** * 计算标准差 */ diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java index b0baabae5..743c69672 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/HistoryResultServiceImpl.java @@ -91,7 +91,6 @@ public class HistoryResultServiceImpl implements HistoryResultService { private final DicDataFeignClient dicDataFeignClient; - @Override public List getHistoryResult(HistoryParam historyParam) { List historyDataResultVOList = new ArrayList<>(); @@ -195,16 +194,16 @@ public class HistoryResultServiceImpl implements HistoryResultService { historyDataResultVO.setValue(objectListData); } else { //按时间分组 - Map> map = harmonicHistoryDataList.stream().collect(Collectors.groupingBy(HarmonicHistoryData::getTime,TreeMap::new, Collectors.toList())); + Map> map = harmonicHistoryDataList.stream().collect(Collectors.groupingBy(HarmonicHistoryData::getTime, TreeMap::new, Collectors.toList())); - Float maxI = null; - Float minI = null; + Float maxI = null; + Float minI = null; for (Map.Entry> entry : map.entrySet()) { List val = entry.getValue(); - Object[] objects = {PubUtils.instantToDate(entry.getKey()),0,0,0}; + Object[] objects = {PubUtils.instantToDate(entry.getKey()), 0, 0, 0}; //需要保证val的长度为3 - if(val.size()!=3){ - for(int i =0;i<3-val.size();i++){ + if (val.size() != 3) { + for (int i = 0; i < 3 - val.size(); i++) { HarmonicHistoryData tem = new HarmonicHistoryData(); tem.setAValue(0f); val.add(tem); @@ -215,7 +214,7 @@ public class HistoryResultServiceImpl implements HistoryResultService { if (InfluxDBTableConstant.PHASE_TYPE_A.equalsIgnoreCase(harmonicHistoryData.getPhasicType())) { BigDecimal a = BigDecimal.valueOf(harmonicHistoryData.getAValue()).setScale(4, RoundingMode.HALF_UP); - objects[1] =a; + objects[1] = a; maxI = max(maxI, a.floatValue()); minI = min(minI, a.floatValue()); @@ -237,7 +236,8 @@ public class HistoryResultServiceImpl implements HistoryResultService { objectListData.add(list); - }; + } + ; //下面代码稳定后可删除 /* List aList = harmonicHistoryDataList.stream() @@ -336,24 +336,24 @@ public class HistoryResultServiceImpl implements HistoryResultService { } - private Float max(Float ding,Float a){ - if(Objects.isNull(ding)){ + private Float max(Float ding, Float a) { + if (Objects.isNull(ding)) { ding = a; } - if(a>ding){ + if (a > ding) { ding = a; } - return ding; + return ding; } - private Float min(Float ding,Float a){ - if(Objects.isNull(ding)){ + private Float min(Float ding, Float a) { + if (Objects.isNull(ding)) { ding = a; } - if(a deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); //获取全部变电站信息 List collect = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList()); @@ -739,6 +740,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); //获取全部变电站信息 List collect = deptGetChildrenMoreDTOS.stream().flatMap(x -> x.getStationIds().stream()).collect(Collectors.toList()); @@ -777,6 +779,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl> getPollutionAlarmList(GridDiagramParam param) { List> info = new ArrayList<>(); + param.getDeviceInfoParam().setPowerFlag(0); List data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData(); List subIds = data.stream().flatMap(x -> x.getSubIndexes().stream()).collect(Collectors.toList()); List substationMlist = pollutionSubstationMMapper.selectList(new LambdaQueryWrapper() diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RMpTargetWarnDServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RMpTargetWarnDServiceImpl.java index d654e7dde..a618e958b 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RMpTargetWarnDServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RMpTargetWarnDServiceImpl.java @@ -2,19 +2,19 @@ package com.njcn.harmonic.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO; -import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.device.biz.pojo.dto.SubGetBase; import com.njcn.device.biz.pojo.param.DeptGetLineParam; +import com.njcn.device.pq.api.LineIntegrityClient; +import com.njcn.device.pq.pojo.po.RStatIntegrityD; import com.njcn.device.pq.pojo.vo.GridDiagramVO; import com.njcn.harmonic.mapper.RMpTargetWarnDMapper; import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.po.RMpTargetWarnDPO; import com.njcn.harmonic.service.IRMpTargetWarnDService; +import com.njcn.harmonic.service.IRStatLimitTargetDService; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataTypeEnum; @@ -46,7 +46,8 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl data = deptFeignClient.getDirectSonSelf(param.getId()).getData(); DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); deptGetLineParam.setDeptId(param.getId()); + deptGetLineParam.setPowerFlag(0); List deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); List lineIDS = deptGetChildrenMoreDTOS.stream() .flatMap(x -> x.getStationIds().stream().flatMap(l -> l.getUnitChildrenList().stream())) .collect(Collectors.toList()); + //根据r_stat_limit_target_d来判断是否告警allTime flicker_overtime - - List list = this.list(new QueryWrapper() - .select("measurement_point_id,sum(is_warn) as isWarn") - .in(CollUtil.isNotEmpty(lineIDS), "measurement_point_id", lineIDS) - .ge(StrUtil.isNotBlank(param.getStartTime()), "data_date", DateUtil.beginOfDay(DateUtil.parse(param.getStartTime()))) - .le(StrUtil.isNotBlank(param.getEndTime()), "data_date", DateUtil.endOfDay(DateUtil.parse(param.getEndTime()))) - .groupBy("measurement_point_id") - ); + List integrityList =new ArrayList<>(); + //根据r_stat_limit_target_d来判断是否告警allTime flicker_overtime + List linesTarget=new ArrayList<>(); + if(CollUtil.isNotEmpty(lineIDS)){ + StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam(); + baseParam.setIds(lineIDS); + baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString()); + baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString()); + linesTarget.addAll(targetDService.getLinesTarget(baseParam)); + List integrityDS = lineIntegrityClient.getIntegrityByLineIds(lineIDS, + DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(), + DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString()).getData(); + integrityList.addAll(integrityDS.stream().filter(x->0==x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList())); + } Map deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetSubStationDTO.Info::getUnitId, Function.identity())); @@ -99,7 +108,7 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl subBaseList = deptLineMap.get(datum.getId()).getStationIds(); List statisticsData = new ArrayList<>(); List gwStatisticsData = new ArrayList<>(); - getSubStationStatisticsData(statisticsData, gwStatisticsData, subBaseList, voltageIds, list); + getSubStationStatisticsData(statisticsData, gwStatisticsData, subBaseList, voltageIds, linesTarget,integrityList); lineStatistics.setData(statisticsData); gwLineStatistics.setData(gwStatisticsData); @@ -116,7 +125,8 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl gwStatisticsData, List subBaseList, List voltageIds, - List list + List list, + List integrityList ) { GridDiagramVO.StatisticsData data; for (String voltageId : voltageIds) { @@ -143,8 +153,10 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl collect = list.stream().filter(d -> line.contains(d.getMeasurementPointId())) - .filter(d -> d.getIsWarn() > 0).map(RMpTargetWarnDPO::getMeasurementPointId).collect(Collectors.toList()); + List collect=new ArrayList<>(); + collect.addAll(list.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); + collect.addAll(integrityList.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); + if (CollUtil.isNotEmpty(collect)) { num.getAndIncrement(); alarm.addAll(collect); @@ -152,7 +164,7 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl alarm = new ArrayList<>(); subBaseList.stream().forEach(x -> { List line = x.getUnitChildrenList(); - List alarmList = list.stream().filter(d -> line.contains(d.getMeasurementPointId())) - .filter(d -> d.getIsWarn() > 0).map(RMpTargetWarnDPO::getMeasurementPointId).collect(Collectors.toList()); + List alarmList=new ArrayList<>(); + alarmList.addAll(list.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); + alarmList.addAll(integrityList.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); if (CollUtil.isNotEmpty(alarmList)) { num.getAndIncrement(); - alarm.addAll(alarmList); + alarm.addAll(alarmList.stream().distinct().collect(Collectors.toList())); } }); data.setNumTwo(num.get()); data.setNumTwoList(alarm); statisticsData.add(data); + //国网监测点 data = new GridDiagramVO.StatisticsData(); data.setNumOne(subBaseList.stream() .filter(x -> 1 == x.getIsUpToGrid()) @@ -195,11 +209,12 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl gwAlarm = new ArrayList<>(); subBaseList.stream().filter(x -> 1 == x.getIsUpToGrid()).forEach(x -> { List line = x.getGwUnitChildrenList(); - List alarmList = list.stream().filter(d -> line.contains(d.getMeasurementPointId())) - .filter(d -> d.getIsWarn() > 0).map(RMpTargetWarnDPO::getMeasurementPointId).collect(Collectors.toList()); + List alarmList=new ArrayList<>(); + alarmList.addAll(list.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); + alarmList.addAll(integrityList.stream().filter(d -> line.contains(d)).collect(Collectors.toList())); if (CollUtil.isNotEmpty(alarmList)) { gwNum.getAndIncrement(); - gwAlarm.addAll(alarmList); + gwAlarm.addAll(alarmList.stream().distinct().collect(Collectors.toList())); } }); data.setNumTwo(gwNum.get()); diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RStatLimitTargetDServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RStatLimitTargetDServiceImpl.java index 595861bb7..8d9f31f4a 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RStatLimitTargetDServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/RStatLimitTargetDServiceImpl.java @@ -1,12 +1,16 @@ package com.njcn.harmonic.service.impl; +import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.harmonic.mapper.RStatLimitTargetDMapper; import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO; +import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO; import com.njcn.harmonic.service.IRStatLimitTargetDService; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.List; /** @@ -24,4 +28,11 @@ public class RStatLimitTargetDServiceImpl extends ServiceImpl getLinesTarget(StatSubstationBizBaseParam param) { return this.baseMapper.getLinesTarget(param.getIds(),param.getStartTime(),param.getEndTime()); } + + @Override + public RStatLimitTargetVO getGridDiagramTargetData(StatisticsBizBaseParam param) { + return this.baseMapper.getSumTargetDetails(Arrays.asList(param.getId()), + DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(), + DateUtil.endOfDay(DateUtil.parse(param.getEndTime())).toString()); + } } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/RStatLimitService.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/RStatLimitService.java index 01d11207b..d6f79a2de 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/RStatLimitService.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/RStatLimitService.java @@ -26,4 +26,11 @@ public interface RStatLimitService { List monitorIdsGetLimitTargetInfo(String date, List monitorIds); List getGridDiagramLineData(DeviceInfoParam.BusinessParam deviceInfoParam); + + /** + * 区域基本信息(监测点,终端,变电站等) + * @param param + * @return + */ + List getGridDiagramAreaData(DeviceInfoParam.BusinessParam param); } diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/RStatLimitServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/RStatLimitServiceImpl.java index d7f9c84c8..4218c557c 100644 --- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/RStatLimitServiceImpl.java +++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/RStatLimitServiceImpl.java @@ -7,21 +7,23 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.njcn.common.pojo.dto.SimpleDTO; +import com.njcn.device.biz.commApi.CommTerminalGeneralClient; +import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO; +import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.LineIntegrityClient; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.param.DeviceInfoParam; import com.njcn.device.pq.pojo.param.OnlineRateParam; import com.njcn.device.pq.pojo.po.RStatIntegrityD; -import com.njcn.device.pq.pojo.po.RStatOnlinerateD; import com.njcn.device.pq.pojo.vo.GridDiagramVO; import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO; -import com.njcn.device.pq.pojo.vo.TerminalTree; import com.njcn.harmonic.mapper.RStatLimitRateDMapper; import com.njcn.harmonic.mapper.RStatLimitTargetDMapper; -import com.njcn.harmonic.mapper.RStatLimitTargetMapper; +import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam; import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO; import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO; +import com.njcn.harmonic.service.IRStatLimitTargetDService; import com.njcn.harmonic.service.majornetwork.RStatLimitService; import com.njcn.system.pojo.enums.StatisticsEnum; import lombok.RequiredArgsConstructor; @@ -30,8 +32,10 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Comparator; import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * pqs @@ -47,6 +51,10 @@ public class RStatLimitServiceImpl implements RStatLimitService { private final RStatLimitTargetDMapper rStatLimitTargetDMapper; private final GeneralDeviceInfoClient generalDeviceInfoClient; private final LineIntegrityClient lineIntegrityClient; + private final IRStatLimitTargetDService targetDService; + private final CommTerminalGeneralClient commTerminalGeneralClient; + + @Override public List monitorIdsGetLimitRateInfo(String date, List monitorIds) { @@ -137,6 +145,87 @@ public class RStatLimitServiceImpl implements RStatLimitService { return info; } + @Override + public List getGridDiagramAreaData(DeviceInfoParam.BusinessParam param) { + List info = new ArrayList<>(); + GridDiagramVO.AreaData areaData ; + //监测点总数 + List data = generalDeviceInfoClient.getPracticalAllDeviceInfoAsDept(param).getData(); + //在线 + List onData = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData(); + Map onMap = onData.stream().collect(Collectors.toMap(GeneralDeviceDTO::getIndex, Function.identity())); + + DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); + deptGetLineParam.setDeptId(param.getDeptIndex()); + deptGetLineParam.setPowerFlag(0); + //变电站公共方法 + List deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetSubStationInfo(deptGetLineParam).getData(); + Map deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetSubStationDTO.Info::getUnitId, Function.identity())); + + List line = data.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList()); + StatSubstationBizBaseParam baseParam=new StatSubstationBizBaseParam(); + baseParam.setIds(line); + baseParam.setStartTime(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString()); + baseParam.setEndTime(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()); + List linesTarget=targetDService.getLinesTarget(baseParam); + List integrityDS = lineIntegrityClient.getIntegrityByLineIds(line, + DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(), + DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())).toString()).getData(); + List integrityDS0 = integrityDS.stream().filter(x -> 0 == x.getIntegrityData()).map(RStatIntegrityD::getLineIndex).collect(Collectors.toList()); + + for (GeneralDeviceDTO datum : data) { + areaData = new GridDiagramVO.AreaData(); + areaData.setOrgId(datum.getIndex()); + areaData.setOrgName(datum.getName()); + areaData.setLineNum(datum.getLineIndexes().size()); + areaData.setLineList(datum.getLineIndexes()); + areaData.setDeviceNum(datum.getDeviceIndexes().size()); + if(onMap.containsKey(datum.getIndex())){ + GeneralDeviceDTO dto = onMap.get(datum.getIndex()); + areaData.setOnlineNum(dto.getLineIndexes().size()); + areaData.setOnlineList(dto.getLineIndexes()); + areaData.setOnDevice(dto.getDeviceIndexes().size()); + if (deptLineMap.containsKey(datum.getIndex())) { + DeptGetSubStationDTO.Info deptSub = deptLineMap.get(datum.getIndex()); + areaData.setSubNum(deptSub.getStationIds().size()); + AtomicLong num = new AtomicLong(); + List alarm = new ArrayList<>(); + deptSub.getStationIds().stream().forEach(x -> { + List lineIds = new ArrayList<>(); + //0:全部 1:国网 + if (ObjectUtil.isNull(param.getMonitorFlag())) { + lineIds.addAll(x.getUnitChildrenList()); + } else { + if (0 == param.getMonitorFlag()) { + lineIds.addAll(x.getUnitChildrenList()); + }else { + lineIds.addAll(x.getGwUnitChildrenList()); + } + } + List collect = new ArrayList<>(); + collect.addAll(linesTarget.stream().filter(d -> lineIds.contains(d)).collect(Collectors.toList())); + collect.addAll(integrityDS0.stream().filter(d -> lineIds.contains(d)).collect(Collectors.toList())); + if (CollUtil.isNotEmpty(collect)) { + num.getAndIncrement(); + alarm.addAll(collect); + } + + }); + areaData.setAlarmSubNum(Math.toIntExact(num.get())); + areaData.setAlarmSubList(alarm.stream().distinct().collect(Collectors.toList())); + } + List lineAlarm = new ArrayList<>(); + lineAlarm.addAll(linesTarget.stream().filter(d -> datum.getLineIndexes().contains(d)).collect(Collectors.toList())); + lineAlarm.addAll(integrityDS0.stream().filter(d -> datum.getLineIndexes().contains(d)).collect(Collectors.toList())); + areaData.setAlarm(lineAlarm.stream().distinct().collect(Collectors.toList()).size()); + areaData.setAlarmList(lineAlarm.stream().distinct().collect(Collectors.toList())); + + } + info.add(areaData); + } + return info; + } + private void onLineAndIntegrity(List lineIds, List onIntegrityByIds, List devIds, List onlineRateByDevIds,List limitTargetList, GridDiagramVO.LineData lineData) { //监测完整率 List integrityDS = onIntegrityByIds.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList()); diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java index b5ac1c617..92e851c1f 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/DayDataServiceImpl.java @@ -3,6 +3,7 @@ package com.njcn.prepare.harmonic.service.mysql.Impl.line; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.ObjUtil; import com.alibaba.nacos.client.naming.utils.CollectionUtils; import com.njcn.common.utils.HarmonicTimesUtil; import com.njcn.harmonic.pojo.po.day.*; @@ -19,7 +20,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.springframework.beans.BeanUtils; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -113,7 +113,10 @@ public class DayDataServiceImpl implements DayDataService { RStatDataVDPO po1 = new RStatDataVDPO(); BeanUtils.copyProperties(item, po1); po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER)); + //todo 此数据质量标记为influxdb查询得出,数据转换时未做数据异常判断,因前置那边未做判断,系统先做判断拦截,后期前置应该加判断 po1.setQualityFlag(Integer.parseInt(item.getQualityFlag())); + //fixme 因现场数据异常,先处理频率偏差、电压偏差、电压总谐波畸变率、三相电压不平衡度、长时闪变异常数据拦截 + po1.setQualityFlag(DataAnomalyDetectio(po1,null)); dataVPOList.add(po1); DayV dayV = new DayV(); BeanUtils.copyProperties(item, dayV); @@ -580,6 +583,7 @@ public class DayDataServiceImpl implements DayDataService { BeanUtils.copyProperties(item, po1); po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER)); po1.setQualityFlag(Integer.parseInt(item.getQualityFlag())); + po1.setQualityFlag(DataAnomalyDetectio(null,po1)); dataPltPOList.add(po1); DayPlt dayPlt = new DayPlt(); @@ -1864,4 +1868,23 @@ public class DayDataServiceImpl implements DayDataService { result.addAll(result4); return result; } + + public Integer DataAnomalyDetectio(RStatDataVDPO po1, RStatDataPltDPO po2) { + int result = 0; + if (ObjUtil.isNotNull(po1)) { + if (Math.abs(po1.getFreqDev()) > 7.5 + || Math.abs(po1.getVlDev()) > 20 + || Math.abs(po1.getVuDev()) > 20 + || po1.getVThd() > 30 + || po1.getVUnbalance() > 40) { + result = 1; + } + } + if (ObjUtil.isNotNull(po2)) { + if (po2.getPlt() > 20) { + result = 1; + } + } + return result; + } } diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/SupervisionPlanFeignClient.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/SupervisionPlanFeignClient.java new file mode 100644 index 000000000..cb93566ed --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/SupervisionPlanFeignClient.java @@ -0,0 +1,22 @@ +package com.njcn.supervision.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.supervision.api.fallback.SupervisionPlanFeignClientFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + + +/** + * 流程实例 Api 接口 + * + * @author hongawen + */ +@FeignClient(value = ServerInfo.SUPERVISION, path = "/superPlan", fallbackFactory = SupervisionPlanFeignClientFallbackFactory.class) +public interface SupervisionPlanFeignClient { + + @GetMapping("/updateStatus") + HttpResult updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status); + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/TempLineDebugFeignClient.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/TempLineDebugFeignClient.java new file mode 100644 index 000000000..d59a16956 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/TempLineDebugFeignClient.java @@ -0,0 +1,22 @@ +package com.njcn.supervision.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.supervision.api.fallback.TempLineDebugFeignClientFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + + +/** + * 流程实例 Api 接口 + * + * @author 芋道源码 + */ +@FeignClient(value = ServerInfo.SUPERVISION, path = "/tempLinedebug", fallbackFactory = TempLineDebugFeignClientFallbackFactory.class) +public interface TempLineDebugFeignClient { + + @GetMapping("/updateStatus") + HttpResult updateStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status); + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserReportNormalFeignClient.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserReportNormalFeignClient.java new file mode 100644 index 000000000..779e743f6 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/UserReportNormalFeignClient.java @@ -0,0 +1,22 @@ +package com.njcn.supervision.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.supervision.api.fallback.UserReportNoramlFeignClientFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + + +/** + * 流程实例 Api 接口 + * + * @author hongawen + */ +@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReportNormal", fallbackFactory = UserReportNoramlFeignClientFallbackFactory.class) +public interface UserReportNormalFeignClient { + + @GetMapping("/updateUserReportNormalStatus") + HttpResult updateUserReportNormalStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status); + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/SupervisionPlanFeignClientFallbackFactory.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/SupervisionPlanFeignClientFallbackFactory.java new file mode 100644 index 000000000..20f89d899 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/SupervisionPlanFeignClientFallbackFactory.java @@ -0,0 +1,37 @@ +package com.njcn.supervision.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.supervision.api.SupervisionPlanFeignClient; +import com.njcn.supervision.utils.SupervisionEnumUtil; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @author denghuajun + * @version 1.0.0 + * @date 2022/3/16 + */ +@Slf4j +@Component +public class SupervisionPlanFeignClientFallbackFactory implements FallbackFactory { + @Override + public SupervisionPlanFeignClient create(Throwable throwable) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (throwable.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) throwable.getCause(); + exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult()); + } + Enum finalExceptionEnum = exceptionEnum; + return new SupervisionPlanFeignClient() { + @Override + public HttpResult updateStatus(String businessKey, Integer status) { + log.error("{}异常,降级处理,异常为:{}", "更新退运装置数据流程状态", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/TempLineDebugFeignClientFallbackFactory.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/TempLineDebugFeignClientFallbackFactory.java new file mode 100644 index 000000000..77411cd3a --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/TempLineDebugFeignClientFallbackFactory.java @@ -0,0 +1,37 @@ +package com.njcn.supervision.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.supervision.api.TempLineDebugFeignClient; +import com.njcn.supervision.utils.SupervisionEnumUtil; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @author denghuajun + * @version 1.0.0 + * @date 2022/3/16 + */ +@Slf4j +@Component +public class TempLineDebugFeignClientFallbackFactory implements FallbackFactory { + @Override + public TempLineDebugFeignClient create(Throwable throwable) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (throwable.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) throwable.getCause(); + exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult()); + } + Enum finalExceptionEnum = exceptionEnum; + return new TempLineDebugFeignClient() { + @Override + public HttpResult updateStatus(String businessKey, Integer status) { + log.error("{}异常,降级处理,异常为:{}", "更新流程状态", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserReportNoramlFeignClientFallbackFactory.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserReportNoramlFeignClientFallbackFactory.java new file mode 100644 index 000000000..8431089e8 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/api/fallback/UserReportNoramlFeignClientFallbackFactory.java @@ -0,0 +1,37 @@ +package com.njcn.supervision.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.supervision.api.UserReportNormalFeignClient; +import com.njcn.supervision.utils.SupervisionEnumUtil; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @author denghuajun + * @version 1.0.0 + * @date 2022/3/16 + */ +@Slf4j +@Component +public class UserReportNoramlFeignClientFallbackFactory implements FallbackFactory { + @Override + public UserReportNormalFeignClient create(Throwable throwable) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if (throwable.getCause() instanceof BusinessException) { + BusinessException businessException = (BusinessException) throwable.getCause(); + exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult()); + } + Enum finalExceptionEnum = exceptionEnum; + return new UserReportNormalFeignClient() { + @Override + public HttpResult updateUserReportNormalStatus(String businessKey, Integer status) { + log.error("{}异常,降级处理,异常为:{}", "更新用户数据流程状态", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/FlowStatusEnum.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/FlowStatusEnum.java index 97f18f55f..a1f2f3947 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/FlowStatusEnum.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/FlowStatusEnum.java @@ -13,7 +13,8 @@ public enum FlowStatusEnum { AUDIT(1, "审批中"), APPROVE(2, "审批通过"), OPPOSE(3, "审批不通过"), - CANCEL(4, "已取消"); + CANCEL(4, "已取消"), + NO_FEEDBACK(5, "未反馈"); private final Integer code; diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/LeafletTypeEnum.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/LeafletTypeEnum.java new file mode 100644 index 000000000..fd8a22edb --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/LeafletTypeEnum.java @@ -0,0 +1,19 @@ +package com.njcn.supervision.enums; + +import lombok.Getter; + +@Getter +public enum LeafletTypeEnum { + + WARNING(1, "预警单"), + ALARM(2, "告警单"); + + private final Integer code; + + private final String name; + + LeafletTypeEnum(Integer code, String name) { + this.code = code; + this.name = name; + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/ProblemTypeEnum.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/ProblemTypeEnum.java new file mode 100644 index 000000000..55ccc8e11 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/enums/ProblemTypeEnum.java @@ -0,0 +1,21 @@ +package com.njcn.supervision.enums; + +import lombok.Getter; + +@Getter +public enum ProblemTypeEnum { + + PLAN(1, "技术监督计划"), + ONLINE(2, "在线监测超标问题"), + USER(3, "用户投诉问题"), + SITE_TEST(4, "现场测试超标问题"); + + private final Integer code; + + private final String name; + + ProblemTypeEnum(Integer code, String name) { + this.code = code; + this.name = name; + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineDebugParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineDebugParam.java new file mode 100644 index 000000000..2bfeb9e55 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineDebugParam.java @@ -0,0 +1,65 @@ +package com.njcn.supervision.pojo.param.device; + +import com.njcn.db.bo.BaseEntity; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Map; + +/** + * + * Description: + * Date: 2024/5/17 15:26【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class SupervisionTempLineDebugParam extends BaseEntity { + private String id; + + /** + * 调试原因 + */ + @ApiModelProperty(value="调试原因") + private String reason; + + /** + * 流程实例的编号 + */ + @ApiModelProperty(value="流程实例的编号") + private String processInstanceId; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + @ApiModelProperty(value="1:审批中;2:审批通过;3:审批不通过;4:已取消") + private Integer status; + + /** + * 状态:0-删除 1-正常 + */ + @ApiModelProperty(value="状态:0-删除 1-正常") + private Integer state; + + @ApiModelProperty("发起人自选审批人 Map") + private Map> startUserSelectAssignees; + + @Data + @EqualsAndHashCode(callSuper = true) + public static class SupervisionTempLineDebugQuery extends BaseParam { + + @ApiModelProperty(value = "填报部门") + private String orgId; + + private List statueList; + + } +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineReportParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineReportParam.java index 5c43575a0..650aefb3b 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineReportParam.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/device/SupervisionTempLineReportParam.java @@ -239,5 +239,7 @@ public class SupervisionTempLineReportParam { @ApiModelProperty(value = "填报部门") private String orgId; + private List statueList; + } } \ No newline at end of file diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/leaflet/WarningLeafletParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/leaflet/WarningLeafletParam.java new file mode 100644 index 000000000..6579e07fc --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/leaflet/WarningLeafletParam.java @@ -0,0 +1,118 @@ +package com.njcn.supervision.pojo.param.leaflet; + +import com.njcn.db.bo.BaseEntity; +import com.njcn.supervision.pojo.param.device.QuitRunningDeviceParam; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + *

+ * 预告警单表 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WarningLeafletParam extends BaseEntity implements Serializable{ + + private static final long serialVersionUID = 1L; + + /** + * 预告警单名称 + */ + @ApiModelProperty(value = "设备编号") + private String leafletName; + + /** + * 预告警编号,目前阶段不做配置 + */ + @ApiModelProperty(value = "设备编号") + private String leafletNo; + + /** + * 1:技术监督管理;2:在线监测超标问题;3:用户投诉;4:现场测试超标 + */ + @ApiModelProperty(value = "设备编号") + private Integer problemType; + + /** + * 对应问题源ID,用于查询详细信息 + */ + @ApiModelProperty(value = "设备编号") + private String problemId; + + /** + * 单子类型:1:预警单;2:告警单 + */ + @ApiModelProperty(value = "设备编号") + private Integer leafletType; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消;5:待反馈 + */ + @ApiModelProperty(value = "设备编号") + private Integer status; + + /** + * 流程实例的编号 + */ + @ApiModelProperty(value = "设备编号") + private String processInstanceId; + + /** + * 问题详细描述 + */ + @ApiModelProperty(value = "问题详细描述") + private String issueDetail; + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class WarningLeafletUpdateParam extends WarningLeafletParam { + + @ApiModelProperty("id") + @NotBlank(message = "索引不能为空") + private String Id; + + + /** + * 采取措施 + */ + @ApiModelProperty(value = "采取措施") + @NotBlank(message = "采取措施不能为空") + private String takeStep; + + + /** + * 处理成效报告 + */ + @ApiModelProperty(value = "处理成效报告") + @NotBlank(message = "处理成效报告不能为空") + private String reportPath; + + } + + + /** + * 分页查询实体 + */ + @Data + @EqualsAndHashCode(callSuper = true) + public static class WarningLeafletQueryParam extends BaseParam { + + + + } + + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisionPlanParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisionPlanParam.java new file mode 100644 index 000000000..e7f3b5336 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisionPlanParam.java @@ -0,0 +1,168 @@ +package com.njcn.supervision.pojo.param.plan; + +import com.njcn.web.pojo.annotation.DateTimeStrValid; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author hongawen + * @since 2023-06-21 + */ +@Data +public class SupervisionPlanParam extends BaseParam { + + + /** + * 计划名称 + */ + @ApiModelProperty(value = "计划名称",required = true) + @NotBlank(message = "计划名称不可为空") + private String workPlanName; + + /** + * 监督单位 + */ + @ApiModelProperty(value = "监督单位",required = true) + @NotBlank(message = "监督单位不可为空") + private String supvOrgId; + + /** + * 计划编制人id + */ + @NotBlank(message = "计划编制人不可为空") + private String planUserId; + + /** + * 监督类型 + */ + @ApiModelProperty(value = "监督类型",required = true) + @NotBlank(message = "监督类型不可为空") + private String supvType; + + /** + * 监督阶段 + */ + @ApiModelProperty(value = "监督阶段",required = true) + @NotBlank(message = "监督阶段不可为空") + private String supvStage; + + /** + * 计划监督时间 + */ + @ApiModelProperty(value = "计划监督时间",required = true) + @NotNull(message = "计划监督时间不可为空") + private String planSupvDate; + + /** + * 监督对象名称 + */ + @ApiModelProperty(value = "监督对象名称") + private String supvObjName; + + /** + * 监督对象类型 + */ + @ApiModelProperty(value = "对象类型") + private String supvObjType; + + /** + * 监督对象电压等级 + */ + @ApiModelProperty(value = "对象电压等级") + private String objVoltageLevel; + + /** + * 关联电站 + */ + @ApiModelProperty(value = "关联电站") + private String substationName; + + @ApiModelProperty(value = "关联电站电压等级") + private String substationVoltageLevel; + + + @ApiModelProperty(value = "监督对象属性") + private String objType; + + @ApiModelProperty(value = "监督对象属性名称") + private String objTypeName; + + @ApiModelProperty(value = "监督对象协议容量(MVA)") + private Double objCapacity; + + /** + * 计划执行开始时间 + */ + @ApiModelProperty(value = "计划执行开始时间",required = true) + @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss",message = "计划执行开始时间格式有误") + private String effectStartTime; + + /** + * 计划执行结束时间 + */ + @ApiModelProperty(value = "计划执行结束时间",required = true) + @DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss",message = "计划执行结束时间格式有误") + private String effectEndTime; + + /** + * 报告出具时间 + */ + @ApiModelProperty(value = "报告出具时间",required = true) + @DateTimeStrValid(message = "报告出具时间格式有误",format = "yyyy-MM-dd HH:mm:ss") + private String reportIssueTime; + + /** + * 电能质量问题发生时间 + */ + @ApiModelProperty(value = "电能质量问题发生时间",required = true) + @DateTimeStrValid(message = "电能质量问题发生时间格式有误",format = "yyyy-MM-dd HH:mm:ss") + private String problemOcTime; + + /** + * 备注 + */ + @ApiModelProperty(value = "备注(其他要求)") + private String otherRemark; + + + /** + * 计划编制单位id + */ + @ApiModelProperty(value = "计划编制单位id") + @NotBlank(message = "计划编制单位id不可为空") + private String planOrgId; + + @ApiModelProperty(value = "实施状态") + private String effectStatus; + + @ApiModelProperty(value = "实施人") + private String effectUserId; + + @ApiModelProperty(value = "计划状态") + private String planStatus; + + @EqualsAndHashCode(callSuper = true) + @Data + public static class UpdateSupvPlanParam extends SupervisionPlanParam{ + + @ApiModelProperty(value = "索引",required = true) + @NotBlank(message = "计划索引不可为空") + private String planId; + + @ApiModelProperty("其他要求") + private String otherRemarkHis; + + @ApiModelProperty("调整原因") + private String applyCommentHis; + } + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisopnProblemParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisopnProblemParam.java new file mode 100644 index 000000000..eed567238 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/plan/SupervisopnProblemParam.java @@ -0,0 +1,157 @@ +package com.njcn.supervision.pojo.param.plan; + +import com.njcn.web.pojo.annotation.DateTimeStrValid; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + *

+ * + *

+ * + * @author hongawen + * @since 2023-06-21 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class SupervisopnProblemParam extends BaseParam { + + + + /** + * 关联计划表 + */ + @ApiModelProperty(value = "关联计划表id",required = true) + @NotBlank(message = "关联计划表不可为空") + private String planId; + + /** + * 责任单位id,取ISC平台上的组织id + */ + @ApiModelProperty(value = "责任单位id,取ISC平台上的组织id",required = true) + @NotBlank(message = "责任单位id不可为空") + private String dutyOrgId; + + /** + * 监测点类型 ,仅供电电压监督计划必填 + */ + @ApiModelProperty(value = "监测点类型 ,仅供电电压监督计划必填") + private String monitorType; + + /** + * 整改时间 + */ + @ApiModelProperty(value = "整改时间",required = true) + private String rectificationTime; + + /** + * 计划整改时间 + */ + @ApiModelProperty(value = "计划整改时间",required = true) + @NotNull(message = "计划整改时间不可为空") + private String planRectificationTime; + + /** + * 是否发布预告警 + */ + @ApiModelProperty(value = "是否发布预告警",required = true) + @NotNull(message = "是否发布预告警不可为空") + private Integer ifReleaseWarning; + + /** + * 问题描述 + */ + @ApiModelProperty(value = "问题简要描述") + @NotBlank(message = "问题简要描述不可为空") + private String simpleProblemDesc; + + + + /** + * 监督标准序号 + */ + @ApiModelProperty(value = "监督标准序号") + @NotBlank(message = "监督标准序号不可为空") + private String supvStandardSort; + + /** + * 问题描述 + */ + @ApiModelProperty(value = "问题描述") + @NotBlank(message = "问题描述不可为空") + private String problemDesc; + + /** + * 监督标准 + */ + @ApiModelProperty(value = "监督标准",required = true) + @NotBlank(message = "监督标准不可为空") + private String supvStandard; + + /** + * 标准出处 + */ + @ApiModelProperty(value = "标准出处",required = true) + @NotBlank(message = "标准出处不可为空") + private String supvResouce; + + /** + * 问题等级 01 一般,02 较大 + */ + @ApiModelProperty(value = "问题等级",required = true) + @NotBlank(message = "问题等级不可为空") + private String problemLevel; + + /** + * 定级依据 + */ + @ApiModelProperty(value = "定级依据",required = true) + @NotBlank(message = "定级依据不可为空") + private String problemLevelReason; + + /** + * 问题类型 + */ + @ApiModelProperty(value = "问题类型",required = true) + @NotBlank(message = "问题类型不可为空") + private String problemType; + + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 整改方案 + */ + @ApiModelProperty(value = "整改方案",required = true) + @NotBlank(message = "整改方案不可为空") + private String rectificationProgramme; + + @ApiModelProperty(value = "整改措施") + private String rectificationMeasure; + + /** + * 整改情况01已整改,02未整改 + */ + @ApiModelProperty(value = "整改情况",required = true) + @NotBlank(message = "整改情况不可为空") + private String rectificationStatus; + + @NotBlank(message = "问题发现时间") + @DateTimeStrValid(format="yyyy-MM-dd HH:mm:ss",message = "问题发现时间格式有误") + private String discoveryTime; + + @EqualsAndHashCode(callSuper = true) + @Data + public static class UpdateSupvProblemParam extends SupervisopnProblemParam{ + + @ApiModelProperty(value = "索引",required = true) + @NotBlank(message = "问题索引不可为空") + private String problemId; + } + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportNormalParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportNormalParam.java new file mode 100644 index 000000000..f617ae929 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportNormalParam.java @@ -0,0 +1,58 @@ +package com.njcn.supervision.pojo.param.user; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import com.njcn.web.pojo.param.BaseParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 干扰源用户常态化管理 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +@Getter +@Setter +public class UserReportNormalParam extends BaseParam { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 关联干扰源用户表 + */ + private String userReportId; + + /** + * 类型0:方案审查 1:治理工程 + */ + private Integer type; + + /** + * 报告存放路径 + */ + private String reportUrl; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + private String status; + + + @ApiModelProperty("发起人自选审批人 Map") + private Map> startUserSelectAssignees; + + + + + + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineDebugPO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineDebugPO.java new file mode 100644 index 000000000..fff03c4f1 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineDebugPO.java @@ -0,0 +1,56 @@ +package com.njcn.supervision.pojo.po.device; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * Description: + * Date: 2024/5/17 15:26【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "supervision_temp_line_debug") +public class SupervisionTempLineDebugPO extends BaseEntity { + @TableId(value = "id", type = IdType.INPUT) + private String id; + + /** + * 调试原因 + */ + @TableField(value = "reason") + @ApiModelProperty(value="调试原因") + private String reason; + + /** + * 流程实例的编号 + */ + @TableField(value = "process_instance_id") + @ApiModelProperty(value="流程实例的编号") + private String processInstanceId; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + @TableField(value = "`status`") + @ApiModelProperty(value="1:审批中;2:审批通过;3:审批不通过;4:已取消") + private Integer status; + + /** + * 状态:0-删除 1-正常 + */ + @TableField(value = "`State`") + @ApiModelProperty(value="状态:0-删除 1-正常") + private Integer state; +} \ No newline at end of file diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineRunTest.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineRunTest.java new file mode 100644 index 000000000..52f3ffb30 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/device/SupervisionTempLineRunTest.java @@ -0,0 +1,63 @@ +package com.njcn.supervision.pojo.po.device; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Getter +@Setter +@TableName("supervision_temp_line_run_test") +public class SupervisionTempLineRunTest extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 流程实例的编号 + */ + private String processInstanceId; + + /** + * 在线率 + */ + private Float onlineRate; + + /** + * 数据完整性 + */ + private Float integrityRate; + + /** + * 数据符合性 + */ + private Float suitRate; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + private Integer status; + + /** + * 状态:0-删除 1-正常 + */ + private Integer state; + + /** + * 0:未试运行 1:试运行中 2.试运行成功 3.试运行异常 + */ + private Integer testRunState; + + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/leaflet/WarningLeaflet.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/leaflet/WarningLeaflet.java new file mode 100644 index 000000000..6dae0b84b --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/leaflet/WarningLeaflet.java @@ -0,0 +1,90 @@ +package com.njcn.supervision.pojo.po.leaflet; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import java.io.Serializable; +import java.time.LocalDateTime; + +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 预告警单表 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Data +@TableName("supervision_warning_leaflet") +public class WarningLeaflet extends BaseEntity implements Serializable{ + + private static final long serialVersionUID = 1L; + + /** + * 预告警单 + */ + private String id; + + /** + * 预告警单名称 + */ + private String leafletName; + + /** + * 预告警编号,目前阶段不做配置 + */ + private String leafletNo; + + /** + * 1:技术监督管理;2:在线监测超标问题;3:用户投诉;4:现场测试超标 + */ + private Integer problemType; + + /** + * 对应问题源ID,用于查询详细信息 + */ + private String problemId; + + /** + * 单子类型:1:预警单;2:告警单 + */ + private Integer leafletType; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消;5:待反馈 + */ + private Integer status; + + /** + * 流程实例的编号 + */ + private String processInstanceId; + + /** + * 问题详细描述 + */ + private String issueDetail; + + + /** + * 采取措施 + */ + private String takeStep; + + + /** + * 处理成效报告 + */ + private String reportPath; + + + /** + * 状态:0-删除 1-正常 + */ + private Integer state; + + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionPlanPO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionPlanPO.java new file mode 100644 index 000000000..9e619d11b --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionPlanPO.java @@ -0,0 +1,236 @@ +package com.njcn.supervision.pojo.po.plan; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * + * Description: + * Date: 2024/5/20 17:49【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "supervision_plan") +public class SupervisionPlanPO extends BaseEntity { + + @TableId(value = "plan_Id", type = IdType.ASSIGN_UUID) + private String planId; + + + @TableField(exist = false) + private String provinceId; + + @TableField(exist = false) + private String provinceName; + + @TableField(exist = false) + private String cityId; + + @TableField(exist = false) + private String cityName; + + @TableField(exist = false) + private String countyId; + + @TableField(exist = false) + private String countyName; + + @TableField(exist = false) + private String supvObjId; + + @TableField(exist = false) + private String objVoltageLevelName; + + /** + * 计划名称 + */ + @TableField(value = "work_plan_name") + private String workPlanName; + + /** + * 监督类型 + */ + @TableField(value = "supv_Type") + private String supvType; + + /** + * 监督阶段 + */ + @TableField(value = "supv_Stage") + private String supvStage; + + /** + * 监督单位 + */ + @TableField(value = "supv_Org_Id") + private String supvOrgId; + + /** + * 计划编制人id + */ + @TableField(value = "plan_User_Id") + private String planUserId; + + /** + * 计划编制单位id + */ + @TableField(value = "plan_Org_Id") + private String planOrgId; + + /** + * 备注 + */ + @TableField(value = "other_Remark") + private String otherRemark; + + /** + * 计划执行开始时间 + */ + @TableField(value = "effect_Start_Time") + private LocalDateTime effectStartTime; + + /** + * 计划执行结束时间 + */ + @TableField(value = "effect_End_Time") + private LocalDateTime effectEndTime; + + /** + * 实施状态 + */ + @TableField(value = "effect_Status") + private String effectStatus; + + /** + * 计划监督时间 + */ + @TableField(value = "plan_Supv_Date") + private LocalDateTime planSupvDate; + + /** + * 对象类型 + */ + @TableField(value = "supv_Obj_Type") + private String supvObjType; + + /** + * 监督对象名称 + */ + @TableField(value = "supv_Obj_Name") + private String supvObjName; + + /** + * 对象电压等级 + */ + @TableField(value = "obj_Voltage_Level") + private String objVoltageLevel; + + /** + * 关联电站 + */ + @TableField(value = "substation_Name") + private String substationName; + + /** + * 关联电站电压等级 + */ + @TableField(value = "substation_Voltage_Level") + private String substationVoltageLevel; + + /** + * 监督对象属性 01 在运站 02 新(改、扩)建站,仅新能源场站监督计划必填 + */ + @TableField(value = "obj_Type") + private String objType; + + /** + * 监督对象属性名称 仅新能源场站监督计划必填 + */ + @TableField(value = "obj_Type_Name") + private String objTypeName; + + /** + * 监督对象协议容量(MVA) 新能源场站、敏感用户监督计划必填 + */ + @TableField(value = "obj_Capacity") + private Double objCapacity; + + /** + * 报告出具时间 + */ + @TableField(value = "report_Issue_Time") + private LocalDateTime reportIssueTime; + + /** + * 电能质量问题发生时间 + */ + @TableField(value = "problem_Oc_Time") + private LocalDateTime problemOcTime; + + /** + * 删除标识 0否1是 + */ + @TableField(value = "delete_Flag") + private String deleteFlag; + + /** + * 计划状态 1新建2变更 3取消 + */ + @TableField(value = "plan_Status") + private String planStatus; + + /** + * 删除时间 + */ + @TableField(value = "delete_Time") + private LocalDateTime deleteTime; + + /** + * 实施人id + */ + @TableField(value = "effect_User_Id") + private String effectUserId; + + /** + * 实施人姓名 + */ + @TableField(value = "effect_User_Name") + private String effectUserName; + + /** + * 0.未上送 1.上送 2.取消上送 3.待重新上送 + */ + @TableField(value = "is_upload_head") + private Integer isUploadHead; + + /** + * 流程实例的编号 + */ + @TableField(value = "process_instance_id") + private String processInstanceId; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + @TableField(value = "`status`") + private Integer status; + + + /** + * 状态:0-删除 1-正常 + */ + @TableField(value = "`State`") + private Integer state; +} \ No newline at end of file diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionProblemPO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionProblemPO.java new file mode 100644 index 000000000..06fff15ca --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/plan/SupervisionProblemPO.java @@ -0,0 +1,159 @@ +package com.njcn.supervision.pojo.po.plan; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * + * Description: + * Date: 2024/5/20 19:50【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@ApiModel(description="") +@Data +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "supervision_problem") +public class SupervisionProblemPO extends BaseEntity { + @TableId(value = "problem_Id", type = IdType.ASSIGN_UUID) + private String problemId; + + /** + * 关联计划表 + */ + @TableField(value = "plan_id") + private String planId; + + /** + * 所属网省id + */ + @TableField(exist = false) + private String provinceId; + + /** + * 责任单位id,取ISC平台上的组织id + */ + @TableField(value = "duty_Org_Id") + private String dutyOrgId; + + @TableField(exist = false) + private String dutyOrgName; + + /** + * 监测点类型 ,仅供电电压监督计划必填 + */ + @TableField(value = "monitor_Type") + private String monitorType; + + /** + * 整改时间 + */ + @TableField(value = "rectification_Time") + private LocalDateTime rectificationTime; + + /** + * 计划整改时间 + */ + @TableField(value = "plan_Rectification_Time") + private LocalDateTime planRectificationTime; + + /** + * 是否发布预告警 + */ + @TableField(value = "if_Release_Warning") + private Boolean ifReleaseWarning; + + @TableField(value = "problem_Desc") + private String problemDesc; + + /** + * 问题描述 + */ + @TableField(value = "simple_Problem_Desc") + private String simpleProblemDesc; + + @TableField(value = "supv_Standard_Sort") + private String supvStandardSort; + + /** + * 监督标准 + */ + @TableField(value = "supv_Standard") + private String supvStandard; + + /** + * 标准出处 + */ + @TableField(value = "supv_Resouce") + private String supvResouce; + + /** + * 问题等级 01 一般,02 较大 + */ + @TableField(value = "problem_Level") + private String problemLevel; + + /** + * 定级依据 + */ + @TableField(value = "problem_Level_Reason") + private String problemLevelReason; + + /** + * 问题类型 + */ + @TableField(value = "problem_Type") + private String problemType; + + /** + * 整改方案 + */ + @TableField(value = "rectification_Programme") + private String rectificationProgramme; + + /** + * 整改措施 + */ + @TableField(value = "rectification_Measure") + private String rectificationMeasure; + + /** + * 整改情况, 01已整改,02未整改 + */ + @TableField(value = "rectification_Status") + private String rectificationStatus; + + /** + * 是否上送国网 0.未上送 1.上送 + */ + @TableField(value = "is_Upload_Head") + private Boolean isUploadHead; + + /** + * 问题发现时间 + */ + @TableField(value = "discovery_Time") + private LocalDateTime discoveryTime; + + @TableField(value = "remark") + private String remark; + + @TableField(exist = false) + private String attachmentName; + + + @TableField(exist = false) + private String attachmentNameTwo; + +} \ No newline at end of file diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SupervisionGeneralSurveyPlanDetailPO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SupervisionGeneralSurveyPlanDetailPO.java index dca8c8362..dd38b47b9 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SupervisionGeneralSurveyPlanDetailPO.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SupervisionGeneralSurveyPlanDetailPO.java @@ -79,6 +79,14 @@ public class SupervisionGeneralSurveyPlanDetailPO extends BaseEntity { @TableField(value = "is_survey") @ApiModelProperty(value="是否实现监测(0:否 1:是)") private Integer isSurvey; + + /** + * 存在问题的普测变电站是否发起告警单,0:否,1:是 + */ + @TableField(value = "initiate_warning_flag") + @ApiModelProperty(value="是否发起告警单") + private Integer initiateWarningFlag; + /** * 状态:0-删除 1-正常 */ diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/user/UserReportNormalPO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/user/UserReportNormalPO.java new file mode 100644 index 000000000..0693d9d7c --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/user/UserReportNormalPO.java @@ -0,0 +1,51 @@ +package com.njcn.supervision.pojo.po.user; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Getter; +import lombok.Setter; + +/** + *

+ * 干扰源用户常态化管理 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +@Getter +@Setter +@TableName("supervision_user_report_normal") +public class UserReportNormalPO extends BaseEntity { + + private static final long serialVersionUID = 1L; + + private String id; + + /** + * 关联干扰源用户表 + */ + private String userReportId; + + /** + * 类型0:方案审查 1:治理工程 + */ + private Boolean type; + + /** + * 报告存放路径 + */ + private String reportUrl; + + private String processInstanceId; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消 + */ + private Integer status; + + private Integer state; + + + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineDebugVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineDebugVO.java new file mode 100644 index 000000000..859396d17 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineDebugVO.java @@ -0,0 +1,32 @@ +package com.njcn.supervision.pojo.vo.device; + +import com.njcn.db.bo.BaseEntity; +import lombok.Data; + +/** + * Description: + * Date: 2024/5/20 10:32【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +public class SupervisionTempLineDebugVO extends BaseEntity { + + private String id; + private String lineId; + private String lineName; + private String userName; + private String connectedBus; + private String monitoringTerminalCode; + private String monitoringTerminalName; + private String powerSubstationName; + private String reason; + private String processInstanceId; + + private Integer status; + /** + * 0:未试运行 1:试运行中 2.试运行成功 3.试运行异常 + */ + private Integer testRunState; +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineReportVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineReportVO.java index 877005dcc..9e22c5e44 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineReportVO.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/device/SupervisionTempLineReportVO.java @@ -215,6 +215,14 @@ public class SupervisionTempLineReportVO { @ApiModelProperty(value="电压偏差下限") private Float voltageDeviationLowerLimit; + /** + * 流程实例的编号 + */ + + @ApiModelProperty(value = "流程实例的编号") + private String processInstanceId; + + /** * 1:审批中;2:审批通过;3:审批不通过;4:已取消 */ diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/leaflet/WarningLeafletVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/leaflet/WarningLeafletVO.java new file mode 100644 index 000000000..1545f3854 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/leaflet/WarningLeafletVO.java @@ -0,0 +1,78 @@ +package com.njcn.supervision.pojo.vo.leaflet; + +import com.njcn.db.bo.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 预告警单表 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Data +public class WarningLeafletVO extends BaseEntity implements Serializable{ + + private static final long serialVersionUID = 1L; + + /** + * 预告警单 + */ + private String id; + + /** + * 预告警单名称 + */ + private String leafletName; + + /** + * 预告警编号,目前阶段不做配置 + */ + private String leafletNo; + + /** + * 1:技术监督管理;2:在线监测超标问题;3:用户投诉;4:现场测试超标 + */ + private Integer problemType; + + /** + * 对应问题源ID,用于查询详细信息 + */ + private String problemId; + + /** + * 单子类型:1:预警单;2:告警单 + */ + private Integer leafletType; + + /** + * 1:审批中;2:审批通过;3:审批不通过;4:已取消;5:待反馈 + */ + private Integer status; + + /** + * 采取措施 + */ + private String takeStep; + + + /** + * 处理成效报告 + */ + private String reportPath; + + /** + * 流程实例的编号 + */ + private String processInstanceId; + + /** + * 问题详细描述 + */ + private String issueDetail; + +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/plan/SupervisionPlanVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/plan/SupervisionPlanVO.java new file mode 100644 index 000000000..129eba016 --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/plan/SupervisionPlanVO.java @@ -0,0 +1,183 @@ +package com.njcn.supervision.pojo.vo.plan; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * pqs + * + * @author cdf + * @date 2023/6/25 + */ +@Data +public class SupervisionPlanVO { + + @ApiModelProperty(value = "索引",required = true) + private String planId; + + /** + * 计划名称 + */ + @ApiModelProperty(value = "计划名称",required = true) + private String workPlanName; + + /** + * 监督单位 + */ + @ApiModelProperty(value = "监督单位",required = true) + private String supvOrgId; + + @ApiModelProperty(value = "监督单位名称",required = true) + private String supvOrgName; + + /** + * 计划编制单位id + */ + @ApiModelProperty(value = "计划编制单位id") + private String planOrgId; + + /** + * 计划编制单位名字 + */ + @ApiModelProperty(value = "计划编制单位名字") + private String planOrgName; + + + private String planUserId; + + private String planUserName; + + /** + * 监督类型 + */ + @ApiModelProperty(value = "监督类型",required = true) + private String supvType; + + /** + * 监督阶段 + */ + @ApiModelProperty(value = "监督阶段",required = true) + private String supvStage; + + /** + * 计划监督时间 + */ + @ApiModelProperty(value = "计划监督时间",required = true) + @JsonFormat(pattern = "yyyy-MM") + private String planSupvDate; + + /** + * 监督对象名称 + */ + @ApiModelProperty(value = "监督对象名称") + private String supvObjName; + + /** + * 对象类型 + */ + @ApiModelProperty(value = "对象类型") + private String supvObjType; + + /** + * 对象电压等级 + */ + @ApiModelProperty(value = "对象电压等级") + private String objVoltageLevel; + + /** + * 关联电站 + */ + @ApiModelProperty(value = "关联电站") + private String substationName; + + @ApiModelProperty(value = "关联电站电压等级") + private String substationVoltageLevel; + + @ApiModelProperty(value = "监督对象属性") + private String objType; + + @ApiModelProperty(value = "监督对象属性名称") + private String objTypeName; + + @ApiModelProperty(value = "监督对象协议容量(MVA)") + private Double objCapacity; + + /** + * 计划执行开始时间 + */ + @ApiModelProperty(value = "计划执行开始时间",required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime effectStartTime; + + /** + * 计划执行结束时间 + */ + @ApiModelProperty(value = "计划执行结束时间",required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime effectEndTime; + + /** + * 报告出具时间 + */ + @ApiModelProperty(value = "报告出具时间",required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime reportIssueTime; + + /** + * 电能质量问题发生时间 + */ + @ApiModelProperty(value = "电能质量问题发生时间",required = true) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime problemOcTime; + + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String otherRemark; + + @ApiModelProperty(value = "省部门") + private String province; + + @ApiModelProperty(value = "市部门") + private String city; + + @ApiModelProperty(value = "县部门") + private String county; + + + @ApiModelProperty(value = "附件名称") + private String attachmentName; + + /** + * 0.未上送 1.上送 2.取消上送 + */ + @ApiModelProperty(value = "0.未上送 1.上送 2.取消上送") + private Integer isUploadHead; + + private String createBy; + + private String updateBy; + + /** + * 实施状态 + */ + private String effectStatus; + /** + * 实施人id + */ + private String effectUserId; + /** + * 实施人姓名 + */ + private String effectUserName; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @ApiModelProperty(value = "计划状态") + private String planStatus; +} diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SupervisionGeneralSurveyPlanDetailVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SupervisionGeneralSurveyPlanDetailVO.java new file mode 100644 index 000000000..b677aecad --- /dev/null +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SupervisionGeneralSurveyPlanDetailVO.java @@ -0,0 +1,117 @@ +package com.njcn.supervision.pojo.vo.survey; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; +import com.njcn.db.bo.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; + +/** + * + * Description: + * Date: 2024/5/13 18:35【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +public class SupervisionGeneralSurveyPlanDetailVO extends BaseEntity { + /** + * 普测计划编号 + */ + @MppMultiId(value = "plan_no") + private String planNo; + + @ApiModelProperty(value="单位Id") + private String orgNo; + + @ApiModelProperty(value="单位名称") + private String orgName; + + /** + * 普测计划名称 + */ + @ApiModelProperty(value="普测计划名称") + private String planName; + + /** + * 计划生成时间 + */ + @ApiModelProperty(value="计划生成时间") + private LocalDate planCreateTime; + + /** + * 计划开始时间 + */ + @ApiModelProperty(value="计划开始时间") + private LocalDate planStartTime; + + /** + * 计划结束时间 + */ + @ApiModelProperty(value="计划结束时间") + private LocalDate planEndTime; + + /** + * 实际完成时间 + */ + @ApiModelProperty(value="实际完成时间") + private LocalDate planComplateTime; + + /** + * 计划负责人 + */ + @ApiModelProperty(value="计划负责人") + private String leader; + + + /** + * 变电站ID + */ + @MppMultiId(value = "sub_id") + private String subId; + + /** + * 变电站名称 + */ + @TableField(value = "sub_name") + @ApiModelProperty(value="变电站名称") + private String subName; + + /** + * 变电站电压等级 + */ + @TableField(value = "voltage_level") + @ApiModelProperty(value="变电站电压等级") + private String voltageLevel; + + + /** + * 是否生成问题(0:否 1:是) + */ + @TableField(value = "is_problem") + @ApiModelProperty(value="是否生成问题(0:否 1:是)") + private Integer isProblem; + + /** + * 文件路径 + */ + @ApiModelProperty(value="文件路径") + private String filePath; + + + /** + * 是否发起告警单 + */ + @ApiModelProperty(value="是否发起告警单") + private Integer initiateWarningFlag; + + + +} \ No newline at end of file diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/UserReportVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/UserReportVO.java index f26e859d6..41df2d8ac 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/UserReportVO.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/user/UserReportVO.java @@ -12,12 +12,13 @@ import com.njcn.supervision.pojo.po.user.UserReportSensitivePO; import com.njcn.supervision.pojo.po.user.UserReportSubstationPO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import lombok.EqualsAndHashCode; import java.time.LocalDate; import java.time.LocalDateTime; /** - * + * * Description: * Date: 2024/4/25 10:07【需求编号】 * @@ -33,6 +34,9 @@ public class UserReportVO { @ApiModelProperty(value = "填报人") private String reporter; + @ApiModelProperty(value = "填报人名称") + private String reporterName; + /** * 填报日期 */ @@ -141,4 +145,18 @@ public class UserReportVO { private UserReportSensitivePO userReportSensitivePO; private UserReportSubstationPO userReportSubstationPO; -} \ No newline at end of file + + + + @Data + @EqualsAndHashCode(callSuper = true) + public static class UserReportGoNetVO extends UserReportVO{ + /** + * 入网评估报告和治理报告的文件路径名 + */ + @ApiModelProperty(value = "入网评估报告和治理报告的文件路径名") + private String otherReport; + + private String userReportId; + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/DeVReportManageController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/DeVReportManageController.java index 374d599fb..08c09f3e8 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/DeVReportManageController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/DeVReportManageController.java @@ -120,4 +120,5 @@ public class DeVReportManageController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe); } + } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/SupervisionTempLineRunTestController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/SupervisionTempLineRunTestController.java new file mode 100644 index 000000000..d75566750 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/SupervisionTempLineRunTestController.java @@ -0,0 +1,27 @@ +package com.njcn.supervision.controller.device; + + +import com.njcn.supervision.service.device.ISupervisionTempLineRunTestService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import com.njcn.web.controller.BaseController; + +/** + *

+ * 前端控制器 + *

+ * + * @author cdf + * @since 2024-05-21 + */ +@RestController +@RequestMapping("/supervisionTempLineRunTest") +@RequiredArgsConstructor +public class SupervisionTempLineRunTestController extends BaseController { + + private final ISupervisionTempLineRunTestService iSupervisionTempLineRunTestService; + +} + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineController.java index 08928bf62..90f9314ce 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineController.java @@ -59,6 +59,15 @@ public class TempLineController extends BaseController { Page out = supervisionTempLineReportService.getTempLineReport(supervisionTempLineReportQuery); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getDetail") + @ApiOperation("查询详情") + public HttpResult getDetailTempLine(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("getDetailTempLine"); + SupervisionTempLineReportVO out = supervisionTempLineReportService.getDetailTempLine(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } @GetMapping("/updateStatus") @OperateInfo(info = LogEnum.BUSINESS_COMMON) @Operation(summary = "更改表单状态") diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineDebugController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineDebugController.java new file mode 100644 index 000000000..ba9e2838b --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/device/TempLineDebugController.java @@ -0,0 +1,100 @@ +package com.njcn.supervision.controller.device; + +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.supervision.pojo.param.device.SupervisionTempLineDebugParam; +import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO; +import com.njcn.supervision.service.device.SupervisionTempLineDebugPOService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 干扰源用户管理 + * + * @author qijian + * @version 1.0.0 + * @createTime 2022/11/11 - 9:20 + */ +@Slf4j +@RestController +@RequestMapping("/tempLinedebug") +@Api(tags = "临时监测点调试管理") +@AllArgsConstructor +public class TempLineDebugController extends BaseController { + + + private final SupervisionTempLineDebugPOService supervisionTempLineDebugPOService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.ADD) + @PostMapping("/add") + @ApiOperation("新增临时监测点调试管理") + @ApiImplicitParam(name = "supervisionTempLineReportParam", value = "实体参数", required = true) + public HttpResult addTempLineDebug(@RequestBody @Validated SupervisionTempLineDebugParam supervisionTempLineReportParam){ + String methodDescribe = getMethodDescribe("addTempLineDebug"); + String tempLineId = supervisionTempLineDebugPOService.addTempLineDebug(supervisionTempLineReportParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, tempLineId, methodDescribe); + + } + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/list") + @ApiOperation("查询联调监测点") + @ApiImplicitParam(name = "supervisionTempLineDebugQuery", value = "参数", required = true) + public HttpResult> getTempLineDeug(@RequestBody @Validated SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) { + String methodDescribe = getMethodDescribe("getTempLineDeug"); + Page out = supervisionTempLineDebugPOService.getTempLineDeug(supervisionTempLineDebugQuery); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/pageHasDebug") + @ApiOperation("查询已完成联调监测点") + @ApiImplicitParam(name = "supervisionTempLineDebugQuery", value = "参数", required = true) + public HttpResult> pageHasDebug(@RequestBody @Validated SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) { + String methodDescribe = getMethodDescribe("pageHasDebug"); + Page out = supervisionTempLineDebugPOService.pageHasDebug(supervisionTempLineDebugQuery); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getDetail") + @ApiOperation("查询详情") + public HttpResult getDetailTempLine(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("getDetailTempLine"); + SupervisionTempLineDebugVO out = supervisionTempLineDebugPOService.getDetailTempLineDebug(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + @GetMapping("/updateStatus") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @Operation(summary = "更改表单状态") + public HttpResult updateStatus(String businessKey,Integer status) { + String methodDescribe = getMethodDescribe("updateStatus"); + supervisionTempLineDebugPOService.updateStatus(businessKey,status); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } +// +// @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) +// @PostMapping("/cancel") +// @ApiOperation("取消设备录入") +// @ApiImplicitParam(name = "cancelReqVO", value = "取消原因", required = true) +// public HttpResult cancelTempLineReport(@Validated @RequestBody BpmProcessInstanceCancelParam cancelReqVO) { +// String methodDescribe = getMethodDescribe("cancelTempLineReport"); +// String id = supervisionTempLineReportService.cancelTempLineReport(cancelReqVO); +// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, id, methodDescribe); +// } + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/leaflet/WarningLeafletController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/leaflet/WarningLeafletController.java new file mode 100644 index 000000000..bab303148 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/leaflet/WarningLeafletController.java @@ -0,0 +1,65 @@ +package com.njcn.supervision.controller.leaflet; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.supervision.pojo.vo.leaflet.WarningLeafletVO; +import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam; +import com.njcn.supervision.service.leaflet.IWarningLeafletService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import com.njcn.web.controller.BaseController; + +/** + *

+ * 预告警单表 前端控制器 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@RestController +@RequestMapping("/warningLeaflet") +@Slf4j +@Api(tags = "预告警单表") +@AllArgsConstructor +public class WarningLeafletController extends BaseController { + + private final IWarningLeafletService warningLeafletService; + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/warningPageData") + @ApiOperation("分页查询当前用户能看到的预警单数据") + @ApiImplicitParam(name = "warningLeafletQueryParam", value = "参数", required = true) + public HttpResult> warningPageData(@RequestBody @Validated WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) { + String methodDescribe = getMethodDescribe("warningPageData"); + Page out = warningLeafletService.warningPageData(warningLeafletQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/alarmPageData") + @ApiOperation("分页查询当前用户能看到的告警单数据") + @ApiImplicitParam(name = "warningLeafletQueryParam", value = "参数", required = true) + public HttpResult> alarmPageData(@RequestBody @Validated WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) { + String methodDescribe = getMethodDescribe("alarmPageData"); + Page out = warningLeafletService.alarmPageData(warningLeafletQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + +} + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionPlanController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionPlanController.java new file mode 100644 index 000000000..826cc4fa7 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionPlanController.java @@ -0,0 +1,87 @@ +package com.njcn.supervision.controller.plan; + +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.supervision.pojo.param.plan.SupervisionPlanParam; +import com.njcn.supervision.pojo.vo.plan.SupervisionPlanVO; +import com.njcn.supervision.service.plan.SupervisionPlanPOService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 干扰源用户管理 + * + * @author qijian + * @version 1.0.0 + * @createTime 2022/11/11 - 9:20 + */ +@Slf4j +@RestController +@RequestMapping("/superPlan") +@Api(tags = "技术监督计划") +@AllArgsConstructor +public class SupervisionPlanController extends BaseController { + + + private final SupervisionPlanPOService supervisionPlanPOService; + + @PostMapping("addPlan") + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @ApiOperation("新增技术监督计划") + @ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true) + public HttpResult addPlan(@RequestBody @Validated SupervisionPlanParam supvPlanParam){ + String methodDescribe = getMethodDescribe("addPlan"); + String id = supervisionPlanPOService.addPlan(supvPlanParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, id, methodDescribe); + } + + + @PostMapping("pagePlan") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("分页查询监督计划") + @ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true) + public HttpResult> pagePlan(@RequestBody SupervisionPlanParam supvPlanParam){ + String methodDescribe = getMethodDescribe("pagePlan"); + Page page = supervisionPlanPOService.pagePlan(supvPlanParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/initiateAudit") + @ApiOperation("发起审核") + public HttpResult initiateAudit(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("initiateAudit"); + String processId = supervisionPlanPOService.initiateAudit(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, processId, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getDetail") + @ApiOperation("查询详情") + public HttpResult getDetailPlan(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("getDetailPlan"); + SupervisionPlanVO out = supervisionPlanPOService.getDetailPlan(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + @GetMapping("/updateStatus") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @Operation(summary = "更改表单状态") + public HttpResult updateStatus(String businessKey,Integer status) { + String methodDescribe = getMethodDescribe("updateStatus"); + supervisionPlanPOService.updateStatus(businessKey,status); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionProblemController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionProblemController.java new file mode 100644 index 000000000..55f0719eb --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/plan/SupervisionProblemController.java @@ -0,0 +1,71 @@ +package com.njcn.supervision.controller.plan; + +import cn.hutool.core.util.StrUtil; +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.exception.BusinessException; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.common.utils.HttpResultUtil; +import com.njcn.supervision.pojo.param.plan.SupervisopnProblemParam; +import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO; +import com.njcn.supervision.service.plan.SupervisionProblemPOService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 干扰源用户管理 + * + * @author qijian + * @version 1.0.0 + * @createTime 2022/11/11 - 9:20 + */ +@Slf4j +@RestController +@RequestMapping("/superProblem") +@Api(tags = "技术监督计划问题") +@AllArgsConstructor +public class SupervisionProblemController extends BaseController { + + + private final SupervisionProblemPOService supervisionProblemPOService; + + @PostMapping("addProblem") + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @ApiOperation("新增技术监督问题") + @ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true) + public HttpResult addProblem(@RequestBody @Validated SupervisopnProblemParam supvProblemParam){ + String methodDescribe = getMethodDescribe("addProblem"); + supervisionProblemPOService.addProblem(supvProblemParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + + @PostMapping("pageProblem") + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("分页查询监督问题") + @ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true) + public HttpResult> pageProblem(@RequestBody SupervisopnProblemParam supvProblemParam){ + String methodDescribe = getMethodDescribe("pageProblem"); + if(StrUtil.isBlank(supvProblemParam.getPlanId())){ + throw new BusinessException("监督计划索引不可为空"); + } + Page page = supervisionProblemPOService.pageProblem(supvProblemParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe); + } + + + + + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/GeneralSurveyController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/GeneralSurveyController.java index 09e6300e6..147bd445e 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/GeneralSurveyController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/GeneralSurveyController.java @@ -10,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; import com.njcn.supervision.pojo.param.survey.SupervisionGeneralSurveyPlanParm; import com.njcn.supervision.pojo.vo.survey.DeptSubstationVO; +import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanDetailVO; import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO; import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanPOService; import com.njcn.web.controller.BaseController; @@ -25,7 +26,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; /** - * 干扰源用户管理 + * 谐波普测计划 * * @author qijian * @version 1.0.0 @@ -64,7 +65,6 @@ public class GeneralSurveyController extends BaseController { } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/removeSurvey") @ApiOperation("移除普测计划") @@ -112,7 +112,7 @@ public class GeneralSurveyController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } - @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE) @PostMapping("/cancel") @ApiOperation("取消普测计划") @ApiImplicitParam(name = "cancelReqVO", value = "取消原因", required = true) @@ -123,4 +123,25 @@ public class GeneralSurveyController extends BaseController { } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/pageProblemSubstationBySurvey") + @ApiOperation("分页查询当前用户能看到的普测计划中存在超标问题") + @ApiImplicitParam(name = "generalSurveyPlanQueryParam", value = "参数", required = true) + public HttpResult> getPageProblemSubstationBySurvey(@RequestBody @Validated SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam ){ + String methodDescribe = getMethodDescribe("pageProblemSubstationBySurvey"); + Page out = supervisionGeneralSurveyPlanPOService.pageProblemSubstationBySurvey(generalSurveyPlanQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @GetMapping("/initiateWarningLeaflet") + @ApiOperation("针对有问题的现场测试发起告警单") + public HttpResult initiateWarningLeaflet(@RequestParam("id") String id,@RequestParam("subId") String subId){ + String methodDescribe = getMethodDescribe("initiateWarningLeaflet"); + supervisionGeneralSurveyPlanPOService.initiateWarningLeaflet(id,subId); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Boolean.TRUE, methodDescribe); + } + + + } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportNormalController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportNormalController.java new file mode 100644 index 000000000..0e1bcc214 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/user/UserReportNormalController.java @@ -0,0 +1,77 @@ +package com.njcn.supervision.controller.user; + + +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.supervision.pojo.param.user.UserReportNormalParam; +import com.njcn.supervision.pojo.vo.user.UserReportVO; +import com.njcn.supervision.service.user.IUserReportNormalService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + *

+ * 干扰源用户常态化管理 前端控制器 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +@RestController +@RequestMapping("userReportNormal") +@RequiredArgsConstructor +public class UserReportNormalController extends BaseController { + + private final IUserReportNormalService iUserReportNormalService; + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.ADD) + @PostMapping("/addUserReportNormal") + @ApiOperation("新增干扰源常态化管理") + @ApiImplicitParam(name = "userReportNormalParam", value = "实体参数", required = true) + public HttpResult addUserReport(@RequestBody @Validated UserReportNormalParam userReportNormalParam){ + String methodDescribe = getMethodDescribe("addUserReport"); + String userReportId = iUserReportNormalService.addUserNormal(userReportNormalParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportId, methodDescribe); + } + + + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/userReportGoNetPage") + @ApiOperation("分页查询干扰源常态化页面") + @ApiImplicitParam(name = "userReportNormalParam", value = "实体参数", required = true) + public HttpResult> userReportGoNetPage(@RequestBody @Validated UserReportNormalParam userReportNormalParam){ + String methodDescribe = getMethodDescribe("userReportGoNetPage"); + Page userReportId = iUserReportNormalService.userReportGoNetPage(userReportNormalParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportId, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @GetMapping("/userReportGoNetById") + @ApiOperation("查询干扰源常态化详情") + public HttpResult userReportGoNetById(@RequestParam("id")String id){ + String methodDescribe = getMethodDescribe("userReportGoNetById"); + UserReportVO.UserReportGoNetVO userReport = iUserReportNormalService.userReportGoNetById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReport, methodDescribe); + } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE) + @GetMapping("/updateUserReportNormalStatus") + @ApiOperation("修改业务审核状态") + public HttpResult updateUserReportNormalStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status){ + String methodDescribe = getMethodDescribe("updateUserReportNormalStatus"); + iUserReportNormalService.updateUserReportNormalStatus(businessKey,status); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe); + } +} + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineDebugPOMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineDebugPOMapper.java new file mode 100644 index 000000000..d084a9371 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineDebugPOMapper.java @@ -0,0 +1,24 @@ +package com.njcn.supervision.mapper.device; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO; +import com.njcn.supervision.pojo.vo.device.SupervisionDevMainReportVO; +import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO; +import org.apache.ibatis.annotations.Param; + +/** + * + * Description: + * Date: 2024/5/17 15:26【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionTempLineDebugPOMapper extends BaseMapper { + Page page(@Param("page")Page objectPage, @Param("ew") QueryWrapper queryWrapper); + + + Page pageHasDebug(@Param("page")Page objectPage, @Param("ew") QueryWrapper queryWrapper); +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineRunTestMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineRunTestMapper.java new file mode 100644 index 000000000..c9d3d2789 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/SupervisionTempLineRunTestMapper.java @@ -0,0 +1,17 @@ +package com.njcn.supervision.mapper.device; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest; + +/** + *

+ * Mapper 接口 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +public interface SupervisionTempLineRunTestMapper extends BaseMapper { + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineDebugPOMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineDebugPOMapper.xml new file mode 100644 index 000000000..161e91a4f --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineDebugPOMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + id, reason, process_instance_id, `status`, Create_By, Create_Time, Update_By, Update_Time, + `State` + + + + + + + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineRunTestMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineRunTestMapper.xml new file mode 100644 index 000000000..cea157461 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/device/mapping/SupervisionTempLineRunTestMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/WarningLeafletMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/WarningLeafletMapper.java new file mode 100644 index 000000000..52abe7e67 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/WarningLeafletMapper.java @@ -0,0 +1,23 @@ +package com.njcn.supervision.mapper.leaflet; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet; +import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 预告警单表 Mapper 接口 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +public interface WarningLeafletMapper extends BaseMapper { + + Page warningPageData(Page objectPage, @Param("ew") QueryWrapper warningLeafletVOQueryWrapper); + + Page alarmPageData(Page objectPage, @Param("ew") QueryWrapper warningLeafletVOQueryWrapper); +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/mapping/WarningLeafletMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/mapping/WarningLeafletMapper.xml new file mode 100644 index 000000000..de4074bc6 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/leaflet/mapping/WarningLeafletMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionPlanPOMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionPlanPOMapper.java new file mode 100644 index 000000000..27b7e3449 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionPlanPOMapper.java @@ -0,0 +1,15 @@ +package com.njcn.supervision.mapper.plan; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO; + +/** + * + * Description: + * Date: 2024/5/20 17:49【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionPlanPOMapper extends BaseMapper { +} \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionProblemPOMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionProblemPOMapper.java new file mode 100644 index 000000000..ab539d90d --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/SupervisionProblemPOMapper.java @@ -0,0 +1,15 @@ +package com.njcn.supervision.mapper.plan; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO; + +/** + * + * Description: + * Date: 2024/5/20 19:50【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionProblemPOMapper extends BaseMapper { +} \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionPlanPOMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionPlanPOMapper.xml new file mode 100644 index 000000000..360490ca3 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionPlanPOMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + plan_Id, work_plan_name, supv_Type, supv_Stage, supv_Org_Id, plan_User_Id, plan_Org_Id, + other_Remark, effect_Start_Time, effect_End_Time, effect_Status, plan_Supv_Date, + supv_Obj_Type, supv_Obj_Name, obj_Voltage_Level, substation_Name, substation_Voltage_Level, + obj_Type, obj_Type_Name, obj_Capacity, report_Issue_Time, problem_Oc_Time, delete_Flag, + plan_Status, delete_Time, effect_User_Id, effect_User_Name, is_upload_head, create_time, + create_by, update_by, update_time + + \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionProblemPOMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionProblemPOMapper.xml new file mode 100644 index 000000000..d991ec853 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/plan/mapping/SupervisionProblemPOMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + problem_Id, plan_id, duty_Org_Id, monitor_Type, rectification_Time, plan_Rectification_Time, + if_Release_Warning, problem_Desc, simple_Problem_Desc, supv_Standard_Sort, supv_Standard, + supv_Resouce, problem_Level, problem_Level_Reason, problem_Type, rectification_Programme, + rectification_Measure, rectification_Status, is_Upload_Head, discovery_Time, remark, + create_by, update_by, create_time, update_time + + \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SupervisionGeneralSurveyPlanPOMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SupervisionGeneralSurveyPlanPOMapper.java index b081874d5..c4e065bc4 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SupervisionGeneralSurveyPlanPOMapper.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/SupervisionGeneralSurveyPlanPOMapper.java @@ -4,11 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO; +import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanDetailVO; import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO; import org.apache.ibatis.annotations.Param; /** - * * Description: * Date: 2024/5/13 18:35【需求编号】 * @@ -17,4 +17,6 @@ import org.apache.ibatis.annotations.Param; */ public interface SupervisionGeneralSurveyPlanPOMapper extends BaseMapper { Page page(Page objectPage, @Param("ew") QueryWrapper queryWrapper); + + Page pageProblemSubstationBySurvey(Page objectPage, @Param("ew") QueryWrapper supervisionGeneralSurveyPlanDetailVOQueryWrapper); } \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SupervisionGeneralSurveyPlanPOMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SupervisionGeneralSurveyPlanPOMapper.xml index 49fc5fb43..92c940373 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SupervisionGeneralSurveyPlanPOMapper.xml +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/survey/mapping/SupervisionGeneralSurveyPlanPOMapper.xml @@ -1,41 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - plan_no, org_no, plan_name, plan_create_time, plan_start_time, plan_end_time, plan_complate_time, - leader, `status`, description, is_file_upload, file_count, file_path, process_instance_id, - upload_time, Create_By, Create_Time, Update_By, Update_Time, `State` - + + + + + + + + + + + + + + + + + + + + + + + + + + + plan_no, org_no, plan_name, plan_create_time, plan_start_time, plan_end_time, plan_complate_time, + leader, `status`, description, is_file_upload, file_count, file_path, process_instance_id, + upload_time, Create_By, Create_Time, Update_By, Update_Time, `State` + - + + + + \ No newline at end of file diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/UserReportNormalMapper.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/UserReportNormalMapper.java new file mode 100644 index 000000000..551dc0fcb --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/UserReportNormalMapper.java @@ -0,0 +1,17 @@ +package com.njcn.supervision.mapper.user; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.supervision.pojo.po.user.UserReportNormalPO; + +/** + *

+ * 干扰源用户常态化管理 Mapper 接口 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +public interface UserReportNormalMapper extends BaseMapper { + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/mapping/UserReportNormalMapper.xml b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/mapping/UserReportNormalMapper.xml new file mode 100644 index 000000000..a4ec0c5fe --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/mapper/user/mapping/UserReportNormalMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/ISupervisionTempLineRunTestService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/ISupervisionTempLineRunTestService.java new file mode 100644 index 000000000..26864b497 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/ISupervisionTempLineRunTestService.java @@ -0,0 +1,17 @@ +package com.njcn.supervision.service.device; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest; + +/** + *

+ * 服务类 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +public interface ISupervisionTempLineRunTestService extends IService { + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineDebugPOService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineDebugPOService.java new file mode 100644 index 000000000..a2c3d3328 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineDebugPOService.java @@ -0,0 +1,28 @@ +package com.njcn.supervision.service.device; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam; +import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO; +import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO; + +/** + * Description: + * Date: 2024/5/17 15:26【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionTempLineDebugPOService extends IService { + + + String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam); + + Page getTempLineDeug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery); + + Page pageHasDebug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery); + + SupervisionTempLineDebugVO getDetailTempLineDebug(String id); + + void updateStatus(String businessKey, Integer status); +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineReportService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineReportService.java index 702dcf60d..37f821103 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineReportService.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/SupervisionTempLineReportService.java @@ -25,4 +25,6 @@ public interface SupervisionTempLineReportService extends IService data = deptFeignClient.getDepSonIdtByDeptId(supervisionDevMainReportQuery.getOrgId()).getData(); + queryWrapper.in("supervision_dev_main_report.org_no", data); - //添加上时间范围 - queryWrapper.between("supervision_dev_main_report.Create_Time", - DateUtil.beginOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchBeginTime())), - DateUtil.endOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchEndTime()))); } + //添加上时间范围 + queryWrapper.between("supervision_dev_main_report.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(supervisionDevMainReportQuery.getSearchEndTime()))); queryWrapper.orderByDesc("supervision_dev_main_report.Update_Time"); Page page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionDevMainReportQuery), PageFactory.getPageSize(supervisionDevMainReportQuery)), queryWrapper); page.getRecords().stream().forEach(temp->{ @@ -186,7 +189,8 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl implements SupervisionTempLineDebugPOService{ + public static final String PROCESS_KEY = "temp_line_debug"; + private final BpmProcessFeignClient bpmProcessFeignClient; + private final DeptFeignClient deptFeignClient; + + private final SupervisionTempLineReportService supervisionTempLineReportService; + + @Override + @Transactional(rollbackFor = Exception.class) + public String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam) { + + SupervisionTempLineDebugPO byId = this.getById(supervisionTempLineReportParam.getId()); + if(Objects.nonNull(byId)){ + if(byId.getState() == 1) { + throw new BusinessException("该监测点以申请联调"); + } + } + SupervisionTempLineDebugPO supervisionTempLineDebugPO = new SupervisionTempLineDebugPO(); + BeanUtils.copyProperties(supervisionTempLineReportParam,supervisionTempLineDebugPO); + supervisionTempLineDebugPO.setState(DataStateEnum.ENABLE.getCode()); + supervisionTempLineDebugPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); + this.save(supervisionTempLineDebugPO); + String id = supervisionTempLineDebugPO.getId(); + // 发起 BPM 流程 + Map processInstanceVariables = new HashMap<>(); + BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO(); + bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY); + bpmProcessInstanceCreateReqDTO.setBusinessKey(id); + bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(supervisionTempLineReportParam.getStartUserSelectAssignees()); + bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables); + String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionTempLineDebugPO.getCreateBy(),bpmProcessInstanceCreateReqDTO).getData(); + // 将工作流的编号,更新到流程单中 + supervisionTempLineDebugPO.setProcessInstanceId(processInstanceId); + this.baseMapper.updateById(supervisionTempLineDebugPO); + + + return id; + } + + @Override + public Page getTempLineDeug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + + String userIndex = RequestUtil.getUserIndex(); + queryWrapper.in("supervision_temp_line_report.create_by", CollectionUtil.newArrayList(userIndex)) + .eq("supervision_temp_line_report.state", DataStateEnum.ENABLE.getCode()); + if (StrUtil.isNotBlank(supervisionTempLineDebugQuery.getOrgId())) { + /*获取直接下属子单位*/ + List data = deptFeignClient.getDepSonIdtByDeptId(supervisionTempLineDebugQuery.getOrgId()).getData(); + queryWrapper.in("supervision_temp_line_report.org_id", data); + + } + //添加上时间范围 + queryWrapper.between("supervision_temp_line_report.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime()))); + queryWrapper.orderByDesc("supervision_temp_line_report.Update_Time"); + + Page page =this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper); + + return page; + } + + @Override + public Page pageHasDebug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + + String userIndex = RequestUtil.getUserIndex(); + queryWrapper + .eq("supervision_temp_line_debug.state", DataStateEnum.ENABLE.getCode()); + if (StrUtil.isNotBlank(supervisionTempLineDebugQuery.getOrgId())) { + /*获取直接下属子单位*/ + List data = deptFeignClient.getDepSonIdtByDeptId(supervisionTempLineDebugQuery.getOrgId()).getData(); + queryWrapper.in("supervision_temp_line_debug.org_id", data); + + } + //添加上时间范围 + queryWrapper.between("supervision_temp_line_debug.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime()))); + queryWrapper.orderByDesc("supervision_temp_line_debug.Update_Time"); + + Page page =this.baseMapper.pageHasDebug(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper); + + return page; + } + + @Override + public SupervisionTempLineDebugVO getDetailTempLineDebug(String id) { + SupervisionTempLineDebugVO supervisionTempLineDebugVO = new SupervisionTempLineDebugVO(); + SupervisionTempLineReport supervisionTempLineReport = supervisionTempLineReportService.getById(id); + SupervisionTempLineDebugPO supervisionTempLineDebugPO = this.getById(id); + supervisionTempLineDebugVO.setId(id); + supervisionTempLineDebugVO.setLineId(supervisionTempLineReport.getLineId()); + supervisionTempLineDebugVO.setLineName(supervisionTempLineReport.getLineName()); + supervisionTempLineDebugVO.setReason(supervisionTempLineDebugPO.getReason()); + supervisionTempLineDebugVO.setProcessInstanceId(supervisionTempLineDebugPO.getProcessInstanceId()); + supervisionTempLineDebugVO.setStatus(supervisionTempLineDebugPO.getStatus()); + + + return supervisionTempLineDebugVO; + } + + @Override + public void updateStatus(String businessKey, Integer status) { + this.lambdaUpdate().set(SupervisionTempLineDebugPO::getStatus,status).eq(SupervisionTempLineDebugPO::getId,businessKey).update(); + + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineReportServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineReportServiceImpl.java index 267e1cde9..a31c05d62 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineReportServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineReportServiceImpl.java @@ -93,20 +93,23 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl data = deptFeignClient.getDepSonIdtByDeptId(supervisionTempLineReportQuery.getOrgId()).getData(); + queryWrapper.in("supervision_temp_line_report.org_id", data); + - //添加上时间范围 - queryWrapper.between("supervision_temp_line_report.Create_Time", - DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchBeginTime())), - DateUtil.endOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchEndTime()))); } + //添加上时间范围 + queryWrapper.between("supervision_temp_line_report.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(supervisionTempLineReportQuery.getSearchEndTime()))); queryWrapper.orderByDesc("supervision_temp_line_report.Update_Time"); Page page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionTempLineReportQuery), PageFactory.getPageSize(supervisionTempLineReportQuery)), queryWrapper); page.getRecords().stream().forEach(temp->{ - temp.setOrgName((deptFeignClient.getDeptById(temp.getOrgId()).getData().getName())); +// temp.setOrgName((deptFeignClient.getDeptById(temp.getOrgId()).getData().getName())); //处理特殊字段,用户名、部门名 UserVO userVO = userFeignClient.getUserById(temp.getReporter()).getData(); temp.setReporter(userVO.getName()); @@ -133,6 +136,20 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); lambdaQueryWrapper diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineRunTestServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineRunTestServiceImpl.java new file mode 100644 index 000000000..e755bfd3e --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/device/impl/SupervisionTempLineRunTestServiceImpl.java @@ -0,0 +1,21 @@ +package com.njcn.supervision.service.device.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.supervision.mapper.device.SupervisionTempLineRunTestMapper; +import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTest; +import com.njcn.supervision.service.device.ISupervisionTempLineRunTestService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Service +public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl implements ISupervisionTempLineRunTestService { + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/IWarningLeafletService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/IWarningLeafletService.java new file mode 100644 index 000000000..227e71e70 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/IWarningLeafletService.java @@ -0,0 +1,33 @@ +package com.njcn.supervision.service.leaflet; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam; +import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet; +import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; + +/** + *

+ * 预告警单表 服务类 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +public interface IWarningLeafletService extends IService { + + /** + * 创建预告警单,此时还没有走流程,等待用户上传反馈单后,才正式进入工作流阶段 + * name:预告警单名称,此处暂时用普测计划名称+变电站名称组成预告警单名 + * code:预告警编号暂时随机by yxb + * id:对应问题源id,用于查询详细数据 + * problemType:问题类型:1:技术监督管理;2:在线监测超标问题;3:用户投诉;4:现场测试超标,此处是现场测试超标 + * leaflet:单子类型:1:预警单;2:告警单 + * issueDetail:问题详细描述 + */ + void createLeaflet(String name, String code, String id, Integer problemType, Integer leaflet,String issueDetail); + + Page alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam); + + Page warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam); +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java new file mode 100644 index 000000000..c35341573 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/leaflet/impl/WarningLeafletServiceImpl.java @@ -0,0 +1,91 @@ +package com.njcn.supervision.service.leaflet.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.supervision.enums.FlowStatusEnum; +import com.njcn.supervision.enums.LeafletTypeEnum; +import com.njcn.supervision.mapper.leaflet.WarningLeafletMapper; +import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam; +import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet; +import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; +import com.njcn.supervision.service.leaflet.IWarningLeafletService; +import com.njcn.user.api.UserFeignClient; +import com.njcn.web.factory.PageFactory; +import com.njcn.web.utils.RequestUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; + +/** + *

+ * 预告警单表 服务实现类 + *

+ * + * @author hongawen + * @since 2024-05-21 + */ +@Service +@RequiredArgsConstructor +public class WarningLeafletServiceImpl extends ServiceImpl implements IWarningLeafletService { + + private final UserFeignClient userFeignClient; + + /** + * 不创建工作流,只是创建一个告警单,需要待用户反馈后才会进入流程 + */ + @Override + public void createLeaflet(String name, String code, String id, Integer problemType, Integer leaflet,String issueDetail) { + WarningLeaflet warningLeaflet = new WarningLeaflet(); + warningLeaflet.setLeafletName(name); + warningLeaflet.setLeafletNo(code); + warningLeaflet.setProblemType(problemType); + warningLeaflet.setProblemId(id); + warningLeaflet.setLeafletType(leaflet); + warningLeaflet.setIssueDetail(issueDetail); + warningLeaflet.setState(DataStateEnum.ENABLE.getCode()); + warningLeaflet.setStatus(FlowStatusEnum.NO_FEEDBACK.getCode()); + this.baseMapper.insert(warningLeaflet); + } + + @Override + public Page warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) { + QueryWrapper warningLeafletVOQueryWrapper = new QueryWrapper<>(); + if (Objects.nonNull(warningLeafletQueryParam)) { + //添加上时间范围 + warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchEndTime()))); + } + //获取当前用户部门所有同事的id,查看该部门下所有的数据 + List colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData(); + warningLeafletVOQueryWrapper.in("supervision_warning_leaflet.Create_By", colleaguesIds) + .eq("supervision_warning_leaflet.state",DataStateEnum.ENABLE.getCode()) + .eq("supervision_warning_leaflet.leaflet_type", LeafletTypeEnum.WARNING.getCode()) + .orderByDesc("supervision_warning_leaflet.Update_Time"); + return this.baseMapper.warningPageData(new Page<>(PageFactory.getPageNum(warningLeafletQueryParam), PageFactory.getPageSize(warningLeafletQueryParam)), warningLeafletVOQueryWrapper); + } + + @Override + public Page alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) { + QueryWrapper warningLeafletVOQueryWrapper = new QueryWrapper<>(); + if (Objects.nonNull(warningLeafletQueryParam)) { + //添加上时间范围 + warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchEndTime()))); + } + //获取当前用户部门所有同事的id,查看该部门下所有的数据 + List colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData(); + warningLeafletVOQueryWrapper.in("supervision_warning_leaflet.Create_By", colleaguesIds) + .eq("supervision_warning_leaflet.state",DataStateEnum.ENABLE.getCode()) + .eq("supervision_warning_leaflet.leaflet_type", LeafletTypeEnum.ALARM.getCode()) + .orderByDesc("supervision_warning_leaflet.Update_Time"); + return this.baseMapper.alarmPageData(new Page<>(PageFactory.getPageNum(warningLeafletQueryParam), PageFactory.getPageSize(warningLeafletQueryParam)), warningLeafletVOQueryWrapper); + + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionPlanPOService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionPlanPOService.java new file mode 100644 index 000000000..fcd8be823 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionPlanPOService.java @@ -0,0 +1,29 @@ +package com.njcn.supervision.service.plan; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.supervision.pojo.param.plan.SupervisionPlanParam; +import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.supervision.pojo.vo.plan.SupervisionPlanVO; + +/** + * + * Description: + * Date: 2024/5/20 17:49【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionPlanPOService extends IService{ + + + String addPlan(SupervisionPlanParam supvPlanParam); + + Page pagePlan(SupervisionPlanParam supvPlanParam); + + String initiateAudit(String id); + + SupervisionPlanVO getDetailPlan(String id); + + void updateStatus(String businessKey, Integer status); +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionProblemPOService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionProblemPOService.java new file mode 100644 index 000000000..7804609dc --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/SupervisionProblemPOService.java @@ -0,0 +1,21 @@ +package com.njcn.supervision.service.plan; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.njcn.supervision.pojo.param.plan.SupervisopnProblemParam; +import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO; +import com.baomidou.mybatisplus.extension.service.IService; + /** + * + * Description: + * Date: 2024/5/20 19:50【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public interface SupervisionProblemPOService extends IService{ + + + void addProblem(SupervisopnProblemParam supvProblemParam); + + Page pageProblem(SupervisopnProblemParam supvProblemParam); + } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionPlanPOServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionPlanPOServiceImpl.java new file mode 100644 index 000000000..c0142d681 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionPlanPOServiceImpl.java @@ -0,0 +1,365 @@ +package com.njcn.supervision.service.plan.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.bpm.api.BpmProcessFeignClient; +import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.utils.PubUtils; +import com.njcn.supervision.mapper.plan.SupervisionPlanPOMapper; +import com.njcn.supervision.pojo.param.plan.SupervisionPlanParam; +import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO; +import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO; +import com.njcn.supervision.pojo.vo.plan.SupervisionPlanVO; +import com.njcn.supervision.service.plan.SupervisionPlanPOService; +import com.njcn.supervision.service.plan.SupervisionProblemPOService; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.api.UserFeignClient; +import com.njcn.user.pojo.po.User; +import com.njcn.user.pojo.vo.PvTerminalTreeVO; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * + * Description: + * Date: 2024/5/20 17:49【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Service +@RequiredArgsConstructor +public class SupervisionPlanPOServiceImpl extends ServiceImpl implements SupervisionPlanPOService{ + private final UserFeignClient userFeignClient; + private final DeptFeignClient deptFeignClient; + private final BpmProcessFeignClient bpmProcessFeignClient; + public static final String PROCESS_KEY = "sup_plan_add"; + private final SupervisionProblemPOService supervisionProblemPOService; + @Override + @Transactional(rollbackFor = Exception.class) + public String addPlan(SupervisionPlanParam supvPlanParam) { + checkParam(supvPlanParam, false); + SupervisionPlanPO supvPlan = new SupervisionPlanPO(); + BeanUtil.copyProperties(supvPlanParam, supvPlan); + supvPlan.setPlanSupvDate(LocalDateTimeUtil.parse(supvPlanParam.getPlanSupvDate(), DatePattern.NORM_DATETIME_PATTERN)); + + if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())) { + supvPlan.setEffectEndTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectEndTime())); + } + if(StrUtil.isNotBlank(supvPlanParam.getEffectStartTime())) { + supvPlan.setEffectStartTime(PubUtils.localDateTimeFormat(supvPlanParam.getEffectStartTime())); + } + if(StrUtil.isNotBlank(supvPlanParam.getProblemOcTime())) { + supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime())); + } + if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())) { + supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); + } + + + + if(!"01".equals(supvPlan.getEffectStatus())){ + if(Objects.isNull(supvPlan.getEffectStartTime()) ){ + throw new BusinessException("开始实施时间不可为空!"); + } + } + + if("04".equals(supvPlan.getEffectStatus())){ + if(Objects.isNull(supvPlan.getEffectEndTime()) ){ + throw new BusinessException("结束实施时间不可为空!"); + } + } + + + supvPlan.setIsUploadHead(0); + if(StrUtil.isNotBlank(supvPlan.getEffectUserId())){ + List userList = userFeignClient.getUserByIdList(Stream.of(supvPlan.getEffectUserId()).collect(Collectors.toList())).getData(); + if(CollUtil.isNotEmpty(userList)){ + supvPlan.setEffectUserName(userList.get(0).getName()); + } + } + supvPlan.setState(DataStateEnum.ENABLE.getCode()); + this.save(supvPlan); + return supvPlan.getPlanId(); + } + + @Override + public Page pagePlan(SupervisionPlanParam supvPlanParam) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())) { + List deptIds = deptFeignClient.getDepSonSelfCodetByCode(supvPlanParam.getSupvOrgId()).getData(); + lambdaQueryWrapper.in(SupervisionPlanPO::getSupvOrgId, deptIds) + .between(SupervisionPlanPO::getPlanSupvDate, supvPlanParam.getSearchBeginTime(),supvPlanParam.getSearchEndTime()) + .eq(StrUtil.isNotBlank(supvPlanParam.getSupvType()),SupervisionPlanPO::getSupvType,supvPlanParam.getSupvType()); + + } + + if(StrUtil.isNotBlank(supvPlanParam.getSortBy())){ + if(supvPlanParam.getOrderBy().equals("desc")){ + lambdaQueryWrapper.orderByDesc(SupervisionPlanPO::getPlanSupvDate); + }else { + lambdaQueryWrapper.orderByAsc(SupervisionPlanPO::getPlanSupvDate); + + } + }else { + lambdaQueryWrapper.orderByDesc(SupervisionPlanPO::getCreateTime); + } + + + List deptList = deptFeignClient.allDeptList().getData(); +// Map mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); + Map mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity())); + + + Page page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)), lambdaQueryWrapper); + List supvPlanVOList = BeanUtil.copyToList(page.getRecords(), SupervisionPlanVO.class); + List userIds = supvPlanVOList.stream().map(SupervisionPlanVO::getPlanUserId).distinct().collect(Collectors.toList()); + supvPlanVOList.forEach(item -> { + PvTerminalTreeVO pvTerminalTreeVO = null; + if (mapList.containsKey(item.getSupvOrgId())) { + pvTerminalTreeVO = mapList.get(item.getSupvOrgId()); + item.setSupvOrgName(pvTerminalTreeVO.getName()); + int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length; + if (deptLevel == 2) { + //省 + item.setProvince(pvTerminalTreeVO.getName()); + } else if (deptLevel == 3) { + //市 + item.setCity(pvTerminalTreeVO.getName()); + if (mapList.containsKey(pvTerminalTreeVO.getPid())) { + PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); + item.setProvince(pvTerminalTreeOne.getName()); + } + } else if (deptLevel == 4) { + //县 + if (mapList.containsKey(pvTerminalTreeVO.getPid())) { + item.setCounty(pvTerminalTreeVO.getName()); + PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); + if (Objects.nonNull(pvTerminalTreeOne)) { + item.setCity(pvTerminalTreeOne.getName()); + if (mapList.containsKey(pvTerminalTreeOne.getPid())) { + PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid()); + if (Objects.nonNull(pvTerminalTreeTwo)) { + item.setProvince(pvTerminalTreeTwo.getName()); + } + } + } + } + } + } + + if (mapList.containsKey(item.getPlanOrgId())) { + item.setPlanOrgName(mapList.get(item.getPlanOrgId()).getName()); + } + +// SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0)); +// if (Objects.nonNull(supvFile)) { +// item.setAttachmentName(supvFile.getAttachmentName()); +// } + + List userList = userFeignClient.getUserByIdList(userIds).getData(); + Map map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); + + if (map.containsKey(item.getPlanUserId())) { + item.setPlanUserName(map.get(item.getPlanUserId()).getName()); + } + + + }); + Page pageVo = new Page<>(); + pageVo.setTotal(page.getTotal()); + pageVo.setPages(page.getPages()); + pageVo.setSize(page.getSize()); + pageVo.setRecords(supvPlanVOList); + return pageVo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String initiateAudit(String id) { + + SupervisionPlanPO byId = this.getById(id); + + List list = supervisionProblemPOService.lambdaQuery().eq(SupervisionProblemPO::getPlanId, id).list(); + if (CollectionUtil.isEmpty(list)){ + throw new BusinessException("请填写完事实问题在提交审核"); + } + // 发起 BPM 流程 + Map processInstanceVariables = new HashMap<>(); + BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO(); + bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY); + bpmProcessInstanceCreateReqDTO.setBusinessKey(id); + bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap> ()); + bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables); + String processInstanceId = bpmProcessFeignClient.createProcessInstance(byId.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData(); + // 将工作流的编号,更新到流程单中 + byId.setProcessInstanceId(processInstanceId); + this.baseMapper.updateById(byId); + return processInstanceId; + } + + @Override + public SupervisionPlanVO getDetailPlan(String id) { + SupervisionPlanVO supervisionPlanVO = new SupervisionPlanVO(); + List deptList = deptFeignClient.allDeptList().getData(); + Map mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity())); + SupervisionPlanPO byId = this.getById(id); + BeanUtils.copyProperties(byId,supervisionPlanVO); + + if (mapList.containsKey(supervisionPlanVO.getSupvOrgId())) { + PvTerminalTreeVO pvTerminalTreeVO = null; + + pvTerminalTreeVO = mapList.get(supervisionPlanVO.getSupvOrgId()); + supervisionPlanVO.setSupvOrgName(pvTerminalTreeVO.getName()); + int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length; + if (deptLevel == 2) { + //省 + supervisionPlanVO.setProvince(pvTerminalTreeVO.getName()); + } else if (deptLevel == 3) { + //市 + supervisionPlanVO.setCity(pvTerminalTreeVO.getName()); + if (mapList.containsKey(pvTerminalTreeVO.getPid())) { + PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); + supervisionPlanVO.setProvince(pvTerminalTreeOne.getName()); + } + } else if (deptLevel == 4) { + //县 + if (mapList.containsKey(pvTerminalTreeVO.getPid())) { + supervisionPlanVO.setCounty(pvTerminalTreeVO.getName()); + PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid()); + if (Objects.nonNull(pvTerminalTreeOne)) { + supervisionPlanVO.setCity(pvTerminalTreeOne.getName()); + if (mapList.containsKey(pvTerminalTreeOne.getPid())) { + PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid()); + if (Objects.nonNull(pvTerminalTreeTwo)) { + supervisionPlanVO.setProvince(pvTerminalTreeTwo.getName()); + } + } + } + } + } + } + + if (mapList.containsKey(supervisionPlanVO.getPlanOrgId())) { + supervisionPlanVO.setPlanOrgName(mapList.get(supervisionPlanVO.getPlanOrgId()).getName()); + } + +// SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0)); +// if (Objects.nonNull(supvFile)) { +// item.setAttachmentName(supvFile.getAttachmentName()); +// } + +// List userList = userFeignClient.getUserByIdList(userIds).getData(); +// Map map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); +// +// if (map.containsKey(supervisionPlanVO.getPlanUserId())) { +// supervisionPlanVO.setPlanUserName(map.get(supervisionPlanVO.getPlanUserId()).getName()); +// } + + return supervisionPlanVO; + } + + @Override + public void updateStatus(String businessKey, Integer status) { + this.lambdaUpdate().set(SupervisionPlanPO::getStatus,status).eq(SupervisionPlanPO::getPlanId,businessKey).update(); + } + + + private void checkParam(SupervisionPlanParam supvPlanParam, Boolean updateFlag) { + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SupervisionPlanPO::getWorkPlanName, supvPlanParam.getWorkPlanName()); + + if (updateFlag) { + if (supvPlanParam instanceof SupervisionPlanParam.UpdateSupvPlanParam) { + //修改 + lambdaQueryWrapper.ne(SupervisionPlanPO::getPlanId, ((SupervisionPlanParam.UpdateSupvPlanParam) supvPlanParam).getPlanId()); + } + } + + int count = this.count(lambdaQueryWrapper); + if (count > 0) { + throw new BusinessException("监督计划名称已存在"); + } + + //判断监督对象类型 + /* if (StrUtil.isNotBlank(supvPlanParam.getSupvObjType())) { + DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData(); + if (dictData.getCode().equals(DicDataEnum.New_Energy.getCode())) { + if (StrUtil.isBlank(supvPlanParam.getSupvObjType())) { + throw new BusinessException("监督对象类型不可为空"); + } + if (StrUtil.isBlank(supvPlanParam.getObjType())) { + throw new BusinessException("监督对象属性名称不可为空"); + } + if (Objects.isNull(supvPlanParam.getObjCapacity())) { + throw new BusinessException("监督对象协议容量不可为空"); + } + } else if (!dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())) { + if (StrUtil.isBlank(supvPlanParam.getSupvObjName())) { + throw new BusinessException("监督对象名称不可为空"); + } + if (StrUtil.isBlank(supvPlanParam.getObjVoltageLevel())) { + throw new BusinessException("监督对象电压等级不可为空"); + } + + } else if (!dictData.getCode().equals(DicDataEnum.POWER_QUALITY.getCode())) { + if (Objects.isNull(supvPlanParam.getObjCapacity())) { + throw new BusinessException("监督对象协议容量不可为空"); + } + } + }*/ + //判断时间范围 + if(StrUtil.isAllNotBlank(supvPlanParam.getEffectStartTime(),supvPlanParam.getEffectEndTime())|| + StrUtil.isAllNotBlank(supvPlanParam.getEffectStartTime(),supvPlanParam.getReportIssueTime()) + ){ + String problemOcTime1 = supvPlanParam.getProblemOcTime(); + if(StrUtil.isNotBlank(problemOcTime1)){ + //实施开始时间 + DateTime effectStartTime = DateUtil.parse(supvPlanParam.getEffectStartTime(), "yyyy-MM-dd HH:mm:ss"); + //问题发现时间 + DateTime problemOcTime = DateUtil.parse(problemOcTime1, "yyyy-MM-dd HH:mm:ss"); + Boolean fly = false; + if(StrUtil.isNotBlank(supvPlanParam.getEffectEndTime())){ + //实施结束时间 + DateTime effectEndTime = DateUtil.parse(supvPlanParam.getEffectEndTime(), "yyyy-MM-dd HH:mm:ss"); + if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) { + fly = true; + } + } + if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())){ + //报告出具时间 + DateTime reportIssueTime = DateUtil.parse(supvPlanParam.getReportIssueTime(), "yyyy-MM-dd HH:mm:ss"); + if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) { + fly = true; + } + } + if (!fly) { + throw new BusinessException("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内"); + } + } + } + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionProblemPOServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionProblemPOServiceImpl.java new file mode 100644 index 000000000..9a4d852cf --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/plan/impl/SupervisionProblemPOServiceImpl.java @@ -0,0 +1,132 @@ +package com.njcn.supervision.service.plan.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +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.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.utils.PubUtils; +import com.njcn.supervision.mapper.plan.SupervisionPlanPOMapper; +import com.njcn.supervision.mapper.plan.SupervisionProblemPOMapper; +import com.njcn.supervision.pojo.param.plan.SupervisopnProblemParam; +import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO; +import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO; +import com.njcn.supervision.service.plan.SupervisionProblemPOService; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.pojo.po.DictData; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.pojo.vo.PvTerminalTreeVO; +import com.njcn.web.factory.PageFactory; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * + * Description: + * Date: 2024/5/20 19:50【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Service +@RequiredArgsConstructor +public class SupervisionProblemPOServiceImpl extends ServiceImpl implements SupervisionProblemPOService{ + + + private final SupervisionPlanPOMapper supervisionPlanPOMapper; + private final DicDataFeignClient dicDataFeignClient; + + private final DeptFeignClient deptFeignClient; + @Override + @Transactional(rollbackFor = Exception.class) + public void addProblem(SupervisopnProblemParam supvProblemParam) { + checkParam(supvProblemParam.getPlanId(),supvProblemParam.getDiscoveryTime()); + SupervisionProblemPO supvProblem = new SupervisionProblemPO(); + BeanUtil.copyProperties(supvProblemParam, supvProblem); + supvProblem.setPlanRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getPlanRectificationTime())); + if(StrUtil.isNotBlank(supvProblemParam.getRectificationTime())) { + supvProblem.setRectificationTime(PubUtils.beginTimeToLocalDateTime(supvProblemParam.getRectificationTime())); + } + this.save(supvProblem); + } + + @Override + public Page pageProblem(SupervisopnProblemParam supvProblemParam) { + DictData stamped_report = dicDataFeignClient.getDicDataByCode("Stamped_Report").getData(); + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(SupervisionProblemPO::getPlanId, supvProblemParam.getPlanId()); + Page page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)), lambdaQueryWrapper); + + List deptList = deptFeignClient.allDeptList().getData(); + Map mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); + + for (SupervisionProblemPO item : page.getRecords()) { + if (mapCode.containsKey(item.getDutyOrgId())) { + item.setDutyOrgName(mapCode.get(item.getDutyOrgId()).getName()); + } + +// List supvFileList = supvFileMapper.selectList(new LambdaQueryWrapper().eq(SupvFile::getBusiId, item.getProblemId()).eq(SupvFile::getType, 1)); +// if (CollUtil.isNotEmpty(supvFileList)) { +// for(SupvFile supvFile:supvFileList){ +// if(supvFile.getAttachmentType().equals(stamped_report.getId())){ +// item.setAttachmentName(supvFile.getAttachmentName()); +// }else { +// item.setAttachmentNameTwo(supvFile.getAttachmentName()); +// } +// +// } +// } + + } + return page; + } + + //判断是否存在时间范围内 + public void checkParam(String id,String time) { + if(StrUtil.isNotBlank(time)){ + SupervisionPlanPO supvPlan = supervisionPlanPOMapper.selectById(id); + if(ObjectUtil.isNotNull(supvPlan)){ + //判断时间范围 + if (ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getEffectEndTime())|| + ObjectUtil.isAllNotEmpty(supvPlan.getEffectStartTime(), supvPlan.getReportIssueTime()) + ) { + //实施开始时间 + DateTime effectStartTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectStartTime()), "yyyy-MM-dd HH:mm:ss"); + //问题发现时间 + DateTime problemOcTime = DateUtil.parse(time, "yyyy-MM-dd HH:mm:ss"); + Boolean fly = false; + if(ObjectUtil.isNotNull(supvPlan.getEffectEndTime())){ + //实施结束时间 + DateTime effectEndTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getEffectEndTime()), "yyyy-MM-dd HH:mm:ss"); + if (DateUtil.isIn(problemOcTime, effectStartTime, effectEndTime)) { + fly = true; + } + } + if(ObjectUtil.isNotNull(supvPlan.getReportIssueTime())){ + //报告出具时间 + DateTime reportIssueTime = DateUtil.parse(DateUtil.formatLocalDateTime(supvPlan.getReportIssueTime()), "yyyy-MM-dd HH:mm:ss"); + if (DateUtil.isIn(problemOcTime, effectStartTime, reportIssueTime)) { + fly = true; + } + } + if (!fly) { + throw new BusinessException("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内"); + + } + } + } + } + + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/SupervisionGeneralSurveyPlanPOService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/SupervisionGeneralSurveyPlanPOService.java index a612d7e35..7d7dcf9a4 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/SupervisionGeneralSurveyPlanPOService.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/SupervisionGeneralSurveyPlanPOService.java @@ -6,34 +6,46 @@ import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.supervision.pojo.param.survey.SupervisionGeneralSurveyPlanParm; import com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO; import com.njcn.supervision.pojo.vo.survey.DeptSubstationVO; +import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanDetailVO; import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO; import java.util.List; /** - * * Description: * Date: 2024/5/13 18:35【需求编号】 * * @author clam * @version V1.0.0 */ -public interface SupervisionGeneralSurveyPlanPOService extends IService{ +public interface SupervisionGeneralSurveyPlanPOService extends IService { - String addDevReport(SupervisionGeneralSurveyPlanParm supervisionGeneralSurveyPlanParm); + String addDevReport(SupervisionGeneralSurveyPlanParm supervisionGeneralSurveyPlanParm); - boolean auditSurvey(SupervisionGeneralSurveyPlanParm.SupervisionGeneralSurveyPlanUpdate supervisionGeneralSurveyPlanUpdate); + boolean auditSurvey(SupervisionGeneralSurveyPlanParm.SupervisionGeneralSurveyPlanUpdate supervisionGeneralSurveyPlanUpdate); - Boolean removeSurvey(List ids); + Boolean removeSurvey(List ids); Page getSurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam); + /** + * 分页查询当前用户能看到的普测计划中存在超标问题 + */ + Page pageProblemSubstationBySurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam); + SupervisionGeneralSurveyPlanVO querySurveyDetail(String id); List initDetpStataionTree(String orgId); - void updateStatus(String businessKey, Integer status); + void updateStatus(String businessKey, Integer status); String cancelGeneralSurvey(BpmProcessInstanceCancelParam cancelReqVO); + + + /** + * 针对有问题的现场测试发起告警单 + * @param id 有问题的测试记录id + */ + void initiateWarningLeaflet(String id,String subId); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SupervisionGeneralSurveyPlanPOServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SupervisionGeneralSurveyPlanPOServiceImpl.java index e877ac525..ffe90faa4 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SupervisionGeneralSurveyPlanPOServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SupervisionGeneralSurveyPlanPOServiceImpl.java @@ -1,9 +1,16 @@ package com.njcn.supervision.service.survey.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.text.StrPool; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.bpm.api.BpmProcessFeignClient; @@ -13,6 +20,7 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO; import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam; import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.pojo.response.HttpResult; import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.biz.pojo.dto.SubGetBase; import com.njcn.device.biz.pojo.param.SubstationParam; @@ -20,15 +28,20 @@ import com.njcn.device.pq.api.LineFeignClient; import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.supervision.enums.FlowStatusEnum; +import com.njcn.supervision.enums.LeafletTypeEnum; +import com.njcn.supervision.enums.ProblemTypeEnum; import com.njcn.supervision.mapper.survey.SupervisionGeneralSurveyPlanPOMapper; import com.njcn.supervision.pojo.param.survey.SupervisionGeneralSurveyPlanParm; import com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanDetailPO; import com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO; import com.njcn.supervision.pojo.vo.survey.DeptSubstationVO; +import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanDetailVO; import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO; +import com.njcn.supervision.service.leaflet.IWarningLeafletService; import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanDetailPOService; import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanPOService; import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.api.UserFeignClient; import com.njcn.user.pojo.vo.PvTerminalTreeVO; import com.njcn.web.factory.PageFactory; import com.njcn.web.utils.RequestUtil; @@ -51,7 +64,7 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl implements SupervisionGeneralSurveyPlanPOService{ +public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl implements SupervisionGeneralSurveyPlanPOService { /** * 用户信息建档对应的流程定义 KEY todo 修改成普测的key */ @@ -62,6 +75,8 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl stationList = commTerminalGeneralClient.tagOrIdGetSub(param).getData(); @@ -90,11 +105,11 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl lines= lineFeignClient.getSubIndexLineDetail(stat.getId()).getData(); - if(CollectionUtil.isEmpty(lines)){ + List lines = lineFeignClient.getSubIndexLineDetail(stat.getId()).getData(); + if (CollectionUtil.isEmpty(lines)) { supervisionGeneralSurveyPlanDetailPO.setMeasurementPointId(""); supervisionGeneralSurveyPlanDetailPO.setIsSurvey(0); - }else { + } else { String subList = lines.stream().map(Line::getName).collect(Collectors.joining(",")); supervisionGeneralSurveyPlanDetailPO.setMeasurementPointId(subList); supervisionGeneralSurveyPlanDetailPO.setIsSurvey(1); @@ -110,19 +125,17 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl unitChildrenList = stat.getUnitChildrenList(); - if(CollectionUtil.isEmpty(unitChildrenList)){ + if (CollectionUtil.isEmpty(unitChildrenList)) { supervisionGeneralSurveyPlanDetailPO.setMeasurementPointId(""); supervisionGeneralSurveyPlanDetailPO.setIsSurvey(0); - }else { + } else { List data = lineFeignClient.getLineDetailList(unitChildrenList).getData(); String subList = data.stream().map(LineDetailDataVO::getLineName).collect(Collectors.joining(",")); @@ -162,7 +175,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl().lambda().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo,planNo)); + supervisionGeneralSurveyPlanDetailPOService.remove(new QueryWrapper().lambda().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, planNo)); supervisionGeneralSurveyPlanDetailPOService.saveOrUpdateBatchByMultiId(supervisionGeneralSurveyPlanDetailPOS, 500); // 发起 BPM 流程 Map processInstanceVariables = new HashMap<>(); @@ -171,7 +184,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl ids) { this.lambdaUpdate().set(SupervisionGeneralSurveyPlanPO::getState, 0).in(SupervisionGeneralSurveyPlanPO::getPlanNo, ids).update(); supervisionGeneralSurveyPlanDetailPOService.remove(new QueryWrapper(). - lambda().in(SupervisionGeneralSurveyPlanDetailPO::getPlanNo,ids)); + lambda().in(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, ids)); return true; } @@ -204,10 +217,14 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(generalSurveyPlanQueryParam), PageFactory.getPageSize(generalSurveyPlanQueryParam)), queryWrapper); - page.getRecords().stream().forEach(temp->{ + page.getRecords().stream().forEach(temp -> { temp.setOrgName((deptFeignClient.getDeptById(temp.getOrgNo()).getData().getName())); //获取普测下电站详情 List list = supervisionGeneralSurveyPlanDetailPOService.lambdaQuery().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, temp.getPlanNo()).list(); @@ -219,11 +236,31 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl pageProblemSubstationBySurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam) { + QueryWrapper supervisionGeneralSurveyPlanDetailVOQueryWrapper = new QueryWrapper<>(); + if (Objects.nonNull(generalSurveyPlanQueryParam)) { + //添加上时间范围 + supervisionGeneralSurveyPlanDetailVOQueryWrapper.between("supervision_general_survey_plan_detail.Create_Time", + DateUtil.beginOfDay(DateUtil.parse(generalSurveyPlanQueryParam.getSearchBeginTime())), + DateUtil.endOfDay(DateUtil.parse(generalSurveyPlanQueryParam.getSearchEndTime()))); + } + //获取当前用户部门所有同事的id,查看该部门下所有的数据 + List colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData(); + supervisionGeneralSurveyPlanDetailVOQueryWrapper.in("supervision_general_survey_plan_detail.Create_By", colleaguesIds) + .eq("supervision_general_survey_plan.status", BpmProcessInstanceStatusEnum.APPROVE.getStatus()) + .orderByDesc("supervision_general_survey_plan_detail.Update_Time"); + Page page = this.baseMapper.pageProblemSubstationBySurvey(new Page<>(PageFactory.getPageNum(generalSurveyPlanQueryParam), PageFactory.getPageSize(generalSurveyPlanQueryParam)), supervisionGeneralSurveyPlanDetailVOQueryWrapper); + //填充部门名称 + page.getRecords().forEach(temp -> temp.setOrgName((deptFeignClient.getDeptById(temp.getOrgNo()).getData().getName()))); + return page; + } + @Override public SupervisionGeneralSurveyPlanVO querySurveyDetail(String id) { SupervisionGeneralSurveyPlanVO supervisionGeneralSurveyPlanVO = new SupervisionGeneralSurveyPlanVO(); SupervisionGeneralSurveyPlanPO byId = this.getById(id); - BeanUtils.copyProperties(byId,supervisionGeneralSurveyPlanVO); + BeanUtils.copyProperties(byId, supervisionGeneralSurveyPlanVO); //获取普测下电站详情 List list = supervisionGeneralSurveyPlanDetailPOService.lambdaQuery().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, id).list(); supervisionGeneralSurveyPlanVO.setSupervisionGeneralSurveyPlanDetailPOS(list); @@ -277,7 +314,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl detailPOLambdaQueryWrapper = new LambdaQueryWrapper<>(); + detailPOLambdaQueryWrapper.eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, id) + .eq(SupervisionGeneralSurveyPlanDetailPO::getSubId, subId); + SupervisionGeneralSurveyPlanDetailPO detailPlan = supervisionGeneralSurveyPlanDetailPOService.getOne(detailPOLambdaQueryWrapper); + SupervisionGeneralSurveyPlanPO generalSurveyPlan = this.getById(id); + /* + * 1、预告警单名称,此处暂时用普测计划名称+变电站名称组成预告警单名 + * 2、预告警编号暂时随机by yxb + * 3、问题类型:1:技术监督管理;2:在线监测超标问题;3:用户投诉;4:现场测试超标,此处是现场测试超标 + * 4、对应问题源id,用于查询详细数据 + * 5、单子类型:1:预警单;2:告警单 + * 6、问题详细描述 + * */ + warningLeafletService.createLeaflet( + generalSurveyPlan.getPlanName().concat(StrPool.UNDERLINE).concat(detailPlan.getSubName()), + IdWorker.get32UUID(), + id, + ProblemTypeEnum.SITE_TEST.getCode(), + LeafletTypeEnum.ALARM.getCode(), + assembleIssueDetail(detailPlan,generalSurveyPlan) + ); + //将当前的问题记录是否告警修改为已告警 + LambdaUpdateWrapper detailPOLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + detailPOLambdaUpdateWrapper.set(SupervisionGeneralSurveyPlanDetailPO::getInitiateWarningFlag, 1) + .eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, id) + .eq(SupervisionGeneralSurveyPlanDetailPO::getSubId, subId); + supervisionGeneralSurveyPlanDetailPOService.update(detailPOLambdaUpdateWrapper); + } + + /** + * 组装谐波普测的问题 + * 格式:planCreateTime发起的planName普测计划,由负责人leader测试后,于planComplateTime完成,其中subName在本次普测计划测试中存在电能质量问题,详细请查看附件 + */ + private String assembleIssueDetail(SupervisionGeneralSurveyPlanDetailPO detailPlan, SupervisionGeneralSurveyPlanPO generalSurveyPlan) { + String issueDetail = "于" + .concat(LocalDateTimeUtil.format(generalSurveyPlan.getPlanCreateTime(), DatePattern.CHINESE_DATE_PATTERN)) + .concat("发起的") + .concat(generalSurveyPlan.getPlanName()) + .concat("普测计划,由负责人") + .concat(generalSurveyPlan.getLeader()) + .concat("测试后,于") + .concat(LocalDateTimeUtil.format(generalSurveyPlan.getPlanComplateTime(), DatePattern.CHINESE_DATE_PATTERN)) + .concat("完成,其中") + .concat(detailPlan.getSubName()) + .concat("在本次普测计划测试中存在电能质量问题,详细请查看问题附件"); + return issueDetail; + } + public List recursion(DeptSubstationVO result, String orgdid) { List deptSubstationVOList = new ArrayList<>(); @@ -313,13 +401,13 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>(); userReportPOLambdaQueryWrapper diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java new file mode 100644 index 000000000..3d680f9ca --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/IUserReportNormalService.java @@ -0,0 +1,32 @@ +package com.njcn.supervision.service.user; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.supervision.pojo.param.user.UserReportNormalParam; +import com.njcn.supervision.pojo.po.user.UserReportNormalPO; +import com.njcn.supervision.pojo.vo.user.UserReportVO; +import org.springframework.web.bind.annotation.RequestParam; + +/** + *

+ * 干扰源用户常态化管理 服务类 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +public interface IUserReportNormalService extends IService { + + String addUserNormal(UserReportNormalParam userReportNormalParam); + + + Page userReportGoNetPage(UserReportNormalParam userReportNormalParam); + + + UserReportVO.UserReportGoNetVO userReportGoNetById(String id); + + + void updateUserReportNormalStatus(String businessKey,Integer status); + +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java new file mode 100644 index 000000000..f729a4ba1 --- /dev/null +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportNormalServiceImpl.java @@ -0,0 +1,151 @@ +package com.njcn.supervision.service.user.impl; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.bpm.api.BpmProcessFeignClient; +import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO; +import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.supervision.enums.FlowStatusEnum; +import com.njcn.supervision.mapper.user.UserReportNormalMapper; +import com.njcn.supervision.pojo.param.user.UserReportNormalParam; +import com.njcn.supervision.pojo.po.user.UserReportNormalPO; +import com.njcn.supervision.pojo.po.user.UserReportPO; +import com.njcn.supervision.pojo.vo.user.UserReportVO; +import com.njcn.supervision.service.user.IUserReportNormalService; +import com.njcn.supervision.service.user.UserReportPOService; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.api.UserFeignClient; +import com.njcn.user.pojo.po.User; +import com.njcn.web.factory.PageFactory; +import com.njcn.web.utils.RequestUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + *

+ * 干扰源用户常态化管理 服务实现类 + *

+ * + * @author hongawen + * @since 2024-05-17 + */ +@Service +@RequiredArgsConstructor +public class UserReportNormalServiceImpl extends ServiceImpl implements IUserReportNormalService { + + /** + * 用户信息建档对应的流程定义 KEY + */ + public static final String PROCESS_KEY = "user_go_net"; + public static final String PROCESS_OTHER_KEY ="user_treat_check"; + + + + private final BpmProcessFeignClient bpmProcessFeignClient; + + private final UserReportPOService userReportPOService; + + + private final DeptFeignClient deptFeignClient; + + private final UserFeignClient userFeignClient; + + @Override + @Transactional(rollbackFor = Exception.class) + public String addUserNormal(UserReportNormalParam userReportNormalParam) { + UserReportNormalPO userReportNormalPO = new UserReportNormalPO(); + BeanUtil.copyProperties(userReportNormalParam, userReportNormalPO); + userReportNormalPO.setState(DataStateEnum.ENABLE.getCode()); + userReportNormalPO.setStatus(FlowStatusEnum.AUDIT.getCode()); + this.save(userReportNormalPO); + // 发起 BPM 流程 + Map processInstanceVariables = new HashMap<>(); + BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO(); + if(userReportNormalParam.getType() == 0){ + bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY); + }else { + bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_OTHER_KEY); + } + + bpmProcessInstanceCreateReqDTO.setBusinessKey(userReportNormalPO.getId()); + bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(userReportNormalParam.getStartUserSelectAssignees()); + bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables); + String processInstanceId = bpmProcessFeignClient.createProcessInstance(userReportNormalPO.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData(); + // 将工作流的编号,更新到流程单中 + userReportNormalPO.setProcessInstanceId(processInstanceId); + this.baseMapper.updateById(userReportNormalPO); + return userReportNormalPO.getId(); + } + + @Override + public Page userReportGoNetPage(UserReportNormalParam userReportNormalParam) { + Page pageResult = new Page<>(); + + + List deptIds = deptFeignClient.getDepSonIdtByDeptId(RequestUtil.getDeptIndex()).getData(); + List userList = userFeignClient.getUserInfoByDeptIds(deptIds).getData(); + List userIds = userList.stream().map(User::getId).distinct().collect(Collectors.toList()); + if(CollUtil.isEmpty(userIds)){ + return pageResult; + } + + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.orderByDesc(UserReportNormalPO::getCreateTime) + .eq(UserReportNormalPO::getType,userReportNormalParam.getType()) + .in(UserReportNormalPO::getCreateBy, userIds) + .eq(UserReportNormalPO::getUserReportId,userReportNormalParam.getUserReportId()); + Page page = this.page(new Page<>(PageFactory.getPageNum(userReportNormalParam), PageFactory.getPageSize(userReportNormalParam)), lambdaQueryWrapper); + if (CollUtil.isNotEmpty(page.getRecords())) { + List ids = page.getRecords().stream().map(UserReportNormalPO::getUserReportId).distinct().collect(Collectors.toList()); + List userReportPOList = userReportPOService.list(new LambdaQueryWrapper().in(UserReportPO::getId, ids)); + Map map = userReportPOList.stream().collect(Collectors.toMap(UserReportPO::getId, Function.identity())); + + List temList = new ArrayList<>(); + page.getRecords().forEach(item -> { + UserReportVO.UserReportGoNetVO vo = new UserReportVO.UserReportGoNetVO(); + UserReportPO userReportPO = map.get(item.getUserReportId()); + BeanUtil.copyProperties(userReportPO,vo); + vo.setId(item.getId()); + vo.setUserReportId(item.getUserReportId()); + vo.setOtherReport(item.getReportUrl()); + vo.setProcessInstanceId(item.getProcessInstanceId()); + vo.setCreateTime(item.getCreateTime()); + vo.setStatus(item.getStatus()); + vo.setReporter(item.getCreateBy()); + temList.add(vo); + }); + BeanUtil.copyProperties(page,pageResult); + pageResult.setRecords(temList); + } + return pageResult; + } + + @Override + public UserReportVO.UserReportGoNetVO userReportGoNetById(String id) { + UserReportNormalPO userReportNormalPO = this.getById(id); + UserReportPO userReportPO = userReportPOService.getById(userReportNormalPO.getUserReportId()); + UserReportVO.UserReportGoNetVO vo = new UserReportVO.UserReportGoNetVO(); + BeanUtil.copyProperties(userReportPO,vo); + BeanUtil.copyProperties(userReportNormalPO,vo); + vo.setOtherReport(userReportNormalPO.getReportUrl()); + return vo; + } + + @Override + public void updateUserReportNormalStatus(String businessKey, Integer status) { + this.update(new UpdateWrapper().lambda().set(UserReportNormalPO::getStatus,status).eq(UserReportNormalPO::getId,businessKey)); + } +} diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java index 734101308..6b2ac8f73 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java @@ -251,6 +251,10 @@ public class UserReportPOServiceImpl extends ServiceImpl collect = list.stream().map(temp -> { UserReportVO vo = new UserReportVO(); BeanUtils.copyProperties(temp, vo); + UserVO userVO = userFeignClient.getUserById(temp.getReporter()).getData(); + vo.setReporter(temp.getReporter()); + vo.setReporterName(userVO.getName()); + vo.setOrgName(deptFeignClient.getDeptById(temp.getOrgId()).getData().getName()); return vo; }).collect(Collectors.toList()); return collect; diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/api/UserFeignClient.java b/pqs-user/user-api/src/main/java/com/njcn/user/api/UserFeignClient.java index 54292f4f2..692dc0882 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/api/UserFeignClient.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/api/UserFeignClient.java @@ -124,4 +124,11 @@ public interface UserFeignClient { @PostMapping("/getUserVOByIdList") HttpResult> getUserVOByIdList(@RequestBody List ids); + /** + * 根据用户id获取该用户同部门下所有的所有用户id + * @param id 用户id + */ + @GetMapping("/getColleaguesIdByUserId") + HttpResult> getColleaguesIdByUserId(@RequestParam("id") String id); + } diff --git a/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/UserFeignClientFallbackFactory.java b/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/UserFeignClientFallbackFactory.java index 6967acbf2..45f493dfb 100644 --- a/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/UserFeignClientFallbackFactory.java +++ b/pqs-user/user-api/src/main/java/com/njcn/user/api/fallback/UserFeignClientFallbackFactory.java @@ -117,6 +117,12 @@ public class UserFeignClientFallbackFactory implements FallbackFactory> getColleaguesIdByUserId(String id) { + log.error("{}异常,降级处理,异常为:{}","根据用户id获取该用户同部门下所有的所有用户id",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + }; } } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/controller/UserController.java b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/UserController.java index bd93d4282..acc45b2c5 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/controller/UserController.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/controller/UserController.java @@ -282,6 +282,24 @@ public class UserController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userVO, methodDescribe); } + + /** + * 根据用户id获取该用户同部门下所有的所有用户id + * + * @param id 用户id + */ + @ApiIgnore + @GetMapping("/getColleaguesIdByUserId") + @OperateInfo(info = LogEnum.SYSTEM_COMMON) + @ApiOperation("根据用户id获取该用户同部门下所有的所有用户id") + @ApiImplicitParam(name = "id", value = "用户id", required = true) + HttpResult> getColleaguesIdByUserId(@RequestParam("id") String id) { + String methodDescribe = getMethodDescribe("getColleaguesIdByUserId"); + LogUtil.njcnDebug(log, "{},用户id为:{}", methodDescribe, id); + List colleagueIds = userService.getColleaguesIdByUserId(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, colleagueIds, methodDescribe); + } + /** * 审核用户 * diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/IUserService.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/IUserService.java index f5bf513f7..9394f5523 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/IUserService.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/IUserService.java @@ -200,4 +200,5 @@ public interface IUserService extends IService { List simpleList(); + List getColleaguesIdByUserId(String id); } diff --git a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java index ef250ab95..8c5bd7576 100644 --- a/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java +++ b/pqs-user/user-boot/src/main/java/com/njcn/user/service/impl/UserServiceImpl.java @@ -573,6 +573,19 @@ public class UserServiceImpl extends ServiceImpl implements IU return this.baseMapper.selectList(userLambdaQueryWrapper); } + @Override + public List getColleaguesIdByUserId(String id) { + User user = this.baseMapper.selectById(id); + //根据当前部门id获取所有子部门的id,包含当前用户部门 + List deptIds = deptService.getDepSonIdtByDeptId(user.getDeptId()); + //获取这些部门下所有的用户id + LambdaQueryWrapper userLambdaQueryWrapper = new LambdaQueryWrapper<>(); + userLambdaQueryWrapper.select(User::getId).in(User::getDeptId,deptIds); + List userList = this.baseMapper.selectList(userLambdaQueryWrapper); + //所有用户的id + return userList.stream().map(User::getId).collect(Collectors.toList()); + } + /** * 根据登录名查询用户 *