From 0f8366ddc9af31a7f346eb17bd18a16cf5f5e63b Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Mon, 7 Aug 2023 15:49:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=BF=90=E5=8D=95=E5=8F=B7=20=20=E5=8C=85?= =?UTF-8?q?=E6=9D=A1=E7=A0=81=20=20=E6=89=98=E7=9B=98=E7=A0=81=20=20?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=8D=95=20=E7=9A=84=E7=A0=81=E5=80=BC?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springblade/common/utils/CommonUtil.java | 4 +-- .../impl/BasicdataCodeServiceImpl.java | 18 +++++++------ .../controller/FactoryCommonController.java | 25 ++++++++++++++++++- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java index 2cc5d698e..06f36ce65 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java @@ -162,9 +162,9 @@ public class CommonUtil { * @param number 数字 * @return */ - public static String geFourNumber(Long number){ + public static String geFourNumber(Long number,int num){ NumberFormat formatter = NumberFormat.getNumberInstance(); - formatter.setMinimumIntegerDigits(4); + formatter.setMinimumIntegerDigits(num); formatter.setGroupingUsed(false); return formatter.format(number); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java index a2f5c09d1..12d67f0fd 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java @@ -87,7 +87,7 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { //如果为1就是刚刚才建立,给他一个过期时间 bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd()); } - return "HTEX"+warehouseCode+CommonUtil.geFourNumber(incr); + return "HTEX"+warehouseCode+CommonUtil.geFourNumber(incr,5); } private String generateTraysCode(Integer type, String warehouseCode) { @@ -116,7 +116,7 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd()); } - return "汇通"+abbreviation+dateShort+CommonUtil.geFourNumber(incr); + return "汇通"+abbreviation+dateShort+CommonUtil.geFourNumber(incr,5); } @@ -141,7 +141,7 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { //如果为1就是刚刚才建立,给他一个过期时间 bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd()); } - return warehouseCode+dateShort+CommonUtil.geFourNumber(incr); + return warehouseCode+dateShort+CommonUtil.geFourNumber(incr,5); } @@ -162,7 +162,7 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { bladeRedis.expireAt(key,CommonUtil.getDayEnd()); } - return tenantCode+warehouseCode+dateShort+CommonUtil.geFourNumber(incr); + return tenantCode+warehouseCode+dateShort+CommonUtil.geFourNumber(incr,5); } /** @@ -186,7 +186,7 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { bladeRedis.expireAt(key,CommonUtil.getDayEnd()); } - return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr); + return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr,5); } @@ -203,10 +203,12 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { //包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引 //获得年月日短字符串 - String dateShort = CommonUtil.dateToString(new Date()); + Date date = new Date(); + String s = CommonUtil.dateToStringShort(date); + String dateShort = CommonUtil.dateToString(date); //redis的key - String key = warehouseCode + ":" + orderCode+":"+dateShort; + String key = warehouseCode + ":" + orderCode+":"+s; //获得序号 Long incr = bladeRedis.incr(key); if(1 == incr){ @@ -214,6 +216,6 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { bladeRedis.expireAt(key,CommonUtil.getDayEnd()); } - return "HT" + warehouseCode + dateShort + CommonUtil.geFourNumber(incr); + return "HT" + warehouseCode + dateShort + CommonUtil.geFourNumber(incr,5); } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java index 6b8cb457f..a0a7c00ca 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/controller/FactoryCommonController.java @@ -2,6 +2,7 @@ package com.logpm.factory.comfac.controller; import com.alibaba.fastjson.JSONObject; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.basicdata.feign.IBasicdataCodeClient; import com.logpm.factory.comfac.dto.OrderInfoDTO; import com.logpm.factory.comfac.dto.OrderStatusDTO; import com.logpm.factory.comfac.dto.ReceiveInfoDTO; @@ -13,6 +14,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.common.constant.CodeNumConstant; import org.springblade.common.constant.RabbitConstant; import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.CommonUtil; @@ -24,7 +26,6 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -39,6 +40,7 @@ public class FactoryCommonController { private final RabbitTemplate rabbitTemplate; private final IOrderStatusLogService orderStatusLogService; private final IFactoryCommonService factoryCommonService; + private final IBasicdataCodeClient codeClient; @ResponseBody @PostMapping("/sendOrders") @@ -191,4 +193,25 @@ public class FactoryCommonController { } + @ResponseBody + @PostMapping("/testCode") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "卸车完成推送", notes = "传入receiveInfoDTO") + public R testCode(@RequestBody OrderInfoDTO orderInfoDTO) { + + String lq = codeClient.getCodeByType(CodeNumConstant.WAYBILL, "LQ", orderInfoDTO.getOrderNo()); + String lq1 = codeClient.getCodeByType(CodeNumConstant.PACKAGE, "LQ", orderInfoDTO.getOrderNo()); + String lq2 = codeClient.getCodeByType(CodeNumConstant.TRAYS, "LQ", orderInfoDTO.getOrderNo()); + String lq3 = codeClient.getCodeByType(CodeNumConstant.ABNORMAL_ORDER, "LQ", orderInfoDTO.getOrderNo()); + + log.info("##############testCode: code={}",lq); + Map map = new HashMap<>(); + map.put("运单号",lq); + map.put("包件码",lq1); + map.put("托盘码",lq2); + map.put("异常工单码",lq3); + + return R.data(map); + } + }