From 06ec23710d30872ffae2b6a7bad2352d0ea994a4 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Tue, 4 Jun 2024 14:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=99=AE=E6=B5=8B=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=B8=A6=E6=9D=A5=E7=9A=84=E5=85=B6=E4=BB=96=E5=8A=9F?= =?UTF-8?q?=E8=83=BDbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/po/survey/SurveyTest.java | 8 ++ .../pojo/vo/survey/SurveyTestVO.java | 7 ++ .../survey/SurveyTestController.java | 22 ++++ .../impl/WarningLeafletServiceImpl.java | 8 +- .../service/survey/ISurveyTestService.java | 3 + .../survey/impl/SurveyPlanServiceImpl.java | 2 + .../survey/impl/SurveyTestServiceImpl.java | 118 +++++++++++++++++- 7 files changed, 164 insertions(+), 4 deletions(-) diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SurveyTest.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SurveyTest.java index 9defbad7a..45ccfcb4b 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SurveyTest.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/po/survey/SurveyTest.java @@ -1,5 +1,6 @@ package com.njcn.supervision.pojo.po.survey; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.njcn.db.bo.BaseEntity; import java.io.Serializable; @@ -91,6 +92,13 @@ public class SurveyTest extends BaseEntity implements Serializable { */ private String historyInstanceId; + + /** + * 是否发起警告单(0:否;1:是) + */ + @TableField(value = "initiate_warning_flag") + private Integer initiateWarningFlag; + /** * 状态:0-删除 1-正常 */ diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SurveyTestVO.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SurveyTestVO.java index 9f6607e4d..0f1015194 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SurveyTestVO.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/vo/survey/SurveyTestVO.java @@ -1,5 +1,6 @@ package com.njcn.supervision.pojo.vo.survey; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.njcn.db.bo.BaseEntity; import lombok.Data; @@ -116,6 +117,12 @@ public class SurveyTestVO extends BaseEntity implements Serializable { */ private String historyInstanceId; + + /** + * 是否发起警告单(0:否;1:是) + */ + private Integer initiateWarningFlag; + /** * 状态:0-删除 1-正常 */ diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyTestController.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyTestController.java index 37290dfa9..5964a4d35 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyTestController.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/controller/survey/SurveyTestController.java @@ -9,7 +9,9 @@ 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.survey.SupervisionGeneralSurveyPlanParm; import com.njcn.supervision.pojo.param.survey.SurveyTestParam; +import com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanDetailVO; import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO; import com.njcn.supervision.pojo.vo.survey.SurveyTestVO; import com.njcn.supervision.service.survey.ISurveyTestService; @@ -51,6 +53,16 @@ public class SurveyTestController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/pageProblemSurvey") + @ApiOperation("分页查询当前用户能看到的普测计划中存在超标问题") + @ApiImplicitParam(name = "surveyTestQueryParam", value = "参数", required = true) + public HttpResult> pageProblemSurvey(@RequestBody @Validated SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam ){ + String methodDescribe = getMethodDescribe("pageProblemSurvey"); + Page out = surveyTestService.pageProblemSurvey(surveyTestQueryParam); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe); + } + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) @PostMapping("/add") @ApiOperation("新增普测测试") @@ -100,5 +112,15 @@ public class SurveyTestController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, surveyTestVO, methodDescribe); } + + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @GetMapping("/initiateWarningLeaflet") + @ApiOperation("针对有问题的现场测试发起告警单") + public HttpResult initiateWarningLeaflet(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("initiateWarningLeaflet"); + surveyTestService.initiateWarningLeaflet(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Boolean.TRUE, methodDescribe); + } } + 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 index 651fc728c..0d1e2d800 100644 --- 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 @@ -25,8 +25,10 @@ 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.po.survey.SupervisionGeneralSurveyPlanPO; +import com.njcn.supervision.pojo.po.survey.SurveyTest; import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO; import com.njcn.supervision.service.leaflet.IWarningLeafletService; +import com.njcn.supervision.service.survey.ISurveyTestService; import com.njcn.supervision.service.survey.SupervisionGeneralSurveyPlanPOService; import com.njcn.supervision.utils.InstanceUtil; import com.njcn.system.api.DicDataFeignClient; @@ -65,6 +67,8 @@ public class WarningLeafletServiceImpl extends ServiceImpl { Page surveyTestPage(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam); + Page pageProblemSurvey(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam); String addSurveyTest(SurveyTestParam surveyTestParam); @@ -28,4 +29,6 @@ public interface ISurveyTestService extends IService { void updateSurveyTestStatus(String businessKey, Integer status); SurveyTestVO getVOById(String id); + + void initiateWarningLeaflet(String id); } diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyPlanServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyPlanServiceImpl.java index 7570c028e..019d70431 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyPlanServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/survey/impl/SurveyPlanServiceImpl.java @@ -202,6 +202,7 @@ public class SurveyPlanServiceImpl extends ServiceImpl @@ -64,6 +75,8 @@ public class SurveyTestServiceImpl extends ServiceImpl surveyTestVOQueryWrapper = new QueryWrapper<>(); if (Objects.nonNull(surveyTestQueryParam)) { //添加上时间范围 - surveyTestVOQueryWrapper.between("supervision_survey_test.Create_Time", + surveyTestVOQueryWrapper.between("supervision_survey_test.create_time", DateUtil.beginOfDay(DateUtil.parse(surveyTestQueryParam.getSearchBeginTime())), DateUtil.endOfDay(DateUtil.parse(surveyTestQueryParam.getSearchEndTime()))); //根据工程名称模糊搜索 if (StrUtil.isNotBlank(surveyTestQueryParam.getSearchValue())) { - surveyTestVOQueryWrapper.like("supervision_survey_test.plan_name", surveyTestQueryParam.getSearchValue()); + LambdaQueryWrapper surveyPlanLambdaQueryWrapper = new LambdaQueryWrapper<>(); + surveyPlanLambdaQueryWrapper.eq(SurveyPlan::getState, DataStateEnum.ENABLE.getCode()) + .like(SurveyPlan::getPlanName, surveyTestQueryParam.getSearchValue()); + List surveyPlans = surveyPlanService.getBaseMapper().selectList(surveyPlanLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(surveyPlans)) { + List planIds = surveyPlans.stream().map(SurveyPlan::getId).collect(Collectors.toList()); + surveyTestVOQueryWrapper.in("supervision_survey_test.plan_id", planIds); + } + } else { + //没有匹配的。直接返回 + return new Page<>(); } } //获取当前用户部门所有同事的id,查看该部门下所有的数据 @@ -108,6 +131,55 @@ public class SurveyTestServiceImpl extends ServiceImpl pageProblemSurvey(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam) { + QueryWrapper 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 (StrUtil.isNotBlank(surveyTestQueryParam.getSearchValue())) { + LambdaQueryWrapper surveyPlanLambdaQueryWrapper = new LambdaQueryWrapper<>(); + surveyPlanLambdaQueryWrapper.eq(SurveyPlan::getState, DataStateEnum.ENABLE.getCode()) + .like(SurveyPlan::getPlanName, surveyTestQueryParam.getSearchValue()); + List surveyPlans = surveyPlanService.getBaseMapper().selectList(surveyPlanLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(surveyPlans)) { + List planIds = surveyPlans.stream().map(SurveyPlan::getId).collect(Collectors.toList()); + surveyTestVOQueryWrapper.in("supervision_survey_test.plan_id", planIds); + } else { + //没有匹配的。直接返回 + return new Page<>(); + } + } + } + //获取当前用户部门所有同事的id,查看该部门下所有的数据 + List colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData(); + surveyTestVOQueryWrapper.in("supervision_survey_test.Create_By", colleaguesIds) + .eq("supervision_survey_test.problem_flag", 1) + .eq("supervision_survey_test.status", FlowStatusEnum.APPROVE.getCode()) + .eq("supervision_survey_test.state", DataStateEnum.ENABLE.getCode()) + .orderByDesc("supervision_survey_test.Update_Time"); + Page surveyTestVOPage = this.baseMapper.surveyTestPage(new Page<>(PageFactory.getPageNum(surveyTestQueryParam), PageFactory.getPageSize(surveyTestQueryParam)), surveyTestVOQueryWrapper); + List records = surveyTestVOPage.getRecords(); + if (CollectionUtil.isNotEmpty(records)) { + for (SurveyTestVO record : records) { + //回显部门名称 + record.setDeptName(deptFeignClient.getDeptById(record.getDeptId()).getData().getName()); + //回显变电站名称 + if (record.getCustomSubstationFlag() == 0) { + //关联台账内的变电站名称 + String substation = record.getSubstation(); + record.setSubstationName(lineFeignClient.getSubstationInfo(substation).getData().getName()); + } else { + record.setSubstationName(record.getSubstation()); + } + } + } + return surveyTestVOPage; + } + @Override @Transactional(rollbackFor = Exception.class) public String addSurveyTest(SurveyTestParam surveyTestParam) { @@ -211,4 +283,46 @@ public class SurveyTestServiceImpl extends ServiceImpl