feat: 增加批量修改装置和杆塔的线路

dev
huangfeng 1 month ago
parent 56ba3b6c4c
commit 832ab09bd2

@ -62,6 +62,20 @@ public class TerminalExtController extends BaseController {
CameraScheduleService cameraScheduleService; CameraScheduleService cameraScheduleService;
@PostMapping("batchUpdate")
@ApiOperation("批量修改装置")
@Log(title = "批量修改装置", type = "修改")
public ResponseReult<String> batchUpdate(@RequestBody BatchUpdateModel model) throws Exception {
if (model.getNewLineId() == null) {
throw new ApiException("newLineId不能为空");
}
if (CollectionUtils.isEmpty(model.getTermIds())) {
throw new ApiException("termIds不能为空");
}
terminalExtService.batchUpdate(model);
return ResponseReult.success("OK");
}
@PostMapping("importTerminal") @PostMapping("importTerminal")
@ApiOperation("导入装置") @ApiOperation("导入装置")
@Log(title = "导入装置", type = "导入") @Log(title = "导入装置", type = "导入")

@ -0,0 +1,11 @@
package com.shxy.xymanager_common.model;
import lombok.Data;
import java.util.List;
@Data
public class BatchUpdateModel {
List<Integer> termIds;
Integer newLineId;
}

@ -361,4 +361,23 @@ public class TerminalExtServiceImpl implements TerminalExtService {
} }
return stat; return stat;
} }
@Override
@CacheEvict(cacheNames = {"permissionfull", "permissionover", "fulltree", "cacheTerminalMap", "cacheTower"}, allEntries = true)
public void batchUpdate(BatchUpdateModel model) throws Exception {
for (Integer termId : model.getTermIds()) {
Terminals terminal = terminalsDao.selectByPrimaryKey(termId);
if (terminal == null) {
throw new ApiException("没有找到该装置termId=" + termId);
}
Towers tower = towerDao.selectByPrimaryKey(terminal.getTowerId());
if (tower == null) {
throw new ApiException("该装置termId=" + termId + "的杆塔towerId=" + terminal.getTowerId() + "不存在");
}
terminal.setLineId(model.getNewLineId());
tower.setLineid(model.getNewLineId());
towerDao.updateByPrimaryKey(tower);
terminalsDao.updateByPrimaryKey(terminal);
}
}
} }

@ -2,6 +2,7 @@ package com.shxy.xymanager_service.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.entity.*; import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.model.BatchUpdateModel;
import com.shxy.xymanager_common.model.StatMaintain; import com.shxy.xymanager_common.model.StatMaintain;
import com.shxy.xymanager_common.model.StatModel; import com.shxy.xymanager_common.model.StatModel;
import com.shxy.xymanager_common.model.UploadModel; import com.shxy.xymanager_common.model.UploadModel;
@ -30,4 +31,6 @@ public interface TerminalExtService {
void importTerminal(UploadModel model); void importTerminal(UploadModel model);
List<StatMaintain> statMaintain(StatModel model) throws Exception; List<StatMaintain> statMaintain(StatModel model) throws Exception;
void batchUpdate(BatchUpdateModel model) throws Exception;
} }

Loading…
Cancel
Save