修改告警展示页面

This commit is contained in:
hzj
2024-10-10 10:40:59 +08:00
parent 86108004d5
commit 3a60a05ea2
7 changed files with 210 additions and 9 deletions

View File

@@ -287,14 +287,25 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
public DevDetailDTO queryDevDetail(String devId) {
DevDetailDTO device = new DevDetailDTO();
CsLedger dev = this.findDataById(devId);
device.setEquipmentName(dev.getName());
device.setEquipmentId(devId);
CsLedger project = this.findDataById(dev.getPid());
device.setProjectId(project.getId());
device.setProjectName(project.getName());
CsLedger engineer = this.findDataById(project.getPid());
device.setEngineeringid(engineer.getId());
device.setEngineeringName(engineer.getName());
//如果是便携式设备pid为0,项目,工程都设置为/
if(Objects.equals(dev.getPid(),"0")){
device.setEquipmentName(dev.getName());
device.setEquipmentId(devId);
device.setProjectId("/");
device.setProjectName("/");
device.setEngineeringid("/");
device.setEngineeringName("/");
}else {
device.setEquipmentName(dev.getName());
device.setEquipmentId(devId);
CsLedger project = this.findDataById(dev.getPid());
device.setProjectId(project.getId());
device.setProjectName(project.getName());
CsLedger engineer = this.findDataById(project.getPid());
device.setEngineeringid(engineer.getId());
device.setEngineeringName(engineer.getName());
}
return device;
}

View File

@@ -29,6 +29,10 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
private Integer pageSize;
@ApiModelProperty(value = "设备类型名称(便携式,治理)")
private String deviceTypeName;
@ApiModelProperty(value = "工程id")
private String engineeringid;

View File

@@ -59,13 +59,22 @@ public class EventUserController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryEventpage")
@ApiOperation("事件消息")
@ApiOperation("事件消息(app)")
@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("/queryEventpageWeb")
@ApiOperation("事件消息(web)")
@ApiImplicitParam(name = "csEventUserQueryPage", value = "暂降事件查询参数", required = true)
public HttpResult<Page<EventDetailVO>> queryEventpageWeb(@RequestBody CsEventUserQueryPage csEventUserQueryPage) {
String methodDescribe = getMethodDescribe("queryEventpageWeb");
Page<EventDetailVO> list = csEventUserPOService.queryEventPageWeb(csEventUserQueryPage);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/updateStatus")

View File

@@ -24,4 +24,6 @@ public interface CsEventUserPOMapper extends BaseMapper<CsEventUserPO> {
List<EventDetailVO> queryUserEventList(@Param("csEventUserQueryParam") CsEventUserQueryParam csEventUserQueryParam, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag);
Page<EventDetailVO> queryEventpage(Page<EventDetailVO> returnpage, @Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage, @Param("devIds") List<String> devIds, @Param("flag") Boolean flag);
Page<EventDetailVO> queryEventPageWeb(Page<EventDetailVO> returnpage,@Param("csEventUserQueryPage") CsEventUserQueryPage csEventUserQueryPage,@Param("devIds") List<String> collect);
}

View File

@@ -117,4 +117,36 @@
</if>
order by b.start_time desc
</select>
<select id="queryEventPageWeb" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
select DISTINCT b.id id,
b.device_id deviceId,b.line_id lineId,b.code code,
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location
from cs_event b inner join cs_equipment_delivery c on b.device_id=c.id where 1=1
and b.process=c.process
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
AND DATE(b.start_time) &lt;= DATE(#{csEventUserQueryPage.endTime})
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.startTime != null and csEventUserQueryPage.startTime !=''">
AND DATE(b.start_time) &gt;= DATE(#{csEventUserQueryPage.startTime})
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
and b.tag in
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and b.device_id in
<foreach collection="devIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
AND b.type =#{ csEventUserQueryPage.type}
</if>
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
AND b.level =#{ csEventUserQueryPage.level}
</if>
order by b.start_time desc
</select>
</mapper>

View File

@@ -27,4 +27,6 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
void updateStatus(CsEventUserQueryParam csEventUserQueryParam);
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
}

View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.constant.LogInfo;
import com.njcn.csdevice.api.CsLedgerFeignClient;
import com.njcn.csdevice.constant.DataParam;
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
@@ -362,6 +363,146 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
return returnpage;
}
@Override
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
List<String> devIds = new ArrayList<>();
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
Objects.equals(temp.getName(), csEventUserQueryPage.getDeviceTypeName())).collect(Collectors.toList());
//便携式设备和治理设备拆分
List<CsLedgerVO> portableDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.portableDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(portableDevTree)){
portableDevTree = portableDevTree.get(0).getChildren();
}
List<CsLedgerVO> governmentDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.governmentDev)).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(governmentDevTree)){
governmentDevTree = governmentDevTree.get(0).getChildren();
}
//便携式就1层下边就是设备
List<String> portableDevIds = portableDevTree.stream().filter(
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).map(CsLedgerVO::getId).collect(Collectors.toList());
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
).
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
).
map(CsLedgerVO::getId).
collect(Collectors.toList());
devIds.addAll(portableDevIds);
devIds.addAll(governmentDevIds);
if (CollectionUtils.isEmpty(devIds)){
return returnpage;
}
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
returnpage.getRecords().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 ele = epdFeignClient.findByName(temp.getTag()).getData();
temp.setShowName(ele.getShowName());
temp.setCode(ele.getDefaultValue());
if(Objects.equals(csEventUserQueryPage.getType(),"0")){
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
for (EleEvtParm eleEvtParm : data1) {
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
continue;
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
}
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
if (evtData == null) {
eventDataSetDTO.setValue("-");
}else {
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
}
// if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
// }
eventDataSetDTOS.add(eventDataSetDTO);
}
temp.setDataSet(eventDataSetDTOS);
List<EventDataSetDTO> evtParamVVaDepth = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_VVaDepth")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamVVaDepth)){
temp.setEvtParamVVaDepth("-");
}else {
temp.setEvtParamVVaDepth(evtParamVVaDepth.get(0).getValue()+(Objects.isNull(evtParamVVaDepth.get(0).getUnit())?"":evtParamVVaDepth.get(0).getUnit()));
}
List<EventDataSetDTO> evtParamPosition = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Position")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamPosition)){
temp.setEvtParamPosition("-");
}else {
//temp.setEvtParamPosition(evtParamPosition.get(0).getValue()+(Objects.isNull(evtParamPosition.get(0).getUnit())?"":evtParamPosition.get(0).getUnit()));
temp.setEvtParamPosition(evtParamPosition.get(0).getValue());
}
if (Objects.equals(temp.getEvtParamPosition(),"-")) {
if (!Objects.isNull(temp.getLocation())) {
temp.setEvtParamPosition(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
}
}
List<EventDataSetDTO> evtParamTm = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Tm")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamTm)){
temp.setEvtParamTm("-");
}else {
temp.setEvtParamTm(evtParamTm.get(0).getValue()+(Objects.isNull(evtParamTm.get(0).getUnit())?"":evtParamTm.get(0).getUnit()));
}
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Phase")).
collect(Collectors.toList());
if(CollectionUtil.isEmpty(evtParamPhase)){
temp.setEvtParamPhase("-");
}else {
temp.setEvtParamPhase(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
}
}
});
return returnpage;
}