From 81185d938e6a75fbcf303a90f89d06af0b824693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 20 Mar 2022 17:26:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8A=82=E7=82=B9=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=81=E6=A0=87=E7=AD=BE=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xm/core/ctrl/XmIterationController.java | 4 +--- .../com/xm/core/service/XmIterationService.java | 14 ++++++++++++++ .../java/com/xm/core/service/XmProductService.java | 6 +++--- .../java/com/xm/core/service/XmProjectService.java | 6 +++--- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java index f38cac4e..41d8f303 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java @@ -163,14 +163,12 @@ public class XmIterationController { Map m = new HashMap<>(); Tips tips=new Tips("成功新增一条数据"); try{ - if(StringUtils.isEmpty(xmIteration.getId())) { - xmIteration.setId(xmIterationService.createKey("id")); - } XmIteration q=new XmIteration(); User user= LoginUtils.getCurrentUserInfo(); q.setBranchId(user.getBranchId()); Long count=this.xmIterationService.countByWhere(q); + xmIteration.setId(this.xmIterationService.createIterationId(count)); xmIteration.setSeqNo(Long.toString(count+1)); xmIteration.setCtime(new Date()); xmIteration.setCuserid(user.getUserid()); diff --git a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java index 44f80d73..deea3ed4 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java @@ -4,6 +4,7 @@ import com.mdp.core.entity.Tips; import com.mdp.core.service.BaseService; import com.mdp.safe.client.entity.User; import com.xm.core.entity.XmIteration; +import com.xm.core.entity.XmProduct; import com.xm.core.entity.XmProject; import com.xm.core.vo.XmIterationVo; import org.springframework.beans.factory.annotation.Autowired; @@ -51,5 +52,18 @@ public class XmIterationService extends BaseService { this.xmIterationLinkService.batchInsert(xmIteration.getLinks()); } + + public String createIterationId( Long count){ + String seq=(count%10000+1)+""; + int preLength=4-seq.length(); + if(preLength>0){ + for (int i = 0; i < preLength; i++) { + seq="0"+seq; + } + } + String code=sequenceService.getCommonNo("IT{date:yyyy}-"+seq+"-{rands:4}"); + return code; + + } } diff --git a/xm-core/src/main/java/com/xm/core/service/XmProductService.java b/xm-core/src/main/java/com/xm/core/service/XmProductService.java index 40801fd2..5968824d 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmProductService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmProductService.java @@ -258,15 +258,15 @@ public class XmProductService extends BaseService { XmProduct product=new XmProduct(); product.setBranchId(branchId); long count=this.countByWhere(product); - String seq=(count+1)+""; - int preLength=6-seq.length(); + String seq=(count%10000+1)+""; + int preLength=4-seq.length(); if(preLength>0){ for (int i = 0; i < preLength; i++) { seq="0"+seq; } } - String code=sequenceService.getCommonNo("pro-{date:yyyyMMdd}-"+seq+"-{rand:2}"); + String code=sequenceService.getCommonNo("PD{date:yyyy}-"+seq+"-{rands:2}"); return code; } diff --git a/xm-core/src/main/java/com/xm/core/service/XmProjectService.java b/xm-core/src/main/java/com/xm/core/service/XmProjectService.java index a528dee6..da295768 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmProjectService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmProjectService.java @@ -296,15 +296,15 @@ public class XmProjectService extends BaseService { XmProject projectQ=new XmProject(); projectQ.setBranchId(branchId); long count=this.countByWhere(projectQ); - String seq=(count+1)+""; - int preLength=6-seq.length(); + String seq=(count%10000+1)+""; + int preLength=4-seq.length(); if(preLength>0){ for (int i = 0; i < preLength; i++) { seq="0"+seq; } } - String code=sequenceService.getCommonNo("prj-{date:yyyyMMdd}-"+seq+"-{rand:2}"); + String code=sequenceService.getCommonNo("PJ{date:yyyy}-"+seq+"-{rands:2}"); return code; }