冀北电能质量问题流程修改

This commit is contained in:
hzj
2024-10-30 19:52:15 +08:00
parent b659dd055f
commit d3f412e2cb
21 changed files with 190 additions and 32 deletions

View File

@@ -74,7 +74,10 @@
supervision_temp_line_run_test.test_run_time,
supervision_temp_line_run_test.create_by,
supervision_warning_leaflet.problem_type problemType,
supervision_temp_line_run_test_warning.reason problemReason
supervision_temp_line_run_test_warning.reason problemReason,
supervision_temp_line_run_test_warning.deal_state dealState,
supervision_warning_leaflet.take_step takeStep,
supervision_warning_leaflet.report_path reportPath
FROM supervision_temp_line_debug
inner JOIN supervision_temp_line_report
ON supervision_temp_line_report.id = supervision_temp_line_debug.id

View File

@@ -4,7 +4,11 @@
<select id="getPage" resultType="com.njcn.supervision.pojo.vo.problem.SupervisionUserComplaintVO">
select
*
from supervision_user_complaint supervision_user_complaint WHERE ${ew.sqlSegment}
supervision_user_complaint.*,
supervision_warning_leaflet.take_step takeStep,
supervision_warning_leaflet.report_path reportPath
from supervision_user_complaint supervision_user_complaint
left join supervision_warning_leaflet
on supervision_warning_leaflet.problem_id = supervision_user_complaint.id WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -10,10 +10,14 @@
supervision_survey_plan.plan_start_time planStartTime,
supervision_survey_plan.supv_type supvType,
supervision_survey_plan.supv_object_name supvObjectName,
supervision_survey_plan.plan_end_time planEndTime
supervision_survey_plan.plan_end_time planEndTime,
supervision_warning_leaflet.take_step takeStep,
supervision_warning_leaflet.report_path reportPath
FROM supervision_survey_test supervision_survey_test
left join supervision_survey_plan supervision_survey_plan
on supervision_survey_test.plan_id = supervision_survey_plan.id
left join supervision_warning_leaflet
on supervision_warning_leaflet.problem_id = supervision_survey_test.id
WHERE ${ew.sqlSegment}
</select>

View File

@@ -20,6 +20,7 @@ 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.enums.common.DealStateEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.biz.commApi.CommLineClient;
@@ -335,6 +336,7 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
warning.setId(IdWorker.get32UUID());
warning.setLineRunId(businessKey);
warning.setReason(reason);
warning.setDealState(DealStateEnum.UNSOLVED.getCode());
warning.setTestRunReport(supervisionTempLineRunTestPO.getTestRunReport());
tempLineRunTestWarningService.save(warning);
}

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
@@ -27,6 +28,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* @Description: 试运行评估问题 服务实现类
@@ -55,10 +57,17 @@ public class LineRunTestProblemServiceImpl implements ILineRunTestProblemService
List<String> data = deptFeignClient.getDepSonIdtByDeptId(supervisionTempLineDebugQuery.getOrgNo()).getData();
queryWrapper.in("supervision_temp_line_report.org_id", data);
}
//添加上时间范围
queryWrapper.between("supervision_temp_line_run_test_warning.create_time",
DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime())));
//添加上时间范围,如果不是只查询已处理的,时间筛选无效
if (Objects.nonNull(supervisionTempLineDebugQuery.getSearchBeginTime())&& StringUtils.equals(supervisionTempLineDebugQuery.getDealState(),"1")){
//添加上时间范围
queryWrapper.between("supervision_temp_line_run_test_warning.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime())));
}
queryWrapper.eq(StringUtils.equals(supervisionTempLineDebugQuery.getDealState(),"0"),"supervision_temp_line_run_test_warning.deal_state",0);
// queryWrapper.between("supervision_temp_line_run_test_warning.create_time",
// DateUtil.beginOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchBeginTime())),
// DateUtil.endOfDay(DateUtil.parse(supervisionTempLineDebugQuery.getSearchEndTime())));
queryWrapper.orderByDesc("supervision_temp_line_run_test_warning.create_time");
return lineDebugPOMapper.pageProblem(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper);
}

