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 741604e..e37d4ac 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,6 +9,10 @@ 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.AssetBasicNetworkCpPo; +import com.ruoyi.tc.entity.po.AssetCurrentCpPo; +import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; +import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo; import com.ruoyi.tc.entity.request.AssetCurrentPageRequest; import com.ruoyi.tc.service.*; import io.swagger.annotations.Api; @@ -51,6 +55,30 @@ public class AssetCurrentController extends BaseController { @Resource private UnitOtherConcatService unitOtherConcatService; + @Resource + private AssetTaskService assetTaskService; + + @Resource + private AssetCurrentCpService assetCurrentCpService; + + @Resource + private AssetBusinessFormCpService assetBusinessFormCpService; + + @Resource + private AssetSupplyChainCpService assetSupplyChainCpService; + + + @Resource + private AssetBasicNetworkCpService assetBasicNetworkCpService; + + + @Resource + private UnitOtherConcatCpService unitOtherConcatCpService; + + + + + /** * 分页查询所有数据 * @@ -158,6 +186,51 @@ public class AssetCurrentController extends BaseController { //新增其他联系人 unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat()); } + // 单位有进行中的任务时,管理端新增该单位下的资产则需同步至当前进行中的任务中。 + //获取新增资产id + Long id = assetCurrent.getId(); + List assetTasks = assetTaskService.taskList(assetCurrent.getDwmc()); + if (assetTasks != null) { + for (AssetTask assetTask : assetTasks) { + //新增资产复制主表 + AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo(); + BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo); + assetCurrentCpPo.setTaskId(assetTask.getId()); + assetCurrentCpService.save(assetCurrentCpPo); + //新增新监管业务形态 + //根据资产id查询新监管业务形态主表id + if (assetCurrent.getXjgywxt() != null) { + assetCurrentCpPo.getXjgywxt().setAssetId(id); + assetCurrentCpPo.getXjgywxt().setTaskId(assetTask.getId()); + assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt()); + } + if (!assetCurrent.getGylxxList().isEmpty()) { + for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) { + items.setAssetId(id); + items.setTaskId(assetTask.getId()); + } + //新增供应链 + assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList()); + } + if (!assetCurrent.getJcwlList().isEmpty()) { + for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) { + items.setAssetId(assetCurrent.getId()); + items.setTaskId(assetTask.getId()); + } + //新增基础网络 + assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList()); + } + if (!assetCurrent.getOtherConcat().isEmpty()) { + for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) { + items.setAssetId(assetCurrent.getId()); + items.setTaskId(assetTask.getId()); + } + //新增其他联系人 + unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat()); + } + } + } + return success(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetTaskMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetTaskMapper.java index 4033d34..02825ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetTaskMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetTaskMapper.java @@ -165,7 +165,15 @@ public interface AssetTaskMapper extends BaseMapper { * @return */ - int updateByTaskId(@Param("taskStatus") Integer taskStatus, @Param("taskId") Integer taskId,@Param("finishTime") LocalDateTime finishTime ); + int updateByTaskId(@Param("taskStatus") Integer taskStatus, @Param("taskId") Integer taskId, @Param("finishTime") LocalDateTime finishTime); + + /** + * 根据单位名称查询是否有进行中的任务 + * + * @param dwmc 单位名称 + * @return + */ + List taskList(@Param("dwmc") String dwmc); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetTaskService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetTaskService.java index a46021d..12fcd51 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetTaskService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetTaskService.java @@ -12,6 +12,8 @@ import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import com.ruoyi.tc.entity.response.AssetTaskResponse; import com.ruoyi.tc.entity.response.AssetdwHcResponse; +import java.util.List; + /** * 任务主表(AssetTask)表服务接口 * @@ -95,5 +97,14 @@ public interface AssetTaskService extends IService { * * @return */ - Page dwHc(Page assetdwHcResponsePage,AssetdwHcRequest req); + Page dwHc(Page assetdwHcResponsePage, AssetdwHcRequest req); + + + /** + * 根据单位名称查询是否有进行中的任务 + * + * @param dwmc 单位名称 + * @return + */ + List taskList(String dwmc); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java index 9e7b137..8c23010 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java @@ -415,4 +415,9 @@ public class AssetTaskServiceImpl extends ServiceImpl taskList(String dwmc) { + return assetTaskDao.taskList(dwmc); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml index 1e58546..3b9fa6a 100644 --- a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml +++ b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml @@ -260,7 +260,7 @@ - and task_id =#{req.taskId} + and task_id =#{req.taskId} GROUP BY @@ -285,6 +285,15 @@ + @@ -389,7 +398,7 @@ where id = #{req.assetId} and task_id = #{req.taskId} - update asset_task + update asset_task task_status=#{taskStatus},