技术监督用户信息迁移
This commit is contained in:
@@ -61,6 +61,7 @@ import com.njcn.device.pq.utils.DeviceUtil;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.PqsTerminalLogsMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.utils.ExcelStyleUtil;
|
||||
import com.njcn.message.api.ProduceFeignClient;
|
||||
import com.njcn.message.constant.DeviceRebootType;
|
||||
@@ -73,7 +74,6 @@ import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -97,7 +97,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -140,7 +139,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
private final NodeDeviceService nodeDeviceService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
private final ProduceFeignClient produceFeignClient;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
@Value("${oracle.isSync}")
|
||||
private Boolean isSync;
|
||||
@@ -989,7 +988,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
Line obj;
|
||||
if (level == 700) {
|
||||
obj = new Line();
|
||||
UserLedgerVO userLedgerVO = userLedgerFeignClient.selectUserInfo(id).getData();
|
||||
UserLedgerVO userLedgerVO = userLedgerService.selectUserInfo(id);
|
||||
if (Objects.nonNull(userLedgerVO)) {
|
||||
obj.setId(userLedgerVO.getId());
|
||||
obj.setLevel(LineBaseEnum.USER_LEVEL.getCode());
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.njcn.device.pq.pojo.po.DeptLine;
|
||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
@@ -27,7 +27,6 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.pojo.param.DeptLineParam;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -52,7 +51,7 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
private final LineMapper lineMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final LineDetailMapper detailMapper;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -251,7 +250,7 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objIds)){
|
||||
List<NewUserReportVO> data = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
List<NewUserReportVO> data = userLedgerService.getUserReportByIds(objIds);
|
||||
Map<String, String> userMap = data.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getProjectName));
|
||||
for (DevDetailVO lineDeviceByDevId : lineDeviceByDevIds) {
|
||||
if(StrUtil.isNotBlank(lineDeviceByDevId.getObjId())){
|
||||
|
||||
@@ -39,11 +39,11 @@ import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.substation.mapper.SubstationMapper;
|
||||
import com.njcn.device.subvoltage.mapper.VoltageMapper;
|
||||
import com.njcn.device.terminal.mapper.TerminalMaintainMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -106,8 +106,10 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
private final TerminalMaintainMapper terminalMaintainMapper;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final DeptLineService deptLineService;
|
||||
private final UserLedgerFeignClient userLedgerFeignClient;
|
||||
private final UserLedgerService userLedgerService;
|
||||
private final PqDevTypeService pqDevTypeService;
|
||||
|
||||
|
||||
@Override
|
||||
public LineDetailDataVO getLineDetailData(String id) {
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
@@ -744,7 +746,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
List<String> objIds = userLedgerList.stream().map(LineDetail::getObjId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> newUserReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
List<NewUserReportVO> newUserReportVOList = userLedgerService.getUserReportByIds(objIds);
|
||||
Map<String, NewUserReportVO> map = newUserReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
@@ -892,7 +894,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<String> userIds = resList.stream().map(AreaLineInfoVO::getObjId).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||
Map<String, NewUserReportVO> userReportVOMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
List<NewUserReportVO> data = userLedgerFeignClient.getUserReportByIds(userIds).getData();
|
||||
List<NewUserReportVO> data = userLedgerService.getUserReportByIds(userIds);
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
userReportVOMap = data.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.njcn.device.userledger.controller;
|
||||
|
||||
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.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.file.FileUrl;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
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.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 干扰源用户管理
|
||||
*
|
||||
* @author qijian
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/11/11 - 9:20
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/userReport")
|
||||
@Api(tags = "干扰源用户管理")
|
||||
@AllArgsConstructor
|
||||
public class UserLedgerController extends BaseController {
|
||||
|
||||
private final UserLedgerService userReportPOService;
|
||||
|
||||
|
||||
@PostMapping(value = "/selectUserList")
|
||||
@ApiOperation("查询用户台账")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam) {
|
||||
String methodDescribe = getMethodDescribe("selectUserList");
|
||||
List<UserLedgerVO> b = userReportPOService.selectUserList(userReportParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/selectUserInfo")
|
||||
@ApiOperation("查询用户基本详情")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<UserLedgerVO> selectUserInfo(@RequestParam String id) {
|
||||
String methodDescribe = getMethodDescribe("selectUserInfo");
|
||||
UserLedgerVO b = userReportPOService.selectUserInfo(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/bindUserStation")
|
||||
@ApiOperation("绑定用户电站信息")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
public HttpResult<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId) {
|
||||
String methodDescribe = getMethodDescribe("bindUserStation");
|
||||
userReportPOService.bindUserStation(userId,stationId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getUserReportByIds")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据ids获取非电网侧用户信息")
|
||||
public HttpResult<List<NewUserReportVO>> getUserReportByIds(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getUserReportByIds");
|
||||
List<NewUserReportVO> userReportByIds = userReportPOService.getUserReportByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportByIds, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSensitiveUserByDept")
|
||||
@ApiOperation("根据部门获取敏感用户信息")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(@RequestBody @Validated SensitiveUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSensitiveUserByDept");
|
||||
List<UserReportPO> list = userReportPOService.getSensitiveUserByDept(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUserLedgerPage")
|
||||
@ApiOperation("分页查询干扰源用户台账")
|
||||
@ApiImplicitParam(name = "userReportQueryParam", value = "参数", required = true)
|
||||
public HttpResult<Page<UserReportVO>> getUserLedgerPage(@RequestBody @Validated UserReportParam.UserReportQueryParam userReportQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("getUserLedgerPage");
|
||||
Page<UserReportVO> out = userReportPOService.getUserLedgerPage(userReportQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, out, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据id获取用户档案录入的详细数据")
|
||||
public HttpResult<UserReportVO.UserReportListVO> getById(String id) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
UserReportVO.UserReportListVO userReportVO = userReportPOService.getVOById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getFileById")
|
||||
@ApiOperation("根据id查询文件信息集合")
|
||||
public HttpResult<List<FileUrl>> getFileUrlList(String id) {
|
||||
String methodDescribe = getMethodDescribe("getFileUrlList");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new ArrayList<>(), methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增干扰源用户")
|
||||
@ApiImplicitParam(name = "userReportParam", value = "实体参数", required = true)
|
||||
public HttpResult<String> addUserReport(@RequestBody @Validated UserReportParam userReportParam) {
|
||||
String methodDescribe = getMethodDescribe("addUserReport");
|
||||
String userReportId = userReportPOService.addUserReport(userReportParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportId, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/deleteUserReport")
|
||||
@ApiOperation("干扰源接入功能删除流程")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.DELETE)
|
||||
public HttpResult<Boolean> deleteUserReport(@RequestBody List<String> supervisionId) {
|
||||
String methodDescribe = getMethodDescribe("deleteUserReport");
|
||||
Boolean b = userReportPOService.deleteUserReport(supervisionId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@GetMapping("/getUserReportById")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据id获取用户档案录入数据")
|
||||
public HttpResult<UserReportVO> getUserReportById(String id) {
|
||||
String methodDescribe = getMethodDescribe("getUserReportById");
|
||||
UserReportVO userReportVO = userReportPOService.getUserReportById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportVO, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
|
||||
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> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
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.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:07【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportPOMapper extends BaseMapper<UserReportPO> {
|
||||
|
||||
Page<UserReportVO> page(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<UserReportVO> userReportVOQueryWrapper);
|
||||
|
||||
|
||||
UserReportVO getUserReportById(@Param("ew")QueryWrapper<UserReportVO> userReportVOQueryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportProjectPOMapper extends BaseMapper<UserReportProjectPO> {
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
public interface UserReportRenewalMapper extends BaseMapper<UserReportRenewalPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSensitivePOMapper extends BaseMapper<UserReportSensitivePO> {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.userledger.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSubstationPOMapper extends BaseMapper<UserReportSubstationPO> {
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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.device.userledger.mapper.UserReportPOMapper">
|
||||
|
||||
<!--获取流程表单分页列表-->
|
||||
<select id="page" resultType="com.njcn.supervision.pojo.vo.user.UserReportVO">
|
||||
SELECT
|
||||
supervision_user_report.id,
|
||||
supervision_user_report.report_date,
|
||||
supervision_user_report.org_id,
|
||||
supervision_user_report.expected_production_date,
|
||||
supervision_user_report.user_type,
|
||||
supervision_user_report.city,
|
||||
supervision_user_report.rate_power,
|
||||
supervision_user_report.responsible_department,
|
||||
supervision_user_report.user_status,
|
||||
supervision_user_report.substation,
|
||||
supervision_user_report.voltage_level,
|
||||
supervision_user_report.project_name,
|
||||
supervision_user_report.evaluation_dept,
|
||||
supervision_user_report.data_type,
|
||||
supervision_user_report.evaluation_conclusion,
|
||||
supervision_user_report.process_instance_id,
|
||||
supervision_user_report.history_instance_id,
|
||||
supervision_user_report.create_time,
|
||||
supervision_user_report.create_by,
|
||||
supervision_user_report.status,
|
||||
supervision_user_report.dev_id,
|
||||
supervision_user_report.line_id,
|
||||
supervision_user_report.second_assessment_id secondAssessmentId
|
||||
FROM supervision_user_report supervision_user_report
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="getUserReportById" resultType="com.njcn.supervision.pojo.vo.user.UserReportVO">
|
||||
SELECT
|
||||
supervision_user_report.id,
|
||||
supervision_user_report.report_date,
|
||||
supervision_user_report.org_id,
|
||||
supervision_user_report.expected_production_date,
|
||||
supervision_user_report.user_type,
|
||||
supervision_user_report.city,
|
||||
supervision_user_report.responsible_department,
|
||||
supervision_user_report.user_status,
|
||||
supervision_user_report.substation,
|
||||
supervision_user_report.voltage_level,
|
||||
supervision_user_report.project_name,
|
||||
supervision_user_report.evaluation_dept,
|
||||
supervision_user_report.data_type,
|
||||
supervision_user_report.evaluation_conclusion,
|
||||
supervision_user_report.process_instance_id,
|
||||
supervision_user_report.history_instance_id,
|
||||
supervision_user_report.create_time,
|
||||
supervision_user_report.create_by,
|
||||
supervision_user_report.status,
|
||||
supervision_user_report.dev_id,
|
||||
supervision_user_report.line_id
|
||||
FROM supervision_user_report supervision_user_report
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
public interface IUserReportNormalService extends IService<UserReportNormalPO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
public interface IUserReportRenewalService extends IService<UserReportRenewalPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2026/3/4 9:12
|
||||
*/
|
||||
public interface UserLedgerService extends IService<UserReportPO> {
|
||||
|
||||
|
||||
/**
|
||||
* 查询用户台账
|
||||
* @param userReportParam
|
||||
* @return
|
||||
*/
|
||||
List<UserLedgerVO> selectUserList(UserReportParam userReportParam);
|
||||
|
||||
/**
|
||||
* 查询用户基本详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserLedgerVO selectUserInfo(String id);
|
||||
|
||||
/**
|
||||
* 绑定用户电站信息
|
||||
* @param userId
|
||||
* @param stationId
|
||||
* @return
|
||||
*/
|
||||
Boolean bindUserStation(String userId,String stationId);
|
||||
|
||||
/**
|
||||
* 根据ids获取非电网侧用户信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<NewUserReportVO> getUserReportByIds(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门获取敏感用户信息
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<UserReportPO> getSensitiveUserByDept(SensitiveUserParam param);
|
||||
|
||||
/**
|
||||
* 分页查询干扰源用户台账
|
||||
* @param userReportQueryParam
|
||||
* @return
|
||||
*/
|
||||
Page<UserReportVO> getUserLedgerPage(UserReportParam.UserReportQueryParam userReportQueryParam);
|
||||
|
||||
/**
|
||||
* 根据id获取用户档案录入的详细数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserReportVO.UserReportListVO getVOById(String id);
|
||||
|
||||
/**
|
||||
* 新增干扰源用户
|
||||
* @param userReportParam
|
||||
* @return
|
||||
*/
|
||||
String addUserReport(UserReportParam userReportParam);
|
||||
|
||||
/**
|
||||
* 干扰源接入功能删除流程
|
||||
* @param supervisionId
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteUserReport(List<String> supervisionId);
|
||||
|
||||
/**
|
||||
* 根据id获取用户档案录入数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserReportVO getUserReportById(String id);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportProjectPOService extends IService<UserReportProjectPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSensitivePOService extends IService<UserReportSensitivePO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.userledger.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface UserReportSubstationPOService extends IService<UserReportSubstationPO>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.bpm.enums.BpmProcessInstanceStatusEnum;
|
||||
import com.njcn.bpm.enums.BpmTaskStatusEnum;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.mapper.UserReportPOMapper;
|
||||
import com.njcn.device.userledger.service.UserLedgerService;
|
||||
import com.njcn.device.userledger.service.UserReportProjectPOService;
|
||||
import com.njcn.device.userledger.service.UserReportSensitivePOService;
|
||||
import com.njcn.device.userledger.service.UserReportSubstationPOService;
|
||||
import com.njcn.supervision.enums.FlowStatusEnum;
|
||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
||||
import com.njcn.supervision.enums.UserNatureEnum;
|
||||
import com.njcn.supervision.pojo.param.SensitiveUserParam;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.user.*;
|
||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2026/3/3 16:19
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserLedgerServiceImpl extends ServiceImpl<UserReportPOMapper, UserReportPO> implements UserLedgerService {
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final UserReportProjectPOService userReportProjectPOService;
|
||||
private final UserReportSubstationPOService userReportSubstationPOService;
|
||||
private final UserReportNormalMapper userReportNormalMapper;
|
||||
private final UserReportSensitivePOService userReportSensitivePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
@Override
|
||||
public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
|
||||
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StrUtil.isNotBlank(userReportParam.getCity())) {
|
||||
lambdaQueryWrapper.in(UserReportPO::getCity, Stream.of(userReportParam.getCity()).collect(Collectors.toList()));
|
||||
}
|
||||
if (StrUtil.isNotBlank(userReportParam.getStationId())) {
|
||||
lambdaQueryWrapper.eq(UserReportPO::getStationId, userReportParam.getStationId());
|
||||
}
|
||||
if (ObjectUtil.isNotNull(userReportParam.getUserType())) {
|
||||
lambdaQueryWrapper.eq(UserReportPO::getUserType, userReportParam.getUserType());
|
||||
}
|
||||
lambdaQueryWrapper.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<UserReportPO> list = this.list(lambdaQueryWrapper);
|
||||
return BeanUtil.copyToList(list, UserLedgerVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLedgerVO selectUserInfo(String id) {
|
||||
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserReportPO::getId, id).eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
UserReportPO userReportPO = this.getById(id);
|
||||
if (Objects.nonNull(userReportPO)) {
|
||||
return BeanUtil.copyProperties(userReportPO, UserLedgerVO.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean bindUserStation(String userId, String stationId) {
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
userReportPO.setId(userId);
|
||||
userReportPO.setStationId(stationId);
|
||||
return this.updateById(userReportPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NewUserReportVO> getUserReportByIds(List<String> ids) {
|
||||
List<UserReportPO> userReportPOS = this.listByIds(ids);
|
||||
List<NewUserReportVO> info = new ArrayList<>();
|
||||
for (UserReportPO userReportNormalPO : userReportPOS) {
|
||||
NewUserReportVO newUserReportVO = new NewUserReportVO();
|
||||
|
||||
BeanUtil.copyProperties(userReportNormalPO, newUserReportVO);
|
||||
info.add(newUserReportVO);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserReportPO> getSensitiveUserByDept(SensitiveUserParam param) {
|
||||
QueryWrapper<UserReportPO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
List<String> data = deptFeignClient.getDepSonIdtByDeptId(param.getDeptId()).getData();
|
||||
//此处仅查询敏感及重要用户
|
||||
userReportVOQueryWrapper.and(wrapper ->
|
||||
wrapper.in("supervision_user_report.org_id", data)
|
||||
)
|
||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode())
|
||||
.eq("supervision_user_report.user_type", UserNatureEnum.SENSITIVE_USER.getCode())
|
||||
.in("supervision_user_report.status", Arrays.asList(FlowStatusEnum.AUDIT.getCode(), FlowStatusEnum.APPROVE.getCode()));
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(param.getProjectName()), "supervision_user_report.project_name", param.getProjectName());
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
return this.baseMapper.selectList(userReportVOQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<UserReportVO> getUserLedgerPage(UserReportParam.UserReportQueryParam userReportQueryParam) {
|
||||
//正则校验
|
||||
Pattern pattern = Pattern.compile(PatternRegex.ALL_CHAR_1_20);
|
||||
Matcher matcher = pattern.matcher(userReportQueryParam.getProjectName());
|
||||
if (StringUtils.isNotBlank(userReportQueryParam.getProjectName()) && !matcher.matches()) {
|
||||
throw new BusinessException(ValidMessage.SEARCH_DATA_ERROR);
|
||||
}
|
||||
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
//此处仅查询敏感及重要用户
|
||||
userReportVOQueryWrapper
|
||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode());
|
||||
|
||||
if (Objects.nonNull(userReportQueryParam)) {
|
||||
if (StrUtil.isNotBlank(userReportQueryParam.getCity())) {
|
||||
//查询所有区域下的数据
|
||||
userReportVOQueryWrapper.in("supervision_user_report.city", userReportQueryParam.getCity());
|
||||
}
|
||||
if (Objects.nonNull(userReportQueryParam.getDataType())) {
|
||||
userReportVOQueryWrapper.eq("data_type", userReportQueryParam.getDataType());
|
||||
}
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(userReportQueryParam.getProjectName()), "supervision_user_report.project_name", userReportQueryParam.getProjectName());
|
||||
if (StrUtil.isNotBlank(userReportQueryParam.getSearchBeginTime()) && StrUtil.isNotBlank(userReportQueryParam.getSearchEndTime())) {
|
||||
userReportVOQueryWrapper.and(wrapper -> wrapper.between("supervision_user_report.report_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
|
||||
.or()
|
||||
.between("supervision_user_report.expected_production_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())))
|
||||
);
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.Update_Time");
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
Page<UserReportVO> page;
|
||||
page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
|
||||
page.getRecords().forEach(temp -> {
|
||||
Integer needGovernance = 0;
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(temp.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
needGovernance = userReportProjectPOService.getById(temp.getId()).getNeedGovernance();
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(temp.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
|
||||
needGovernance = userReportSubstationPOService.getById(temp.getId()).getNeedGovernance();
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(temp.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
needGovernance = userReportSensitivePOService.getById(temp.getId()).getNeedGovernance();
|
||||
}
|
||||
temp.setNeedGovernance(needGovernance);
|
||||
//添加治理评估文件,需先判断入网评估是否审核通过
|
||||
boolean type = true;
|
||||
if (1 == temp.getNeedGovernance()) {
|
||||
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
|
||||
.eq(UserReportNormalPO::getUserReportId, temp.getId())
|
||||
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
|
||||
.ne(UserReportNormalPO::getStatus, BpmTaskStatusEnum.CANCEL.getStatus())
|
||||
.eq(UserReportNormalPO::getType, 0)
|
||||
.orderByDesc(UserReportNormalPO::getCreateTime)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<String> collect = list.stream().filter(x -> !Objects.equals(x.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus()))
|
||||
.map(UserReportNormalPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
type = false;
|
||||
}
|
||||
} else {
|
||||
type = false;
|
||||
}
|
||||
}
|
||||
temp.setType(type);
|
||||
});
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserReportVO.UserReportListVO getVOById(String id) {
|
||||
UserReportVO.UserReportListVO userReportVO = new UserReportVO.UserReportListVO();
|
||||
UserReportPO userReportPO = this.baseMapper.selectById(id);
|
||||
//复制基础信息
|
||||
BeanUtil.copyProperties(userReportPO, userReportVO);
|
||||
//处理特殊字段,用户名、部门名
|
||||
if (StrUtil.isNotBlank(userReportPO.getReporter())){
|
||||
UserVO userVO = userFeignClient.getUserById(userReportPO.getReporter()).getData();
|
||||
if(ObjUtil.isNotNull(userVO)){
|
||||
userReportVO.setReporter(userVO.getName());
|
||||
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(userReportPO.getReporter())){
|
||||
Dept dept = deptFeignClient.getDeptById(userReportPO.getOrgId()).getData();
|
||||
if(ObjUtil.isNotNull(dept)){
|
||||
userReportVO.setOrgName(dept.getName());
|
||||
}
|
||||
}
|
||||
/*
|
||||
根据用户性质获取自己特有的字段,此处需要特殊处理
|
||||
1、每个附件需要返回文件名称以及可以预览的url
|
||||
todo...by黄正剑
|
||||
*/
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
UserReportProjectPO byId = userReportProjectPOService.getById(id);
|
||||
userReportVO.setUserReportProjectPO(byId);
|
||||
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
UserReportSubstationPO byId = userReportSubstationPOService.getById(id);
|
||||
userReportSubstationPOService.saveOrUpdate(byId);
|
||||
userReportVO.setUserReportSubstationPO(byId);
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportPO.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
UserReportSensitivePO byId = userReportSensitivePOService.getById(id);
|
||||
userReportVO.setUserReportSensitivePO(byId);
|
||||
}
|
||||
List<UserReportNormalPO> list = userReportNormalMapper.selectList(new LambdaQueryWrapper<UserReportNormalPO>()
|
||||
.eq(UserReportNormalPO::getUserReportId, id)
|
||||
.eq(UserReportNormalPO::getStatus, BpmTaskStatusEnum.APPROVE.getStatus())
|
||||
.eq(UserReportNormalPO::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(UserReportNormalPO::getCreateTime)
|
||||
);
|
||||
Optional<String> netInReport = list.stream().filter(x -> 0 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
|
||||
Optional<String> governReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getReportUrl).findFirst();
|
||||
Optional<String> simulationReport = list.stream().filter(x -> 1 == x.getType()).map(UserReportNormalPO::getSimulationReportUrl).findFirst();
|
||||
userReportVO.setNetInReport(Collections.singletonList(netInReport.orElse(null)));
|
||||
userReportVO.setGovernReport(Collections.singletonList(governReport.orElse(null)));
|
||||
userReportVO.setSimulationReport(Collections.singletonList(simulationReport.orElse(null)));
|
||||
return userReportVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String addUserReport(UserReportParam userReportParam) {
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
BeanUtils.copyProperties(userReportParam, userReportPO);
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "2")) {
|
||||
checkProjectName(userReportParam, !StringUtils.isEmpty(userReportParam.getId()));
|
||||
}
|
||||
//判断工程名称是否有重复的
|
||||
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "1")) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
|
||||
checkProjectName(userReportParam, !StringUtils.isEmpty(userReportParam.getId()));
|
||||
} else {
|
||||
//常态化干扰源用户信息更新的用的
|
||||
if (!Objects.equals(userReportParam.getSaveOrCheckflag(), "0")) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(userReportParam.getDataType())) {
|
||||
userReportPO.setDataType(userReportParam.getDataType());
|
||||
if (userReportParam.getDataType() == 1) {
|
||||
if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportParam.getUserType())) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.APPROVE.getStatus());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
userReportPO.setDataType(0);
|
||||
}
|
||||
this.saveOrUpdate(userReportPO);
|
||||
userReportPO = this.getById(userReportPO.getId());
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
UserReportProjectPO userReportProjectPO = userReportParam.getUserReportProjectPO();
|
||||
userReportProjectPO.setId(userReportPO.getId());
|
||||
userReportProjectPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportProjectPOService.saveOrUpdate(userReportProjectPO);
|
||||
} else if (
|
||||
CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
UserReportSubstationPO userReportSubstationPO = userReportParam.getUserReportSubstationPO();
|
||||
userReportSubstationPO.setId(userReportPO.getId());
|
||||
userReportSubstationPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSubstationPOService.saveOrUpdate(userReportSubstationPO);
|
||||
} else if (UserNatureEnum.SENSITIVE_USER.getCode().equals(userReportPO.getUserType())) {
|
||||
// 敏感及重要用户
|
||||
UserReportSensitivePO userReportSensitivePO = userReportParam.getUserReportSensitivePO();
|
||||
userReportSensitivePO.setId(userReportPO.getId());
|
||||
userReportSensitivePO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSensitivePOService.saveOrUpdate(userReportSensitivePO);
|
||||
}
|
||||
return userReportPO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteUserReport(List<String> supervisionId) {
|
||||
List<UserReportPO> userReportPOS = this.listByIds(supervisionId);
|
||||
if (CollUtil.isEmpty(userReportPOS)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
|
||||
}
|
||||
//先判断是否是删除管理员,如果是就有全部删除权限,否则就只能删除带提交审批的
|
||||
List<String> deleteUser = userReportPOS.stream().map(UserReportPO::getCreateBy).distinct().collect(Collectors.toList());
|
||||
long statusCount = userReportPOS.stream().filter(x -> !BpmTaskStatusEnum.WAIT.getStatus().equals(x.getStatus())).count();
|
||||
//判断是否有权限操作
|
||||
if (CollUtil.isEmpty(deleteUser)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
|
||||
}
|
||||
//如果为空则需要判断信息,先判断全部数据是否都是自己创建的,然后判断是否是都是带提交数据
|
||||
if (CollUtil.isEmpty(deleteUser)) {
|
||||
long count = deleteUser.stream().filter(x -> !RequestUtil.getUserIndex().equals(x)).count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException(SupervisionResponseEnum.NO_POWER);
|
||||
} else {
|
||||
if (statusCount > 0) {
|
||||
throw new BusinessException(SupervisionResponseEnum.DELETE_TO_BE_SUBMITTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.update(new LambdaUpdateWrapper<UserReportPO>().set(UserReportPO::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(UserReportPO::getId, supervisionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserReportVO getUserReportById(String id) {
|
||||
QueryWrapper<UserReportVO> userReportVOQueryWrapper = new QueryWrapper<>();
|
||||
userReportVOQueryWrapper.eq("supervision_user_report.id", id);
|
||||
return this.baseMapper.getUserReportById(userReportVOQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工程名称是否重复,如果重复则提示用户XXX已经创建该工程
|
||||
*
|
||||
* @param userReportParam 用户申请数据
|
||||
* @param isExcludeSelf 是否排除自己,一般新增不排除,更新时需要排除自己
|
||||
*/
|
||||
protected void checkProjectName(UserReportParam userReportParam, boolean isExcludeSelf) {
|
||||
if (!StringUtils.isEmpty(userReportParam.getProjectName())) {
|
||||
LambdaQueryWrapper<UserReportPO> userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userReportPOLambdaQueryWrapper
|
||||
.eq(UserReportPO::getProjectName, userReportParam.getProjectName())
|
||||
.in(UserReportPO::getStatus, CollectionUtil.newArrayList(BpmProcessInstanceStatusEnum.AWAIT.getStatus(), BpmProcessInstanceStatusEnum.RUNNING.getStatus(), BpmProcessInstanceStatusEnum.APPROVE.getStatus()))
|
||||
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (userReportParam instanceof UserReportParam.UserReportUpdate) {
|
||||
userReportPOLambdaQueryWrapper.ne(UserReportPO::getId, ((UserReportParam.UserReportUpdate) userReportParam).getId());
|
||||
} else {
|
||||
userReportPOLambdaQueryWrapper.ne(UserReportPO::getId, (userReportParam).getId());
|
||||
}
|
||||
}
|
||||
List<UserReportPO> userReportPOList = this.baseMapper.selectList(userReportPOLambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
//过滤已取消的申请
|
||||
userReportPOList = userReportPOList.stream()
|
||||
.filter(userReportPO -> !userReportPO.getStatus().equals(FlowStatusEnum.CANCEL.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
//如果还存在,则说明有人申请过了
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
UserVO userVO = userFeignClient.getUserById(userReportPOList.get(0).getReporter()).getData();
|
||||
throw new BusinessException(userReportParam.getProjectName().concat(",该工程已被:").concat(userVO.getName()).concat("申请"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportNormalMapper;
|
||||
import com.njcn.device.userledger.service.IUserReportNormalService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportNormalPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 干扰源用户常态化管理 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserReportNormalServiceImpl extends ServiceImpl<UserReportNormalMapper, UserReportNormalPO> implements IUserReportNormalService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportProjectPOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportProjectPOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:08【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportProjectPOServiceImpl extends ServiceImpl<UserReportProjectPOMapper, UserReportProjectPO> implements UserReportProjectPOService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportRenewalMapper;
|
||||
import com.njcn.device.userledger.service.IUserReportRenewalService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportRenewalPO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户档案信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2024-06-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalMapper, UserReportRenewalPO> implements IUserReportRenewalService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportSensitivePOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportSensitivePOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportSensitivePOServiceImpl extends ServiceImpl<UserReportSensitivePOMapper, UserReportSensitivePO> implements UserReportSensitivePOService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.device.userledger.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.userledger.mapper.UserReportSubstationPOMapper;
|
||||
import com.njcn.device.userledger.service.UserReportSubstationPOService;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/4/25 10:09【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class UserReportSubstationPOServiceImpl extends ServiceImpl<UserReportSubstationPOMapper, UserReportSubstationPO> implements UserReportSubstationPOService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user