1.解决省级用户,可查看市级待提交和审核不通过数据
2.pms增加数据单位管理
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
package com.njcn.device.pms.pojo.vo;
|
||||
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/8/21 10:16
|
||||
*/
|
||||
@Data
|
||||
public class DeviceUnitVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "频率")
|
||||
private String unitFrequency;
|
||||
|
||||
@ApiModelProperty(value = "频率偏差")
|
||||
private String unitFrequencyDev;
|
||||
|
||||
@ApiModelProperty(value = "相电压有效值")
|
||||
private String phaseVoltage;
|
||||
|
||||
@ApiModelProperty(value = "线电压有效值")
|
||||
private String lineVoltage;
|
||||
|
||||
@ApiModelProperty(value = "电压上偏差")
|
||||
private String voltageDev;
|
||||
|
||||
@ApiModelProperty(value = "电压下偏差")
|
||||
private String uvoltageDev;
|
||||
|
||||
@ApiModelProperty(value = "电流有效值")
|
||||
private String ieffective;
|
||||
|
||||
@ApiModelProperty(value = "单相有功功率")
|
||||
private String singleP;
|
||||
|
||||
@ApiModelProperty(value = "单相视在功率")
|
||||
private String singleViewP;
|
||||
|
||||
@ApiModelProperty(value = "单相无功功率")
|
||||
private String singleNoP;
|
||||
|
||||
@ApiModelProperty(value = "总有功功率")
|
||||
private String totalActiveP;
|
||||
|
||||
@ApiModelProperty(value = "总视在功率")
|
||||
private String totalViewP;
|
||||
|
||||
@ApiModelProperty(value = "总无功功率")
|
||||
private String totalNoP;
|
||||
|
||||
@ApiModelProperty(value = "相(线)电压基波有效值")
|
||||
private String vfundEffective;
|
||||
|
||||
@ApiModelProperty(value = "基波电流")
|
||||
private String ifund;
|
||||
|
||||
@ApiModelProperty(value = "基波有功功率")
|
||||
private String fundActiveP;
|
||||
|
||||
@ApiModelProperty(value = "基波无功功率")
|
||||
private String fundNoP;
|
||||
|
||||
@ApiModelProperty(value = "电压总谐波畸变率")
|
||||
private String vdistortion;
|
||||
|
||||
@ApiModelProperty(value = "2~50次谐波电压含有率")
|
||||
private String vharmonicRate;
|
||||
|
||||
@ApiModelProperty(value = "2~50次谐波电流有效值")
|
||||
private String iharmonic;
|
||||
|
||||
@ApiModelProperty(value = "2~50次谐波有功功率")
|
||||
private String pharmonic;
|
||||
|
||||
@ApiModelProperty(value = "0.5~49.5次间谐波电流有效值")
|
||||
private String iiharmonic;
|
||||
|
||||
@ApiModelProperty(value = "正序电压")
|
||||
private String positiveV;
|
||||
|
||||
@ApiModelProperty(value = "运行状态")
|
||||
private String devFlag;
|
||||
|
||||
@ApiModelProperty(value = "零序负序电压")
|
||||
private String noPositiveV;
|
||||
@ApiModelProperty(value = "子集数据")
|
||||
List<?> children;
|
||||
|
||||
@Data
|
||||
public static class DeviceUnit extends PqsDeviceUnit {
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "父节点")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "运行状态")
|
||||
private String devFlag;
|
||||
|
||||
@ApiModelProperty(value = "子集数据")
|
||||
List<?> children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.njcn.device.pms.controller.majornetwork;
|
||||
|
||||
|
||||
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.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
|
||||
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据单位管理
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "数据单位管理")
|
||||
@RequestMapping("/pq/pqsDeviceUnit")
|
||||
@RequiredArgsConstructor
|
||||
public class PqsDeviceUnitController extends BaseController {
|
||||
|
||||
private final IPqsDeviceUnitService iPqsDeviceUnitService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/nodeTree")
|
||||
@ApiOperation("数据单位查询树")
|
||||
@ApiImplicitParam(name = "devFlag", value = "实体", required = true)
|
||||
public HttpResult<List<DeviceUnitVo>> nodeTree(String devFlag) {
|
||||
String methodDescribe = getMethodDescribe("nodeTree");
|
||||
List<DeviceUnitVo> pqsDeviceUnitVos = iPqsDeviceUnitService.nodeList(devFlag);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnitVos, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/saveDeviceUnit")
|
||||
@ApiOperation("数据单位修改")
|
||||
@ApiImplicitParam(name = "unit", value = "实体", required = true)
|
||||
public HttpResult<Boolean> saveDeviceUnit(@RequestBody PqsDeviceUnit unit) {
|
||||
String methodDescribe = getMethodDescribe("saveDeviceUnit");
|
||||
Boolean aBoolean = iPqsDeviceUnitService.saveDeviceUnit(unit);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, aBoolean, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/lineUnitDetail")
|
||||
@ApiOperation("根据监测点id获取数据单位")
|
||||
@ApiImplicitParam(name = "lineID", value = "实体", required = true)
|
||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineID") String lineID) {
|
||||
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
||||
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.lineUnitDetail(lineID);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/devUnitDetail")
|
||||
@ApiOperation("根据终端id获取数据单位")
|
||||
@ApiImplicitParam(name = "devID", value = "实体", required = true)
|
||||
public HttpResult<PqsDeviceUnit> devUnitDetail(@RequestParam("devID") String devID) {
|
||||
String methodDescribe = getMethodDescribe("devUnitDetail");
|
||||
PqsDeviceUnit pqsDeviceUnit = iPqsDeviceUnitService.devUnitDetail(devID);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.device.pms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
public interface PqsDeviceUnitMapper extends BaseMapper<PqsDeviceUnit> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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.pq.mapper.PqsDeviceUnitMapper">
|
||||
|
||||
<select id="deviceUnitList" resultType="com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo$DeviceUnit">
|
||||
SELECT
|
||||
dev.id as id,
|
||||
dev.pid as pid,
|
||||
dev.NAME as `name`,
|
||||
pd.Run_Flag as devFlag,
|
||||
b.*
|
||||
FROM
|
||||
pq_line dev
|
||||
INNER JOIN pq_device pd ON dev.id = pd.id and dev.State = 1
|
||||
LEFT JOIN pqs_device_unit b ON dev.id = b.dev_index
|
||||
<where>
|
||||
<if test="devFlag!=null and devFlag!='' ">
|
||||
pd.Run_Flag = #{devFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="deviceUnitByID" resultType="com.njcn.device.biz.pojo.po.PqsDeviceUnit">
|
||||
SELECT
|
||||
unit.*
|
||||
FROM
|
||||
pq_line line
|
||||
INNER JOIN pq_line vo ON vo.id = line.pid
|
||||
INNER JOIN pq_line dev ON dev.id = vo.pid
|
||||
INNER JOIN pq_device pd ON pd.id = dev.id
|
||||
LEFT JOIN pqs_device_unit unit ON unit.DEV_INDEX = dev.id
|
||||
<where>
|
||||
line.State = 1
|
||||
<if test="ids!=null and ids!='' ">
|
||||
and line.id = #{ids}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.device.pms.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
public interface IPqsDeviceUnitService extends IService<PqsDeviceUnit> {
|
||||
|
||||
/**
|
||||
* @param devFlag
|
||||
* @Description: 查询数据单位树
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.vo.PqsDeviceUnitVo>
|
||||
* @Author: wr
|
||||
* @Date: 2023/8/21 13:58
|
||||
*/
|
||||
List<DeviceUnitVo> nodeList(String devFlag);
|
||||
|
||||
/**
|
||||
* @param unit
|
||||
* @Description: 添加数据终端
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2023/8/21 14:01
|
||||
*/
|
||||
Boolean saveDeviceUnit(PqsDeviceUnit unit);
|
||||
|
||||
/**
|
||||
* @param lineID
|
||||
* @Description: 根据监测点id查询数据单位
|
||||
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
|
||||
* @Author: wr
|
||||
* @Date: 2023/8/21 14:02
|
||||
*/
|
||||
PqsDeviceUnit lineUnitDetail(String lineID);
|
||||
|
||||
/**
|
||||
* @param devID
|
||||
* @Description: 根据终端id查询数据单位
|
||||
* @return: com.njcn.device.biz.pojo.po.PqsDeviceUnit
|
||||
* @Author: wr
|
||||
* @Date: 2023/8/21 14:02
|
||||
*/
|
||||
PqsDeviceUnit devUnitDetail(String devID);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.njcn.device.pms.service.majornetwork.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.device.pms.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pms.pojo.po.PmsTerminal;
|
||||
import com.njcn.device.pms.pojo.vo.DeviceUnitVo;
|
||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
import com.njcn.device.pms.service.majornetwork.IPqsDeviceUnitService;
|
||||
import com.njcn.device.pms.service.majornetwork.ITerminalService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wr
|
||||
* @since 2023-08-21
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqsDeviceUnitServiceImpl extends ServiceImpl<PqsDeviceUnitMapper, PqsDeviceUnit> implements IPqsDeviceUnitService {
|
||||
|
||||
private final ITerminalService terminalService;
|
||||
private final IMonitorService monitorService;
|
||||
|
||||
@Override
|
||||
public List<DeviceUnitVo> nodeList(String devFlag) {
|
||||
List<DeviceUnitVo> pqsDeviceUnitVos = new ArrayList<>();
|
||||
List<PmsTerminal> list = terminalService.list(new LambdaQueryWrapper<PmsTerminal>()
|
||||
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
|
||||
.eq(StrUtil.isNotBlank(devFlag), PmsTerminal::getTerminalState, devFlag)
|
||||
);
|
||||
List<String> terminal = list.stream().map(PmsTerminal::getId).collect(Collectors.toList());
|
||||
//获取所有终端信息
|
||||
List<PqsDeviceUnit> pqsDeviceUnits = this.listByIds(terminal);
|
||||
Map<String, PqsDeviceUnit> unitMap = pqsDeviceUnits.stream().collect(Collectors.toMap(PqsDeviceUnit::getDevIndex, Function.identity()));
|
||||
Map<String, List<PmsTerminal>> orgMap = list.stream().collect(Collectors.groupingBy(PmsTerminal::getOrgId));
|
||||
orgMap.forEach((key, value) -> {
|
||||
DeviceUnitVo unitVo = new DeviceUnitVo();
|
||||
unitVo.setId(key);
|
||||
unitVo.setName(value.get(0).getOrgName());
|
||||
Map<String, List<PmsTerminal>> subMap = value.stream().collect(Collectors.groupingBy(PmsTerminal::getPowerStationId));
|
||||
|
||||
List<DeviceUnitVo> subUnitVos = new ArrayList<>();
|
||||
subMap.forEach((subKey, subValue) -> {
|
||||
DeviceUnitVo subUnitVo = new DeviceUnitVo();
|
||||
subUnitVo.setId(subKey);
|
||||
subUnitVo.setName(subValue.get(0).getPowerrName());
|
||||
Map<String, List<PmsTerminal>> terMap = subValue.stream().collect(Collectors.groupingBy(PmsTerminal::getId));
|
||||
List<DeviceUnitVo> terUnitVos = new ArrayList<>();
|
||||
terMap.forEach((terKey, terValue) -> {
|
||||
for (PmsTerminal pmsTerminal : terValue) {
|
||||
DeviceUnitVo terUnitVo = new DeviceUnitVo();
|
||||
terUnitVo.setId(pmsTerminal.getId());
|
||||
terUnitVo.setName(pmsTerminal.getName());
|
||||
PqsDeviceUnit pqsDeviceUnit;
|
||||
if (unitMap.containsKey(terKey)) {
|
||||
pqsDeviceUnit = unitMap.get(terKey);
|
||||
} else {
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
BeanUtil.copyProperties(pqsDeviceUnit,terUnitVo);
|
||||
terUnitVos.add(terUnitVo);
|
||||
}
|
||||
});
|
||||
subUnitVo.setChildren(terUnitVos);
|
||||
subUnitVos.add(subUnitVo);
|
||||
});
|
||||
unitVo.setChildren(subUnitVos);
|
||||
pqsDeviceUnitVos.add(unitVo);
|
||||
});
|
||||
return pqsDeviceUnitVos;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveDeviceUnit(PqsDeviceUnit unit) {
|
||||
PqsDeviceUnit byId = this.getById(unit.getDevIndex());
|
||||
if (ObjectUtil.isNotNull(byId)) {
|
||||
return this.updateById(unit);
|
||||
}
|
||||
return this.save(unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqsDeviceUnit lineUnitDetail(String lineID) {
|
||||
Monitor byId = monitorService.getById(lineID);
|
||||
if (ObjectUtil.isNotNull(byId)) {
|
||||
PqsDeviceUnit unit = this.getById(byId.getTerminalId());
|
||||
if (ObjectUtil.isNotNull(unit)) {
|
||||
return unit;
|
||||
}
|
||||
return new PqsDeviceUnit();
|
||||
}
|
||||
return new PqsDeviceUnit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqsDeviceUnit devUnitDetail(String devID) {
|
||||
PqsDeviceUnit byId = this.getById(devID);
|
||||
if (ObjectUtil.isNotNull(byId)) {
|
||||
return byId;
|
||||
}
|
||||
return new PqsDeviceUnit();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user