This commit is contained in:
guosongrui
2024-05-22 14:49:19 +08:00
120 changed files with 5646 additions and 326 deletions

View File

@@ -120,4 +120,5 @@ public class DeVReportManageController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
}

View File

@@ -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;
/**
* <p>
* 前端控制器
* </p>
*
* @author cdf
* @since 2024-05-21
*/
@RestController
@RequestMapping("/supervisionTempLineRunTest")
@RequiredArgsConstructor
public class SupervisionTempLineRunTestController extends BaseController {
private final ISupervisionTempLineRunTestService iSupervisionTempLineRunTestService;
}

View File

@@ -59,6 +59,15 @@ public class TempLineController extends BaseController {
Page<SupervisionTempLineReportVO> out = supervisionTempLineReportService.getTempLineReport(supervisionTempLineReportQuery);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDetail")
@ApiOperation("查询详情")
public HttpResult<SupervisionTempLineReportVO> 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 = "更改表单状态")

View File

@@ -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<String> 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<Page<SupervisionTempLineDebugVO>> getTempLineDeug(@RequestBody @Validated SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) {
String methodDescribe = getMethodDescribe("getTempLineDeug");
Page<SupervisionTempLineDebugVO> 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<Page<SupervisionTempLineDebugVO>> pageHasDebug(@RequestBody @Validated SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) {
String methodDescribe = getMethodDescribe("pageHasDebug");
Page<SupervisionTempLineDebugVO> out = supervisionTempLineDebugPOService.pageHasDebug(supervisionTempLineDebugQuery);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getDetail")
@ApiOperation("查询详情")
public HttpResult<SupervisionTempLineDebugVO> 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<Object> 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<String> cancelTempLineReport(@Validated @RequestBody BpmProcessInstanceCancelParam cancelReqVO) {
// String methodDescribe = getMethodDescribe("cancelTempLineReport");
// String id = supervisionTempLineReportService.cancelTempLineReport(cancelReqVO);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, id, methodDescribe);
// }
}

View File

@@ -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;
/**
* <p>
* 预告警单表 前端控制器
* </p>
*
* @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<Page<WarningLeafletVO>> warningPageData(@RequestBody @Validated WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
String methodDescribe = getMethodDescribe("warningPageData");
Page<WarningLeafletVO> 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<Page<WarningLeafletVO>> alarmPageData(@RequestBody @Validated WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
String methodDescribe = getMethodDescribe("alarmPageData");
Page<WarningLeafletVO> out = warningLeafletService.alarmPageData(warningLeafletQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
}

View File

@@ -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<Object> 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<Page<SupervisionPlanVO>> pagePlan(@RequestBody SupervisionPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("pagePlan");
Page<SupervisionPlanVO> page = supervisionPlanPOService.pagePlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/initiateAudit")
@ApiOperation("发起审核")
public HttpResult<String> 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<SupervisionPlanVO> 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<Object> updateStatus(String businessKey,Integer status) {
String methodDescribe = getMethodDescribe("updateStatus");
supervisionPlanPOService.updateStatus(businessKey,status);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -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<Object> 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<Page<SupervisionProblemPO>> pageProblem(@RequestBody SupervisopnProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("pageProblem");
if(StrUtil.isBlank(supvProblemParam.getPlanId())){
throw new BusinessException("监督计划索引不可为空");
}
Page<SupervisionProblemPO> page = supervisionProblemPOService.pageProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -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<Page<SupervisionGeneralSurveyPlanDetailVO>> getPageProblemSubstationBySurvey(@RequestBody @Validated SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam ){
String methodDescribe = getMethodDescribe("pageProblemSubstationBySurvey");
Page<SupervisionGeneralSurveyPlanDetailVO> out = supervisionGeneralSurveyPlanPOService.pageProblemSubstationBySurvey(generalSurveyPlanQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/initiateWarningLeaflet")
@ApiOperation("针对有问题的现场测试发起告警单")
public HttpResult<Boolean> 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);
}
}

View File

@@ -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.*;
/**
* <p>
* 干扰源用户常态化管理 前端控制器
* </p>
*
* @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<String> 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<Page<UserReportVO.UserReportGoNetVO>> userReportGoNetPage(@RequestBody @Validated UserReportNormalParam userReportNormalParam){
String methodDescribe = getMethodDescribe("userReportGoNetPage");
Page<UserReportVO.UserReportGoNetVO> userReportId = iUserReportNormalService.userReportGoNetPage(userReportNormalParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportId, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/userReportGoNetById")
@ApiOperation("查询干扰源常态化详情")
public HttpResult<UserReportVO.UserReportGoNetVO> 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<Object> updateUserReportNormalStatus(@RequestParam("businessKey") String businessKey, @RequestParam("status")Integer status){
String methodDescribe = getMethodDescribe("updateUserReportNormalStatus");
iUserReportNormalService.updateUserReportNormalStatus(businessKey,status);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
}

View File

@@ -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<SupervisionTempLineDebugPO> {
Page<SupervisionTempLineDebugVO> page(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
Page<SupervisionTempLineDebugVO> pageHasDebug(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
}

View File

@@ -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;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
public interface SupervisionTempLineRunTestMapper extends BaseMapper<SupervisionTempLineRunTest> {
}

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.mapper.device.SupervisionTempLineDebugPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO">
<!--@mbg.generated-->
<!--@Table supervision_temp_line_debug-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="reason" jdbcType="VARCHAR" property="reason" />
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId" />
<result column="status" jdbcType="BIT" property="status" />
<result column="Create_By" jdbcType="CHAR" property="createBy" />
<result column="Create_Time" jdbcType="TIMESTAMP" property="createTime" />
<result column="Update_By" jdbcType="CHAR" property="updateBy" />
<result column="Update_Time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="State" jdbcType="BIT" property="state" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, reason, process_instance_id, `status`, Create_By, Create_Time, Update_By, Update_Time,
`State`
</sql>
<select id="page" resultType="com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO">
SELECT
supervision_temp_line_report.id id,
supervision_temp_line_report.line_id lineId,
supervision_temp_line_report.line_name lineName,
supervision_temp_line_debug.reason reason,
supervision_temp_line_debug.process_instance_id process_instanceId,
supervision_temp_line_debug.`status` `Status`
FROM
supervision_temp_line_report left
JOIN supervision_temp_line_debug ON supervision_temp_line_report.id = supervision_temp_line_debug.id
where supervision_temp_line_report.`status`=2
and ${ew.sqlSegment}
</select>
<select id="pageHasDebug" resultType="com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO">
SELECT
supervision_temp_line_report.id id,
supervision_temp_line_report.user_name,
supervision_temp_line_report.connected_bus,
supervision_temp_line_report.monitoring_terminal_code,
supervision_temp_line_report.monitoring_terminal_name,
supervision_temp_line_report.Power_Substation_Name,
supervision_temp_line_report.line_id lineId,
supervision_temp_line_report.line_name lineName,
supervision_temp_line_debug.reason reason,
supervision_temp_line_run_test.process_instance_id process_instanceId,
supervision_temp_line_run_test.`status` `Status`,
IFNULL(supervision_temp_line_run_test.`test_run_state`,0) `testRunState`
FROM
supervision_temp_line_debug
inner JOIN supervision_temp_line_report ON supervision_temp_line_report.id = supervision_temp_line_debug.id
left join supervision_temp_line_run_test on supervision_temp_line_debug.id = supervision_temp_line_run_test.id
where supervision_temp_line_debug.`status`=2
and ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.device.mapper.SupervisionTempLineRunTestMapper">
</mapper>

View File

@@ -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;
/**
* <p>
* 预告警单表 Mapper 接口
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
public interface WarningLeafletMapper extends BaseMapper<WarningLeaflet> {
Page<WarningLeafletVO> warningPageData(Page<Object> objectPage, @Param("ew") QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper);
Page<WarningLeafletVO> alarmPageData(Page<Object> objectPage, @Param("ew") QueryWrapper<WarningLeafletVO> warningLeafletVOQueryWrapper);
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.mapper.leaflet.WarningLeafletMapper">
<select id="warningPageData" resultType="WarningLeafletVO">
SELECT supervision_warning_leaflet.*
FROM supervision_warning_leaflet supervision_warning_leaflet
WHERE ${ew.sqlSegment}
</select>
<select id="alarmPageData" resultType="WarningLeafletVO">
SELECT supervision_warning_leaflet.*
FROM supervision_warning_leaflet supervision_warning_leaflet
WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -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<SupervisionPlanPO> {
}

View File

@@ -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<SupervisionProblemPO> {
}

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.mapper.plan.SupervisionPlanPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.supervision.pojo.po.plan.SupervisionPlanPO">
<!--@mbg.generated-->
<!--@Table supervision_plan-->
<id column="plan_Id" jdbcType="CHAR" property="planId" />
<result column="work_plan_name" jdbcType="VARCHAR" property="workPlanName" />
<result column="supv_Type" jdbcType="CHAR" property="supvType" />
<result column="supv_Stage" jdbcType="CHAR" property="supvStage" />
<result column="supv_Org_Id" jdbcType="CHAR" property="supvOrgId" />
<result column="plan_User_Id" jdbcType="CHAR" property="planUserId" />
<result column="plan_Org_Id" jdbcType="CHAR" property="planOrgId" />
<result column="other_Remark" jdbcType="VARCHAR" property="otherRemark" />
<result column="effect_Start_Time" jdbcType="TIMESTAMP" property="effectStartTime" />
<result column="effect_End_Time" jdbcType="TIMESTAMP" property="effectEndTime" />
<result column="effect_Status" jdbcType="CHAR" property="effectStatus" />
<result column="plan_Supv_Date" jdbcType="TIMESTAMP" property="planSupvDate" />
<result column="supv_Obj_Type" jdbcType="CHAR" property="supvObjType" />
<result column="supv_Obj_Name" jdbcType="VARCHAR" property="supvObjName" />
<result column="obj_Voltage_Level" jdbcType="CHAR" property="objVoltageLevel" />
<result column="substation_Name" jdbcType="CHAR" property="substationName" />
<result column="substation_Voltage_Level" jdbcType="CHAR" property="substationVoltageLevel" />
<result column="obj_Type" jdbcType="VARCHAR" property="objType" />
<result column="obj_Type_Name" jdbcType="VARCHAR" property="objTypeName" />
<result column="obj_Capacity" jdbcType="DOUBLE" property="objCapacity" />
<result column="report_Issue_Time" jdbcType="TIMESTAMP" property="reportIssueTime" />
<result column="problem_Oc_Time" jdbcType="TIMESTAMP" property="problemOcTime" />
<result column="delete_Flag" jdbcType="CHAR" property="deleteFlag" />
<result column="plan_Status" jdbcType="CHAR" property="planStatus" />
<result column="delete_Time" jdbcType="TIMESTAMP" property="deleteTime" />
<result column="effect_User_Id" jdbcType="CHAR" property="effectUserId" />
<result column="effect_User_Name" jdbcType="CHAR" property="effectUserName" />
<result column="is_upload_head" jdbcType="BIT" property="isUploadHead" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="CHAR" property="createBy" />
<result column="update_by" jdbcType="CHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
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
</sql>
</mapper>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.mapper.plan.SupervisionProblemPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.supervision.pojo.po.plan.SupervisionProblemPO">
<!--@mbg.generated-->
<!--@Table supervision_problem-->
<id column="problem_Id" jdbcType="CHAR" property="problemId" />
<result column="plan_id" jdbcType="CHAR" property="planId" />
<result column="duty_Org_Id" jdbcType="CHAR" property="dutyOrgId" />
<result column="monitor_Type" jdbcType="CHAR" property="monitorType" />
<result column="rectification_Time" jdbcType="TIMESTAMP" property="rectificationTime" />
<result column="plan_Rectification_Time" jdbcType="TIMESTAMP" property="planRectificationTime" />
<result column="if_Release_Warning" jdbcType="BIT" property="ifReleaseWarning" />
<result column="problem_Desc" jdbcType="VARCHAR" property="problemDesc" />
<result column="simple_Problem_Desc" jdbcType="VARCHAR" property="simpleProblemDesc" />
<result column="supv_Standard_Sort" jdbcType="VARCHAR" property="supvStandardSort" />
<result column="supv_Standard" jdbcType="VARCHAR" property="supvStandard" />
<result column="supv_Resouce" jdbcType="VARCHAR" property="supvResouce" />
<result column="problem_Level" jdbcType="VARCHAR" property="problemLevel" />
<result column="problem_Level_Reason" jdbcType="VARCHAR" property="problemLevelReason" />
<result column="problem_Type" jdbcType="VARCHAR" property="problemType" />
<result column="rectification_Programme" jdbcType="VARCHAR" property="rectificationProgramme" />
<result column="rectification_Measure" jdbcType="VARCHAR" property="rectificationMeasure" />
<result column="rectification_Status" jdbcType="VARCHAR" property="rectificationStatus" />
<result column="is_Upload_Head" jdbcType="BIT" property="isUploadHead" />
<result column="discovery_Time" jdbcType="TIMESTAMP" property="discoveryTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
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
</sql>
</mapper>

View File

@@ -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<SupervisionGeneralSurveyPlanPO> {
Page<SupervisionGeneralSurveyPlanVO> page(Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionGeneralSurveyPlanVO> queryWrapper);
Page<SupervisionGeneralSurveyPlanDetailVO> pageProblemSubstationBySurvey(Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionGeneralSurveyPlanDetailVO> supervisionGeneralSurveyPlanDetailVOQueryWrapper);
}

View File

@@ -1,41 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.mapper.survey.SupervisionGeneralSurveyPlanPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO">
<!--@mbg.generated-->
<!--@Table supervision_general_survey_plan-->
<id column="plan_no" jdbcType="VARCHAR" property="planNo" />
<result column="org_no" jdbcType="VARCHAR" property="orgNo" />
<result column="plan_name" jdbcType="VARCHAR" property="planName" />
<result column="plan_create_time" jdbcType="DATE" property="planCreateTime" />
<result column="plan_start_time" jdbcType="DATE" property="planStartTime" />
<result column="plan_end_time" jdbcType="DATE" property="planEndTime" />
<result column="plan_complate_time" jdbcType="DATE" property="planComplateTime" />
<result column="leader" jdbcType="VARCHAR" property="leader" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="is_file_upload" jdbcType="TINYINT" property="isFileUpload" />
<result column="file_count" jdbcType="INTEGER" property="fileCount" />
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId" />
<result column="upload_time" jdbcType="DATE" property="uploadTime" />
<result column="Create_By" jdbcType="CHAR" property="createBy" />
<result column="Create_Time" jdbcType="TIMESTAMP" property="createTime" />
<result column="Update_By" jdbcType="CHAR" property="updateBy" />
<result column="Update_Time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="State" jdbcType="BIT" property="state" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
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`
</sql>
<resultMap id="BaseResultMap" type="com.njcn.supervision.pojo.po.survey.SupervisionGeneralSurveyPlanPO">
<!--@mbg.generated-->
<!--@Table supervision_general_survey_plan-->
<id column="plan_no" jdbcType="VARCHAR" property="planNo"/>
<result column="org_no" jdbcType="VARCHAR" property="orgNo"/>
<result column="plan_name" jdbcType="VARCHAR" property="planName"/>
<result column="plan_create_time" jdbcType="DATE" property="planCreateTime"/>
<result column="plan_start_time" jdbcType="DATE" property="planStartTime"/>
<result column="plan_end_time" jdbcType="DATE" property="planEndTime"/>
<result column="plan_complate_time" jdbcType="DATE" property="planComplateTime"/>
<result column="leader" jdbcType="VARCHAR" property="leader"/>
<result column="status" jdbcType="TINYINT" property="status"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="is_file_upload" jdbcType="TINYINT" property="isFileUpload"/>
<result column="file_count" jdbcType="INTEGER" property="fileCount"/>
<result column="file_path" jdbcType="VARCHAR" property="filePath"/>
<result column="process_instance_id" jdbcType="VARCHAR" property="processInstanceId"/>
<result column="upload_time" jdbcType="DATE" property="uploadTime"/>
<result column="Create_By" jdbcType="CHAR" property="createBy"/>
<result column="Create_Time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="Update_By" jdbcType="CHAR" property="updateBy"/>
<result column="Update_Time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="State" jdbcType="BIT" property="state"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
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`
</sql>
<select id="page" resultType="com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO">
SELECT
*
FROM supervision_general_survey_plan supervision_general_survey_plan
WHERE ${ew.sqlSegment}
</select>
<select id="page" resultType="com.njcn.supervision.pojo.vo.survey.SupervisionGeneralSurveyPlanVO">
SELECT *
FROM supervision_general_survey_plan supervision_general_survey_plan
WHERE ${ew.sqlSegment}
</select>
<!--查询现场测试有问题的数据-->
<select id="pageProblemSubstationBySurvey"
resultType="SupervisionGeneralSurveyPlanDetailVO">
SELECT supervision_general_survey_plan_detail.*,
supervision_general_survey_plan.org_no,
supervision_general_survey_plan.plan_name,
supervision_general_survey_plan.plan_create_time,
supervision_general_survey_plan.plan_start_time,
supervision_general_survey_plan.plan_end_time,
supervision_general_survey_plan.plan_complate_time,
supervision_general_survey_plan.leader,
supervision_general_survey_plan.file_path
FROM supervision_general_survey_plan_detail supervision_general_survey_plan_detail
left join
supervision_general_survey_plan supervision_general_survey_plan
on supervision_general_survey_plan_detail.plan_no = supervision_general_survey_plan.plan_no
WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -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;
/**
* <p>
* 干扰源用户常态化管理 Mapper 接口
* </p>
*
* @author hongawen
* @since 2024-05-17
*/
public interface UserReportNormalMapper extends BaseMapper<UserReportNormalPO> {
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.supervision.device.mapper.UserReportNormalMapper">
</mapper>

View File

@@ -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;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
public interface ISupervisionTempLineRunTestService extends IService<SupervisionTempLineRunTest> {
}

View File

@@ -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<SupervisionTempLineDebugPO> {
String addTempLineDebug(SupervisionTempLineDebugParam supervisionTempLineReportParam);
Page<SupervisionTempLineDebugVO> getTempLineDeug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery);
Page<SupervisionTempLineDebugVO> pageHasDebug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery);
SupervisionTempLineDebugVO getDetailTempLineDebug(String id);
void updateStatus(String businessKey, Integer status);
}

View File

@@ -25,4 +25,6 @@ public interface SupervisionTempLineReportService extends IService<SupervisionTe
void updateStatus(String businessKey, Integer status);
String cancelTempLineReport(BpmProcessInstanceCancelParam cancelReqVO);
SupervisionTempLineReportVO getDetailTempLine(String id);
}

