辽宁功能提交

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

36
pom.xml
View File

@@ -39,11 +39,24 @@
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
<properties> <properties>
<!--中间件目标地址-->
<!-- <middle.server.url>10.95.53.49</middle.server.url>--> <!-- <middle.server.url>25.36.232.56</middle.server.url>
&lt;!&ndash;<middle.server.url>192.168.1.22</middle.server.url>&ndash;&gt;
&lt;!&ndash;微服务模块发布地址&ndash;&gt;
<service.server.url>10.247.207.131</service.server.url>
&lt;!&ndash;<service.server.url>192.168.1.29</service.server.url>&ndash;&gt;
&lt;!&ndash;docker仓库地址&ndash;&gt;
<docker.server.url>192.168.1.22</docker.server.url>
&lt;!&ndash;nacos的ip:port&ndash;&gt;
<nacos.url>${middle.server.url}:18848</nacos.url>
&lt;!&ndash;服务器发布内容为空&ndash;&gt;
<nacos.namespace></nacos.namespace>-->
<middle.server.url>192.168.1.22</middle.server.url> <middle.server.url>192.168.1.22</middle.server.url>
<!--微服务模块发布地址--> <!--微服务模块发布地址-->
<service.server.url>127.0.0.1</service.server.url> <service.server.url>192.168.1.127</service.server.url>
<!--docker仓库地址--> <!--docker仓库地址-->
<docker.server.url>192.168.1.22</docker.server.url> <docker.server.url>192.168.1.22</docker.server.url>
<!--nacos的ip:port--> <!--nacos的ip:port-->
@@ -51,13 +64,18 @@
<!--nacos开启鉴权后的用户名--> <!--nacos开启鉴权后的用户名-->
<nacos.username>nacos</nacos.username> <nacos.username>nacos</nacos.username>
<!--nacos的ip:port--> <!--nacos的ip:port-->
<nacos.password>nacos</nacos.password> <nacos.password>Nacos@#001</nacos.password>
<!--服务器发布内容为空--> <!--服务器发布内容为空-->
<!-- <nacos.namespace></nacos.namespace>--> <!-- <nacos.namespace>be707bb0-02ea-4a8d-bd91-bac2ceb43177</nacos.namespace>-->
<!-- <nacos.namespace>30c701c4-2a94-49d9-82e1-76aa9456573f</nacos.namespace>-->
<nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace> <!-- <nacos.namespace>1dd11af6-e668-41fd-a663-02a05705304d</nacos.namespace>-->
<!-- <nacos.namespace>910d0d69-2254-481b-b9f7-7ecf9cb881b0</nacos.namespace>--> <nacos.namespace>78588706-e06f-4580-b612-b26d72493fcb</nacos.namespace>
<!-- sentinel:port--> <!-- <nacos.namespace>78588706-e06f-4580-b612-b26d72493fcb</nacos.namespace>-->
<sentinel.url>${middle.server.url}:8080</sentinel.url> <sentinel.url>${middle.server.url}:8080</sentinel.url>
<!--网关地址主要用于配置swagger中认证token--> <!--网关地址主要用于配置swagger中认证token-->
<gateway.url>${service.server.url}:10215</gateway.url> <gateway.url>${service.server.url}:10215</gateway.url>

View File

@@ -26,11 +26,11 @@
<artifactId>pq-device-boot</artifactId> <artifactId>pq-device-boot</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- <dependency>--> <!-- <dependency>
<!-- <groupId>com.njcn</groupId>--> <groupId>com.njcn</groupId>
<!-- <artifactId>pms-device-boot</artifactId>--> <artifactId>pms-device-boot</artifactId>
<!-- <version>${project.version}</version>--> <version>${project.version}</version>
<!-- </dependency>--> </dependency>-->
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>

View File

