From c6984906d6488e4257f32f2a8780dc0c55182c87 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Thu, 14 Nov 2024 10:02:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E4=B8=8A=E4=BC=A0=E5=BC=80?= =?UTF-8?q?=E5=B7=A5=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E4=B8=80=E5=B9=B3=E5=8F=B0=E6=88=AA=E5=9B=BE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UpdateProjectSystemReplaceInfoBatchNoUtil.java | 50 ++++++++++------------ .../api/projectdeclared/manage/PurchaseManage.java | 1 + .../projectdeclared/model/entity/Operation.java | 3 ++ .../model/req/TestValidInfoReq.java | 3 ++ .../api/projectdeclared/model/vo/OperationVO.java | 3 ++ 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/UpdateProjectSystemReplaceInfoBatchNoUtil.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/UpdateProjectSystemReplaceInfoBatchNoUtil.java index 077b2c9..0d634fc 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/UpdateProjectSystemReplaceInfoBatchNoUtil.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/UpdateProjectSystemReplaceInfoBatchNoUtil.java @@ -1,16 +1,13 @@ package com.hz.pm.api.common.util; -import cn.hutool.core.collection.CollUtil; import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelUtil; import com.hz.pm.api.projectlib.entity.ProjectGovSystemReplaceInfos; +import com.hz.pm.api.projectlib.model.enumeration.GovSystemReplaceTypeEnum; import com.ningdatech.basic.util.CollUtils; -import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; /** *

@@ -26,32 +23,29 @@ public class UpdateProjectSystemReplaceInfoBatchNoUtil { } public static void main(String[] args) { - ExcelReader reader = ExcelUtil.getReader("/Users/wendy/Desktop/response.xls"); + ExcelReader reader = ExcelUtil.getReader("/Users/wendy/Desktop/2024.xls"); List replaceInfos = reader.readAll(ProjectGovSystemReplaceInfos.class); - CollUtils.group(replaceInfos, ProjectGovSystemReplaceInfos::getProjectCode).forEach((k, v) -> { - v.sort(Comparator.comparing(ProjectGovSystemReplaceInfos::getBatchNo)); - Integer batchNo = CollUtil.getLast(v).getBatchNo(); - if (batchNo == 1 && v.size() > 1) { - Set targetSystsems = CollUtils.fieldSet(v, ProjectGovSystemReplaceInfos::getTargetSystem); - if (targetSystsems.size() > 1 && CollUtils.fieldSet(v, ProjectGovSystemReplaceInfos::getReplaceType).size() == 1) { - // System.out.println("项目编码:" + k); - // System.out.println(JSONUtil.toJsonStr(targetSystsems)); - Map> group = CollUtils.group(v, ProjectGovSystemReplaceInfos::getTargetSystem); - AtomicInteger newBatchNo = new AtomicInteger(0); - group.entrySet().stream().sorted(Comparator.comparing(w -> { - w.getValue().sort(Comparator.comparing(ProjectGovSystemReplaceInfos::getId)); - return w.getValue().get(0).getId(); - })).forEach(entry -> { - int currBatchNo = newBatchNo.incrementAndGet(); - for (ProjectGovSystemReplaceInfos infos : entry.getValue()) { - String sql = String.format("update ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS set batch_no = %d where id = %d;", currBatchNo, infos.getId()); - System.out.println(sql); - } - }); - } + Map> map = CollUtils.group(replaceInfos, w -> w.getId() == null); + List oldEntities = map.get(Boolean.FALSE); + for (ProjectGovSystemReplaceInfos entity : oldEntities) { + String updateSql = String.format("update ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS set source_system = '%s', target_system = '%s', batch_no = %d, replace_type = '%s' where id = %d;", entity.getSourceSystem(), entity.getTargetSystem(), entity.getBatchNo(), + GovSystemReplaceTypeEnum.getByVal(entity.getReplaceType()).get().getCode() + , entity.getId()); + System.out.println(updateSql); + } + List newEntities = map.get(Boolean.TRUE); + for (ProjectGovSystemReplaceInfos entity : newEntities) { + String insertSql = String.format("INSERT INTO ND_PROJECT_GOV_SYSTEM_REPLACE_INFOS (SOURCE_SYSTEM, TARGET_SYSTEM, REPLACE_TYPE, PROJECT_ID, BATCH_NO, CREATE_BY, CREATE_ON, PROJECT_CODE) \n" + + "VALUES('%s', '%s', '%d', %d, %d, 150, '2024-08-22 14:27:11.822', '%s');", + entity.getSourceSystem(), + entity.getTargetSystem(), + GovSystemReplaceTypeEnum.getByVal(entity.getReplaceType()).get().getCode(), + entity.getProjectId(), + entity.getBatchNo(), + entity.getProjectCode()); + System.out.println(insertSql); + } - } - }); } } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index 95020ec..021bfaf 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -1001,6 +1001,7 @@ public class PurchaseManage { newOperation.setProjectCode(project.getProjectCode()); return newOperation; }); + operation.setUnitOnePlatformImages(req.getUnitOnePlatformImages()); operation.setActualAdaptionTime(req.getActualTime()); operation.setAdaptionFiles(req.getFiles()); operation.setAdaptionRemark(req.getRemark()); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java index 9af4140..205a432 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/entity/Operation.java @@ -68,6 +68,9 @@ public class Operation { @ApiModelProperty("适配改造时间") private LocalDateTime adaptationTime; + @ApiModelProperty("单位一平台截图") + private String unitOnePlatformImages; + @ApiModelProperty("实际完成适配改造时间") private LocalDateTime actualAdaptionTime; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java index d023328..9d1358c 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/req/TestValidInfoReq.java @@ -29,4 +29,7 @@ public class TestValidInfoReq { @ApiModelProperty("附件") private String files; + @ApiModelProperty("单位一平台截图") + private String unitOnePlatformImages; + } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java index 74ab86f..d2bbaaa 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/model/vo/OperationVO.java @@ -66,6 +66,9 @@ public class OperationVO { @ApiModelProperty("测试验证时间") private LocalDateTime testValidTime; + @ApiModelProperty("单位一平台截图") + private String unitOnePlatformImages; + @ApiModelProperty("实际完成适配改造时间") private LocalDateTime actualAdaptionTime;