新增敏感用户相关功能
This commit is contained in:
@@ -1,11 +1,16 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
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.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -59,6 +64,10 @@ public interface CsLineFeignClient {
|
|||||||
@PostMapping("/getOverLimitDataByIds")
|
@PostMapping("/getOverLimitDataByIds")
|
||||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||||
|
|
||||||
|
@PostMapping("/getLineBySensitiveUser")
|
||||||
|
@ApiOperation("根据敏感用户查询监测点")
|
||||||
|
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,13 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取国标限值异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取国标限值异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<CsLinePO>> getLineByName(String lineName) {
|
public HttpResult<List<CsLinePO>> getLineByName(String lineName) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","根据名称查询监测点异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据名称查询监测点异常",cause.toString());
|
||||||
|
|||||||
@@ -132,4 +132,7 @@ public class CsLinePO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "is_govern")
|
@TableField(value = "is_govern")
|
||||||
private Integer govern;
|
private Integer govern;
|
||||||
|
|
||||||
|
@TableField(value = "monitor_user")
|
||||||
|
private String monitorUser;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,4 +253,13 @@ public class CslineController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLineBySensitiveUser")
|
||||||
|
@ApiOperation("根据敏感用户查询监测点")
|
||||||
|
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
||||||
|
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,6 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
List<CsLinePO> getLineByName(String lineName);
|
List<CsLinePO> getLineByName(String lineName);
|
||||||
|
|
||||||
List<String> getAllLine();
|
List<String> getAllLine();
|
||||||
|
|
||||||
|
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -226,6 +227,14 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.in(CsLinePO::getMonitorUser,list)
|
||||||
|
.eq(CsLinePO::getStatus, 1)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||||
// *
|
// *
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("pq_sensitive_user")
|
||||||
|
public class PqSensitiveUser extends BaseEntity implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感负荷类型
|
||||||
|
*/
|
||||||
|
private String loadType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户协议容量
|
||||||
|
*/
|
||||||
|
private Double userAgreementCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装机容量
|
||||||
|
*/
|
||||||
|
private Double installedCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属厂站名称
|
||||||
|
*/
|
||||||
|
private String substationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EventStatisticsVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电压中断次数")
|
||||||
|
private Integer times1;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电压暂降次数")
|
||||||
|
private Integer times2;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电压暂升次数")
|
||||||
|
private Integer times3;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqSensitiveUserVo implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感用户名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感负荷类型
|
||||||
|
*/
|
||||||
|
private String loadType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否监测
|
||||||
|
*/
|
||||||
|
private String isMonitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否治理
|
||||||
|
*/
|
||||||
|
private String isGovern;
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import com.njcn.csharmonic.param.DataParam;
|
|||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -155,4 +156,15 @@ public class CsEventController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/eventStatistics")
|
||||||
|
@ApiOperation("暂态事件统计")
|
||||||
|
@ApiImplicitParam(name = "param", value = "事件信息", required = true)
|
||||||
|
public HttpResult<List<EventStatisticsVo>> getEventStatistics(@RequestBody CsEventUserQueryParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getEventByTime");
|
||||||
|
List<EventStatisticsVo> list = csEventPOService.getEventStatistics(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
|
||||||
|
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.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
|
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pqSensitiveUser")
|
||||||
|
@Api(tags = "敏感负荷用户管理")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PqSensitiveUserController extends BaseController {
|
||||||
|
|
||||||
|
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getList")
|
||||||
|
@ApiOperation("获取敏感负荷用户列表")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<Page<PqSensitiveUserVo>> getList(@RequestBody BaseParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getList");
|
||||||
|
Page<PqSensitiveUserVo> page = pqSensitiveUserService.getList(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.csharmonic.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
public interface PqSensitiveUserMapper extends BaseMapper<PqSensitiveUser> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import com.njcn.csharmonic.param.DataParam;
|
|||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@@ -62,4 +63,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
|||||||
|
|
||||||
List<CsEventPO> getEventByTime(List<String> lineList, String startTime, String endTime);
|
List<CsEventPO> getEventByTime(List<String> lineList, String startTime, String endTime);
|
||||||
|
|
||||||
|
List<EventStatisticsVo> getEventStatistics(CsEventUserQueryParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
|
||||||
|
|
||||||
|
Page<PqSensitiveUserVo> getList(BaseParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ import com.njcn.csharmonic.param.DataParam;
|
|||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||||
import com.njcn.event.file.component.WaveFileComponent;
|
import com.njcn.event.file.component.WaveFileComponent;
|
||||||
@@ -316,6 +317,15 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
return this.list(lambdaQueryWrapper);
|
return this.list(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EventStatisticsVo> getEventStatistics(CsEventUserQueryParam param) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
public String getTag(Integer type) {
|
public String getTag(Integer type) {
|
||||||
String tag;
|
String tag;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
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.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csharmonic.mapper.PqSensitiveUserMapper;
|
||||||
|
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
|
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-11-17
|
||||||
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMapper, PqSensitiveUser> implements IPqSensitiveUserService {
|
||||||
|
|
||||||
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
||||||
|
Page<PqSensitiveUserVo> result = new Page<>(param.getPageNum(),param.getPageSize());
|
||||||
|
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.orderByDesc(PqSensitiveUser::getSort);
|
||||||
|
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||||
|
lambdaQueryWrapper.like(PqSensitiveUser::getName, param.getSearchValue());
|
||||||
|
}
|
||||||
|
Page<PqSensitiveUser> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),lambdaQueryWrapper);
|
||||||
|
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||||
|
List<PqSensitiveUserVo> dataGroupEventVOList = new ArrayList<>();
|
||||||
|
Map<String,List<CsLinePO>> map = new HashMap<>();
|
||||||
|
//获取绑定敏感用户的监测点信息
|
||||||
|
List<String> sensitiveUserIds = page.getRecords().stream().map(PqSensitiveUser::getId).collect(Collectors.toList());
|
||||||
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLineBySensitiveUser(sensitiveUserIds).getData();
|
||||||
|
if (CollUtil.isNotEmpty(csLinePOList)) {
|
||||||
|
map = csLinePOList.stream().collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
||||||
|
}
|
||||||
|
Map<String, List<CsLinePO>> finalMap = map;
|
||||||
|
page.getRecords().forEach(item->{
|
||||||
|
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||||
|
BeanUtil.copyProperties(item,vo);
|
||||||
|
if (finalMap.containsKey(item.getId())) {
|
||||||
|
vo.setIsMonitor("是");
|
||||||
|
List<CsLinePO> list = finalMap.get(item.getId());
|
||||||
|
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
||||||
|
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||||
|
} else {
|
||||||
|
vo.setIsMonitor("否");
|
||||||
|
vo.setIsGovern("否");
|
||||||
|
}
|
||||||
|
dataGroupEventVOList.add(vo);
|
||||||
|
});
|
||||||
|
result.setRecords(dataGroupEventVOList);
|
||||||
|
result.setTotal(page.getTotal());
|
||||||
|
result.setSize(page.getSize());
|
||||||
|
result.setCurrent(page.getCurrent());
|
||||||
|
result.setPages(page.getPages());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user