1.暂降次数微调
2.报表接口调整
This commit is contained in:
@@ -39,7 +39,7 @@ public class MonitorSendController extends BaseController {
|
||||
@ApiOperation("国网上送接口")
|
||||
@ApiImplicitParam(name = "param",value = "请求体",required = true)
|
||||
public HttpResult<String> windSend(@RequestBody @Validated MonitorParam.Info param){
|
||||
String methodDescribe = getMethodDescribe("sendType");
|
||||
String methodDescribe = getMethodDescribe("windSend");
|
||||
String s = monitorSendService.sendType(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -1334,6 +1334,12 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
|
||||
for (OracleTerminalExcel oracleTerminalExcel : oracleTerminalExcelList) {
|
||||
//单位
|
||||
if(oracleTerminalExcel.getGdName().equals("省检修")){
|
||||
oracleTerminalExcel.setGdName("国网河北超高压公司本部");
|
||||
}else {
|
||||
oracleTerminalExcel.setGdName("国网"+oracleTerminalExcel.getGdName()+"本部");
|
||||
}
|
||||
|
||||
if (!mapDept.containsKey(oracleTerminalExcel.getGdName())) {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "单位名称不存在,请确认单位名称是否正确"));
|
||||
continue;
|
||||
@@ -1524,8 +1530,11 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
LambdaQueryWrapper<Monitor> monitorLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
monitorLambdaQueryWrapper.eq(Monitor::getLineId, lineId)
|
||||
.eq(Monitor::getName, oracleTerminalExcel.getLineName());
|
||||
Monitor monitor = monitorMapper.selectOne(monitorLambdaQueryWrapper);
|
||||
List<Monitor> monitorList = monitorMapper.selectList(monitorLambdaQueryWrapper);
|
||||
|
||||
if(CollUtil.isNotEmpty(monitorList)) {
|
||||
|
||||
for (Monitor monitor : monitorList) {
|
||||
|
||||
//当前电站下面没有监测点,可以新增
|
||||
Monitor monitorPO = new Monitor();
|
||||
@@ -1611,32 +1620,58 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
monitorPO.setMonitorObjectName(oracleTerminalExcel.getObjName());
|
||||
|
||||
|
||||
|
||||
if(oracleTerminalExcel.getLoadType().equals("电加热负荷") || oracleTerminalExcel.getLoadType().equals("商业/市政/民用/电子通讯负荷") ||oracleTerminalExcel.getLoadType().equals("其他非线性负荷")){
|
||||
if (objTypeDicMap.containsKey(oracleTerminalExcel.getLoadType())) {
|
||||
if (oracleTerminalExcel.getLoadType().equals("电加热负荷") ||oracleTerminalExcel.getLoadType().equals("轧机") || oracleTerminalExcel.getLoadType().equals("其他非线性负荷")) {
|
||||
if (objTypeDicMap.containsKey("冶炼负荷")) {
|
||||
String objTypeId = objTypeDicMap.get("冶炼负荷").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "字典监测标签不存在,请确认后重试"));
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "冶炼负荷字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
}else if(oracleTerminalExcel.getLoadType().equals("半导体制造") ||oracleTerminalExcel.getLoadType().equals("精密加工")){
|
||||
if (objTypeDicMap.containsKey(oracleTerminalExcel.getLoadType())) {
|
||||
String objTypeId = objTypeDicMap.get("重要或敏感用户").getId();
|
||||
} else if (oracleTerminalExcel.getLoadType().equals("商业/市政/民用/电子通讯负荷")) {
|
||||
if (objTypeDicMap.containsKey("城市商业")) {
|
||||
String objTypeId = objTypeDicMap.get("城市商业").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "字典监测标签不存在,请确认后重试"));
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "城市商业字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if (oracleTerminalExcel.getLoadType().equals("半导体制造") || oracleTerminalExcel.getLoadType().equals("精密加工")) {
|
||||
if (objTypeDicMap.containsKey("敏感用户")) {
|
||||
String objTypeId = objTypeDicMap.get("敏感用户").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "敏感用户字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if (oracleTerminalExcel.getLoadType().equals("二类变电站") || oracleTerminalExcel.getLoadType().equals("三类变电站") || oracleTerminalExcel.getLoadType().equals("四类变电站")) {
|
||||
if (objTypeDicMap.containsKey(oracleTerminalExcel.getLoadType())) {
|
||||
String objTypeId = objTypeDicMap.get("主变低压侧").getId();
|
||||
if (objTypeDicMap.containsKey("主变高压侧")) {
|
||||
String objTypeId = objTypeDicMap.get("主变高压侧").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
}else if(oracleTerminalExcel.getLoadType().equals("跨省计量关口")){
|
||||
if (objTypeDicMap.containsKey("跨省联络线")) {
|
||||
String objTypeId = objTypeDicMap.get("跨省联络线").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "跨省联络线字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
|
||||
}else if(oracleTerminalExcel.getLoadType().equals("光伏电站")){
|
||||
if (objTypeDicMap.containsKey("光伏电站")) {
|
||||
String objTypeId = objTypeDicMap.get("光伏电站").getId();
|
||||
monitorPO.setMonitorTag(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, "光伏电站字典监测标签不存在,请确认后重试"));
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (objTypeDicMap.containsKey(oracleTerminalExcel.getLoadType())) {
|
||||
String objTypeId = objTypeDicMap.get(oracleTerminalExcel.getLoadType()).getId();
|
||||
@@ -1653,6 +1688,9 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
if (objTypeMap.containsKey(oracleTerminalExcel.getLoadType())) {
|
||||
String objTypeId = objTypeMap.get(oracleTerminalExcel.getLoadType()).getId();
|
||||
monitorPO.setObjType(objTypeId);
|
||||
}else if(oracleTerminalExcel.getLoadType().equals("电加热负荷")){
|
||||
String objTypeId = objTypeMap.get("电加热负荷(含电弧炉、中频炉、电热炉、单/多晶硅生产设备)").getId();
|
||||
monitorPO.setObjType(objTypeId);
|
||||
} else {
|
||||
oracleTerminalExcelMsg.add(assembleMsg(oracleTerminalExcel, oracleTerminalExcel.getLoadType() + "字典监测点对象类型不存在,请确认后重试"));
|
||||
continue;
|
||||
@@ -1711,8 +1749,6 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (Objects.isNull(lineBak) && Objects.isNull(monitor)) {
|
||||
monitorPO.setIsUpToGrid(0);
|
||||
monitorMapper.insert(monitorPO);
|
||||
@@ -1756,6 +1792,9 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class RmpEventDetailController extends BaseController {
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getImMonitorEvents")
|
||||
@ApiOperation("暂降事件记录")
|
||||
@ApiOperation("查询重要监测点指定时间发生的暂降次数")
|
||||
public HttpResult<List<Map<String,Object>>> getImMonitorEvents(@RequestBody EventBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getImMonitorEvents");
|
||||
List<Map<String,Object>> result = rmpEventDetailService.getImMonitorEvents(param);
|
||||
|
||||
@@ -399,6 +399,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getImMonitorEvents(EventBaseParam param) {
|
||||
List<Map<String,Object>> mapList = new ArrayList<>();
|
||||
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(),DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(),DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
||||
|
||||
@@ -408,6 +409,9 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
queryWrapper.eq("measurement_point_id",param.getSearchValue());
|
||||
}else {
|
||||
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),param.getDeptId()).getData();
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
return mapList;
|
||||
}
|
||||
queryWrapper.in("measurement_point_id",lineIds);
|
||||
}
|
||||
|
||||
@@ -415,13 +419,17 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
queryWrapper.select("measurement_point_id as lineId","count(event_id) as eventCount").between("start_time",param.getSearchBeginTime(),param.getSearchEndTime())
|
||||
.eq("event_type",eventDic.getId())
|
||||
.groupBy("measurement_point_id");
|
||||
List<Map<String,Object>> mapList = this.baseMapper.selectMaps(queryWrapper);
|
||||
mapList = this.baseMapper.selectMaps(queryWrapper);
|
||||
if(CollUtil.isEmpty(mapList)){
|
||||
return mapList;
|
||||
}
|
||||
List<String> ids = mapList.stream().map(it->it.get("lineId").toString()).distinct().collect(Collectors.toList());
|
||||
List<Line> lineList = lineFeignClient.getBaseLineList(ids).getData();
|
||||
Map<String,Line> lineMap = lineList.stream().collect(Collectors.toMap(Line::getId,Function.identity()));
|
||||
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(ids).getData();
|
||||
Map<String,AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
||||
|
||||
mapList.forEach(item->{
|
||||
item.put("lineName",lineMap.get(item.get("lineId")).getName());
|
||||
AreaLineInfoVO tem = lineMap.get(item.get("lineId").toString());
|
||||
item.put("lineName",tem.getVoltageName()+"_"+tem.getLineName());
|
||||
});
|
||||
|
||||
return mapList;
|
||||
|
||||
@@ -74,6 +74,10 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -112,6 +116,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
|
||||
private final WlRecordFeignClient wlRecordFeignClient;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addCustomReportTemplate(ReportTemplateParam reportTemplateParam) {
|
||||
checkName(reportTemplateParam, false);
|
||||
@@ -261,8 +268,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<ReportTreeVO> reportChooseTree() {
|
||||
DictData dic = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.CS_DATA_TYPE.getName(), DicDataEnum.EPD.getName()).getData();
|
||||
@@ -598,6 +603,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
System.out.println(sql);
|
||||
|
||||
long l = System.currentTimeMillis();
|
||||
|
||||
|
||||
List<Map<String, Object>> mapList = SqlRunner.db().selectList(sql.toString());
|
||||
|
||||
long la = System.currentTimeMillis();
|
||||
@@ -652,6 +659,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
*/
|
||||
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
|
||||
List<Future<?>> futures = new ArrayList<>();
|
||||
|
||||
long begin = System.currentTimeMillis();
|
||||
|
||||
@@ -688,7 +696,11 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
//定义存放越限指标的map
|
||||
Map<String, ReportTemplateDTO> assNoPassMap = new HashMap<>();
|
||||
long deal = System.currentTimeMillis();
|
||||
|
||||
|
||||
|
||||
classMap.forEach((classKey, templateValue) -> {
|
||||
|
||||
Map<String, List<ReportTemplateDTO>> valueTypeMap = templateValue.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getStatMethod));
|
||||
//avg.max,min,cp95
|
||||
valueTypeMap.forEach((valueTypeKey, valueTypeVal) -> {
|
||||
@@ -696,6 +708,7 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
//相别分组
|
||||
Map<String, List<ReportTemplateDTO>> phaseMap = valueTypeVal.stream().collect(Collectors.groupingBy(ReportTemplateDTO::getPhase));
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
futures.add(executorService.submit(() -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlNew(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
@@ -706,11 +719,25 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assSqlNew(phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap);
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 等待所有任务完成
|
||||
for (Future<?> future : futures) {
|
||||
try {
|
||||
future.get(); // 这会阻塞直到任务完成或抛出异常
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//处理指标最终判定合格还是不合格
|
||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||
|
||||
@@ -819,7 +846,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
* @author cdf
|
||||
* @date 2023/10/20
|
||||
*/
|
||||
private void parseTemplate(JSONArray jsonArray, List<ReportTemplateDTO> reportTemplateDTOList, List<ReportTemplateDTO> reportLimitList, List<ReportTemplateDTO> terminalList) {
|
||||
private void parseTemplate (JSONArray
|
||||
jsonArray, List < ReportTemplateDTO > reportTemplateDTOList, List < ReportTemplateDTO > reportLimitList, List < ReportTemplateDTO > terminalList)
|
||||
{
|
||||
try {
|
||||
//通过文件服务器获取
|
||||
|
||||
@@ -898,7 +927,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
* @author cdf
|
||||
* @date 2023/10/23
|
||||
*/
|
||||
private Map<String, Float> overLimitDeal(List<ReportTemplateDTO> reportLimitList, ReportSearchParam reportSearchParam) {
|
||||
private Map<String, Float> overLimitDeal (List < ReportTemplateDTO > reportLimitList, ReportSearchParam
|
||||
reportSearchParam){
|
||||
Map<String, Float> limitMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(reportLimitList)) {
|
||||
StringBuilder sql = new StringBuilder("select ");
|
||||
@@ -950,7 +980,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
|
||||
|
||||
private void analyzeReportZhejiang(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, HttpServletResponse response) {
|
||||
private void analyzeReportZhejiang (ReportSearchParam reportSearchParam, ExcelRptTemp
|
||||
excelRptTemp, HttpServletResponse response){
|
||||
|
||||
//指标
|
||||
List<ReportTemplateDTO> reportTemplateDTOList = new ArrayList<>();
|
||||
@@ -966,10 +997,6 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||
}
|
||||
|
||||
|
||||
long temEnd = System.currentTimeMillis();
|
||||
|
||||
|
||||
//处理指标是否合格
|
||||
reportLimitList = new LinkedHashSet<>(reportLimitList)
|
||||
.stream()
|
||||
@@ -1063,7 +1090,10 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
|
||||
|
||||
private void assSqlZhejiang(List<ReportTemplateDTO> data, StringBuilder sql, List<ReportTemplateDTO> endList, String method, ReportSearchParam reportSearchParam, Map<String, ReportTemplateDTO> limitMap, Map<String, Float> overLimitMap, Map<String, ReportTemplateDTO> assNoPassMap, List<WlRecord> wlRecordList) {
|
||||
private void assSqlZhejiang (List < ReportTemplateDTO > data, StringBuilder
|
||||
sql, List < ReportTemplateDTO > endList, String method, ReportSearchParam
|
||||
reportSearchParam, Map < String, ReportTemplateDTO > limitMap, Map < String, Float > overLimitMap, Map < String, ReportTemplateDTO > assNoPassMap, List < WlRecord > wlRecordList)
|
||||
{
|
||||
//sql拼接示例:select MAX(IHA2) as IHA2 from power_quality_data where Phase = 'A' and LineId='1324564568' and Stat_Method='max' tz('Asia/Shanghai')
|
||||
//cp95函数特殊处理 PERCENTILE(field_key, N)
|
||||
if (InfluxDbSqlConstant.PERCENTILE.equals(method)) {
|
||||
@@ -1249,7 +1279,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
|
||||
|
||||
private void dealExcelResult(JSONArray jsonArray,Map<String,List<ReportTemplateDTO>> assMap,Map<String,String> unit){
|
||||
private void dealExcelResult (JSONArray
|
||||
jsonArray, Map < String, List < ReportTemplateDTO >> assMap, Map < String, String > unit){
|
||||
jsonArray.forEach(item -> {
|
||||
JSONObject jsonObject = (JSONObject) item;
|
||||
JSONArray itemArr = (JSONArray) jsonObject.get("celldata");
|
||||
@@ -1317,7 +1348,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
/**
|
||||
* 处理指标超标结论
|
||||
*/
|
||||
private void dealTargetResult(Map<String,ReportTemplateDTO> assNoPassMap,Map<String,ReportTemplateDTO> limitTargetMapX,List<ReportTemplateDTO> endList){
|
||||
private void dealTargetResult
|
||||
(Map < String, ReportTemplateDTO > assNoPassMap, Map < String, ReportTemplateDTO > limitTargetMapX, List < ReportTemplateDTO > endList)
|
||||
{
|
||||
assNoPassMap.forEach((key, val) -> {
|
||||
limitTargetMapX.remove(key);
|
||||
if ("Voltage_Dev".equals(val.getTemplateName()) || "Freq_Dev".equals(val.getTemplateName())) {
|
||||
@@ -1348,7 +1381,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
* @author cdf
|
||||
* @date 2023/10/20
|
||||
*/
|
||||
private void parseTemplateZhejiang(JSONArray jsonArray, List<ReportTemplateDTO> reportTemplateDTOList, List<ReportTemplateDTO> reportLimitList, List<ReportTemplateDTO> terminalList) {
|
||||
private void parseTemplateZhejiang (JSONArray
|
||||
jsonArray, List < ReportTemplateDTO > reportTemplateDTOList, List < ReportTemplateDTO > reportLimitList, List < ReportTemplateDTO > terminalList)
|
||||
{
|
||||
try {
|
||||
//通过文件服务器获取
|
||||
|
||||
|
||||
Reference in New Issue
Block a user