@@ -23,6 +23,7 @@ public enum LineBaseEnum {
DEVICE_LEVEL(4, "设备"), DEVICE_LEVEL(4, "设备"),
SUB_V_LEVEL(5, "母线"), SUB_V_LEVEL(5, "母线"),
LINE_LEVEL(6, "监测点"), LINE_LEVEL(6, "监测点"),
USER_LEVEL(7,"用户"),
INVALID_LEVEL(-1, "非法拓扑等级"), INVALID_LEVEL(-1, "非法拓扑等级"),

View File

@@ -120,6 +120,15 @@ public class LineParam {
@ApiModelProperty(name = "objName",value = "监测点对象名称") @ApiModelProperty(name = "objName",value = "监测点对象名称")
private String objName; private String objName;
@ApiModelProperty(name = "objId",value = "对象id")
private String objId;
@ApiModelProperty(name = "bigObjType",value = "对象大类")
private String bigObjType;
@ApiModelProperty(name = "smallObjType",value = "对象小类")
private String smallObjType;
/** /**
* 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法) * 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法)
*/ */

View File

@@ -107,8 +107,24 @@ public class LineDetail{
/** /**
* 监测点对象名称 * 监测点对象名称
*/ */
@Deprecated
private String objName; private String objName;
/**
* 监测点对象id
*/
private String objId;
/**
* 监测对象大类
*/
private String bigObjType;
/**
* 监测对象小类
*/
private String smallObjType;
/** /**
* 人为干预 0 不参与统计 1 参与统计 * 人为干预 0 不参与统计 1 参与统计
*/ */
@@ -139,26 +155,31 @@ public class LineDetail{
/** /**
* 上级电站 * 上级电站
*/ */
@Deprecated
private String superiorsSubstation; private String superiorsSubstation;
/** /**
* 挂接线路 * 挂接线路
*/ */
@Deprecated
private String hangLine; private String hangLine;
/** /**
* 监测点拥有者 * 监测点拥有者
*/ */
@Deprecated
private String owner; private String owner;
/** /**
* 拥有者职务 * 拥有者职务
*/ */
@Deprecated
private String ownerDuty; private String ownerDuty;
/** /**
* 拥有者联系方式 * 拥有者联系方式
*/ */
@Deprecated
private String ownerTel; private String ownerTel;
/** /**
@@ -183,6 +204,7 @@ public class LineDetail{
/** /**
* 新能源场站信息ID * 新能源场站信息ID
*/ */
@Deprecated
private String newStationId; private String newStationId;
/** /**

View File

@@ -100,6 +100,21 @@ public class LineVO implements Serializable {
@ApiModelProperty(name = "objName",value = "监测点对象名称") @ApiModelProperty(name = "objName",value = "监测点对象名称")
private String objName; private String objName;
/**
* 监测点对象id
*/
private String objId;
/**
* 监测对象大类
*/
private String bigObjType;
/**
* 监测对象小类
*/
private String smallObjType;
/** /**
* 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法) * 接线类型(0:星型接法;1:三角型接法;2:开口三角型接法)
*/ */

View File

@@ -75,4 +75,6 @@ public class TerminalTree implements Serializable {
* 电网侧变电站 * 电网侧变电站
*/ */
private String objName; private String objName;
private String objId;
} }

View File

@@ -45,6 +45,7 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.njcn.platform</groupId> <groupId>com.njcn.platform</groupId>
<artifactId>message-api</artifactId> <artifactId>message-api</artifactId>
@@ -52,7 +53,12 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>supervision-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>

View File

@@ -121,13 +121,13 @@ public class TerminalBaseController extends BaseController {
} }
terminalBaseService.addTerminal(addTerminalParam); terminalBaseService.addTerminal(addTerminalParam);
//新增终端后发送消息给前置重启设备 //新增终端后发送消息给前置重启设备
if (Objects.nonNull(addTerminalParam.getDeviceParam())) { /* if (Objects.nonNull(addTerminalParam.getDeviceParam())) {
addTerminalParam.getDeviceParam().forEach(temp->{ addTerminalParam.getDeviceParam().forEach(temp->{
Line line = terminalBaseService.queryTerminalByName(temp.getName()); Line line = terminalBaseService.queryTerminalByName(temp.getName());
terminalBaseService.askRestartDevice(line.getId(), DeviceRebootType.ADD_TERMINAL); terminalBaseService.askRestartDevice(line.getId(), DeviceRebootType.ADD_TERMINAL);
}); });
} }*/
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@@ -192,9 +192,9 @@ public class TerminalBaseController extends BaseController {
@ApiOperation("查询终端详情") @ApiOperation("查询终端详情")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM) @OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@GetMapping("queryTerminal") @GetMapping("queryTerminal")
public HttpResult<TerminalVO> queryTerminal(@RequestParam("id") String id) { public HttpResult<TerminalVO> queryTerminal(@RequestParam("id") String id,@RequestParam(required = false)Integer level) {
String methodDescribe = getMethodDescribe("queryTerminal"); String methodDescribe = getMethodDescribe("queryTerminal");
TerminalVO t = terminalBaseService.queryTerminal(id); TerminalVO t = terminalBaseService.queryTerminal(id,level);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, t, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, t, methodDescribe);
} }

View File

@@ -569,4 +569,6 @@ public interface LineMapper extends BaseMapper<Line> {
List<LineDetail> selectByName(@Param("param") LineBaseQueryParam param); List<LineDetail> selectByName(@Param("param") LineBaseQueryParam param);
List<MonitorInfo> getLineByDeviceId(@Param("id") String id); List<MonitorInfo> getLineByDeviceId(@Param("id") String id);
List<TerminalTree> getLineAndLineDetail();
} }

View File

@@ -1812,4 +1812,12 @@
LEFT JOIN sys_dict_data s1 ON pq_voltage.Scale = s1.id LEFT JOIN sys_dict_data s1 ON pq_voltage.Scale = s1.id
WHERE voltage.Pid = #{id} WHERE voltage.Pid = #{id}
</select> </select>
<select id="getLineAndLineDetail" resultType="TerminalTree">
select
t1.id,t1.name,t1.pid,t2.obj_id,t1.sort,t1.pids,t1.level
from
pq_line t1 inner join pq_line_detail t2 on t1.id = t2.id
where t1.state = 1
</select>
</mapper> </mapper>

View File

@@ -383,7 +383,8 @@
line.pids, line.pids,
CONCAT(voltage.name, '_', line.name) name, CONCAT(voltage.name, '_', line.name) name,
comFlag.Com_Flag, comFlag.Com_Flag,
detail.pt_type detail.pt_type,
detail.obj_id
FROM FROM
pq_line line, pq_line line,
pq_line_detail detail, pq_line_detail detail,

View File

@@ -47,7 +47,7 @@ public interface TerminalBaseService {
* @author cdf * @author cdf
* @date 2021/7/19 * @date 2021/7/19
*/ */
TerminalVO queryTerminal(String id); TerminalVO queryTerminal(String id,Integer level);
/** /**
* 终端查询操作 * 终端查询操作

View File

@@ -55,6 +55,9 @@ import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.excel.ExcelUtil;
import com.njcn.poi.util.PoiUtil; import com.njcn.poi.util.PoiUtil;
import com.njcn.redis.utils.RedisUtil; import com.njcn.redis.utils.RedisUtil;
import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.supervision.pojo.vo.user.UserReportVO;
import com.njcn.system.api.AreaFeignClient; import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
@@ -114,6 +117,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
private final NodeDeviceService nodeDeviceService; private final NodeDeviceService nodeDeviceService;
private final DeviceProcessService deviceProcessService; private final DeviceProcessService deviceProcessService;
private final ProduceFeignClient produceFeignClient; private final ProduceFeignClient produceFeignClient;
private final UserLedgerFeignClient userLedgerFeignClient;
@Value("${oracle.isSync}") @Value("${oracle.isSync}")
private Boolean isSync; private Boolean isSync;
@@ -475,7 +480,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
lineDetailMapper.insert(lineDetail); lineDetailMapper.insert(lineDetail);
if(StrUtil.isNotBlank(lineDetail.getObjId())){
userLedgerFeignClient.bindUserStation(lineDetail.getObjId(),subIndex);
}
//通过监测点id获取母线电压等级 //通过监测点id获取母线电压等级
Voltage voltage = lineMapper.getVoltageByLineId(line.getId()); Voltage voltage = lineMapper.getVoltageByLineId(line.getId());
//监测点限值 //监测点限值
@@ -797,6 +804,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
lineDetailMapper.updateById(lineDetail); lineDetailMapper.updateById(lineDetail);
if(StrUtil.isNotBlank(lineDetail.getObjId())){
Line tem = this.getById(lineDetail.getId());
userLedgerFeignClient.bindUserStation(lineDetail.getObjId(),tem.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]);
}
Overlimit overlimitTem = overlimitMapper.selectById(lineId); Overlimit overlimitTem = overlimitMapper.selectById(lineId);
if ((!lineDetailRes.getDevCapacity().equals(lineDetail.getDevCapacity())) if ((!lineDetailRes.getDevCapacity().equals(lineDetail.getDevCapacity()))
|| ((!lineDetailRes.getShortCapacity().equals(lineDetail.getShortCapacity()))) || ((!lineDetailRes.getShortCapacity().equals(lineDetail.getShortCapacity())))
@@ -952,8 +964,20 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
* @date 2021/7/19 * @date 2021/7/19
*/ */
@Override @Override
public TerminalVO queryTerminal(String id) { public TerminalVO queryTerminal(String id,Integer level) {
Line obj = this.getById(id); Line obj;
if(level == 700){
obj = new Line();
UserLedgerVO userLedgerVO = userLedgerFeignClient.selectUserInfo(id).getData();
if(Objects.nonNull(userLedgerVO)){
obj.setId(userLedgerVO.getId());
obj.setLevel(LineBaseEnum.USER_LEVEL.getCode());
obj.setPid(userLedgerVO.getStationId());
}
}else {
obj = this.getById(id);
}
if (Objects.isNull(obj)) { if (Objects.isNull(obj)) {
throw new BusinessException(CommonResponseEnum.FAIL); throw new BusinessException(CommonResponseEnum.FAIL);
} }
@@ -1052,6 +1076,89 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
terminalVO.setDeviceVO(deviceDTOList); terminalVO.setDeviceVO(deviceDTOList);
} else if(obj.getLevel().equals(LineBaseEnum.USER_LEVEL.getCode())){
//点击用户节点
//查询所有子级装置
LambdaQueryWrapper<LineDetail> detailLambdaQueryWrapper = new LambdaQueryWrapper<>();
detailLambdaQueryWrapper.eq(LineDetail::getObjId,id);
List<LineDetail> lineDetailList = lineDetailMapper.selectList(detailLambdaQueryWrapper);
List<String> ids = lineDetailList.stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.in(Line::getId, ids)
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
.orderByAsc(Line::getSort);
List<Line> temLineList = this.list(lineLambdaQueryWrapper);
List<String> devIds = temLineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[4]).collect(Collectors.toList());
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.in(Line::getId, devIds)
.eq(Line::getState, DataStateEnum.ENABLE.getCode())
.orderByAsc(Line::getSort);
List<Line> devList = this.list(lineLambdaQueryWrapper);
List<DeviceVO> deviceDTOList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(devList)) {
for (Line device : devList) {
DeviceVO deviceVO = new DeviceVO();
BeanUtils.copyProperties(device, deviceVO);
Device deviceDetail = deviceMapper.selectById(device.getId());
//解密
//decoderM3d(deviceDetail);
BeanUtils.copyProperties(deviceDetail, deviceVO);
deviceVO.setDevIndex(device.getId());
//母线
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.eq(Line::getPid, device.getId())
.orderByAsc(Line::getSort)
.eq(Line::getState, DataStateEnum.ENABLE.getCode());
List<Line> subVoltageList = this.list(lineLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(subVoltageList)) {
List<SubVoltageVO> subVoltageVOS = new ArrayList<>();
for (Line subVoltage : subVoltageList) {
SubVoltageVO subVoltageVO = new SubVoltageVO();
BeanUtils.copyProperties(subVoltage, subVoltageVO);
Voltage voltage = voltageMapper.selectById(subVoltage.getId());
BeanUtils.copyProperties(voltage, subVoltageVO);
subVoltageVO.setSubvIndex(subVoltage.getId());
//监测点
lineLambdaQueryWrapper.clear();
lineLambdaQueryWrapper.eq(Line::getPid, subVoltage.getId())
.eq(Line::getState, DataStateEnum.ENABLE.getCode());
List<Line> lineList = this.list(lineLambdaQueryWrapper);
if (CollectionUtil.isNotEmpty(lineList)) {
List<LineVO> lineVOS = new ArrayList<>();
for (Line line : lineList) {
LineVO lineVO = new LineVO();
BeanUtils.copyProperties(line, lineVO);
LineDetail lineDetail = lineDetailMapper.selectById(line.getId());
BeanUtils.copyProperties(lineDetail, lineVO);
Overlimit overLimit = overlimitMapper.selectById(line.getId());
lineVO.setVoltageDev(overLimit.getVoltageDev());
lineVO.setUvoltageDev(overLimit.getUvoltageDev());
lineVO.setLineIndex(line.getId());
lineVOS.add(lineVO);
}
subVoltageVO.setLineVO(lineVOS);
}
subVoltageVOS.add(subVoltageVO);
}
deviceVO.setSubVoltageVOList(subVoltageVOS);
}
deviceDTOList.add(deviceVO);
}
}
terminalVO.setDeviceVO(deviceDTOList);
commTerminalValue(terminalVO, obj.getPid());
} else if (obj.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())) { } else if (obj.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())) {
//点击装置节点 //点击装置节点

View File

@@ -19,11 +19,14 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.po.LineDetail; import com.njcn.device.pq.pojo.po.LineDetail;
import com.njcn.device.pq.pojo.vo.DeptLineTreeVO; import com.njcn.device.pq.pojo.vo.DeptLineTreeVO;
import com.njcn.device.pq.pojo.vo.DevAndLine;
import com.njcn.device.pq.pojo.vo.TerminalTree; import com.njcn.device.pq.pojo.vo.TerminalTree;
import com.njcn.device.pq.service.TerminalTreeService; import com.njcn.device.pq.service.TerminalTreeService;
import com.njcn.supervision.api.UserLedgerFeignClient; import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO; 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.system.api.AreaFeignClient; import com.njcn.system.api.AreaFeignClient;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.enums.StatisticsEnum; import com.njcn.system.pojo.enums.StatisticsEnum;
@@ -81,27 +84,42 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
List<TerminalTree> subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()); List<TerminalTree> subList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()); List<TerminalTree> devList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()); List<TerminalTree> subvList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
List<TerminalTree> lineList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList());
//处理存在用户的台账
List<TerminalTree> newLineList = lineMapper.getLineAndLineDetail();
List<TerminalTree> userLineList = newLineList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
List<TerminalTree> otherLineList = newLineList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
List<String> devIds = userLineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()]).distinct().collect(Collectors.toList());
List<TerminalTree> subvUserList = subvList.stream().filter(it->devIds.contains(it.getPid())).collect(Collectors.toList());
List<String> busBarIds = subvUserList.stream().map(TerminalTree::getId).distinct().collect(Collectors.toList());
List<TerminalTree> devUserList = devList.stream().filter(it->devIds.contains(it.getId())).collect(Collectors.toList());
//其他的台账默认时电网侧台账
List<TerminalTree> subvOtherList = subvList.stream().filter(it->!busBarIds.contains(it.getId())).collect(Collectors.toList());
List<TerminalTree> devOtherList = devList.stream().filter(it->!devIds.contains(it.getId())).collect(Collectors.toList());
UserReportParam userReportParam = new UserReportParam(); UserReportParam userReportParam = new UserReportParam();
List<UserReportPO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam); List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
userReportPOList = userReportPOList.stream().filter(it->StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList()); userReportPOList = userReportPOList.stream().filter(it->StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
Map<String,List<UserReportPO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserReportPO::getStationId)); Map<String,List<UserLedgerVO>> userMap = userReportPOList.stream().collect(Collectors.groupingBy(UserLedgerVO::getStationId));
subvOtherList.forEach(subv -> subv.setChildren(getChildren(subv, otherLineList)));
devOtherList.forEach(dev -> dev.setChildren(getChildren(dev, subvOtherList)));
subList.forEach(sub -> sub.setChildren(specialDealSubChildren(sub, userLineList,devOtherList,subvUserList,devUserList,userMap.get(sub.getId()))));
subvList.forEach(subv -> subv.setChildren(getChildren(subv, lineList)));
devList.forEach(dev -> dev.setChildren(getChildren(dev, subvList)));
subList.forEach(sub -> sub.setChildren(specialDealSubChildren(sub, devList,userMap.get(sub.getId()))));
//subList.forEach(sub -> sub.setChildren(getChildren(sub, devList))); //subList.forEach(sub -> sub.setChildren(getChildren(sub, devList)));
gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList))); gdList.forEach(gd -> gd.setChildren(getChildren(gd, subList)));
provinceList.forEach(province -> province.setChildren(getChildren(province, gdList))); provinceList.forEach(province -> province.setChildren(getChildren(province, gdList)));
projectList.forEach(project -> project.setChildren(getChildren(project, provinceList))); projectList.forEach(project -> project.setChildren(getChildren(project, provinceList)));
if (CollectionUtil.isNotEmpty(allList)) { /* if (CollectionUtil.isNotEmpty(allList)) {
TerminalTree terminalTree = new TerminalTree(); TerminalTree terminalTree = new TerminalTree();
terminalTree.setId("9999999"); terminalTree.setId("9999999");
terminalTree.setLevel(0); terminalTree.setLevel(0);
@@ -110,27 +128,76 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
terminalTree.setChildren(projectList); terminalTree.setChildren(projectList);
} }
taiZhang.add(terminalTree); taiZhang.add(terminalTree);
} }*/
return taiZhang; return projectList;
} }
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> devList,List<UserReportPO> userReportPOList){ private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
List<TerminalTree> list = new ArrayList<>(); List<TerminalTree> list = new ArrayList<>();
List<TerminalTree> devTree = devList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){ if(CollUtil.isNotEmpty(userReportPOList)) {
list.addAll(devTree); Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
}
for(UserReportPO userReportPO:userReportPOList){ List<TerminalTree> userLineList = lineUserList.stream().filter(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()].equals(sub.getId())).collect(Collectors.toList());
List<TerminalTree> dev = devList.stream().filter(it->it.getPid().equals(userReportPO.getId())).collect(Collectors.toList()); Map<String, List<TerminalTree>> map = userLineList.stream().collect(Collectors.groupingBy(TerminalTree::getObjId));
map.forEach((objId, lineList) -> {
List<String> devIds = lineList.stream()
.map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.DEVICE_LEVEL.getCode()])
.distinct()
.collect(Collectors.toList());
List<TerminalTree> busList = busBarList.stream()
.filter(it -> devIds.contains(it.getPid()))
.collect(Collectors.toList());
List<TerminalTree> temBus = new ArrayList<>();
busList.forEach(it -> {
TerminalTree busCopy = new TerminalTree();
busCopy.setName(it.getName());
busCopy.setId(it.getId());
busCopy.setPid(it.getPid());
busCopy.setChildren(getChildren(it, lineList));
busCopy.setPowerFlag(1);
busCopy.setLevel(LineBaseEnum.SUB_V_LEVEL.getCode());
temBus.add(busCopy);
});
List<TerminalTree> devUsrList = devAllList.stream()
.filter(it -> devIds.contains(it.getId()))
.collect(Collectors.toList());
List<TerminalTree> temDevList = new ArrayList<>();
devUsrList.forEach(it -> {
TerminalTree devCopy = new TerminalTree();
devCopy.setName(it.getName());
devCopy.setId(it.getId());
devCopy.setPid(it.getPid());
devCopy.setChildren(getChildren(it, temBus));
devCopy.setPowerFlag(1);
devCopy.setLevel(LineBaseEnum.DEVICE_LEVEL.getCode());
temDevList.add(devCopy);
});
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
TerminalTree terminalTree = new TerminalTree(); TerminalTree terminalTree = new TerminalTree();
terminalTree.setName(userReportPO.getProjectName());
terminalTree.setId(userReportPO.getId()); terminalTree.setId(userReportPO.getId());
terminalTree.setPid(userReportPO.getStationId()); terminalTree.setPid(userReportPO.getStationId());
terminalTree.setPowerFlag(1); terminalTree.setPowerFlag(1);
terminalTree.setLevel(7); terminalTree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
terminalTree.setChildren(dev); terminalTree.setChildren(temDevList);
list.add(terminalTree); list.add(terminalTree);
});
} }
List<TerminalTree> devTree = devOtherList.stream().filter(it->it.getPid().equals(sub.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devTree)){
list.addAll(devTree);
}
return list; return list;
} }
@@ -169,20 +236,52 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
// 通过监测点索引查询监测点信息 // 通过监测点索引查询监测点信息
List<TerminalTree> lineList = treeMapper.getLineList(generalDeviceDTO.getLineIndexes()); List<TerminalTree> lineList = treeMapper.getLineList(generalDeviceDTO.getLineIndexes());
List<TerminalTree> userLineList = lineList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
List<TerminalTree> otherLineList = lineList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
Map<String,List<TerminalTree>> temMap = new HashMap<>();
if(CollUtil.isNotEmpty(userLineList)) {
Map<String, List<TerminalTree>> objMap = userLineList.stream().collect(Collectors.groupingBy(TerminalTree::getObjId));
UserReportParam userReportParam = new UserReportParam();
List<UserLedgerVO> userReportPOList = userLedgerFeignClient.selectUserList(userReportParam).getData();
userReportPOList = userReportPOList.stream().filter(it -> StrUtil.isNotBlank(it.getStationId())).collect(Collectors.toList());
Map<String, UserLedgerVO> userMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
List<TerminalTree> temList = new ArrayList<>();
objMap.forEach((objId, monitorList) -> {
UserLedgerVO userLedgerVO = userMap.get(objId);
TerminalTree tree = new TerminalTree();
tree.setLevel(LineBaseEnum.USER_LEVEL.getCode());
tree.setPid(userLedgerVO.getStationId());
tree.setId(userLedgerVO.getId());
tree.setChildren(monitorList);
int devSize = monitorList.stream().map(x -> {
// 获取父id字符串通过 逗号 分割 成一个数组
String[] pid = x.getPids().split(StrUtil.COMMA);
return pid[LineBaseEnum.DEVICE_LEVEL.getCode()];
}).distinct().collect(Collectors.toList()).size();
tree.setName(userLedgerVO.getProjectName() + "" + devSize + "台装置)");
temList.add(tree);
});
temMap = temList.stream().collect(Collectors.groupingBy(TerminalTree::getPid));
}
//处理变电站 //处理变电站
dealChildrenData(subList, lineList, true); dealChildrenData(subList, otherLineList, temMap,true);
//监测点前面加序号,后面不需要删除下面两行就行 //监测点前面加序号,后面不需要删除下面两行就行
//Integer[] arr = {1}; //Integer[] arr = {1};
//subList.forEach(item->item.getChildren().forEach(it->it.setName((arr[0]++ +"_"+it.getName())))); //subList.forEach(item->item.getChildren().forEach(it->it.setName((arr[0]++ +"_"+it.getName()))));
//处理供电公司 //处理供电公司
dealChildrenData(gdList, subList, false); dealChildrenData(gdList, subList, null,false);
if (deviceInfoParam.getStatisticalType().getCode().equalsIgnoreCase(StatisticsEnum.POWER_NETWORK.getCode())) { if (deviceInfoParam.getStatisticalType().getCode().equalsIgnoreCase(StatisticsEnum.POWER_NETWORK.getCode())) {
terminalTree.setChildren(gdList); terminalTree.setChildren(gdList);
} else { } else {
//还需要额外处理省会 //还需要额外处理省会
dealChildrenData(proList, gdList, false); dealChildrenData(proList, gdList, null,false);
terminalTree.setChildren(proList); terminalTree.setChildren(proList);
} }
terminalTree.setId(generalDeviceDTO.getIndex()); terminalTree.setId(generalDeviceDTO.getIndex());
@@ -203,7 +302,7 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
* @param childrenData * @param childrenData
* @param isLine * @param isLine
*/ */
private void dealChildrenData(List<TerminalTree> targetData, List<TerminalTree> childrenData, boolean isLine) { private void dealChildrenData(List<TerminalTree> targetData, List<TerminalTree> childrenData,Map<String,List<TerminalTree>> userLineMap, boolean isLine) {
// 创建一个map集合用于封装对象 // 创建一个map集合用于封装对象
Map<String, List<TerminalTree>> groupLine; Map<String, List<TerminalTree>> groupLine;
if (isLine) { if (isLine) {
@@ -218,20 +317,27 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
} }
//变电站 //变电站
targetData = targetData.stream().peek(terminalTree -> { targetData = targetData.stream().peek(terminalTree -> {
System.out.println(groupLine.get(terminalTree.getId())); List<TerminalTree> terminalTrees = new ArrayList<>();
System.out.println(terminalTree.getId()); if(groupLine.containsKey(terminalTree.getId())) {
List<TerminalTree> terminalTrees = groupLine.get(terminalTree.getId()).stream().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()); terminalTrees.addAll(groupLine.get(terminalTree.getId()).stream().sorted(Comparator.comparing(TerminalTree::getSort)).collect(Collectors.toList()));
}
if (isLine) { if (isLine) {
//变电站集合 //变电站集合
int size = terminalTrees.stream().map(x -> { int size = terminalTrees.stream().map(x -> {
// 获取父id字符串通过 逗号 分割 成一个数组 // 获取父id字符串通过 逗号 分割 成一个数组
String[] pid = x.getPids().split(","); String[] pid = x.getPids().split(StrUtil.COMMA);
return pid[LineBaseEnum.DEVICE_LEVEL.getCode()]; return pid[LineBaseEnum.DEVICE_LEVEL.getCode()];
}).distinct().collect(Collectors.toList()).size(); }).distinct().collect(Collectors.toList()).size();
terminalTree.setName(terminalTree.getName() + "" + size + "台装置)"); terminalTree.setName(terminalTree.getName() + "" + size + "台装置)");
if(userLineMap.containsKey(terminalTree.getId())){
List<TerminalTree> devList = userLineMap.get(terminalTree.getId());
terminalTrees.addAll(devList);
}
terminalTree.setChildren(terminalTrees); terminalTree.setChildren(terminalTrees);
} else { } else {
terminalTree.setChildren(groupLine.get(terminalTree.getId())); terminalTree.setChildren(groupLine.get(terminalTree.getId()));
} }

View File

@@ -724,50 +724,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
.set(RGeneralSurveyPlanPO::getStatus, AuditProcessEnum.WaitAudit.getStatus()).set(RGeneralSurveyPlanPO::getCheckPerson, rGeneralSurveyPlanAuditUserParam.getAuditUser()) .set(RGeneralSurveyPlanPO::getStatus, AuditProcessEnum.WaitAudit.getStatus()).set(RGeneralSurveyPlanPO::getCheckPerson, rGeneralSurveyPlanAuditUserParam.getAuditUser())
); );
//绑定工作流
Map<String, Object> map = new HashMap<>();
//map.put("applyUser",userId);
for (String planId : planIds) {
//需要判断那些流程已经启动,已经启动的则为驳回后的再次提交审核
FlowableAss flowableAss = flowableAssMapper.selectOne(new LambdaQueryWrapper<FlowableAss>().eq(FlowableAss::getThsIndex, planId));
if (Objects.nonNull(flowableAss)) {
//不为空则认为是驳回后的重新发起
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setAssignee(userId);
flowTaskVo.setComment(RequestUtil.getUserNickname() + "重新发起普测计划申请");
iFlowTaskService.complete(flowTaskVo);
Task taskNext = iFlowTaskService.getTask(flowableAss.getExecIndex());
FlowTaskVo flowTaskVoNext = new FlowTaskVo();
flowTaskVoNext.setTaskId(taskNext.getId());
flowTaskVoNext.setAssignee(rGeneralSurveyPlanAuditUserParam.getAuditUser());
iFlowTaskService.toNextTaskUser(flowTaskVoNext);
} else {
//开始流程
FlowFormAss flowFormAss = flowFormAssMapper.selectOne(new LambdaQueryWrapper<FlowFormAss>().eq(FlowFormAss::getFormId, 1));
if (Objects.isNull(flowFormAss)) {
throw new BusinessException("当前功能未绑定流程,请先绑定流程");
}
String processId = iFlowDefinitionService.startProcessInstanceById(flowFormAss.getDefinitionId(), planId, ThsFlowTypeEnum.rGeneralSurvey.getCode(), map);
Task task = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVo = new FlowTaskVo();
flowTaskVo.setTaskId(task.getId());
flowTaskVo.setInstanceId(processId);
flowTaskVo.setComment(RequestUtil.getUserNickname() + "发起普测计划申请");
iFlowTaskService.complete(flowTaskVo);
Task taskNext = iFlowTaskService.getTask(processId);
FlowTaskVo flowTaskVoNext = new FlowTaskVo();
flowTaskVoNext.setTaskId(taskNext.getId());
flowTaskVoNext.setAssignee(rGeneralSurveyPlanAuditUserParam.getAuditUser());
iFlowTaskService.toNextTaskUser(flowTaskVoNext);
}
}
return true; return true;
} }

View File

@@ -1,14 +1,18 @@
package com.njcn.supervision.api; package com.njcn.supervision.api;
import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory; import com.njcn.supervision.api.fallback.TempLineRunTestFeignClientFallbackFactory;
import com.njcn.supervision.api.fallback.UserLedgerFeignClientFallbackFactory; import com.njcn.supervision.api.fallback.UserLedgerFeignClientFallbackFactory;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO; 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.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
@@ -22,6 +26,11 @@ public interface UserLedgerFeignClient {
@PostMapping("/selectUserList") @PostMapping("/selectUserList")
List<UserReportPO> selectUserList(@RequestBody UserReportParam userReportParam); HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam);
@GetMapping("/selectUserInfo")
HttpResult<UserLedgerVO> selectUserInfo(@RequestParam("id") String id);
@PostMapping(value = "/bindUserStation")
HttpResult<List<UserLedgerVO>> bindUserStation(@RequestParam("userId")String userId,@RequestParam("stationId")String stationId);
} }

