From e4667ffbf0f27e39c0b1dda014cdf20b6457ec20 Mon Sep 17 00:00:00 2001 From: du <1725534722@qq.com> Date: Fri, 10 Jan 2025 14:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=94=AF=E4=B8=80=E6=80=A7?= =?UTF-8?q?=E5=92=8C=E5=8D=95=E4=BD=8Dxiaojian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tc/controller/AssetAppController.java | 15 ++++++++ .../tc/controller/AssetCurrentController.java | 35 +++++++++++++++---- .../tc/controller/AssetEmailController.java | 20 +++++++++-- .../AssetMiniProgramsController.java | 18 ++++++++++ .../AssetOfficialAccountController.java | 18 ++++++++++ .../tc/service/impl/AssetAppServiceImpl.java | 22 +++++++++--- .../service/impl/AssetEmailServiceImpl.java | 14 +++++++- .../impl/AssetMiniProgramsServiceImpl.java | 19 +++++++--- .../impl/AssetOfficialAccountServiceImpl.java | 23 ++++++++++++ 9 files changed, 166 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetAppController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetAppController.java index 17f2b36..6613763 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetAppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetAppController.java @@ -20,6 +20,7 @@ import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.service.AssetAppCpService; import com.ruoyi.tc.service.AssetAppJyService; import com.ruoyi.tc.service.AssetAppService; +import com.ruoyi.tc.service.UnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -55,6 +56,8 @@ public class AssetAppController extends BaseController { @Resource private AssetAppJyService assetAppJyService; + @Resource + private UnitService unitService; /** * 分页查询 * @@ -84,6 +87,18 @@ public class AssetAppController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('unit')") @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetAppJyPo assetAppJyPo) { + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetAppJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list1 = assetAppService.lambdaQuery().eq(AssetApp::getSsdw, assetAppJyPo.getSsdw()) + .eq(AssetApp::getAppName, assetAppJyPo.getAppName()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + + AssetAppJyPo one = assetAppJyService.lambdaQuery().eq(AssetAppJyPo::getAppName,assetAppJyPo.getAppName()) .eq(AssetAppJyPo::getSsdw,assetAppJyPo.getSsdw()).isNull(AssetAppJyPo::getTaskId).one(); assetAppJyPo.setAuditState("1"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java index 981096e..1b8db14 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetCurrentController.java @@ -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 list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list(); if (list == null || list.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + List 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 list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrentJyPo.getDwmc()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List 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 list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List 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 list = unitService.lambdaQuery().eq(Unit::getNickName, assetCurrent.getDwmc()).eq(Unit::getDelFlag, 0).list(); - if (list == null || list.isEmpty()) { - throw new ServiceException("请选择已有单位!"); - } + assetCurrentService.updateById(assetCurrent); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetEmailController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetEmailController.java index 7d27011..83e75da 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetEmailController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetEmailController.java @@ -10,14 +10,15 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.tc.entity.AssetApp; import com.ruoyi.tc.entity.AssetEmail; -import com.ruoyi.tc.entity.po.*; +import com.ruoyi.tc.entity.Unit; +import com.ruoyi.tc.entity.po.AssetEmailJyPo; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetEmailPageRequest; import com.ruoyi.tc.service.AssetEmailJyService; import com.ruoyi.tc.service.AssetEmailService; +import com.ruoyi.tc.service.UnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -46,6 +47,9 @@ public class AssetEmailController extends BaseController { @Resource private AssetEmailService assetEmailService; + @Resource + private UnitService unitService; + @Resource private AssetEmailJyService assetEmailJyService; /** @@ -78,6 +82,18 @@ public class AssetEmailController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('unit')") @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetEmailJyPo assetEmailJyPo) { + + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmailJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list1 = assetEmailService.lambdaQuery().eq(AssetEmail::getSsdw, assetEmailJyPo.getSsdw()) + .eq(AssetEmail::getDzyxhz, assetEmailJyPo.getDzyxhz()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + AssetEmailJyPo one = assetEmailJyService.lambdaQuery().eq(AssetEmailJyPo::getSsdw,assetEmailJyPo.getSsdw()) .eq(AssetEmailJyPo::getDzyxhz,assetEmailJyPo.getDzyxhz()).isNull(AssetEmailJyPo::getTaskId).one(); assetEmailJyPo.setAuditState("1"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetMiniProgramsController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetMiniProgramsController.java index f16fbc2..2a41afa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetMiniProgramsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetMiniProgramsController.java @@ -10,8 +10,10 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.tc.entity.AssetCurrent; import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetMiniPrograms; +import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.po.AssetAppCpPo; import com.ruoyi.tc.entity.po.AssetAppJyPo; import com.ruoyi.tc.entity.po.AssetEmailJyPo; @@ -21,6 +23,7 @@ import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest; import com.ruoyi.tc.service.AssetMiniProgramsJyService; import com.ruoyi.tc.service.AssetMiniProgramsService; +import com.ruoyi.tc.service.UnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -51,6 +54,9 @@ public class AssetMiniProgramsController extends BaseController { @Resource private AssetMiniProgramsJyService assetMiniProgramsJyService; + + @Resource + private UnitService unitService; /** * 分页查询 * @@ -81,6 +87,18 @@ public class AssetMiniProgramsController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('unit')") @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetMiniProgramsJyPo assetMiniProgramsJyPo) { + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniProgramsJyPo.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list1 = assetMiniProgramsService.lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniProgramsJyPo.getSsdw()) + .eq(AssetMiniPrograms::getXcxmc, assetMiniProgramsJyPo.getXcxmc()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + + AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery().eq(AssetMiniProgramsJyPo::getSsdw,assetMiniProgramsJyPo.getSsdw()) .eq(AssetMiniProgramsJyPo::getXcxmc,assetMiniProgramsJyPo.getXcxmc()).isNull(AssetMiniProgramsJyPo::getTaskId).one(); assetMiniProgramsJyPo.setAuditState("1"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java index cdbcdec..9bd2606 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetOfficialAccountController.java @@ -9,8 +9,10 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetMiniPrograms; import com.ruoyi.tc.entity.AssetOfficialAccount; +import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.po.AssetAppJyPo; import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo; import com.ruoyi.tc.entity.po.AssetOfficialAccountJyPo; @@ -20,6 +22,7 @@ import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest; import com.ruoyi.tc.service.AssetOfficialAccountJyService; import com.ruoyi.tc.service.AssetOfficialAccountService; +import com.ruoyi.tc.service.UnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -55,6 +58,9 @@ public class AssetOfficialAccountController { @Resource private AssetOfficialAccountJyService assetOfficialAccountJyService; + + @Resource + private UnitService unitService; /** * 分页查询 * @@ -117,6 +123,18 @@ public class AssetOfficialAccountController { @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetOfficialAccountJyPo ao) { + List list = unitService.lambdaQuery().eq(Unit::getNickName, ao.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list1 = assetOfficialAccountService.lambdaQuery().eq(AssetOfficialAccount::getSsdw, ao.getSsdw()) + .eq(AssetOfficialAccount::getGzhmc, ao.getGzhmc()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + + if (ao.getCdList() != null && !ao.getCdList().isEmpty()) { StringBuilder a = new StringBuilder(); StringBuilder b = new StringBuilder(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetAppServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetAppServiceImpl.java index 6ec3708..486ca8f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetAppServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetAppServiceImpl.java @@ -36,6 +36,9 @@ public class AssetAppServiceImpl extends ServiceImpl i @Resource private AssetTaskService assetTaskService; + + + /** * 分页查询所有数据 * @@ -90,11 +93,16 @@ public class AssetAppServiceImpl extends ServiceImpl i */ @Override public Boolean add(AssetApp assetApp) { - List list = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()) - .eq(Unit::getDelFlag, 0).list(); + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list(); if (list == null || list.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + + List list1 = lambdaQuery().eq(AssetApp::getSsdw, assetApp.getSsdw()) + .eq(AssetApp::getAppName, assetApp.getAppName()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } save(assetApp); AssetAppCpPo a = new AssetAppCpPo(); BeanUtil.copyProperties(assetApp, a); @@ -118,10 +126,16 @@ public class AssetAppServiceImpl extends ServiceImpl i public Boolean edit(AssetApp assetApp) { AssetApp byId = getById(assetApp.getId()); - List list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list(); - if (list1 == null || list1.isEmpty()) { + List list2 = unitService.lambdaQuery().eq(Unit::getNickName, assetApp.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list2 == null || list2.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + + List list1 = lambdaQuery().eq(AssetApp::getSsdw, assetApp.getSsdw()) + .eq(AssetApp::getAppName, assetApp.getAppName()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } updateById(assetApp); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetEmailServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetEmailServiceImpl.java index 45d9c45..7676408 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetEmailServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetEmailServiceImpl.java @@ -37,6 +37,7 @@ public class AssetEmailServiceImpl extends ServiceImpl list = unitService.lambdaQuery().eq(Unit::getNickName, assetEmail.getSsdw()) .eq(Unit::getDelFlag, 0).list(); if (list == null || list.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + List list1 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw()) + .eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } save(assetEmail); AssetEmailCpPo a = new AssetEmailCpPo(); BeanUtil.copyProperties(assetEmail, a); @@ -121,7 +129,11 @@ public class AssetEmailServiceImpl extends ServiceImpl list3 = lambdaQuery().eq(AssetEmail::getSsdw, assetEmail.getSsdw()) + .eq(AssetEmail::getDzyxhz, assetEmail.getDzyxhz()).list(); + if (list3 != null&& !list3.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } updateById(assetEmail); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetMiniProgramsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetMiniProgramsServiceImpl.java index e8f859e..e96bba7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetMiniProgramsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetMiniProgramsServiceImpl.java @@ -81,11 +81,16 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()) - .eq(Unit::getDelFlag, 0).list(); + List list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list(); if (list == null || list.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + + List list1 = lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniPrograms.getSsdw()) + .eq(AssetMiniPrograms::getXcxmc, assetMiniPrograms.getXcxmc()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } save(assetMiniPrograms); AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo(); BeanUtil.copyProperties(assetMiniPrograms, assetMiniProgramsCpPo); @@ -107,11 +112,17 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl list1 = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list(); - if (list1 == null || list1.isEmpty()) { + List list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list3 == null || list3.isEmpty()) { throw new ServiceException("请选择已有单位!"); } + List list1 = lambdaQuery().eq(AssetMiniPrograms::getSsdw, assetMiniPrograms.getSsdw()) + .eq(AssetMiniPrograms::getXcxmc, assetMiniPrograms.getXcxmc()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + updateById(assetMiniPrograms); List list = assetMiniProgramsCpService.lambdaQuery() .eq(AssetMiniProgramsCpPo::getAssetId, assetMiniPrograms.getId()).list(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java index b8b768c..b8af876 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetOfficialAccountServiceImpl.java @@ -84,6 +84,17 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list3 == null || list3.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list1 = lambdaQuery().eq(AssetOfficialAccount::getSsdw, assetOfficialAccount.getSsdw()) + .eq(AssetOfficialAccount::getGzhmc, assetOfficialAccount.getGzhmc()).list(); + if (list1 != null&& !list1.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) { StringBuilder a = new StringBuilder(); StringBuilder b = new StringBuilder(); @@ -131,6 +142,18 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl list3 = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()).eq(Unit::getDelFlag, 0).list(); + if (list3 == null || list3.isEmpty()) { + throw new ServiceException("请选择已有单位!"); + } + + List list4 = lambdaQuery().eq(AssetOfficialAccount::getSsdw, assetOfficialAccount.getSsdw()) + .eq(AssetOfficialAccount::getGzhmc, assetOfficialAccount.getGzhmc()).list(); + if (list4 != null&& !list4.isEmpty()){ + throw new ServiceException("不允许新增重复资产!"); + } + + if (assetOfficialAccount.getCdList() != null && !assetOfficialAccount.getCdList().isEmpty()) { StringBuilder a = new StringBuilder(); StringBuilder b = new StringBuilder();