View File

@@ -14,6 +14,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.device.pq.api.LineFeignClient;
import com.njcn.supervision.enums.FlowStatusEnum;
import com.njcn.supervision.mapper.device.SupervisionDevMainReportPOMapper;
import com.njcn.supervision.pojo.param.device.SupervisionDevMainReportParam;
@@ -62,6 +63,7 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
private final SupervisionTempDeviceReportService supervisionTempDeviceReportService;
private final DeptFeignClient deptFeignClient;
private final UserFeignClient userFeignClient;
private final LineFeignClient lineFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -123,12 +125,13 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
if (StrUtil.isNotBlank(supervisionDevMainReportQuery.getOrgId())) {
/*获取直接下属子单位*/
List<String> 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<SupervisionDevMainReportVO> 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<Supervisi
supervisionDevMainReportVO.setOrgName(deptFeignClient.getDeptById(byId.getOrgId()).getData().getName());
SupervisionTempDeviceReport supervisionTempDeviceReport = supervisionTempDeviceReportService.lambdaQuery().eq(SupervisionTempDeviceReport::getId, id).one();
supervisionTempDeviceReport.setSubstation(lineFeignClient.getSubstationInfo(supervisionTempDeviceReport.getSubstation()).getData().getName());
supervisionTempDeviceReport.setPowerCompany(deptFeignClient.getDeptById(byId.getOrgId()).getData().getName());
supervisionDevMainReportVO.setSupervisionTempDeviceReport(supervisionTempDeviceReport);
return supervisionDevMainReportVO;
}

