fix(algorithm):优化算法方案逻辑
优化了方案图片前端预览慢和布点图片保存问题
This commit is contained in:
parent
fef76e3618
commit
e0800f781c
@ -158,13 +158,12 @@ public class IEC61850Service {
|
||||
} else {
|
||||
FcModelNode fcModelNode = (FcModelNode) serverModel.findModelNode(address, Fc.SP);
|
||||
if (fcModelNode == null) {
|
||||
throw new IllegalArgumentException("Model node not found for address: " + address);
|
||||
throw new IllegalArgumentException("找不到地址的模型节点: " + address);
|
||||
}
|
||||
// 获取 "SetVal" 子节点
|
||||
ModelNode setValNode = fcModelNode.getChild("SetVal");
|
||||
if (!(setValNode instanceof BdaFloat32)) {
|
||||
throw new IllegalArgumentException("'SetVal' child node not found or not of type " +
|
||||
"BdaFloat32 for model node: " + address);
|
||||
throw new IllegalArgumentException("找不到模型节点的“SetVal”子节点或其类型不是BdaFloat32: " + address);
|
||||
}
|
||||
// 将 "SetVal" 子节点强制转换为 BdaFloat32 并设置值
|
||||
BdaFloat32 setVal = (BdaFloat32) setValNode;
|
||||
|
@ -107,8 +107,8 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
registry.addResourceHandler("/mainDevice/**").addResourceLocations(mainDeviceUrl).setCachePeriod(0);
|
||||
|
||||
// 变电站平面图地址
|
||||
String planUrl = "file:" + planFilePath;
|
||||
registry.addResourceHandler("/plan/**").addResourceLocations(planUrl).setCachePeriod(0);
|
||||
// String planUrl = "file:" + planFilePath;
|
||||
// registry.addResourceHandler("/plan/**").addResourceLocations(planUrl).setCachePeriod(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.yfd.platform.modules.algorithm.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@ -17,6 +16,8 @@ import com.deepoove.poi.util.PoitlIOUtils;
|
||||
import com.yfd.platform.config.HttpServerConfig;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmArrange;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmArrangeDevice;
|
||||
import com.yfd.platform.modules.algorithm.domain.ArrangeDeviceRequest;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeDeviceService;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeService;
|
||||
import com.yfd.platform.modules.basedata.domain.Substation;
|
||||
@ -27,14 +28,15 @@ import com.yfd.platform.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -54,6 +56,7 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("/algorithm/algorithm-arrange")
|
||||
@Api(value = "AlgorithmArrangeController", tags = "算法布点模块")
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class AlgorithmArrangeController {
|
||||
|
||||
@Resource
|
||||
@ -136,7 +139,7 @@ public class AlgorithmArrangeController {
|
||||
// 上传文件
|
||||
String fileUrl = algorithmArrangeService.uploadImage(file);
|
||||
LambdaUpdateWrapper<AlgorithmArrange> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AlgorithmArrange::getId, id).set(AlgorithmArrange::getArrangeImageUrl, fileUrl);
|
||||
updateWrapper.eq(AlgorithmArrange::getId, id).set(AlgorithmArrange::getImageUrl, fileUrl);
|
||||
algorithmArrangeService.update(updateWrapper);
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.error("文件上传失败:" + e.getMessage());
|
||||
@ -145,6 +148,41 @@ public class AlgorithmArrangeController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/saveArrangeDevice")
|
||||
@ApiOperation("保存布点详情")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseResult saveArrangeDevice(@RequestPart("data") @Valid ArrangeDeviceRequest arrangeDeviceRequest,
|
||||
@RequestParam("file") MultipartFile file) {
|
||||
// 文件上传逻辑
|
||||
if (file != null && !file.isEmpty()) {
|
||||
try {
|
||||
AlgorithmArrange arrange = algorithmArrangeService.getById(arrangeDeviceRequest.getArrangeId());
|
||||
if (StrUtil.isNotBlank(arrange.getArrangeImageUrl())) {
|
||||
algorithmArrangeService.removeImage(httpServerConfig.getPlanFilePath() + arrange.getArrangeImageUrl());
|
||||
}
|
||||
// 上传文件
|
||||
String fileUrl = algorithmArrangeService.uploadImage(file);
|
||||
LambdaUpdateWrapper<AlgorithmArrange> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AlgorithmArrange::getId, arrangeDeviceRequest.getArrangeId()).set(AlgorithmArrange::getCustom3, "1").set(AlgorithmArrange::getArrangeImageUrl, fileUrl);
|
||||
algorithmArrangeService.update(updateWrapper);
|
||||
} catch (Exception e) {
|
||||
return ResponseResult.error("文件上传失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
List<AlgorithmArrangeDevice> algorithmArrangeDevice = arrangeDeviceRequest.getAlgorithmArrangeDevice();
|
||||
if (algorithmArrangeDevice != null && !algorithmArrangeDevice.isEmpty()) {
|
||||
algorithmArrangeDevice.forEach(r -> r.setArrangeId(arrangeDeviceRequest.getArrangeId()));
|
||||
// 获取修改的参数id
|
||||
Set<String> idList =
|
||||
algorithmArrangeDevice.stream().map(AlgorithmArrangeDevice::getId).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
if (!idList.isEmpty()) {
|
||||
algorithmArrangeDeviceService.remove(new LambdaQueryWrapper<AlgorithmArrangeDevice>().notIn(AlgorithmArrangeDevice::getId, idList));
|
||||
}
|
||||
algorithmArrangeDeviceService.saveOrUpdateBatch(algorithmArrangeDevice);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updateAlgorithmArrange")
|
||||
@ApiOperation("修改算法布点")
|
||||
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
||||
@ -178,6 +216,7 @@ public class AlgorithmArrangeController {
|
||||
algorithmArrange.setStationName(substation.getStationName());
|
||||
algorithmArrange.setStationCode(substation.getStationCode());
|
||||
}
|
||||
algorithmArrange.setCustom3("1");
|
||||
boolean save = algorithmArrangeService.updateById(algorithmArrange);
|
||||
if (!save) {
|
||||
return ResponseResult.error();
|
||||
@ -197,7 +236,7 @@ public class AlgorithmArrangeController {
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmArrangeByIds")
|
||||
@ApiOperation("删除布点数据")
|
||||
@ApiOperation("批量删除布点数据")
|
||||
public ResponseResult deleteAlgorithmArrangeByIds(@RequestBody List<String> ids) {
|
||||
boolean b = algorithmArrangeService.removeByIds(ids);
|
||||
if (b) {
|
||||
@ -282,6 +321,12 @@ public class AlgorithmArrangeController {
|
||||
public ResponseResult exportArrangeById(String id) throws IOException {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id);
|
||||
if ("0".equals(algorithmArrange.getCustom3())) {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
if (StrUtil.isNotBlank(algorithmArrange.getCustom2())) {
|
||||
algorithmArrangeService.removeImage(httpServerConfig.getPlanFilePath() + algorithmArrange.getCustom2());
|
||||
}
|
||||
map.put("arrangeName", algorithmArrange.getArrangeName());
|
||||
map.put("stationName", algorithmArrange.getStationName());
|
||||
Map<String, Object> businessTypeMap = sysDictionaryItemsService.getDeviceMapByType("businessType");
|
||||
@ -335,7 +380,7 @@ public class AlgorithmArrangeController {
|
||||
Files.createDirectories(reportPath.getParent());
|
||||
template.write(Files.newOutputStream(reportPath));
|
||||
LambdaUpdateWrapper<AlgorithmArrange> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(AlgorithmArrange::getId, id).set(AlgorithmArrange::getCustom2, fileName);
|
||||
updateWrapper.eq(AlgorithmArrange::getId, id).set(AlgorithmArrange::getCustom2, fileName).set(AlgorithmArrange::getCustom3, "0");
|
||||
algorithmArrangeService.update(updateWrapper);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
@ -384,6 +429,21 @@ public class AlgorithmArrangeController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/viewFile")
|
||||
@ApiOperation("预览方案图片")
|
||||
public void serveVideo(String id, String type, HttpServletResponse response) {
|
||||
AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id);
|
||||
if (algorithmArrange == null) {
|
||||
return;
|
||||
}
|
||||
if ("1".equals(type) && StrUtil.isNotBlank(algorithmArrange.getImageUrl())) {
|
||||
FileUtil.serveVideo(httpServerConfig.getPlanFilePath(), algorithmArrange.getImageUrl(), response);
|
||||
}
|
||||
if ("2".equals(type) && StrUtil.isNotBlank(algorithmArrange.getArrangeImageUrl())) {
|
||||
FileUtil.serveVideo(httpServerConfig.getPlanFilePath(), algorithmArrange.getArrangeImageUrl(), response);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getMapData() {
|
||||
List<Map<String, Object>> demo = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -40,6 +41,13 @@ public class AlgorithmClassComponentController {
|
||||
return ResponseResult.successData(algorithmClassComponentPage);
|
||||
}
|
||||
|
||||
@GetMapping("/getMainDeviceInfo")
|
||||
@ApiOperation("获取主设备信息")
|
||||
public ResponseResult getMainDeviceInfo(String componentId) {
|
||||
Map<String, Object> mainDeviceInfo = algorithmClassComponentService.getMainDeviceInfo(componentId);
|
||||
return ResponseResult.successData(mainDeviceInfo);
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmClassComponent")
|
||||
@ApiOperation("删除算法关联主设备部件")
|
||||
public ResponseResult deleteAlgorithmClassComponent(String id) {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.yfd.platform.modules.algorithm.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2025/6/9 10:26
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("算法方案布点数请求对象")
|
||||
public class ArrangeDeviceRequest {
|
||||
|
||||
@ApiModelProperty("算法布点方案ID")
|
||||
private String arrangeId;
|
||||
@ApiModelProperty("算法布点详情对象")
|
||||
private List<AlgorithmArrangeDevice> algorithmArrangeDevice;
|
||||
}
|
@ -17,4 +17,6 @@ import java.util.Map;
|
||||
public interface AlgorithmClassComponentMapper extends BaseMapper<AlgorithmClassComponent> {
|
||||
|
||||
List<Map<String, Object>> getAlgorithmComponentList(String stationCode,String algorithmClassName);
|
||||
|
||||
Map<String, Object> getMainDeviceInfo(String componentId);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -48,4 +49,6 @@ public interface IAlgorithmClassComponentService extends IService<AlgorithmClass
|
||||
boolean setAlgorithmClassComponentStatus(String id, String isenable) throws ParseException;
|
||||
|
||||
boolean createAlgorithmTaskList(AlgorithmClassComponent algorithmClassComponent) throws ParseException;
|
||||
|
||||
Map<String, Object> getMainDeviceInfo(String componentId);
|
||||
}
|
||||
|
@ -125,10 +125,13 @@ public class AlgorithmArrangeServiceImpl extends ServiceImpl<AlgorithmArrangeMap
|
||||
***********************************/
|
||||
@Override
|
||||
public String uploadImage(MultipartFile file) {
|
||||
|
||||
String extensionName = FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
if ("blob".equals(extensionName)) {
|
||||
extensionName = "png";
|
||||
}
|
||||
// 文件存储地址
|
||||
String fileName =
|
||||
IdUtil.fastSimpleUUID() + "." + FileUtil.getExtensionName(file.getOriginalFilename());
|
||||
IdUtil.fastSimpleUUID() + "." + extensionName;
|
||||
// 上传文件
|
||||
String name =
|
||||
Objects.requireNonNull(FileUtil.upload(file, httpServerConfig.getPlanFilePath(), fileName)).getName();
|
||||
|
@ -17,8 +17,10 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -35,6 +37,9 @@ public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmCla
|
||||
@Resource
|
||||
private AlgorithmDeviceMapper algorithmDeviceMapper;
|
||||
|
||||
@Resource
|
||||
private AlgorithmClassComponentMapper algorithmClassComponentMapper;
|
||||
|
||||
@Resource
|
||||
private AlgorithmTaskManager algorithmTaskManager;
|
||||
|
||||
@ -150,6 +155,11 @@ public class AlgorithmClassComponentServiceImpl extends ServiceImpl<AlgorithmCla
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMainDeviceInfo(String componentId) {
|
||||
return algorithmClassComponentMapper.getMainDeviceInfo(componentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置待办任务的时间
|
||||
* 此方法用于根据提供的算法类组件和触发时间来安排待办任务
|
||||
|
@ -101,20 +101,20 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
||||
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
|
||||
// 获取修改的参数id
|
||||
Set<String> paramIdList =
|
||||
algorithmParamsList.stream().filter(a -> StrUtil.isNotBlank(a.getId())).map(AlgorithmParams::getId).collect(Collectors.toSet());
|
||||
algorithmParamsList.stream().map(AlgorithmParams::getId).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
|
||||
// 排除修改的算法参数,删除掉其他算法参数和点位信息
|
||||
|
||||
LambdaQueryWrapper<AlgorithmDevice> deviceQueryWrapper = new LambdaQueryWrapper<>();
|
||||
deviceQueryWrapper.eq(AlgorithmDevice::getAlgorithmId, algorithmClass.getId());
|
||||
if (paramIdList.size() > 0) {
|
||||
if (!paramIdList.isEmpty()) {
|
||||
deviceQueryWrapper.notIn(AlgorithmDevice::getParamId, paramIdList);
|
||||
}
|
||||
algorithmDeviceService.remove(deviceQueryWrapper);
|
||||
|
||||
LambdaQueryWrapper<AlgorithmParams> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmParams::getAlgorithmId, algorithmClass.getId());
|
||||
if (paramIdList.size() > 0) {
|
||||
if (!paramIdList.isEmpty()) {
|
||||
queryWrapper.notIn(AlgorithmParams::getId, paramIdList);
|
||||
}
|
||||
algorithmParamsService.remove(queryWrapper);
|
||||
@ -124,7 +124,7 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
|
||||
r.setLastmodifier(currentUsername);
|
||||
r.setLastmodifydate(LocalDateTime.now());
|
||||
});
|
||||
if (algorithmParamsList.size() > 0) {
|
||||
if (!algorithmParamsList.isEmpty()) {
|
||||
return algorithmParamsService.saveOrUpdateBatch(algorithmParamsList);
|
||||
}
|
||||
return true;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.yfd.platform.modules.auxcontrol.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -34,7 +33,6 @@ import java.util.Map;
|
||||
@Api(value = "DeviceSignalController", tags = "变电站辅控设备信号")
|
||||
public class DeviceSignalController {
|
||||
|
||||
|
||||
@Resource
|
||||
private IDeviceSignalService deviceSignalService;
|
||||
|
||||
@ -49,13 +47,14 @@ public class DeviceSignalController {
|
||||
***********************************/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页查询变电站辅控设备信号")
|
||||
public ResponseResult getDeviceSignalPage(String systemcode,String meterDeviceId,String mainDeviceId, String mainComponentId, String signalName, Page<DeviceSignal> page) {
|
||||
public ResponseResult getDeviceSignalPage(String systemcode, String meterDeviceId, String mainDeviceId,
|
||||
String mainComponentId, String signalName, Page<DeviceSignal> page) {
|
||||
//参数校验 辅控设备ID不能为空
|
||||
Page<DeviceSignal> deviceSignalPage = deviceSignalService.getDeviceSignalPage(systemcode,meterDeviceId,mainDeviceId,mainComponentId, signalName, page);
|
||||
Page<DeviceSignal> deviceSignalPage = deviceSignalService.getDeviceSignalPage(systemcode, meterDeviceId,
|
||||
mainDeviceId, mainComponentId, signalName, page);
|
||||
return ResponseResult.successData(deviceSignalPage);
|
||||
}
|
||||
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询遥信遥测数据
|
||||
* 参数说明
|
||||
@ -71,6 +70,19 @@ public class DeviceSignalController {
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询遥信数据
|
||||
* 参数说明
|
||||
* areaid 区域ID
|
||||
* 返回值说明: 变电站辅控设备信号集合
|
||||
***********************************/
|
||||
@GetMapping("/queryYxData")
|
||||
@ApiOperation("查询遥信数据")
|
||||
public ResponseResult queryYxData(Page<Map<String, Object>> page, String areaId, String type) {
|
||||
Page<Map<String, Object>> mapPage = deviceSignalService.queryYxData(page, areaId, type);
|
||||
return ResponseResult.successData(mapPage);
|
||||
}
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 查询信号信息
|
||||
* 参数说明
|
||||
@ -112,7 +124,7 @@ public class DeviceSignalController {
|
||||
* 参数说明 deviceSignal 变电站辅控设备信号
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回修改成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "变电站辅控设备信号", value = "修改变电站辅控设备信号",type = "1")
|
||||
@Log(module = "变电站辅控设备信号", value = "修改变电站辅控设备信号", type = "1")
|
||||
@PostMapping("/updateDeviceSignal")
|
||||
@ApiOperation("修改变电站辅控设备信号")
|
||||
public ResponseResult updateDeviceSignal(@RequestBody DeviceSignal deviceSignal) {
|
||||
@ -132,7 +144,7 @@ public class DeviceSignalController {
|
||||
* 参数说明 id 变电站辅控设备信号ID
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回删除成功或者失败
|
||||
***********************************/
|
||||
@Log(module = "变电站辅控设备信号", value = "根据ID删除变电站辅控设备信号",type = "1")
|
||||
@Log(module = "变电站辅控设备信号", value = "根据ID删除变电站辅控设备信号", type = "1")
|
||||
@PostMapping("/deleteDeviceSignalById")
|
||||
@ApiOperation("根据ID删除变电站辅控设备信号")
|
||||
public ResponseResult deleteDeviceSignalById(@RequestParam String id) {
|
||||
@ -147,13 +159,12 @@ public class DeviceSignalController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 批量删除变电站辅控设备信号
|
||||
* 参数说明 ids 变电站辅控设备信号id数组
|
||||
* 返回值说明: com.yfd.platform.config.ResponseResult 返回批量删除成功或失败
|
||||
***********************************/
|
||||
@Log(module = "变电站辅控设备信号", value = "批量删除变电站辅控设备信号",type = "1")
|
||||
@Log(module = "变电站辅控设备信号", value = "批量删除变电站辅控设备信号", type = "1")
|
||||
@PostMapping("/deleteDeviceSignalByIds")
|
||||
@ApiOperation("批量删除变电站辅控设备信号")
|
||||
public ResponseResult deleteDeviceByIds(@RequestParam String ids) {
|
||||
@ -169,5 +180,4 @@ public class DeviceSignalController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ public class MeterDeviceController {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
//分页查询
|
||||
Page<MeterDevice> devicePage = meterDeviceService.getDevicePage(stationId,deviceName, deviceModel, deviceType, status,
|
||||
Page<MeterDevice> devicePage = meterDeviceService.getDevicePage(stationId, deviceName, deviceModel,
|
||||
deviceType, status,
|
||||
systemcode, page);
|
||||
return ResponseResult.successData(devicePage);
|
||||
}
|
||||
@ -127,7 +128,8 @@ public class MeterDeviceController {
|
||||
if (StrUtil.isBlank(batchUpdateIpRequest.getIp())) {
|
||||
return ResponseResult.error("参数为空");
|
||||
}
|
||||
boolean isOk = meterDeviceService.batchUpdateDeviceIp(batchUpdateIpRequest.getIds(), batchUpdateIpRequest.getIp());
|
||||
boolean isOk = meterDeviceService.batchUpdateDeviceIp(batchUpdateIpRequest.getIds(),
|
||||
batchUpdateIpRequest.getIp());
|
||||
if (isOk) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.modules.auxcontrol.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
@ -29,4 +30,5 @@ public interface DeviceSignalMapper extends BaseMapper<DeviceSignal> {
|
||||
|
||||
Map<String, Object> querySignalDataById(String signalId);
|
||||
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type);
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package com.yfd.platform.modules.auxcontrol.mapper;
|
||||
import com.yfd.platform.modules.auxcontrol.domain.MeterDevice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 变电站二次设备中的智能仪表监控设备 Mapper 接口
|
||||
|
@ -69,4 +69,5 @@ public interface IDeviceSignalService extends IService<DeviceSignal> {
|
||||
***********************************/
|
||||
Map<String, Object> querySignalDataById(String signalId);
|
||||
|
||||
Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type);
|
||||
}
|
||||
|
@ -58,4 +58,6 @@ public interface IMeterDeviceService extends IService<MeterDevice> {
|
||||
* 返回值说明: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||
***********************************/
|
||||
List<Map<String, Object>> getMeterDeviceByCode(String stationId, String systemCode);
|
||||
|
||||
|
||||
}
|
||||
|
@ -208,4 +208,9 @@ public class DeviceSignalServiceImpl extends ServiceImpl<DeviceSignalMapper, Dev
|
||||
public Map<String, Object> querySignalDataById(String signalId) {
|
||||
return deviceSignalMapper.querySignalDataById(signalId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Map<String, Object>> queryYxData(Page<Map<String, Object>> page, String areaId, String type) {
|
||||
return deviceSignalMapper.queryYxData(page, areaId, type);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -29,6 +31,9 @@ import java.util.Map;
|
||||
@Service
|
||||
public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, MeterDevice> implements IMeterDeviceService {
|
||||
|
||||
@Resource
|
||||
private MeterDeviceMapper meterDeviceMapper;
|
||||
|
||||
/**********************************
|
||||
* 用途说明: 分页查询变电站辅控设备
|
||||
* 参数说明 deviceName 设备名称
|
||||
@ -37,10 +42,12 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
||||
* 参数说明 status 状态
|
||||
* 参数说明 systemcode 系统编码
|
||||
* 参数说明 page
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain.MeterDevice>
|
||||
* 返回值说明: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.yfd.platform.modules.auxcontrol.domain
|
||||
* .MeterDevice>
|
||||
***********************************/
|
||||
@Override
|
||||
public Page<MeterDevice> getDevicePage(String stationId,String deviceName, String deviceModel, String deviceType, String status,
|
||||
public Page<MeterDevice> getDevicePage(String stationId, String deviceName, String deviceModel, String deviceType
|
||||
, String status,
|
||||
String systemcode, Page<MeterDevice> page) {
|
||||
LambdaQueryWrapper<MeterDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(stationId), MeterDevice::getStationId, stationId);
|
||||
@ -128,4 +135,6 @@ public class MeterDeviceServiceImpl extends ServiceImpl<MeterDeviceMapper, Meter
|
||||
queryWrapper.eq(StrUtil.isNotBlank(stationId), MeterDevice::getStationId, stationId).eq(StrUtil.isNotBlank(systemCode), MeterDevice::getSystemcode, systemCode).select(MeterDevice::getDeviceId, MeterDevice::getDeviceName).orderByAsc(MeterDevice::getDeviceCode);
|
||||
return this.listMaps(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -56,6 +57,7 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -175,6 +177,43 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||
}
|
||||
return resultSize;
|
||||
}
|
||||
/**
|
||||
* 服务视频文件
|
||||
* 根据提供的文件路径和文件名,设置HTTP响应的内容类型,并将文件内容写入响应中
|
||||
*
|
||||
* @param snapFilePath 文件所在的目录路径
|
||||
* @param filename 要服务的文件名
|
||||
* @param response HTTP响应对象,用于设置响应头和输出流
|
||||
*/
|
||||
public static void serveVideo(String snapFilePath,String filename, HttpServletResponse response) {
|
||||
File file = new File(snapFilePath, filename);
|
||||
if (file.exists()) {
|
||||
// 根据文件扩展名设置合适的 Content-Type
|
||||
if (filename.endsWith(".mp4")) {
|
||||
response.setContentType("video/mp4");
|
||||
} else if (filename.endsWith(".jpg") || filename.endsWith(".jpeg")) {
|
||||
response.setContentType("image/jpeg");
|
||||
} else if (filename.endsWith(".png")) {
|
||||
response.setContentType("image/png");
|
||||
} else {
|
||||
response.setContentType("application/octet-stream");
|
||||
}
|
||||
|
||||
try (InputStream is = Files.newInputStream(file.toPath())) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = is.read(buffer)) != -1) {
|
||||
response.getOutputStream().write(buffer, 0, bytesRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
log.info(e.getMessage());
|
||||
}
|
||||
} else {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* inputStream 转 File
|
||||
|
@ -20,4 +20,13 @@
|
||||
AND ac.algorithm_class_name LIKE CONCAT('%',#{algorithmClassName},'%')
|
||||
</if>
|
||||
</select>
|
||||
<select id="getMainDeviceInfo" resultType="java.util.Map">
|
||||
SELECT
|
||||
sm.*
|
||||
FROM
|
||||
`iis_substation_component` sc
|
||||
INNER JOIN iis_substation_maindevice sm ON sc.main_device_id = sm.main_device_id
|
||||
WHERE
|
||||
component_id = #{componentId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -128,5 +128,26 @@
|
||||
WHERE signal_id =#{signalId}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="queryYxData" resultType="java.util.Map">
|
||||
SELECT
|
||||
md.device_type,
|
||||
ds.signal_name,
|
||||
ds.signal_code,
|
||||
ds.yx_addr,
|
||||
ds.yx_value
|
||||
FROM
|
||||
fk_device_signal ds
|
||||
INNER JOIN fk_meter_device md ON ds.meter_device_id = md.device_id
|
||||
WHERE
|
||||
ds.yx_addr IS NOT NULL
|
||||
AND ds.yx_addr != ''
|
||||
AND md.region = #{areaId}
|
||||
<if test="type != null and type != ''">
|
||||
AND md.device_type = #{type}
|
||||
</if>
|
||||
ORDER BY
|
||||
md.device_type,
|
||||
ds.signal_code
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user