diff --git a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java index 170cdb7..3df84b8 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java +++ b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java @@ -128,9 +128,9 @@ public class IEC61850Service { if (ObjUtil.isNotEmpty(deviceSignal)) { //查找设备 MeterDevice meterDevice = meterDeviceService.getById(deviceSignal.getMeterDeviceId()); - QueryWrapper queryWrapper = new QueryWrapper<>(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); //通讯网关机的IP地址 - queryWrapper.eq("ip_addr", meterDevice.getNetdeviceIp()); + queryWrapper.eq(GatewayDevice::getIpAddr, meterDevice.getNetdeviceIp()); //查找网关机 GatewayDevice gatewayDevice = gatewayDeviceService.getOne(queryWrapper); String convalue = value; diff --git a/riis-system/src/main/java/com/yfd/platform/config/HttpServerConfig.java b/riis-system/src/main/java/com/yfd/platform/config/HttpServerConfig.java index 0d904ab..558cb31 100644 --- a/riis-system/src/main/java/com/yfd/platform/config/HttpServerConfig.java +++ b/riis-system/src/main/java/com/yfd/platform/config/HttpServerConfig.java @@ -111,6 +111,10 @@ public class HttpServerConfig { @Value("${httpserver.patrolserver.documentpath}") private String documentPath; + @Value("${httpserver.patrolserver.maindevicefilepath}") + private String mainDeviceFilepath; + + @Value("${httpserver.patrolserver.tempfilepath}") private String tempFilePath; @@ -255,6 +259,10 @@ public class HttpServerConfig { return documentPath; } + public String getMainDeviceFilepath() { + return mainDeviceFilepath; + } + public String getTempFilePath() { return tempFilePath; } diff --git a/riis-system/src/main/java/com/yfd/platform/config/WebConfig.java b/riis-system/src/main/java/com/yfd/platform/config/WebConfig.java index 225e7bc..cc8d3a2 100644 --- a/riis-system/src/main/java/com/yfd/platform/config/WebConfig.java +++ b/riis-system/src/main/java/com/yfd/platform/config/WebConfig.java @@ -34,6 +34,10 @@ public class WebConfig implements WebMvcConfigurer { @Value("${httpserver.patrolserver.alarmfilepath}") private String alarmFilePath; + @Value("${httpserver.patrolserver.maindevicefilepath}") + private String mainDeviceFilepath; + + @Resource private ISubstationDeviceService substationDeviceService; @@ -94,6 +98,10 @@ public class WebConfig implements WebMvcConfigurer { // 告警图片 String alarmUrl = "file:" + alarmFilePath; registry.addResourceHandler("/alarm/**").addResourceLocations(alarmUrl).setCachePeriod(0); + + // 告警图片 + String mainDeviceUrl = "file:" + mainDeviceFilepath; + registry.addResourceHandler("/mainDevice/**").addResourceLocations(mainDeviceUrl).setCachePeriod(0); } } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmLogsController.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmLogsController.java index 8fbb4c0..149bc09 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmLogsController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmLogsController.java @@ -36,10 +36,11 @@ public class AlgorithmLogsController { @GetMapping("/getAlgorithmLogsPage") @ApiOperation("分页查询算法分析日志") public ResponseResult getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, - String mainDeviceId, String componentId, String componentName, + String mainDeviceId, String componentId, String componentName,String startDate, + String endDate, Page page) { Page> pageMaps = algorithmLogsService.getAlgorithmLogsPage(stationCode, algorithmId, areaId, - bayId, mainDeviceId, componentId, componentName, page); + bayId, mainDeviceId, componentId, componentName,startDate,endDate, page); return ResponseResult.successData(pageMaps); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/mapper/AlgorithmLogsMapper.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/mapper/AlgorithmLogsMapper.java index 03c27b0..1c39789 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/mapper/AlgorithmLogsMapper.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/mapper/AlgorithmLogsMapper.java @@ -27,5 +27,6 @@ public interface AlgorithmLogsMapper extends BaseMapper { * 参数说明 page 分页参数 * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page ***********************************/ - Page> getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, String mainDeviceId, String componentId, String componentName, Page page); + Page> getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, String mainDeviceId, String componentId, String componentName,String startDate, + String endDate, Page page); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmLogsService.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmLogsService.java index d58a19b..2a0c777 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmLogsService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/IAlgorithmLogsService.java @@ -27,6 +27,7 @@ public interface IAlgorithmLogsService extends IService { * 参数说明 page 分页参数 * 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page ***********************************/ - Page> getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, String mainDeviceId, String componentId, String componentName, Page page); + Page> getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, String mainDeviceId, String componentId, String componentName,String startDate, + String endDate, Page page); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmLogsServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmLogsServiceImpl.java index 3228050..bd77576 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmLogsServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/service/impl/AlgorithmLogsServiceImpl.java @@ -37,8 +37,9 @@ public class AlgorithmLogsServiceImpl extends ServiceImpl> getAlgorithmLogsPage(String stationCode, String algorithmId, String areaId, String bayId, - String mainDeviceId, String componentId, String componentName, Page page) { + String mainDeviceId, String componentId, String componentName,String startDate, + String endDate, Page page) { return algorithmLogsMapper.getAlgorithmLogsPage(stationCode,algorithmId, areaId, bayId, - mainDeviceId, componentId,componentName, page); + mainDeviceId, componentId,componentName,startDate,endDate, page); } } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java index 625d14f..f645891 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/controller/SubstationMaindeviceController.java @@ -68,7 +68,8 @@ public class SubstationMaindeviceController { @PostMapping("/addMainDevice") @ApiOperation("新增主设备") @PreAuthorize("@el.check('add:maindevice')") - public ResponseResult addMainDevice(SubstationMaindevice substationMaindevice) { + public ResponseResult addMainDevice(SubstationMaindevice substationMaindevice, + MultipartFile file) { String mainDeviceName = substationMaindevice.getMainDeviceName(); String bayId = substationMaindevice.getBayId(); int count = @@ -82,6 +83,16 @@ public class SubstationMaindeviceController { substationMaindevice.setDatastatus("1"); substationMaindevice.setLastmodifier(SecurityUtils.getCurrentUsername()); substationMaindevice.setLastmodifydate(LocalDateTime.now()); + // 文件上传逻辑 + if (file != null && !file.isEmpty()) { + try { + // 调用服务层方法 + String fileUrl = substationMaindeviceService.uploadImage(file); + substationMaindevice.setFileUrl(fileUrl); + } catch (Exception e) { + return ResponseResult.error("文件上传失败:" + e.getMessage()); + } + } boolean ok = substationMaindeviceService.save(substationMaindevice); if (ok) { return ResponseResult.success(); @@ -282,7 +293,8 @@ public class SubstationMaindeviceController { @PostMapping("/updateMainDevice") @ApiOperation("修改主设备") @PreAuthorize("@el.check('update:maindevice')") - public ResponseResult updateMainDevice(SubstationMaindevice substationMaindevice) { + public ResponseResult updateMainDevice(SubstationMaindevice substationMaindevice, + MultipartFile file) { if (substationMaindevice == null) { return ResponseResult.error("参数为空"); } @@ -303,6 +315,16 @@ public class SubstationMaindeviceController { } substationMaindevice.setLastmodifier(SecurityUtils.getCurrentUsername()); substationMaindevice.setLastmodifydate(LocalDateTime.now()); + // 文件上传逻辑 + if (file != null && !file.isEmpty()) { + try { + String fileUrl = substationMaindeviceService.uploadImage(file); // 调用服务层方法 + substationMaindevice.setFileUrl(fileUrl); + } catch (Exception e) { + return ResponseResult.error("文件上传失败:" + e.getMessage()); + } + } + boolean ok = substationMaindeviceService.updateById(substationMaindevice); if (ok) { return ResponseResult.success(); diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/domain/SubstationMaindevice.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/domain/SubstationMaindevice.java index 55871e7..aba1a80 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/domain/SubstationMaindevice.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/domain/SubstationMaindevice.java @@ -72,6 +72,21 @@ public class SubstationMaindevice implements Serializable { */ private String areaName; + /** + * 出厂寿命 + */ + private String factoryLifespan; + + /** + * 初始运行时间,设备第一次运行的时间 + */ + private LocalDateTime runTime; + + /** + * 主设备效果图地址 + */ + private String fileUrl; + /** * 数据状态 */ @@ -108,4 +123,5 @@ public class SubstationMaindevice implements Serializable { */ @TableField("material_id") private String materialId; + } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java index 8670d29..4362b6e 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/ISubstationMaindeviceService.java @@ -146,4 +146,5 @@ public interface ISubstationMaindeviceService extends IService getComponentTree(String stationCode, String componentName); + String uploadImage(MultipartFile file); } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java index 7758060..00bf7b9 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/basedata/service/impl/SubstationMaindeviceServiceImpl.java @@ -1,9 +1,11 @@ package com.yfd.platform.modules.basedata.service.impl; +import cn.hutool.core.util.IdUtil; 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.extension.service.impl.ServiceImpl; +import com.yfd.platform.config.HttpServerConfig; import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.service.IDeviceSignalService; import com.yfd.platform.modules.basedata.domain.*; @@ -13,6 +15,7 @@ import com.yfd.platform.system.domain.SysDictionary; import com.yfd.platform.system.domain.SysDictionaryItems; import com.yfd.platform.system.service.ISysDictionaryItemsService; import com.yfd.platform.system.service.ISysDictionaryService; +import com.yfd.platform.utils.FileUtil; import com.yfd.platform.utils.SecurityUtils; import freemarker.template.utility.NullArgumentException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -26,13 +29,11 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -40,7 +41,6 @@ import java.util.stream.Collectors; * 变电站_主设备 服务实现类 *

* - * * @since 2023-03-28 */ @Transactional @@ -68,6 +68,9 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); -// queryWrapper.eq(SubstationComponent::getMainDeviceId, id); -// substationComponentMapper.delete(queryWrapper); + // LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + // queryWrapper.eq(SubstationComponent::getMainDeviceId, id); + // substationComponentMapper.delete(queryWrapper); boolean ok = this.removeById(id); String bayId = substationMaindevice.getBayId(); List list = @@ -737,6 +740,18 @@ public class SubstationMaindeviceServiceImpl extends ServiceImpl