基于云平台功能调整
This commit is contained in:
@@ -81,4 +81,7 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/getLineDetailData")
|
||||
HttpResult<LineDetailDataVO> getLineDetailData(@RequestParam("id") String id);
|
||||
|
||||
@GetMapping("/getSimpleLine")
|
||||
HttpResult<List<CsLinePO>> getSimpleLine();
|
||||
|
||||
}
|
||||
|
||||
@@ -131,6 +131,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getSimpleLine() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询登录用户拥有的监测点台账",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,31 +23,31 @@ public class DeviceExcelTemplete implements Serializable {
|
||||
/**
|
||||
* 装置名称
|
||||
*/
|
||||
@Excel(name = "装置名称", width = 15)
|
||||
@Excel(name = "设备名称", width = 15)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 网关识别码
|
||||
*/
|
||||
@Excel(name = "网关识别码", width = 15)
|
||||
@Excel(name = "网络设备ID", width = 15)
|
||||
private String ndid;
|
||||
|
||||
/**
|
||||
* 装置类型(直连设备、网关设备、装置)
|
||||
*/
|
||||
@Excel(name = "装置类型(直连设备,网关设备)", width = 30)
|
||||
@Excel(name = "设备类型(直连设备,网关设备、便携式设备)", width = 30)
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 装置型号(pqs588、pqs680...)
|
||||
*/
|
||||
@Excel(name = "装置型号", width = 15)
|
||||
@Excel(name = "设备型号", width = 15)
|
||||
private String devModel;
|
||||
|
||||
/**
|
||||
* 装置接入方式(mqtt、cloud)
|
||||
*/
|
||||
@Excel(name = "装置接入方式(mqtt、cloud)", width = 25)
|
||||
@Excel(name = "通讯协议(MQTT、CLD)", width = 25)
|
||||
private String devAccessMethod;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.controller.line;
|
||||
|
||||
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.plugins.pagination.Page;
|
||||
@@ -11,8 +12,8 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.utils.COverlimitUtil;
|
||||
@@ -27,8 +28,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -160,6 +163,16 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitData")
|
||||
@ApiOperation("根据监测点id获取国标限值")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitData");
|
||||
Overlimit result = overlimitMapper.selectById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
// @PostMapping("/getLinesByDevList")
|
||||
// @ApiOperation("根据装置id集合获取监测点id集合")
|
||||
@@ -188,7 +201,7 @@ public class CslineController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("addCldLine");
|
||||
csLinePOService.addCldLine(param);
|
||||
//新增监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),param.getProtocolCapacity().floatValue(),param.getDevCapacity().floatValue(),param.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(param.getLineId());
|
||||
overlimitMapper.deleteById(param.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
@@ -203,7 +216,7 @@ public class CslineController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("updateCldLine");
|
||||
csLinePOService.updateCldLine(param);
|
||||
//修改监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),param.getProtocolCapacity().floatValue(),param.getDevCapacity().floatValue(),param.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(param.getLineId());
|
||||
overlimitMapper.deleteById(param.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
@@ -217,6 +230,7 @@ public class CslineController extends BaseController {
|
||||
public HttpResult<List<CsLinePO>> delCldLine(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delCldLine");
|
||||
csLinePOService.deleteCldLine(id);
|
||||
overlimitMapper.deleteById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -270,9 +284,15 @@ public class CslineController extends BaseController {
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLinePOService.getSimpleLine();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
List<CsLinePO> list = csLinePOService.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.in(CsLinePO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(CsLinePO::getName));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
@@ -292,7 +312,7 @@ public class CslineController extends BaseController {
|
||||
@ApiOperation("获取敏感负荷用户监测点列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSensitiveUserLineVO>> getSensitiveUserLineList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
String methodDescribe = getMethodDescribe("getSensitiveUserLineList");
|
||||
Page<PqSensitiveUserLineVO> page = csLinePOService.getSensitiveUserLineList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -117,8 +117,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
if(Objects.nonNull (one)){
|
||||
List<CsEquipmentDeliveryPO> one = this.lambdaQuery()
|
||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
||||
.list();
|
||||
if(CollUtil.isNotEmpty(one)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
}
|
||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
|
||||
@@ -259,12 +263,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
//修改台账树中的设备名称
|
||||
//如果是已经接入的设备需要修改台账树中的设备名称
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
if (ObjectUtil.isNotNull(csLedger)) {
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||
@@ -990,17 +996,33 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||
DictTreeVO vo = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
if (ObjectUtil.isNotNull(vo)) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
//获取用户已经绑定的便携式设备
|
||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList);
|
||||
if (ObjectUtil.isNull(vo)) {
|
||||
throw new BusinessException("便携式设备类型字典缺失");
|
||||
}
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
//获取用户已经绑定的便携式设备
|
||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList);
|
||||
}
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
//获取已经接入过系统的设备,未接入的不给分配
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
List<String> ids = result.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
queryWrapper.in(CsLedger::getId,ids);
|
||||
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Set<String> idSet = list.stream()
|
||||
.map(CsLedger::getId)
|
||||
.collect(Collectors.toSet());
|
||||
return result.stream()
|
||||
.filter(data -> idSet.contains(data.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1135,6 +1135,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
@Override
|
||||
public Map<String, List<ThdDataVO>> sensitiveUserTrendData(SensitiveUserTrendDataQueryParam param) {
|
||||
Map<String, List<ThdDataVO>> result = new HashMap<>();
|
||||
if (Objects.isNull(param.getSensitiveUserId())) {
|
||||
return result;
|
||||
}
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
|
||||
@@ -275,7 +275,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
public List<CsLinePO> getSimpleLine() {
|
||||
List<String> devIds = commGetDevIds(RequestUtil.getUserIndex());
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName).in(CsLinePO::getDeviceId,devIds)
|
||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
return poList;
|
||||
}else {
|
||||
@@ -287,8 +287,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
||||
devIds = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().eq(CsEquipmentDeliveryPO::getStatus,DataStateEnum.ENABLE)).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().ne(CsEquipmentDeliveryPO::getRunStatus,DataStateEnum.DELETED.getCode())).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))
|
||||
@@ -313,14 +313,20 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
result.setCurrent(param.getPageNum());
|
||||
result.setSize(param.getPageSize());
|
||||
|
||||
|
||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()),
|
||||
new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser)
|
||||
);
|
||||
// 查询登录用户拥有的监测点台账
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
// 构建基础查询条件
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
//.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser);
|
||||
// 只有当lineList不为空时才添加in条件
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(CsLinePO::getLineId, lineList);
|
||||
}
|
||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lambdaQueryWrapper);
|
||||
BeanUtil.copyProperties(linePage, result);
|
||||
List<CsLinePO> records = linePage.getRecords();
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
@@ -349,15 +355,21 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
}
|
||||
// 监测类型
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
DictData positionDictData = dicDataFeignClient.getDicDataById(record.getPosition()).getData();
|
||||
if (positionDictData != null) {
|
||||
sensitiveUserLineVO.setPosition(positionDictData.getName());
|
||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
DictData positionDictData = dicDataFeignClient.getDicDataById(record.getPosition()).getData();
|
||||
if (positionDictData != null) {
|
||||
sensitiveUserLineVO.setPosition(positionDictData.getName());
|
||||
}
|
||||
}
|
||||
// 电压等级
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
if (ObjectUtil.isNotNull(record.getVolGrade())) {
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
}
|
||||
// 运行状态
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(record.getRunStatus()));
|
||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(record.getRunStatus()));
|
||||
}
|
||||
// 报告文件
|
||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||
// 最新数据时间
|
||||
@@ -377,7 +389,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
|
||||
@Override
|
||||
public boolean uploadReport(MultipartFile file, String lineId) {
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.GOVERN_HARMONIC_FILE);
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.GOVERN_HARMONIC_FILE, true);
|
||||
return this.update(new LambdaUpdateWrapper<CsLinePO>().eq(CsLinePO::getLineId, lineId).set(CsLinePO::getReportFilePath, filePath));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements IOverLimitService {
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
public class SensitiveUserTrendDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "检测对象ID")
|
||||
@NotBlank(message = "检测对象ID不可为空")
|
||||
private String sensitiveUserId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
|
||||
@@ -10,6 +10,8 @@ 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.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
@@ -24,7 +26,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -42,6 +47,7 @@ import java.util.List;
|
||||
public class PqSensitiveUserController extends BaseController {
|
||||
|
||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@@ -59,11 +65,26 @@ public class PqSensitiveUserController extends BaseController {
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getListByIds");
|
||||
List<PqSensitiveUser> list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>()
|
||||
.in(CollUtil.isNotEmpty(ids),PqSensitiveUser::getId, ids)
|
||||
List<PqSensitiveUser> list;
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getMonitorUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
keywordsLineIds = ids;
|
||||
}
|
||||
}
|
||||
list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>().in(PqSensitiveUser::getId, keywordsLineIds)
|
||||
);
|
||||
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ public class RStatLimitRateDController extends BaseController {
|
||||
public HttpResult<TotalLimitTotalStatisticsVO> totalLimitTotalStatisticsData(@RequestBody TotalLimitStatisticsParam mainLineQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("totalLimitStatisticsList");
|
||||
TotalLimitTotalStatisticsVO data = limitRateDService.totalLimitTotalStatisticsData(mainLineQueryParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -122,7 +121,6 @@ public class RStatLimitRateDController extends BaseController {
|
||||
public HttpResult<List<TotalLimitStatisticsVO>> totalLimitStatisticsList(@RequestBody TotalLimitStatisticsParam mainLineQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("totalLimitStatisticsList");
|
||||
List<TotalLimitStatisticsVO> list = limitRateDService.totalLimitStatisticsList(mainLineQueryParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,13 +162,21 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
||||
return result;
|
||||
}
|
||||
keywordsLineIds = lineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
} else {
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return result;
|
||||
}
|
||||
// 根据监测点Id分组,再分页
|
||||
Page<RStatLimitRateDPO> ratePage = this.page(new Page<RStatLimitRateDPO>(param.getPageNum(), param.getPageSize()), new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
||||
.in(CollUtil.isNotEmpty(keywordsLineIds), RStatLimitRateDPO::getLineId, keywordsLineIds)
|
||||
.in(RStatLimitRateDPO::getLineId, keywordsLineIds)
|
||||
.groupBy(RStatLimitRateDPO::getLineId)
|
||||
.select(RStatLimitRateDPO::getLineId)
|
||||
);
|
||||
@@ -237,19 +245,19 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
||||
|
||||
@Override
|
||||
public List<MainLineStatLimitRateDetailsVO> mainLineStatLimitRateDetails(MainLineStatLimitRateDetailsQueryParam param) {
|
||||
|
||||
HttpResult<CsLinePO> lineResult = csLineFeignClient.getById(param.getLineId());
|
||||
CsLinePO linePO = lineResult.getData();
|
||||
if (linePO == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<RStatLimitRateDPO> list = this.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
.eq(RStatLimitRateDPO::getLineId, param.getLineId())
|
||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||
.eq(RStatLimitRateDPO::getLineId, param.getLineId())
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
||||
.orderByAsc(RStatLimitRateDPO::getTime)
|
||||
);
|
||||
|
||||
return list.stream().map(item -> {
|
||||
MainLineStatLimitRateDetailsVO vo = BeanUtil.copyProperties(item, MainLineStatLimitRateDetailsVO.class);
|
||||
vo.setLineName(linePO.getName());
|
||||
@@ -269,16 +277,28 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TotalLimitTotalStatisticsVO totalLimitTotalStatisticsData(TotalLimitStatisticsParam param) {
|
||||
TotalLimitTotalStatisticsVO statisticsVO = new TotalLimitTotalStatisticsVO();
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return statisticsVO;
|
||||
}
|
||||
List<RStatLimitRateDPO> rateList = this.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
||||
.in(RStatLimitRateDPO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(RStatLimitRateDPO::getTime)
|
||||
);
|
||||
|
||||
TotalLimitTotalStatisticsVO statisticsVO = new TotalLimitTotalStatisticsVO();
|
||||
int flickerTotalTime = rateList.stream().mapToInt(RStatLimitRateDPO::getFlickerOvertime).sum();
|
||||
int voltageDevTotalTime = rateList.stream().mapToInt(RStatLimitRateDPO::getVoltageDevOvertime).sum();
|
||||
int ubalanceTotalTime = rateList.stream().mapToInt(RStatLimitRateDPO::getUbalanceOvertime).sum();
|
||||
@@ -316,11 +336,20 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
||||
@Override
|
||||
public List<TotalLimitStatisticsVO> totalLimitStatisticsList(TotalLimitStatisticsParam param) {
|
||||
List<TotalLimitStatisticsVO> result = new ArrayList<>();
|
||||
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return result;
|
||||
}
|
||||
List<RStatLimitRateDPO> rateList = this.list(new LambdaQueryWrapper<RStatLimitRateDPO>()
|
||||
.eq(RStatLimitRateDPO::getPhasicType, "T")
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
||||
.in(RStatLimitRateDPO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(RStatLimitRateDPO::getTime)
|
||||
);
|
||||
if (CollUtil.isEmpty(rateList)) {
|
||||
|
||||
@@ -89,9 +89,19 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
LimitExtentVO ubalance = new LimitExtentVO();
|
||||
ubalance.setCode("ubalance");
|
||||
ubalance.setName(indexMap.get(ubalance.getCode()));
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return result;
|
||||
}
|
||||
List<RStatLimitRateDetailDPO> detailList = this.list(new LambdaQueryWrapper<RStatLimitRateDetailDPO>()
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDetailDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDetailDPO::getTime, param.getSearchEndTime())
|
||||
.in(RStatLimitRateDetailDPO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(RStatLimitRateDetailDPO::getTime)
|
||||
);
|
||||
if (CollUtil.isNotEmpty(detailList)) {
|
||||
@@ -190,9 +200,19 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
||||
@Override
|
||||
public List<LimitCalendarVO> limitCalendarData(LimitCalendarQueryParam param) {
|
||||
List<LimitCalendarVO> result = new ArrayList<>();
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return result;
|
||||
}
|
||||
List<RStatLimitRateDetailDPO> detailList = this.list(new LambdaQueryWrapper<RStatLimitRateDetailDPO>()
|
||||
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDetailDPO::getTime, param.getSearchBeginTime())
|
||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDetailDPO::getTime, param.getSearchEndTime())
|
||||
.in(RStatLimitRateDetailDPO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(RStatLimitRateDetailDPO::getTime)
|
||||
);
|
||||
if (CollUtil.isEmpty(detailList)) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.njcn.csharmonic.service.impl.event;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -13,7 +13,6 @@ import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.enums.CsEventEnum;
|
||||
import com.njcn.csharmonic.enums.CsTransientEnum;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
|
||||
@@ -24,9 +23,9 @@ import com.njcn.csharmonic.service.event.EventOverviewService;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
Reference in New Issue
Block a user