From f36cdd51d14e396faa5f99dab633a48d74f4586d Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Fri, 22 Nov 2024 14:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97=E7=BC=96?= =?UTF-8?q?=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tc/controller/AssetLcController.java | 12 +- .../tc/controller/AssetTaskController.java | 20 +-- .../java/com/ruoyi/tc/entity/AssetTask.java | 6 +- .../entity/request/AssetTaskPageRequest.java | 6 + .../response/AssetTaskStatusResponse.java | 35 +++++ .../tc/entity/response/AssetdwHcResponse.java | 7 + .../tc/mapper/AssetBasicNetWorkCpMapper.java | 11 ++ .../tc/mapper/AssetBusinessFormCpMapper.java | 12 ++ .../ruoyi/tc/mapper/AssetCurrentCpMapper.java | 16 ++ .../com/ruoyi/tc/mapper/AssetLcMapper.java | 4 +- .../tc/mapper/AssetSupplyChainCpMapper.java | 13 ++ .../com/ruoyi/tc/mapper/AssetTaskMapper.java | 26 +++- .../tc/mapper/UnitOtherConcatCpMapper.java | 11 ++ .../service/AssetBasicNetworkCpService.java | 10 ++ .../service/AssetBusinessFormCpService.java | 11 ++ .../tc/service/AssetCurrentCpService.java | 11 ++ .../com/ruoyi/tc/service/AssetLcService.java | 4 +- .../tc/service/AssetSupplyChainCpService.java | 10 ++ .../tc/service/UnitOtherConcatCpService.java | 11 ++ .../impl/AssetBasicNetworkCpServiceImpl.java | 5 + .../impl/AssetBusinessFormCpServiceImpl.java | 5 + .../impl/AssetCurrentCpServiceImpl.java | 6 + .../tc/service/impl/AssetLcServiceImpl.java | 12 +- .../impl/AssetSupplyChainCpServiceImpl.java | 6 + .../tc/service/impl/AssetTaskServiceImpl.java | 143 +++++++++++++++++- .../impl/UnitOtherConcatCpServiceImpl.java | 5 + .../src/main/resources/application-test.yml | 61 ++++++++ .../src/main/resources/application.yml | 2 +- .../src/main/resources/mapper/AssetLcDao.xml | 14 +- .../main/resources/mapper/AssetTaskDao.xml | 67 ++++++-- .../framework/config/SecurityConfig.java | 2 +- 31 files changed, 497 insertions(+), 67 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetTaskStatusResponse.java create mode 100644 ruoyi-admin/src/main/resources/application-test.yml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetLcController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetLcController.java index 001dde3..b0ce790 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetLcController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetLcController.java @@ -1,6 +1,5 @@ package com.ruoyi.tc.controller; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.tc.entity.AssetLc; @@ -19,7 +18,7 @@ import javax.validation.Valid; * @author makejava * @since 2024-11-18 14:46:40 */ -@Api("任务流程") +@Api(tags = "任务流程") @RestController @RequestMapping("/unit/assetLc") public class AssetLcController extends BaseController { @@ -30,16 +29,15 @@ public class AssetLcController extends BaseController { private AssetLcService assetLcService; /** - * 分页查询 + * 查询 * - * @param assetLc 筛选条件 - * @param req 分页对象 + * @param req 对象 * @return 查询结果 */ @GetMapping("/page") @ApiOperation(value = "分页查询", response = AssetLc.class) - public AjaxResult queryByPage(Page assetLc, AssetLcRequest req) { - return AjaxResult.success(this.assetLcService.queryByPage(assetLc, req)); + public AjaxResult queryByPage(AssetLcRequest req) { + return AjaxResult.success(this.assetLcService.queryByPage(req)); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java index d002cbe..08f1f59 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java @@ -83,7 +83,6 @@ public class AssetTaskController extends BaseController { */ @ApiOperation(value = "分页查询", response = AssetTask.class) @GetMapping("/page") - public AjaxResult queryByPage(Page assetTask, AssetTaskPageRequest pageRequest) { return AjaxResult.success(this.assetTaskService.queryByPage(assetTask, pageRequest)); } @@ -267,10 +266,10 @@ public class AssetTaskController extends BaseController { assetLc.setTaskId(assetCurrent.getTaskId()); assetLc.setAssetName(assetCurrent.getXtmc()); //当审核状态为审核不通过 单位端重新提交 - if (assetCurrent.getStatus().equals(4)){ + if (assetCurrent.getStatus().equals(4)) { assetLc.setTaskId(assetCurrent.getTaskId()); assetLc.setXfTime(LocalDateTime.now()); - assetLc.setAssetName("单位重新核查提交时间"+assetCurrent.getXtmc()); + assetLc.setAssetName("单位重新核查提交时间" + assetCurrent.getXtmc()); assetLcService.insert(assetLc); } @@ -289,18 +288,16 @@ public class AssetTaskController extends BaseController { b.append(","); }); } - assetCurrent.setGlIp(b.toString()); assetCurrent.setStatus(1); //当审核状态为带待核查 - if(assetCurrent.getStatus().equals(1)){ + if (assetCurrent.getStatus().equals(1)) { assetLc.setXfTime(LocalDateTime.now()); assetLc.setTaskId(assetCurrent.getTaskId()); - assetLc.setAssetName("单位核查完成提交"+assetCurrent.getXtmc()); + assetLc.setAssetName("单位核查完成提交" + assetCurrent.getXtmc()); assetLcService.insert(assetLc); } assetCurrentJyService.save(assetCurrent); - //新增新监管业务形态 if (assetCurrent.getXjgywxt() != null) { assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId()); @@ -331,6 +328,7 @@ public class AssetTaskController extends BaseController { //新增其他联系人 unitOtherConcatJyservice.saveBatch(assetCurrent.getOtherConcat()); } + return success(); } @@ -348,20 +346,18 @@ public class AssetTaskController extends BaseController { } - /** * 管理端-单位核查情况 * * @param req 请求类 * @return */ - @ApiOperation(value = "管理端-单位核查情况",response =AssetdwHcResponse.class ) - @PostMapping("/dwHc") + @ApiOperation(value = "管理端-单位核查情况", response = AssetdwHcResponse.class) + @GetMapping("/dwHc") public AjaxResult dwHc(Page assetdwHcResponsePage, AssetdwHcRequest req) { - return AjaxResult.success(assetTaskService.dwHc(assetdwHcResponsePage,req)); + return AjaxResult.success(assetTaskService.dwHc(assetdwHcResponsePage, req)); } - } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetTask.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetTask.java index 01d9ce8..21593c8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetTask.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/AssetTask.java @@ -54,10 +54,10 @@ public class AssetTask implements Serializable { @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime taskFinishTime; /** - * 任务状态1:进行中,2:正常完成,3:超期完成,4:正常完成,5:审核驳回 + * 任务状态1:进行中,2:正常完成,3:超期完成, */ - @ApiModelProperty("任务状态1:进行中,2:正常完成,3:超期完成,4:正常完成,5:审核驳回") - private String taskStatus; + @ApiModelProperty("任务状态1:进行中,2:正常完成,3:超期完成,4:审核驳回") + private Integer taskStatus=1; /** * 单位名称 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetTaskPageRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetTaskPageRequest.java index b97e088..ea0dc47 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetTaskPageRequest.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/request/AssetTaskPageRequest.java @@ -16,6 +16,12 @@ import java.time.LocalDateTime; @ApiModel("任务主表分页请求类") public class AssetTaskPageRequest { + + /** + * 主键id + */ + @ApiModelProperty("主键id") + private Integer id; /** * 任务名称 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetTaskStatusResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetTaskStatusResponse.java new file mode 100644 index 0000000..1c7cf5e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetTaskStatusResponse.java @@ -0,0 +1,35 @@ +package com.ruoyi.tc.entity.response; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +/** + * @author dong + * @since 2024/11/22 9:35 + */ +@Data +@ApiModel("资产表状态时间详情类") +public class AssetTaskStatusResponse { + + + /** + * 审核状态 + */ + + @ApiModelProperty("审核状态(0待核查,1待审批,3审核通过,4审核不通过,5已报废)") + private Integer status; + + + /** + * 超期状态 + */ + + @ApiModelProperty("6已超期;7未超期") + private Integer deadstatus; + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java index e9b105f..22d0f91 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java @@ -36,6 +36,13 @@ public class AssetdwHcResponse { private Integer checked; + /** + * 完成数量 + */ + @ApiModelProperty("完成数量") + private Integer notChecked; + + /** * 百分比 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBasicNetWorkCpMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBasicNetWorkCpMapper.java index 58ff333..d52cf3f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBasicNetWorkCpMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBasicNetWorkCpMapper.java @@ -36,4 +36,15 @@ public interface AssetBasicNetWorkCpMapper extends BaseMapper findByTaskId(int taskId); + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBusinessFormCpMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBusinessFormCpMapper.java index 4b74c5c..3b2b96e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBusinessFormCpMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetBusinessFormCpMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo; +import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -36,5 +37,16 @@ public interface AssetBusinessFormCpMapper extends BaseMapper findByTaskId(int taskId); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetCurrentCpMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetCurrentCpMapper.java index 490bcf4..e57daca 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetCurrentCpMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetCurrentCpMapper.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** * 现有资产复制表(AssetCurrentResponse)表数据库访问层 @@ -19,5 +22,18 @@ public interface AssetCurrentCpMapper extends BaseMapper { */ @Delete("delete from asset_current_cp where id=#{assetId} and task_id =#{taskId} ") void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId); + + + + + + /** + * 根据taskid查询查询数据 + * + * @param taskId 任务id + * @return + */ + @Select("select * from asset_current_cp where task_id=#{taskId}") + List findByTaskId(int taskId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetLcMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetLcMapper.java index cdd49eb..05bb6e8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetLcMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetLcMapper.java @@ -19,11 +19,11 @@ public interface AssetLcMapper { /** * 页条件查询 * - * @param page 分页条件 + * @param pageRequest 查询条件 * @return 填报任务 */ - Page queryByPage(Page page, @Param("req") AssetLcRequest pageRequest); + List queryByPage( @Param("req") AssetLcRequest pageRequest); /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetSupplyChainCpMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetSupplyChainCpMapper.java index 73ab9f5..a600789 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetSupplyChainCpMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/AssetSupplyChainCpMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.tc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo; import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; @@ -35,5 +36,17 @@ public interface AssetSupplyChainCpMapper extends BaseMapper findByTaskId(int taskId); } 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 d836b23..4033d34 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 @@ -3,17 +3,19 @@ package com.ruoyi.tc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.tc.entity.AssetTask; +import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import com.ruoyi.tc.entity.request.AssestTaskXqRequest; import com.ruoyi.tc.entity.request.AssetCurrentShRequest; import com.ruoyi.tc.entity.request.AssetTaskPageRequest; import com.ruoyi.tc.entity.request.AssetdwHcRequest; import com.ruoyi.tc.entity.response.AssestTaskXqresponse; -import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import com.ruoyi.tc.entity.response.AssetTaskResponse; +import com.ruoyi.tc.entity.response.AssetTaskStatusResponse; import com.ruoyi.tc.entity.response.AssetdwHcResponse; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; +import java.time.LocalDateTime; import java.util.List; /** @@ -139,13 +141,31 @@ public interface AssetTaskMapper extends BaseMapper { int sh(@Param("req") AssetCurrentShRequest req); - - /** * 管理端-单位核查情况 * * @return */ Page dwHc(Page assetdwHcResponsePage, @Param("req") AssetdwHcRequest req); + + + /** + * 查询当前任务下的所有资产状态和完成时间 + * + * @param taskId 任务id + * @return + */ + List findByTaskId(Integer taskId); + + /** + * 修改主表任务状态 + * + * @param taskStatus 任务状态 + * @param taskId 任务id + * @return + */ + + int updateByTaskId(@Param("taskStatus") Integer taskStatus, @Param("taskId") Integer taskId,@Param("finishTime") LocalDateTime finishTime ); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/UnitOtherConcatCpMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/UnitOtherConcatCpMapper.java index 21d9749..56382dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/UnitOtherConcatCpMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/mapper/UnitOtherConcatCpMapper.java @@ -34,4 +34,15 @@ public interface UnitOtherConcatCpMapper extends BaseMapper */ @Delete("delete from unit_other_contact_cp where asset_id=#{assetId} and task_id =#{taskId} ") void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId")int taskId); + + + + /** + * 根据taskid查询查询数据 + * + * @param taskId 任务id + * @return + */ + @Select("select * from unit_other_contact_cp where task_id=#{taskId}") + List findByTaskId(int taskId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBasicNetworkCpService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBasicNetworkCpService.java index e0f0102..44f952a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBasicNetworkCpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBasicNetworkCpService.java @@ -2,6 +2,7 @@ package com.ruoyi.tc.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo; +import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo; import java.util.List; @@ -30,4 +31,13 @@ public interface AssetBasicNetworkCpService extends IService findByTaskId(int taskId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBusinessFormCpService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBusinessFormCpService.java index de3469f..1ea96bf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBusinessFormCpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetBusinessFormCpService.java @@ -2,6 +2,7 @@ package com.ruoyi.tc.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo; +import com.ruoyi.tc.entity.po.AssetCurrentCpPo; import java.util.List; @@ -30,5 +31,15 @@ public interface AssetBusinessFormCpService extends IService findByTaskId(int taskId); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetCurrentCpService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetCurrentCpService.java index 6c632fc..04fa751 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetCurrentCpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetCurrentCpService.java @@ -3,6 +3,8 @@ package com.ruoyi.tc.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.tc.entity.po.AssetCurrentCpPo; +import java.util.List; + /** * 现有资产复制表(AssetCurrentResponse)表服务接口 * @@ -19,5 +21,14 @@ public interface AssetCurrentCpService extends IService { */ void deletByAssetIdandTaskId(Long assetId, int taskId); + + /** + * 根据taskid查询查询数据 + * + * @param taskId 任务id + * @return + */ + List findByTaskId(int taskId); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetLcService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetLcService.java index ddf5e2e..5da1e69 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetLcService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetLcService.java @@ -3,7 +3,9 @@ package com.ruoyi.tc.service; import com.ruoyi.tc.entity.AssetLc; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.tc.entity.request.AssetLcRequest; +import com.ruoyi.tc.entity.response.AssetTaskStatusResponse; +import java.util.List; /** * 任务流程(AssetLc)表服务接口 * @@ -27,7 +29,7 @@ public interface AssetLcService { * @param pageRequest 分页对象 * @return 查询结果 */ - Page queryByPage(PageassetLc, AssetLcRequest pageRequest); + List queryByPage( AssetLcRequest pageRequest); /** * 新增数据 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetSupplyChainCpService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetSupplyChainCpService.java index 2cd34a2..1aa8cab 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetSupplyChainCpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/AssetSupplyChainCpService.java @@ -1,6 +1,7 @@ package com.ruoyi.tc.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo; import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; import java.util.List; @@ -22,6 +23,15 @@ public interface AssetSupplyChainCpService extends IService findByassetId(Long assetId); + /** + * 根据taskid查询查询数据 + * + * @param taskId 任务id + * @return + */ + List findByTaskId(int taskId); + + /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/UnitOtherConcatCpService.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/UnitOtherConcatCpService.java index 8a95ae6..267b52f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/UnitOtherConcatCpService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/UnitOtherConcatCpService.java @@ -1,6 +1,7 @@ package com.ruoyi.tc.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo; import com.ruoyi.tc.entity.po.UnitOtherConcatJyPo; @@ -29,4 +30,14 @@ public interface UnitOtherConcatCpService extends IService * @param taskId 任务id */ void deletByAssetIdandTaskId(Long assetId, int taskId); + + + + /** + * 根据taskid查询查询数据 + * + * @param taskId 任务id + * @return + */ + List findByTaskId(int taskId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBasicNetworkCpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBasicNetworkCpServiceImpl.java index ee706f2..58ca5fd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBasicNetworkCpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBasicNetworkCpServiceImpl.java @@ -31,5 +31,10 @@ public class AssetBasicNetworkCpServiceImpl extends ServiceImpl findByTaskId(int taskId) { + return assetBasicNetWorkCpMapper.findByTaskId(taskId); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBusinessFormCpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBusinessFormCpServiceImpl.java index b3a8b31..5194e7d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBusinessFormCpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetBusinessFormCpServiceImpl.java @@ -30,5 +30,10 @@ public class AssetBusinessFormCpServiceImpl extends ServiceImpl findByTaskId(int taskId) { + return assetBusinessFormCpMapper.findByTaskId(taskId); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetCurrentCpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetCurrentCpServiceImpl.java index f25a3f1..89a7074 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetCurrentCpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetCurrentCpServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.tc.service.*; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; /** * 现有资产复制表(AssetCurrentResponse)表服务实现类 @@ -23,5 +24,10 @@ public class AssetCurrentCpServiceImpl extends ServiceImpl findByTaskId(int taskId) { + return assetCurrentCpMapper.findByTaskId(taskId); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetLcServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetLcServiceImpl.java index e5a22e6..20c033b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetLcServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetLcServiceImpl.java @@ -8,7 +8,7 @@ import com.ruoyi.tc.service.AssetLcService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import javax.annotation.Resource; - +import java.util.List; /** * 任务流程(AssetLc)表服务实现类 * @@ -34,15 +34,15 @@ public class AssetLcServiceImpl implements AssetLcService { } /** - * 分页查询 + * 查询 * - * @param assetLc 筛选条件 - * @param pageRequest 分页对象 + * @param + * @param pageRequest 对象 * @return 查询结果 */ @Override - public Page queryByPage(Page assetLc, AssetLcRequest pageRequest) { - return assetLcDao.queryByPage(assetLc, pageRequest); + public List queryByPage( AssetLcRequest pageRequest) { + return assetLcDao.queryByPage( pageRequest); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetSupplyChainCpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetSupplyChainCpServiceImpl.java index 9180bd3..f25c99f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetSupplyChainCpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetSupplyChainCpServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.tc.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo; import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo; import com.ruoyi.tc.mapper.AssetSupplyChainCpMapper; import com.ruoyi.tc.service.AssetSupplyChainCpService; @@ -25,6 +26,11 @@ public class AssetSupplyChainCpServiceImpl extends ServiceImpl findByTaskId(int taskId) { + return assetSupplyChainCpMapper.findByTaskId(taskId); + } + @Override public void deletByAssetIdandTaskId(Long assetId, int taskId) { assetSupplyChainCpMapper.deletByAssetIdandTaskId(assetId,taskId); 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 17fc814..5dd04cf 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 @@ -2,12 +2,13 @@ package com.ruoyi.tc.service.impl; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.ruoyi.tc.entity.AssetLc; -import com.ruoyi.tc.entity.AssetTask; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.tc.entity.*; import com.ruoyi.tc.entity.po.*; import com.ruoyi.tc.entity.request.*; import com.ruoyi.tc.entity.response.AssestTaskXqresponse; import com.ruoyi.tc.entity.response.AssetTaskResponse; +import com.ruoyi.tc.entity.response.AssetTaskStatusResponse; import com.ruoyi.tc.entity.response.AssetdwHcResponse; import com.ruoyi.tc.mapper.AssetTaskMapper; import com.ruoyi.tc.service.*; @@ -18,6 +19,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * 任务主表(AssetTask)表服务实现类 @@ -50,6 +52,22 @@ public class AssetTaskServiceImpl extends ServiceImpl list = assetTaskDao.findByTaskId(req.getTaskId()); + // 检查状态 + boolean hasPendingApproval = list.stream().anyMatch(item -> item.getStatus() == 0 || item.getStatus() == 1); + boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3); + boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6); + boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4); + LocalDateTime finishTime = null; + if (hasPendingApproval) { + // 资产状态存在待审批,任务状态为进行中 + taskStatus = 1; + } else if (allApproved && !hasPendingApproval && !hasRejected && !hasExpired) { + // 资产状态全部为已通过中并且全部资产完成时间在任务期限之前 + taskStatus = 2; + finishTime = LocalDateTime.now(); + taskSaveOrDelete(req); + } else if (allApproved && !hasPendingApproval && !hasRejected && hasExpired) { + // 资产状态全部为已通过,资产完成时间有超期的为超期完成 + taskStatus = 3; + finishTime = LocalDateTime.now(); + taskSaveOrDelete(req); + } else if (hasRejected) { + // 审核不通过 + taskStatus = 4; + } + //修改主表任务状态 + assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime); + return a; + } - return assetTaskDao.sh(req); + private void taskSaveOrDelete(AssetCurrentShRequest req) { + // 根据taskid查询五张数据 + List currentList = assetCurrentCpService.findByTaskId(req.getTaskId()); + List idList = currentList.stream() + .map(AssetCurrentCpPo::getId) + .collect(Collectors.toList()); + //删除原有数据 + assetCurrentService.removeBatchByIds(idList); + //将子表数据复制到主表中 + List currentNewList = currentList.stream() + .map(cpPo -> { + AssetCurrent current = new AssetCurrent(); + BeanUtils.copyProperties(cpPo, current); // 复制属性 + return current; // 返回新对象 + }) + .collect(Collectors.toList()); // 收集到列表中 + assetCurrentService.saveBatch(currentNewList); + //AssetBusinessFormCpPo + List bussinessList = assetBusinessFormCpService.findByTaskId(req.getTaskId()); + List bussinessidList = bussinessList.stream() + .map(AssetBusinessFormCpPo::getAssetId) + .collect(Collectors.toList()); + //删除原有数据 + assetBusinessFormService.removeBatchByIds(bussinessidList); + //将子表数据复制到主表中 + List bussinessNewList = bussinessList.stream() + .map(cpPo -> { + AssetBusinessForm businessForm = new AssetBusinessForm(); + BeanUtils.copyProperties(cpPo, businessForm); // 复制属性 + return businessForm; // 返回新对象 + }) + .collect(Collectors.toList()); // 收集到列表中 + assetBusinessFormService.saveBatch(bussinessNewList); + //AssetBasicNetworkCpPo + List netWorkList = assetBasicNetworkCpService.findByTaskId(req.getTaskId()); + List netWorkidList = netWorkList.stream() + .map(AssetBasicNetworkCpPo::getAssetId) + .collect(Collectors.toList()); + //删除原有数据 + assetBasicNetworkService.removeBatchByIds(netWorkidList); + //将子表数据复制到主表中 + List netWorkNewList = netWorkList.stream() + .map(cpPo -> { + AssetBasicNetwork network = new AssetBasicNetwork(); + BeanUtils.copyProperties(cpPo, network); // 复制属性 + return network; // 返回新对象 + }) + .collect(Collectors.toList()); // 收集到列表中 + assetBasicNetworkService.saveBatch(netWorkNewList); + //AssetSupplyChainCpPo + List SupplyChainList = assetSupplyChainCpService.findByTaskId(req.getTaskId()); + List SupplyChainidList = SupplyChainList.stream() + .map(AssetSupplyChainCpPo::getAssetId) + .collect(Collectors.toList()); + //删除原有数据 + assetSupplyChainService.removeBatchByIds(SupplyChainidList); + List SupplyChainNewList = SupplyChainList.stream() + .map(cpPo -> { + AssetSupplyChain supplyChain = new AssetSupplyChain(); + BeanUtils.copyProperties(cpPo, supplyChain); // 复制属性 + return supplyChain; // 返回新对象 + }) + .collect(Collectors.toList()); + assetSupplyChainService.saveBatch(SupplyChainNewList); + //UnitOtherConcatCpPo + List UnitOtherConcatList = unitOtherConcatCpService.findByTaskId(req.getTaskId()); + List UnitOtherConcatidList = UnitOtherConcatList.stream() + .map(UnitOtherConcatCpPo::getAssetId) + .collect(Collectors.toList()); + //删除原有数据 + unitOtherConcatService.removeBatchByIds(UnitOtherConcatidList); + List UnitOtherConcatNewList = UnitOtherConcatList.stream() + .map(cpPo -> { + UnitOtherConcat unitOtherConcat = new UnitOtherConcat(); + BeanUtils.copyProperties(cpPo, unitOtherConcat); // 复制属性 + return unitOtherConcat; // 返回新对象 + }) + .collect(Collectors.toList()); + assetSupplyChainService.saveBatch(SupplyChainNewList); + unitOtherConcatService.saveBatch(UnitOtherConcatNewList); } @Override - public Page dwHc(Page assetdwHcResponsePage,AssetdwHcRequest req) { + public Page dwHc(Page assetdwHcResponsePage, AssetdwHcRequest req) { - return assetTaskDao.dwHc(assetdwHcResponsePage,req); + return assetTaskDao.dwHc(assetdwHcResponsePage, req); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/UnitOtherConcatCpServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/UnitOtherConcatCpServiceImpl.java index d8c8023..5f9ac2c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/UnitOtherConcatCpServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/UnitOtherConcatCpServiceImpl.java @@ -29,4 +29,9 @@ public class UnitOtherConcatCpServiceImpl extends ServiceImpl findByTaskId(int taskId) { + return unitOtherConcatCpMapper.findByTaskId(taskId); + } } diff --git a/ruoyi-admin/src/main/resources/application-test.yml b/ruoyi-admin/src/main/resources/application-test.yml new file mode 100644 index 0000000..eaedbfc --- /dev/null +++ b/ruoyi-admin/src/main/resources/application-test.yml @@ -0,0 +1,61 @@ +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + url: jdbc:mysql://localhost:3306/tc-asset-verification?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: adminadmin + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置连接超时时间 + connectTimeout: 30000 + # 配置网络超时时间 + socketTimeout: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 6aee222..e11d951 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -52,7 +52,7 @@ spring: # 国际化资源文件路径 basename: i18n/messages profiles: - active: druid + active: test # 文件上传 servlet: multipart: diff --git a/ruoyi-admin/src/main/resources/mapper/AssetLcDao.xml b/ruoyi-admin/src/main/resources/mapper/AssetLcDao.xml index a9a6037..7371308 100644 --- a/ruoyi-admin/src/main/resources/mapper/AssetLcDao.xml +++ b/ruoyi-admin/src/main/resources/mapper/AssetLcDao.xml @@ -166,18 +166,14 @@ diff --git a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml index 27000ed..0aad61c 100644 --- a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml +++ b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml @@ -186,6 +186,9 @@ and task_status = #{req.taskStatus} + + and id = #{req.id} + + + insert into asset_task(task_name, task_time, task_deadline, task_finish_time, task_status, dwmc, @@ -347,11 +369,26 @@ update asset_current_cp - + status = #{req.status}, + update_time=now() + + where id = #{req.assetId} and task_id = #{req.taskId} + + + update asset_task + + + task_status=#{taskStatus}, + + + task_finish_time=#{finishTime} + - where id = #{req.assetId} and task_id = #{req.taskId} + + where id =#{taskId} + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 9bb9e48..dad24b0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -115,7 +115,7 @@ public class SecurityConfig // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() - .antMatchers("/unit/assetTask/**","/tc/**").permitAll() + .antMatchers("/unit/assetTask/**","/tc/**","/unit/assetLc/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); })