View File

@@ -0,0 +1,153 @@
package com.njcn.supervision.service.device.impl;
import cn.hutool.core.collection.CollectionUtil;
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.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.bpm.api.BpmProcessFeignClient;
import com.njcn.bpm.enums.BpmTaskStatusEnum;
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.supervision.mapper.device.SupervisionTempLineDebugPOMapper;
import com.njcn.supervision.pojo.param.device.SupervisionTempLineDebugParam;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineDebugPO;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.vo.device.SupervisionDevMainReportVO;
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO;
import com.njcn.supervision.service.device.SupervisionTempLineDebugPOService;
import com.njcn.supervision.service.device.SupervisionTempLineReportService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil;
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;
/**
*
* Description:
* Date: 2024/5/17 15:26【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<SupervisionTempLineDebugPOMapper, SupervisionTempLineDebugPO> 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<String, Object> 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<SupervisionTempLineDebugVO> getTempLineDeug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) {
QueryWrapper<SupervisionDevMainReportVO> 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<String> 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<SupervisionTempLineDebugVO> page =this.baseMapper.page(new Page<>(PageFactory.getPageNum(supervisionTempLineDebugQuery), PageFactory.getPageSize(supervisionTempLineDebugQuery)), queryWrapper);
return page;
}
@Override
public Page<SupervisionTempLineDebugVO> pageHasDebug(SupervisionTempLineDebugParam.SupervisionTempLineDebugQuery supervisionTempLineDebugQuery) {
QueryWrapper<SupervisionDevMainReportVO> queryWrapper = new QueryWrapper<>();
String userIndex = RequestUtil.getUserIndex();
queryWrapper
.eq("supervision_temp_line_debug.state", DataStateEnum.ENABLE.getCode());
if (StrUtil.isNotBlank(supervisionTempLineDebugQuery.getOrgId())) {
/*获取直接下属子单位*/
List<String> 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<SupervisionTempLineDebugVO> 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();
}
}