View File

@@ -2,10 +2,13 @@ package com.njcn.supervision.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.TempLineRunTestFeignClient; import com.njcn.supervision.api.TempLineRunTestFeignClient;
import com.njcn.supervision.api.UserLedgerFeignClient; import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO; 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.utils.SupervisionEnumUtil; import com.njcn.supervision.utils.SupervisionEnumUtil;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -29,10 +32,22 @@ public class UserLedgerFeignClientFallbackFactory implements FallbackFactory<Use
return new UserLedgerFeignClient() { return new UserLedgerFeignClient() {
@Override @Override
public List<UserReportPO> selectUserList(UserReportParam userReportParam) { public HttpResult<List<UserLedgerVO>> selectUserList(UserReportParam userReportParam) {
log.error("{}异常,降级处理,异常为:{}", "查询用户台账", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "查询用户台账", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<UserLedgerVO> selectUserInfo(String id) {
log.error("{}异常,降级处理,异常为:{}", "查询用户台账详情", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<UserLedgerVO>> bindUserStation(String userId, String stationId) {
log.error("{}异常,降级处理,异常为:{}", "用户电站信息绑定", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -14,6 +14,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -115,6 +116,12 @@ public class UserReportParam {
@ApiModelProperty(value = "预测评估单位") @ApiModelProperty(value = "预测评估单位")
private String evaluationDept; private String evaluationDept;
@ApiModelProperty(value = "经度")
private BigDecimal longitude;
@ApiModelProperty(value = "纬度")
private BigDecimal latitude;
/** /**
* 预测评估结论 * 预测评估结论
*/ */

View File

@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
/** /**
@@ -131,6 +133,19 @@ public class UserReportPO extends BaseEntity {
*/ */
private String stationId; private String stationId;
/**
* 经度
*/
private BigDecimal longitude;
/**
* 纬度
*/
private BigDecimal latitude;
/** /**
* 终端id * 终端id
*/ */

View File

@@ -0,0 +1,24 @@
package com.njcn.supervision.pojo.vo.user;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: cdf
* @CreateTime: 2025-03-24
* @Description: 用户台账
*/
@Data
public class UserLedgerVO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String projectName;
private String stationId;
private String city;
}

View File

@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@@ -95,6 +96,14 @@ public class UserReportVO {
@ApiModelProperty(value = "变电站") @ApiModelProperty(value = "变电站")
private String substation; private String substation;
private String stationId;
@ApiModelProperty(value = "经度")
private BigDecimal longitude;
@ApiModelProperty(value = "纬度")
private BigDecimal latitude;
/** /**
* 电压等级 * 电压等级
*/ */

View File

@@ -10,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO; 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.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.IUserReportNormalService; import com.njcn.supervision.service.user.IUserReportNormalService;
import com.njcn.supervision.service.user.UserReportPOService; import com.njcn.supervision.service.user.UserReportPOService;
@@ -244,11 +245,45 @@ public class UserReportManageController extends BaseController {
@PostMapping(value = "/selectUserList") @PostMapping(value = "/selectUserList")
@ApiOperation("查询用户台账") @ApiOperation("查询用户台账")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
public HttpResult<List<UserReportPO>> selectUserList(@RequestBody UserReportParam userReportParam) { public HttpResult<List<UserLedgerVO>> selectUserList(@RequestBody UserReportParam userReportParam) {
String methodDescribe = getMethodDescribe("selectUserList"); String methodDescribe = getMethodDescribe("selectUserList");
List<UserReportPO> b = userReportPOService.selectUserList(userReportParam); List<UserLedgerVO> b = userReportPOService.selectUserList(userReportParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe); 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.bpm.service.IBpmService;
import com.njcn.supervision.pojo.param.user.UserReportParam; import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.user.UserReportPO; 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.pojo.vo.user.UserReportVO;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -59,5 +61,12 @@ public interface UserReportPOService extends IBpmService<UserReportPO> {
Boolean deleteUserReport(List<String> supervisionId); 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.param.user.UserReportParam;
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport; import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
import com.njcn.supervision.pojo.po.user.*; 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.pojo.vo.user.UserReportVO;
import com.njcn.supervision.service.user.*; import com.njcn.supervision.service.user.*;
import com.njcn.supervision.utils.InstanceUtil; import com.njcn.supervision.utils.InstanceUtil;
@@ -1155,15 +1156,124 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
} }
@Override @Override
public List<UserReportPO> selectUserList(UserReportParam userReportParam) { public List<UserLedgerVO> selectUserList(UserReportParam userReportParam) {
LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<UserReportPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(userReportParam.getCity())){ if(StrUtil.isNotBlank(userReportParam.getCity())){
lambdaQueryWrapper.in(UserReportPO::getCity,Stream.of(userReportParam.getCity()).collect(Collectors.toList())); 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) { public Map<String, String> getTreeString(String name, List<SysDicTreePO> treeVOS) {

View File

@@ -1,15 +1,6 @@
FROM openjdk:8-jdk-alpine FROM openjdk:8-jdk-alpine
FROM eclipse-temurin:8-jdk-ubi9-minimal
MAINTAINER hongawen_13914774158@163.com
ENV JAVA_OPTS="-Xms1024m -Xmx1024m"
# 挂载时区的目录
VOLUME /usr/share/zoneinfo
# 设置时区为上海
ENV TZ=Asia/Shanghai
# 设置时区信息
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD target/systemboot.jar systemboot.jar ADD target/systemboot.jar systemboot.jar
ENTRYPOINT ["java","-jar","/systemboot.jar"] ENTRYPOINT ["java","-jar","/systemboot.jar"]
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /systemboot.jar
EXPOSE 10207 EXPOSE 10207
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone
#RUN apk add --update ttf-dejavu fontconfig && rm -rf /var/cache/apk/*

View File

@@ -161,7 +161,7 @@ public class DictTreeController extends BaseController {
@GetMapping("/queryAllByType") @GetMapping("/queryAllByType")
@ApiOperation("分类查询所有树形字典") @ApiOperation("分类查询所有树形字典")
public HttpResult<List<SysDicTreePO>> queryAllByType(@RequestParam("type")Integer type) { public HttpResult<List<SysDicTreePO>> queryAllByType(@RequestParam("type")Integer type) {
String methodDescribe = getMethodDescribe("queryAll"); String methodDescribe = getMethodDescribe("queryAllByType");
List<SysDicTreePO> result = sysDicTreePOService.queryAllByType(type); List<SysDicTreePO> result = sysDicTreePOService.queryAllByType(type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }