From f6d400943176b85b01ced0b1e1623f81a77c2b8e Mon Sep 17 00:00:00 2001 From: wu Date: Tue, 7 Jan 2025 11:34:05 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=E4=BF=AE=E6=94=B9=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E6=8E=92=E9=99=A4=E5=85=B3=E5=81=9C=E4=BB=BB=E5=8A=A1=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=81=9A=E9=9D=9E=E7=A9=BA=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tc/controller/AssetCurrentController.java | 149 +++++++++++------- 1 file changed, 94 insertions(+), 55 deletions(-) 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 c4a9ca1..bce673a 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 @@ -9,18 +9,57 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.tc.entity.*; -import com.ruoyi.tc.entity.po.*; +import com.ruoyi.tc.entity.AssetBasicNetwork; +import com.ruoyi.tc.entity.AssetBusinessForm; +import com.ruoyi.tc.entity.AssetCurrent; +import com.ruoyi.tc.entity.AssetExport; +import com.ruoyi.tc.entity.AssetSupplyChain; +import com.ruoyi.tc.entity.Unit; +import com.ruoyi.tc.entity.UnitOtherConcat; +import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo; +import com.ruoyi.tc.entity.po.AssetBasicNetworkJyPo; +import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo; +import com.ruoyi.tc.entity.po.AssetBusinessFormJyPo; +import com.ruoyi.tc.entity.po.AssetCurrentCpPo; +import com.ruoyi.tc.entity.po.AssetCurrentJyPo; +import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; +import com.ruoyi.tc.entity.po.AssetSupplyChainJyPo; +import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo; +import com.ruoyi.tc.entity.po.UnitOtherConcatJyPo; import com.ruoyi.tc.entity.request.Acomma; import com.ruoyi.tc.entity.request.AssetAuditPageRequest; import com.ruoyi.tc.entity.request.AssetAuditRequest; import com.ruoyi.tc.entity.request.AssetCurrentPageRequest; -import com.ruoyi.tc.service.*; +import com.ruoyi.tc.service.AssetBasicNetworkCpService; +import com.ruoyi.tc.service.AssetBasicNetworkJyService; +import com.ruoyi.tc.service.AssetBasicNetworkService; +import com.ruoyi.tc.service.AssetBusinessFormCpService; +import com.ruoyi.tc.service.AssetBusinessFormJyService; +import com.ruoyi.tc.service.AssetBusinessFormService; +import com.ruoyi.tc.service.AssetCurrentCpService; +import com.ruoyi.tc.service.AssetCurrentJyService; +import com.ruoyi.tc.service.AssetCurrentService; +import com.ruoyi.tc.service.AssetSupplyChainCpService; +import com.ruoyi.tc.service.AssetSupplyChainJyService; +import com.ruoyi.tc.service.AssetSupplyChainService; +import com.ruoyi.tc.service.AssetTaskService; +import com.ruoyi.tc.service.UnitOtherConcatCpService; +import com.ruoyi.tc.service.UnitOtherConcatJyservice; +import com.ruoyi.tc.service.UnitOtherConcatService; +import com.ruoyi.tc.service.UnitService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -573,61 +612,61 @@ public class AssetCurrentController extends BaseController { queryWrapper1.eq("task_id", i); queryWrapper1.ne("status", 5); AssetCurrentCpPo x = assetCurrentCpService.getOne(queryWrapper1); + if (BeanUtil.isEmpty(x)) { + Integer status = x.getStatus(); + Long currentId = x.getCurrentId(); + AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); + BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); + assetCurrentCpPo.setTaskId(i); + assetCurrentCpPo.setCurrentId(currentId); + assetCurrentCpPo.setStatus(status); + assetCurrentCpService.updateById(assetCurrentCpPo); + QueryWrapper queryWrapper2 = new QueryWrapper<>(); + queryWrapper2.eq("asset_id", assetCurrent.getId()); + queryWrapper2.eq("task_id", i); + assetSupplyChainCpService.remove(queryWrapper2); + QueryWrapper queryWrapper3 = new QueryWrapper<>(); + 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("asset_id", assetCurrent.getId()); + assetBusinessFormCpService.remove(queryWrapper4); + QueryWrapper queryWrapper5 = new QueryWrapper<>(); + queryWrapper5.eq("asset_id", assetCurrent.getId()); + queryWrapper5.eq("task_id", i); + unitOtherConcatCpService.remove(queryWrapper5); - Integer status = x.getStatus(); - Long currentId = x.getCurrentId(); - AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); - BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); - assetCurrentCpPo.setTaskId(i); - assetCurrentCpPo.setCurrentId(currentId); - assetCurrentCpPo.setStatus(status); - assetCurrentCpService.updateById(assetCurrentCpPo); - - QueryWrapper queryWrapper2 = new QueryWrapper<>(); - queryWrapper2.eq("asset_id", assetCurrent.getId()); - queryWrapper2.eq("task_id", i); - assetSupplyChainCpService.remove(queryWrapper2); - QueryWrapper queryWrapper3 = new QueryWrapper<>(); - 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("asset_id", assetCurrent.getId()); - assetBusinessFormCpService.remove(queryWrapper4); - QueryWrapper queryWrapper5 = new QueryWrapper<>(); - queryWrapper5.eq("asset_id", assetCurrent.getId()); - queryWrapper5.eq("task_id", i); - unitOtherConcatCpService.remove(queryWrapper5); - - if (assetCurrent.getXjgywxt() != null) { - assetCurrentCpPo.getXjgywxt().setAssetId(assetCurrent.getId()); - assetCurrentCpPo.getXjgywxt().setTaskId(i); - assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt()); - } - if (assetCurrent.getGylxxList() != null) { - for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) { - items.setAssetId(assetCurrent.getId()); - items.setTaskId(i); + if (assetCurrent.getXjgywxt() != null) { + assetCurrentCpPo.getXjgywxt().setAssetId(assetCurrent.getId()); + assetCurrentCpPo.getXjgywxt().setTaskId(i); + assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt()); } - //新增供应链 - assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList()); - } - if (assetCurrent.getJcwlList() != null) { - for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) { - items.setAssetId(assetCurrent.getId()); - items.setTaskId(i); + if (assetCurrent.getGylxxList() != null) { + for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) { + items.setAssetId(assetCurrent.getId()); + items.setTaskId(i); + } + //新增供应链 + assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList()); } - //新增基础网络 - assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList()); - } - if (assetCurrent.getOtherConcat() != null) { - for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) { - items.setAssetId(assetCurrent.getId()); - items.setTaskId(i); + if (assetCurrent.getJcwlList() != null) { + for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) { + items.setAssetId(assetCurrent.getId()); + items.setTaskId(i); + } + //新增基础网络 + assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList()); + } + if (assetCurrent.getOtherConcat() != null) { + for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) { + items.setAssetId(assetCurrent.getId()); + items.setTaskId(i); + } + //新增其他联系人 + unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat()); } - //新增其他联系人 - unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat()); } } return success();