|
|
|
|
@ -118,6 +118,12 @@ public class BsSafeInspectionPointController { |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@Operation(summary = "新增", description = "传入bsSafeInspectionPoint") |
|
|
|
|
public R save(@Valid @RequestBody BsSafeInspectionPointEntity bsSafeInspectionPoint) { |
|
|
|
|
// 校验巡检点编号是否重复
|
|
|
|
|
if (bsSafeInspectionPoint.getInsNum() != null) { |
|
|
|
|
if (bsSafeInspectionPointService.checkDuplicate(bsSafeInspectionPoint.getInsNum(), null)) { |
|
|
|
|
throw new RuntimeException("巡检点编号【" + bsSafeInspectionPoint.getInsNum() + "】已存在,不能重复添加"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.status(bsSafeInspectionPointService.save(bsSafeInspectionPoint)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -128,6 +134,12 @@ public class BsSafeInspectionPointController { |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@Operation(summary = "修改", description = "传入bsSafeInspectionPoint") |
|
|
|
|
public R update(@Valid @RequestBody BsSafeInspectionPointEntity bsSafeInspectionPoint) { |
|
|
|
|
// 校验巡检点编号是否重复(排除当前记录)
|
|
|
|
|
if (bsSafeInspectionPoint.getInsNum() != null) { |
|
|
|
|
if (bsSafeInspectionPointService.checkDuplicate(bsSafeInspectionPoint.getInsNum(), bsSafeInspectionPoint.getId())) { |
|
|
|
|
return R.fail("巡检点编号【" + bsSafeInspectionPoint.getInsNum() + "】已存在,不能重复"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.status(bsSafeInspectionPointService.updateById(bsSafeInspectionPoint)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -138,6 +150,12 @@ public class BsSafeInspectionPointController { |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@Operation(summary = "新增或修改", description = "传入bsSafeInspectionPoint") |
|
|
|
|
public R submit(@Valid @RequestBody BsSafeInspectionPointEntity bsSafeInspectionPoint) { |
|
|
|
|
// 校验巡检点编号是否重复
|
|
|
|
|
if (bsSafeInspectionPoint.getInsNum() != null) { |
|
|
|
|
if (bsSafeInspectionPointService.checkDuplicate(bsSafeInspectionPoint.getInsNum(), bsSafeInspectionPoint.getId())) { |
|
|
|
|
return R.fail("巡检点编号【" + bsSafeInspectionPoint.getInsNum() + "】已存在,不能重复"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return R.status(bsSafeInspectionPointService.saveOrUpdate(bsSafeInspectionPoint)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -212,6 +230,15 @@ public class BsSafeInspectionPointController { |
|
|
|
|
&& !item.getInsNum().contains("注")) |
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
// 校验导入数据中是否有重复的巡检点编号
|
|
|
|
|
for (BsSafeInspectionPointEntity entity : importList) { |
|
|
|
|
if (entity.getInsNum() != null) { |
|
|
|
|
if (bsSafeInspectionPointService.checkDuplicate(entity.getInsNum(), null)) { |
|
|
|
|
return R.fail("巡检点编号【" + entity.getInsNum() + "】已存在,不能重复导入"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.status(bsSafeInspectionPointService.saveBatch(importList)); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
@ -221,6 +248,15 @@ public class BsSafeInspectionPointController { |
|
|
|
|
@ApiOperationSupport(order = 12) |
|
|
|
|
@Operation(summary = "批量新增", description = "传入bsSafeInspectionPointList") |
|
|
|
|
public R saveList(@Valid @RequestBody List<BsSafeInspectionPointEntity> bsSafeInspectionPointList) { |
|
|
|
|
// 校验批量数据中是否有重复的巡检点编号
|
|
|
|
|
for (BsSafeInspectionPointEntity entity : bsSafeInspectionPointList) { |
|
|
|
|
if (entity.getInsNum() != null) { |
|
|
|
|
if (bsSafeInspectionPointService.checkDuplicate(entity.getInsNum(), entity.getId())) { |
|
|
|
|
return R.fail("巡检点编号【" + entity.getInsNum() + "】已存在,不能重复添加"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return R.status(bsSafeInspectionPointService.saveOrUpdateBatch(bsSafeInspectionPointList)); |
|
|
|
|
} |
|
|
|
|
@PostMapping(value = "/print") |
|
|
|
|
|