View File

@@ -93,20 +93,23 @@ public class SupervisionTempLineReportServiceImpl extends ServiceImpl<Supervisio
String userIndex = RequestUtil.getUserIndex();
queryWrapper.in("supervision_temp_line_report.create_by", CollectionUtil.newArrayList(userIndex))
.eq("supervision_temp_line_report.state", DataStateEnum.ENABLE.getCode());
.eq("supervision_temp_line_report.state", DataStateEnum.ENABLE.getCode())
.in(CollectionUtil.isNotEmpty(supervisionTempLineReportQuery.getStatueList()),"supervision_temp_line_report.status",supervisionTempLineReportQuery.getStatueList());
if (StrUtil.isNotBlank(supervisionTempLineReportQuery.getOrgId())) {
/*获取直接下属子单位*/
List<String> 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<SupervisionTempLineReportVO> 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<Supervisio
return supervisionDevMainReportPO.getId();
}
@Override
public SupervisionTempLineReportVO getDetailTempLine(String id) {
SupervisionTempLineReportVO vo =new SupervisionTempLineReportVO();
SupervisionTempLineReport byId = this.getById(id);
BeanUtils.copyProperties(byId,vo);
//处理特殊字段,用户名、部门名
UserVO userVO = userFeignClient.getUserById(vo.getReporter()).getData();
vo.setReporter(userVO.getName());
vo.setOrgName(deptFeignClient.getDeptById(vo.getOrgId()).getData().getName());
return vo;
}
private void checkLineId(SupervisionTempLineReportParam supervisionTempLineReportParam, boolean isExcludeSelf) {
LambdaQueryWrapper<SupervisionTempLineReport> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper

View File

@@ -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;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
@Service
public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<SupervisionTempLineRunTestMapper, SupervisionTempLineRunTest> implements ISupervisionTempLineRunTestService {
}

View File

@@ -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;
/**
* <p>
* 预告警单表 服务类
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
public interface IWarningLeafletService extends IService<WarningLeaflet> {
/**
* 创建预告警单,此时还没有走流程,等待用户上传反馈单后,才正式进入工作流阶段
* 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<WarningLeafletVO> alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam);
Page<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam);
}

View File

@@ -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;
/**
* <p>
* 预告警单表 服务实现类
* </p>
*
* @author hongawen
* @since 2024-05-21
*/
@Service
@RequiredArgsConstructor
public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper, WarningLeaflet> 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<WarningLeafletVO> warningPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> 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<String> 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<WarningLeafletVO> alarmPageData(WarningLeafletParam.WarningLeafletQueryParam warningLeafletQueryParam) {
QueryWrapper<WarningLeafletVO> 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<String> 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);
}
}

