fix(service): 修复电压等级获取和服务调用中的空指针异常

- 在CsEventUserPOServiceImpl中添加空值检查避免map.get返回null时的异常
- 移除CsGroupController中多余的空行
- 在CsGroupServiceImpl中引入PqGovernPlanFeignClient并重构敏感用户趋势数据查询逻辑
- 修改系统服务中EPD PQD树形结构构建的名称设置逻辑
- 更新PqGovernPlan服务接口增加治理类型参数支持
- 优化LineTargetServiceImpl中目标标签解析逻辑
- 在PqGovernPlanFeignClient中添加根据ID查询治理方案的接口方法
- 为PqGovernPlanClientFallbackFactory添加getById方法的降级处理
- 修复PqSensitiveUserServiceImpl中用户设备树构建的数据获取逻辑
- 重构RStatLimitRateDServiceImpl中限值统计结果分页和数据显示逻辑
This commit is contained in:
xy
2026-06-22 19:31:09 +08:00
parent de60b53dd1
commit 57d5b159ef
12 changed files with 100 additions and 97 deletions

View File

@@ -179,9 +179,5 @@ public class CsGroupController extends BaseController {
Map<String,List<ThdDataVO>> result = csGroupService.sensitiveUserTrendData(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -39,8 +39,10 @@ import com.njcn.csdevice.service.ICsLedgerService;
import com.njcn.csdevice.util.InfluxDbParamUtil;
import com.njcn.csdevice.utils.DataChangeUtil;
import com.njcn.csharmonic.api.EventFeignClient;
import com.njcn.csharmonic.api.PqGovernPlanFeignClient;
import com.njcn.csharmonic.constant.HarmonicConstant;
import com.njcn.csharmonic.param.*;
import com.njcn.csharmonic.pojo.po.PqGovernPlan;
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.device.biz.mapper.OverLimitWlMapper;
@@ -51,7 +53,6 @@ import com.njcn.influx.pojo.dto.StatisticalDataDTO;
import com.njcn.influx.service.CommonService;
import com.njcn.influx.service.EvtDataService;
import com.njcn.system.api.*;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.po.EleEvtParm;
import com.njcn.system.pojo.vo.CsStatisticalSetVO;
@@ -112,6 +113,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
private final CsLinePOService csLinePOService;
private final PqGovernPlanFeignClient pqGovernPlanFeignClient;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -1336,12 +1338,10 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
}
result.put("before", new ArrayList<>());
result.put("after", new ArrayList<>());
String sensitiveUserId = param.getSensitiveUserId();
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(Collections.singletonList(sensitiveUserId)).getData();
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
CsLinePO loadSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(loadSideDictData.getId())).findFirst().orElse(null);
PqGovernPlan plan = pqGovernPlanFeignClient.getById(param.getSensitiveUserId()).getData();
if (Objects.isNull(plan)) {
return result;
}
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
@@ -1357,17 +1357,14 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
return queryParam;
}).collect(Collectors.toList());
trendDataQueryParam.setList(indexList);
if (loadSideLine != null) {
trendDataQueryParam.setLineId(loadSideLine.getLineId());
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
result.put("before", thdDataList);
}
if (gridSideLine != null) {
trendDataQueryParam.setLineId(gridSideLine.getLineId());
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
result.put("after", thdDataList);
}
//治理前
trendDataQueryParam.setLineId(plan.getGovernBefore());
List<ThdDataVO> thdDataList1 = this.trendData(trendDataQueryParam);
result.put("before", thdDataList1);
//治理后
trendDataQueryParam.setLineId(plan.getGovernAfter());
List<ThdDataVO> thdDataList2 = this.trendData(trendDataQueryParam);
result.put("after", thdDataList2);
return result;
}