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; }