View File

@@ -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<SupervisionPlanPO>{
String addPlan(SupervisionPlanParam supvPlanParam);
Page<SupervisionPlanVO> pagePlan(SupervisionPlanParam supvPlanParam);
String initiateAudit(String id);
SupervisionPlanVO getDetailPlan(String id);
void updateStatus(String businessKey, Integer status);
}

View File

@@ -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<SupervisionProblemPO>{
void addProblem(SupervisopnProblemParam supvProblemParam);
Page<SupervisionProblemPO> pageProblem(SupervisopnProblemParam supvProblemParam);
}

View File

@@ -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<SupervisionPlanPOMapper, SupervisionPlanPO> 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<User> 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<SupervisionPlanVO> pagePlan(SupervisionPlanParam supvPlanParam) {
LambdaQueryWrapper<SupervisionPlanPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())) {
List<String> 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<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
// Map<String, PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
Map<String, PvTerminalTreeVO> mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
Page<SupervisionPlanPO> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)), lambdaQueryWrapper);
List<SupervisionPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(), SupervisionPlanVO.class);
List<String> 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<SupvFile>().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0));
// if (Objects.nonNull(supvFile)) {
// item.setAttachmentName(supvFile.getAttachmentName());
// }
List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
Map<String, User> map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
if (map.containsKey(item.getPlanUserId())) {
item.setPlanUserName(map.get(item.getPlanUserId()).getName());
}
});
Page<SupervisionPlanVO> 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<SupervisionProblemPO> list = supervisionProblemPOService.lambdaQuery().eq(SupervisionProblemPO::getPlanId, id).list();
if (CollectionUtil.isEmpty(list)){
throw new BusinessException("请填写完事实问题在提交审核");
}
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(PROCESS_KEY);
bpmProcessInstanceCreateReqDTO.setBusinessKey(id);
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<String, List<String>> ());
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<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String, PvTerminalTreeVO> 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<SupvFile>().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0));
// if (Objects.nonNull(supvFile)) {
// item.setAttachmentName(supvFile.getAttachmentName());
// }
// List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
// Map<String, User> 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<SupervisionPlanPO> 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("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内");
}
}
}
}
}

