Browse Source

feat:修改随机值生成规则

master
郑贵龙 1 year ago
parent
commit
924c5c845b
2 changed files with 11 additions and 23 deletions
  1. +2
    -17
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java
  2. +9
    -6
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java

+ 2
- 17
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/production/ProductionCreateEAIService.java View File

@ -11,6 +11,7 @@ import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService;
import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService;
import com.digiwin.athena.opt.common.eai.EAIRequest;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.generator.SnowflakeWorker;
import com.digiwin.athena.opt.common.util.RedisUtil;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -76,7 +77,7 @@ public class ProductionCreateEAIService extends AbsEAIService {
productionDetailsEntity.setProduceBoss("23467345221");
productionDetailsEntity.setProductionStatus(TabStatusEnums.PENDING.getValue().toString());
productionDetailsEntity.setNature(String.valueOf(randomNumber));
String batchNo = createBatchNo();
String batchNo = SnowflakeWorker.nextId().toString();
productionDetailsEntity.setBatchNo("MMDD-"+batchNo);
//预计产量赋值
if (CollectionUtils.isNotEmpty(list)) {
@ -97,20 +98,4 @@ public class ProductionCreateEAIService extends AbsEAIService {
return buildOK();
}
private String createBatchNo(){
StringBuffer sb = new StringBuffer();
Long batchNo;
if (redisUtil.getRedisTemplate().hasKey(ProductionUtil.KEY)) {
batchNo = redisUtil.incrBy(ProductionUtil.KEY, 1);
} else {
redisUtil.setObject(ProductionUtil.KEY, 1);
batchNo = 1L;
}
int prefix = 5-batchNo.toString().length();
for (int i = 0; i < prefix; i++) {
sb.append("0");
}
return sb.append(batchNo).toString();
}
}

+ 9
- 6
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/ptc/service/receivables/ReceivablesInitialCreateEAIService.java View File

@ -11,6 +11,7 @@ import com.digiwin.athena.app.ptc.infra.repository.ReceivablesDetailRepository;
import com.digiwin.athena.app.ptc.infra.service.CollectionDetailService;
import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService;
import com.digiwin.athena.opt.common.eai.service.AbsEAIService;
import com.digiwin.athena.opt.common.generator.SnowflakeWorker;
import com.digiwin.athena.opt.common.security.SecurityUtil;
import com.digiwin.athena.opt.common.util.DateUtils;
import lombok.extern.log4j.Log4j2;
@ -132,18 +133,18 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService {
receivablesDetailEntity.setSkuCode(sku.getSkuCode());
receivablesDetailEntity.setSkuName(sku.getSkuName());
receivablesDetailEntity.setSkuSpec(sku.getSkuSpec());
receivablesDetailEntity.setReceivableNo("RE-"+DateUtils.currentTimeString());
receivablesDetailEntity.setReceivableNon("SEQ-"+DateUtils.currentTimeString());
receivablesDetailEntity.setContractNo("CO"+DateUtils.currentTimeString());
receivablesDetailEntity.setReceivableNo("RE-"+SnowflakeWorker.nextId());
receivablesDetailEntity.setReceivableNon("SEQ-"+SnowflakeWorker.nextId());
receivablesDetailEntity.setContractNo("CO"+ SnowflakeWorker.nextId());
receivablesDetailEntity.setStatus("1");
receivablesDetailEntity.setSalesOrder("SO-"+DateUtils.currentTimeString());
receivablesDetailEntity.setSalesOrderNumber("SON-"+DateUtils.currentTimeString());
receivablesDetailEntity.setSalesOrder("SO-"+SnowflakeWorker.nextId());
receivablesDetailEntity.setSalesOrderNumber("SON-"+SnowflakeWorker.nextId());
receivablesDetailEntity.setSalesmanAssistant("Sp0001");
receivablesDetailEntity.setSalesmanBoss("qcsupplier001");
receivablesDetailEntity.setSalesman("qcuser001");
receivablesDetailEntity.setProduceBoss("Sp0002");
receivablesDetailEntity.setEmail("ath_Sp0001@163.com");
receivablesDetailEntity.setWorkNo("work-"+DateUtils.currentTimeString());
receivablesDetailEntity.setWorkNo("work-"+SnowflakeWorker.nextId());
receivablesDetailEntity.setOverdueDays(String.valueOf((new Date().getTime()-receivablesDetailEntity.getReceivableDate().getTime())/86400000L));
}
@ -152,4 +153,6 @@ public class ReceivablesInitialCreateEAIService extends AbsEAIService {
return buildOK();
}
}

Loading…
Cancel
Save