代码提交

This commit is contained in:
huangzj
2023-09-21 15:58:38 +08:00
parent a53561c07f
commit b86cb8ddd8
24 changed files with 336 additions and 27 deletions

View File

@@ -1,10 +1,12 @@
package com.njcn.csharmonic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.csharmonic.service.CsEventUserPOService;
@@ -47,7 +49,7 @@ public class EventUserController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventList")
@ApiOperation("当天事件未读消息")
@ApiOperation("当天事件消息")
@ApiImplicitParam(name = "csEventUserQueryParam", value = "暂降事件查询参数", required = true)
public HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) {
String methodDescribe = getMethodDescribe("queryEventList");
@@ -55,6 +57,16 @@ public class EventUserController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventpage")
@ApiOperation("当天事件消息")
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
public HttpResult<Page<EventDetailVO>> queryEventpage(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
String methodDescribe = getMethodDescribe("queryEventpage");
Page<EventDetailVO> list = csEventUserPOService.queryEventpage(csEventUserQueryPage);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateStatus")
@ApiOperation("已读事件")

View File

@@ -31,7 +31,14 @@
<select id="queryUserEventList" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
select a.event_id id,a.user_id userId,a.status status,b.device_id deviceId,b.line_id lineId,
b.start_time startTime,b.tag tag ,b.wave_path wavePath, b.type type
from cs_event_user a inner join cs_event b on a.event_id=b.id where 1=1 and DATE(b.start_time) =DATE(NOW())
from cs_event_user a inner join cs_event b on a.event_id=b.id where 1=1
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.endTime != null and csEventUserQueryParam.endTime !=''">
AND DATE(b.start_time) &lt;= DATE(#{csEventUserQueryParam.endTime})
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.startTime != null and csEventUserQueryParam.startTime !=''">
AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryParam.startTime})
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.target != null and csEventUserQueryParam.target.size()>0">
and b.tag in
@@ -49,6 +56,10 @@
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.status != null and csEventUserQueryParam.status !=''">
AND a.status =#{ csEventUserQueryParam.status}
</if>
<if test="csEventUserQueryParam!=null and csEventUserQueryParam.userId != null and csEventUserQueryParam.userId !=''">
and a.user_id=#{ csEventUserQueryParam.userId}
</if>
order by create_time desc
</select>
</mapper>

View File

@@ -1,5 +1,7 @@
package com.njcn.csharmonic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
import com.baomidou.mybatisplus.extension.service.IService;
@@ -23,4 +25,6 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
List<EventDetailVO> queryUserEventList(CsEventUserQueryParam csEventUserQueryParam);
void updateStatus(CsEventUserQueryParam csEventUserQueryParam);
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
}

View File

