Compare commits
23 Commits
4ee100a72b
...
2025-12
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b0feb1320 | |||
| e92326c55d | |||
| 7abbfd500b | |||
| 77360ef468 | |||
| b38d3bad1b | |||
| 27aebf2ca4 | |||
| 9981b04ed6 | |||
| f8c9828369 | |||
| 0d652b9f4d | |||
| 3ea67da152 | |||
| c7dce89d36 | |||
| e7dbee2df5 | |||
| 29168bbd9f | |||
| 56d88939c4 | |||
| bc6f3dca80 | |||
| 2957188466 | |||
| 2894a4780b | |||
| 240ec304b0 | |||
| ae09cc1996 | |||
| efdb1781da | |||
|
|
46aef0d97f | ||
|
|
5539c8fed5 | ||
|
|
10d93c260c |
@@ -4,18 +4,14 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.Integrity;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.StaticInfo;
|
||||
import com.njcn.cloud.service.AdminStatistic.DataIntegrityService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -10,12 +10,14 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,7 +56,7 @@ public class StaticServiceImpl implements StaticService {
|
||||
//获取终端信息
|
||||
List<DevDetail> devDetails = generalDeviceInfoClient.getDevInfoByIds(new ArrayList<>()).getData();
|
||||
//获取终端在线率
|
||||
List<RStatOnlinerateVO> onlineRates = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
List<RStatOnlineRateVO> onlineRates = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
//异常终端数据
|
||||
long count = devDetails.stream().filter(x -> 0==x.getComFlag()).count();
|
||||
StaticInfo info=new StaticInfo();
|
||||
@@ -63,14 +65,14 @@ public class StaticServiceImpl implements StaticService {
|
||||
info.setOnlineRatez(data);
|
||||
info.setComError(count);
|
||||
List<StaticInfo.DevStatic> list=new ArrayList<>();
|
||||
Map<String, Float> onlineRateMap = onlineRates.stream().collect(Collectors.toMap(RStatOnlinerateVO::getDevIndex, RStatOnlinerateVO::getOnlineRate));
|
||||
Map<String, BigDecimal> onlineRateMap = onlineRates.stream().collect(Collectors.toMap(RStatOnlineRateVO::getDevIndex, RStatOnlineRateVO::getOnlineRate));
|
||||
StaticInfo.DevStatic devStatic;
|
||||
for (DevDetail devDetail : devDetails) {
|
||||
devStatic=new StaticInfo.DevStatic();
|
||||
devStatic.setDevIndex(devDetail.getDevIndex());
|
||||
devStatic.setDevName(devDetail.getDevName());
|
||||
devStatic.setIp(devDetail.getIp());
|
||||
devStatic.setOnlineRate(onlineRateMap.get(devDetail.getDevIndex()));
|
||||
devStatic.setOnlineRate(onlineRateMap.get(devDetail.getDevIndex()).setScale(3, RoundingMode.HALF_UP).floatValue());
|
||||
devStatic.setGdName(devDetail.getGdName());
|
||||
devStatic.setSubName(devDetail.getBdzName());
|
||||
devStatic.setTimeId(devDetail.getTimeID());
|
||||
@@ -80,4 +82,4 @@ public class StaticServiceImpl implements StaticService {
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,13 @@ import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
@@ -38,6 +40,10 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/findByNdid")
|
||||
HttpResult<List<CsLinePO>> findByNdid(@RequestParam("id") String id);
|
||||
|
||||
|
||||
@GetMapping("/getCustomDetailByLineId")
|
||||
HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/getPositionById")
|
||||
HttpResult<String> getPositionById(@RequestParam("id") String id);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
@@ -54,6 +55,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam("id") String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id查询监测点",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> getPositionById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","通过id查询监测点位置",cause.toString());
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
@@ -47,13 +48,8 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "通用台账查询")
|
||||
public class CsCommTerminalController extends BaseController {
|
||||
|
||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
private final CsCommTerminalService commTerminalService;
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
@@ -64,7 +60,7 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getDevIdsByUser");
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
List<String> devIds = commTerminalService.commGetDevIds(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -77,19 +73,8 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}
|
||||
List<String> lineIds = commTerminalService.getLineIdsByUser(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,37 +86,12 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiOperation("根据登录用户id获取电能质量用户id集合")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getPqUserIdsByUser");
|
||||
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}
|
||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||
List<String> lineIds = commTerminalService.getPqUserIdsByUser(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
private List<String> commGetDevIds(String userId){
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
||||
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
@@ -144,11 +104,7 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
|
||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
||||
|
||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||
if(Objects.isNull(pqsDeviceUnit)){
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
PqsDeviceUnit pqsDeviceUnit = commTerminalService.lineUnitDetail(lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,16 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/objTree")
|
||||
@ApiOperation("三层对象用户树")
|
||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增台账信息")
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -104,6 +105,17 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getCustomDetailByLineId")
|
||||
@ApiOperation("根据id查询监测点")
|
||||
public HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam String id){
|
||||
String methodDescribe = getMethodDescribe("getCustomDetailByLineId");
|
||||
Map<String,String> map = csLinePOService.getCustomDetailByLineId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateLine")
|
||||
@ApiOperation("修改监测点信息")
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -17,4 +18,7 @@ import java.util.List;
|
||||
public interface CsLinePOMapper extends BaseMapper<CsLinePO> {
|
||||
|
||||
List<CsLinePO> findByNdid(@Param("id") String id);
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(@Param("lineId")String lineId);
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
line_id, dev_id, `name`, `position`, vol_grade, pt_ratio, ct_ratio, `status`, create_by,
|
||||
line_id, dev_id, `name`, `position`, vol_grade, pt_ratio, ct_ratio, `status`, create_by,
|
||||
create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
@@ -33,4 +33,22 @@
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
<select id="getCustomDetailByLineId" resultType="map">
|
||||
SELECT
|
||||
line.line_id as lineId,
|
||||
line.name as lineName,
|
||||
concat(round(line.pt_ratio,0),concat(':',round(line.pt2_ratio,0))) as pt,
|
||||
concat(round(line.ct_ratio,0),concat(':',round(line.ct2_ratio,0))) as ct,
|
||||
line.dev_capacity as Dev_Capacity,
|
||||
line.short_circuit_capacity as Short_Capacity,
|
||||
line.basic_capacity as Standard_Capacity,
|
||||
line.protocol_capacity as Deal_Capacity,
|
||||
line.vol_grade AS voltageLevel
|
||||
FROM
|
||||
cs_line line
|
||||
WHERE
|
||||
line.line_id = #{lineId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CsCommTerminalService {
|
||||
|
||||
|
||||
List<String> getLineIdsByUser(String userId);
|
||||
|
||||
|
||||
|
||||
List<String> getPqUserIdsByUser(String userId);
|
||||
|
||||
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -39,6 +40,9 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
*/
|
||||
List<CsLinePO> findByNdid(String id);
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(String lineId);
|
||||
|
||||
/**
|
||||
* 更新监测点信息
|
||||
* @param csLineParam
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getLineTree();
|
||||
|
||||
/**
|
||||
* 终端三层树
|
||||
* 终端三层树
|
||||
* @return
|
||||
*/
|
||||
List<CsLedgerVO> getDeviceTree();
|
||||
@@ -77,6 +77,9 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
|
||||
|
||||
List<CsLedgerVO> objTree();
|
||||
|
||||
/**
|
||||
* 根据设备集合获取项目和工程
|
||||
* @param id
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-12-23
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
|
||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getLineIdsByUser(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList = csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPqUserIdsByUser(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqsDeviceUnit lineUnitDetail(String lineId) {
|
||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||
if(Objects.isNull(pqsDeviceUnit)){
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
return pqsDeviceUnit;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> commGetDevIds(String userId) {
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/9/27 10:29【需求编号】
|
||||
*
|
||||
@@ -50,12 +50,12 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
|
||||
public Double getDevCapacity(String id) {
|
||||
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||
|
||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
//String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
|
||||
Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||
List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||
//Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||
//List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||
/*治理侧监测点*/
|
||||
CsLinePO csLinePO = collect1.get(0);
|
||||
CsLinePO csLinePO = csLinePOS.get(0);
|
||||
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
||||
if(Objects.isNull(one)){
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -941,13 +942,16 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
CsLinePO finalCsLinePO = csLineFeignClient.getById(fittingDataQueryParam.getLineId()).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePO.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
// String position = finalCsLinePO.getPosition();
|
||||
Overlimit overlimit = overlimitMapper.selectById(finalCsLinePO.getLineId());
|
||||
JSONObject entries = JSONUtil.parseObj(overlimit);
|
||||
if (Objects.isNull(overlimit)) {
|
||||
throw new BusinessException("当前测点限值信息缺失,请联系管理员排查");
|
||||
}
|
||||
JSONObject entries = JSONUtil.parseObj(overlimit, new JSONConfig().setIgnoreNullValue(false));
|
||||
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
||||
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
||||
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
||||
|
||||
@@ -4,12 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.controller.project.EngineeringController;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
@@ -18,13 +19,18 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -57,8 +63,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final EngineeringController engineeringController;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
@@ -104,7 +112,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
}
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||
@@ -148,14 +156,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.peek(
|
||||
item -> {
|
||||
item.setType("line");
|
||||
String index = item.getId().substring(item.getId().length()-1);
|
||||
if (Objects.equals(index,"0")) {
|
||||
String index = item.getId().substring(item.getId().length() - 1);
|
||||
if (Objects.equals(index, "0")) {
|
||||
item.setLineType(0);
|
||||
} else {
|
||||
item.setLineType(1);
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
||||
queryWrapper.eq(CsLinePO::getLineId, item.getId()).eq(CsLinePO::getStatus, 1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
item.setConType(po.getConType());
|
||||
}
|
||||
@@ -201,16 +209,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
@@ -269,6 +277,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
@@ -328,7 +337,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||
@@ -404,16 +413,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
@@ -475,11 +484,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId, csLedgerParam.getPid()).one();
|
||||
CsLedger csLedger = new CsLedger();
|
||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||
BeanUtils.copyProperties(csLedgerParam, csLedger);
|
||||
csLedger.setState(1);
|
||||
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
||||
if (Objects.equals(csLedgerParam.getPid(), "9999999")) {
|
||||
csLedger.setPid("0");
|
||||
csLedger.setPids("0");
|
||||
} else {
|
||||
@@ -491,7 +500,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public void deleteLedgerTree(String id) {
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,id).one();
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, id).one();
|
||||
csLedger.setState(0);
|
||||
this.updateById(csLedger);
|
||||
}
|
||||
@@ -506,8 +515,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
@Override
|
||||
public String findDevByLineId(String lineId) {
|
||||
String deviceId = null;
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,lineId).eq(CsLedger::getState,1).one();
|
||||
if (!Objects.isNull(csLedger)){
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, lineId).eq(CsLedger::getState, 1).one();
|
||||
if (!Objects.isNull(csLedger)) {
|
||||
deviceId = csLedger.getPid();
|
||||
}
|
||||
return deviceId;
|
||||
@@ -515,7 +524,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedger findDataById(String id) {
|
||||
return this.lambdaQuery().eq(CsLedger::getId,id).eq(CsLedger::getState,1).one();
|
||||
return this.lambdaQuery().eq(CsLedger::getId, id).eq(CsLedger::getState, 1).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -523,12 +532,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status","1");
|
||||
queryWrapper.eq("status", "1");
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOS = appTopologyDiagramMapper.selectList(queryWrapper);
|
||||
projectList.forEach(temp->{
|
||||
projectList.forEach(temp -> {
|
||||
AppProjectPO appProjectPO = appProjectMapper.selectById(temp.getId());
|
||||
temp.setArea(appProjectPO.getArea());
|
||||
temp.setRemark(appProjectPO.getDescription());
|
||||
@@ -544,13 +553,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
temp.setChildren(collect);
|
||||
});
|
||||
engineeringList.forEach(eng -> {
|
||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
||||
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||
eng.setCityId(csEngineeringPO.getCity());
|
||||
eng.setRemark(csEngineeringPO.getDescription());
|
||||
eng.setChildren(getChildren(eng, projectList));
|
||||
}
|
||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince()) + this.getAreaById(csEngineeringPO.getCity()));
|
||||
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||
eng.setCityId(csEngineeringPO.getCity());
|
||||
eng.setRemark(csEngineeringPO.getDescription());
|
||||
eng.setChildren(getChildren(eng, projectList));
|
||||
}
|
||||
);
|
||||
|
||||
return engineeringList;
|
||||
@@ -566,14 +575,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
CsLedger dev = this.findDataById(devId);
|
||||
//如果是便携式设备,pid为0,项目,工程都设置为/
|
||||
if(Objects.equals(dev.getPid(),"0")){
|
||||
if (Objects.equals(dev.getPid(), "0")) {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
device.setEngineeringName("/");
|
||||
}else {
|
||||
} else {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
@@ -595,12 +604,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0")).
|
||||
peek(
|
||||
temp->{
|
||||
temp -> {
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(po.getRunStatus());
|
||||
temp.setNDId(po.getNdid());
|
||||
@@ -626,9 +635,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
project.setPid("0");
|
||||
project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0")).collect(Collectors.toList());
|
||||
checkDevSetData(portables);
|
||||
for(CsLedgerVO c : portables){
|
||||
for (CsLedgerVO c : portables) {
|
||||
c.setPid(project.getId());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
@@ -643,9 +652,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setChildren(wxProjectList);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(0);
|
||||
government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||
@@ -659,29 +665,109 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
String userId = "fa37b93cc90d4c1784ca8f6debddee1a";
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
if (CollUtil.isEmpty(poList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
|
||||
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
|
||||
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
|
||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
projectList.forEach(pro->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(pro.getId());
|
||||
csLedgerVO.setPid(pro.getPid());
|
||||
csLedgerVO.setLevel(pro.getLevel());
|
||||
csLedgerVO.setName(pro.getName());
|
||||
|
||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
if(lineMap.containsKey(pro.getId())){
|
||||
List<String> ids = lineMap.get(pro.getId());
|
||||
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objTemIds)){
|
||||
objTemIds.forEach(it->{
|
||||
CsLedgerVO inner = new CsLedgerVO();
|
||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
inner.setId(it);
|
||||
inner.setLevel(2);
|
||||
temObjList.add(inner);
|
||||
});
|
||||
}
|
||||
}
|
||||
csLedgerVO.setChildren(temObjList);
|
||||
realProjectList.add(csLedgerVO);
|
||||
});
|
||||
|
||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
|
||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
gcList.forEach(gc->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(gc.getId());
|
||||
csLedgerVO.setPid(gc.getPid());
|
||||
csLedgerVO.setLevel(gc.getLevel());
|
||||
csLedgerVO.setName(gc.getName());
|
||||
|
||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
csLedgerVO.setChildren(proList);
|
||||
realGcList.add(csLedgerVO);
|
||||
});
|
||||
return realGcList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
Set<String> idSet = new HashSet<>(id);
|
||||
if (CollectionUtil.isNotEmpty(id)) {
|
||||
id.forEach(item->{
|
||||
allList.forEach(item2->{
|
||||
if (Objects.equals(item2.getId(),item)) {
|
||||
idSet.addAll(Arrays.asList(item2.getPids().split( ",")));
|
||||
id.forEach(item -> {
|
||||
allList.forEach(item2 -> {
|
||||
if (Objects.equals(item2.getId(), item)) {
|
||||
idSet.addAll(Arrays.asList(item2.getPids().split(",")));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(idSet)) {
|
||||
idSet.forEach(item->{
|
||||
allList.forEach(item2->{
|
||||
if (Objects.equals(item2.getId(),item)) {
|
||||
idSet.forEach(item -> {
|
||||
allList.forEach(item2 -> {
|
||||
if (Objects.equals(item2.getId(), item)) {
|
||||
result.add(item2);
|
||||
}
|
||||
});
|
||||
@@ -718,7 +804,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
|
||||
//list1是 cld设备
|
||||
devs.forEach(item->{
|
||||
devs.forEach(item -> {
|
||||
if (item.getDevType().equals(vo1.getId())) {
|
||||
list1.add(item.getId());
|
||||
}
|
||||
@@ -759,19 +845,19 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
||||
List<CsLedgerVO> finalLineTree = lineTree;
|
||||
deviceTree.forEach(item->{
|
||||
deviceTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalLineTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(projectTree)) {
|
||||
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
||||
projectTree.forEach(item->{
|
||||
projectTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalDeviceTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
||||
List<CsLedgerVO> finalProjectTree = projectTree;
|
||||
engineerTree.forEach(item->{
|
||||
engineerTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalProjectTree));
|
||||
});
|
||||
}
|
||||
@@ -791,9 +877,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
List<CsLedger> ledgers = this.listByIds(list);
|
||||
Set<String> enginingeringIds = new HashSet<>();
|
||||
ledgers.forEach(item->{
|
||||
ledgers.forEach(item -> {
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
if(Objects.equals(item.getPid(),"0")){
|
||||
if (Objects.equals(item.getPid(), "0")) {
|
||||
device.setEquipmentName(item.getName());
|
||||
device.setEquipmentId(item.getId());
|
||||
device.setProjectId("/");
|
||||
@@ -807,7 +893,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
||||
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
||||
engineer.forEach(item->{
|
||||
engineer.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEngineeringid(item.getId());
|
||||
detail.setEngineeringName(item.getName());
|
||||
@@ -828,7 +914,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
dev.forEach(item->{
|
||||
dev.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
@@ -840,7 +926,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
@Override
|
||||
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
list.forEach(item -> {
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLedger::getPid, item);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
@@ -873,12 +959,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return children;
|
||||
}
|
||||
|
||||
public String getAreaById(String id){
|
||||
String areaName =redisUtil.getStringByKey (id);
|
||||
areaName = Optional.ofNullable (areaName).orElseGet (() ->{
|
||||
Area data = areaFeignClient.selectIdArea (id).getData ( );
|
||||
redisUtil.saveByKey (id,data.getName ());
|
||||
return data.getName ();
|
||||
public String getAreaById(String id) {
|
||||
String areaName = redisUtil.getStringByKey(id);
|
||||
areaName = Optional.ofNullable(areaName).orElseGet(() -> {
|
||||
Area data = areaFeignClient.selectIdArea(id).getData();
|
||||
redisUtil.saveByKey(id, data.getName());
|
||||
return data.getName();
|
||||
});
|
||||
return areaName;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
@@ -34,7 +35,6 @@ import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.pojo.vo.LineDataVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -44,7 +44,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -103,6 +106,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
return this.baseMapper.findByNdid(id);
|
||||
}
|
||||
|
||||
public Map<String,String> getCustomDetailByLineId(String lineId){
|
||||
return this.baseMapper.getCustomDetailByLineId(lineId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLine(CsLineParam csLineParam) {
|
||||
LambdaUpdateWrapper<CsLinePO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
@@ -393,9 +400,15 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
return new LineDetailDataVO();
|
||||
} else {
|
||||
CsLinePO csLinePO = this.baseMapper.selectOne(new LambdaQueryWrapper<CsLinePO>().eq(CsLinePO::getLineId,id));
|
||||
|
||||
CsLedger csLedger = csLedgerMapper.selectById(csLinePO.getLineId());
|
||||
|
||||
LineDetailDataVO lineDetailDataVO = new LineDetailDataVO();
|
||||
|
||||
//lineDetailDataVO.setScale(dicDataFeignClient.getDicDataById(voltageMapper.selectById(voId).getScale()).getData().getName());
|
||||
lineDetailDataVO.setScale(csLinePO.getVolGrade()+"kV");
|
||||
lineDetailDataVO.setAreaName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.ENGINEERING_LEVEL.getCode()+1]).getName());
|
||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||
|
||||
//Device device = deviceMapper.selectById(devId);
|
||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||
@@ -407,8 +420,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||
//lineDetailDataVO.setPt(lineDetail.getPt1() + "/" + lineDetail.getPt2());
|
||||
//lineDetailDataVO.setCt(lineDetail.getCt1() + "/" + lineDetail.getCt2());
|
||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + csLinePO.getPt2Ratio());
|
||||
lineDetailDataVO.setCt(csLinePO.getCtRatio() + "/" + csLinePO.getCt2Ratio());
|
||||
lineDetailDataVO.setDealCapacity(csLinePO.getProtocolCapacity().floatValue());
|
||||
lineDetailDataVO.setDevCapacity(csLinePO.getDevCapacity().floatValue());
|
||||
lineDetailDataVO.setShortCapacity(csLinePO.getShortCircuitCapacity().floatValue());
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
@@ -94,7 +94,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode()) ){
|
||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
@@ -198,7 +198,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode())){
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
|
||||
@@ -28,6 +28,11 @@ public class CsConfigurationParm {
|
||||
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 数据范围 0 私有 1全局
|
||||
*/
|
||||
private int scope;
|
||||
|
||||
private List<String> projectIds;
|
||||
|
||||
|
||||
@@ -55,6 +60,10 @@ public class CsConfigurationParm {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CsConfigurationQueryParam extends BaseParam {
|
||||
private String id;
|
||||
@ApiModelProperty(value = "当前用户ID")
|
||||
private String currentUserId;
|
||||
@ApiModelProperty(value = "当前用户角色")
|
||||
private String roleCode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@ public class SensitiveUserReportQueryParam {
|
||||
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||
private String tempId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@ApiModelProperty(name = "startTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@ApiModelProperty(name = "endTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csharmonic.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/09/18 下午 2:00【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RealTimeDataDTO {
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer type =1;
|
||||
// private List<RealTimeDataVo> realTimeDataVoList;
|
||||
}
|
||||
@@ -39,8 +39,11 @@ public class ZuTaiDTO {
|
||||
@SerializedName("lineId")
|
||||
private String lineId;
|
||||
|
||||
@SerializedName("UIDType")
|
||||
private Boolean uIdType;
|
||||
|
||||
@SerializedName("UID")
|
||||
private List<String> uId;
|
||||
private List<Object> uId;
|
||||
|
||||
@SerializedName("UIDName")
|
||||
private String target;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.csharmonic.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/6/14 20:07
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ZuTaiNewDTO {
|
||||
|
||||
private List<DiagramElement> json;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class DiagramElement{
|
||||
|
||||
private String id;
|
||||
private String title;
|
||||
private String keyId;
|
||||
private String type;
|
||||
private boolean resize;
|
||||
private boolean rotate;
|
||||
private boolean lock;
|
||||
private boolean active;
|
||||
private boolean hide;
|
||||
private String tag;
|
||||
private boolean use_proportional_scaling;
|
||||
private String lineId;
|
||||
private List<String> lineList;
|
||||
private String lineName;
|
||||
@JsonProperty("UID")
|
||||
private List<Object> uid;
|
||||
@JsonProperty("UIDNames")
|
||||
|
||||
private List<String> uidNames;
|
||||
private List<String> unit;
|
||||
|
||||
private Boolean uidType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@@ -31,6 +31,12 @@ public class CsConfigurationPO extends BaseEntity {
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据范围 0 私有 1全局
|
||||
*/
|
||||
@TableField(value = "scope")
|
||||
private int scope;
|
||||
|
||||
@TableField(value = "image_path")
|
||||
private String imagePath;
|
||||
|
||||
@@ -50,7 +56,6 @@ public class CsConfigurationPO extends BaseEntity {
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_NAME = "name";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CsPageUser implements Serializable {
|
||||
|
||||
/**
|
||||
* 组态界面ID
|
||||
*/
|
||||
private String pageId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
@@ -7,6 +8,8 @@ import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
@@ -25,6 +28,7 @@ public class PqSensitiveUser extends BaseEntity implements Serializable{
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,8 @@ public class CsConfigurationVO extends BaseEntity {
|
||||
|
||||
private Integer orderBy;
|
||||
|
||||
private Integer scope;
|
||||
|
||||
|
||||
private List<String> projectIds;
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ public class CsRtDataVO {
|
||||
@ApiModelProperty("指标显示名称")
|
||||
private String statisticalName;
|
||||
|
||||
@ApiModelProperty("指标单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String target;
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 组态下事件描述实体
|
||||
*/
|
||||
@Data
|
||||
public class CsWarnDescVO implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
|
||||
/**
|
||||
* 名称,比如监测点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 发生时间
|
||||
*/
|
||||
private String timeId;
|
||||
|
||||
|
||||
/**
|
||||
* 事件描述eventDesc
|
||||
*/
|
||||
private String eventDesc;
|
||||
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Double persistTime;
|
||||
|
||||
/**
|
||||
* 暂降幅值
|
||||
*/
|
||||
private Double amplitude;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -135,11 +135,27 @@
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>csHarmonicBoot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* (cs_configuration)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
* (cs_configuration)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csconfiguration")
|
||||
@@ -38,10 +38,10 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增组态项目")
|
||||
@ApiImplicitParam(name = "csConfigurationParm", value = "新增组态项目参数", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CsConfigurationParm csConfigurationParm){
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CsConfigurationParm csConfigurationParm) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
|
||||
boolean save = csConfigurationService.add (csConfigurationParm);
|
||||
boolean save = csConfigurationService.add(csConfigurationParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -49,23 +49,22 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/audit")
|
||||
@ApiOperation("修改组态项目")
|
||||
@ApiImplicitParam(name = "auditParm", value = "修改组态项目参数", required = true)
|
||||
public HttpResult<Boolean> audit(@RequestBody @Validated CsConfigurationParm.CsConfigurationAuditParam auditParm){
|
||||
public HttpResult<Boolean> audit(@RequestBody @Validated CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||
String methodDescribe = getMethodDescribe("audit");
|
||||
|
||||
boolean save = csConfigurationService.audit (auditParm);
|
||||
boolean save = csConfigurationService.audit(auditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryPage")
|
||||
@ApiOperation("组态项目分页查询")
|
||||
@ApiImplicitParam(name = "csConfigurationQueryParam", value = "组态项目查询参数", required = true)
|
||||
public HttpResult<IPage<CsConfigurationVO>> queryPage(@RequestBody @Validated CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam ){
|
||||
public HttpResult<IPage<CsConfigurationVO>> queryPage(@RequestBody @Validated CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
|
||||
IPage<CsConfigurationVO> page = csConfigurationService.queryPage (csConfigurationQueryParam);
|
||||
IPage<CsConfigurationVO> page = csConfigurationService.queryPage(csConfigurationQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -73,10 +72,10 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/uploadImage")
|
||||
@ApiOperation("上传底图")
|
||||
@ApiImplicitParam(name = "file", value = "底图文件", required = true)
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage(@RequestParam("file") MultipartFile issuesFile){
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage(@RequestParam("file") MultipartFile issuesFile) {
|
||||
String methodDescribe = getMethodDescribe("uploadImage");
|
||||
String filePath = csConfigurationService.uploadImage(issuesFile);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,new MinIoUploadResDTO(issuesFile.getOriginalFilename(),filePath), methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new MinIoUploadResDTO(issuesFile.getOriginalFilename(), filePath), methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ 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.param.CsPageParm;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
import com.njcn.csharmonic.pojo.vo.CsPageVO;
|
||||
import com.njcn.csharmonic.service.CsPagePOService;
|
||||
import com.njcn.csharmonic.service.CsPageUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -21,48 +23,68 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* (cs_page)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
* (cs_page)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cspage")
|
||||
@Api(tags = "组态项目页面")
|
||||
@AllArgsConstructor
|
||||
public class CsPagePOController extends BaseController {
|
||||
public class CsPagePOController extends BaseController {
|
||||
private final CsPagePOService csPagePOService;
|
||||
|
||||
private final CsPageUserService csPageUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增组态页面")
|
||||
// @ApiImplicitParam(name = "csPageParm", value = "新增组态项目参数", required = true)
|
||||
public HttpResult<Boolean> add( @Validated CsPageParm csPageParm){
|
||||
public HttpResult<Boolean> add(@Validated CsPageParm csPageParm) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
|
||||
boolean flag = csPagePOService.add (csPageParm);
|
||||
boolean flag = csPagePOService.add(csPageParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/audit")
|
||||
@ApiOperation("修改组态页面")
|
||||
public HttpResult<Boolean> audit( @Validated CsPageParm.CsPageParmAuditParam auditParm){
|
||||
public HttpResult<Boolean> audit(@Validated CsPageParm.CsPageParmAuditParam auditParm) {
|
||||
String methodDescribe = getMethodDescribe("audit");
|
||||
|
||||
boolean save = csPagePOService.audit (auditParm);
|
||||
boolean save = csPagePOService.audit(auditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryPage")
|
||||
@ApiOperation("组态页面分页查询")
|
||||
@ApiImplicitParam(name = "csPageParam", value = "组态项目查询参数", required = true)
|
||||
public HttpResult<IPage<CsPageVO>> queryPage(@RequestBody @Validated CsPageParm.CsPageParmQueryParam csPageParam ){
|
||||
public HttpResult<IPage<CsPageVO>> queryPage(@RequestBody @Validated CsPageParm.CsPageParmQueryParam csPageParam) {
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
|
||||
IPage<CsPageVO> page = csPagePOService.queryPage (csPageParam);
|
||||
IPage<CsPageVO> page = csPagePOService.queryPage(csPageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/savePageIdWithUser")
|
||||
@ApiOperation("保存组态界面与用户的关系")
|
||||
public HttpResult<Boolean> savePageIdWithUser(CsPageUser csPageUser) {
|
||||
String methodDescribe = getMethodDescribe("savePageIdWithUser");
|
||||
boolean flag = csPageUserService.savePageIdWithUser(csPageUser);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getByUserId")
|
||||
@ApiOperation("根据用户id获取组件信息")
|
||||
public HttpResult<CsPageUser> getByUserId(String userId) {
|
||||
String methodDescribe = getMethodDescribe("getByUserId");
|
||||
CsPageUser csPageUser = csPageUserService.getByUserId(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csPageUser, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CustomReportController extends BaseController {
|
||||
@GetMapping("/getTemplateByDept")
|
||||
@ApiOperation("根据部门查询模板")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam("id") String id){
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam(value = "id",required = false) String id){
|
||||
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||
List<ReportTemplateVO> list = customReportService.getTemplateByDept(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
|
||||
@@ -13,10 +13,7 @@ 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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csharmonic.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
@@ -16,8 +17,11 @@ import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.pojo.dto.RealTimeDataDTO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.ILineTargetService;
|
||||
import com.njcn.csharmonic.service.StableDataService;
|
||||
import com.njcn.csharmonic.service.TemperatureService;
|
||||
@@ -34,12 +38,10 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -64,7 +66,7 @@ public class MqttMessageHandler {
|
||||
private final TemperatureService temperatureService;
|
||||
|
||||
private final DevCapacityFeignClient devCapacityFeignClient;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
private final ChannelObjectUtil channelObjectUtil;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
private final CsTopicFeignClient csTopicFeignClient;
|
||||
@@ -72,26 +74,61 @@ public class MqttMessageHandler {
|
||||
private static Integer mid = 1;
|
||||
private final FileFeignClient fileFeignClient;
|
||||
|
||||
CsEventPOService csEventPOService;
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askRtData/{pageId}",qos = 1)
|
||||
@MqttSubscribe(value = "/zl/askRtData/{pageId}", qos = 1)
|
||||
public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<CsRtDataVO> list = lineTargetService.getLineData(pageId);
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/rtData/"+pageId,gson.toJson(list),1,false);
|
||||
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
|
||||
}
|
||||
|
||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}",qos = 1)
|
||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1)
|
||||
public void responseTemperData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
List<StatisticalDataDTO> statisticalDataDTOS = temperatureService.queryTemperature(devId);
|
||||
statisticalDataDTOS.stream().forEach(temp->{
|
||||
statisticalDataDTOS.stream().forEach(temp -> {
|
||||
temp.setClDid(getCldidName(temp.getClDid()));
|
||||
});
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/TemperData/"+devId,gson.toJson(statisticalDataDTOS),1,false);
|
||||
publisher.send("/zl/TemperData/" + devId, gson.toJson(statisticalDataDTOS), 1, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 物联平台的组态实时数据调试
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askCSConfigRtData/{pageId}", qos = 1)
|
||||
public void responseCSConfigRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<String> lineIdList = Arrays.stream(payload.substring(1, payload.length() - 1).split(","))
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toList());
|
||||
List<CsRtDataVO> lineData = lineTargetService.getLineDataNew(pageId);
|
||||
List<CsRtDataVO> collect = lineData.stream().filter(temp -> (!CollectionUtils.isEmpty(lineIdList)) && lineIdList.contains(temp.getLineId())).collect(Collectors.toList());
|
||||
RealTimeDataDTO recallReplyDTO = new RealTimeDataDTO();
|
||||
recallReplyDTO.setCode(200);
|
||||
recallReplyDTO.setMessage(JSONObject.toJSONString(collect));
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/csConfigRtData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
||||
}
|
||||
|
||||
@MqttSubscribe(value = "/zl/askCSConfigWarnData/{pageId}", qos = 1)
|
||||
public void responseCSConfigWarnData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<String> lineIdList = Arrays.stream(payload.substring(1, payload.length() - 1).split(","))
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toList());
|
||||
// 目前暂且查最近的60条记录
|
||||
List<CsWarnDescVO> csWarnDescVOList = csEventPOService.getEventDesc(lineIdList);
|
||||
RealTimeDataDTO recallReplyDTO = new RealTimeDataDTO();
|
||||
recallReplyDTO.setCode(200);
|
||||
recallReplyDTO.setMessage(JSONObject.toJSONString(csWarnDescVOList));
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/TemperData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@@ -195,20 +232,21 @@ public class MqttMessageHandler {
|
||||
// }
|
||||
// publisher.send("/zl/devData/"+devId,topoDataJson,1,false);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}/{typeId}",qos = 1)
|
||||
public void responseTopoDataByType(String topic, @NamedValue("devId") String devId,@NamedValue("typeId") String typeId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson =redisUtil.getStringByKey (devId+"#"+typeId);
|
||||
if(StringUtils.isEmpty(topoDataJson)){
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}/{typeId}", qos = 1)
|
||||
public void responseTopoDataByType(String topic, @NamedValue("devId") String devId, @NamedValue("typeId") String typeId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson = redisUtil.getStringByKey(devId + "#" + typeId);
|
||||
if (StringUtils.isEmpty(topoDataJson)) {
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
List<ThdDataVO> tempList = new ArrayList<>();
|
||||
|
||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(typeId).getData();
|
||||
data.forEach(temp->{
|
||||
if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
data.forEach(temp -> {
|
||||
if (Objects.nonNull(temp.getHarmStart()) && Objects.nonNull(temp.getHarmEnd())) {
|
||||
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
frequencyStatisticalQueryParam.setDevId(devId);
|
||||
frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
@@ -218,12 +256,12 @@ public class MqttMessageHandler {
|
||||
List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
|
||||
tempList.addAll(thdDataVOList);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
List<ThdDataVO> listFuture= stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
tempList.addAll(listFuture);
|
||||
}
|
||||
|
||||
@@ -231,23 +269,23 @@ public class MqttMessageHandler {
|
||||
|
||||
//过滤M相
|
||||
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
m.stream().forEach(temp->{
|
||||
Stream.of("A","B","C").forEach(phase->{
|
||||
m.stream().forEach(temp -> {
|
||||
Stream.of("A", "B", "C").forEach(phase -> {
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(temp,thdDataVO);
|
||||
BeanUtils.copyProperties(temp, thdDataVO);
|
||||
thdDataVO.setPhase(phase);
|
||||
result.add(thdDataVO);
|
||||
});
|
||||
});
|
||||
//如果是基础数据则添加拓扑图的数据
|
||||
if(Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415",typeId)){
|
||||
if (Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415", typeId)) {
|
||||
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect3.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect3.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -255,11 +293,11 @@ public class MqttMessageHandler {
|
||||
});
|
||||
List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect2.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect2.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -267,11 +305,11 @@ public class MqttMessageHandler {
|
||||
});
|
||||
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect4.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect4.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -279,16 +317,16 @@ public class MqttMessageHandler {
|
||||
}
|
||||
});
|
||||
Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
||||
apfRmsI.forEach(temp->{
|
||||
apfRmsI.forEach(temp -> {
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(temp,thdDataVO);
|
||||
BeanUtils.copyProperties(temp, thdDataVO);
|
||||
thdDataVO.setUnit("%");
|
||||
thdDataVO.setStatisticalName("load_Rate");
|
||||
thdDataVO.setAnotherName("负载率");
|
||||
if (capacity<=0){
|
||||
if (capacity <= 0) {
|
||||
thdDataVO.setStatisticalData(3.1415926);
|
||||
}else {
|
||||
double v = temp.getStatisticalData()*100 / capacity;
|
||||
} else {
|
||||
double v = temp.getStatisticalData() * 100 / capacity;
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));
|
||||
}
|
||||
result.add(thdDataVO);
|
||||
@@ -299,14 +337,13 @@ public class MqttMessageHandler {
|
||||
result.addAll(notM);
|
||||
Gson gson = new Gson();
|
||||
topoDataJson = gson.toJson(result);
|
||||
redisUtil.saveByKeyWithExpire(devId+"#"+typeId, (Object) topoDataJson, 30L);
|
||||
redisUtil.saveByKeyWithExpire(devId + "#" + typeId, (Object) topoDataJson, 30L);
|
||||
}
|
||||
publisher.send("/zl/devData/"+devId+"/"+typeId,topoDataJson,1,false);
|
||||
publisher.send("/zl/devData/" + devId + "/" + typeId, topoDataJson, 1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCldidName( String cldid) {
|
||||
public String getCldidName(String cldid) {
|
||||
|
||||
switch (cldid) {
|
||||
case "0":
|
||||
@@ -361,7 +398,7 @@ public class MqttMessageHandler {
|
||||
/**
|
||||
* 处理补召数据
|
||||
*/
|
||||
@MqttSubscribe(value = "/makeUpData/{nDid}/{lineId}",qos = 1)
|
||||
@MqttSubscribe(value = "/makeUpData/{nDid}/{lineId}", qos = 1)
|
||||
public void responseRtData(String topic, @NamedValue("nDid") String nDid, @NamedValue("lineId") String lineId, MqttMessage message, @Payload String payload) {
|
||||
//下载文件
|
||||
fileFeignClient.downloadMakeUpFile(nDid);
|
||||
|
||||
@@ -16,5 +16,5 @@ import java.util.List;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsConfigurationMapper extends BaseMapper<CsConfigurationPO> {
|
||||
Page<CsConfigurationPO> queryPage(Page<CsConfigurationPO> temppage, @Param("temp") CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam, @Param("list") List<String> list);
|
||||
Page<CsConfigurationPO> queryPage(Page<CsConfigurationPO> temppage, @Param("temp") CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam, @Param("list") List<String> list, @Param("userId") String userId);
|
||||
}
|
||||
@@ -2,6 +2,10 @@ package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,4 +16,5 @@ import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsEventPOMapper extends BaseMapper<CsEventPO> {
|
||||
List<CsWarnDescVO> getEventDesc(@Param("lineIdList")List<String> lineIdList, @Param("count")int count);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据集表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
public interface CsPageUserMapper extends BaseMapper<CsPageUser> {
|
||||
|
||||
}
|
||||
@@ -7,14 +7,15 @@
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="scope" jdbcType="INTEGER" property="scope" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, `status`, create_by, create_time, update_by, update_time
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, `status`, `scope`,create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
<select id="queryPage" resultMap="BaseResultMap">
|
||||
@@ -24,6 +25,14 @@
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<choose>
|
||||
<when test="userId != null and userId != ''">
|
||||
AND (a.scope = 1 OR (a.scope = 0 AND a.create_by = #{userId}))
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (a.scope = 1 OR a.scope = 0)
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||
AND a.name like concat(concat("%",#{temp.searchValue}),"%")
|
||||
</if>
|
||||
|
||||
@@ -15,4 +15,26 @@
|
||||
<!--@mbg.generated-->
|
||||
id, line_id, device_id, start_time, tag, wave_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getEventDesc" resultType="com.njcn.csharmonic.pojo.vo.CsWarnDescVO">
|
||||
SELECT
|
||||
t1.line_id id,
|
||||
t2.NAME,
|
||||
t1.start_time timeId,
|
||||
t1.amplitude,
|
||||
t1.persist_time
|
||||
FROM
|
||||
cs_event t1,
|
||||
cs_line t2
|
||||
WHERE
|
||||
t1.line_id = t2.line_id
|
||||
and t1.line_id in
|
||||
<foreach collection="lineIdList" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
and t1.type = 0
|
||||
LIMIT 60
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.csharmonic.mapper.CsPageUserMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -37,6 +37,7 @@
|
||||
sys_excel_rpt_temp a
|
||||
WHERE
|
||||
a.state = 1
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getReportTemplateByDept" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
@@ -69,4 +70,5 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
||||
|
||||
List<EventStatisticsVo> getEventStatistics(CsEventUserQueryParam param);
|
||||
|
||||
List<CsWarnDescVO> getEventDesc(List<String> lineIdList);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
|
||||
public interface CsPageUserService extends IService<CsPageUser> {
|
||||
boolean savePageIdWithUser(CsPageUser csPageUser);
|
||||
|
||||
CsPageUser getByUserId(String userId);
|
||||
}
|
||||
@@ -23,4 +23,9 @@ public interface ILineTargetService {
|
||||
*/
|
||||
List<CsRtDataVO> getLineData(String id);
|
||||
|
||||
/**
|
||||
* 获取绑定指标的数据
|
||||
* @param id
|
||||
*/
|
||||
List<CsRtDataVO> getLineDataNew(String id);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/5/31 10:53【需求编号】
|
||||
*
|
||||
@@ -42,7 +42,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMapper, CsConfigurationPO> implements CsConfigurationService{
|
||||
public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMapper, CsConfigurationPO> implements CsConfigurationService {
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
@@ -53,17 +53,16 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
public boolean add(CsConfigurationParm csConfigurationParm) {
|
||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||
|
||||
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
||||
BeanUtils.copyProperties(csConfigurationParm, csConfigurationPO);
|
||||
|
||||
List<String> projectIds = csConfigurationParm.getProjectIds();
|
||||
if(CollectionUtils.isEmpty(projectIds)){
|
||||
throw new BusinessException("请选择项目");
|
||||
String projects = "";
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
projects = String.join(",", projectIds);
|
||||
}
|
||||
String projects = String.join(",", projectIds);
|
||||
|
||||
csConfigurationPO.setProjectIds(projects);
|
||||
//排序不填给个100往后排
|
||||
csConfigurationPO.setOrderBy(Objects.isNull(csConfigurationParm.getOrderBy())?100:csConfigurationParm.getOrderBy());
|
||||
csConfigurationPO.setOrderBy(Objects.isNull(csConfigurationParm.getOrderBy()) ? 100 : csConfigurationParm.getOrderBy());
|
||||
csConfigurationPO.setImagePath(csConfigurationParm.getFileContent());
|
||||
|
||||
csConfigurationPO.setStatus("1");
|
||||
@@ -71,7 +70,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
|
||||
String name = csConfigurationPO.getName();
|
||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
||||
if(count>1){
|
||||
if (count > 1) {
|
||||
throw new BusinessException("存在相同的组态项目名称在其他工程项目中,无法新建");
|
||||
}
|
||||
return save;
|
||||
@@ -80,30 +79,30 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
@Override
|
||||
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||
if(Objects.equals(auditParm.getStatus(),"0")){
|
||||
if (Objects.equals(auditParm.getStatus(), "0")) {
|
||||
csConfigurationPO.setId(auditParm.getId());
|
||||
csConfigurationPO.setStatus("0");
|
||||
boolean b = this.updateById(csConfigurationPO);
|
||||
return b;
|
||||
}
|
||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, auditParm.getName()).ne(CsConfigurationPO::getId,auditParm.getId()).eq(CsConfigurationPO::getStatus, "1").count();
|
||||
if(count>0){
|
||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, auditParm.getName()).ne(CsConfigurationPO::getId, auditParm.getId()).eq(CsConfigurationPO::getStatus, "1").count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException("修改名称失败,存在相同的组态项目");
|
||||
}
|
||||
BeanUtils.copyProperties(auditParm,csConfigurationPO);
|
||||
BeanUtils.copyProperties(auditParm, csConfigurationPO);
|
||||
|
||||
List<String> projectIds = auditParm.getProjectIds();
|
||||
if(!CollectionUtils.isEmpty(projectIds)){
|
||||
if (!CollectionUtils.isEmpty(projectIds)) {
|
||||
String projects = String.join(",", projectIds);
|
||||
csConfigurationPO.setProjectIds(projects);
|
||||
|
||||
}
|
||||
if(!Objects.isNull(auditParm.getOrderBy())){
|
||||
csConfigurationPO.setOrderBy(auditParm.getOrderBy()==0?100:auditParm.getOrderBy());
|
||||
if (!Objects.isNull(auditParm.getOrderBy())) {
|
||||
csConfigurationPO.setOrderBy(auditParm.getOrderBy() == 0 ? 100 : auditParm.getOrderBy());
|
||||
|
||||
}
|
||||
|
||||
if(!Objects.isNull(auditParm.getFileContent())){
|
||||
if (!Objects.isNull(auditParm.getFileContent())) {
|
||||
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(auditParm.getFileContent()), HarmonicConstant.CONFIGURATIONPATH, HarmonicConstant.CONFIGURATIONNAME);
|
||||
csConfigurationPO.setImagePath(s);
|
||||
}
|
||||
@@ -115,16 +114,21 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
|
||||
@Override
|
||||
public IPage<CsConfigurationVO> queryPage(CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
||||
Page<CsConfigurationVO> returnpage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||
Page<CsConfigurationPO> temppage = new Page<> (csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize ( ));
|
||||
Page<CsConfigurationVO> returnpage = new Page<>(csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize());
|
||||
Page<CsConfigurationPO> temppage = new Page<>(csConfigurationQueryParam.getPageNum(), csConfigurationQueryParam.getPageSize());
|
||||
|
||||
List<String> data1 = roleEngineerDevFeignClient.getRoleProject().getData();
|
||||
if(CollectionUtils.isEmpty(data1)){
|
||||
return returnpage;
|
||||
}
|
||||
// if (CollectionUtils.isEmpty(data1)) {
|
||||
// return returnpage;
|
||||
// }
|
||||
//+无线项目id
|
||||
data1.add(DataParam.WIRELESS_PROJECT_ID);
|
||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage,csConfigurationQueryParam,data1);
|
||||
String userId = csConfigurationQueryParam.getCurrentUserId();
|
||||
String roleCode = csConfigurationQueryParam.getRoleCode();
|
||||
if (roleCode.contains("operation_manager")) {
|
||||
userId = null;
|
||||
}
|
||||
Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().queryPage(temppage, csConfigurationQueryParam, data1, userId);
|
||||
// QueryWrapper<CsConfigurationPO> query = new QueryWrapper<>();
|
||||
// query.like(StringUtils.isNotBlank(csConfigurationQueryParam.getSearchValue()),CsConfigurationPO.COL_NAME,csConfigurationQueryParam.getSearchValue()).
|
||||
// le (StringUtils.isNotBlank (csConfigurationQueryParam.getSearchEndTime()), CsConfigurationPO.COL_CREATE_TIME, csConfigurationQueryParam.getSearchEndTime ( )).
|
||||
@@ -133,7 +137,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
// Page<CsConfigurationPO> csConfigurationPOPage = this.getBaseMapper().selectPage(temppage, query);
|
||||
List<String> collect1 = csConfigurationPOPage.getRecords().stream().map(CsConfigurationPO::getCreateBy).collect(Collectors.toList());
|
||||
Map<String, String> collect2;
|
||||
if(!CollectionUtils.isEmpty(collect1)){
|
||||
if (!CollectionUtils.isEmpty(collect1)) {
|
||||
List<User> data = userFeignClient.appuserByIdList(collect1).getData();
|
||||
collect2 = data.stream().collect(Collectors.toMap(User::getId, User::getName, (e1, e2) -> e1 + "," + e2));
|
||||
|
||||
@@ -145,16 +149,16 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
CsConfigurationVO csDevModelPageVO = new CsConfigurationVO();
|
||||
BeanUtils.copyProperties(page, csDevModelPageVO);
|
||||
|
||||
if(StringUtils.isEmpty(page.getProjectIds())){
|
||||
if (StringUtils.isEmpty(page.getProjectIds())) {
|
||||
csDevModelPageVO.setProjectIds(new ArrayList<>());
|
||||
}else {
|
||||
csDevModelPageVO.setProjectIds( Arrays.asList(page.getProjectIds().split(",")));
|
||||
} else {
|
||||
csDevModelPageVO.setProjectIds(Arrays.asList(page.getProjectIds().split(",")));
|
||||
|
||||
}
|
||||
if(Objects.isNull(page.getImagePath())){
|
||||
if (Objects.isNull(page.getImagePath())) {
|
||||
csDevModelPageVO.setFileContent(null);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
InputStream fileStream = fileStorageUtil.getFileStream(page.getImagePath());
|
||||
String text = new BufferedReader(
|
||||
new InputStreamReader(fileStream, StandardCharsets.UTF_8))
|
||||
@@ -171,13 +175,12 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
returnpage.setTotal(csConfigurationPOPage.getTotal());
|
||||
|
||||
|
||||
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadImage(MultipartFile issuesFile) {
|
||||
return fileStorageUtil.getFileUrl( fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
||||
return fileStorageUtil.getFileUrl(fileStorageUtil.uploadMultipart(issuesFile, HarmonicConstant.CONFIGURATIONPATH));
|
||||
}
|
||||
|
||||
/*将strin写入Json文件,返回一个InputStream*/
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
@@ -401,6 +402,23 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsWarnDescVO> getEventDesc(List<String> lineIdList) {
|
||||
List<CsWarnDescVO> csWarnDescVOList = new ArrayList<>();
|
||||
if(CollUtil.isEmpty(lineIdList)){
|
||||
return csWarnDescVOList;
|
||||
}
|
||||
/**
|
||||
* todo.. 目前且先查最近的60条
|
||||
*/
|
||||
csWarnDescVOList = this.baseMapper.getEventDesc(lineIdList,60);
|
||||
// 处理下描述
|
||||
for (CsWarnDescVO csWarnDescVO : csWarnDescVOList) {
|
||||
csWarnDescVO.setEventDesc("电压暂态事件,持续时间"+csWarnDescVO.getPersistTime()+"秒,电压降至"+csWarnDescVO.getAmplitude()+"%。");
|
||||
}
|
||||
return csWarnDescVOList;
|
||||
}
|
||||
|
||||
public String getTag(Integer type) {
|
||||
String tag;
|
||||
switch (type) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csharmonic.mapper.CsPageUserMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
import com.njcn.csharmonic.service.CsPageUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsPageUserServiceImpl extends ServiceImpl<CsPageUserMapper, CsPageUser> implements CsPageUserService {
|
||||
|
||||
@Override
|
||||
public boolean savePageIdWithUser(CsPageUser csPageUser) {
|
||||
// 首先获取该用户的数据,理论上只有一个,以后可能有多个
|
||||
CsPageUser csPageUser1 = this.getOne(new QueryWrapper<CsPageUser>().eq("user_id", csPageUser.getUserId()));
|
||||
if(Objects.isNull(csPageUser1)){
|
||||
// 如果没有就插入
|
||||
return this.save(csPageUser);
|
||||
}else{
|
||||
return this.update(csPageUser, new QueryWrapper<CsPageUser>().eq("user_id", csPageUser.getUserId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsPageUser getByUserId(String userId) {
|
||||
// 根据用户id获取组件信息
|
||||
CsPageUser csPageUser = this.getOne(new QueryWrapper<CsPageUser>().eq("user_id", userId));
|
||||
if(Objects.isNull(csPageUser)){
|
||||
throw new BusinessException("该用户不存在组件信息");
|
||||
}
|
||||
return csPageUser;
|
||||
}
|
||||
}
|
||||
@@ -375,7 +375,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
} else if (v.contains("start_time") && v.contains("end_time")){
|
||||
//如时间是大于当前时间则用当前时间
|
||||
LocalDate startDate = LocalDateTimeUtil.parseDate(queryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
LocalDate startDate = LocalDateTimeUtil.parseDate(queryParam.getStartTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
LocalDate nowDate = LocalDate.now();
|
||||
if (!nowDate.isAfter(startDate)) {
|
||||
startDate = LocalDate.now();
|
||||
@@ -383,11 +383,11 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN) + InfluxDbSqlConstant.START_TIME;
|
||||
//如时间是大于当前时间则用当前时间
|
||||
String localTime = InfluxDbSqlConstant.END_TIME;
|
||||
LocalDate endDate = LocalDateTimeUtil.parseDate(queryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
LocalDate endDate = LocalDateTimeUtil.parseDate(queryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
if (nowDate.isAfter(endDate)) {
|
||||
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
||||
}
|
||||
String endTime = queryParam.getSearchEndTime() + localTime;
|
||||
String endTime = queryParam.getEndTime() + localTime;
|
||||
String val = v.replace(STR_THREE, "").replace("start_time", startTime).replace("end_time", endTime);
|
||||
son.putOpt(V, val);
|
||||
|
||||
@@ -1050,9 +1050,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
//时间范围处理
|
||||
sql.append(InfluxDbSqlConstant.AND)
|
||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(queryParam.getSearchBeginTime()).append(InfluxDbSqlConstant.START_TIME).append(InfluxDbSqlConstant.QM)
|
||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(queryParam.getStartTime()).append(InfluxDbSqlConstant.START_TIME).append(InfluxDbSqlConstant.QM)
|
||||
.append(InfluxDbSqlConstant.AND)
|
||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(queryParam.getSearchEndTime()).append(InfluxDbSqlConstant.END_TIME).append(InfluxDbSqlConstant.QM);
|
||||
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(queryParam.getEndTime()).append(InfluxDbSqlConstant.END_TIME).append(InfluxDbSqlConstant.QM);
|
||||
|
||||
System.out.println(sql);
|
||||
List<Map<String, Object>> mapList = Collections.emptyList();
|
||||
@@ -1126,28 +1126,35 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
Map<String, List<ReportTemplateDTO>> classMap = reportTemplateDTOList.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getResourceId));
|
||||
//定义存放越限指标的map
|
||||
Map<String, ReportTemplateDTO> assNoPassMap = new HashMap<>();
|
||||
|
||||
classMap.forEach((classKey, templateValue) -> {
|
||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||
//每张表开启一个独立线程查询
|
||||
futures.add(executorService.submit(() -> {
|
||||
// 子线程中手动指定数据源(关键)
|
||||
DynamicDataSourceContextHolder.push("sjzx");
|
||||
//avg.max,min,cp95
|
||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||
//相别分组
|
||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
}
|
||||
try {
|
||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||
//相别分组
|
||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlByMysql(phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}finally {
|
||||
DynamicDataSourceContextHolder.poll();
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
@@ -1174,7 +1181,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
//处理台账信息
|
||||
Map<String, String> finalTerminalMap;
|
||||
if (CollUtil.isNotEmpty(terminalList)) {
|
||||
finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
|
||||
finalTerminalMap = convertKeysToUpperCase(csLineFeignClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
|
||||
} else {
|
||||
finalTerminalMap = new HashMap<>();
|
||||
}
|
||||
|
||||
@@ -2,20 +2,22 @@ package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.*;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
|
||||
import com.njcn.csharmonic.pojo.dto.ZuTaiDTO;
|
||||
import com.njcn.csharmonic.pojo.dto.ZuTaiNewDTO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
||||
import com.njcn.csharmonic.service.CsPagePOService;
|
||||
import com.njcn.csharmonic.service.ILineTargetService;
|
||||
import com.njcn.csharmonic.util.InfluxDbParamUtil;
|
||||
import com.njcn.cssystem.enums.CsSystemResponseEnum;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
@@ -23,7 +25,7 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -49,6 +51,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class LineTargetServiceImpl implements ILineTargetService {
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
@@ -107,27 +110,62 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
return dataArrayFeignClient.getDataArray(setList).getData();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<CsRtDataVO> getLineData(String id) {
|
||||
// List<CsRtDataVO> result = new ArrayList<>();
|
||||
// String path = csPagePOService.queryById(id).getPath();
|
||||
// InputStream inputStream = fileStorageUtil.getFileStream(path);
|
||||
// ZuTaiDTO zuTaiDto = analysisJson(inputStream);
|
||||
// zuTaiDto.getJson().forEach(item->{
|
||||
// if (!Objects.isNull(item.getTarget()) && StringUtils.isNotBlank(item.getTarget())){
|
||||
// String targetTag = item.getTarget().split("\\$")[0];
|
||||
// String phasic = item.getTarget().split("\\$")[1];
|
||||
// String dataType = item.getTarget().split("\\$")[2];
|
||||
// if (CollectionUtils.isEmpty(item.getUId()) || ObjectUtil.isNull(item.getLineId())){
|
||||
// throw new BusinessException(CsHarmonicResponseEnum.BIND_TARGET_ERROR);
|
||||
// }
|
||||
// CsDataArray dataArray = dataArrayFeignClient.getDataArrayById(String.valueOf(item.getUId().get(0)),targetTag).getData().get(0);
|
||||
// String targetName = dataArray.getAnotherName();
|
||||
// String dataId = dataArray.getDataId();
|
||||
// String classId = epdFeignClient.selectById(dataId).getData().getClassId();
|
||||
// String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId());
|
||||
// //基础信息
|
||||
// CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid);
|
||||
// //设备状态信息
|
||||
// CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(item.getLineId()).getData();
|
||||
// vo.setDevStatus(po.getRunStatus());
|
||||
// result.add(vo);
|
||||
// }
|
||||
// });
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsRtDataVO> getLineData(String id) {
|
||||
List<CsRtDataVO> result = new ArrayList<>();
|
||||
String path = csPagePOService.queryById(id).getPath();
|
||||
InputStream inputStream = fileStorageUtil.getFileStream(path);
|
||||
ZuTaiDTO zuTaiDto = analysisJson(inputStream);
|
||||
|
||||
zuTaiDto.getJson().forEach(item->{
|
||||
if (!Objects.isNull(item.getTarget()) && StringUtils.isNotBlank(item.getTarget())){
|
||||
String targetTag = item.getTarget().split("\\$")[0];
|
||||
String phasic = item.getTarget().split("\\$")[1];
|
||||
String dataType = item.getTarget().split("\\$")[2];
|
||||
if (CollectionUtils.isEmpty(item.getUId()) || ObjectUtil.isNull(item.getLineId())){
|
||||
throw new BusinessException(CsHarmonicResponseEnum.BIND_TARGET_ERROR);
|
||||
if (ObjectUtil.isNotNull(item.getUIdType()) && item.getUIdType()) {
|
||||
Object lastElement = item.getUId().get(item.getUId().size() - 1);
|
||||
String data = String.valueOf(lastElement);
|
||||
//分解出来五个参数 第一个 指标字段 第二个 相别 第三个 数据类型 第四个 influxdb表名 第五个 限值名称
|
||||
String[] tempTable = data.replace("$", "").split("#");
|
||||
//解析指标名称
|
||||
String targetName = "指标名称获取失败";
|
||||
String[] tmepUidName = item.getTarget().split(" / ");
|
||||
if(tmepUidName.length==2) {
|
||||
targetName = tmepUidName[0];
|
||||
}else if (tmepUidName.length==3) {
|
||||
targetName = tmepUidName[0];
|
||||
} else if (tmepUidName.length==4) {
|
||||
targetName = tmepUidName[1];
|
||||
}
|
||||
CsDataArray dataArray = dataArrayFeignClient.getDataArrayById(item.getUId().get(0),targetTag).getData().get(0);
|
||||
String targetName = dataArray.getAnotherName();
|
||||
String dataId = dataArray.getDataId();
|
||||
String classId = epdFeignClient.selectById(dataId).getData().getClassId();
|
||||
String clDid = influxDbParamUtil.getClDidByLineId(item.getLineId());
|
||||
//基础信息
|
||||
CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),influxDbParamUtil.getTableNameByClassId(classId),targetTag,phasic,dataType,targetName,clDid);
|
||||
CsRtDataVO vo = getLineRtData(item.getId(),item.getLineId(),tempTable[3],tempTable[0],Objects.equals(tempTable[1],"T")?"M":tempTable[1],tempTable[2],targetName,clDid);
|
||||
//设备状态信息
|
||||
CsEquipmentDeliveryPO po = equipmentFeignClient.getDevByLineId(item.getLineId()).getData();
|
||||
vo.setDevStatus(po.getRunStatus());
|
||||
@@ -137,6 +175,55 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsRtDataVO> getLineDataNew(String id) {
|
||||
List<CsRtDataVO> result = new ArrayList<>();
|
||||
String path = csPagePOService.queryById(id).getPath();
|
||||
InputStream inputStream = fileStorageUtil.getFileStream(path);
|
||||
ZuTaiNewDTO zuTaiDto = analysisJsonNew(inputStream);
|
||||
|
||||
zuTaiDto.getJson().forEach(item->{
|
||||
if (!CollectionUtils.isEmpty(item.getUidNames()) && Objects.isNull(item.getUidType())){
|
||||
for (int i = 0; i < item.getUidNames().size(); i++) {
|
||||
String temp = item.getUidNames().get(i);
|
||||
String targetTag = null;
|
||||
String phasic = null;
|
||||
String dataType = null;
|
||||
// String[] tmepUidName = temp.split(" / ");
|
||||
// if(tmepUidName.length==2){
|
||||
// targetTag = tmepUidName[0];
|
||||
// phasic = "T";
|
||||
// dataType = tmepUidName[1];
|
||||
// }else if (tmepUidName.length==3){
|
||||
// targetTag = tmepUidName[0];
|
||||
// phasic = tmepUidName[1];
|
||||
// dataType = tmepUidName[2];
|
||||
// }
|
||||
|
||||
if (CollectionUtils.isEmpty(item.getUid()) || org.springframework.util.StringUtils.isEmpty(item.getLineId())){
|
||||
throw new BusinessException(CsSystemResponseEnum.BIND_TARGET_ERROR);
|
||||
}
|
||||
// List<String> tempUid = (List<String>) item.getUid().get(i);
|
||||
|
||||
if (item.getUid().get(i) instanceof List) {
|
||||
List<?> rawList = (List<?>) item.getUid().get(i);
|
||||
List<String> tempUid = rawList.stream()
|
||||
.filter(item2 -> item2 instanceof String)
|
||||
.map(item2 -> (String) item2)
|
||||
.collect(Collectors.toList());
|
||||
String s = tempUid.get(tempUid.size() - 1);
|
||||
String[] tempTable = s.replace("$", "").split("#");
|
||||
result.add(getLineRtDataNew(item.getId(),item.getLineId(),tempTable[3],tempTable[0],Objects.equals(tempTable[1],"T")?"M":tempTable[1],tempTable[2],temp,item.getUnit().get(i)));
|
||||
// result.add(getLineRtData(item.getId(),item.getLineId(),tempUid.get(3),tempUid.get(0),tempUid.get(1),tempUid.get(2).toUpperCase(),temp,"%"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析json文件
|
||||
*/
|
||||
@@ -149,6 +236,28 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
return gson.fromJson(text, new TypeToken<ZuTaiDTO>(){}.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析json文件
|
||||
*/
|
||||
public ZuTaiNewDTO analysisJsonNew(InputStream inputStream) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
String text = new BufferedReader(
|
||||
new InputStreamReader(inputStream, StandardCharsets.UTF_8))
|
||||
.lines()
|
||||
.collect(Collectors.joining("\n"));
|
||||
|
||||
|
||||
ZuTaiNewDTO config = null;
|
||||
try {
|
||||
config = mapper.readValue(text, ZuTaiNewDTO.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orm框架获取数据
|
||||
* @param id 图元Id
|
||||
@@ -179,4 +288,75 @@ public class LineTargetServiceImpl implements ILineTargetService {
|
||||
csRtDataVO.setId(id);
|
||||
return csRtDataVO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过orm框架获取数据
|
||||
* @param id 图元Id
|
||||
* @param lineId 监测点Id
|
||||
* @param tableName 表名称
|
||||
* @param columnName 字段名称
|
||||
* @param phasic 相别
|
||||
* @param dataType 数据类型
|
||||
* @param target 数据名称
|
||||
* @return
|
||||
*/
|
||||
public CsRtDataVO getLineRtDataNew(String id,String lineId, String tableName, String columnName, String phasic, String dataType, String target,String uint) {
|
||||
CsRtDataVO csRtDataVO = new CsRtDataVO();
|
||||
String clDid = influxDbParamUtil.getClDidByLineId(lineId);
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,tableName,columnName,phasic,dataType,clDid);
|
||||
if(Objects.isNull(statisticalDataDTO)){
|
||||
statisticalDataDTO = new StatisticalDataDTO();
|
||||
statisticalDataDTO.setLineId(lineId);
|
||||
statisticalDataDTO.setPhaseType(phasic);
|
||||
statisticalDataDTO.setValueType(dataType);
|
||||
statisticalDataDTO.setValue(3.1415926);
|
||||
} else {
|
||||
statisticalDataDTO.setValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
String targetTag = null;
|
||||
String targetPhasic = null;
|
||||
String targetDataType = null;
|
||||
|
||||
String[] tmepUidName = target.split(" / ");
|
||||
if(tmepUidName.length==2){
|
||||
targetTag = tmepUidName[0];
|
||||
targetDataType = getDataType(tmepUidName[1]) ;
|
||||
}else if (tmepUidName.length==3){
|
||||
targetTag = tmepUidName[0];
|
||||
targetPhasic = tmepUidName[1];
|
||||
targetDataType =getDataType(tmepUidName[2]) ;
|
||||
} else if (tmepUidName.length==4) {
|
||||
targetTag = tmepUidName[1];
|
||||
targetPhasic = tmepUidName[2];
|
||||
targetDataType =getDataType(tmepUidName[3]) ;
|
||||
}
|
||||
statisticalDataDTO.setStatisticalName((Objects.isNull(targetPhasic)?"":targetPhasic+"相_")+targetTag+"_"+targetDataType);
|
||||
statisticalDataDTO.setTarget(columnName + "$" + phasic + "$" + dataType);
|
||||
BeanUtils.copyProperties(statisticalDataDTO,csRtDataVO);
|
||||
csRtDataVO.setId(id);
|
||||
csRtDataVO.setUnit(uint);
|
||||
return csRtDataVO;
|
||||
}
|
||||
|
||||
public String getDataType(String statItem){
|
||||
String valueTypeName = "";
|
||||
switch (statItem) {
|
||||
case "max":
|
||||
valueTypeName = "最大值";
|
||||
break;
|
||||
case "min":
|
||||
valueTypeName = "最小值";
|
||||
break;
|
||||
case "avg":
|
||||
valueTypeName = "平均值";
|
||||
break;
|
||||
case "cp95":
|
||||
valueTypeName = "cp95值";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return valueTypeName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ public class ReportServiceImpl implements ReportService {
|
||||
return value.stream().filter(x -> x.getValueType().equals(name)).map(temp -> {
|
||||
BigDecimal o = null;
|
||||
try {
|
||||
o = (BigDecimal) finalField.get(temp);
|
||||
o = BigDecimal.valueOf((Double) finalField.get(temp));
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ spring:
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
@@ -46,6 +50,8 @@ logging:
|
||||
mybatis-plus:
|
||||
#别名扫描
|
||||
type-aliases-package: com.njcn.harmonic.pojo
|
||||
global-config:
|
||||
enable-sql-runner: true
|
||||
|
||||
mqtt:
|
||||
client-id: @artifactId@${random.value}
|
||||
client-id: @artifactId@${random.value}
|
||||
|
||||
@@ -18,7 +18,7 @@ public enum CsSystemResponseEnum {
|
||||
SAME_DATA_ERROR("A0301","数据重复"),
|
||||
|
||||
CS_SYSTEM_COMMON_ERROR("A00302","治理系统模块异常"),
|
||||
|
||||
BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -146,5 +146,35 @@ public class EleEpdPqd {
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 报表数据来源(mysql表名)
|
||||
*/
|
||||
private String resourcesId;
|
||||
|
||||
/**
|
||||
* 限值名称
|
||||
*/
|
||||
private String limitName;
|
||||
|
||||
/**
|
||||
* 限值表名
|
||||
*/
|
||||
private String limitTable;
|
||||
|
||||
/**
|
||||
* 超标判断方式
|
||||
*/
|
||||
private String formula;
|
||||
|
||||
/**
|
||||
* 二次值转一次值公式
|
||||
*/
|
||||
private String primaryFormula;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.cssystem.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EleEpdTreeVO {
|
||||
|
||||
@ApiModelProperty(name = "id",value = "模板索引")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(name = "name",value = "模板字段名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "showName",value = "模板中文展示名")
|
||||
private String showName;
|
||||
|
||||
@ApiModelProperty(name = "flag",value = "用于标识最底层对象 1.表示已经没有子级")
|
||||
private Integer flag;
|
||||
|
||||
@ApiModelProperty(name = "unit",value = "单位")
|
||||
private String unit;
|
||||
|
||||
private List<EleEpdTreeVO> children;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.njcn.cssystem.controller.zutai;
|
||||
|
||||
|
||||
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.cssystem.pojo.vo.EleEpdTreeVO;
|
||||
import com.njcn.cssystem.service.IEleEpdPqdService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-24
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csDictData")
|
||||
@Api(tags = "指标数据字典")
|
||||
@AllArgsConstructor
|
||||
public class EleEpdPqdController extends BaseController {
|
||||
|
||||
private final IEleEpdPqdService eleEpdPqdService;
|
||||
|
||||
/**
|
||||
* 获取电能质量指标模板树
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/eleEpdChooseTree")
|
||||
@ApiOperation("获取电能质量指标模板树")
|
||||
public HttpResult<List<EleEpdTreeVO>> eleEpdChooseTree(){
|
||||
String methodDescribe = getMethodDescribe("eleEpdChooseTree");
|
||||
List<EleEpdTreeVO> res = eleEpdPqdService.eleEpdChooseTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.cssystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-24
|
||||
*/
|
||||
public interface EleEpdPqdMapper extends BaseMapper<EleEpdPqd> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.cssystem.mapper.EleEpdPqdMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
||||
import com.njcn.cssystem.pojo.vo.EleEpdTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-24
|
||||
*/
|
||||
public interface IEleEpdPqdService extends IService<EleEpdPqd> {
|
||||
|
||||
|
||||
List<EleEpdTreeVO> eleEpdChooseTree();
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.njcn.cssystem.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.cssystem.mapper.EleEpdPqdMapper;
|
||||
import com.njcn.cssystem.pojo.po.EleEpdPqd;
|
||||
import com.njcn.cssystem.pojo.vo.EleEpdTreeVO;
|
||||
import com.njcn.cssystem.service.IEleEpdPqdService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-24
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EleEpdPqdServiceImpl extends ServiceImpl<EleEpdPqdMapper, EleEpdPqd> implements IEleEpdPqdService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final String STR_ONE = "#";
|
||||
|
||||
private final String STR_TWO = "$";
|
||||
|
||||
@Override
|
||||
public List<EleEpdTreeVO> eleEpdChooseTree() {
|
||||
DictData dic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.CS_DATA_TYPE.getName(), DicDataEnum.PQD.getName()).getData();
|
||||
LambdaQueryWrapper<EleEpdPqd> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(EleEpdPqd::getDataType, dic.getId()).orderByAsc(EleEpdPqd::getSort);
|
||||
List<EleEpdPqd> list = this.getBaseMapper().selectList(lambdaQueryWrapper);
|
||||
Map<String, List<EleEpdPqd>> map = list.stream().collect(Collectors.groupingBy(EleEpdPqd::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
List<EleEpdTreeVO> tree = new ArrayList<>();
|
||||
map.forEach((key, value) -> {
|
||||
|
||||
EleEpdTreeVO reportTreeVO = new EleEpdTreeVO();
|
||||
reportTreeVO.setName(value.get(0).getName());
|
||||
reportTreeVO.setShowName(value.get(0).getShowName());
|
||||
|
||||
//存在1-50次 2-50次情况
|
||||
if (Objects.nonNull(value.get(0).getHarmStart()) && Objects.nonNull(value.get(0).getHarmEnd())) {
|
||||
List<EleEpdTreeVO> reHarm = new ArrayList<>();
|
||||
for (int i = value.get(0).getHarmStart(); i <= value.get(0).getHarmEnd(); i++) {
|
||||
EleEpdTreeVO reportTreeCount = new EleEpdTreeVO();
|
||||
reportTreeCount.setName(value.get(0).getName() + "_" + i);
|
||||
reportTreeCount.setShowName(i + "次" + value.get(0).getShowName());
|
||||
reportTreeVO.setFlag(1);
|
||||
assPhase(value, reportTreeCount, reportTreeCount.getName());
|
||||
reHarm.add(reportTreeCount);
|
||||
}
|
||||
reportTreeVO.setChildren(reHarm);
|
||||
} else {
|
||||
assPhase(value, reportTreeVO, value.get(0).getName());
|
||||
}
|
||||
tree.add(reportTreeVO);
|
||||
});
|
||||
return tree;
|
||||
}
|
||||
|
||||
/*组装相别*/
|
||||
private void assPhase(List<EleEpdPqd> value, EleEpdTreeVO reportTreeItem, String key) {
|
||||
List<EleEpdTreeVO> phaseTree = new ArrayList<>();
|
||||
value.forEach(item -> {
|
||||
if (Objects.nonNull(item.getPhase()) && !"M".equals(item.getPhase())) {
|
||||
List<EleEpdTreeVO> statTree = new ArrayList<>();
|
||||
EleEpdTreeVO reportTreePhase = new EleEpdTreeVO();
|
||||
reportTreePhase.setName(item.getPhase());
|
||||
reportTreePhase.setShowName(item.getPhase());
|
||||
// reportTreePhase.setUnit(item.getUnit());
|
||||
assStatMethod(item, statTree, key, item.getPhase());
|
||||
reportTreePhase.setChildren(statTree);
|
||||
phaseTree.add(reportTreePhase);
|
||||
reportTreeItem.setChildren(phaseTree);
|
||||
|
||||
} else {
|
||||
List<EleEpdTreeVO> statTree = new ArrayList<>();
|
||||
assStatMethod(item, statTree, key, "M");
|
||||
reportTreeItem.setChildren(statTree);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void assStatMethod(EleEpdPqd item, List<EleEpdTreeVO> statTree, String oneKey, String twoKey) {
|
||||
//存在向别为M但是Stat_Method不为空
|
||||
if (StrUtil.isNotBlank(item.getStatMethod())) {
|
||||
String[] arr = item.getStatMethod().split(",");
|
||||
List<String> stat = Stream.of(arr).collect(Collectors.toList());
|
||||
//根据表id获取表名称
|
||||
String tableName = dicDataFeignClient.getDicDataById(item.getClassId().trim()).getData().getName();
|
||||
if (CollUtil.isNotEmpty(stat)) {
|
||||
stat.forEach(statItem -> {
|
||||
EleEpdTreeVO reportTreeStat = new EleEpdTreeVO();
|
||||
reportTreeStat.setUnit(item.getUnit());
|
||||
String tem = "";
|
||||
if (Objects.nonNull(item.getLimitName())) {
|
||||
tem = STR_ONE + item.getLimitName();
|
||||
} else {
|
||||
tem = "#NO";
|
||||
}
|
||||
if (StrUtil.isNotBlank(twoKey)) {
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + twoKey + STR_ONE + statItem + STR_ONE + tableName + tem.trim() + STR_TWO);
|
||||
} else {
|
||||
reportTreeStat.setName(STR_TWO + oneKey + STR_ONE + statItem + STR_ONE + tableName + tem.trim() + STR_TWO);
|
||||
}
|
||||
|
||||
reportTreeStat.setShowName(statItem);
|
||||
statTree.add(reportTreeStat);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user