|
@@ -772,36 +772,8 @@ public class MeterTreeController extends BladeController {
|
|
|
@GetMapping("/contract/remove")
|
|
|
@ApiOperationSupport(order = 29)
|
|
|
@ApiOperation(value = "合同段树节点删除", notes = "传入id")
|
|
|
- public R<Object> contractRemove(@RequestParam String id) {
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- MeterTreeContract obj = meterTreeContractService.getById(id);
|
|
|
- if (obj != null) {
|
|
|
- if (obj.getParentId().equals(0L) && obj.getAncestor().equals("0")) {
|
|
|
- throw new ServiceException("根节点无法删除");
|
|
|
- }
|
|
|
-
|
|
|
- /*子节点判断*/
|
|
|
- Long countChild = meterTreeContractService.getBaseMapper().selectCount(Wrappers.<MeterTreeContract>lambdaQuery()
|
|
|
- .eq(MeterTreeContract::getTemplateId, obj.getTemplateId())
|
|
|
- .eq(MeterTreeContract::getProjectId, obj.getProjectId())
|
|
|
- .eq(MeterTreeContract::getContractId, obj.getContractId())
|
|
|
- .eq(MeterTreeContract::getStatus, 1)
|
|
|
- .like(MeterTreeContract::getAncestor, id));
|
|
|
- if (countChild > 0) {
|
|
|
- throw new ServiceException("该节点下存在子节点,无法删除");
|
|
|
- }
|
|
|
-
|
|
|
- /*清单判断*/
|
|
|
- Long inventoryFormMeterCount = inventoryFormMeterService.getBaseMapper().selectCount(Wrappers.<InventoryFormMeter>lambdaQuery()
|
|
|
- .eq(InventoryFormMeter::getContractMeterId, id));
|
|
|
- if (inventoryFormMeterCount != null && inventoryFormMeterCount > 0) {
|
|
|
- throw new ServiceException("该节点下存在清单信息,无法删除");
|
|
|
- }
|
|
|
-
|
|
|
- return R.data(meterTreeContractService.removeById(id));
|
|
|
- }
|
|
|
- }
|
|
|
- return R.fail("操作失败");
|
|
|
+ public R<Object> contractRemove(@RequestParam Long id) {
|
|
|
+ return meterTreeContractService.contractRemove(id);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/contract/lock")
|
|
@@ -913,4 +885,16 @@ public class MeterTreeController extends BladeController {
|
|
|
return R.success("取消关联成功");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/contract/importTemplate")
|
|
|
+ @ApiOperationSupport(order = 37)
|
|
|
+ @ApiOperation(value = "获取合同计量单元导入模板", notes = "获取合同计量单元导入模板,传入type")
|
|
|
+ public R<String> importTemplate(Integer type) {
|
|
|
+ if (type == null) {
|
|
|
+ R.fail("操作失败,请传入type");
|
|
|
+ }
|
|
|
+ String url = jdbcTemplate.queryForObject("select dict_value from blade_dict_biz where code = 'import_template' and dict_key = "+type+" and is_deleted = 0", String.class);
|
|
|
+ return R.data(url);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|