辽宁功能提交

This commit is contained in:
2025-03-25 14:08:29 +08:00
parent 72b2283165
commit de2a2e2fea
27 changed files with 598 additions and 120 deletions

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.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.IUserReportNormalService;
import com.njcn.supervision.service.user.UserReportPOService;
@@ -244,11 +245,45 @@ public class UserReportManageController extends BaseController {
@PostMapping(value = "/selectUserList")
@ApiOperation("查询用户台账")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
public HttpResult<List<UserReportPO>> selectUserList(@RequestBody UserReportParam userReportParam) {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
public HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam) {
String methodDescribe = getMethodDescribe("selectUserList");
List<UserReportPO> b = userReportPOService.selectUserList(userReportParam);
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);
}
@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);
}
}

View File

@@ -5,7 +5,9 @@ import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
import com.njcn.bpm.service.IBpmService;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
@@ -59,5 +61,12 @@ public interface UserReportPOService extends IBpmService<UserReportPO> {
Boolean deleteUserReport(List<String> supervisionId);
List<UserReportPO> selectUserList(UserReportParam userReportParam);
List<UserLedgerVO> selectUserList(UserReportParam userReportParam);
UserLedgerVO selectUserInfo(String id);
Boolean bindUserStation(String userId,String stationId);
Page<UserReportVO> getUserLedgerPage(UserReportParam.UserReportQueryParam userReportQueryParam);
}

View File

@@ -44,6 +44,7 @@ import com.njcn.supervision.pojo.dto.SensitiveUserSExcel;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.user.*;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.*;
import com.njcn.supervision.utils.InstanceUtil;
@@ -1155,15 +1156,124 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
}
@Override
public List<UserReportPO> selectUserList(UserReportParam userReportParam) {
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()));
}
this.list(lambdaQueryWrapper);
return Collections.emptyList();
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 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;
}
public Map<String, String> getTreeString(String name, List<SysDicTreePO> treeVOS) {