View File

@@ -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<SupervisionProblemPOMapper, SupervisionProblemPO> 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<SupervisionProblemPO> pageProblem(SupervisopnProblemParam supvProblemParam) {
DictData stamped_report = dicDataFeignClient.getDicDataByCode("Stamped_Report").getData();
LambdaQueryWrapper<SupervisionProblemPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupervisionProblemPO::getPlanId, supvProblemParam.getPlanId());
Page<SupervisionProblemPO> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)), lambdaQueryWrapper);
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
Map<String, PvTerminalTreeVO> 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<SupvFile> supvFileList = supvFileMapper.selectList(new LambdaQueryWrapper<SupvFile>().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("问题发现时时间,不在实施开始时间到(实施结束时间/报告出具时间)范围内");
}
}
}
}
}
}

View File

@@ -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<SupervisionGeneralSurveyPlanPO>{
public interface SupervisionGeneralSurveyPlanPOService extends IService<SupervisionGeneralSurveyPlanPO> {
String addDevReport(SupervisionGeneralSurveyPlanParm supervisionGeneralSurveyPlanParm);
String addDevReport(SupervisionGeneralSurveyPlanParm supervisionGeneralSurveyPlanParm);
boolean auditSurvey(SupervisionGeneralSurveyPlanParm.SupervisionGeneralSurveyPlanUpdate supervisionGeneralSurveyPlanUpdate);
boolean auditSurvey(SupervisionGeneralSurveyPlanParm.SupervisionGeneralSurveyPlanUpdate supervisionGeneralSurveyPlanUpdate);
Boolean removeSurvey(List<String> ids);
Boolean removeSurvey(List<String> ids);
Page<SupervisionGeneralSurveyPlanVO> getSurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam);
/**
* 分页查询当前用户能看到的普测计划中存在超标问题
*/
Page<SupervisionGeneralSurveyPlanDetailVO> pageProblemSubstationBySurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam);
SupervisionGeneralSurveyPlanVO querySurveyDetail(String id);
List<DeptSubstationVO> 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);
}

View File

@@ -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<SupervisionGeneralSurveyPlanPOMapper, SupervisionGeneralSurveyPlanPO> implements SupervisionGeneralSurveyPlanPOService{
public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<SupervisionGeneralSurveyPlanPOMapper, SupervisionGeneralSurveyPlanPO> implements SupervisionGeneralSurveyPlanPOService {
/**
* 用户信息建档对应的流程定义 KEY todo 修改成普测的key
*/
@@ -62,6 +75,8 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
private final BpmProcessFeignClient bpmProcessFeignClient;
private final DeptFeignClient deptFeignClient;
private final LineFeignClient lineFeignClient;
private final UserFeignClient userFeignClient;
private final IWarningLeafletService warningLeafletService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -77,7 +92,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
this.save(supervisionGeneralSurveyPlanPO);
String planNo = supervisionGeneralSurveyPlanPO.getPlanNo();
//保存普测计划电站表
if(CollectionUtil.isNotEmpty(supervisionGeneralSurveyPlanParm.getSubIds())){
if (CollectionUtil.isNotEmpty(supervisionGeneralSurveyPlanParm.getSubIds())) {
SubstationParam param = new SubstationParam();
param.setPowerIds(supervisionGeneralSurveyPlanParm.getSubIds());
List<SubGetBase> stationList = commTerminalGeneralClient.tagOrIdGetSub(param).getData();
@@ -90,11 +105,11 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
supervisionGeneralSurveyPlanDetailPO.setSubName(stat.getName());
/*目前时间与计划开始时间,结束时间一致*/
supervisionGeneralSurveyPlanDetailPO.setVoltageLevel(stat.getVoltageLevel());
List<Line> lines= lineFeignClient.getSubIndexLineDetail(stat.getId()).getData();
if(CollectionUtil.isEmpty(lines)){
List<Line> 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<Super
bpmProcessInstanceCreateReqDTO.setBusinessKey(planNo);
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(supervisionGeneralSurveyPlanParm.getStartUserSelectAssignees());
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionGeneralSurveyPlanPO.getCreateBy(),bpmProcessInstanceCreateReqDTO).getData();
String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionGeneralSurveyPlanPO.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData();
// 将工作流的编号,更新到流程单中
supervisionGeneralSurveyPlanPO.setProcessInstanceId(processInstanceId);
this.baseMapper.updateById(supervisionGeneralSurveyPlanPO);
return planNo;
}{
}
{
throw new BusinessException("请选择电站");
}
}
@Override
@@ -148,10 +161,10 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
/*目前时间与计划开始时间,结束时间一致*/
supervisionGeneralSurveyPlanDetailPO.setVoltageLevel(stat.getVoltageLevel());
List<String> unitChildrenList = stat.getUnitChildrenList();
if(CollectionUtil.isEmpty(unitChildrenList)){
if (CollectionUtil.isEmpty(unitChildrenList)) {
supervisionGeneralSurveyPlanDetailPO.setMeasurementPointId("");
supervisionGeneralSurveyPlanDetailPO.setIsSurvey(0);
}else {
} else {
List<LineDetailDataVO> data = lineFeignClient.getLineDetailList(unitChildrenList).getData();
String subList = data.stream().map(LineDetailDataVO::getLineName).collect(Collectors.joining(","));
@@ -162,7 +175,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
supervisionGeneralSurveyPlanDetailPOS.add(supervisionGeneralSurveyPlanDetailPO);
}
//清除原有的
supervisionGeneralSurveyPlanDetailPOService.remove(new QueryWrapper<SupervisionGeneralSurveyPlanDetailPO>().lambda().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo,planNo));
supervisionGeneralSurveyPlanDetailPOService.remove(new QueryWrapper<SupervisionGeneralSurveyPlanDetailPO>().lambda().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, planNo));
supervisionGeneralSurveyPlanDetailPOService.saveOrUpdateBatchByMultiId(supervisionGeneralSurveyPlanDetailPOS, 500);
// 发起 BPM 流程
Map<String, Object> processInstanceVariables = new HashMap<>();
@@ -171,7 +184,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
bpmProcessInstanceCreateReqDTO.setBusinessKey(planNo);
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(supervisionGeneralSurveyPlanUpdate.getStartUserSelectAssignees());
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
String processInstanceId = bpmProcessFeignClient.createProcessInstance(RequestUtil.getUserIndex(),bpmProcessInstanceCreateReqDTO).getData();
String processInstanceId = bpmProcessFeignClient.createProcessInstance(RequestUtil.getUserIndex(), bpmProcessInstanceCreateReqDTO).getData();
// 将工作流的编号,更新到流程单中
byId.setProcessInstanceId(processInstanceId);
this.baseMapper.updateById(byId);
@@ -184,7 +197,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
public Boolean removeSurvey(List<String> ids) {
this.lambdaUpdate().set(SupervisionGeneralSurveyPlanPO::getState, 0).in(SupervisionGeneralSurveyPlanPO::getPlanNo, ids).update();
supervisionGeneralSurveyPlanDetailPOService.remove(new QueryWrapper<SupervisionGeneralSurveyPlanDetailPO>().
lambda().in(SupervisionGeneralSurveyPlanDetailPO::getPlanNo,ids));
lambda().in(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, ids));
return true;
}
@@ -204,10 +217,14 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
queryWrapper.in("supervision_general_survey_plan.org_no", data);
}
}
//添加上时间范围
queryWrapper.between("supervision_general_survey_plan.Create_Time",
DateUtil.beginOfDay(DateUtil.parse(generalSurveyPlanQueryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(generalSurveyPlanQueryParam.getSearchEndTime())));
queryWrapper.orderByDesc("supervision_general_survey_plan.create_time");
Page<SupervisionGeneralSurveyPlanVO> 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<SupervisionGeneralSurveyPlanDetailPO> list = supervisionGeneralSurveyPlanDetailPOService.lambdaQuery().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, temp.getPlanNo()).list();
@@ -219,11 +236,31 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
}
@Override
public Page<SupervisionGeneralSurveyPlanDetailVO> pageProblemSubstationBySurvey(SupervisionGeneralSurveyPlanParm.GeneralSurveyPlanQueryParam generalSurveyPlanQueryParam) {
QueryWrapper<SupervisionGeneralSurveyPlanDetailVO> 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<String> 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<SupervisionGeneralSurveyPlanDetailVO> 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<SupervisionGeneralSurveyPlanDetailPO> list = supervisionGeneralSurveyPlanDetailPOService.lambdaQuery().eq(SupervisionGeneralSurveyPlanDetailPO::getPlanNo, id).list();
supervisionGeneralSurveyPlanVO.setSupervisionGeneralSurveyPlanDetailPOS(list);
@@ -277,7 +314,7 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
@Override
public void updateStatus(String businessKey, Integer status) {
this.lambdaUpdate().set(SupervisionGeneralSurveyPlanPO::getStatus,status).eq(SupervisionGeneralSurveyPlanPO::getPlanNo,businessKey).update();
this.lambdaUpdate().set(SupervisionGeneralSurveyPlanPO::getStatus, status).eq(SupervisionGeneralSurveyPlanPO::getPlanNo, businessKey).update();
}
@Override
@@ -292,6 +329,57 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
return supervisionGeneralSurveyPlanPO.getPlanNo();
}
@Override
public void initiateWarningLeaflet(String id, String subId) {
//获取数据源用于组装数据
LambdaQueryWrapper<SupervisionGeneralSurveyPlanDetailPO> 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<SupervisionGeneralSurveyPlanDetailPO> 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<DeptSubstationVO> recursion(DeptSubstationVO result, String orgdid) {
List<DeptSubstationVO> deptSubstationVOList = new ArrayList<>();
@@ -313,13 +401,13 @@ public class SupervisionGeneralSurveyPlanPOServiceImpl extends ServiceImpl<Super
}
/**
* @Description: 校验计划名称是否存在
* @Param: * @param userReportParam 用户申请数据
* * @param isExcludeSelf 是否排除自己,一般新增不排除,更新时需要排除自己
* @return: void
* @Author: clam
* @Date: 2024/5/13
*/
* @Description: 校验计划名称是否存在
* @Param: * @param userReportParam 用户申请数据
* * @param isExcludeSelf 是否排除自己,一般新增不排除,更新时需要排除自己
* @return: void
* @Author: clam
* @Date: 2024/5/13
*/
private void checkPlanName(SupervisionGeneralSurveyPlanParm supervisionGeneralSurveyPlanParm, boolean isExcludeSelf) {
LambdaQueryWrapper<SupervisionGeneralSurveyPlanPO> userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
userReportPOLambdaQueryWrapper

View File

@@ -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;
/**
* <p>
* 干扰源用户常态化管理 服务类
* </p>
*
* @author hongawen
* @since 2024-05-17
*/
public interface IUserReportNormalService extends IService<UserReportNormalPO> {
String addUserNormal(UserReportNormalParam userReportNormalParam);
Page<UserReportVO.UserReportGoNetVO> userReportGoNetPage(UserReportNormalParam userReportNormalParam);
UserReportVO.UserReportGoNetVO userReportGoNetById(String id);
void updateUserReportNormalStatus(String businessKey,Integer status);
}

View File

@@ -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;
/**
* <p>
* 干扰源用户常态化管理 服务实现类
* </p>
*
* @author hongawen
* @since 2024-05-17
*/
@Service
@RequiredArgsConstructor
public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMapper, UserReportNormalPO> 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<String, Object> 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<UserReportVO.UserReportGoNetVO> userReportGoNetPage(UserReportNormalParam userReportNormalParam) {
Page<UserReportVO.UserReportGoNetVO> pageResult = new Page<>();
List<String> deptIds = deptFeignClient.getDepSonIdtByDeptId(RequestUtil.getDeptIndex()).getData();
List<User> userList = userFeignClient.getUserInfoByDeptIds(deptIds).getData();
List<String> userIds = userList.stream().map(User::getId).distinct().collect(Collectors.toList());
if(CollUtil.isEmpty(userIds)){
return pageResult;
}
LambdaQueryWrapper<UserReportNormalPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByDesc(UserReportNormalPO::getCreateTime)
.eq(UserReportNormalPO::getType,userReportNormalParam.getType())
.in(UserReportNormalPO::getCreateBy, userIds)
.eq(UserReportNormalPO::getUserReportId,userReportNormalParam.getUserReportId());
Page<UserReportNormalPO> page = this.page(new Page<>(PageFactory.getPageNum(userReportNormalParam), PageFactory.getPageSize(userReportNormalParam)), lambdaQueryWrapper);
if (CollUtil.isNotEmpty(page.getRecords())) {
List<String> ids = page.getRecords().stream().map(UserReportNormalPO::getUserReportId).distinct().collect(Collectors.toList());
List<UserReportPO> userReportPOList = userReportPOService.list(new LambdaQueryWrapper<UserReportPO>().in(UserReportPO::getId, ids));
Map<String, UserReportPO> map = userReportPOList.stream().collect(Collectors.toMap(UserReportPO::getId, Function.identity()));
List<UserReportVO.UserReportGoNetVO> 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<UserReportNormalPO>().lambda().set(UserReportNormalPO::getStatus,status).eq(UserReportNormalPO::getId,businessKey));
}
}

View File

@@ -251,6 +251,10 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
List<UserReportVO> 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;