Compare commits
2 Commits
1a110afcf8
...
9a6cff1514
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9a6cff1514 | ||
![]() |
cb340a99fc |
@ -10,14 +10,12 @@ import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -49,9 +47,10 @@ public class AlgorithmArrangeController {
|
||||
Page<AlgorithmArrange> arrangePage = algorithmArrangeService.page(page, queryWrapper);
|
||||
return ResponseResult.successData(arrangePage);
|
||||
}
|
||||
|
||||
@GetMapping("/getAlgorithmArrangeById")
|
||||
@ApiOperation("根据Id查询算法布点")
|
||||
public ResponseResult getAlgorithmArrangeById (String id){
|
||||
public ResponseResult getAlgorithmArrangeById(String id) {
|
||||
AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id);
|
||||
return ResponseResult.successData(algorithmArrange);
|
||||
}
|
||||
@ -59,6 +58,13 @@ public class AlgorithmArrangeController {
|
||||
@PostMapping("/saveAlgorithmArrange")
|
||||
@ApiOperation("新增算法布点")
|
||||
public ResponseResult saveAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
||||
|
||||
// 判断是否存在相同的方案
|
||||
LambdaQueryWrapper<AlgorithmArrange> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmArrange::getArrangeName, algorithmArrange.getArrangeName());
|
||||
if (algorithmArrangeService.getOne(queryWrapper) != null) {
|
||||
return ResponseResult.error("方案名称已存在");
|
||||
}
|
||||
algorithmArrange.setLastmodifier("admin");
|
||||
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
||||
algorithmArrange.setDatastatus("1");
|
||||
@ -85,6 +91,13 @@ public class AlgorithmArrangeController {
|
||||
@PostMapping("/updateAlgorithmArrange")
|
||||
@ApiOperation("修改算法布点")
|
||||
public ResponseResult updateAlgorithmArrange(AlgorithmArrange algorithmArrange, MultipartFile file) {
|
||||
// 判断是否存在相同的方案
|
||||
LambdaQueryWrapper<AlgorithmArrange> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(AlgorithmArrange::getId, algorithmArrange.getId()).eq(AlgorithmArrange::getArrangeName,
|
||||
algorithmArrange.getArrangeName());
|
||||
if (algorithmArrangeService.getOne(queryWrapper) != null) {
|
||||
return ResponseResult.error("方案名称已存在");
|
||||
}
|
||||
algorithmArrange.setLastmodifier(SecurityUtils.getCurrentUsername());
|
||||
algorithmArrange.setLastmodifydate(LocalDateTime.now());
|
||||
// 文件上传逻辑
|
||||
@ -105,12 +118,33 @@ public class AlgorithmArrangeController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmArrange")
|
||||
@ApiOperation("删除布点数据")
|
||||
public ResponseResult deleteAlgorithmArrange(String id) {
|
||||
boolean b = algorithmArrangeService.removeById(id);
|
||||
if (b) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/deleteAlgorithmArrange")
|
||||
@ApiOperation("删除布点数据")
|
||||
public ResponseResult deleteAlgorithmArrange(@RequestBody List<String> ids) {
|
||||
boolean b = algorithmArrangeService.removeByIds(ids);
|
||||
if (b) {
|
||||
return ResponseResult.success();
|
||||
} else {
|
||||
return ResponseResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/callAlgorithmArrange")
|
||||
@ApiOperation("调用算法布点API")
|
||||
public ResponseResult callAlgorithmArrange(String id) {
|
||||
AlgorithmArrange algorithmArrange=algorithmArrangeService.callAlgorithmArrange(id);
|
||||
AlgorithmArrange algorithmArrange = algorithmArrangeService.callAlgorithmArrange(id);
|
||||
return ResponseResult.successData(algorithmArrange);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.yfd.platform.modules.algorithm.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.modules.algorithm.domain.AlgorithmArrangeDevice;
|
||||
import com.yfd.platform.modules.algorithm.service.IAlgorithmArrangeDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -34,4 +36,13 @@ public class AlgorithmArrangeDeviceController {
|
||||
List<Map<String, Object>> maps = algorithmArrangeDeviceService.getArrangeDeviceInfo(arrangeId);
|
||||
return ResponseResult.successData(maps);
|
||||
}
|
||||
|
||||
@GetMapping("/getArrangeDeviceById")
|
||||
@ApiOperation("根据ID查询当前布点详情")
|
||||
public ResponseResult getArrangeDeviceById(String arrangeId) {
|
||||
LambdaQueryWrapper<AlgorithmArrangeDevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AlgorithmArrangeDevice::getArrangeId, arrangeId);
|
||||
List<Map<String, Object>> maps = algorithmArrangeDeviceService.listMaps(queryWrapper);
|
||||
return ResponseResult.successData(maps);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class SubstationMaindeviceController {
|
||||
}
|
||||
LambdaQueryWrapper<SubstationMaindevice> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(stationCode), SubstationMaindevice::getStationCode, stationCode);
|
||||
queryWrapper.eq(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType, StrUtil.split(deviceTypeList
|
||||
queryWrapper.in(StrUtil.isNotBlank(deviceTypeList), SubstationMaindevice::getDeviceType, StrUtil.split(deviceTypeList
|
||||
, ","));
|
||||
queryWrapper.select(SubstationMaindevice::getMainDeviceId, SubstationMaindevice::getMainDeviceName,
|
||||
SubstationMaindevice::getDeviceType, SubstationMaindevice::getFileUrl);
|
||||
|
Loading…
Reference in New Issue
Block a user