diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/PqDeviceMapper.java b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/PqDeviceMapper.java index 7c3cde01..2531fc98 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/PqDeviceMapper.java +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/PqDeviceMapper.java @@ -3,6 +3,7 @@ package com.njcn.gather.event.devcie.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; +import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO; import com.njcn.gather.event.devcie.pojo.po.PqDevice; import org.apache.ibatis.annotations.Param; @@ -24,4 +25,5 @@ public interface PqDeviceMapper extends BaseMapper { Page queryListByLineIds(Page pqsEventdetailPage, @Param("searchValue") String searchValue,@Param("lineIds") List lineIds); + List selectDeviceDept(); } \ No newline at end of file diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml index 0a4bb88d..83ceb7be 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/mapper/mapping/PqDeviceMapper.xml @@ -53,18 +53,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDeptDTO.java b/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDeptDTO.java new file mode 100644 index 00000000..6ff622c9 --- /dev/null +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/pojo/dto/DeviceDeptDTO.java @@ -0,0 +1,21 @@ +package com.njcn.gather.event.devcie.pojo.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * Description: + * Date: 2025/06/27 下午 3:25【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +public class DeviceDeptDTO { + private Integer devId; + private String deptId; + private String deptName; + +} diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/service/PqDeviceService.java b/event_smart/src/main/java/com/njcn/gather/event/devcie/service/PqDeviceService.java index 6dc40065..537a59ca 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/service/PqDeviceService.java +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/service/PqDeviceService.java @@ -2,6 +2,7 @@ package com.njcn.gather.event.devcie.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; +import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO; import com.njcn.gather.event.devcie.pojo.po.PqDevice; import com.baomidou.mybatisplus.extension.service.IService; @@ -20,4 +21,6 @@ public interface PqDeviceService extends IService{ List queryListByIds(List lineIds); Page selectDeviceDTOPage(Page pqsEventdetailPage, String searchValue, List devIndexs, String state); + + List selectDeviceDept(); } diff --git a/event_smart/src/main/java/com/njcn/gather/event/devcie/service/impl/PqDeviceServiceImpl.java b/event_smart/src/main/java/com/njcn/gather/event/devcie/service/impl/PqDeviceServiceImpl.java index a3607369..8f44a38c 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/devcie/service/impl/PqDeviceServiceImpl.java +++ b/event_smart/src/main/java/com/njcn/gather/event/devcie/service/impl/PqDeviceServiceImpl.java @@ -2,6 +2,7 @@ package com.njcn.gather.event.devcie.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; +import com.njcn.gather.event.devcie.pojo.dto.DeviceDeptDTO; import org.springframework.stereotype.Service; import java.util.List; @@ -29,4 +30,9 @@ public class PqDeviceServiceImpl extends ServiceImpl i public Page selectDeviceDTOPage(Page pqsEventdetailPage, String searchValue, List devIndexs, String state) { return this.baseMapper.selectDeviceDTOPage(pqsEventdetailPage,searchValue,devIndexs,state); } + + @Override + public List selectDeviceDept() { + return this.baseMapper.selectDeviceDept(); + } } diff --git a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java index 8a85735b..8df1ee1a 100644 --- a/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java +++ b/event_smart/src/main/java/com/njcn/gather/event/transientes/service/impl/LargeScreenCountServiceImpl.java @@ -18,10 +18,7 @@ import com.njcn.gather.event.devcie.config.PqlineCache; import com.njcn.gather.event.devcie.mapper.PqLineMapper; import com.njcn.gather.event.devcie.mapper.PqLinedetailMapper; import com.njcn.gather.event.devcie.mapper.PqsStationMapMapper; -import com.njcn.gather.event.devcie.pojo.dto.DeviceDTO; -import com.njcn.gather.event.devcie.pojo.dto.LedgerBaseInfoDTO; -import com.njcn.gather.event.devcie.pojo.dto.PqsDeptDTO; -import com.njcn.gather.event.devcie.pojo.dto.SubstationDTO; +import com.njcn.gather.event.devcie.pojo.dto.*; import com.njcn.gather.event.devcie.pojo.po.*; import com.njcn.gather.event.transientes.mapper.PqUserLedgerMapper; import com.njcn.gather.event.transientes.mapper.PqUserLineAssMapper; @@ -1190,6 +1187,16 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { log.info("完成设备查询sql:"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s"); List runDevList = pqDeviceList.stream().map(PqDevice::getDevIndex).collect(Collectors.toList()); + List deviceDeptDTOS= pqDeviceService.selectDeviceDept(); + Map deviceDeptMap = deviceDeptDTOS.stream() + .collect(Collectors.toMap( + DeviceDeptDTO::getDevId, // key mapper + DeviceDeptDTO::getDeptName, // value mapper + (value1, value2 )->{ + return value2; + } + )); + log.info("完成设备部门查询:"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s"); pqsEventdetailPage = pqDeviceService.selectDeviceDTOPage(pqsEventdetailPage,largeScreenCountParam.getSearchValue(),runDevList,largeScreenCountParam.getState()); log.info("完成设备分页查询sql:"+timeInterval.intervalMs()+"ms; "+timeInterval.intervalSecond()+"s"); @@ -1216,6 +1223,7 @@ public class LargeScreenCountServiceImpl implements LargeScreenCountService { for (DeviceDTO record : pqsEventdetailPage.getRecords()) { + record.setDeptName(deviceDeptMap.get(record.getDevId())); List tempList = list.stream().filter(temp -> Objects.equals(temp.getDevIndex(), record.getDevId())).collect(Collectors.toList()); if(!CollectionUtils.isEmpty(tempList)){ double asDouble = tempList.stream().mapToDouble(temp -> {