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 98d7b5e..30b750d 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 @@ -2,6 +2,7 @@ package com.ruoyi.tc.controller; import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -10,17 +11,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.AssetTask; -import com.ruoyi.tc.entity.po.AssetAppCpPo; -import com.ruoyi.tc.entity.po.AssetAppJyPo; +import com.ruoyi.tc.entity.*; +import com.ruoyi.tc.entity.po.*; +import com.ruoyi.tc.entity.request.Acomma; import com.ruoyi.tc.entity.request.AssetAppPageRequest; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; 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.AssetTaskService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -31,8 +30,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import static com.ruoyi.common.core.domain.AjaxResult.success; + /** * 资产移动应用程序表(asset_app)表控制层 * @@ -57,6 +60,8 @@ public class AssetAppController extends BaseController { @Resource private AssetAppCpService assetAppCpService; + @Resource + private UnitService unitService; /** * 分页查询 * @@ -79,7 +84,6 @@ public class AssetAppController extends BaseController { return success(assetAppService.page(page, req)); } //================================================= - /** * 单位自编辑进行校验 */ @@ -87,8 +91,20 @@ public class AssetAppController extends BaseController { @PreAuthorize("@ss.hasAnyRoles('unit')") @PostMapping("/unitEdit") public AjaxResult unitEdit(@RequestBody @Valid AssetAppJyPo assetAppJyPo) { - AssetAppJyPo one = assetAppJyService.lambdaQuery().eq(AssetAppJyPo::getAppName, assetAppJyPo.getAppName()) - .eq(AssetAppJyPo::getSsdw, assetAppJyPo.getSsdw()).isNull(AssetAppJyPo::getTaskId).one(); + 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"); assetAppJyPo.setAuditYy(null); if (one != null) { @@ -161,7 +177,7 @@ public class AssetAppController extends BaseController { .isNotNull(AssetAppJyPo::getTaskId) .ne(AssetAppJyPo::getStatus, 5) .eq(AssetAppJyPo::getAssetId, byId.getAssetId()).one(); - if (one != null) { + if(one!=null){ Integer status = one.getStatus(); Integer taskId = one.getTaskId(); Long appId = one.getAppId(); 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 0d8b70b..307da13 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); @@ -522,6 +537,15 @@ public class AssetCurrentController extends BaseController { } } } + 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(); @@ -544,10 +568,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 be3d6c5..47c8767 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,18 @@ 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.AssetTask; 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.*; +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 +50,9 @@ public class AssetEmailController extends BaseController { @Resource private AssetEmailService assetEmailService; + @Resource + private UnitService unitService; + @Resource private AssetEmailJyService assetEmailJyService; @@ -83,6 +90,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 74caa23..261f5ed 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,14 +10,23 @@ 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.AssetTask; import com.ruoyi.tc.entity.po.*; +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; +import com.ruoyi.tc.entity.po.AssetMiniProgramsJyPo; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetMiniProgramsPageRequest; import com.ruoyi.tc.service.*; +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; @@ -54,6 +63,9 @@ public class AssetMiniProgramsController extends BaseController { private AssetTaskService assetTaskService; @Resource private AssetMiniProgramsCpService assetMiniProgramsCpService; + + @Resource + private UnitService unitService; /** * 分页查询 * @@ -84,6 +96,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 bdc7510..75d9e64 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,13 @@ 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; import com.ruoyi.tc.entity.AssetTask; import com.ruoyi.tc.entity.po.*; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; @@ -18,6 +23,9 @@ import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetOfficialAccountMenu; import com.ruoyi.tc.entity.request.AssetOfficialAccountPageRequest; import com.ruoyi.tc.service.*; +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; @@ -53,6 +61,9 @@ public class AssetOfficialAccountController { @Resource private AssetOfficialAccountJyService assetOfficialAccountJyService; + + @Resource + private UnitService unitService; @Resource private AssetTaskService assetTaskService; @Resource @@ -120,6 +131,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 9b37260..f384683 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 @@ -37,6 +37,9 @@ public class AssetAppServiceImpl extends ServiceImpl i @Resource private AssetTaskService assetTaskService; + + + /** * 分页查询所有数据 * @@ -91,11 +94,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); @@ -119,10 +127,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 9b526eb..82bad36 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 @@ -39,6 +39,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); @@ -123,7 +131,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 542acd4..e55ea6d 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 @@ -85,11 +85,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); @@ -111,11 +116,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 4526029..d4862e3 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 @@ -88,6 +88,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(); @@ -135,6 +146,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();