新增算法分类配置逻辑

This commit is contained in:
weitang 2025-05-14 10:55:03 +08:00
parent 172404f84d
commit 1cae0f1e4c
14 changed files with 215 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent; import com.yfd.platform.modules.algorithm.domain.AlgorithmClassComponent;
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService; import com.yfd.platform.modules.algorithm.service.IAlgorithmClassComponentService;
import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -24,6 +25,7 @@ import javax.annotation.Resource;
*/ */
@RestController @RestController
@RequestMapping("/algorithm/algorithm-class-component") @RequestMapping("/algorithm/algorithm-class-component")
@Api(value = "AlgorithmClassComponentController", tags = "算法分类和部件关联")
public class AlgorithmClassComponentController { public class AlgorithmClassComponentController {
@Resource @Resource

View File

@ -4,7 +4,9 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yfd.platform.config.ResponseResult; import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
import com.yfd.platform.modules.algorithm.domain.AlgorithmParamsRequest;
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService; import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -22,6 +24,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/algorithm/algorithm-class") @RequestMapping("/algorithm/algorithm-class")
@Api(value = "AlgorithmClassController", tags = "算法分类")
public class AlgorithmClassController { public class AlgorithmClassController {
@Resource @Resource
@ -48,6 +51,17 @@ public class AlgorithmClassController {
} }
} }
@PostMapping("/addAlgorithmClassAndParams")
@ApiOperation("保存算法分类和算法参数")
public ResponseResult addAlgorithmClassAndParams(@RequestBody AlgorithmParamsRequest algorithmParamsRequest) {
boolean isOK = algorithmClassService.addAlgorithmClassAndParams(algorithmParamsRequest);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/updateAlgorithmClass") @PostMapping("/updateAlgorithmClass")
@ApiOperation("修改算法分类") @ApiOperation("修改算法分类")
public ResponseResult updateAlgorithmClass(@RequestBody AlgorithmClass algorithmClass) { public ResponseResult updateAlgorithmClass(@RequestBody AlgorithmClass algorithmClass) {

View File

@ -4,6 +4,7 @@ import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice; import com.yfd.platform.modules.algorithm.domain.AlgorithmDevice;
import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService; import com.yfd.platform.modules.algorithm.service.IAlgorithmDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -24,6 +25,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/algorithm/algorithm-device") @RequestMapping("/algorithm/algorithm-device")
@Api(value = "AlgorithmDeviceController", tags = "算法分类部件点位关联")
public class AlgorithmDeviceController { public class AlgorithmDeviceController {
@Resource @Resource

View File

@ -2,12 +2,12 @@ package com.yfd.platform.modules.algorithm.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yfd.platform.config.ResponseResult; import com.yfd.platform.config.ResponseResult;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams; import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService; import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@ -24,16 +24,60 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/algorithm/algorithm-params") @RequestMapping("/algorithm/algorithm-params")
@Api(value = "AlgorithmParamsController", tags = "算法分类参数")
public class AlgorithmParamsController { public class AlgorithmParamsController {
@Resource @Resource
private IAlgorithmParamsService algorithmParamsService; private IAlgorithmParamsService algorithmParamsService;
@GetMapping("/getAlgorithmParamsList") @GetMapping("/getAlgorithmParamsList")
@ApiOperation("查询算法分类") @ApiOperation("查询算法参数")
public ResponseResult getAlgorithmParamsList(String algorithmId) { public ResponseResult getAlgorithmParamsList(String algorithmId) {
List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsList(algorithmId); List<Map<String, Object>> algorithmClassList = algorithmParamsService.getAlgorithmParamsList(algorithmId);
return ResponseResult.successData(algorithmClassList); return ResponseResult.successData(algorithmClassList);
} }
@PostMapping("/addAlgorithmParams")
@ApiOperation("新增算法参数")
public ResponseResult addAlgorithmParams(@RequestBody AlgorithmParams algorithmParams) {
boolean isOK = algorithmParamsService.addAlgorithmParams(algorithmParams);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/batchAddAlgorithmParams")
@ApiOperation("批量新增算法参数")
public ResponseResult batchAddAlgorithmParams(@RequestBody List<AlgorithmParams> algorithmParamsList) {
boolean isOK = algorithmParamsService.batchAddAlgorithmParams(algorithmParamsList);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/batchUpdateAlgorithmParams")
@ApiOperation("批量修改算法参数")
public ResponseResult batchUpdateAlgorithmParams(@RequestBody List<AlgorithmParams> algorithmParamsList) {
boolean isOK = algorithmParamsService.batchUpdateAlgorithmParams(algorithmParamsList);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
@PostMapping("/deleteAlgorithmParams")
@ApiOperation("删除算法参数")
public ResponseResult deleteAlgorithmParams(String id) {
boolean isOK = algorithmParamsService.deleteAlgorithmParams(id);
if (isOK) {
return ResponseResult.success();
} else {
return ResponseResult.error();
}
}
} }

View File

@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
/** /**
* <p> * <p>
* * 算法分类
* </p> * </p>
* *
* @author zhengsl * @author zhengsl
@ -18,6 +21,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("iis_algorithm_class") @TableName("iis_algorithm_class")
@ApiModel("算法分类")
public class AlgorithmClass implements Serializable { public class AlgorithmClass implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -26,26 +30,31 @@ public class AlgorithmClass implements Serializable {
* 算法分类id * 算法分类id
*/ */
@TableId(type = IdType.ASSIGN_UUID) @TableId(type = IdType.ASSIGN_UUID)
@ApiModelProperty("算法分类id")
private String id; private String id;
/** /**
* 算法分类编号 * 算法分类编号
*/ */
@ApiModelProperty("算法分类编号")
private String algorithmClassCode; private String algorithmClassCode;
/** /**
* 算法分类名称 * 算法分类名称
*/ */
@ApiModelProperty("算法分类名称")
private String algorithmClassName; private String algorithmClassName;
/** /**
* 描述 * 描述
*/ */
@ApiModelProperty("描述")
private String description; private String description;
/** /**
* 服务地址 * 服务地址
*/ */
@ApiModelProperty("服务地址")
private String serviceAddress; private String serviceAddress;

View File

@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -18,6 +21,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("iis_algorithm_class_component") @TableName("iis_algorithm_class_component")
@ApiModel("算法分类部件")
public class AlgorithmClassComponent implements Serializable { public class AlgorithmClassComponent implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -26,66 +30,79 @@ public class AlgorithmClassComponent implements Serializable {
* id * id
*/ */
@TableId(type = IdType.ASSIGN_UUID) @TableId(type = IdType.ASSIGN_UUID)
@ApiModelProperty("算法分类部件id")
private String id; private String id;
/** /**
* 算法分类id * 算法分类id
*/ */
@ApiModelProperty("算法分类id")
private String algorithmId; private String algorithmId;
/** /**
* 变电站编号 * 变电站编号
*/ */
@ApiModelProperty("变电站编号")
private String stationCode; private String stationCode;
/** /**
* 变电站名称 * 变电站名称
*/ */
@ApiModelProperty("变电站名称")
private String stationName; private String stationName;
/** /**
* 区域id * 区域id
*/ */
@ApiModelProperty("区域id")
private String areaId; private String areaId;
/** /**
* 区域名称 * 区域名称
*/ */
@ApiModelProperty("区域名称")
private String areaName; private String areaName;
/** /**
* 间隔id * 间隔id
*/ */
@ApiModelProperty("间隔id")
private String bayId; private String bayId;
/** /**
* 间隔名称 * 间隔名称
*/ */
@ApiModelProperty("间隔名称")
private String bayName; private String bayName;
/** /**
* 主设备id * 主设备id
*/ */
@ApiModelProperty("主设备id")
private String mainDeviceId; private String mainDeviceId;
/** /**
* 主设备类型 * 主设备类型
*/ */
@ApiModelProperty("主设备类型")
private String deviceType; private String deviceType;
/** /**
* 主设备名称 * 主设备名称
*/ */
@ApiModelProperty("主设备名称")
private String mainDeviceName; private String mainDeviceName;
/** /**
* 部件id * 部件id
*/ */
@ApiModelProperty("部件id")
private String componentId; private String componentId;
/** /**
* 部件名称 * 部件名称
*/ */
@ApiModelProperty("部件名称")
private String componentName; private String componentName;

View File

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -19,6 +22,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("iis_algorithm_device") @TableName("iis_algorithm_device")
@ApiModel("算法分类绑定点位")
public class AlgorithmDevice implements Serializable { public class AlgorithmDevice implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -26,77 +30,92 @@ public class AlgorithmDevice implements Serializable {
/** /**
* ID * ID
*/ */
@ApiModelProperty("ID")
@TableId(type = IdType.ASSIGN_UUID) @TableId(type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
* 算法分类id * 算法分类id
*/ */
@ApiModelProperty("算法分类id")
private String algorithm_id; private String algorithm_id;
/** /**
* 参数id * 参数id
*/ */
@ApiModelProperty("参数id")
private String paramId; private String paramId;
/** /**
* 参数名称 * 参数名称
*/ */
@ApiModelProperty("参数名称")
private String paramName; private String paramName;
/** /**
* 参数值 * 参数值
*/ */
@ApiModelProperty("参数值")
private String paramValue; private String paramValue;
/** /**
* 部件id * 部件id
*/ */
@ApiModelProperty("部件id")
private String componentId; private String componentId;
/** /**
* 巡视点位名称(信号名称) * 巡视点位名称(信号名称)
*/ */
@ApiModelProperty("巡视点位名称(信号名称)")
private String deviceName; private String deviceName;
/** /**
* 巡视点位id信号id * 巡视点位id信号id
*/ */
@ApiModelProperty("巡视点位id信号id")
private String deviceId; private String deviceId;
/** /**
* 来源类型1:巡视点位2辅控信号 * 来源类型1:巡视点位2辅控信号
*/ */
@ApiModelProperty("来源类型1:巡视点位2辅控信号")
private String sourceType; private String sourceType;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态")
private String datastatus; private String datastatus;
/** /**
* 修改人 * 修改人
*/ */
@ApiModelProperty("修改人")
private String lastmodifier; private String lastmodifier;
/** /**
* 最近修改时间 * 最近修改时间
*/ */
@ApiModelProperty("最近修改时间")
private LocalDateTime lastmodifydate; private LocalDateTime lastmodifydate;
/** /**
* 备用1 * 备用1
*/ */
@ApiModelProperty("备用1")
private String custom1; private String custom1;
/** /**
* 备用2 * 备用2
*/ */
@ApiModelProperty("备用2")
private String custom2; private String custom2;
/** /**
* 备用3 * 备用3
*/ */
@ApiModelProperty("备用3")
private String custom3; private String custom3;

View File

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -19,6 +22,7 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("iis_algorithm_params") @TableName("iis_algorithm_params")
@ApiModel("算法分类参数")
public class AlgorithmParams implements Serializable { public class AlgorithmParams implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -27,86 +31,103 @@ public class AlgorithmParams implements Serializable {
* id * id
*/ */
@TableId(type = IdType.ASSIGN_UUID) @TableId(type = IdType.ASSIGN_UUID)
@ApiModelProperty("算法分类参数id")
private String id; private String id;
/** /**
* 算法分类id * 算法分类id
*/ */
@ApiModelProperty("算法分类id")
private String algorithmId; private String algorithmId;
/** /**
* 参数序号 * 参数序号
*/ */
@ApiModelProperty("参数序号")
private String paramOrder; private String paramOrder;
/** /**
* 参数名称 * 参数名称
*/ */
@ApiModelProperty("参数名称")
private String paramName; private String paramName;
/** /**
* 参数中文描述 * 参数中文描述
*/ */
@ApiModelProperty("参数中文描述")
private String paramDesc; private String paramDesc;
/** /**
* 参数类型[('01', '单个文本'), ('02', '文本数组'), ('03', '单个数值'), ('04', '数值数组'), ('05', 'Json对象'),('06', 'Json数组'), ('07', 'csv数据文件'), ('08', '单张图片'),('09', '图片文件包'),('10', 'Json文件')] * 参数类型[('01', '单个文本'), ('02', '文本数组'), ('03', '单个数值'), ('04', '数值数组'), ('05', 'Json对象'),('06', 'Json数组'), ('07', 'csv数据文件'), ('08', '单张图片'),('09', '图片文件包'),('10', 'Json文件')]
*/ */
@ApiModelProperty("参数类型")
private String paramType; private String paramType;
/** /**
* 自定义描述参数单位 * 自定义描述参数单位
*/ */
@ApiModelProperty("自定义描述参数单位")
private String paramUnit; private String paramUnit;
/** /**
* 参数范围 * 参数范围
*/ */
@ApiModelProperty("参数范围")
private String paramRange; private String paramRange;
/** /**
* 默认值 * 默认值
*/ */
@ApiModelProperty("默认值")
private String defaultValues; private String defaultValues;
/** /**
* 参数描述 * 参数描述
*/ */
@ApiModelProperty("参数描述")
private String description; private String description;
/** /**
* 是否固定参数01当为否时需要关联巡视点位或者信号 * 是否固定参数01当为否时需要关联巡视点位或者信号
*/ */
@ApiModelProperty("是否固定参数,01")
private String paramFixed; private String paramFixed;
/** /**
* 数据状态 * 数据状态
*/ */
@ApiModelProperty("数据状态")
private String datastatus; private String datastatus;
/** /**
* 修改人 * 修改人
*/ */
@ApiModelProperty("修改人")
private String lastmodifier; private String lastmodifier;
/** /**
* 最近修改时间 * 最近修改时间
*/ */
@ApiModelProperty("最近修改时间")
private LocalDateTime lastmodifydate; private LocalDateTime lastmodifydate;
/** /**
* 备用1 * 备用1
*/ */
@ApiModelProperty("custom1")
private String custom1; private String custom1;
/** /**
* 备用2 * 备用2
*/ */
@ApiModelProperty("备用2")
private String custom2; private String custom2;
/** /**
* 备用3 * 备用3
*/ */
@ApiModelProperty("备用3")
private String custom3; private String custom3;

View File

@ -2,6 +2,7 @@ package com.yfd.platform.modules.algorithm.service;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yfd.platform.modules.algorithm.domain.AlgorithmParamsRequest;
/** /**
* <p> * <p>
@ -35,4 +36,6 @@ public interface IAlgorithmClassService extends IService<AlgorithmClass> {
***********************************/ ***********************************/
boolean deleteAlgorithmClass(String id); boolean deleteAlgorithmClass(String id);
boolean addAlgorithmClassAndParams(AlgorithmParamsRequest algorithmParamsRequest);
} }

View File

@ -18,4 +18,12 @@ import java.util.Map;
public interface IAlgorithmParamsService extends IService<AlgorithmParams> { public interface IAlgorithmParamsService extends IService<AlgorithmParams> {
List<Map<String, Object>> getAlgorithmParamsList(String algorithmId); List<Map<String, Object>> getAlgorithmParamsList(String algorithmId);
boolean addAlgorithmParams(AlgorithmParams algorithmParams);
boolean batchAddAlgorithmParams(List<AlgorithmParams> algorithmParamsList);
boolean batchUpdateAlgorithmParams(List<AlgorithmParams> algorithmParamsList);
boolean deleteAlgorithmParams(String id);
} }

View File

@ -1,10 +1,23 @@
package com.yfd.platform.modules.algorithm.service.impl; package com.yfd.platform.modules.algorithm.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.yfd.platform.modules.algorithm.domain.AlgorithmClass; import com.yfd.platform.modules.algorithm.domain.AlgorithmClass;
import com.yfd.platform.modules.algorithm.domain.AlgorithmParams;
import com.yfd.platform.modules.algorithm.domain.AlgorithmParamsRequest;
import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassMapper; import com.yfd.platform.modules.algorithm.mapper.AlgorithmClassMapper;
import com.yfd.platform.modules.algorithm.mapper.AlgorithmParamsMapper;
import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService; import com.yfd.platform.modules.algorithm.service.IAlgorithmClassService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.modules.algorithm.service.IAlgorithmParamsService;
import com.yfd.platform.utils.SecurityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/** /**
* <p> * <p>
@ -15,8 +28,12 @@ import org.springframework.stereotype.Service;
* @since 2025-05-13 * @since 2025-05-13
*/ */
@Service @Service
@Transactional
public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper, AlgorithmClass> implements IAlgorithmClassService { public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper, AlgorithmClass> implements IAlgorithmClassService {
@Resource
private IAlgorithmParamsService algorithmParamsService;
/********************************** /**********************************
* 用途说明: 新增算法分类 * 用途说明: 新增算法分类
* 参数说明 algorithmClass * 参数说明 algorithmClass
@ -46,4 +63,26 @@ public class AlgorithmClassServiceImpl extends ServiceImpl<AlgorithmClassMapper,
public boolean deleteAlgorithmClass(String id) { public boolean deleteAlgorithmClass(String id) {
return this.removeById(id); return this.removeById(id);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public boolean addAlgorithmClassAndParams(AlgorithmParamsRequest algorithmParamsRequest) {
AlgorithmClass algorithmClass = algorithmParamsRequest.getAlgorithmClass();
if (ObjUtil.isEmpty(algorithmClass)) {
return false;
}
if (StrUtil.isBlank(algorithmClass.getId())) {
String uuid = IdUtil.fastSimpleUUID();
algorithmClass.setId(uuid);
}
String currentUsername = SecurityUtils.getCurrentUsername();
this.saveOrUpdate(algorithmClass);
List<AlgorithmParams> algorithmParamsList = algorithmParamsRequest.getAlgorithmParamsList();
algorithmParamsList.forEach(r -> {
r.setAlgorithmId(algorithmClass.getId());
r.setLastmodifier(currentUsername);
r.setLastmodifydate(LocalDateTime.now());
});
return algorithmParamsService.saveOrUpdateBatch(algorithmParamsList);
}
} }

View File

@ -28,4 +28,24 @@ public class AlgorithmParamsServiceImpl extends ServiceImpl<AlgorithmParamsMappe
public List<Map<String, Object>> getAlgorithmParamsList(String algorithmId) { public List<Map<String, Object>> getAlgorithmParamsList(String algorithmId) {
return algorithmParamsMapper.getAlgorithmParamsList(algorithmId); return algorithmParamsMapper.getAlgorithmParamsList(algorithmId);
} }
@Override
public boolean addAlgorithmParams(AlgorithmParams algorithmParams) {
return this.saveOrUpdate(algorithmParams);
}
@Override
public boolean batchAddAlgorithmParams(List<AlgorithmParams> algorithmParamsList) {
return this.saveBatch(algorithmParamsList);
}
@Override
public boolean batchUpdateAlgorithmParams(List<AlgorithmParams> algorithmParamsList) {
return this.saveOrUpdateBatch(algorithmParamsList);
}
@Override
public boolean deleteAlgorithmParams(String id) {
return this.removeById(id);
}
} }

View File

@ -118,8 +118,8 @@ public class SubstationController {
return ResponseResult.error("参数为空"); return ResponseResult.error("参数为空");
} }
LambdaQueryWrapper<SubstationArea> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SubstationArea> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SubstationArea::getStationCode, stationCode).eq(SubstationArea::getDatastatus, "1"); queryWrapper.eq(SubstationArea::getStationCode, stationCode).eq(SubstationArea::getDatastatus, "1").select(SubstationArea::getStationCode,SubstationArea::getStationName,SubstationArea::getAreaId,SubstationArea::getAreaName);
List<SubstationArea> list = substationAreaService.list(queryWrapper); List<Map<String, Object>> list = substationAreaService.listMaps(queryWrapper);
return ResponseResult.successData(list); return ResponseResult.successData(list);
} }
@ -509,4 +509,13 @@ public class SubstationController {
return ResponseResult.success(); return ResponseResult.success();
} }
@GetMapping("/getSubstationMaindeviceList")
@ApiOperation("获取间隔下的主设备")
public ResponseResult getSubstationMaindeviceList(String bayId) {
LambdaQueryWrapper<SubstationMaindevice> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SubstationMaindevice::getDatastatus, "1").eq(SubstationMaindevice::getBayId, bayId).select(SubstationMaindevice::getAreaId, SubstationMaindevice::getAreaName, SubstationMaindevice::getBayId, SubstationMaindevice::getBayName, SubstationMaindevice::getStationCode, SubstationMaindevice::getMainDeviceName, SubstationMaindevice::getMainDeviceId);
List<Map<String, Object>> mapList = substationMaindeviceService.listMaps(queryWrapper);
return ResponseResult.successData(mapList);
}
} }

View File

@ -182,7 +182,7 @@ public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substat
if (StrUtil.isNotBlank(areaId)) { if (StrUtil.isNotBlank(areaId)) {
queryWrapper.eq(SubstationBay::getAreaId, areaId); queryWrapper.eq(SubstationBay::getAreaId, areaId);
} }
queryWrapper.eq(SubstationBay::getDatastatus, "1").orderByAsc(SubstationBay::getCustom1); queryWrapper.eq(SubstationBay::getDatastatus, "1").select(SubstationBay::getAreaId,SubstationBay::getAreaName,SubstationBay::getBayId,SubstationBay::getBayName,SubstationBay::getStationCode,SubstationBay::getStationName).orderByAsc(SubstationBay::getCustom1);
List<Map<String, Object>> list = substationBayMapper.selectMaps(queryWrapper); List<Map<String, Object>> list = substationBayMapper.selectMaps(queryWrapper);
return list; return list;
} }