|
|
|
@ -145,10 +145,16 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
|
|
|
|
|
|
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException("请选择已有单位!");
|
|
|
|
|
}
|
|
|
|
|
List<AssetCurrent> list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list();
|
|
|
|
|
if (list1 != null&& !list1.isEmpty()){
|
|
|
|
|
throw new ServiceException("不允许新增重复资产!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StringBuilder a = new StringBuilder();
|
|
|
|
|
if (assetCurrent.getGlymList() != null) {
|
|
|
|
|
assetCurrent.getGlymList().forEach(x -> {
|
|
|
|
@ -239,9 +245,7 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
success();
|
|
|
|
|
return success();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//=================================================
|
|
|
|
@ -253,6 +257,17 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('unit')")
|
|
|
|
|
@PostMapping("/unitEdit")
|
|
|
|
|
public AjaxResult unitEdit(@RequestBody @Valid AssetCurrentJyPo assetCurrentJyPo) {
|
|
|
|
|
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrentJyPo.getDwmc()).eq(Unit::getDelFlag, 0).list();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException("请选择已有单位!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<AssetCurrent> list1 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrentJyPo.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrentJyPo.getDwmc()).list();
|
|
|
|
|
if (list1 != null&& !list1.isEmpty()){
|
|
|
|
|
throw new ServiceException("不允许新增重复资产!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AssetCurrentJyPo one = assetCurrentJyService.lambdaQuery().eq(AssetCurrentJyPo::getXtmc, assetCurrentJyPo.getXtmc()).eq(AssetCurrentJyPo::getDwmc, assetCurrentJyPo.getDwmc()).isNull(AssetCurrentJyPo::getTaskId).one();
|
|
|
|
|
assetCurrentJyPo.setAuditState("1");
|
|
|
|
|
assetCurrentJyPo.setAuditYy(null);
|
|
|
|
@ -506,6 +521,15 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
|
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException("请选择已有单位!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<AssetCurrent> list3 = assetCurrentService.lambdaQuery().eq(AssetCurrent::getXtmc, assetCurrent.getXtmc()).eq(AssetCurrent::getDwmc, assetCurrent.getDwmc()).list();
|
|
|
|
|
if (list3 != null&& !list3.isEmpty()){
|
|
|
|
|
throw new ServiceException("不允许新增重复资产!");
|
|
|
|
|
}
|
|
|
|
|
//保存未修改之前的单位名称
|
|
|
|
|
// AssetCurrent byId = assetCurrentService.getById(assetCurrent.getId());
|
|
|
|
|
StringBuilder a = new StringBuilder();
|
|
|
|
@ -528,10 +552,7 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
assetCurrent.setGlIp(b.toString());
|
|
|
|
|
List<Unit> list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list();
|
|
|
|
|
if (list == null || list.isEmpty()) {
|
|
|
|
|
throw new ServiceException("请选择已有单位!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assetCurrentService.updateById(assetCurrent);
|
|
|
|
|
|
|
|
|
|