View File

@@ -10,6 +10,7 @@ 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.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.bpm.api.BpmProcessFeignClient;
@@ -20,7 +21,9 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.pojo.vo.TodoVO;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.common.DealStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.harmonic.pojo.dto.RMpPartHarmonicDetailDTO;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.supervision.enums.*;
@@ -28,9 +31,13 @@ import com.njcn.supervision.mapper.leaflet.WarningLeafletMapper;
import com.njcn.supervision.pojo.param.leaflet.WarningLeafletParam;
import com.njcn.supervision.pojo.po.device.TempLineRunTestWarning;
import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet;
import com.njcn.supervision.pojo.po.problem.SupervisionUserComplaintPO;
import com.njcn.supervision.pojo.po.survey.SurveyTest;
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
import com.njcn.supervision.service.device.TempLineRunTestWarningService;
import com.njcn.supervision.service.leaflet.IWarningLeafletService;
import com.njcn.supervision.service.problem.SupervisionUserComplaintPOService;
import com.njcn.supervision.service.survey.ISurveyTestService;
import com.njcn.supervision.utils.InstanceUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -47,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -76,32 +84,53 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
@Resource
private TempLineRunTestWarningService lineRunTestWarningService;
@Resource
private ISurveyTestService surveyTestService;
@Resource
private SupervisionUserComplaintPOService supervisionUserComplaintService;
/**
* 不创建工作流,只是创建一个告警单,需要待用户反馈后才会进入流程
*/
@Override
public String createLeaflet(String name, String deptId, String code, String id, Integer problemType, Integer leaflet, String issueDetail, String reformAdvice, String filePath) {
WarningLeaflet warningLeaflet = new WarningLeaflet();
warningLeaflet.setLeafletName(name);
warningLeaflet.setDeptId(deptId);
warningLeaflet.setLeafletNo(code);
warningLeaflet.setProblemType(problemType);
warningLeaflet.setProblemId(id);
warningLeaflet.setLeafletType(leaflet);
warningLeaflet.setIssueDetail(issueDetail);
//新增字段整改意见
warningLeaflet.setReformAdvice(reformAdvice);
warningLeaflet.setState(DataStateEnum.ENABLE.getCode());
warningLeaflet.setStatus(FlowStatusEnum.NO_FEEDBACK.getCode());
warningLeaflet.setFilePath(filePath);
this.baseMapper.insert(warningLeaflet);
return warningLeaflet.getId();
WarningLeaflet one = this.lambdaQuery().eq(WarningLeaflet::getProblemId, id).one();
if(Objects.isNull(one)){
WarningLeaflet warningLeaflet = new WarningLeaflet();
warningLeaflet.setLeafletName(name);
warningLeaflet.setDeptId(deptId);
warningLeaflet.setLeafletNo(code);
warningLeaflet.setProblemType(problemType);
warningLeaflet.setProblemId(id);
warningLeaflet.setLeafletType(leaflet);
warningLeaflet.setIssueDetail(issueDetail);
//新增字段整改意见
warningLeaflet.setReformAdvice(reformAdvice);
warningLeaflet.setState(DataStateEnum.ENABLE.getCode());
warningLeaflet.setStatus(FlowStatusEnum.NO_FEEDBACK.getCode());
warningLeaflet.setDealState(DealStateEnum.UNSOLVED.getCode());
warningLeaflet.setFilePath(filePath);
this.baseMapper.insert(warningLeaflet);
return warningLeaflet.getId();
}else {
//新增字段整改意见
one.setReformAdvice(reformAdvice);
one.setDealState(DealStateEnum.UNSOLVED.getCode());
one.setCreateTime(LocalDateTime.now());
this.updateById(one);
return one.getId();
}
}
@Override
public Page<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(warningLeafletQueryParam)) {
if (Objects.nonNull(warningLeafletQueryParam)&& StringUtils.equals(warningLeafletQueryParam.getDealState(),"1")) {
//添加上时间范围
warningLeafletVOQueryWrapper.between("supervision_warning_leaflet.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(warningLeafletQueryParam.getSearchBeginTime())),
@@ -114,6 +143,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
warningLeafletVOQueryWrapper.in("supervision_warning_leaflet.dept_id", deptIds);
}
warningLeafletVOQueryWrapper
.eq(StringUtils.equals(warningLeafletQueryParam.getDealState(),"0"),"supervision_temp_line_run_test_warning.deal_state",0)
.eq("supervision_warning_leaflet.state", DataStateEnum.ENABLE.getCode())
.eq("supervision_warning_leaflet.leaflet_type", LeafletTypeEnum.WARNING.getCode())
.orderByDesc("supervision_warning_leaflet.Update_Time");
@@ -228,10 +258,43 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateProcessStatus(String businessKey, Integer status) {
this.lambdaUpdate().set(WarningLeaflet::getStatus, status).eq(WarningLeaflet::getId, businessKey).update();
WarningLeaflet one = this.lambdaQuery().eq(WarningLeaflet::getId, businessKey).one();
//如果审核通过且problem_type不是在线监测的1技术监督管理2在线监测超标问题3用户投诉4现场测试超标,将对应能质量问题改成已解决,所有的预告警单改成已解决
if(status==2&&one.getProblemType()!=2){
//多次的预告警单是删除
this.lambdaUpdate().set(WarningLeaflet::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(WarningLeaflet::getId, businessKey)
.eq(WarningLeaflet::getProblemId,one.getProblemId()).update();
updatePowerProblem(one.getProblemType(),one.getProblemId());
}
}
private void updatePowerProblem(Integer problemType, String problemId) {
switch (problemType) {
//技术监督计划
case 1:
surveyTestService.lambdaUpdate().set(SurveyTest::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(SurveyTest::getId,problemId).update();
break;
//用户投诉问题
case 3:
supervisionUserComplaintService.lambdaUpdate().set(SupervisionUserComplaintPO::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(SupervisionUserComplaintPO::getId,problemId).update();
break;
//试运行监测点问题
case 4:
lineRunTestWarningService.lambdaUpdate().set(TempLineRunTestWarning::getDealState, DealStateEnum.RESOLVED.getCode())
.eq(TempLineRunTestWarning::getId,problemId).update();
break;
default:
break;
}
}
@Override
public BpmInstanceInfo getInstanceInfo(String businessId) {
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();

View File

@@ -6,9 +6,11 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
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.common.pojo.enums.common.DealStateEnum;
import com.njcn.supervision.enums.LeafletTypeEnum;
import com.njcn.supervision.enums.ProblemTypeEnum;
import com.njcn.supervision.mapper.problem.SupervisionUserComplaintPOMapper;
@@ -52,6 +54,7 @@ public class SupervisionUserComplaintPOServiceImpl extends ServiceImpl<Supervisi
BeanUtil.copyProperties(supervisionUserComplaintParam,supervisionUserComplaintPO);
supervisionUserComplaintPO.setInitiateWarningFlag(0);
supervisionUserComplaintPO.setState(DataStateEnum.ENABLE.getCode());
supervisionUserComplaintPO.setDealState(DealStateEnum.UNSOLVED.getCode());
this.save(supervisionUserComplaintPO);
return supervisionUserComplaintPO.getId();
}
@@ -59,8 +62,8 @@ public class SupervisionUserComplaintPOServiceImpl extends ServiceImpl<Supervisi
@Override
public Page<SupervisionUserComplaintVO> getSupervisionUserComplaint(SupervisionUserComplaintParam.SupervisionUserComplaintQueryParam supervisionUserComplaintQueryParam) {
QueryWrapper<SupervisionUserComplaintParam> supervisionUserComplaintQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(supervisionUserComplaintQueryParam)) {
//如果不是只查询已处理的,时间无效
if (Objects.nonNull(supervisionUserComplaintQueryParam.getSearchBeginTime())&& StringUtils.equals(supervisionUserComplaintQueryParam.getDealState(),"1")){
//添加上时间范围
supervisionUserComplaintQueryWrapper.between("supervision_user_complaint.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(supervisionUserComplaintQueryParam.getSearchBeginTime())),
@@ -74,6 +77,8 @@ public class SupervisionUserComplaintPOServiceImpl extends ServiceImpl<Supervisi
supervisionUserComplaintQueryWrapper
.eq("supervision_user_complaint.state",DataStateEnum.ENABLE.getCode())
//未解决查未解决,已解决查未解决+已解决,反正未解决的都要查
.eq(StringUtils.equals(supervisionUserComplaintQueryParam.getDealState(),"0"),"supervision_user_complaint.deal_state",0)
.orderByDesc("supervision_user_complaint.Update_Time");
Page<SupervisionUserComplaintVO> page = this.baseMapper.getPage(new Page<>(PageFactory.getPageNum(supervisionUserComplaintQueryParam), PageFactory.getPageSize(supervisionUserComplaintQueryParam)), supervisionUserComplaintQueryWrapper);
if (CollUtil.isNotEmpty(page.getRecords())) {

View File

@@ -18,6 +18,7 @@ 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.enums.common.DealStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
@@ -236,6 +237,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
surveyTest.setInitiateWarningFlag(0);
surveyTest.setSubstation(subId);
surveyTest.setCustomSubstationFlag(0);
surveyTest.setDealState(DealStateEnum.UNSOLVED.getCode());
surveyTest.setCreateBy("");
surveyTest.setStatus(FlowStatusEnum.NEW.getCode());
surveyTestService.save(surveyTest);
@@ -248,6 +250,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
surveyTest.setSubstation(surveyPlan.getSubstation());
surveyTest.setInitiateWarningFlag(0);
surveyTest.setCustomSubstationFlag(1);
surveyTest.setDealState(DealStateEnum.UNSOLVED.getCode());
surveyTest.setStatus(FlowStatusEnum.NEW.getCode());
surveyTest.setCreateBy("");
surveyTestService.save(surveyTest);

View File

@@ -21,6 +21,7 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.pojo.vo.TodoVO;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.common.DealStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
@@ -160,10 +161,13 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
public Page<SurveyTestVO> pageProblemSurvey(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam) {
QueryWrapper<SurveyTestVO> surveyTestVOQueryWrapper = new QueryWrapper<>();
if (Objects.nonNull(surveyTestQueryParam)) {
//添加上时间范围
surveyTestVOQueryWrapper.between("supervision_survey_test.create_time",
DateUtil.beginOfDay(DateUtil.parse(surveyTestQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(surveyTestQueryParam.getSearchEndTime())));
//如果不是只查询已处理的,时间无效
if (Objects.nonNull(surveyTestQueryParam.getSearchBeginTime())&& StringUtils.equals(surveyTestQueryParam.getDealState(),"1")){
//添加上时间范围
surveyTestVOQueryWrapper.between("supervision_survey_test.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(surveyTestQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(surveyTestQueryParam.getSearchEndTime())));
}
//根据工程名称模糊搜索
if (StrUtil.isNotBlank(surveyTestQueryParam.getSearchValue())) {
LambdaQueryWrapper<SurveyPlan> surveyPlanLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -185,6 +189,8 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
}
}
surveyTestVOQueryWrapper
//未解决查未解决,已解决查未解决+已解决,反正未解决的都要查
.eq(StringUtils.equals(surveyTestQueryParam.getDealState(),"0"),"supervision_survey_test.deal_state",0)
.eq("supervision_survey_test.problem_flag", 1)
.eq("supervision_survey_test.status", FlowStatusEnum.APPROVE.getCode())
.eq("supervision_survey_test.state", DataStateEnum.ENABLE.getCode())
@@ -232,6 +238,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
}
surveyTest.setState(DataStateEnum.ENABLE.getCode());
surveyTest.setDealState(DealStateEnum.UNSOLVED.getCode());
surveyTest.setCreateBy(RequestUtil.getUserIndex());
this.updateById(surveyTest);
// 发起 BPM 流程