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 f0d8392..17f2b36 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 @@ -156,9 +156,10 @@ public class AssetAppController extends BaseController { //如果有任务也修改任务这边 AssetAppJyPo one = assetAppJyService.lambdaQuery() .isNotNull(AssetAppJyPo::getTaskId) - .eq(AssetAppJyPo::getStatus,"1") + .ne(AssetAppJyPo::getStatus, 5) .eq(AssetAppJyPo::getAssetId, byId.getAssetId()).one(); if(one!=null){ + Integer status = one.getStatus(); Integer taskId = one.getTaskId(); Long appId = one.getAppId(); BeanUtil.copyProperties(byId, one); @@ -166,6 +167,7 @@ public class AssetAppController extends BaseController { one.setTaskId(taskId); one.setAuditState(null); one.setAuditYy(null); + one.setStatus(status); assetAppJyService.updateById(one); } } 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 52f566e..c4a9ca1 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 @@ -144,6 +144,11 @@ 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("请选择已有单位!"); + } StringBuilder a = new StringBuilder(); if (assetCurrent.getGlymList() != null) { assetCurrent.getGlymList().forEach(x -> { @@ -442,32 +447,34 @@ public class AssetCurrentController extends BaseController { //如果有任务也修改任务这边 AssetCurrentCpPo one = assetCurrentCpService.lambdaQuery() .isNotNull(AssetCurrentCpPo::getTaskId) - .eq(AssetCurrentCpPo::getStatus,"1") + .ne(AssetCurrentCpPo::getStatus, 5) .eq(AssetCurrentCpPo::getId, byId.getId()).one(); - if(one!=null){ + if (one != null) { Integer taskId = one.getTaskId(); Long appId = one.getCurrentId(); + Integer status = one.getStatus(); BeanUtil.copyProperties(byId, one); one.setCurrentId(appId); one.setTaskId(taskId); one.setAuditState(null); one.setAuditYy(null); + one.setStatus(status); assetCurrentCpService.updateById(one); QueryWrapper queryWrapper2 = new QueryWrapper<>(); queryWrapper2.eq("asset_id", one.getId()); - queryWrapper2.eq("task_id",taskId); + queryWrapper2.eq("task_id", taskId); assetSupplyChainCpService.remove(queryWrapper2); QueryWrapper queryWrapper3 = new QueryWrapper<>(); queryWrapper3.eq("asset_id", one.getId()); - queryWrapper3.eq("task_id",taskId); + queryWrapper3.eq("task_id", taskId); assetBasicNetworkCpService.remove(queryWrapper3); QueryWrapper queryWrapper4 = new QueryWrapper<>(); queryWrapper4.eq("asset_id", one.getId()); - queryWrapper4.eq("task_id",taskId); + queryWrapper4.eq("task_id", taskId); assetBusinessFormCpService.remove(queryWrapper4); QueryWrapper queryWrapper5 = new QueryWrapper<>(); - queryWrapper5.eq("task_id",taskId); + queryWrapper5.eq("task_id", taskId); queryWrapper5.eq("asset_id", one.getId()); unitOtherConcatCpService.remove(queryWrapper5); list.forEach(x -> { @@ -560,35 +567,37 @@ public class AssetCurrentController extends BaseController { //================================ Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0"); - if(i!=null){ - + if (i != null) { QueryWrapper queryWrapper1 = new QueryWrapper<>(); queryWrapper1.eq("id", assetCurrent.getId()); - queryWrapper1.eq("status","1"); - queryWrapper1.eq("task_id",i); - assetCurrentCpService.remove(queryWrapper1); + queryWrapper1.eq("task_id", i); + queryWrapper1.ne("status", 5); + AssetCurrentCpPo x = assetCurrentCpService.getOne(queryWrapper1); + Integer status = x.getStatus(); + Long currentId = x.getCurrentId(); AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); assetCurrentCpPo.setTaskId(i); - assetCurrentCpPo.setStatus(1); - assetCurrentCpService.save(assetCurrentCpPo); + assetCurrentCpPo.setCurrentId(currentId); + assetCurrentCpPo.setStatus(status); + assetCurrentCpService.updateById(assetCurrentCpPo); QueryWrapper queryWrapper2 = new QueryWrapper<>(); queryWrapper2.eq("asset_id", assetCurrent.getId()); - queryWrapper2.eq("task_id",i); + queryWrapper2.eq("task_id", i); assetSupplyChainCpService.remove(queryWrapper2); QueryWrapper queryWrapper3 = new QueryWrapper<>(); - queryWrapper3.eq("task_id",i); + queryWrapper3.eq("task_id", i); queryWrapper3.eq("asset_id", assetCurrent.getId()); assetBasicNetworkCpService.remove(queryWrapper3); QueryWrapper queryWrapper4 = new QueryWrapper<>(); - queryWrapper4.eq("task_id",i); + queryWrapper4.eq("task_id", i); queryWrapper4.eq("asset_id", assetCurrent.getId()); assetBusinessFormCpService.remove(queryWrapper4); QueryWrapper queryWrapper5 = new QueryWrapper<>(); queryWrapper5.eq("asset_id", assetCurrent.getId()); - queryWrapper5.eq("task_id",i); + queryWrapper5.eq("task_id", i); unitOtherConcatCpService.remove(queryWrapper5); if (assetCurrent.getXjgywxt() != null) { @@ -620,7 +629,6 @@ public class AssetCurrentController extends BaseController { //新增其他联系人 unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat()); } - } return success(); } @@ -701,7 +709,9 @@ public class AssetCurrentController extends BaseController { //读取所有的字段 ExcelUtil util = new ExcelUtil<>(AssetExport.class); List proList = util.importExcel(file.getInputStream()); + int j = 0; for (AssetExport items : proList) { + j++; AssetCurrent as = new AssetCurrent(); //copy新增到新的现有资产表里面 BeanUtil.copyProperties(items, as); @@ -715,6 +725,11 @@ public class AssetCurrentController extends BaseController { assetSupplyChainService.deleteIdList(a1); assetBasicNetworkService.deleteIdList(a1); } else { + List list = unitService.lambdaQuery().eq(Unit::getNickName, items.getDwmc()) + .eq(Unit::getDelFlag, 0).list(); + if (list == null || list.isEmpty()) { + throw new ServiceException(j + "行单位未入库!"); + } assetCurrentService.save(as); } 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 d32f802..7d27011 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 @@ -150,9 +150,10 @@ public class AssetEmailController extends BaseController { //如果有任务也修改任务这边 AssetEmailJyPo one = assetEmailJyService.lambdaQuery() .isNotNull(AssetEmailJyPo::getTaskId) - .eq(AssetEmailJyPo::getStatus,"1") + .ne(AssetEmailJyPo::getStatus, 5) .eq(AssetEmailJyPo::getAssetId, byId.getAssetId()).one(); if(one!=null){ + Integer status = one.getStatus(); Integer taskId = one.getTaskId(); Long appId = one.getEmailId(); BeanUtil.copyProperties(byId, one); @@ -160,6 +161,7 @@ public class AssetEmailController extends BaseController { one.setTaskId(taskId); one.setAuditState(null); one.setAuditYy(null); + one.setStatus(status); assetEmailJyService.updateById(one); } } 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 fb5bbd6..f16fbc2 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 @@ -13,6 +13,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.tc.entity.AssetEmail; import com.ruoyi.tc.entity.AssetMiniPrograms; 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; @@ -152,16 +153,18 @@ public class AssetMiniProgramsController extends BaseController { //如果有任务也修改任务这边 AssetMiniProgramsJyPo one = assetMiniProgramsJyService.lambdaQuery() .isNotNull(AssetMiniProgramsJyPo::getTaskId) - .eq(AssetMiniProgramsJyPo::getStatus,"1") + .ne(AssetMiniProgramsJyPo::getStatus, 5) .eq(AssetMiniProgramsJyPo::getAssetId, byId.getAssetId()).one(); if(one!=null){ Integer taskId = one.getTaskId(); Long appId = one.getMiniId(); + Integer status = one.getStatus(); BeanUtil.copyProperties(byId, one); one.setMiniId(appId); one.setTaskId(taskId); one.setAuditState(null); one.setAuditYy(null); + one.setStatus(status); assetMiniProgramsJyService.updateById(one); } } 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 86a2119..8546ab1 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 @@ -166,9 +166,10 @@ public class AssetOfficialAccountController { //如果有任务也修改任务这边 AssetOfficialAccountJyPo one = assetOfficialAccountJyService.lambdaQuery() .isNotNull(AssetOfficialAccountJyPo::getTaskId) - .eq(AssetOfficialAccountJyPo::getStatus,"1") + .ne(AssetOfficialAccountJyPo::getStatus, 5) .eq(AssetOfficialAccountJyPo::getAssetId, byId.getAssetId()).one(); if(one!=null){ + Integer status = one.getStatus(); Integer taskId = one.getTaskId(); Long appId = one.getAccountId(); BeanUtil.copyProperties(byId, one); @@ -176,6 +177,7 @@ public class AssetOfficialAccountController { one.setTaskId(taskId); one.setAuditState(null); one.setAuditYy(null); + one.setStatus(status); assetOfficialAccountJyService.updateById(one); } } 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 f46ab1b..b4be1c2 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 @@ -4,7 +4,9 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.tc.entity.AssetApp; +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.AssetEmailCpPo; @@ -87,6 +89,11 @@ 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(); + if(list==null || list.isEmpty()){ + throw new ServiceException("请选择已有单位!"); + } save(assetApp); AssetAppCpPo a = new AssetAppCpPo(); BeanUtil.copyProperties(assetApp, a); @@ -111,14 +118,18 @@ public class AssetAppServiceImpl extends ServiceImpl i updateById(assetApp); AssetAppCpPo one = assetAppCpService.lambdaQuery() .eq(AssetAppCpPo::getAssetId, assetApp.getId()) - .eq(AssetAppCpPo::getStatus,"1") + .ne(AssetAppCpPo::getStatus, 5) .isNotNull(AssetAppCpPo::getTaskId) .one(); if (one != null) { + Integer status = one.getStatus(); + Integer taskId = one.getTaskId(); + Long appId = one.getAppId(); BeanUtil.copyProperties(assetApp, one); - one.setTaskId(unitService.selectTaskId(assetApp.getSsdw(), "4")); + one.setStatus(status); + one.setTaskId(taskId); one.setAssetId(assetApp.getId()); - one.setStatus(0); + one.setAppId(appId); return assetAppCpService.updateById(one); }else { return true; 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 ac12acb..f2205c4 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 @@ -4,7 +4,9 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.tc.entity.AssetEmail; +import com.ruoyi.tc.entity.Unit; import com.ruoyi.tc.entity.po.AssetEmailCpPo; import com.ruoyi.tc.entity.po.AssetEmailJyPo; import com.ruoyi.tc.entity.po.AssetMiniProgramsCpPo; @@ -87,6 +89,11 @@ 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("请选择已有单位!"); + } save(assetEmail); AssetEmailCpPo a = new AssetEmailCpPo(); BeanUtil.copyProperties(assetEmail, a); @@ -110,13 +117,17 @@ public class AssetEmailServiceImpl extends ServiceImpl list = unitService.lambdaQuery().eq(Unit::getNickName, assetMiniPrograms.getSsdw()) + .eq(Unit::getDelFlag, 0).list(); + if(list==null || list.isEmpty()){ + throw new ServiceException("请选择已有单位!"); + } save(assetMiniPrograms); AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo(); BeanUtil.copyProperties(assetMiniPrograms,assetMiniProgramsCpPo); @@ -102,13 +110,17 @@ public class AssetMiniProgramsServiceImpl extends ServiceImpl list = unitService.lambdaQuery().eq(Unit::getNickName, assetOfficialAccount.getSsdw()) + .eq(Unit::getDelFlag, 0).list(); + if(list==null || list.isEmpty()){ + throw new ServiceException("请选择已有单位!"); + } save(assetOfficialAccount); AssetOfficialAccountCpPo a = new AssetOfficialAccountCpPo(); BeanUtil.copyProperties(assetOfficialAccount, a); @@ -106,14 +114,18 @@ public class AssetOfficialAccountServiceImpl extends ServiceImpl