@@ -2,12 +2,19 @@ package com.njcn.csharmonic.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
import com.njcn.csharmonic.param.CsEventUserQueryPage;
import com.njcn.csharmonic.param.CsEventUserQueryParam;
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
import com.njcn.influx.pojo.dto.EventDataSetDTO;
import com.njcn.influx.service.EvtDataService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.EleEvtFeignClient;
import com.njcn.system.api.EpdFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.system.pojo.po.EleEpdPqd;
@@ -29,6 +36,7 @@ import com.njcn.csharmonic.pojo.po.CsEventUserPO;
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
import com.njcn.csharmonic.service.CsEventUserPOService;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
*
@@ -44,6 +52,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
private final DicDataFeignClient dicDataFeignClient;
private final CsLedgerFeignClient csLedgerFeignClient;
private final EvtDataService evtDataService;
private final EpdFeignClient epdFeignClient;
private final EleEvtFeignClient eleEvtFeignClient;
@Override
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
@@ -64,6 +75,9 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
if( Objects.equals(role, AppRoleEnum.APP_VIP_USER.getCode())){
csEventUserQueryParam.setLevel("3");
}
if( Objects.equals(role, AppRoleEnum.OPERATION_MANAGER.getCode())||Objects.equals(role, AppRoleEnum.ROOT.getCode())){
csEventUserQueryParam.setUserId(null);
}
if(CollectionUtil.isEmpty(csEventUserQueryParam.getTarget())&&Objects.equals(csEventUserQueryParam.getType(),"0")){
/*获取所有暂态事件类型*/
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.APP_EVENT.getCode()).getData();
@@ -79,8 +93,38 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
temp.setProjectName(devDetail.getProjectName());
temp.setEngineeringid(devDetail.getEngineeringid());
temp.setEngineeringName(devDetail.getEngineeringName());
EleEpdPqd data = epdFeignClient.findByName(temp.getTag()).getData();
temp.setShowName(data.getShowName());
});
if(Objects.equals(csEventUserQueryParam.getType(),"0")){
list.forEach(temp->{
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
temp.setEquipmentName(devDetail.getEquipmentName());
temp.setProjectId(devDetail.getProjectId());
temp.setProjectName(devDetail.getProjectName());
temp.setEngineeringid(devDetail.getEngineeringid());
temp.setEngineeringName(devDetail.getEngineeringName());
EleEpdPqd data = epdFeignClient.findByName(temp.getTag()).getData();
temp.setShowName(data.getShowName());
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(data.getId()).getData();
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
for (EleEvtParm eleEvtParm : data1) {
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
if (evtData == null) {
eventDataSetDTO.setValue("3.1415926");
}else {
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("3.1415926"));
}
eventDataSetDTOS.add(eventDataSetDTO);
}
temp.setDataSet(eventDataSetDTOS);
});
}
return list;
}
@@ -95,4 +139,24 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
eq(CsEventUserPO::getUserId,csEventUserQueryParam.getUserId()).
set(CsEventUserPO::getStatus,1).update();
}
@Override
public Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage) {
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
List<EventDetailVO> list = this.queryUserEventList(csEventUserQueryPage);
if(!StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())){
list =list.stream().filter(temp->Objects.equals(temp.getEngineeringid(),csEventUserQueryPage.getEngineeringid())).collect(Collectors.toList());
}
if(!StringUtils.isEmpty(csEventUserQueryPage.getProjectId())){
list =list.stream().filter(temp->Objects.equals(temp.getProjectId(),csEventUserQueryPage.getProjectId())).collect(Collectors.toList());
}
if(!StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())){
list =list.stream().filter(temp->Objects.equals(temp.getDeviceId(),csEventUserQueryPage.getDeviceId())).collect(Collectors.toList());
}
returnpage.setRecords (list);
returnpage.setTotal(list.size());
return returnpage;
}
}

View File

@@ -236,15 +236,19 @@ public class StableDataServiceImpl implements StableDataService {
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
// EleEpdPqd data = epdFeignClient.selectById(commonStatisticalQueryParam.getStatisticalId()).getData();
// Optional.ofNullable(data).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ELEEPDPQD_DATA_ERROR));
if(CollectionUtil.isNotEmpty(data)){
List<String> finalCollect = collect;
data.forEach(epdPqd->{
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(finalCollect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
@@ -281,6 +285,9 @@ public class StableDataServiceImpl implements StableDataService {
throw new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR);
}
List<String> collect = csLinePOList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
Optional.ofNullable(csLinePOList).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
collect = csLinePOList.stream().filter(temp->Objects.equals(areaId,temp.getPosition())).map(CsLinePO::getLineId).collect(Collectors.toList());
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
@@ -289,8 +296,9 @@ public class StableDataServiceImpl implements StableDataService {
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
if(CollectionUtil.isNotEmpty(data)){
List<String> finalCollect = collect;
data.forEach(epdPqd->{
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(collect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(finalCollect, epdPqd.getClassId(), epdPqd.getName()+frequency, epdPqd.getPhase(), commonStatisticalQueryParam.getValueType(),commonStatisticalQueryParam.getStartTime(),commonStatisticalQueryParam.getEndTime());
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {