1.审批流程中审批不通过会造成俩条数据bug解决

2.解决公共方法,变电站信息台账数据量不准确问题,增加变电数据判断
3.技术监督-干扰源治理验收报告逻辑校验
4.技术监督-台账联调,增加治理验收和入网评估报告验证
This commit is contained in:
wr
2024-07-24 09:43:06 +08:00
parent a9aa0785da
commit 67ad03ddbe
13 changed files with 169 additions and 54 deletions

View File

@@ -1,10 +1,13 @@
package com.njcn.supervision.service.device.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -22,17 +25,24 @@ import com.njcn.device.pq.api.TerminalBaseClient;
import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.Line;
import com.njcn.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.enums.UserNatureEnum;
import com.njcn.supervision.mapper.device.SupervisionTempLineDebugPOMapper;
import com.njcn.supervision.mapper.user.UserReportNormalMapper;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam;
import com.njcn.supervision.pojo.po.device.SupervisionTempDeviceReport;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import com.njcn.supervision.pojo.vo.device.SupervisionDevMainReportVO;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO;
import com.njcn.supervision.service.device.SupervisionDevMainReportPOService;
import com.njcn.supervision.service.device.SupervisionTempDeviceReportService;
import com.njcn.supervision.service.device.SupervisionTempLineDebugPOService;
import com.njcn.supervision.service.device.SupervisionTempLineReportService;
import com.njcn.supervision.service.user.UserReportPOService;
import com.njcn.supervision.service.user.UserReportProjectPOService;
import com.njcn.supervision.service.user.UserReportSensitivePOService;
import com.njcn.supervision.service.user.UserReportSubstationPOService;
import com.njcn.supervision.utils.InstanceUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.DictTreeFeignClient;
@@ -66,20 +76,20 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
private final BpmProcessFeignClient bpmProcessFeignClient;
private final DeptFeignClient deptFeignClient;
private final SupervisionTempLineReportService supervisionTempLineReportService;
private final SupervisionDevMainReportPOService supervisionDevMainReportPOService;
private final SupervisionTempDeviceReportService supervisionTempDeviceReportService;
private final LineFeignClient lineFeignClient;
private final DictTreeFeignClient dictTreeFeignClient;
private final DicDataFeignClient dicDataFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final UserFeignClient userFeignClient;
private final TerminalBaseClient terminalBaseClient;
private final UserReportPOService userReportPOService;
private final UserReportProjectPOService userReportProjectPOService;
private final UserReportSubstationPOService userReportSubstationPOService;
private final UserReportSensitivePOService userReportSensitivePOService;
private final UserReportNormalMapper userReportNormalMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam) {
@@ -266,7 +276,60 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
}
//获取临时监测点详情
SupervisionTempLineReport tempLine = supervisionTempLineReportService.getById(id);
//需要审核报告是否审核通过
UserReportPO temp = userReportPOService.getById(tempLine.getUserId());
//是否存在治理方案
Integer needGovernance = 0;
if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_POWER_GRID.getCode(),
UserNatureEnum.EXTEND_POWER_GRID.getCode()
).contains(temp.getUserType())) {
//电网工程类用户额外数据
needGovernance = userReportProjectPOService.getById(temp.getId()).getNeedGovernance();
} else if (
CollectionUtil.newArrayList(
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
).contains(temp.getUserType())) {
//非线性负荷用户 & 新能源发电站用户
needGovernance = userReportSubstationPOService.getById(temp.getId()).getNeedGovernance();
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(temp.getUserType())) {
// 敏感及重要用户
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
}
//添加治理评估文件,需先判断入网评估是否审核通过
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, temp.getId())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
.orderByDesc(UserReportNormalPO::getCreateTime)
);
if (CollUtil.isNotEmpty(list)) {
Optional<UserReportNormalPO> netInReport = list.stream().filter(x -> 0 == x.getType()).findFirst();
if(netInReport.isPresent()){
if(netInReport.get().getStatus()!=2){
throw new BusinessException("最新入网验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写入网验收方案流程,审核通过后方可操作!");
}
if (needGovernance == 1) {
Optional<UserReportNormalPO> governReport = list.stream().filter(x -> 1 == x.getType()).findFirst();
if(governReport.isPresent()){
if(governReport.get().getStatus()!=2){
throw new BusinessException("最新治理工程验收方案流程,暂未审核通过!");
}
}else{
throw new BusinessException("请填写治理工程验收方案流程,审核通过后方可操作!");
}
}
} else {
throw new BusinessException("请上传,入网设计方案或者治理工程验收方案");
}
//获取关联的设备信息
SupervisionTempDeviceReport tempDevice = supervisionTempDeviceReportService.getById(tempLine.getMonitoringTerminalCode());

View File

@@ -361,7 +361,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
}
warningLeafletVOQueryWrapper
.eq("supervision_warning_leaflet.state", DataStateEnum.ENABLE.getCode())
.in("supervision_warning_leaflet.status", Arrays.asList(3,4,5))
.ne("supervision_warning_leaflet.status", 2)
.orderByDesc("supervision_warning_leaflet.Update_Time");
Page<WarningLeafletVO> warningLeafletVOPage = this.baseMapper.alarmPageData(new Page<>(PageFactory.getPageNum(warningLeafletQueryParam), PageFactory.getPageSize(warningLeafletQueryParam)), warningLeafletVOQueryWrapper);
//目前仅知道现场测试超标会有附件

View File

@@ -14,7 +14,6 @@ import com.njcn.bpm.pojo.dto.BpmInstanceInfo;
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.supervision.enums.SupervisionKeyEnum;
import com.njcn.supervision.mapper.user.UserReportNormalMapper;
import com.njcn.supervision.pojo.param.user.UserReportNormalParam;
@@ -57,26 +56,6 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
@Override
@Transactional(rollbackFor = Exception.class)
public String addUserNormal(UserReportNormalParam userReportNormalParam) {
//添加治理评估文件,需先判断入网评估是否审核通过
if (1 == userReportNormalParam.getType()) {
List<UserReportNormalPO> list = this.list(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, userReportNormalParam.getUserReportId())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
.eq(UserReportNormalPO::getType, 0)
.orderByDesc(UserReportNormalPO::getCreateTime)
);
if(CollUtil.isNotEmpty(list)){
List<String> collect = list.stream().filter(x -> Objects.equals(x.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus()))
.map(UserReportNormalPO::getId)
.collect(Collectors.toList());
if(CollUtil.isNotEmpty(collect)){
throw new BusinessException("入网方案申请未都通过!");
}
}else{
throw new BusinessException("请先进行入网方案申请!");
}
}
UserReportNormalPO userReportNormalPO = new UserReportNormalPO();
BeanUtil.copyProperties(userReportNormalParam, userReportNormalPO);
userReportNormalPO.setState(DataStateEnum.ENABLE.getCode());
@@ -143,13 +122,10 @@ public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMap
@Override
public Page<UserReportVO.UserReportGoNetVO> userReportGoNetPage(UserReportNormalParam userReportNormalParam) {
Page<UserReportVO.UserReportGoNetVO> pageResult = new Page<>();
List<String> colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData();
if (CollUtil.isEmpty(colleaguesIds)) {
return pageResult;
}
LambdaQueryWrapper<UserReportNormalPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByDesc(UserReportNormalPO::getCreateTime)
.eq(UserReportNormalPO::getType, userReportNormalParam.getType())

View File

@@ -110,16 +110,16 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "1")) {
userReportPO.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
} else {
if(!Objects.equals(userReportParam.getSaveOrCheckflag(), "0")){
if (!Objects.equals(userReportParam.getSaveOrCheckflag(), "0")) {
userReportPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
}
}
if(ObjectUtil.isNotNull(userReportParam.getDataType())){
if (ObjectUtil.isNotNull(userReportParam.getDataType())) {
userReportPO.setDataType(userReportParam.getDataType());
if(userReportParam.getDataType()==1){
if (userReportParam.getDataType() == 1) {
userReportPO.setStatus(FlowStatusEnum.APPROVE.getCode());
}
}else{
} else {
userReportPO.setDataType(0);
}
this.saveOrUpdate(userReportPO);
@@ -295,8 +295,8 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
if (StrUtil.isNotBlank(userReportQueryParam.getSearchBeginTime()) && StrUtil.isNotBlank(userReportQueryParam.getSearchEndTime())) {
userReportVOQueryWrapper.and(x -> x.between("supervision_user_report.expected_production_date",
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
.or()
.isNull("supervision_user_report.expected_production_date"));
}
@@ -361,8 +361,10 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.orderByDesc(UserReportNormalPO::getCreateTime)
);
userReportVO.setNetInReport(list.stream().filter(x -> 0==x.getType()).map(UserReportNormalPO::getReportUrl).collect(Collectors.toList()));
userReportVO.setGovernReport(list.stream().filter(x -> 1==x.getType()).map(UserReportNormalPO::getReportUrl).collect(Collectors.toList()));
Optional<String> netInReport = list.stream().filter(x -> 0 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
Optional<String> governReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
userReportVO.setNetInReport(Arrays.asList(netInReport.isPresent() ? netInReport.get() : null));
userReportVO.setGovernReport(Arrays.asList(governReport.isPresent() ? governReport.get() : null));
return userReportVO;
}
@@ -433,13 +435,13 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
}
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
Page<UserReportVO> page;
if(!allDataFlag){
page= this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
}else{
if (!allDataFlag) {
page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
} else {
page = this.baseMapper.pageUpdate(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
}
page.getRecords().forEach(temp->{
page.getRecords().forEach(temp -> {
Integer needGovernance = 0;
if (
CollectionUtil.newArrayList(
@@ -462,8 +464,29 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
// 敏感及重要用户
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
}
temp.setNeedGovernance(needGovernance);
//添加治理评估文件,需先判断入网评估是否审核通过
Boolean type = true;
if (1 == temp.getNeedGovernance()) {
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
.eq(UserReportNormalPO::getUserReportId, temp.getId())
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
.eq(UserReportNormalPO::getType, 0)
.orderByDesc(UserReportNormalPO::getCreateTime)
);
if (CollUtil.isNotEmpty(list)) {
List<String> collect = list.stream().filter(x -> !Objects.equals(x.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus()))
.map(UserReportNormalPO::getId)
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
type = false;
}
} else {
type = false;
}
}
temp.setType(type);
});
return page;
}
@@ -659,7 +682,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
params.setNeedVerify(true);
params.setStartSheetIndex(0);
params.setSheetNum(1);
List<SensitiveUserSExcel> sensitiveUserExcels=new ArrayList<>();
List<SensitiveUserSExcel> sensitiveUserExcels = new ArrayList<>();
try {
ExcelImportResult<SensitiveUserSExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveUserSExcel.class, params);
//如果存在非法数据,将不合格的数据导出
@@ -859,7 +882,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
params.setNeedVerify(true);
params.setStartSheetIndex(0);
params.setSheetNum(1);
List<SensitiveReportExcel> sensitiveUserExcels=new ArrayList<>();
List<SensitiveReportExcel> sensitiveUserExcels = new ArrayList<>();
try {
ExcelImportResult<SensitiveReportExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveReportExcel.class, params);
//如果存在非法数据,将不合格的数据导出