Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be6628fe35 | ||
|
|
6c7ca8eb46 | ||
|
|
5dff7c6ff8 | ||
| a96fce38be | |||
|
|
27841f0f4e | ||
|
|
35cd056870 | ||
| 3d29e5a64c | |||
|
|
a7d34296c7 | ||
|
|
cf7a2e04d5 | ||
|
|
8f0a739564 | ||
|
|
a627125a9e | ||
| ab1c777432 | |||
| 000e201ed7 | |||
|
|
9501880933 | ||
| c9896fd52d | |||
|
|
2524b13661 | ||
|
|
55f03e3244 | ||
| 8f5d9a13d8 | |||
|
|
a8c1498738 | ||
| 00fabe3b6b | |||
|
|
37f95daaf0 | ||
|
|
005f73e19d | ||
| 2a0367f1ff | |||
| 0e1605d9b3 | |||
|
|
e0cfcbccf8 | ||
|
|
43e7bc0e39 |
@@ -18,14 +18,17 @@
|
|||||||
b.logic_next nodeNext,
|
b.logic_next nodeNext,
|
||||||
d.Algo_Describe type
|
d.Algo_Describe type
|
||||||
FROM
|
FROM
|
||||||
|
pqs_tflgploy ploy,
|
||||||
pqs_tflgployass a,
|
pqs_tflgployass a,
|
||||||
pqs_tflgass b,
|
pqs_tflgass b,
|
||||||
pqs_transformer c,
|
pqs_transformer c,
|
||||||
sys_dict_data d
|
sys_dict_data d
|
||||||
WHERE
|
WHERE
|
||||||
a.tf_index = b.tf_index
|
ploy.TP_Index = a.TP_Index
|
||||||
|
and a.tf_index = b.tf_index
|
||||||
AND b.tf_index = c.tf_index
|
AND b.tf_index = c.tf_index
|
||||||
and c.Wiring = d.id
|
and c.Wiring = d.id
|
||||||
|
and ploy.Status = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -78,14 +78,6 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
public void processEvents(LocalDateTime startTime, LocalDateTime endTime, String deptId) {
|
public void processEvents(LocalDateTime startTime, LocalDateTime endTime, String deptId) {
|
||||||
TimeInterval timeInterval = new TimeInterval();
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
|
|
||||||
//获取节点和变压器配置信息
|
|
||||||
Map<String, Map<String, Integer>> nodeMap1 = getBeforeNodeInfo();
|
|
||||||
Set<Map.Entry<String, Map<String, Integer>>> nodeSort1 = nodeMap1.entrySet();
|
|
||||||
System.out.println(nodeSort1);
|
|
||||||
|
|
||||||
Map<String, EntityMtrans> entityMtransMap1 = getNodeInfo();
|
|
||||||
Set<Map.Entry<String, EntityMtrans>> setMtrans1 = entityMtransMap1.entrySet();
|
|
||||||
System.out.println(setMtrans1);
|
|
||||||
|
|
||||||
LocalDateTime date = LocalDateTime.now();
|
LocalDateTime date = LocalDateTime.now();
|
||||||
HandleEvent handleEvent = new HandleEvent();
|
HandleEvent handleEvent = new HandleEvent();
|
||||||
@@ -117,6 +109,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
|||||||
|
|
||||||
for (Map.Entry<String, Integer> mm : mapValue) {
|
for (Map.Entry<String, Integer> mm : mapValue) {
|
||||||
for (EntityGroupEvtData groupEvtData : baseList) {
|
for (EntityGroupEvtData groupEvtData : baseList) {
|
||||||
|
//矩阵只计算短路故障相关的事件,其他事件另行计算
|
||||||
if (groupEvtData.getNodePhysics().equals(mm.getKey()) && dictData.getId().equals(groupEvtData.getSagReason())) {
|
if (groupEvtData.getNodePhysics().equals(mm.getKey()) && dictData.getId().equals(groupEvtData.getSagReason())) {
|
||||||
groupEvtData.setNode(mm.getValue());
|
groupEvtData.setNode(mm.getValue());
|
||||||
list.add(groupEvtData);
|
list.add(groupEvtData);
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ public class RespDataResultServiceImpl extends ServiceImpl<RespDataResultMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<ResponsibilityResult> displayHistoryData(String id, Integer time) {
|
public List<ResponsibilityResult> displayHistoryData(String id, Integer time) {
|
||||||
List<ResponsibilityResult> responsibilityResults = new ArrayList<>();
|
List<ResponsibilityResult> responsibilityResults = new ArrayList<>();
|
||||||
//if (Objects.isNull(time)) {
|
RespData respDataQuery = respDataService.getById(id);
|
||||||
RespData respDataQuery = respDataService.getById(id);
|
String[] split = respDataQuery.getDataTimes().split(StrPool.COMMA);
|
||||||
String[] split = respDataQuery.getDataTimes().split(StrPool.COMMA);
|
if (Objects.isNull(time)) {
|
||||||
time = Integer.parseInt(split[0]);
|
time = Integer.parseInt(split[0]);
|
||||||
//}
|
}
|
||||||
LambdaQueryWrapper<RespDataResult> respDataResultLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RespDataResult> respDataResultLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
respDataResultLambdaQueryWrapper.eq(RespDataResult::getResDataId, id)
|
respDataResultLambdaQueryWrapper.eq(RespDataResult::getResDataId, id)
|
||||||
.eq(RespDataResult::getTime, time);
|
.eq(RespDataResult::getTime, time);
|
||||||
|
|||||||
@@ -1498,6 +1498,10 @@ public class RespDataServiceImpl extends ServiceImpl<RespDataMapper, RespData> i
|
|||||||
param.setLineIds(userList);
|
param.setLineIds(userList);
|
||||||
List<DataHarmPowerP> dataHarmPList = historyHarmonicService.getHarmonicPData(param);
|
List<DataHarmPowerP> dataHarmPList = historyHarmonicService.getHarmonicPData(param);
|
||||||
Map<String, List<DataHarmPowerP>> collect = dataHarmPList.stream().collect(Collectors.groupingBy(DataHarmPowerP::getLineId));
|
Map<String, List<DataHarmPowerP>> collect = dataHarmPList.stream().collect(Collectors.groupingBy(DataHarmPowerP::getLineId));
|
||||||
|
Set<String> lineIds = collect.keySet();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<DataHarmPowerP> result = new ArrayList<>();
|
List<DataHarmPowerP> result = new ArrayList<>();
|
||||||
collect.forEach((k,v)->{
|
collect.forEach((k,v)->{
|
||||||
LineDetailDataVO lineDetailData = lineService.getLineDetailData(k);
|
LineDetailDataVO lineDetailData = lineService.getLineDetailData(k);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.njcn.product.diagram.LedgerScale.pojo.dto.EventSourceDTO;
|
|||||||
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerBaseInfo;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.PqStation;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
||||||
import com.njcn.product.diagram.LedgerScale.service.LedgerScaleService;
|
import com.njcn.product.diagram.LedgerScale.service.LedgerScaleService;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
||||||
@@ -94,12 +94,12 @@ public class LedgerScaleController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
@GetMapping("/clickImage")
|
@PostMapping("/clickImage")
|
||||||
@ApiOperation("一次接线图点击事件")
|
@ApiOperation("一次接线图点击事件")
|
||||||
@ApiImplicitParam(name = "lineId", value = "查询参数", required = true)
|
@ApiImplicitParam(name = "lineId", value = "查询参数", required = true)
|
||||||
public HttpResult<EventLedgerVO> clickImage(@RequestParam("lineId")String lineId) {
|
public HttpResult<EventLedgerVO> clickImage(@RequestBody LargeScreenCountParam param) {
|
||||||
String methodDescribe = getMethodDescribe("clickImage");
|
String methodDescribe = getMethodDescribe("clickImage");
|
||||||
EventLedgerVO result = ledgerScaleService.clickImage(lineId);
|
EventLedgerVO result = ledgerScaleService.clickImage(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,4 +168,16 @@ public class LedgerScaleController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@PostMapping("/stationMap")
|
||||||
|
@ApiOperation("获取变电站详情")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<PqStation>> stationMap(@RequestBody LargeScreenCountParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("stationMap");
|
||||||
|
List<PqStation> result = ledgerScaleService.stationMap(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import com.njcn.product.diagram.LedgerScale.pojo.dto.EventSourceDTO;
|
|||||||
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerBaseInfo;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.PqStation;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
||||||
|
|
||||||
@@ -30,8 +30,7 @@ public interface LedgerScaleService {
|
|||||||
List<EventLedgerVO> hasUpEventList(LargeScreenCountParam param);
|
List<EventLedgerVO> hasUpEventList(LargeScreenCountParam param);
|
||||||
|
|
||||||
|
|
||||||
EventLedgerVO clickImage(String lineId);
|
EventLedgerVO clickImage(LargeScreenCountParam param);
|
||||||
|
|
||||||
Page<EventDetailVO> eventList(LargeScreenCountParam param);
|
Page<EventDetailVO> eventList(LargeScreenCountParam param);
|
||||||
|
|
||||||
Page<EventDetailVO> eventListByLineId(LargeScreenCountParam param);
|
Page<EventDetailVO> eventListByLineId(LargeScreenCountParam param);
|
||||||
@@ -44,4 +43,6 @@ public interface LedgerScaleService {
|
|||||||
|
|
||||||
|
|
||||||
List<CustomerResponsibility> harmOneImage(String id, Integer time);
|
List<CustomerResponsibility> harmOneImage(String id, Integer time);
|
||||||
|
|
||||||
|
List<PqStation> stationMap(LargeScreenCountParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.product.diagram.LedgerScale.service.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
@@ -20,24 +19,25 @@ import com.njcn.product.advance.eventSource.pojo.po.RmpEventDetailAssPO;
|
|||||||
import com.njcn.product.advance.harmonicUp.mapper.UpHarmonicDetailMapper;
|
import com.njcn.product.advance.harmonicUp.mapper.UpHarmonicDetailMapper;
|
||||||
import com.njcn.product.advance.harmonicUp.pojo.po.UpHarmonicDetail;
|
import com.njcn.product.advance.harmonicUp.pojo.po.UpHarmonicDetail;
|
||||||
import com.njcn.product.advance.responsility.mapper.RespDataResultMapper;
|
import com.njcn.product.advance.responsility.mapper.RespDataResultMapper;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerData;
|
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
import com.njcn.product.advance.responsility.pojo.dto.CustomerResponsibility;
|
||||||
import com.njcn.product.advance.responsility.pojo.dto.ResponsibilityResult;
|
|
||||||
import com.njcn.product.advance.responsility.pojo.po.RespDataResult;
|
import com.njcn.product.advance.responsility.pojo.po.RespDataResult;
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsConfigurationPO;
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss;
|
||||||
|
import com.njcn.product.cnzutai.zutai.service.CsConfigurationService;
|
||||||
|
import com.njcn.product.cnzutai.zutai.service.CsSubConfigurationAssService;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.dto.EventSourceDTO;
|
import com.njcn.product.diagram.LedgerScale.pojo.dto.EventSourceDTO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
import com.njcn.product.diagram.LedgerScale.pojo.dto.LedgerScaleDTO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
import com.njcn.product.diagram.LedgerScale.pojo.vo.EventLedgerVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.mapper.LineMapper;
|
import com.njcn.product.terminal.mysqlTerminal.mapper.*;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.mapper.UserReportPOMapper;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.enums.LineBaseEnum;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.po.UserReportPO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Line;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.PqStation;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
|
||||||
import com.njcn.product.diagram.LedgerScale.service.LedgerScaleService;
|
import com.njcn.product.diagram.LedgerScale.service.LedgerScaleService;
|
||||||
import com.njcn.product.system.dict.mapper.DictDataMapper;
|
import com.njcn.product.system.dict.mapper.DictDataMapper;
|
||||||
import com.njcn.product.system.dict.pojo.enums.DicDataTypeEnum;
|
import com.njcn.product.system.dict.pojo.enums.DicDataTypeEnum;
|
||||||
import com.njcn.product.system.dict.pojo.po.DictData;
|
import com.njcn.product.system.dict.pojo.po.DictData;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.mapper.LedgerScaleMapper;
|
|
||||||
import com.njcn.product.terminal.mysqlTerminal.mapper.RmpEventDetailMapper;
|
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerBaseInfo;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerBaseInfo;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.enums.RunFlagEnum;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.enums.RunFlagEnum;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.param.LargeScreenCountParam;
|
||||||
@@ -51,7 +51,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -80,9 +79,10 @@ public class LedgerScaleServiceImpl implements LedgerScaleService {
|
|||||||
private final RespDataResultMapper respDataResultMapper;
|
private final RespDataResultMapper respDataResultMapper;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final UserReportPOMapper userReportPOMapper;
|
|
||||||
private final UpHarmonicDetailMapper upHarmonicDetailMapper;
|
private final UpHarmonicDetailMapper upHarmonicDetailMapper;
|
||||||
|
private final PqStationMapper pqStationMapper;
|
||||||
|
private final CsSubConfigurationAssService csSubConfigurationAssService;
|
||||||
|
private final CsConfigurationService csConfigurationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LedgerScaleDTO ledgerScaleStatistic(LargeScreenCountParam param) {
|
public LedgerScaleDTO ledgerScaleStatistic(LargeScreenCountParam param) {
|
||||||
@@ -281,16 +281,18 @@ public class LedgerScaleServiceImpl implements LedgerScaleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventLedgerVO clickImage(String lineId) {
|
public EventLedgerVO clickImage(LargeScreenCountParam param) {
|
||||||
List<LedgerBaseInfo> ledgerBaseInfoList = ledgerScaleMapper.getLedgerBaseInfo(Stream.of(lineId).collect(Collectors.toList()));
|
List<LedgerBaseInfo> ledgerBaseInfoList = ledgerScaleMapper.getLedgerBaseInfo(Stream.of(param.getLineId()).collect(Collectors.toList()));
|
||||||
if (CollUtil.isEmpty(ledgerBaseInfoList)) {
|
if (CollUtil.isEmpty(ledgerBaseInfoList)) {
|
||||||
throw new BusinessException(CommonResponseEnum.FAIL, "当前节点未查询到测点信息");
|
throw new BusinessException(CommonResponseEnum.FAIL, "当前节点未查询到测点信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
EventLedgerVO eventLedgerVO = new EventLedgerVO();
|
EventLedgerVO eventLedgerVO = new EventLedgerVO();
|
||||||
BeanUtil.copyProperties(ledgerBaseInfoList.get(0), eventLedgerVO);
|
BeanUtil.copyProperties(ledgerBaseInfoList.get(0), eventLedgerVO);
|
||||||
|
DateTime start = DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()));
|
||||||
|
DateTime end = DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()));
|
||||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(RmpEventDetailPO::getLineId, lineId);
|
lambdaQueryWrapper.eq(RmpEventDetailPO::getLineId, param.getLineId()).between(RmpEventDetailPO::getStartTime, start, end).orderByDesc(RmpEventDetailPO::getStartTime);;
|
||||||
List<RmpEventDetailPO> rmpEventDetailPOList = rmpEventDetailMapper.selectList(lambdaQueryWrapper);
|
List<RmpEventDetailPO> rmpEventDetailPOList = rmpEventDetailMapper.selectList(lambdaQueryWrapper);
|
||||||
|
|
||||||
List<DictData> dictDataList = dictDataMapper.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode());
|
List<DictData> dictDataList = dictDataMapper.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode());
|
||||||
@@ -301,6 +303,7 @@ public class LedgerScaleServiceImpl implements LedgerScaleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<EventDetailVO> eventList(LargeScreenCountParam param) {
|
public Page<EventDetailVO> eventList(LargeScreenCountParam param) {
|
||||||
Page<EventDetailVO> result = new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param));
|
Page<EventDetailVO> result = new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param));
|
||||||
@@ -489,5 +492,42 @@ public class LedgerScaleServiceImpl implements LedgerScaleService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqStation> stationMap(LargeScreenCountParam param) {
|
||||||
|
List<PqStation> result = new ArrayList<>();
|
||||||
|
List<String> runIds = commGeneralService.getRunLineIdsByDept(param.getDeptId());
|
||||||
|
if(CollUtil.isEmpty(runIds)){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,runIds));
|
||||||
|
List<String> stationIds = lineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).distinct().collect(Collectors.toList());
|
||||||
|
List<Line> stationResult = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,stationIds));
|
||||||
|
List<String> ids = stationResult.stream().map(Line::getId).distinct().collect(Collectors.toList());
|
||||||
|
List<PqStation> pqStationList = pqStationMapper.selectList(new LambdaQueryWrapper<PqStation>().in(PqStation::getId,ids));
|
||||||
|
Map<String, PqStation> substationMap = pqStationList.stream().collect(Collectors.toMap(PqStation::getId, po->po));
|
||||||
|
stationResult.forEach(it->{
|
||||||
|
PqStation pqStation = new PqStation();
|
||||||
|
if(substationMap.containsKey(it.getId())){
|
||||||
|
PqStation tem = substationMap.get(it.getId());
|
||||||
|
pqStation.setLng(tem.getLng());
|
||||||
|
pqStation.setLat(tem.getLat());
|
||||||
|
}
|
||||||
|
pqStation.setId(it.getId());
|
||||||
|
pqStation.setName(it.getName());
|
||||||
|
CsSubConfigurationAss one = csSubConfigurationAssService.lambdaQuery().eq(CsSubConfigurationAss::getSubId, it.getId()).one();
|
||||||
|
if(Objects.isNull(one)){
|
||||||
|
pqStation.setBindFlag(false);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
CsConfigurationPO csConfigurationPO = csConfigurationService.lambdaQuery().eq(CsConfigurationPO::getId, one.getConfigId()).one();
|
||||||
|
pqStation.setBindFlag(true);
|
||||||
|
pqStation.setConfigId(csConfigurationPO.getId());
|
||||||
|
pqStation.setConfigName(csConfigurationPO.getName());
|
||||||
|
}
|
||||||
|
result.add(pqStation);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.njcn.product.terminal.device.service;
|
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.pojo.dto.OracleLedgerTreeDTO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface LedgerTreeService {
|
|
||||||
|
|
||||||
List<OracleLedgerTreeDTO> getTree();
|
|
||||||
}
|
|
||||||
@@ -54,17 +54,31 @@ public class EventGateServiceImpl implements EventGateService {
|
|||||||
String lineid = eventDetail.getLineId();
|
String lineid = eventDetail.getLineId();
|
||||||
LedgerBaseInfo pqLine = ledgerScaleMapper.getLedgerBaseInfo(Stream.of(lineid).collect(Collectors.toList())).get(0);
|
LedgerBaseInfo pqLine = ledgerScaleMapper.getLedgerBaseInfo(Stream.of(lineid).collect(Collectors.toList())).get(0);
|
||||||
String waveName = eventDetail.getWavePath();
|
String waveName = eventDetail.getWavePath();
|
||||||
String cfgPath, datPath;
|
String cfgPath, datPath,cfgPath1,datPath1;
|
||||||
|
InputStream cfgStream,datStream;
|
||||||
if (StrUtil.isBlank(waveName)) {
|
if (StrUtil.isBlank(waveName)) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
cfgPath = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".CFG";
|
try {
|
||||||
datPath = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".DAT";
|
cfgPath = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".CFG";
|
||||||
log.info("本地磁盘波形文件路径----" + cfgPath);
|
datPath = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".DAT";
|
||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
|
||||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
|
||||||
|
log.info("本地磁盘波形文件路径----" + cfgPath);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
cfgPath1 = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".cfg";
|
||||||
|
datPath1 = generalInfo.getBusinessWavePath()+ File.separator+pqLine.getIp()+"/"+waveName+".dat";
|
||||||
|
cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath1);
|
||||||
|
datStream = waveFileComponent.getFileInputStreamByFilePath(datPath1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
|
||||||
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
|
|
||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.njcn.product.terminal.mysqlTerminal.controller;
|
package com.njcn.product.terminal.mysqlTerminal.controller;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.product.terminal.device.service.LedgerTreeService;
|
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerTreeDTO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerTreeDTO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.enums.StatisticsEnum;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.enums.StatisticsEnum;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.param.DeviceInfoParam;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.param.DeviceInfoParam;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.njcn.common.pojo.annotation.OperateInfo;
|
|||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.OracleLedgerTreeDTO;
|
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerTreeDTO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerTreeDTO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.service.LineService;
|
import com.njcn.product.terminal.mysqlTerminal.service.LineService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.njcn.product.terminal.mysqlTerminal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.PqStation;
|
||||||
|
|
||||||
|
public interface PqStationMapper extends BaseMapper<PqStation> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
and (dev.name like CONCAT('%', #{searchValue}, '%')
|
and (dev.name like CONCAT('%', #{searchValue}, '%')
|
||||||
or a.name like CONCAT('%', #{searchValue}, '%'))
|
or a.name like CONCAT('%', #{searchValue}, '%'))
|
||||||
</if>
|
</if>
|
||||||
order by c.name,a.name
|
<!-- order by c.name,a.name-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getLineList" resultType="TerminalShowVO">
|
<select id="getLineList" resultType="TerminalShowVO">
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
or a.name like CONCAT('%', #{searchValue}, '%')
|
or a.name like CONCAT('%', #{searchValue}, '%')
|
||||||
or c.name like CONCAT('%', #{searchValue}, '%'))
|
or c.name like CONCAT('%', #{searchValue}, '%'))
|
||||||
</if>
|
</if>
|
||||||
order by c.name,a.name
|
<!-- order by c.name,a.name-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMonitorDetail" resultType="com.njcn.product.terminal.mysqlTerminal.pojo.dto.LineDevGetDTO">
|
<select id="getMonitorDetail" resultType="com.njcn.product.terminal.mysqlTerminal.pojo.dto.LineDevGetDTO">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.njcn.product.terminal.mysqlTerminal.pojo.dto;
|
package com.njcn.product.terminal.mysqlTerminal.pojo.dto;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.pojo.dto.OracleLedgerTreeDTO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.product.terminal.mysqlTerminal.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2022-01-04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("pq_substation")
|
||||||
|
public class PqStation implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变电站序号
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压等级Id,字典表
|
||||||
|
*/
|
||||||
|
private String scale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private BigDecimal lng;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private BigDecimal lat;
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private boolean bindFlag;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String configId;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String configName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import com.njcn.product.terminal.mysqlTerminal.pojo.param.UserReportParam;
|
|||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Device;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Device;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Line;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Line;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.po.LineDetail;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.LineDetail;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.UserReportPO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDataVO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDataVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDetailDataVO;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalTree;
|
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalTree;
|
||||||
@@ -58,6 +59,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
private final LineDetailMapper lineDetailMapper;
|
private final LineDetailMapper lineDetailMapper;
|
||||||
private final AreaMapper areaMapper;
|
private final AreaMapper areaMapper;
|
||||||
private final VoltageMapper voltageMapper;
|
private final VoltageMapper voltageMapper;
|
||||||
|
private final UserReportPOMapper userReportPOMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LedgerTreeDTO> getTree() {
|
public List<LedgerTreeDTO> getTree() {
|
||||||
@@ -261,7 +263,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
lineDetailDataVO.setDevId(device.getId());
|
lineDetailDataVO.setDevId(device.getId());
|
||||||
lineDetailDataVO.setBusinessType(dictDataMapper.selectById(lineDetail.getBusinessType()).getName());
|
lineDetailDataVO.setBusinessType(dictDataMapper.selectById(lineDetail.getBusinessType()).getName());
|
||||||
lineDetailDataVO.setLoadType(dictDataMapper.selectById(lineDetail.getLoadType()).getName());
|
lineDetailDataVO.setLoadType(dictDataMapper.selectById(lineDetail.getLoadType()).getName());
|
||||||
lineDetailDataVO.setObjName(lineDetail.getObjName());
|
UserReportPO userReportPO = userReportPOMapper.selectById(lineDetail.getObjId());
|
||||||
|
if(Objects.nonNull(userReportPO)){
|
||||||
|
lineDetailDataVO.setObjName(userReportPO.getProjectName());
|
||||||
|
}else {
|
||||||
|
lineDetailDataVO.setObjName("/");
|
||||||
|
}
|
||||||
lineDetailDataVO.setId(lineDetail.getNum());
|
lineDetailDataVO.setId(lineDetail.getNum());
|
||||||
lineDetailDataVO.setPtType(TerminalUtils.ptType(lineDetail.getPtType()));
|
lineDetailDataVO.setPtType(TerminalUtils.ptType(lineDetail.getPtType()));
|
||||||
lineDetailDataVO.setPt(lineDetail.getPt1() + "/" + lineDetail.getPt2());
|
lineDetailDataVO.setPt(lineDetail.getPt1() + "/" + lineDetail.getPt2());
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqDeviceDetail;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqDeviceDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CN_Gather
|
* CN_Gather
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDeptDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDeptDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqDevice;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqDevice;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqGdCompany;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqGdCompany;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.LedgerBaseInfoDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqLine;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqLine;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqLinedetail;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqLinedetail;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.pojo.dto.SubstationDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.SubstationDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqSubstation;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqSubstation;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqsDeptsline;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqsDeptsline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.product.terminal.device.mapper;
|
package com.njcn.product.terminal.oracleDevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqsStationMap;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqsStationMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.product.terminal.device.mapper.PqDeviceMapper">
|
<mapper namespace="com.njcn.product.terminal.device.mapper.PqDeviceMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.device.pojo.po.PqDevice">
|
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.oracleDevice.pojo.po.PqDevice">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
<!--@Table PQ_DEVICE-->
|
<!--@Table PQ_DEVICE-->
|
||||||
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
|
<id column="DEV_INDEX" jdbcType="DECIMAL" property="devIndex" />
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
|
NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryListByIds" resultType="com.njcn.product.terminal.device.pojo.dto.DeviceDTO">
|
<select id="queryListByIds" resultType="com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDTO">
|
||||||
select
|
select
|
||||||
pq_device.dev_index devId,
|
pq_device.dev_index devId,
|
||||||
pq_device.name devName,
|
pq_device.name devName,
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceDTOPage" resultType="com.njcn.product.terminal.device.pojo.dto.DeviceDTO">
|
<select id="selectDeviceDTOPage" resultType="com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDTO">
|
||||||
|
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
pq_device.dev_index devId,
|
pq_device.dev_index devId,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.product.terminal.device.mapper.PqLineMapper">
|
<mapper namespace="com.njcn.product.terminal.device.mapper.PqLineMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.device.pojo.po.PqLine">
|
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.oracleDevice.pojo.po.PqLine">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
<!--@Table PQ_LINE-->
|
<!--@Table PQ_LINE-->
|
||||||
<id column="LINE_INDEX" jdbcType="DECIMAL" property="lineIndex" />
|
<id column="LINE_INDEX" jdbcType="DECIMAL" property="lineIndex" />
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
<select id="getBaseLineInfo" resultType="com.njcn.product.terminal.device.pojo.dto.LedgerBaseInfoDTO">
|
<select id="getBaseLineInfo" resultType="com.njcn.product.terminal.oracleDevice.pojo.dto.LedgerBaseInfoDTO">
|
||||||
|
|
||||||
WITH temp AS(
|
WITH temp AS(
|
||||||
select PQ_USER_LINE_ASS.LINE_INDEX LINE_INDEX,listagg(PQ_USER_LEDGER.CUSTOMER_NAME,';') within GROUP (order by PQ_USER_LEDGER.CUSTOMER_NAME) objName from PQ_USER_LINE_ASS ,PQ_USER_LEDGER where PQ_USER_LINE_ASS.USER_INDEX=PQ_USER_LEDGER.ID group by PQ_USER_LINE_ASS.LINE_INDEX
|
select PQ_USER_LINE_ASS.LINE_INDEX LINE_INDEX,listagg(PQ_USER_LEDGER.CUSTOMER_NAME,';') within GROUP (order by PQ_USER_LEDGER.CUSTOMER_NAME) objName from PQ_USER_LINE_ASS ,PQ_USER_LEDGER where PQ_USER_LINE_ASS.USER_INDEX=PQ_USER_LEDGER.ID group by PQ_USER_LINE_ASS.LINE_INDEX
|
||||||
@@ -62,7 +62,7 @@ where 1=1
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getBaseLedger" resultType="com.njcn.product.terminal.device.pojo.dto.LedgerBaseInfoDTO">
|
<select id="getBaseLedger" resultType="com.njcn.product.terminal.oracleDevice.pojo.dto.LedgerBaseInfoDTO">
|
||||||
select
|
select
|
||||||
PQ_GDINFORMATION.name gdName,
|
PQ_GDINFORMATION.name gdName,
|
||||||
pq_line.GD_INDEX gdIndex,
|
pq_line.GD_INDEX gdIndex,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.product.terminal.device.mapper.PqSubstationMapper">
|
<mapper namespace="com.njcn.product.terminal.device.mapper.PqSubstationMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.device.pojo.po.PqSubstation">
|
<resultMap id="BaseResultMap" type="com.njcn.product.terminal.oracleDevice.pojo.po.PqSubstation">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
<!--@Table PQ_SUBSTATION-->
|
<!--@Table PQ_SUBSTATION-->
|
||||||
<id column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
|
<id column="SUB_INDEX" jdbcType="DECIMAL" property="subIndex" />
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
SUB_INDEX, GD_INDEX, "NAME", "SCALE"
|
SUB_INDEX, GD_INDEX, "NAME", "SCALE"
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryListByIds" resultType="com.njcn.product.terminal.device.pojo.dto.SubstationDTO">
|
<select id="queryListByIds" resultType="com.njcn.product.terminal.oracleDevice.pojo.dto.SubstationDTO">
|
||||||
select
|
select
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
PQ_SUBSTATION.name stationName,
|
PQ_SUBSTATION.name stationName,
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.dto;
|
package com.njcn.product.terminal.oracleDevice.pojo.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.njcn.product.terminal.device.pojo.po;
|
package com.njcn.product.terminal.oracleDevice.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.njcn.product.terminal.oracleDevice.service;
|
||||||
|
|
||||||
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.OracleLedgerTreeDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LedgerTreeService {
|
||||||
|
|
||||||
|
List<OracleLedgerTreeDTO> getTree();
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.njcn.product.terminal.device.service;
|
package com.njcn.product.terminal.oracleDevice.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDTO;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDeptDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDeptDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqDevice;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqDevice;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.product.terminal.device.service;
|
package com.njcn.product.terminal.oracleDevice.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.LedgerBaseInfoDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqLine;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqLine;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.product.terminal.device.service;
|
package com.njcn.product.terminal.oracleDevice.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.SubstationDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.SubstationDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqSubstation;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqSubstation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.product.terminal.device.service;
|
package com.njcn.product.terminal.oracleDevice.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqsDeptsline;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqsDeptsline;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.njcn.product.terminal.device.service.impl;
|
package com.njcn.product.terminal.oracleDevice.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.product.terminal.device.mapper.PqDeviceMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqDeviceMapper;
|
||||||
import com.njcn.product.terminal.device.mapper.PqGdCompanyMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqGdCompanyMapper;
|
||||||
import com.njcn.product.terminal.device.mapper.PqLineMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqLineMapper;
|
||||||
import com.njcn.product.terminal.device.mapper.PqSubstationMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqSubstationMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.OracleLedgerTreeDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.OracleLedgerTreeDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqDevice;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqDevice;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqGdCompany;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqGdCompany;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqLine;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqLine;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqSubstation;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqSubstation;
|
||||||
import com.njcn.product.terminal.device.service.LedgerTreeService;
|
import com.njcn.product.terminal.oracleDevice.service.LedgerTreeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.njcn.product.terminal.device.service.impl;
|
package com.njcn.product.terminal.oracleDevice.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.mapper.PqDeviceMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqDeviceMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.DeviceDeptDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.DeviceDeptDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqDevice;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqDevice;
|
||||||
import com.njcn.product.terminal.device.service.PqDeviceService;
|
import com.njcn.product.terminal.oracleDevice.service.PqDeviceService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.njcn.product.terminal.device.service.impl;
|
package com.njcn.product.terminal.oracleDevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.product.terminal.device.mapper.PqLineMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqLineMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.LedgerBaseInfoDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqLine;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqLine;
|
||||||
import com.njcn.product.terminal.device.service.PqLineService;
|
import com.njcn.product.terminal.oracleDevice.service.PqLineService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.njcn.product.terminal.device.service.impl;
|
package com.njcn.product.terminal.oracleDevice.service.impl;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.mapper.PqSubstationMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqSubstationMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.dto.SubstationDTO;
|
import com.njcn.product.terminal.oracleDevice.pojo.dto.SubstationDTO;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqSubstation;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqSubstation;
|
||||||
import com.njcn.product.terminal.device.service.PqSubstationService;
|
import com.njcn.product.terminal.oracleDevice.service.PqSubstationService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.njcn.product.terminal.device.service.impl;
|
package com.njcn.product.terminal.oracleDevice.service.impl;
|
||||||
|
|
||||||
import com.njcn.product.terminal.device.mapper.PqsDeptslineMapper;
|
import com.njcn.product.terminal.oracleDevice.mapper.PqsDeptslineMapper;
|
||||||
import com.njcn.product.terminal.device.pojo.po.PqsDeptsline;
|
import com.njcn.product.terminal.oracleDevice.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.product.terminal.device.service.PqsDeptslineService;
|
import com.njcn.product.terminal.oracleDevice.service.PqsDeptslineService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
@@ -54,6 +54,12 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.product</groupId>
|
||||||
|
<artifactId>cn-terminal</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.njcn.product.cnzutai.zutai.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/11/04 上午 11:07【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsSubConfigurationAssMapper extends BaseMapper<CsSubConfigurationAss> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?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.product.cnzutai.zutai.mapper.CsSubConfigurationAssMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table cs_sub_configuration_ass-->
|
||||||
|
<id column="sub_id" jdbcType="VARCHAR" property="subId" />
|
||||||
|
<result column="config_id" jdbcType="VARCHAR" property="configId" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
sub_id, config_id
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
@@ -30,6 +30,8 @@ public class CsConfigurationParm {
|
|||||||
|
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
private List<String> substionIds;
|
||||||
|
|
||||||
|
|
||||||
private Integer orderBy;
|
private Integer orderBy;
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class CsPagePO extends BaseEntity {
|
|||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String COL_ID = "id";
|
public static final String COL_ID = "id";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.product.cnzutai.zutai.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/11/04 上午 11:07【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@TableName(value = "cs_sub_configuration_ass")
|
||||||
|
@Data
|
||||||
|
public class CsSubConfigurationAss {
|
||||||
|
/**
|
||||||
|
* 变电站序号
|
||||||
|
*/
|
||||||
|
@TableId(value = "sub_id", type = IdType.INPUT)
|
||||||
|
private String subId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组态id
|
||||||
|
*/
|
||||||
|
@TableField(value = "config_id")
|
||||||
|
private String configId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,6 +37,9 @@ public class CsConfigurationVO extends BaseEntity {
|
|||||||
|
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
private List<String> substionIds;
|
||||||
|
|
||||||
|
private List<String> substionName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "操作人")
|
@ApiModelProperty(value = "操作人")
|
||||||
private String operater;
|
private String operater;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.product.cnzutai.zutai.service;
|
||||||
|
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/11/04 上午 11:07【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface CsSubConfigurationAssService extends IService<CsSubConfigurationAss>{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.product.cnzutai.zutai.service.impl;
|
package com.njcn.product.cnzutai.zutai.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -11,11 +12,16 @@ import com.njcn.oss.constant.OssPath;
|
|||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.product.cnzutai.zutai.mapper.CsPagePOMapper;
|
import com.njcn.product.cnzutai.zutai.mapper.CsPagePOMapper;
|
||||||
import com.njcn.product.cnzutai.zutai.pojo.po.CsPagePO;
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsPagePO;
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss;
|
||||||
import com.njcn.product.cnzutai.zutai.service.CsConfigurationService;
|
import com.njcn.product.cnzutai.zutai.service.CsConfigurationService;
|
||||||
import com.njcn.product.cnzutai.zutai.mapper.CsConfigurationMapper;
|
import com.njcn.product.cnzutai.zutai.mapper.CsConfigurationMapper;
|
||||||
import com.njcn.product.cnzutai.zutai.pojo.param.CsConfigurationParm;
|
import com.njcn.product.cnzutai.zutai.pojo.param.CsConfigurationParm;
|
||||||
import com.njcn.product.cnzutai.zutai.pojo.po.CsConfigurationPO;
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsConfigurationPO;
|
||||||
import com.njcn.product.cnzutai.zutai.pojo.vo.CsConfigurationVO;
|
import com.njcn.product.cnzutai.zutai.pojo.vo.CsConfigurationVO;
|
||||||
|
import com.njcn.product.cnzutai.zutai.service.CsSubConfigurationAssService;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.mapper.LineMapper;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.mapper.PqStationMapper;
|
||||||
|
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Line;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -46,6 +52,8 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final CsPagePOMapper csPagePOMapper;
|
private final CsPagePOMapper csPagePOMapper;
|
||||||
|
private final CsSubConfigurationAssService csSubConfigurationAssService;
|
||||||
|
private final LineMapper lineMapper;
|
||||||
|
|
||||||
//private final UserFeignClient userFeignClient;
|
//private final UserFeignClient userFeignClient;
|
||||||
|
|
||||||
@@ -72,21 +80,44 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
csConfigurationPO.setStatus("1");
|
csConfigurationPO.setStatus("1");
|
||||||
boolean save = this.save(csConfigurationPO);
|
boolean save = this.save(csConfigurationPO);
|
||||||
|
|
||||||
|
|
||||||
String name = csConfigurationPO.getName();
|
String name = csConfigurationPO.getName();
|
||||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
||||||
if(count>1){
|
if(count>1){
|
||||||
throw new BusinessException("存在相同的组态项目名称");
|
throw new BusinessException("存在相同的组态项目名称");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//添加变电站绑定
|
||||||
|
if(!CollectionUtils.isEmpty(csConfigurationParm.getSubstionIds())){
|
||||||
|
List<CsSubConfigurationAss> list = csSubConfigurationAssService.lambdaQuery().in(CsSubConfigurationAss::getSubId, csConfigurationParm.getSubstionIds()).list();
|
||||||
|
if (!CollectionUtils.isEmpty(list)){
|
||||||
|
List<Line> stationResult = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,list));
|
||||||
|
String subNameList = stationResult.stream().map(Line::getName).collect(Collectors.joining(StrUtil.COMMA));
|
||||||
|
|
||||||
|
throw new BusinessException("变电站"+subNameList+"已绑定其他项目请修改");
|
||||||
|
}else {
|
||||||
|
List<CsSubConfigurationAss> csSubConfigurationAsses = csConfigurationParm.getSubstionIds().stream().map(temp -> {
|
||||||
|
CsSubConfigurationAss csSubConfigurationAss = new CsSubConfigurationAss();
|
||||||
|
csSubConfigurationAss.setSubId(temp);
|
||||||
|
csSubConfigurationAss.setConfigId(csConfigurationPO.getId());
|
||||||
|
return csSubConfigurationAss;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
csSubConfigurationAssService.saveBatch(csSubConfigurationAsses);
|
||||||
|
}
|
||||||
|
}
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
public boolean audit(CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||||
CsConfigurationPO tem = this.getById(auditParm.getId());
|
CsConfigurationPO tem = this.getById(auditParm.getId());
|
||||||
if(Objects.isNull(tem)){
|
if(Objects.isNull(tem)){
|
||||||
throw new BusinessException(CommonResponseEnum.FAIL,"未查询到项目信息,无法操作!");
|
throw new BusinessException(CommonResponseEnum.FAIL,"未查询到项目信息,无法操作!");
|
||||||
}
|
}
|
||||||
|
//删除关联表信息
|
||||||
|
csSubConfigurationAssService.lambdaUpdate().eq(CsSubConfigurationAss::getConfigId,tem.getId()).remove();
|
||||||
|
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
if(Objects.equals(auditParm.getStatus(),"0")){
|
if(Objects.equals(auditParm.getStatus(),"0")){
|
||||||
@@ -126,6 +157,26 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
|
|
||||||
boolean b = this.updateById(csConfigurationPO);
|
boolean b = this.updateById(csConfigurationPO);
|
||||||
|
|
||||||
|
//添加变电站绑定
|
||||||
|
if(!CollectionUtils.isEmpty(auditParm.getSubstionIds())){
|
||||||
|
List<CsSubConfigurationAss> list = csSubConfigurationAssService.lambdaQuery().in(CsSubConfigurationAss::getSubId, auditParm.getSubstionIds()).list();
|
||||||
|
if (!CollectionUtils.isEmpty(list)){
|
||||||
|
List<Line> stationResult = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,list));
|
||||||
|
String subNameList = stationResult.stream().map(Line::getName).collect(Collectors.joining(StrUtil.COMMA));
|
||||||
|
|
||||||
|
throw new BusinessException("变电站"+subNameList+"已绑定其他项目请修改");
|
||||||
|
}else {
|
||||||
|
List<CsSubConfigurationAss> csSubConfigurationAsses = auditParm.getSubstionIds().stream().map(temp -> {
|
||||||
|
CsSubConfigurationAss csSubConfigurationAss = new CsSubConfigurationAss();
|
||||||
|
csSubConfigurationAss.setSubId(temp);
|
||||||
|
csSubConfigurationAss.setConfigId(csConfigurationPO.getId());
|
||||||
|
return csSubConfigurationAss;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
csSubConfigurationAssService.saveBatch(csSubConfigurationAsses);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +249,14 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
List<CsSubConfigurationAss> csSubConfigurationAssList = csSubConfigurationAssService.lambdaQuery().eq(CsSubConfigurationAss::getConfigId, page.getId()).list();
|
||||||
|
if(!CollectionUtils.isEmpty(csSubConfigurationAssList)){
|
||||||
|
List<String> subIds = csSubConfigurationAssList.stream().map(CsSubConfigurationAss::getSubId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
csDevModelPageVO.setSubstionIds(subIds);
|
||||||
|
// List<Line> stationResult = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId,subIds));
|
||||||
|
// csDevModelPageVO.setSubstionName();
|
||||||
|
}
|
||||||
|
|
||||||
csDevModelPageVO.setOperater(collect2.get(csDevModelPageVO.getCreateBy()));
|
csDevModelPageVO.setOperater(collect2.get(csDevModelPageVO.getCreateBy()));
|
||||||
return csDevModelPageVO;
|
return csDevModelPageVO;
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class CsElementServiceImpl extends ServiceImpl<CsElementMapper, CsElement
|
|||||||
csElement.setPath(path);
|
csElement.setPath(path);
|
||||||
csElement.setStatus(1);
|
csElement.setStatus(1);
|
||||||
this.saveOrUpdate(csElement);
|
this.saveOrUpdate(csElement);
|
||||||
csElement.setPath(path);
|
|
||||||
return csElement;
|
return csElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
@@ -68,11 +70,14 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
|||||||
.lines()
|
.lines()
|
||||||
.collect(Collectors.joining("\n"));
|
.collect(Collectors.joining("\n"));
|
||||||
List<CsPagePO> csPagePOS = JSONUtil.toList(text, CsPagePO.class);
|
List<CsPagePO> csPagePOS = JSONUtil.toList(text, CsPagePO.class);
|
||||||
|
// 倒序排列
|
||||||
csPagePOS.forEach(temp->{
|
csPagePOS.forEach(temp->{
|
||||||
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(temp.getPath()), OssPath.CONFIGURATIONPATH, OssPath.CONFIGURATIONNAME);
|
String s = fileStorageUtil.uploadStream(writeJsonStringToInputStream(temp.getPath()), OssPath.CONFIGURATIONPATH, OssPath.CONFIGURATIONNAME);
|
||||||
temp.setPid(pid);
|
temp.setPid(pid);
|
||||||
temp.setStatus("1");
|
temp.setStatus("1");
|
||||||
temp.setPath(s);
|
temp.setPath(s);
|
||||||
|
temp.setCreateTime(LocalDateTime.now());
|
||||||
|
temp.setUpdateTime(LocalDateTime.now());
|
||||||
this.save(temp);
|
this.save(temp);
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -109,8 +114,8 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
|||||||
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsPagePO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq(StrUtil.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
queryWrapper.eq(StrUtil.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
||||||
like(StrUtil.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
like(StrUtil.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
||||||
eq ("status",1);
|
eq ("status",1).
|
||||||
// orderByAsc(CsPagePO.COL_KID)
|
orderByAsc("sort");
|
||||||
|
|
||||||
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.product.cnzutai.zutai.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.product.cnzutai.zutai.mapper.CsSubConfigurationAssMapper;
|
||||||
|
import com.njcn.product.cnzutai.zutai.pojo.po.CsSubConfigurationAss;
|
||||||
|
import com.njcn.product.cnzutai.zutai.service.CsSubConfigurationAssService;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/11/04 上午 11:07【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsSubConfigurationAssServiceImpl extends ServiceImpl<CsSubConfigurationAssMapper, CsSubConfigurationAss> implements CsSubConfigurationAssService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,13 +18,32 @@
|
|||||||
<version>0.0.1</version>
|
<version>0.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.njcn</groupId>-->
|
||||||
|
<!-- <artifactId>common-redis</artifactId>-->
|
||||||
|
<!-- <version>1.0.0</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>common-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
<version>1.0.0</version>
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.lettuce</groupId>
|
||||||
|
<artifactId>lettuce-core</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.15.1</version> <!-- 建议使用最新版本 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.njcn.product.event.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
|
||||||
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.cache.CacheManager;
|
||||||
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.connection.RedisPassword;
|
||||||
|
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||||
|
import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
|
||||||
|
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import redis.clients.jedis.JedisPoolConfig;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableCaching
|
||||||
|
public class RedisConfig {
|
||||||
|
|
||||||
|
@Value("${spring.redis.host:localhost}")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
@Value("${spring.redis.port:6379}")
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
@Value("${spring.redis.password:}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Value("${spring.redis.database:0}")
|
||||||
|
private int database;
|
||||||
|
|
||||||
|
@Value("${spring.redis.timeout:5000}")
|
||||||
|
private int timeout;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||||
|
|
||||||
|
|
||||||
|
// 为了开发方便,一般直接使用<String,object>
|
||||||
|
RedisTemplate<String,Object> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||||
|
// 用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值
|
||||||
|
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class);
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
// 指定要序列化的域(field,get,set),访问修饰符(public,private,protected)
|
||||||
|
//解决Java 8 date/time type java.time.Instant not supported
|
||||||
|
objectMapper.registerModule(new JavaTimeModule());
|
||||||
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
objectMapper.registerModule(new SimpleModule().addDeserializer(Instant.class, new RedisInstantDateDeserializer()));
|
||||||
|
|
||||||
|
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
|
objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
|
||||||
|
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||||
|
jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
|
||||||
|
// key采用string的序列化方式
|
||||||
|
redisTemplate.setKeySerializer(stringRedisSerializer);
|
||||||
|
// value序列化方式采用jackson
|
||||||
|
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
// hash的key采用string的序列化方式
|
||||||
|
redisTemplate.setHashKeySerializer(stringRedisSerializer);
|
||||||
|
// hash的value序列化方式采用jackson
|
||||||
|
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
redisTemplate.afterPropertiesSet();
|
||||||
|
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JedisConnectionFactory redisConnectionFactory() {
|
||||||
|
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration();
|
||||||
|
config.setHostName(host);
|
||||||
|
config.setPort(port);
|
||||||
|
config.setDatabase(database);
|
||||||
|
if (StringUtils.hasText(password)) {
|
||||||
|
config.setPassword(RedisPassword.of(password));
|
||||||
|
}
|
||||||
|
|
||||||
|
JedisClientConfiguration.JedisClientConfigurationBuilder builder = JedisClientConfiguration.builder();
|
||||||
|
builder.connectTimeout(Duration.ofMillis(timeout));
|
||||||
|
builder.readTimeout(Duration.ofMillis(timeout));
|
||||||
|
|
||||||
|
// 使用连接池
|
||||||
|
JedisPoolConfig poolConfig = new JedisPoolConfig();
|
||||||
|
poolConfig.setMaxTotal(20);
|
||||||
|
poolConfig.setMaxIdle(8);
|
||||||
|
poolConfig.setMinIdle(2);
|
||||||
|
poolConfig.setMaxWaitMillis(8000);
|
||||||
|
poolConfig.setTestOnBorrow(true);
|
||||||
|
poolConfig.setTestWhileIdle(true);
|
||||||
|
poolConfig.setTimeBetweenEvictionRunsMillis(30000);
|
||||||
|
|
||||||
|
builder.usePooling().poolConfig(poolConfig);
|
||||||
|
|
||||||
|
return new JedisConnectionFactory(config, builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CacheManager cacheManager(RedisConnectionFactory factory) {
|
||||||
|
RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
|
.entryTtl(Duration.ofHours(1))
|
||||||
|
.disableCachingNullValues();
|
||||||
|
|
||||||
|
return RedisCacheManager.builder(factory)
|
||||||
|
.cacheDefaults(config)
|
||||||
|
.transactionAware()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.product.event.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
|
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-07-25
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RedisInstantDateDeserializer extends StdDeserializer<Instant> {
|
||||||
|
|
||||||
|
public RedisInstantDateDeserializer() {
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected RedisInstantDateDeserializer(Class<?> vc) {
|
||||||
|
super(vc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Instant deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
||||||
|
String text = p.getValueAsString();
|
||||||
|
return DateUtil.parse(text, DatePattern.NORM_DATETIME_PATTERN).toInstant().plusMillis(TimeUnit.HOURS.toMillis(8));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
package com.njcn.product.event.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisCallback;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis 工具类 - 基于 RedisTemplate
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class RedisUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
// ==================== 通用操作 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置缓存
|
||||||
|
*/
|
||||||
|
public void saveByKey(String key, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForValue().set(key, value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis set操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置缓存带过期时间
|
||||||
|
*/
|
||||||
|
public void setex(String key, Object value, long time, TimeUnit timeUnit) {
|
||||||
|
try {
|
||||||
|
if (time > 0) {
|
||||||
|
redisTemplate.opsForValue().set(key, value, time, timeUnit);
|
||||||
|
} else {
|
||||||
|
saveByKey(key, value);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis setex操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存
|
||||||
|
*/
|
||||||
|
public Object get(String key) {
|
||||||
|
try {
|
||||||
|
return key != null ? redisTemplate.opsForValue().get(key) : null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis get操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对象 - 你在代码中使用的方法
|
||||||
|
*/
|
||||||
|
public Object getObjectByKey(String key) {
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取value为字符串的
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRawValue(String key) {
|
||||||
|
return redisTemplate.execute((RedisCallback<String>) connection -> {
|
||||||
|
byte[] data = connection.get(key.getBytes());
|
||||||
|
return data == null ? null : new String(data, StandardCharsets.UTF_8);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除缓存
|
||||||
|
*/
|
||||||
|
public void deleteKeysByString(String... keys) {
|
||||||
|
try {
|
||||||
|
if (keys != null && keys.length > 0) {
|
||||||
|
if (keys.length == 1) {
|
||||||
|
redisTemplate.delete(keys[0]);
|
||||||
|
} else {
|
||||||
|
redisTemplate.delete(CollectionUtils.arrayToList(keys));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis del操作失败", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置过期时间
|
||||||
|
*/
|
||||||
|
public boolean expire(String key, long time, TimeUnit timeUnit) {
|
||||||
|
try {
|
||||||
|
if (time > 0) {
|
||||||
|
redisTemplate.expire(key, time, timeUnit);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis expire操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取过期时间
|
||||||
|
*/
|
||||||
|
public long getExpire(String key, TimeUnit timeUnit) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.getExpire(key, timeUnit);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis getExpire操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断key是否存在
|
||||||
|
*/
|
||||||
|
public boolean hasKey(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.hasKey(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis hasKey操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== Hash 操作 ====================
|
||||||
|
|
||||||
|
public void hset(String key, String item, Object value) {
|
||||||
|
try {
|
||||||
|
redisTemplate.opsForHash().put(key, item, value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis hset操作失败 key: {}, item: {}", key, item, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object hget(String key, String item) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForHash().get(key, item);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis hget操作失败 key: {}, item: {}", key, item, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<Object, Object> hgetall(String key) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForHash().entries(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis hgetall操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 其他常用操作 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递增
|
||||||
|
*/
|
||||||
|
public long incr(String key, long delta) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForValue().increment(key, delta);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis incr操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递减
|
||||||
|
*/
|
||||||
|
public long decr(String key, long delta) {
|
||||||
|
try {
|
||||||
|
return redisTemplate.opsForValue().increment(key, -delta);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Redis decr操作失败 key: {}", key, e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.product.event.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-23
|
||||||
|
* @Description: 线程池配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ThreadPoolConfig {
|
||||||
|
|
||||||
|
@Bean("smsTaskExecutor")
|
||||||
|
public ThreadPoolTaskExecutor smsTaskExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(3); // 核心线程数
|
||||||
|
executor.setMaxPoolSize(10); // 最大线程数
|
||||||
|
executor.setQueueCapacity(100); // 队列容量
|
||||||
|
executor.setKeepAliveSeconds(30); // 空闲线程存活时间
|
||||||
|
executor.setThreadNamePrefix("sms-sender-"); // 线程名前缀
|
||||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); // 拒绝策略
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class AppConfig {
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate() {
|
||||||
|
return new RestTemplate(); // 基础配置
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,551 @@
|
|||||||
|
package com.njcn.product.event.dataTransmit;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.njcn.product.event.devcie.mapper.PqGdCompanyMapper;
|
||||||
|
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.product.event.devcie.mapper.PqLinedetailMapper;
|
||||||
|
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
|
import com.njcn.product.event.devcie.pojo.po.PqGdCompany;
|
||||||
|
import com.njcn.product.event.devcie.pojo.po.PqLinedetail;
|
||||||
|
import com.njcn.product.event.transientes.mapper.*;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.UpLoadEvent;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.UpLoadUserDTO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.UserLegerDTO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.UserLineAssDTO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.*;
|
||||||
|
import com.njcn.product.event.transientes.service.PqsEventDetailStatusService;
|
||||||
|
import com.njcn.product.event.transientes.utils.OssFileStorageUtils;
|
||||||
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-20
|
||||||
|
* @Description: 暂降事件同步
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@EnableScheduling
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DataSynchronization {
|
||||||
|
|
||||||
|
private final PqsEventdetailMapper pqsEventdetailMapper;
|
||||||
|
|
||||||
|
private final PqsEventDetailStatusService pqsEventDetailStatusService;
|
||||||
|
|
||||||
|
private final OssFileStorageUtils ossFileStorageUtils;
|
||||||
|
private final PqLinedetailMapper pqLinedetailMapper;
|
||||||
|
private final PqLineMapper pqLineMapper;
|
||||||
|
|
||||||
|
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||||
|
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||||
|
private final PqsDicTreeMapper pqsDicTreeMapper;
|
||||||
|
private final PqGdCompanyMapper pqGdCompanyMapper;
|
||||||
|
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
// 文件配置
|
||||||
|
@Value("${business.wavePath}")
|
||||||
|
private String sourceWaveDir;
|
||||||
|
|
||||||
|
@Value("${business.targetPath}")
|
||||||
|
private String targetPath;
|
||||||
|
|
||||||
|
@Value("${business.syncinterval}")
|
||||||
|
private Integer syncinterval;
|
||||||
|
|
||||||
|
@Value("${business.failsyncinterval}")
|
||||||
|
private Integer failsyncinterval;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private volatile boolean syncEventFlag = false;
|
||||||
|
private volatile boolean syncFailFlag = false;
|
||||||
|
|
||||||
|
|
||||||
|
private final static String NAME_KEY = "LineCache:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时执行的同步任务
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "${business.eventCronExpression}")
|
||||||
|
@Transactional
|
||||||
|
public void syncPqsEventdetails() {
|
||||||
|
// 防止任务并发执行
|
||||||
|
if (syncEventFlag) {
|
||||||
|
log.warn("同步任务正在执行中,跳过本次调度");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
syncEventFlag = true;
|
||||||
|
log.info("=== 开始暂降事件波形文件同步任务 ===");
|
||||||
|
|
||||||
|
|
||||||
|
// 同步最近N天的事件,因为存在事件补招,延迟的原因,采用大范围扫描
|
||||||
|
LocalDateTime end = LocalDateTime.now();
|
||||||
|
LocalDateTime start = end.minusMinutes(syncinterval);
|
||||||
|
syncEvents(start, end);
|
||||||
|
|
||||||
|
log.info("=== 同步任务完成 ===");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("同步任务执行失败", e);
|
||||||
|
} finally {
|
||||||
|
syncEventFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "${business.failCronExpression}")
|
||||||
|
@Transactional
|
||||||
|
public void syncFail() {
|
||||||
|
// 防止任务并发执行
|
||||||
|
if (syncFailFlag) {
|
||||||
|
log.warn("同步任务正在执行中,跳过本次调度");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
syncFailFlag = true;
|
||||||
|
log.info("=== 开始暂降事件波形文件同步任务 ===");
|
||||||
|
|
||||||
|
|
||||||
|
// 同步最近N天的事件,因为存在事件补招,延迟的原因,采用大范围扫描
|
||||||
|
LocalDateTime end = LocalDateTime.now();
|
||||||
|
LocalDateTime start = end.minusMinutes(failsyncinterval);
|
||||||
|
synFailEvents(start, end);
|
||||||
|
|
||||||
|
log.info("=== 同步任务完成 ===");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("同步任务执行失败", e);
|
||||||
|
} finally {
|
||||||
|
syncFailFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "${business.userCronExpression}")
|
||||||
|
@Transactional
|
||||||
|
public void syncUser() throws Exception {
|
||||||
|
|
||||||
|
log.info("=== 开始重要敏感用户同步任务 ===");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String exportDirName = "/pq_user/pq_user.json";
|
||||||
|
UpLoadUserDTO result = new UpLoadUserDTO();
|
||||||
|
QueryWrapper<PqUserLedgerPO> pqUserLedgerPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
// pqUserLedgerPOQueryWrapper.lambda().eq(PqUserLedgerPO::getIsShow,1);
|
||||||
|
List<PqUserLedgerPO> pqUserLedgerPOS = pqUserLedgerMapper.selectList(null);
|
||||||
|
if(!CollectionUtils.isEmpty(pqUserLedgerPOS)){
|
||||||
|
List<String> showIds =new ArrayList<>();
|
||||||
|
List<UserLegerDTO> userLegerDTOList =new ArrayList<>();
|
||||||
|
List<PqsDicTreePO> pqsDicTreePOS = pqsDicTreeMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
|
Map<String, PqsDicTreePO> pqsDicTreePOMap = pqsDicTreePOS.stream().collect(Collectors.toMap(PqsDicTreePO::getId, Function.identity()));
|
||||||
|
List<PqGdCompany> pqGdCompanyList = pqGdCompanyMapper.selectList(null);
|
||||||
|
Map<Long, PqGdCompany> gdMap = pqGdCompanyList.stream().collect(Collectors.toMap(PqGdCompany::getGdIndex, Function.identity()));
|
||||||
|
pqUserLedgerPOS.forEach(temp->{
|
||||||
|
showIds.add(temp.getId());
|
||||||
|
UserLegerDTO userLegerDTO = new UserLegerDTO();
|
||||||
|
userLegerDTO.setId(temp.getId());
|
||||||
|
userLegerDTO.setPowerSupplyArea(gdMap.get(Long.valueOf(temp.getPowerSupplyArea())).getName());
|
||||||
|
userLegerDTO.setCustomerName(temp.getCustomerName());
|
||||||
|
userLegerDTO.setElectricityAddress(temp.getElectricityAddress());
|
||||||
|
userLegerDTO.setBigObjType(pqsDicTreePOMap.get(temp.getBigObjType()).getName());
|
||||||
|
userLegerDTO.setSmallObjType(pqsDicTreePOMap.get(temp.getSmallObjType()).getName());
|
||||||
|
|
||||||
|
userLegerDTO.setCustomerNo("");
|
||||||
|
userLegerDTO.setIsShow(temp.getIsShow());
|
||||||
|
userLegerDTOList.add(userLegerDTO);
|
||||||
|
});
|
||||||
|
|
||||||
|
QueryWrapper<PqUserLineAssPO> userLineAssPOQueryWrapper = new QueryWrapper<>();
|
||||||
|
// userLineAssPOQueryWrapper.lambda().in(PqUserLineAssPO::getUserIndex,showIds);
|
||||||
|
if (showIds.size() > 1000) {
|
||||||
|
List<List<String>> splitList = CollUtil.split(showIds, 1000);
|
||||||
|
userLineAssPOQueryWrapper.lambda().and(ew -> {
|
||||||
|
for (int i = 0; i < splitList.size(); i++) {
|
||||||
|
List<String> batch = splitList.get(i);
|
||||||
|
if (i == 0) {
|
||||||
|
ew.in(PqUserLineAssPO::getUserIndex, batch); // 第一个条件不加 or
|
||||||
|
} else {
|
||||||
|
ew.or().in(PqUserLineAssPO::getUserIndex, batch); // 后续条件加 or
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
userLineAssPOQueryWrapper.lambda().in(PqUserLineAssPO::getUserIndex, showIds);
|
||||||
|
}
|
||||||
|
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(userLineAssPOQueryWrapper);
|
||||||
|
List<UserLineAssDTO> userLineAssDTOS = pqUserLineAssPOS.stream().map(temp -> {
|
||||||
|
UserLineAssDTO userLineAssDTO = new UserLineAssDTO();
|
||||||
|
BeanUtils.copyProperties(temp, userLineAssDTO);
|
||||||
|
return userLineAssDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.setUserList(userLegerDTOList);
|
||||||
|
result.setAssList(userLineAssDTOS);
|
||||||
|
|
||||||
|
|
||||||
|
ossFileStorageUtils.uploadObjectAsJsonStream(result,exportDirName);
|
||||||
|
log.info("=== 结束重要敏感用户同步任务 ===");
|
||||||
|
|
||||||
|
}else {
|
||||||
|
log.info("=== 暂无重要敏感用户 ===");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void synFailEvents(LocalDateTime start, LocalDateTime end) throws Exception {
|
||||||
|
log.info("=== 开始同步同步失败事件任务 ===");
|
||||||
|
|
||||||
|
// 创建导出目录
|
||||||
|
String filePath = start.toLocalDate().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||||
|
String fileName = end.format(DateTimeFormatter.ofPattern(DatePattern.PURE_DATETIME_PATTERN));
|
||||||
|
|
||||||
|
String exportDirName = String.format("%s/%s/%s.json","/event", filePath,"bz_"+fileName);
|
||||||
|
// 查询失败的暂降事件
|
||||||
|
LambdaQueryWrapper<PqsEventDetailStatusPO> statusPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
statusPOLambdaQueryWrapper.between(PqsEventDetailStatusPO::getSyncTime,start,end);
|
||||||
|
List<PqsEventDetailStatusPO> hasList = pqsEventDetailStatusService.list(statusPOLambdaQueryWrapper);
|
||||||
|
Map<String, PqsEventDetailStatusPO> pqsEventDetailStatusPOMap = hasList.stream().collect(Collectors.toMap(PqsEventDetailStatusPO::getEventDetailId, Function.identity()));
|
||||||
|
// 查询事件
|
||||||
|
LambdaQueryWrapper<PqsEventdetail> pqsEventdetailLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
pqsEventdetailLambdaQueryWrapper.between(PqsEventdetail::getCreateTime,start.minusMinutes(6*10),end);
|
||||||
|
List<PqsEventdetail> unsyncedEvents = pqsEventdetailMapper.selectList(pqsEventdetailLambdaQueryWrapper);
|
||||||
|
List<String> tempEvetIds = unsyncedEvents.stream().map(PqsEventdetail::getEventdetailIndex).collect(Collectors.toList());
|
||||||
|
//查询日志
|
||||||
|
List<String> allEventIds = hasList.stream().map(PqsEventDetailStatusPO::getEventDetailId).collect(Collectors.toList());
|
||||||
|
List<String> unSyncIds = tempEvetIds.stream().filter(temp -> !allEventIds.contains(temp)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<String> failIds = hasList.stream().filter(temp -> temp.getRetryCount() <= 5 && temp.getSyncStatus() == 0).map(PqsEventDetailStatusPO::getEventDetailId).collect(Collectors.toList());
|
||||||
|
unSyncIds.addAll(failIds);
|
||||||
|
List<UpLoadEvent> result = new ArrayList<>();
|
||||||
|
|
||||||
|
if(!CollectionUtils.isEmpty(unSyncIds)){
|
||||||
|
List<String> eventIds = unSyncIds.stream().distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
LambdaQueryWrapper<PqsEventdetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (eventIds.size() > 1000) {
|
||||||
|
List<List<String>> splitList = CollUtil.split(eventIds, 1000);
|
||||||
|
lambdaQueryWrapper.and(ew -> {
|
||||||
|
for (int i = 0; i < splitList.size(); i++) {
|
||||||
|
List<String> batch = splitList.get(i);
|
||||||
|
if (i == 0) {
|
||||||
|
ew.in(PqsEventdetail::getEventdetailIndex, batch); // 第一个条件不加 or
|
||||||
|
} else {
|
||||||
|
ew.or().in(PqsEventdetail::getEventdetailIndex, batch); // 后续条件加 or
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
lambdaQueryWrapper.in(PqsEventdetail::getEventdetailIndex, eventIds);
|
||||||
|
}
|
||||||
|
List<PqsEventdetail> pqsEventdetails = pqsEventdetailMapper.selectList(lambdaQueryWrapper);
|
||||||
|
Map<String, PqsEventdetail> pqsEventdetailMap = pqsEventdetails.stream().collect(Collectors.toMap(PqsEventdetail::getEventdetailIndex, Function.identity()));
|
||||||
|
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = (List<LedgerBaseInfoDTO>)redisUtil.getObjectByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO");
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> LedgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
List<PqLinedetail> pqLinedetails = pqLinedetailMapper.selectList(null);
|
||||||
|
Map<Integer, PqLinedetail> lineDetailMap = pqLinedetails.stream().collect(Collectors.toMap(PqLinedetail::getLineIndex, Function.identity()));
|
||||||
|
|
||||||
|
eventIds.forEach(temp->{
|
||||||
|
PqsEventdetail pqsEventdetail = pqsEventdetailMap.get(temp);
|
||||||
|
|
||||||
|
if(pqsEventDetailStatusPOMap.containsKey(temp)){
|
||||||
|
PqsEventDetailStatusPO pqsEventDetailStatusPO = pqsEventDetailStatusPOMap.get(temp);
|
||||||
|
pqsEventDetailStatusPO.setRetryCount(pqsEventDetailStatusPO.getRetryCount()+1);
|
||||||
|
if(Objects.nonNull(pqsEventdetail.getWavename())||pqsEventDetailStatusPO.getRetryCount()>5){
|
||||||
|
pqsEventDetailStatusPO.setSyncStatus(1);
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(0);
|
||||||
|
UpLoadEvent upLoadEvent = new UpLoadEvent();
|
||||||
|
upLoadEvent.setEventdetail_index(pqsEventdetail.getEventdetailIndex());
|
||||||
|
upLoadEvent.setLineid(pqsEventdetail.getLineid());
|
||||||
|
upLoadEvent.setTimeid(LocalDateTimeUtil.format(pqsEventdetail.getTimeid(),DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
upLoadEvent.setMs(pqsEventdetail.getMs());
|
||||||
|
upLoadEvent.setDescribe(pqsEventdetail.getDescribe());
|
||||||
|
upLoadEvent.setWavetype(pqsEventdetail.getWavetype());
|
||||||
|
upLoadEvent.setPersisttime( pqsEventdetail.getPersisttime()/ 1000);
|
||||||
|
upLoadEvent.setEventvalue(pqsEventdetail.getEventvalue());
|
||||||
|
upLoadEvent.setEventreason(pqsEventdetail.getEventreason());
|
||||||
|
upLoadEvent.setEventtype(pqsEventdetail.getEventtype());
|
||||||
|
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||||
|
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||||
|
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetail.getLineid()).collect(Collectors.toList()));
|
||||||
|
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||||
|
}
|
||||||
|
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||||
|
upLoadEvent.setBdname(ledgerBaseInfoDTO.getStationName());
|
||||||
|
upLoadEvent.setBusname(ledgerBaseInfoDTO.getBusBarName());
|
||||||
|
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||||
|
upLoadEvent.setIp(ledgerBaseInfoDTO.getIp());
|
||||||
|
upLoadEvent.setPt(ledgerBaseInfoDTO.getPt());
|
||||||
|
upLoadEvent.setCt(ledgerBaseInfoDTO.getCt());
|
||||||
|
upLoadEvent.setPtType(lineDetailMap.get(pqsEventdetail.getLineid()).getPttype());
|
||||||
|
upLoadEvent.setIp(ledgerBaseInfoDTO.getIp());
|
||||||
|
if(Objects.nonNull(pqsEventdetail.getWavename())){
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(1);
|
||||||
|
|
||||||
|
upLoadEvent.setWavePath(ledgerBaseInfoDTO.getIp()+"/"+pqsEventdetail.getWavename());
|
||||||
|
}
|
||||||
|
result.add(upLoadEvent);
|
||||||
|
}
|
||||||
|
pqsEventDetailStatusService.saveOrUpdate(pqsEventDetailStatusPO);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
PqsEventDetailStatusPO pqsEventDetailStatusPO = new PqsEventDetailStatusPO();
|
||||||
|
pqsEventDetailStatusPO.setEventDetailId(pqsEventdetail.getEventdetailIndex());
|
||||||
|
pqsEventDetailStatusPO.setEventTime(pqsEventdetail.getTimeid());
|
||||||
|
pqsEventDetailStatusPO.setSyncTime(LocalDateTime.now());
|
||||||
|
pqsEventDetailStatusPO.setRemark("");
|
||||||
|
pqsEventDetailStatusPO.setRetryCount(0);
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(pqsEventdetail.getWavename())){
|
||||||
|
pqsEventDetailStatusPO.setSyncStatus(0);
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(0);
|
||||||
|
}else {
|
||||||
|
UpLoadEvent upLoadEvent = new UpLoadEvent();
|
||||||
|
upLoadEvent.setEventdetail_index(pqsEventdetail.getEventdetailIndex());
|
||||||
|
upLoadEvent.setLineid(pqsEventdetail.getLineid());
|
||||||
|
upLoadEvent.setTimeid(LocalDateTimeUtil.format(pqsEventdetail.getTimeid(),DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
upLoadEvent.setMs(pqsEventdetail.getMs());
|
||||||
|
upLoadEvent.setDescribe(pqsEventdetail.getDescribe());
|
||||||
|
upLoadEvent.setWavetype(pqsEventdetail.getWavetype());
|
||||||
|
upLoadEvent.setPersisttime(pqsEventdetail.getPersisttime()/ 1000);
|
||||||
|
upLoadEvent.setEventvalue(pqsEventdetail.getEventvalue());
|
||||||
|
upLoadEvent.setEventreason(pqsEventdetail.getEventreason());
|
||||||
|
upLoadEvent.setEventtype(pqsEventdetail.getEventtype());
|
||||||
|
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||||
|
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||||
|
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetail.getLineid()).collect(Collectors.toList()));
|
||||||
|
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||||
|
}
|
||||||
|
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||||
|
upLoadEvent.setBdname(ledgerBaseInfoDTO.getStationName());
|
||||||
|
upLoadEvent.setBusname(ledgerBaseInfoDTO.getBusBarName());
|
||||||
|
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||||
|
upLoadEvent.setIp(ledgerBaseInfoDTO.getIp());
|
||||||
|
upLoadEvent.setPt(ledgerBaseInfoDTO.getPt());
|
||||||
|
upLoadEvent.setCt(ledgerBaseInfoDTO.getCt());
|
||||||
|
upLoadEvent.setPtType(lineDetailMap.get(pqsEventdetail.getLineid()).getPttype());
|
||||||
|
upLoadEvent.setWavePath(ledgerBaseInfoDTO.getIp()+"/"+pqsEventdetail.getWavename());
|
||||||
|
result.add(upLoadEvent);
|
||||||
|
pqsEventDetailStatusPO.setSyncStatus(1);
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
pqsEventDetailStatusService.saveOrUpdate(pqsEventDetailStatusPO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(result)){
|
||||||
|
//上传Json
|
||||||
|
ossFileStorageUtils.uploadObjectAsJsonStream(result,exportDirName);
|
||||||
|
//上传波形文件
|
||||||
|
result.forEach(temp->{
|
||||||
|
if(Objects.nonNull(temp.getWavePath())){
|
||||||
|
// String uploadLocalFile1 =sourceWaveDir+"/"+temp.getWavePath()+".dat";
|
||||||
|
String uploadLocalFile2 =sourceWaveDir+"/"+temp.getWavePath()+".DAT";
|
||||||
|
// String uploadLocalFile3 =sourceWaveDir+"/"+temp.getWavePath()+".cfg";
|
||||||
|
String uploadLocalFile4 =sourceWaveDir+"/"+temp.getWavePath()+".CFG";
|
||||||
|
String uploadLocalFile5 =sourceWaveDir+"/"+temp.getWavePath()+".HDR";
|
||||||
|
// String uploadLocalFile6 =sourceWaveDir+"/"+temp.getWavePath()+".hdr";
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile1, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile2, targetPath+"/"+temp.getIp());
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile3, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile4, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile5, targetPath+"/"+temp.getIp());
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile6, targetPath+"/"+temp.getIp());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步指定时间范围内的事件
|
||||||
|
*/
|
||||||
|
public void syncEvents(LocalDateTime startTime, LocalDateTime endTime) throws Exception {
|
||||||
|
// 创建导出目录
|
||||||
|
String filePath = endTime.toLocalDate().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
||||||
|
String fileName = startTime.format(DateTimeFormatter.ofPattern(DatePattern.PURE_DATETIME_PATTERN));
|
||||||
|
|
||||||
|
String exportDirName = String.format("%s/%s/%s.json","/event", filePath,fileName);
|
||||||
|
|
||||||
|
// 查询未同步的事件
|
||||||
|
LambdaQueryWrapper<PqsEventdetail> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.between(PqsEventdetail::getCreateTime,startTime,endTime);
|
||||||
|
List<PqsEventdetail> unsyncedEvents = pqsEventdetailMapper.selectList(lambdaQueryWrapper);
|
||||||
|
log.info("查询到 " + unsyncedEvents.size() + " 个暂降事件");
|
||||||
|
if(CollUtil.isEmpty(unsyncedEvents)){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 查询已经存在记录的暂降事件
|
||||||
|
// LambdaQueryWrapper<PqsEventDetailStatusPO> statusPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// statusPOLambdaQueryWrapper.between(PqsEventDetailStatusPO::getEventTime,startTime,endTime);
|
||||||
|
// List<PqsEventDetailStatusPO> hasList = pqsEventDetailStatusMapper.selectList(statusPOLambdaQueryWrapper);
|
||||||
|
|
||||||
|
// log.info("查询到 " + hasList.size() + "条已存在记录事件");
|
||||||
|
// //成功或者重试超过2次的时间id
|
||||||
|
// List<String> successEventDetailIds = hasList.stream().filter(it->it.getWaveFlag() == 1||it.getRetryCount()>2).map(PqsEventDetailStatusPO::getEventDetailId).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //排除已经成功的事件
|
||||||
|
// if(CollUtil.isNotEmpty(successEventDetailIds)){
|
||||||
|
// unsyncedEvents = unsyncedEvents.stream().filter(it->!successEventDetailIds.contains(it.getEventdetailIndex())).collect(Collectors.toList());
|
||||||
|
// }
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = (List<LedgerBaseInfoDTO>)redisUtil.getObjectByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO");
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> LedgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
|
||||||
|
List<PqLinedetail> pqLinedetails = pqLinedetailMapper.selectList(null);
|
||||||
|
Map<Integer, PqLinedetail> lineDetailMap = pqLinedetails.stream().collect(Collectors.toMap(PqLinedetail::getLineIndex, Function.identity()));
|
||||||
|
List<UpLoadEvent> result = new ArrayList<>();
|
||||||
|
List<PqsEventDetailStatusPO> logs = new ArrayList<>();
|
||||||
|
|
||||||
|
for (PqsEventdetail unsyncedEvent : unsyncedEvents) {
|
||||||
|
|
||||||
|
PqsEventDetailStatusPO pqsEventDetailStatusPO = new PqsEventDetailStatusPO();
|
||||||
|
pqsEventDetailStatusPO.setEventDetailId(unsyncedEvent.getEventdetailIndex());
|
||||||
|
pqsEventDetailStatusPO.setEventTime(unsyncedEvent.getTimeid());
|
||||||
|
pqsEventDetailStatusPO.setSyncTime(LocalDateTime.now());
|
||||||
|
pqsEventDetailStatusPO.setRemark("");
|
||||||
|
pqsEventDetailStatusPO.setRetryCount(0);
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(unsyncedEvent.getWavename())){
|
||||||
|
pqsEventDetailStatusPO.setSyncStatus(0);
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(0);
|
||||||
|
}else {
|
||||||
|
UpLoadEvent upLoadEvent = new UpLoadEvent();
|
||||||
|
upLoadEvent.setEventdetail_index(unsyncedEvent.getEventdetailIndex());
|
||||||
|
upLoadEvent.setLineid(unsyncedEvent.getLineid());
|
||||||
|
upLoadEvent.setTimeid(LocalDateTimeUtil.format(unsyncedEvent.getTimeid(),DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
upLoadEvent.setMs(unsyncedEvent.getMs());
|
||||||
|
upLoadEvent.setDescribe(unsyncedEvent.getDescribe());
|
||||||
|
upLoadEvent.setWavetype(unsyncedEvent.getWavetype());
|
||||||
|
upLoadEvent.setPersisttime(unsyncedEvent.getPersisttime()/ 1000);
|
||||||
|
upLoadEvent.setEventvalue(unsyncedEvent.getEventvalue());
|
||||||
|
upLoadEvent.setEventreason(unsyncedEvent.getEventreason());
|
||||||
|
upLoadEvent.setEventtype(unsyncedEvent.getEventtype());
|
||||||
|
LedgerBaseInfoDTO ledgerBaseInfoDTO = LedgerBaseInfoDTOMap.get(unsyncedEvent.getLineid());
|
||||||
|
if(Objects.isNull(ledgerBaseInfoDTO)){
|
||||||
|
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(unsyncedEvent.getLineid()).collect(Collectors.toList()));
|
||||||
|
ledgerBaseInfoDTO = baseLineInfo.get(0);
|
||||||
|
}
|
||||||
|
upLoadEvent.setGdname(ledgerBaseInfoDTO.getGdName());
|
||||||
|
upLoadEvent.setBdname(ledgerBaseInfoDTO.getStationName());
|
||||||
|
upLoadEvent.setBusname(ledgerBaseInfoDTO.getBusBarName());
|
||||||
|
upLoadEvent.setPointname(ledgerBaseInfoDTO.getLineName());
|
||||||
|
upLoadEvent.setIp(ledgerBaseInfoDTO.getIp());
|
||||||
|
upLoadEvent.setPt(ledgerBaseInfoDTO.getPt());
|
||||||
|
upLoadEvent.setCt(ledgerBaseInfoDTO.getCt());
|
||||||
|
upLoadEvent.setPtType(lineDetailMap.get(unsyncedEvent.getLineid()).getPttype());
|
||||||
|
upLoadEvent.setWavePath(ledgerBaseInfoDTO.getIp()+"/"+unsyncedEvent.getWavename());
|
||||||
|
result.add(upLoadEvent);
|
||||||
|
pqsEventDetailStatusPO.setSyncStatus(1);
|
||||||
|
pqsEventDetailStatusPO.setWaveFlag(1);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
pqsEventDetailStatusService.saveOrUpdate(pqsEventDetailStatusPO);
|
||||||
|
logs.add(pqsEventDetailStatusPO);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(result)){
|
||||||
|
//上传Json
|
||||||
|
ossFileStorageUtils.uploadObjectAsJsonStream(result,exportDirName);
|
||||||
|
//上传波形文件
|
||||||
|
result.forEach(temp->{
|
||||||
|
// String uploadLocalFile1 =sourceWaveDir+"/"+temp.getWavePath()+".dat";
|
||||||
|
String uploadLocalFile2 =sourceWaveDir+"/"+temp.getWavePath()+".DAT";
|
||||||
|
// String uploadLocalFile3 =sourceWaveDir+"/"+temp.getWavePath()+".cfg";
|
||||||
|
String uploadLocalFile4 =sourceWaveDir+"/"+temp.getWavePath()+".CFG";
|
||||||
|
String uploadLocalFile5 =sourceWaveDir+"/"+temp.getWavePath()+".HDR";
|
||||||
|
// String uploadLocalFile6 =sourceWaveDir+"/"+temp.getWavePath()+".hdr";
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile1, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile2, targetPath+"/"+temp.getIp());
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile3, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile4, targetPath+"/"+temp.getIp());
|
||||||
|
ossFileStorageUtils.uploadLocalFile(uploadLocalFile5, targetPath+"/"+temp.getIp());
|
||||||
|
// ossFileStorageUtils.uploadLocalFile(uploadLocalFile6, targetPath+"/"+temp.getIp());
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取波形类型描述
|
||||||
|
*/
|
||||||
|
private String getWaveTypeDesc(Integer waveType) {
|
||||||
|
if (waveType == null) return "未知";
|
||||||
|
|
||||||
|
switch (waveType) {
|
||||||
|
case 1: return "电压暂降";
|
||||||
|
case 2: return "电压暂升";
|
||||||
|
case 3: return "电压中断";
|
||||||
|
case 4: return "电压波动";
|
||||||
|
default: return "未知类型(" + waveType + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
double a =3.00;
|
||||||
|
System.out.println(a/1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -3,12 +3,13 @@ package com.njcn.product.event.devcie.config;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
||||||
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
||||||
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -44,7 +45,7 @@ public class PqlineCache {
|
|||||||
private String sysTypeZt;
|
private String sysTypeZt;
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
log.info("系统启动中。。。加载pqline");
|
log.info("初始化刷新redis缓存----------------------");
|
||||||
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
List<PqLine> pqLines = pqLineMapper.selectList(null);
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"pqLineList",pqLines);
|
||||||
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
List<PqsDepts> list = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState, 1).list();
|
||||||
@@ -70,6 +71,20 @@ public class PqlineCache {
|
|||||||
|
|
||||||
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
||||||
|
List<Integer> collect = pqLines.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
|
||||||
|
|
||||||
|
if(collect.size()>1000){
|
||||||
|
List<List<Integer>> listIds = CollUtil.split(collect,1000);
|
||||||
|
for(List<Integer> itemIds : listIds){
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(itemIds);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(collect);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO",ledgerBaseInfoDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.product.event.devcie.mapper.PqDeviceMapper;
|
import com.njcn.product.event.devcie.mapper.PqDeviceMapper;
|
||||||
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||||
|
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
||||||
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
||||||
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
@@ -74,6 +75,20 @@ public class LineCacheJob {
|
|||||||
|
|
||||||
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
List<PqsDepts> deptsList = pqsDeptsService.lambdaQuery().eq(PqsDepts::getState,1).list();
|
||||||
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"AllDept",deptsList);
|
||||||
|
List<Integer> collect = pqLines.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
|
||||||
|
|
||||||
|
if(collect.size()>1000){
|
||||||
|
List<List<Integer>> listIds = CollUtil.split(collect,1000);
|
||||||
|
for(List<Integer> itemIds : listIds){
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(itemIds);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(collect);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
redisUtil.saveByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO",ledgerBaseInfoDTOS);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,9 @@
|
|||||||
PQ_SUBVOLTAGE.SCALE,
|
PQ_SUBVOLTAGE.SCALE,
|
||||||
pq_device.dev_index devId,
|
pq_device.dev_index devId,
|
||||||
pq_device.name devName,
|
pq_device.name devName,
|
||||||
|
pq_device.ip ip,
|
||||||
|
pq_line.pt1/pq_line.pt2 pt,
|
||||||
|
pq_line.ct1/pq_line.ct2 ct,
|
||||||
pq_device.Status runFlag,
|
pq_device.Status runFlag,
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
PQ_SUBSTATION.name stationName,
|
PQ_SUBSTATION.name stationName,
|
||||||
@@ -74,6 +77,9 @@ where 1=1
|
|||||||
PQ_SUBVOLTAGE.SCALE,
|
PQ_SUBVOLTAGE.SCALE,
|
||||||
pq_device.dev_index devId,
|
pq_device.dev_index devId,
|
||||||
pq_device.name devName,
|
pq_device.name devName,
|
||||||
|
pq_device.ip ip,
|
||||||
|
pq_line.pt1/pq_line.pt2 pt,
|
||||||
|
pq_line.ct1/pq_line.ct2 ct,
|
||||||
pq_device.Status runFlag,
|
pq_device.Status runFlag,
|
||||||
PQ_SUBSTATION.sub_index stationId,
|
PQ_SUBSTATION.sub_index stationId,
|
||||||
PQ_SUBSTATION.name stationName
|
PQ_SUBSTATION.name stationName
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ public class LedgerBaseInfoDTO {
|
|||||||
private Integer runFlag=0;
|
private Integer runFlag=0;
|
||||||
|
|
||||||
private Integer eventCount;
|
private Integer eventCount;
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private int pt;
|
||||||
|
private int ct;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.product.event.devcie.pojo.dto;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/10/23 上午 10:58【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LedgerExcelDTO {
|
||||||
|
@Excel(name = "供电公司", width = 20)
|
||||||
|
private String gdName;
|
||||||
|
|
||||||
|
@Excel(name = "变电站", width = 20)
|
||||||
|
private String stationName;
|
||||||
|
@Excel(name = "装置", width = 20)
|
||||||
|
|
||||||
|
private String devName;
|
||||||
|
@Excel(name = "母线", width = 20)
|
||||||
|
private String busBarName;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "监测点", width = 20)
|
||||||
|
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "用户", width = 50)
|
||||||
|
|
||||||
|
private String objName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import com.njcn.product.event.report.utils.WordTemplate;
|
|||||||
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
||||||
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
import com.njcn.product.event.transientes.pojo.po.PqsDepts;
|
||||||
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
import com.njcn.product.event.transientes.service.PqsDeptsService;
|
||||||
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.text.StrBuilder;
|
import cn.hutool.core.text.StrBuilder;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
@@ -24,7 +25,9 @@ import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
|||||||
import com.njcn.product.event.transientes.pojo.po.*;
|
import com.njcn.product.event.transientes.pojo.po.*;
|
||||||
import com.njcn.product.event.transientes.service.CommGeneralService;
|
import com.njcn.product.event.transientes.service.CommGeneralService;
|
||||||
import com.njcn.product.event.transientes.service.MsgEventConfigService;
|
import com.njcn.product.event.transientes.service.MsgEventConfigService;
|
||||||
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
||||||
@@ -35,7 +38,10 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.DoubleStream;
|
import java.util.stream.DoubleStream;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -47,6 +53,7 @@ import java.util.stream.Stream;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
||||||
|
|
||||||
private final CommGeneralService commGeneralService;
|
private final CommGeneralService commGeneralService;
|
||||||
@@ -68,10 +75,12 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
|||||||
private final ObjectMapper mapper = new ObjectMapper();
|
private final ObjectMapper mapper = new ObjectMapper();
|
||||||
// @Value("${business.wordTemplatePath}")
|
// @Value("${business.wordTemplatePath}")
|
||||||
// private String wordTemplatePath;
|
// private String wordTemplatePath;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final static String NAME_KEY = "LineCache:";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportWordReport(HttpServletResponse response, ReportExportParam param) {
|
public void exportWordReport(HttpServletResponse response, ReportExportParam param) {
|
||||||
|
log.info(LocalDateTime.now()+"开始导出word报告");
|
||||||
try {
|
try {
|
||||||
List<Integer> deptIds = commGeneralService.getLineIdsByRedis(param.getDeptId());
|
List<Integer> deptIds = commGeneralService.getLineIdsByRedis(param.getDeptId());
|
||||||
if (CollUtil.isEmpty(deptIds)) {
|
if (CollUtil.isEmpty(deptIds)) {
|
||||||
@@ -110,20 +119,23 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
|||||||
|
|
||||||
List<PqsEventdetail> pqsEventdetailList = pqsEventdetailMapper.selectList(lambdaQueryWrapper);
|
List<PqsEventdetail> pqsEventdetailList = pqsEventdetailMapper.selectList(lambdaQueryWrapper);
|
||||||
if(CollUtil.isNotEmpty(pqsEventdetailList)) {
|
if(CollUtil.isNotEmpty(pqsEventdetailList)) {
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = (List<LedgerBaseInfoDTO>)redisUtil.getObjectByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO");
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> LedgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
|
||||||
List<Map<String, Object>> eventTemplateList = new ArrayList<>();
|
List<Map<String, Object>> eventTemplateList = new ArrayList<>();
|
||||||
for (int i = 0; i < pqsEventdetailList.size(); i++) {
|
for (int i = 0; i < pqsEventdetailList.size(); i++) {
|
||||||
PqsEventdetail pqsEventdetail = pqsEventdetailList.get(i);
|
PqsEventdetail pqsEventdetail = pqsEventdetailList.get(i);
|
||||||
EventTemplate eventTemplate = new EventTemplate();
|
EventTemplate eventTemplate = new EventTemplate();
|
||||||
eventTemplate.setSno(i + 1);
|
eventTemplate.setSno(i + 1);
|
||||||
eventTemplate.setTimeId(pqsEventdetail.getTimeid().format(DatePattern.NORM_DATETIME_FORMATTER) + "." + pqsEventdetail.getMs());
|
eventTemplate.setTimeId(pqsEventdetail.getTimeid().format(DatePattern.NORM_DATETIME_FORMATTER) + "." + pqsEventdetail.getMs());
|
||||||
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetailList.get(i).getLineid()).collect(Collectors.toList()));
|
LedgerBaseInfoDTO baseLineInfo = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||||
eventTemplate.setOrgName(baseLineInfo.get(0).getGdName());
|
eventTemplate.setOrgName(baseLineInfo.getGdName());
|
||||||
eventTemplate.setSubName(baseLineInfo.get(0).getStationName());
|
eventTemplate.setSubName(baseLineInfo.getStationName());
|
||||||
eventTemplate.setBusName(baseLineInfo.get(0).getBusBarName());
|
eventTemplate.setBusName(baseLineInfo.getBusBarName());
|
||||||
eventTemplate.setScale(pqsDicDataMap.get(baseLineInfo.get(0).getScale()).getDicName());
|
eventTemplate.setScale(pqsDicDataMap.get(baseLineInfo.getScale()).getDicName());
|
||||||
eventTemplate.setDuration(String.format("%.3f", pqsEventdetail.getPersisttime() / 1000));
|
eventTemplate.setDuration(String.format("%.3f", pqsEventdetail.getPersisttime() / 1000));
|
||||||
eventTemplate.setResidualVoltage(String.format("%.2f", pqsEventdetail.getEventvalue() * 100));
|
eventTemplate.setResidualVoltage(String.format("%.2f", pqsEventdetail.getEventvalue() * 100));
|
||||||
eventTemplate.setUserName(baseLineInfo.get(0).getObjName());
|
eventTemplate.setUserName(baseLineInfo.getObjName());
|
||||||
Map<String, Object> eventMap = mapper.convertValue(eventTemplate, Map.class);
|
Map<String, Object> eventMap = mapper.convertValue(eventTemplate, Map.class);
|
||||||
|
|
||||||
eventTemplateList.add(eventMap);
|
eventTemplateList.add(eventMap);
|
||||||
@@ -154,30 +166,56 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
|||||||
|
|
||||||
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex, lineIds));
|
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex, lineIds));
|
||||||
List<String> userIds = pqUserLineAssPOS.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
List<String> userIds = pqUserLineAssPOS.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId, userIds));
|
LambdaQueryWrapper<PqUserLedgerPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (userIds.size() > 1000) {
|
||||||
|
List<List<String>> listUserIds = CollUtil.split(userIds, 1000);
|
||||||
|
queryWrapper.and(w -> {
|
||||||
|
for (List<String> ids : listUserIds) {
|
||||||
|
w.or(wIn -> wIn.in(PqUserLedgerPO::getId, ids));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
queryWrapper.in(PqUserLedgerPO::getId, userIds);
|
||||||
|
}
|
||||||
|
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(queryWrapper);
|
||||||
Map<String, List<PqUserLedgerPO>> stringListMap = pqUserLedgerPOList.stream().collect(Collectors.groupingBy(PqUserLedgerPO::getSmallObjType));
|
Map<String, List<PqUserLedgerPO>> stringListMap = pqUserLedgerPOList.stream().collect(Collectors.groupingBy(PqUserLedgerPO::getSmallObjType));
|
||||||
|
|
||||||
String treeStr = userToStr(stringListMap, treePOMap);
|
String treeStr = userToStr(stringListMap, treePOMap);
|
||||||
|
|
||||||
bjReportDTO.setObjTypeList(treeStr);
|
bjReportDTO.setObjTypeList(treeStr);
|
||||||
bjReportDTO.setAffectedUserCount(pqUserLedgerPOList.size());
|
bjReportDTO.setAffectedUserCount(pqUserLedgerPOList.size());
|
||||||
|
log.info(LocalDateTime.now()+"组装公共参数结束");
|
||||||
|
|
||||||
areaAssemble(bjReportDTO, param, pqsDicDataMap);
|
areaAssemble(bjReportDTO, param, pqsDicDataMap);
|
||||||
|
log.info(LocalDateTime.now()+"组装特别参数结束");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,Object> map = mapper.convertValue(bjReportDTO,Map.class);
|
Map<String,Object> map = mapper.convertValue(bjReportDTO,Map.class);
|
||||||
|
log.info(LocalDateTime.now()+"开始组装word模版");
|
||||||
|
|
||||||
WordTemplate.generateWordDownload("template/bj_report.docx", response, bjReportDTO.getDateFormat()+"重要敏感用户电压暂降事件监测情况.docx", map);
|
WordTemplate.generateWordDownload("template/bj_report.docx", response, bjReportDTO.getDateFormat()+"重要敏感用户电压暂降事件监测情况.docx", map);
|
||||||
|
log.info(LocalDateTime.now()+"结束导出word报告");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.info(LocalDateTime.now()+"导出word报告出现异常:"+e.getMessage());
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void areaAssemble(BjCustomReportDTO bjReportDTO, ReportExportParam param, Map<String, PqsDicData> pqsDicDataMap) {
|
private void areaAssemble(BjCustomReportDTO bjReportDTO, ReportExportParam param, Map<String, PqsDicData> pqsDicDataMap) {
|
||||||
|
log.info(LocalDateTime.now()+"组装word报告");
|
||||||
|
|
||||||
List<PqsDeptDTO> pqsDeptsList = pqsDeptsMapper.getDeptList(param.getDeptList());
|
List<PqsDeptDTO> pqsDeptsList = pqsDeptsMapper.getDeptList(param.getDeptList());
|
||||||
Map<String,String> deptMap = pqsDeptsList.stream().collect(Collectors.toMap(PqsDeptDTO::getDeptsIndex,PqsDeptDTO::getDeptsname));
|
Map<String,String> deptMap = pqsDeptsList.stream().collect(Collectors.toMap(PqsDeptDTO::getDeptsIndex,PqsDeptDTO::getDeptsname));
|
||||||
List<String> areaContentList = new ArrayList<>();
|
List<String> areaContentList = new ArrayList<>();
|
||||||
List<Map<String,Object>> eventTemplateList = new ArrayList<>();
|
List<Map<String,Object>> eventTemplateList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = (List<LedgerBaseInfoDTO>)redisUtil.getObjectByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO");
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> LedgerBaseInfoDTOMap = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> finalEventTemplateList = eventTemplateList;
|
List<Map<String, Object>> finalEventTemplateList = eventTemplateList;
|
||||||
param.getDeptList().forEach(deptId->{
|
param.getDeptList().forEach(deptId->{
|
||||||
String deptName = deptMap.get(deptId);
|
String deptName = deptMap.get(deptId);
|
||||||
@@ -231,76 +269,90 @@ public class EasyPoiWordExportServiceImpl implements EasyPoiWordExportService {
|
|||||||
|
|
||||||
if(!CollectionUtils.isEmpty(lineIds)){
|
if(!CollectionUtils.isEmpty(lineIds)){
|
||||||
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex,lineIds));
|
List<PqUserLineAssPO> pqUserLineAssPOS = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex,lineIds));
|
||||||
List<String> userIds = pqUserLineAssPOS.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
if(CollectionUtils.isEmpty(pqUserLineAssPOS)){
|
||||||
|
|
||||||
LambdaQueryWrapper<PqUserLedgerPO> pqUserLedgerPOLambdaQueryWrapper = new LambdaQueryWrapper<PqUserLedgerPO>();
|
|
||||||
pqUserLedgerPOLambdaQueryWrapper.in(PqUserLedgerPO::getId,userIds).eq(PqUserLedgerPO::getIsShow,1);
|
|
||||||
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(pqUserLedgerPOLambdaQueryWrapper);
|
|
||||||
if(CollectionUtils.isEmpty(pqUserLedgerPOList)){
|
|
||||||
userContext ="不涉及半导体及重点关注用户。";
|
userContext ="不涉及半导体及重点关注用户。";
|
||||||
}else {
|
}else {
|
||||||
String companyName = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining("、", "(", ")"));
|
List<String> userIds = pqUserLineAssPOS.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
userContext="涉及"+pqUserLedgerPOList.size()+"家半导体及重点关注用户"+companyName+",";
|
|
||||||
//逆推监测点,过滤发生暂降事件
|
|
||||||
List<String> companyId = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
|
||||||
List<PqUserLineAssPO> pqUserLineAssPOS1 = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getUserIndex, companyId));
|
|
||||||
List<String> companyNameList = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.toList());
|
|
||||||
List<Integer> companyLineId= pqUserLineAssPOS1.stream().map(PqUserLineAssPO::getLineIndex).collect(Collectors.toList());
|
|
||||||
List<PqsEventdetail> companyevent = pqsEventdetailList.stream().filter(pqsEventdetail -> companyLineId.contains(pqsEventdetail.getLineid())).collect(Collectors.toList());
|
|
||||||
if(CollectionUtils.isEmpty(companyevent)){
|
|
||||||
userContext =userContext+"暂未发生暂态事件。";
|
|
||||||
}else {
|
|
||||||
|
|
||||||
for (int i = 0; i < pqsEventdetailList.size(); i++) {
|
LambdaQueryWrapper<PqUserLedgerPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
PqsEventdetail pqsEventdetail = pqsEventdetailList.get(i);
|
if (userIds.size() > 1000) {
|
||||||
|
List<List<String>> listUserIds = CollUtil.split(userIds, 1000);
|
||||||
List<LedgerBaseInfoDTO> baseLineInfo = pqLineMapper.getBaseLineInfo(Stream.of(pqsEventdetailList.get(i).getLineid()).collect(Collectors.toList()));
|
queryWrapper.eq(PqUserLedgerPO::getIsShow,1).and(w -> {
|
||||||
if(Objects.isNull(baseLineInfo.get(0).getObjName())){
|
for (List<String> ids : listUserIds) {
|
||||||
continue;
|
w.or(wIn -> wIn.in(PqUserLedgerPO::getId, ids));
|
||||||
}
|
}
|
||||||
String[] split = baseLineInfo.get(0).getObjName().split(";");
|
});
|
||||||
for (int i1 = 0; i1 < split.length; i1++) {
|
} else {
|
||||||
if(companyNameList.contains(split[i1])){
|
queryWrapper.eq(PqUserLedgerPO::getIsShow,1).in(PqUserLedgerPO::getId, userIds);
|
||||||
EventTemplate eventTemplate = new EventTemplate();
|
}
|
||||||
eventTemplate.setTimeId(pqsEventdetail.getTimeid().format(DatePattern.NORM_DATETIME_FORMATTER)+"."+pqsEventdetail.getMs());
|
List<PqUserLedgerPO> pqUserLedgerPOList = pqUserLedgerMapper.selectList(queryWrapper);
|
||||||
eventTemplate.setOrgName(baseLineInfo.get(0).getGdName());
|
if(CollectionUtils.isEmpty(pqUserLedgerPOList)){
|
||||||
eventTemplate.setSubName(baseLineInfo.get(0).getStationName());
|
userContext ="不涉及半导体及重点关注用户。";
|
||||||
eventTemplate.setBusName(baseLineInfo.get(0).getBusBarName());
|
}else {
|
||||||
eventTemplate.setScale(pqsDicDataMap.get(baseLineInfo.get(0).getScale()).getDicName());
|
String companyName = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining("、", "(", ")"));
|
||||||
eventTemplate.setDuration(String.format("%.3f",pqsEventdetail.getPersisttime()/1000));
|
userContext="涉及"+pqUserLedgerPOList.size()+"家半导体及重点关注用户"+companyName+",";
|
||||||
eventTemplate.setResidualVoltage(String.format("%.2f",pqsEventdetail.getEventvalue()*100));
|
//逆推监测点,过滤发生暂降事件
|
||||||
eventTemplate.setUserName(split[i1]);
|
List<String> companyId = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getId).collect(Collectors.toList());
|
||||||
Map<String,Object> eventMap = mapper.convertValue(eventTemplate,Map.class);
|
List<PqUserLineAssPO> pqUserLineAssPOS1 = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getUserIndex, companyId));
|
||||||
finalEventTemplateList.add(eventMap);
|
List<String> companyNameList = pqUserLedgerPOList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.toList());
|
||||||
|
List<Integer> companyLineId= pqUserLineAssPOS1.stream().map(PqUserLineAssPO::getLineIndex).collect(Collectors.toList());
|
||||||
|
List<PqsEventdetail> companyevent = pqsEventdetailList.stream().filter(pqsEventdetail -> companyLineId.contains(pqsEventdetail.getLineid())).collect(Collectors.toList());
|
||||||
|
if(CollectionUtils.isEmpty(companyevent)){
|
||||||
|
userContext =userContext+"暂未发生暂态事件。";
|
||||||
|
}else {
|
||||||
|
|
||||||
|
for (int i = 0; i < pqsEventdetailList.size(); i++) {
|
||||||
|
PqsEventdetail pqsEventdetail = pqsEventdetailList.get(i);
|
||||||
|
|
||||||
|
LedgerBaseInfoDTO baseLineInfo = LedgerBaseInfoDTOMap.get(pqsEventdetail.getLineid());
|
||||||
|
if(Objects.isNull(baseLineInfo.getObjName())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] split = baseLineInfo.getObjName().split(";");
|
||||||
|
for (int i1 = 0; i1 < split.length; i1++) {
|
||||||
|
if(companyNameList.contains(split[i1])){
|
||||||
|
EventTemplate eventTemplate = new EventTemplate();
|
||||||
|
eventTemplate.setTimeId(pqsEventdetail.getTimeid().format(DatePattern.NORM_DATETIME_FORMATTER)+"."+pqsEventdetail.getMs());
|
||||||
|
eventTemplate.setOrgName(baseLineInfo.getGdName());
|
||||||
|
eventTemplate.setSubName(baseLineInfo.getStationName());
|
||||||
|
eventTemplate.setBusName(baseLineInfo.getBusBarName());
|
||||||
|
eventTemplate.setScale(pqsDicDataMap.get(baseLineInfo.getScale()).getDicName());
|
||||||
|
eventTemplate.setDuration(String.format("%.3f",pqsEventdetail.getPersisttime()/1000));
|
||||||
|
eventTemplate.setResidualVoltage(String.format("%.2f",pqsEventdetail.getEventvalue()*100));
|
||||||
|
eventTemplate.setUserName(split[i1]);
|
||||||
|
Map<String,Object> eventMap = mapper.convertValue(eventTemplate,Map.class);
|
||||||
|
finalEventTemplateList.add(eventMap);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Integer companyEveCount = companyevent.size();
|
||||||
|
|
||||||
|
List<Integer> companyLineIds = companyevent.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
||||||
|
List<LedgerBaseInfoDTO> companyLedgerBaseInfoDTOList = pqLineMapper.getBaseLedger(companyLineIds,null);
|
||||||
|
long companyStationCount = companyLedgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getStationId).distinct().count();
|
||||||
|
long companyBusCount = companyLedgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getBusBarId).distinct().count();
|
||||||
|
|
||||||
|
String companyStationStr = stationVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap);
|
||||||
|
String companyAreabusVoltageDeal = areabusVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap);
|
||||||
|
String companyMin =String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01) ;
|
||||||
|
String companyMax = String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01) ;
|
||||||
|
|
||||||
|
String companyResidualVoltage = companyMin+"%-"+companyMax+"%";
|
||||||
|
|
||||||
|
double companyMinPersisTime = companyevent.stream().mapToDouble(PqsEventdetail::getPersisttime).min().getAsDouble()/1000;
|
||||||
|
double companyMaxPersisTime = companyevent.stream().mapToDouble(PqsEventdetail::getPersisttime).max().getAsDouble()/1000;
|
||||||
|
String companyDuration = companyMinPersisTime+"s-"+companyMaxPersisTime+"s";
|
||||||
|
String companyTemp ="电压暂降事件%s条,变电站%s座,母线%s条,其中:%s,造成%s发生电压暂降,残余电压范围为%s,持续时间范围为%s。";
|
||||||
|
userContext = userContext+String.format(companyTemp,companyEveCount,companyStationCount,companyBusCount,companyStationStr,companyAreabusVoltageDeal,companyResidualVoltage,companyDuration);
|
||||||
}
|
}
|
||||||
Integer companyEveCount = companyevent.size();
|
|
||||||
|
|
||||||
List<Integer> companyLineIds = companyevent.stream().map(PqsEventdetail::getLineid).distinct().collect(Collectors.toList());
|
|
||||||
List<LedgerBaseInfoDTO> companyLedgerBaseInfoDTOList = pqLineMapper.getBaseLedger(companyLineIds,null);
|
|
||||||
long companyStationCount = companyLedgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getStationId).distinct().count();
|
|
||||||
long companyBusCount = companyLedgerBaseInfoDTOList.stream().map(LedgerBaseInfoDTO::getBusBarId).distinct().count();
|
|
||||||
|
|
||||||
String companyStationStr = stationVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap);
|
|
||||||
String companyAreabusVoltageDeal = areabusVoltageDeal(companyLedgerBaseInfoDTOList,pqsDicDataMap);
|
|
||||||
String companyMin =String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).min().getAsDouble()*100*100)*0.01) ;
|
|
||||||
String companyMax = String.format("%.2f",Math.round(pqsEventdetailList.stream().mapToDouble(PqsEventdetail::getEventvalue).max().getAsDouble()*100*100)*0.01) ;
|
|
||||||
|
|
||||||
String companyResidualVoltage = companyMin+"%-"+companyMax+"%";
|
|
||||||
|
|
||||||
double companyMinPersisTime = companyevent.stream().mapToDouble(PqsEventdetail::getPersisttime).min().getAsDouble()/1000;
|
|
||||||
double companyMaxPersisTime = companyevent.stream().mapToDouble(PqsEventdetail::getPersisttime).max().getAsDouble()/1000;
|
|
||||||
String companyDuration = companyMinPersisTime+"s-"+companyMaxPersisTime+"s";
|
|
||||||
String companyTemp ="电压暂降事件%s条,变电站%s座,母线%s条,其中:%s,造成%s发生电压暂降,残余电压范围为%s,持续时间范围为%s。";
|
|
||||||
userContext = userContext+String.format(companyTemp,companyEveCount,companyStationCount,companyBusCount,companyStationStr,companyAreabusVoltageDeal,companyResidualVoltage,companyDuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
userContext ="不涉及半导体及重点关注用户。";
|
userContext ="不涉及半导体及重点关注用户。";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ public class WordTemplate {
|
|||||||
MyXWPFDocument document = new MyXWPFDocument (temPath);
|
MyXWPFDocument document = new MyXWPFDocument (temPath);
|
||||||
|
|
||||||
WordExportUtil.exportWord07(document, data);
|
WordExportUtil.exportWord07(document, data);
|
||||||
|
System.out.println("开始合并单元格");
|
||||||
mergeTableCells(document);
|
mergeTableCells(document);
|
||||||
try (OutputStream outputStream = response.getOutputStream()) {
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
document.write(outputStream);
|
document.write(outputStream);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.njcn.product.event.transientes.controller;
|
package com.njcn.product.event.transientes.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
@@ -12,6 +15,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
|
import com.njcn.product.event.devcie.config.PqlineCache;
|
||||||
|
import com.njcn.product.event.devcie.job.LineCacheJob;
|
||||||
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
import com.njcn.product.event.devcie.mapper.PqLineMapper;
|
||||||
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
import com.njcn.product.event.devcie.pojo.dto.LedgerBaseInfoDTO;
|
||||||
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
import com.njcn.product.event.devcie.pojo.po.PqLine;
|
||||||
@@ -19,13 +24,16 @@ import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
|||||||
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.product.event.transientes.mapper.PqUserLedgerMapper;
|
import com.njcn.product.event.transientes.mapper.PqUserLedgerMapper;
|
||||||
import com.njcn.product.event.transientes.mapper.PqUserLineAssMapper;
|
import com.njcn.product.event.transientes.mapper.PqUserLineAssMapper;
|
||||||
|
import com.njcn.product.event.transientes.mapper.PqsEventdetailMapper;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.SmsResponseDTO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.SmsSendDTO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.dto.UpLoadEvent;
|
||||||
import com.njcn.product.event.transientes.pojo.param.MonitorTerminalParam;
|
import com.njcn.product.event.transientes.pojo.param.MonitorTerminalParam;
|
||||||
import com.njcn.product.event.transientes.pojo.param.SimulationMsgParam;
|
|
||||||
import com.njcn.product.event.transientes.pojo.po.*;
|
import com.njcn.product.event.transientes.pojo.po.*;
|
||||||
import com.njcn.product.event.transientes.service.*;
|
import com.njcn.product.event.transientes.service.*;
|
||||||
import com.njcn.product.event.transientes.service.impl.MsgEventInfoServiceImpl;
|
import com.njcn.product.event.transientes.utils.SmsUtils;
|
||||||
import com.njcn.product.event.transientes.websocket.WebSocketServer;
|
import com.njcn.product.event.transientes.websocket.WebSocketServer;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -34,7 +42,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -58,12 +66,13 @@ import static com.njcn.product.event.transientes.pojo.constant.RedisConstant.RED
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class EventGateController extends BaseController {
|
public class EventGateController extends BaseController {
|
||||||
private final MsgEventInfoServiceImpl msgEventInfoServiceImpl;
|
|
||||||
private final PqUserLineAssMapper pqUserLineAssMapper;
|
private final PqUserLineAssMapper pqUserLineAssMapper;
|
||||||
private final PqUserLedgerMapper pqUserLedgerMapper;
|
private final PqUserLedgerMapper pqUserLedgerMapper;
|
||||||
|
private final PqsEventdetailMapper pqsEventdetailMapper;
|
||||||
@Value("${SYS_TYPE_ZT}")
|
@Value("${SYS_TYPE_ZT}")
|
||||||
private String sysTypeZt;
|
private String sysTypeZt;
|
||||||
|
|
||||||
|
|
||||||
private final WebSocketServer webSocketServer;
|
private final WebSocketServer webSocketServer;
|
||||||
|
|
||||||
private final PqsDeptslineService pqsDeptslineService;
|
private final PqsDeptslineService pqsDeptslineService;
|
||||||
@@ -84,6 +93,10 @@ public class EventGateController extends BaseController {
|
|||||||
|
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
|
private final SmsUtils smsUtils;
|
||||||
|
|
||||||
|
private final ThreadPoolTaskExecutor smsTaskExecutor;
|
||||||
|
private final PqlineCache pqlineCache;
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@GetMapping("/eventMsg")
|
@GetMapping("/eventMsg")
|
||||||
@@ -91,7 +104,7 @@ public class EventGateController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "eventMsg", value = "暂态事件json字符", required = true)
|
@ApiImplicitParam(name = "eventMsg", value = "暂态事件json字符", required = true)
|
||||||
public HttpResult<Object> eventMsg(@RequestParam("msg") String msg) {
|
public HttpResult<Object> eventMsg(@RequestParam("msg") String msg) {
|
||||||
String methodDescribe = getMethodDescribe("eventMsg");
|
String methodDescribe = getMethodDescribe("eventMsg");
|
||||||
log.info("收到前置推送暂降事件:"+msg);
|
log.info("收到前置推送暂降事件,事件详情:" + msg);
|
||||||
|
|
||||||
JSONObject jsonObject;
|
JSONObject jsonObject;
|
||||||
try {
|
try {
|
||||||
@@ -102,28 +115,58 @@ public class EventGateController extends BaseController {
|
|||||||
|
|
||||||
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())
|
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString())
|
||||||
&& Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()
|
&& Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()
|
||||||
&& (Float.parseFloat(jsonObject.get("persisttime").toString())*1000) >= msgEventConfigService.getEventDuration()) {
|
&& (Float.parseFloat(jsonObject.get("persisttime").toString()) * 1000) >= msgEventConfigService.getEventDuration()) {
|
||||||
//过滤重要暂降事件
|
//过滤重要暂降事件
|
||||||
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
//F47过滤
|
||||||
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getLineIndex,lineId));
|
float eventvalue = Float.parseFloat(jsonObject.get("eventvalue").toString());
|
||||||
|
float persisttime = Float.parseFloat(jsonObject.get("persisttime").toString()) * 1000;
|
||||||
|
if(shouldSendSMS(eventvalue,persisttime)){
|
||||||
|
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
||||||
|
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().eq(PqUserLineAssPO::getLineIndex, lineId));
|
||||||
|
|
||||||
|
String str ;
|
||||||
|
if (CollUtil.isNotEmpty(assList)) {
|
||||||
|
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
|
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId, PqUserLedgerPO::getCustomerName,PqUserLedgerPO::getIsShow).in(PqUserLedgerPO::getId, userIds));
|
||||||
|
List<PqUserLedgerPO> isShowUser = poList.stream().filter(temp -> temp.getIsShow() == 1).collect(Collectors.toList());
|
||||||
|
List<PqUserLedgerPO> noShowUser = poList.stream().filter(temp -> temp.getIsShow() != 1).collect(Collectors.toList());
|
||||||
|
String strUser="" ;
|
||||||
|
|
||||||
|
if(CollectionUtil.isEmpty(isShowUser)){
|
||||||
|
strUser =strUser+"影响集成电路敏感用户:无;";
|
||||||
|
}else {
|
||||||
|
String sensitiveUser = isShowUser.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(";"));
|
||||||
|
strUser =strUser+"影响集成电路敏感用户:"+sensitiveUser+";";
|
||||||
|
}
|
||||||
|
if(CollectionUtil.isEmpty(noShowUser)){
|
||||||
|
strUser =strUser+"影响其他用户:无;";
|
||||||
|
}else {
|
||||||
|
String sensitiveUser = noShowUser.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(";"));
|
||||||
|
strUser =strUser+"影响其他用户:"+sensitiveUser+";";
|
||||||
|
}
|
||||||
|
str = strUser;
|
||||||
|
} else {
|
||||||
|
str = "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PqsDepts> deptsList = (List<PqsDepts>) redisUtil.getObjectByKey(REDIS_DEPT_INDEX + StrUtil.DASHED + "AllDept");
|
||||||
|
Map<String, PqsDepts> deptsMap = deptsList.stream().collect(Collectors.toMap(PqsDepts::getDeptsIndex, dept -> dept));
|
||||||
|
|
||||||
|
List<PqsDeptsline> deptslineList = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).list();
|
||||||
|
List<String> deptIds = deptslineList.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toList());
|
||||||
|
Set<String> set = getAllParentIdsWithChildrenBatch(deptIds, deptsMap);
|
||||||
|
jsonObject.putOpt("objName", str);
|
||||||
|
jsonObject.putOpt("dept", String.join(StrUtil.COMMA, set));
|
||||||
|
|
||||||
|
webSocketServer.sendMessageToAll(jsonObject.toString());
|
||||||
|
|
||||||
|
//针对前置推送的暂降事件进行短信发送功能
|
||||||
|
smsTaskExecutor.execute(() -> {
|
||||||
|
sendMessage(jsonObject, str);
|
||||||
|
});
|
||||||
|
|
||||||
String str ="/";
|
|
||||||
if(CollUtil.isNotEmpty(assList)){
|
|
||||||
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
|
||||||
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().select(PqUserLedgerPO::getId,PqUserLedgerPO::getCustomerName).in(PqUserLedgerPO::getId,userIds));
|
|
||||||
str = poList.stream().map(PqUserLedgerPO::getCustomerName).collect(Collectors.joining(StrUtil.COMMA));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PqsDepts> deptsList = (List<PqsDepts>)redisUtil.getObjectByKey(REDIS_DEPT_INDEX+ StrUtil.DASHED+"AllDept");
|
|
||||||
Map<String,PqsDepts> deptsMap = deptsList.stream().collect(Collectors.toMap(PqsDepts::getDeptsIndex,dept->dept));
|
|
||||||
|
|
||||||
List<PqsDeptsline> deptslineList = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex,lineId).list();
|
|
||||||
List<String> deptIds = deptslineList.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toList());
|
|
||||||
Set<String> set =getAllParentIdsWithChildrenBatch(deptIds,deptsMap);
|
|
||||||
jsonObject.putOpt("objName",str);
|
|
||||||
jsonObject.putOpt("dept", String.join(StrUtil.COMMA, set));
|
|
||||||
|
|
||||||
webSocketServer.sendMessageToAll(jsonObject.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -133,6 +176,27 @@ public class EventGateController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldSendSMS( Float value , Float time ) {
|
||||||
|
|
||||||
|
|
||||||
|
// 条件1: 电压降至50%以下,持续时间超过20ms
|
||||||
|
if (value < 0.5 && time >= 20) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 条件2: 电压降至50%—70%,持续时间超过200ms
|
||||||
|
if (value >= 50 && value < 70 && time >= 200) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 条件3: 电压降至70%—80%,持续时间超过500ms
|
||||||
|
if (value >= 70 && value < 80 && time >= 500) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<String> getAllParentIdsRecursive(String deptId, Map<String, PqsDepts> deptMap, Set<String> result) {
|
public Set<String> getAllParentIdsRecursive(String deptId, Map<String, PqsDepts> deptMap, Set<String> result) {
|
||||||
if (deptId == null || result.contains(deptId)) {
|
if (deptId == null || result.contains(deptId)) {
|
||||||
return result;
|
return result;
|
||||||
@@ -166,15 +230,20 @@ public class EventGateController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
//下面一行代码正式环境需要放开
|
//下面一行代码正式环境需要放开
|
||||||
jsonObject = test();
|
jsonObject = test();
|
||||||
|
List<PqsDepts> deptsList = (List<PqsDepts>) redisUtil.getObjectByKey(REDIS_DEPT_INDEX + StrUtil.DASHED + "AllDept");
|
||||||
|
List<String> deptIds = deptsList.stream().map(PqsDepts::getDeptsIndex).distinct().collect(Collectors.toList());
|
||||||
|
jsonObject.putOpt("dept", String.join(StrUtil.COMMA,deptIds));
|
||||||
|
|
||||||
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) &&Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
|
if (msgEventConfigService.getEventType().contains(jsonObject.get("wavetype").toString()) && Float.parseFloat(jsonObject.get("eventvalue").toString()) <= msgEventConfigService.getEventValue()) {
|
||||||
|
log.info("122345678788999999----------测试发送数据成功: {}",jsonObject);
|
||||||
webSocketServer.sendMessageToAll(jsonObject.toString());
|
webSocketServer.sendMessageToAll(jsonObject.toString());
|
||||||
|
|
||||||
//开始发送短信
|
//开始发送短信
|
||||||
try {
|
try {
|
||||||
sendMessage(jsonObject);
|
sendMessage(jsonObject, "/");
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error("短信组装发送失败!失败原因{}",e.getMessage());
|
e.printStackTrace();
|
||||||
|
log.error("短信组装发送失败!失败原因{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -185,6 +254,8 @@ public class EventGateController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final int MAX_RETRY_COUNT = 3; // 最大重试次数
|
||||||
|
|
||||||
|
|
||||||
//测试模拟,正式环境删除
|
//测试模拟,正式环境删除
|
||||||
private PqsEventdetail createEvent(JSONObject jsonObject, LocalDateTime now) {
|
private PqsEventdetail createEvent(JSONObject jsonObject, LocalDateTime now) {
|
||||||
@@ -208,8 +279,19 @@ public class EventGateController extends BaseController {
|
|||||||
//以下部分为测试数据后续删除
|
//以下部分为测试数据后续删除
|
||||||
List<PqLine> pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>());
|
List<PqLine> pqLineList = pqLineMapper.selectList(new LambdaQueryWrapper<>());
|
||||||
List<Integer> lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
List<Integer> lineList = pqLineList.stream().map(PqLine::getLineIndex).collect(Collectors.toList());
|
||||||
List<LedgerBaseInfoDTO> baseInfoDTOList = pqLineMapper.getBaseLineInfo(lineList);
|
|
||||||
Map<Integer, LedgerBaseInfoDTO> map = baseInfoDTOList.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = new ArrayList<>();
|
||||||
|
if(lineList.size()>1000){
|
||||||
|
List<List<Integer>> listIds = CollUtil.split(lineList,1000);
|
||||||
|
for(List<Integer> itemIds : listIds){
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(itemIds);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<LedgerBaseInfoDTO> temp =pqLineMapper.getBaseLineInfo(lineList);
|
||||||
|
ledgerBaseInfoDTOS.addAll(temp);
|
||||||
|
}
|
||||||
|
Map<Integer, LedgerBaseInfoDTO> map = ledgerBaseInfoDTOS.stream().collect(Collectors.toMap(LedgerBaseInfoDTO::getLineId, Function.identity()));
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Integer lineId = lineList.get(random.nextInt(lineList.size()));
|
Integer lineId = lineList.get(random.nextInt(lineList.size()));
|
||||||
@@ -223,7 +305,7 @@ public class EventGateController extends BaseController {
|
|||||||
Integer wave = random.nextInt(2);
|
Integer wave = random.nextInt(2);
|
||||||
|
|
||||||
|
|
||||||
Double per = (double)random.nextInt(5000);
|
Double per = (double) random.nextInt(5000);
|
||||||
|
|
||||||
double minV = 0.1;
|
double minV = 0.1;
|
||||||
double maxV = 0.9;
|
double maxV = 0.9;
|
||||||
@@ -267,53 +349,124 @@ public class EventGateController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/simulationSend")
|
@GetMapping("/phoneSend")
|
||||||
@ApiOperation("模拟发送短信")
|
@ApiOperation("模拟发送短信")
|
||||||
public HttpResult<WaveDataDTO> simulationSend(@RequestBody @Validated SimulationMsgParam param) {
|
public HttpResult<String> simulationSend(@RequestParam("id") String id) {
|
||||||
|
|
||||||
String methodDescribe = getMethodDescribe("simulationSend");
|
String methodDescribe = getMethodDescribe("simulationSend");
|
||||||
|
|
||||||
|
PqsEventdetail pqsEventdetail = pqsEventdetailMapper.selectOne(new LambdaQueryWrapper<PqsEventdetail>().eq(PqsEventdetail::getEventdetailIndex, id));
|
||||||
|
UpLoadEvent upLoadEvent = new UpLoadEvent();
|
||||||
|
upLoadEvent.setEventdetail_index(pqsEventdetail.getEventdetailIndex());
|
||||||
|
upLoadEvent.setMs(pqsEventdetail.getMs());
|
||||||
|
upLoadEvent.setBdname("测试电站");
|
||||||
|
upLoadEvent.setLineid(pqsEventdetail.getLineid());
|
||||||
|
upLoadEvent.setTimeid(LocalDateTimeUtil.format(pqsEventdetail.getTimeid(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
upLoadEvent.setWavetype(pqsEventdetail.getWavetype());
|
||||||
|
upLoadEvent.setPersisttime(pqsEventdetail.getPersisttime());
|
||||||
|
upLoadEvent.setEventvalue(pqsEventdetail.getEventvalue());
|
||||||
|
upLoadEvent.setEventreason("");
|
||||||
|
upLoadEvent.setEventtype(pqsEventdetail.getEventtype());
|
||||||
|
upLoadEvent.setPointname("测试监测点");
|
||||||
|
upLoadEvent.setGdname("测试供电公司");
|
||||||
|
JSONObject jsonObject = new JSONObject(upLoadEvent);
|
||||||
|
|
||||||
|
sendMessage(jsonObject, "/");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendMessage(JSONObject jsonObject) throws Exception{
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
@GetMapping("/simpleTest")
|
||||||
List<PqsDeptsline> pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
@ApiOperation("模拟发送简单测试短信")
|
||||||
Set<String> deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet());
|
public HttpResult<Object> simpleTest() {
|
||||||
Set<String> resultIds = getAllParentDeptIds(deptIds);
|
String methodDescribe = getMethodDescribe("simulationSend");
|
||||||
|
List<SmsSendDTO.ItemInner> msgDTOList = new ArrayList<>();
|
||||||
|
SmsSendDTO.ItemInner msgDTO = new SmsSendDTO.ItemInner();
|
||||||
|
msgDTO.setCustomMsgID(IdUtil.simpleUUID());
|
||||||
|
msgDTO.setContent("test");
|
||||||
|
msgDTO.setTo("18815508963");
|
||||||
|
msgDTOList.add(msgDTO);
|
||||||
|
List<SmsResponseDTO.SmsItem> result = smsUtils.sendSmSToUser(msgDTOList);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
List<PqsUserSet> pqsUserSetList = pqsUsersetService.lambdaQuery().eq(PqsUserSet::getIsNotice, 1).in(PqsUserSet::getDeptsIndex, resultIds).list();
|
|
||||||
if (CollUtil.isEmpty(pqsUserSetList)) {
|
|
||||||
//当前事件未找到用户信息,判断为不需要发送短信用户
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<PqsUser> pqsUserList = pqsUserService.lambdaQuery().select(PqsUser::getUserIndex,PqsUser::getPhone,PqsUser::getName).in(PqsUser::getUserIndex, pqsUserSetList.stream().map(PqsUserSet::getUserIndex).collect(Collectors.toList())).list();
|
|
||||||
List<String> userIds = pqsUserList.stream().map(PqsUser::getUserIndex).collect(Collectors.toList());
|
|
||||||
List<PqsUserSet> poList = pqsUserSetList.stream().filter(it -> userIds.contains(it.getUserIndex())).collect(Collectors.toList());
|
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString());
|
|
||||||
List<LedgerBaseInfoDTO> list = pqLineMapper.getBaseLineInfo(Stream.of(lineId).collect(Collectors.toList()));
|
|
||||||
LedgerBaseInfoDTO ledgerBaseInfoDTO = list.get(0);
|
|
||||||
BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
|
|
||||||
stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(", ").append(ledgerBaseInfoDTO.getStationName()).append(ledgerBaseInfoDTO.getLineName())
|
|
||||||
.append("发生暂降事件,事件特征幅值").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S");
|
|
||||||
//TODO 发送短信
|
|
||||||
// System.out.println(stringBuilder);
|
|
||||||
|
|
||||||
List<MsgEventInfo> resultList = new ArrayList<>();
|
private void sendMessage(JSONObject jsonObject, String objStr) {
|
||||||
for (PqsUser user : pqsUserList) {
|
try {
|
||||||
MsgEventInfo msgEventInfo = new MsgEventInfo();
|
if (!"/".equals(objStr)) {
|
||||||
msgEventInfo.setEventIndex(jsonObject.get("eventdetail_index").toString());
|
log.info("-------------------------开始执行短信发送逻辑{}", System.currentTimeMillis());
|
||||||
msgEventInfo.setMsgContent(stringBuilder.toString());
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
msgEventInfo.setMsgIndex(IdUtil.simpleUUID());
|
Integer lineId = Integer.valueOf(jsonObject.get("lineid").toString());
|
||||||
msgEventInfo.setPhone(user.getPhone());
|
List<PqsDeptsline> pqLineDept = pqsDeptslineService.lambdaQuery().eq(PqsDeptsline::getLineIndex, lineId).eq(PqsDeptsline::getSystype, sysTypeZt).list();
|
||||||
msgEventInfo.setSendResult(0);
|
Set<String> deptIds = pqLineDept.stream().map(PqsDeptsline::getDeptsIndex).collect(Collectors.toSet());
|
||||||
msgEventInfo.setUserId(user.getUserIndex());
|
Set<String> resultIds = getAllParentDeptIds(deptIds);
|
||||||
msgEventInfo.setUserName(user.getName());
|
|
||||||
msgEventInfo.setIsHandle(0);
|
List<PqsUserSet> pqsUserSetList = pqsUsersetService.lambdaQuery().eq(PqsUserSet::getIsNotice, 1).in(PqsUserSet::getDeptsIndex, resultIds).list();
|
||||||
msgEventInfo.setSendTime(LocalDateTime.now());
|
if (CollUtil.isEmpty(pqsUserSetList)) {
|
||||||
resultList.add(msgEventInfo);
|
//当前事件未找到用户信息,判断为不需要发送短信用户
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<PqsUser> pqsUserList = pqsUserService.lambdaQuery().select(PqsUser::getUserIndex, PqsUser::getPhone, PqsUser::getName).in(PqsUser::getUserIndex, pqsUserSetList.stream().map(PqsUserSet::getUserIndex).collect(Collectors.toList())).list();
|
||||||
|
List<String> userIds = pqsUserList.stream().map(PqsUser::getUserIndex).collect(Collectors.toList());
|
||||||
|
List<PqsUserSet> poList = pqsUserSetList.stream().filter(it -> userIds.contains(it.getUserIndex())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
|
StringBuilder stringBuilder = new StringBuilder(jsonObject.get("timeid").toString());
|
||||||
|
String busName = jsonObject.containsKey("busname")? "_"+jsonObject.get("busname").toString():"";
|
||||||
|
BigDecimal bigDecimal = new BigDecimal(jsonObject.get("eventvalue").toString()).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP);
|
||||||
|
stringBuilder.append(".").append(jsonObject.get("ms").toString()).append(",").append(jsonObject.get("bdname").toString()).append(busName)
|
||||||
|
// .append("_").append(jsonObject.get("pointname").toString())
|
||||||
|
.append("发生电压暂降事件,事件残余电压").append(bigDecimal).append("%,持续时间:").append(jsonObject.get("persisttime").toString()).append("S;");
|
||||||
|
stringBuilder.append(objStr);
|
||||||
|
|
||||||
|
String message;
|
||||||
|
if (stringBuilder.length() > 500) {
|
||||||
|
message = stringBuilder.substring(0, 490).concat(";详情请登录电压暂降监测平台查看。");
|
||||||
|
} else {
|
||||||
|
message = stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MsgEventInfo> resultList = new ArrayList<>();
|
||||||
|
List<SmsSendDTO.ItemInner> msgDTOList = new ArrayList<>();
|
||||||
|
for (PqsUser user : pqsUserList) {
|
||||||
|
String msgId = IdUtil.simpleUUID();
|
||||||
|
|
||||||
|
SmsSendDTO.ItemInner dto = new SmsSendDTO.ItemInner();
|
||||||
|
dto.setContent(message);
|
||||||
|
dto.setTo(user.getPhone());
|
||||||
|
dto.setCustomMsgID(msgId);
|
||||||
|
msgDTOList.add(dto);
|
||||||
|
|
||||||
|
MsgEventInfo msgEventInfo = new MsgEventInfo();
|
||||||
|
msgEventInfo.setMsgIndex(msgId);
|
||||||
|
msgEventInfo.setMsgContent(message);
|
||||||
|
msgEventInfo.setPhone(user.getPhone());
|
||||||
|
msgEventInfo.setUserId(user.getUserIndex());
|
||||||
|
msgEventInfo.setUserName(user.getName());
|
||||||
|
msgEventInfo.setIsHandle(0);
|
||||||
|
msgEventInfo.setSendResult(0);
|
||||||
|
msgEventInfo.setSendTime(LocalDateTime.now());
|
||||||
|
msgEventInfo.setEventIndex(jsonObject.get("eventdetail_index").toString());
|
||||||
|
resultList.add(msgEventInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SmsResponseDTO.SmsItem> result = smsUtils.sendSmSToUser(msgDTOList);
|
||||||
|
Map<String, SmsResponseDTO.SmsItem> stringSmsItemMap = result.stream().collect(Collectors.toMap(SmsResponseDTO.SmsItem::getCustomMsgID, Function.identity()));
|
||||||
|
|
||||||
|
resultList.forEach(item -> {
|
||||||
|
if (stringSmsItemMap.containsKey(item.getMsgIndex())) {
|
||||||
|
SmsResponseDTO.SmsItem smsItem = stringSmsItemMap.get(item.getMsgIndex());
|
||||||
|
item.setSendResult(Objects.equals(smsItem.getCode(), "0") ? 1 : 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
msgEventInfoService.saveBatch(resultList);
|
||||||
|
}
|
||||||
|
log.info("{}-------------短信发送执行结束,执行时长{}s", System.currentTimeMillis(), timeInterval.intervalSecond());
|
||||||
}
|
}
|
||||||
msgEventInfoService.saveBatch(resultList);
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("---------短信发送异常,异常信息", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,7 +478,9 @@ public class EventGateController extends BaseController {
|
|||||||
return "token";
|
return "token";
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean apiSend(){
|
private boolean apiSend() {
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,6 +515,11 @@ public class EventGateController extends BaseController {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@GetMapping("/refreshIdCache")
|
||||||
|
@ApiOperation("刷新缓存")
|
||||||
|
public Boolean refreshIdCache() {
|
||||||
|
pqlineCache.init();
|
||||||
|
return true;// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "数据同步");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.njcn.product.event.transientes.controller;
|
package com.njcn.product.event.transientes.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.OperateType;
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.product.event.dataTransmit.DataSynchronization;
|
||||||
import com.njcn.product.event.devcie.pojo.dto.DeviceDTO;
|
import com.njcn.product.event.devcie.pojo.dto.DeviceDTO;
|
||||||
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
||||||
import com.njcn.product.event.transientes.pojo.param.MessageEventFeedbackParam;
|
import com.njcn.product.event.transientes.pojo.param.MessageEventFeedbackParam;
|
||||||
@@ -18,6 +22,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -274,5 +279,27 @@ public class LargeScreenCountController extends BaseController {
|
|||||||
Page<EventDetailVO> result = largeScreenCountService.userEventList(largeScreenCountParam);
|
Page<EventDetailVO> result = largeScreenCountService.userEventList(largeScreenCountParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/exportLineData")
|
||||||
|
@ApiOperation("导出台账数据数据")
|
||||||
|
public void exportEventData() {
|
||||||
|
largeScreenCountService.exportLineData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataSynchronization synchronization;
|
||||||
|
|
||||||
|
@GetMapping("sycnEvent")
|
||||||
|
public boolean sycnEvent(@RequestParam("startDateTime") String startDateTime,@RequestParam("endDateTime") String endDateTime) throws Exception {
|
||||||
|
synchronization.syncEvents(LocalDateTimeUtil.parse(startDateTime, DatePattern.NORM_DATETIME_PATTERN),LocalDateTimeUtil.parse(endDateTime, DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("sycnUser")
|
||||||
|
public boolean sycnUser() throws Exception {
|
||||||
|
synchronization.syncUser();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public class PqUserLedgerController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PqUserLedgerService pqUserLedgerService;
|
private PqUserLedgerService pqUserLedgerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 添加记录
|
// 添加记录
|
||||||
@PostMapping("addLedger")
|
@PostMapping("addLedger")
|
||||||
public boolean addLedger(@RequestBody PqUserLedgerParam ledgerParam) {
|
public boolean addLedger(@RequestBody PqUserLedgerParam ledgerParam) {
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.njcn.product.event.transientes.job;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
|
import org.springframework.scheduling.support.CronTrigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-16
|
||||||
|
* @Description: 定时同步暂降数据包
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@EnableScheduling
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ScheduledEvent implements SchedulingConfigurer {
|
||||||
|
|
||||||
|
// @Value("${}")
|
||||||
|
private final String cronStr = "0 0 */2 * * ?";
|
||||||
|
|
||||||
|
// 源文件夹路径
|
||||||
|
private final String sourceFolderPath = "D:\\";
|
||||||
|
// 压缩文件输出路径
|
||||||
|
private final String zipOutputPath = "./output_zips";
|
||||||
|
// 最终存放压缩文件的目录
|
||||||
|
private final String finalDestination = "./archive";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||||
|
taskRegistrar.addTriggerTask(
|
||||||
|
() -> dataToFile(),
|
||||||
|
triggerContext -> {
|
||||||
|
CronTrigger trigger = new CronTrigger(cronStr);
|
||||||
|
return trigger.nextExecutionTime(triggerContext);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dataToFile() {
|
||||||
|
try {
|
||||||
|
// 1. 创建临时文件夹并写入测试文件
|
||||||
|
String folderName = "data_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss"));
|
||||||
|
Path sourceDir = Paths.get(sourceFolderPath, folderName);
|
||||||
|
Files.createDirectories(sourceDir);
|
||||||
|
|
||||||
|
// 模拟生成文件(例如:log.txt)
|
||||||
|
Path testFile = sourceDir.resolve("log.txt");
|
||||||
|
Files.write(testFile, "This is a test log file.".getBytes(), StandardOpenOption.CREATE);
|
||||||
|
|
||||||
|
// 2. 压缩文件夹
|
||||||
|
Path zipOutputDir = Paths.get(zipOutputPath);
|
||||||
|
Files.createDirectories(zipOutputDir);
|
||||||
|
Path zipFile = zipOutputDir.resolve(folderName + ".zip");
|
||||||
|
|
||||||
|
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile.toFile()))) {
|
||||||
|
Files.walk(sourceDir)
|
||||||
|
.filter(path -> !Files.isDirectory(path))
|
||||||
|
.forEach(path -> {
|
||||||
|
String zipEntryName = sourceDir.relativize(path).toString();
|
||||||
|
try {
|
||||||
|
zos.putNextEntry(new ZipEntry(zipEntryName));
|
||||||
|
Files.copy(path, zos);
|
||||||
|
zos.closeEntry();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to add file to zip: " + path, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 移动压缩文件到最终目录
|
||||||
|
Path finalDir = Paths.get(finalDestination);
|
||||||
|
Files.createDirectories(finalDir);
|
||||||
|
Path targetPath = finalDir.resolve(zipFile.getFileName());
|
||||||
|
Files.move(zipFile, targetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
// 4. 删除临时文件夹(可选)
|
||||||
|
deleteDirectory(sourceDir.toFile());
|
||||||
|
|
||||||
|
System.out.println("Task completed: " + targetPath);
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 递归删除目录
|
||||||
|
*/
|
||||||
|
private void deleteDirectory(File directory) {
|
||||||
|
File[] allContents = directory.listFiles();
|
||||||
|
if (allContents != null) {
|
||||||
|
for (File file : allContents) {
|
||||||
|
deleteDirectory(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
directory.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.product.event.transientes.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.PqsEventDetailStatusPO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-20
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
public interface PqsEventDetailStatusMapper extends BaseMapper<PqsEventDetailStatusPO> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-15
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MsgDTO {
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@JsonProperty(value = "customMsgID")
|
||||||
|
private String customMsgID;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-15
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsResponseDTO {
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String message;
|
||||||
|
private String batchId;
|
||||||
|
private List<SmsItem> items;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SmsItem {
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@JsonProperty(value = "customMsgID")
|
||||||
|
private String customMsgID;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-15
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsSendDTO {
|
||||||
|
|
||||||
|
private String serviceCode;
|
||||||
|
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
private String ts;
|
||||||
|
|
||||||
|
private List<ItemInner> items;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class ItemInner{
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@JsonProperty(value = "customMsgID")
|
||||||
|
private String customMsgID;
|
||||||
|
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
private String ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/10/22 上午 10:37【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UpLoadEvent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* eventdetail_index : d4963f8f-201f-443f-b293-dda8ef870ee6
|
||||||
|
* lineid : 1591
|
||||||
|
* timeid : 2025-10-09 13:25:14
|
||||||
|
* ms : 509
|
||||||
|
* describe :
|
||||||
|
* wavetype : 1
|
||||||
|
* persisttime : 23.000
|
||||||
|
* eventvalue : 0.6
|
||||||
|
* eventreason :
|
||||||
|
* eventtype :
|
||||||
|
* gdname :
|
||||||
|
* bdname : 110kV皇后店变
|
||||||
|
* pointname : 232待用
|
||||||
|
* wavePath : 192.168.1.102/3_20240515_163022_349
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String eventdetail_index;
|
||||||
|
private Integer lineid;
|
||||||
|
private String timeid;
|
||||||
|
private BigDecimal ms;
|
||||||
|
private String describe;
|
||||||
|
private Integer wavetype;
|
||||||
|
private Double persisttime;
|
||||||
|
private Double eventvalue;
|
||||||
|
private String eventreason;
|
||||||
|
private String eventtype;
|
||||||
|
private String gdname;
|
||||||
|
private String bdname;
|
||||||
|
private String busname;
|
||||||
|
private String pointname;
|
||||||
|
private String wavePath;
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private int pt;
|
||||||
|
private int ct;
|
||||||
|
private int ptType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.PqUserLedgerPO;
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.PqUserLineAssPO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/10/28 下午 2:32【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UpLoadUserDTO {
|
||||||
|
private List<UserLegerDTO> userList;
|
||||||
|
private List<UserLineAssDTO> assList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/10/28 下午 2:47【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserLegerDTO {
|
||||||
|
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String powerSupplyArea;
|
||||||
|
|
||||||
|
private String customerNo;
|
||||||
|
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
private String electricityAddress;
|
||||||
|
|
||||||
|
private String bigObjType;
|
||||||
|
|
||||||
|
private String smallObjType;
|
||||||
|
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/10/28 下午 2:49【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserLineAssDTO {
|
||||||
|
|
||||||
|
private String userIndex;
|
||||||
|
|
||||||
|
private Integer lineIndex;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.product.event.transientes.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: cdf
|
||||||
|
* @CreateTime: 2025-10-20
|
||||||
|
* @Description: 暂降事件同步记录
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "PQS_EVENTDETAIL_STATUS")
|
||||||
|
public class PqsEventDetailStatusPO {
|
||||||
|
|
||||||
|
@TableId(value = "EVENT_DETAIL_ID")
|
||||||
|
private String eventDetailId;
|
||||||
|
|
||||||
|
@TableField(value = "EVENT_TIME")
|
||||||
|
private LocalDateTime eventTime;
|
||||||
|
|
||||||
|
@TableField(value = "WAVE_FLAG")
|
||||||
|
private int waveFlag;
|
||||||
|
|
||||||
|
@TableField(value = "SYNC_STATUS")
|
||||||
|
private int syncStatus;
|
||||||
|
|
||||||
|
@TableField(value = "SYNC_TIME")
|
||||||
|
private LocalDateTime syncTime;
|
||||||
|
|
||||||
|
@TableField(value = "REMARK")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@TableField(value = "RETRY_COUNT")
|
||||||
|
private int retryCount;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -96,6 +96,10 @@ public class PqsEventdetail {
|
|||||||
@TableField(value = "NOTICE_FLAG")
|
@TableField(value = "NOTICE_FLAG")
|
||||||
private Integer noticeFlag;
|
private Integer noticeFlag;
|
||||||
|
|
||||||
|
@TableField(value = "CREATE_TIME")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private Integer eventSeverity;
|
private Integer eventSeverity;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.njcn.product.event.transientes.security;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.product.event.transientes.utils.JwtUtil;
|
import com.njcn.product.event.transientes.utils.JwtUtil;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -47,6 +47,8 @@ public class AuthController extends BaseController {
|
|||||||
//针对系统推送的认证特殊处理
|
//针对系统推送的认证特殊处理
|
||||||
if ("system_event".equals(authRequest.getUsername())) {
|
if ("system_event".equals(authRequest.getUsername())) {
|
||||||
pass = authRequest.getPassword();
|
pass = authRequest.getPassword();
|
||||||
|
} else if ("cn_test_a".equals(authRequest.getUsername())) {
|
||||||
|
pass = authRequest.getPassword();
|
||||||
} else {
|
} else {
|
||||||
hasFlag = redisUtil.hasKey(eventRedisKey + authRequest.getUsername());
|
hasFlag = redisUtil.hasKey(eventRedisKey + authRequest.getUsername());
|
||||||
if (hasFlag) {
|
if (hasFlag) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.njcn.product.event.transientes.mapper.PqsUserMapper;
|
|||||||
import com.njcn.product.event.transientes.mapper.PqsUserSetMapper;
|
import com.njcn.product.event.transientes.mapper.PqsUserSetMapper;
|
||||||
import com.njcn.product.event.transientes.pojo.po.PqsUser;
|
import com.njcn.product.event.transientes.pojo.po.PqsUser;
|
||||||
import com.njcn.product.event.transientes.pojo.po.PqsUserSet;
|
import com.njcn.product.event.transientes.pojo.po.PqsUserSet;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
@@ -39,6 +39,13 @@ public class MyUserDetailsService implements UserDetailsService {
|
|||||||
new ArrayList<>());
|
new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("cn_test_a".equals(username)){
|
||||||
|
PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||||
|
String encodedPassword = passwordEncoder.encode("@#001njcnpqs");
|
||||||
|
return new MyUserDetails("12345678910","system_event",encodedPassword,"10001",
|
||||||
|
new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(redisUtil.hasKey("event_smart_"+username)){
|
if(redisUtil.hasKey("event_smart_"+username)){
|
||||||
String password = redisUtil.getRawValue("event_smart_"+username);
|
String password = redisUtil.getRawValue("event_smart_"+username);
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.csrf().disable()
|
http.csrf().disable()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg").permitAll() // 允许访问认证接口
|
.antMatchers("/cn_authenticate","/ws/**","/accept/testEvent","/accept/eventMsg","/accept/simpleTest","/accept/phoneSend","/accept/refreshIdCache","/largescreen/sycnUser").permitAll() // 允许访问认证接口
|
||||||
//.antMatchers("/**").permitAll() // 允许访问认证接口
|
// .antMatchers("/**").permitAll() // 允许访问认证接口
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.sessionManagement()
|
.sessionManagement()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
import com.njcn.product.event.devcie.pojo.po.PqsDeptsline;
|
||||||
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
import com.njcn.product.event.transientes.pojo.param.LargeScreenCountParam;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|||||||
@@ -64,4 +64,6 @@ public interface LargeScreenCountService {
|
|||||||
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
|
Page<DeviceDTO> devicePage(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|
||||||
Page<EventDetailVO> userEventList(LargeScreenCountParam largeScreenCountParam);
|
Page<EventDetailVO> userEventList(LargeScreenCountParam largeScreenCountParam);
|
||||||
|
|
||||||
|
void exportLineData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.product.event.transientes.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.PqsEventDetailStatusPO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CN_Product
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2025/10/24
|
||||||
|
*/
|
||||||
|
public interface PqsEventDetailStatusService extends IService<PqsEventDetailStatusPO> {
|
||||||
|
}
|
||||||
@@ -38,8 +38,15 @@ public class EventGateServiceImpl implements EventGateService {
|
|||||||
private final WaveFileComponent waveFileComponent;
|
private final WaveFileComponent waveFileComponent;
|
||||||
private final PqLineService pqLineService;
|
private final PqLineService pqLineService;
|
||||||
private final PqLinedetailMapper pqLinedetailMapper;
|
private final PqLinedetailMapper pqLinedetailMapper;
|
||||||
@Value("${WAVEPATH}")
|
@Value("${business.wavePath}")
|
||||||
private String WAVEPATH;
|
private String WAVEPATH;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 波形分析
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param) {
|
public WaveDataDTO getTransientAnalyseWave(MonitorTerminalParam param) {
|
||||||
WaveDataDTO waveDataDTO;
|
WaveDataDTO waveDataDTO;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.product.event.transientes.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.*;
|
import cn.hutool.core.date.*;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -14,6 +15,7 @@ import com.beust.ah.A;
|
|||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.product.event.config.RedisUtil;
|
||||||
import com.njcn.product.event.devcie.mapper.*;
|
import com.njcn.product.event.devcie.mapper.*;
|
||||||
import com.njcn.product.event.devcie.pojo.dto.*;
|
import com.njcn.product.event.devcie.pojo.dto.*;
|
||||||
import com.njcn.product.event.devcie.pojo.po.*;
|
import com.njcn.product.event.devcie.pojo.po.*;
|
||||||
@@ -31,10 +33,11 @@ import com.njcn.product.event.transientes.pojo.vo.*;
|
|||||||
import com.njcn.product.event.devcie.service.*;
|
import com.njcn.product.event.devcie.service.*;
|
||||||
import com.njcn.product.event.transientes.service.*;
|
import com.njcn.product.event.transientes.service.*;
|
||||||
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
import com.njcn.product.event.devcie.service.PqsDeptslineService;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -502,7 +505,18 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex, ids));
|
List<PqUserLineAssPO> assList = pqUserLineAssMapper.selectList(new LambdaQueryWrapper<PqUserLineAssPO>().in(PqUserLineAssPO::getLineIndex, ids));
|
||||||
if (CollUtil.isNotEmpty(assList)) {
|
if (CollUtil.isNotEmpty(assList)) {
|
||||||
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
List<String> userIds = assList.stream().map(PqUserLineAssPO::getUserIndex).distinct().collect(Collectors.toList());
|
||||||
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(new LambdaQueryWrapper<PqUserLedgerPO>().in(PqUserLedgerPO::getId, userIds));
|
LambdaQueryWrapper<PqUserLedgerPO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if(userIds.size()>1000){
|
||||||
|
List<List<String>> userIdsList = CollUtil.split(userIds, 1000);
|
||||||
|
wrapper.and(w -> {
|
||||||
|
for (List<String> teIds : userIdsList) {
|
||||||
|
w.or(wIn -> wIn.in(PqUserLedgerPO::getId, teIds));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
wrapper.in(PqUserLedgerPO::getId, userIds);
|
||||||
|
}
|
||||||
|
List<PqUserLedgerPO> poList = pqUserLedgerMapper.selectList(wrapper);
|
||||||
userMap = poList.stream().collect(Collectors.toMap(PqUserLedgerPO::getId, Function.identity()));
|
userMap = poList.stream().collect(Collectors.toMap(PqUserLedgerPO::getId, Function.identity()));
|
||||||
assMap = assList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex));
|
assMap = assList.stream().collect(Collectors.groupingBy(PqUserLineAssPO::getLineIndex));
|
||||||
} else {
|
} else {
|
||||||
@@ -686,6 +700,9 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
LambdaQueryWrapper<MsgEventInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MsgEventInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(!StringUtils.isEmpty(largeScreenCountParam.getSendResult()), MsgEventInfo::getSendResult, largeScreenCountParam.getSendResult());
|
lambdaQueryWrapper.eq(!StringUtils.isEmpty(largeScreenCountParam.getSendResult()), MsgEventInfo::getSendResult, largeScreenCountParam.getSendResult());
|
||||||
lambdaQueryWrapper.orderByDesc(MsgEventInfo::getSendTime).between(MsgEventInfo::getSendTime, start, end);
|
lambdaQueryWrapper.orderByDesc(MsgEventInfo::getSendTime).between(MsgEventInfo::getSendTime, start, end);
|
||||||
|
if(StrUtil.isNotBlank(largeScreenCountParam.getSearchValue())){
|
||||||
|
lambdaQueryWrapper.and(w->w.like(MsgEventInfo::getUserName,largeScreenCountParam.getSearchValue()).or().like(MsgEventInfo::getPhone,largeScreenCountParam.getSearchValue()));
|
||||||
|
}
|
||||||
return msgEventInfoService.page(new Page<>(PageFactory.getPageNum(largeScreenCountParam), PageFactory.getPageSize(largeScreenCountParam)), lambdaQueryWrapper);
|
return msgEventInfoService.page(new Page<>(PageFactory.getPageNum(largeScreenCountParam), PageFactory.getPageSize(largeScreenCountParam)), lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1659,5 +1676,22 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportLineData() {
|
||||||
|
List<LedgerExcelDTO> ledgerExcelDTOList;
|
||||||
|
List<LedgerBaseInfoDTO> ledgerBaseInfoDTOS = (List<LedgerBaseInfoDTO>)redisUtil.getObjectByKey(NAME_KEY + StrUtil.DASHED+"LedgerBaseInfoDTO");
|
||||||
|
ledgerExcelDTOList = ledgerBaseInfoDTOS.stream().map(temp->{
|
||||||
|
LedgerExcelDTO ledgerExcelDTO = new LedgerExcelDTO();
|
||||||
|
BeanUtils.copyProperties(temp,ledgerExcelDTO);
|
||||||
|
return ledgerExcelDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtil.isEmpty(ledgerExcelDTOList)) {
|
||||||
|
ExcelUtil.exportExcel("台账数据.xls", "台账数据", LedgerExcelDTO.class, new ArrayList<>());
|
||||||
|
} else {
|
||||||
|
ExcelUtil.exportExcel("台账数据.xls", "台账数据", LedgerExcelDTO.class, ledgerExcelDTOList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.product.event.transientes.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.product.event.transientes.mapper.PqsEventDetailStatusMapper;
|
||||||
|
import com.njcn.product.event.transientes.pojo.po.PqsEventDetailStatusPO;
|
||||||
|
import com.njcn.product.event.transientes.service.PqsEventDetailStatusService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CN_Product
|
||||||
|
*PqsEventDetailStatusPO
|
||||||
|
* @author cdf
|
||||||
|
* @date 2025/10/24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PqsEventDetailStatusServiceImpl extends ServiceImpl<PqsEventDetailStatusMapper, PqsEventDetailStatusPO> implements PqsEventDetailStatusService {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user