e98581cd sonin

设备台账 删除逻辑 修改

1 个父辈 3d30ef3b
...@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
10 import cn.hutool.json.JSONObject; 10 import cn.hutool.json.JSONObject;
11 import com.skua.core.context.BaseContextHandler; 11 import com.skua.core.context.BaseContextHandler;
12 import com.skua.core.query.QueryGenerator; 12 import com.skua.core.query.QueryGenerator;
13 import com.skua.modules.equipment.service.IEquipmentAssetService;
13 import org.apache.commons.lang.StringUtils; 14 import org.apache.commons.lang.StringUtils;
14 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 15 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
15 import org.apache.poi.ss.usermodel.Sheet; 16 import org.apache.poi.ss.usermodel.Sheet;
...@@ -109,6 +110,8 @@ public class EquipmentController { ...@@ -109,6 +110,8 @@ public class EquipmentController {
109 @Autowired 110 @Autowired
110 private IEquipmentInfoService equipmentInfoService; 111 private IEquipmentInfoService equipmentInfoService;
111 @Autowired 112 @Autowired
113 private IEquipmentAssetService equipmentAssetService;
114 @Autowired
112 private Key2ValueService key2ValueService; 115 private Key2ValueService key2ValueService;
113 116
114 117
...@@ -384,17 +387,26 @@ public class EquipmentController { ...@@ -384,17 +387,26 @@ public class EquipmentController {
384 Result<?> result = new Result<>(); 387 Result<?> result = new Result<>();
385 Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO); 388 Equipment equipment = EquipmentUtils.equipDTO2Entity(equipmentDTO);
386 // todo 前端未传,特殊处理 389 // todo 前端未传,特殊处理
387 equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId()); 390 // equipment.getEquipmentInfo().setAssetId(equipment.getEquipmentAsset().getId());
388 // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId()); 391 // equipment.getEquipmentExt().setInfoId(equipment.getEquipmentInfo().getId());
389 // 校验ID是否一致 392 // 校验ID是否一致
390 JoinSqlUtils.checkSqlIdFunc(equipment); 393 // JoinSqlUtils.checkSqlIdFunc(equipment);
391 // 与点表有关联的台账不允许删除 394 // 与点表有关联的台账不允许删除
392 List<SysMonitorMetricInfo> monitorMetricInfo = sysMonitorMetricInfoService.list(new QueryWrapper<SysMonitorMetricInfo>().eq("equipment_code", equipmentDTO.getEquipmentInfo().getId())); 395 List<SysMonitorMetricInfo> monitorMetricInfo = sysMonitorMetricInfoService.list(new QueryWrapper<SysMonitorMetricInfo>().eq("equipment_code", equipmentDTO.getEquipmentInfo().getId()));
393 if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) { 396 if (monitorMetricInfo!=null&&monitorMetricInfo.size()>0) {
394 result.error500("与运行点表有关联的设备台账不允许删除"); 397 result.error500("与运行点表有关联的设备台账不允许删除");
395 return result; 398 return result;
396 } 399 }
397 iCrudSqlService.delete(equipment); 400 // iCrudSqlService.delete(equipment);
401 transactionTemplate.execute((transactionStatus -> {
402 if (StringUtils.isNotEmpty(equipment.getEquipmentInfo().getId())) {
403 equipmentInfoService.removeById(equipment.getEquipmentInfo().getId());
404 }
405 if (StringUtils.isNotEmpty(equipment.getEquipmentAsset().getId())) {
406 equipmentAssetService.removeById(equipment.getEquipmentAsset().getId());
407 }
408 return 1;
409 }));
398 return Result.ok("删除成功!"); 410 return Result.ok("删除成功!");
399 } 411 }
400 412
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!