From e6ccc3a1236e23e4c292175cfe97c211ce6d491c Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Wed, 28 Jun 2023 18:45:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=A2=A6=E5=A4=A9?= =?UTF-8?q?=E5=B7=A5=E5=8E=82=E6=95=B0=E6=8D=AE=EF=BD=94=EF=BD=8F=EF=BD=8B?= =?UTF-8?q?=EF=BD=85=EF=BD=8E=E3=80=80=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MtFactoryDataServiceImpl.java | 48 ++++++++++++++- .../factory/props/MtFactoryProperties.java | 23 +++++++ .../src/main/resources/application-dev.yml | 6 +- .../src/main/resources/application-prod.yml | 26 ++++++++ .../src/main/resources/application-test.yml | 28 +++++++++ .../java/com/logpm/factory/TestService.java | 49 ++++++--------- .../launch/FactoryLauncherServiceImpl.java | 60 +++++++++++++++++++ 7 files changed, 203 insertions(+), 37 deletions(-) create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/props/MtFactoryProperties.java create mode 100644 blade-service/logpm-factory/src/test/java/com/logpm/factory/launch/FactoryLauncherServiceImpl.java diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 1d9246871..e5450e8b9 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -2,6 +2,7 @@ package com.logpm.factory.mt.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; @@ -17,6 +18,7 @@ import com.logpm.factory.mt.service.IMtFactoryDataService; import com.logpm.factory.mt.service.IMtFactoryOrderMainService; import com.logpm.factory.mt.service.IMtFactoryOrderService; import com.logpm.factory.mt.service.IMtPackageInfoService; +import com.logpm.factory.props.MtFactoryProperties; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.entity.MtFactoryOrder; import com.logpm.factory.snm.entity.MtFactoryOrderMain; @@ -28,9 +30,12 @@ import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.common.exception.CustomerException; +import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; import java.util.*; @@ -47,6 +52,10 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { private final IAdvanceDetailClient advanceDetailClient; private final IWarehouseClient warehouseClient; + private final BladeRedis bladeRedis; + + private final MtFactoryProperties mtFactoryProperties; + @Transactional @Override public R dealWithData(MtFactoryDataDTO mtFactoryDataDTO) { @@ -151,7 +160,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { String s = gson.toJson(map); //先获取token - String panToken = "getPanToken()"; + String panToken = getMtToken(); //请求参数 logger.info("##############handleData: 推送包件状态请求参数 {}",s); @@ -180,6 +189,43 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { } return Resp.success("SUCCESS"); + } + + /** + * 获取梦天的工厂的数据token + * @return + */ + public String getMtToken() { + String mtToken =bladeRedis.get("mt_token"); + if(StringUtil.isBlank(mtToken)){ + // 重新获取 + JSONObject jsonObject1 =new JSONObject(); + jsonObject1.put("APPKEY",mtFactoryProperties.getAppkey()); + jsonObject1.put("APPSECRET",mtFactoryProperties.getAppsecret()); + jsonObject1.put("USERID",mtFactoryProperties.getUserid()); + jsonObject1.put("USERPWD",mtFactoryProperties.getUserpwd()); + String result = HttpRequest.post(mtFactoryProperties.getUrl()) + .header("Content-Type","application/json").body(jsonObject1.toJSONString()).timeout(5 * 1000) + .execute() + .body(); + logger.info("##############getMengtianToken: 获取梦天token返回参数 {}",result); + //获取的结果转成json对象 + JSONObject jsonObject = JSONObject.parseObject(result); + logger.info("##############getMengtianToken: 获取梦天token返回参数 {}",result); + + String access_token = jsonObject.getString("Data"); + if(StringUtil.hasLength(access_token)){ + mtToken= access_token; + // 加入redis + bladeRedis.setEx("mt_token",mtToken,25*60L); + }else{ + throw new CustomerException(402,"获取梦天token失败"); + } + } + return mtToken; + + + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/MtFactoryProperties.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/MtFactoryProperties.java new file mode 100644 index 000000000..6b24adea5 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/props/MtFactoryProperties.java @@ -0,0 +1,23 @@ +package com.logpm.factory.props; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@ConfigurationProperties(prefix = "mengtian") +@Component +public class MtFactoryProperties { + + private String url; + + private String appkey ; + + private String appsecret ; + + private String userid ; + + private String userpwd ; + + +} diff --git a/blade-service/logpm-factory/src/main/resources/application-dev.yml b/blade-service/logpm-factory/src/main/resources/application-dev.yml index 88c70d307..5545973e1 100644 --- a/blade-service/logpm-factory/src/main/resources/application-dev.yml +++ b/blade-service/logpm-factory/src/main/resources/application-dev.yml @@ -43,8 +43,4 @@ spring: username: ${blade.datasource.factory.slave.username} password: ${blade.datasource.factory.slave.password} -pan: - url: http://157.122.179.34:15019 - clientId: hzero-front-dev - clientSecret: c2VjcmV0 - grantType: client_credentials + diff --git a/blade-service/logpm-factory/src/main/resources/application-prod.yml b/blade-service/logpm-factory/src/main/resources/application-prod.yml index a0ca7ca85..aa4e0d740 100644 --- a/blade-service/logpm-factory/src/main/resources/application-prod.yml +++ b/blade-service/logpm-factory/src/main/resources/application-prod.yml @@ -29,3 +29,29 @@ spring: url: ${blade.datasource.factory.slave.url} username: ${blade.datasource.factory.slave.username} password: ${blade.datasource.factory.slave.password} + #rabbitmq配置 + rabbitmq: + host: 172.16.128.146 + port: 5672 + username: admin + password: Slwk@123654 + #虚拟host 可以不设置,使用server默认host + virtual-host: / + #确认消息已发送到队列(Queue) + publisher-returns: true + publisher-confirm-type: correlated + # 手动提交消息 + listener: + simple: + acknowledge-mode: auto + default-requeue-rejected: false + retry: + enabled: true # 开启消费者失败重试 + initial-interval: 1000 # 初识的失败等待时长为1秒 + multiplier: 1 # 失败的等待时长倍数,下次等待时长 = multiplier * last-interval + max-attempts: 3 # 最大重试次数 + stateless: true # true无状态;false有状态。如果业务中包含事务,这里改为false + direct: + acknowledge-mode: manual + template: + mandatory: true diff --git a/blade-service/logpm-factory/src/main/resources/application-test.yml b/blade-service/logpm-factory/src/main/resources/application-test.yml index 81ad99d0b..1ef2d5db2 100644 --- a/blade-service/logpm-factory/src/main/resources/application-test.yml +++ b/blade-service/logpm-factory/src/main/resources/application-test.yml @@ -29,3 +29,31 @@ spring: url: ${blade.datasource.factory.slave.url} username: ${blade.datasource.factory.slave.username} password: ${blade.datasource.factory.slave.password} + #rabbitmq配置 + rabbitmq: + host: 172.16.128.146 + port: 5672 + username: admin + password: Slwk@123654 + #虚拟host 可以不设置,使用server默认host + virtual-host: / + #确认消息已发送到队列(Queue) + publisher-returns: true + publisher-confirm-type: correlated + # 手动提交消息 + listener: + simple: + acknowledge-mode: auto + default-requeue-rejected: false + retry: + enabled: true # 开启消费者失败重试 + initial-interval: 1000 # 初识的失败等待时长为1秒 + multiplier: 1 # 失败的等待时长倍数,下次等待时长 = multiplier * last-interval + max-attempts: 3 # 最大重试次数 + stateless: true # true无状态;false有状态。如果业务中包含事务,这里改为false + direct: + acknowledge-mode: manual + template: + mandatory: true + + diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index 41c5f2f57..8ced88c95 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -1,41 +1,28 @@ package com.logpm.factory; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springblade.core.test.BladeBootTest; +import org.springblade.core.test.BladeSpringExtension; +import org.springblade.core.tool.utils.StringUtil; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; import java.util.Random; +//@ExtendWith(BladeSpringExtension.class) +//@BladeBootTest(appName = "logpm-factory", enableLoader = true) public class TestService { - public static void main(String[] args) { + @Autowired + private MtFactoryDataServiceImpl mtFactoryDataService; + @Test + public void contextLoads() { - String code = getCharAndNumr(32); - System.out.println(code); - } - /** - * 方法1:生成随机数字和字母组合 - * @param length - * @return - */ - - public static String getCharAndNumr(int length) { - - Random random = new Random(); - - StringBuffer valSb = new StringBuffer(); - - String charStr = "0123456789abcdefghijklmnopqrstuvwxyz"; - - int charLength = charStr.length(); - - - - for (int i = 0; i < length; i++) { - - int index = random.nextInt(charLength); - - valSb.append(charStr.charAt(index)); - - } - - return valSb.toString(); + String tolk =mtFactoryDataService.getMtToken(); + System.out.println(tolk); } diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/launch/FactoryLauncherServiceImpl.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/launch/FactoryLauncherServiceImpl.java new file mode 100644 index 000000000..5f8c3dd3b --- /dev/null +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/launch/FactoryLauncherServiceImpl.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.factory.launch; + +import org.springblade.core.auto.service.AutoService; +import org.springblade.core.launch.constant.NacosConstant; +import org.springblade.core.launch.service.LauncherService; +import org.springblade.core.launch.utils.PropsUtil; +import org.springframework.boot.builder.SpringApplicationBuilder; + +import java.util.Properties; + +/** + * 启动参数拓展 + * + * @author Chill + */ +@AutoService(LauncherService.class) +public class FactoryLauncherServiceImpl implements LauncherService { + + @Override + public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { + Properties props = System.getProperties(); + // 开启多数据源 + PropsUtil.setProperty(props, "spring.datasource.dynamic.enabled", "true"); + // 指定注册配置信息 + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].data-id", NacosConstant.dataId("factory", profile)); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].group", NacosConstant.NACOS_CONFIG_GROUP); + PropsUtil.setProperty(props, "spring.cloud.nacos.config.extension-configs[0].refresh", NacosConstant.NACOS_CONFIG_REFRESH); + // 指定注册IP + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.ip", "127.0.0.1"); + // 指定注册端口 + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.port", "8200"); + // 自定义命名空间 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.namespace", LauncherConstant.NACOS_NAMESPACE); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.namespace", LauncherConstant.NACOS_NAMESPACE); + // 自定义分组 + // PropsUtil.setProperty(props, "spring.cloud.nacos.config.group", NacosConstant.NACOS_CONFIG_GROUP); + // PropsUtil.setProperty(props, "spring.cloud.nacos.discovery.group", NacosConstant.NACOS_CONFIG_GROUP); + } + + @Override + public int getOrder() { + return 20; + } +} From f7cf2bd13badf65f4c9c4fb5bbfab3437b53835e Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Wed, 28 Jun 2023 18:56:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E5=A4=84=E7=90=86=E5=9C=A8=E5=BA=93?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=95=B0=E6=8D=AE=E5=88=B0=E6=96=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=80=BB=E8=BE=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/DistributionParcelListEntity.java | 9 +++- .../feign/IDistributionParcelListClient.java | 4 +- .../IDistributionStockArticleClient.java | 3 ++ .../feign/IAdvanceDetailClient.java | 6 +-- .../vo/DistributionParcelListEntityVO.java | 7 ++++ .../feign/DistributionParcelListClient.java | 6 +++ .../feign/DistributionStockArticleClient.java | 6 +++ .../impl/PanFactoryDataServiceImpl.java | 42 +++++++++---------- .../oldproject/feign/AdvanceDetailClient.java | 5 +-- .../mapper/AdvanceDetailMapper.java | 2 +- .../oldproject/mapper/AdvanceDetailMapper.xml | 35 +++++++++------- .../service/IAdvanceDetailService.java | 3 +- .../impl/AdvanceDetailServiceImpl.java | 4 +- 13 files changed, 81 insertions(+), 51 deletions(-) diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java index 9db7ca66c..2f01659f1 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionParcelListEntity.java @@ -17,10 +17,9 @@ package com.logpm.distribution.entity; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; @@ -81,6 +80,12 @@ public class DistributionParcelListEntity extends TenantEntity { */ @ApiModelProperty(value = "包条码") private String packetBarCode; + + @ApiModelProperty(value = "货区信息") + private String cargoTitle; + + @ApiModelProperty(value = "货架信息") + private String shelfTitle; /** * 货位信息 */ diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index f1ad1cf20..01267bc42 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -17,7 +17,6 @@ package com.logpm.distribution.feign; import com.logpm.distribution.entity.DistributionParcelListEntity; -import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.mp.support.BladePage; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -56,4 +55,7 @@ public interface IDistributionParcelListClient { @PostMapping(API_PREFIX+"/addBatch") boolean addBatch(@RequestBody List parcelListEntityList); + + @PostMapping(API_PREFIX+"/add") + boolean add(@RequestBody DistributionParcelListEntity entity); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java index 4c37f7ea9..f3bba919a 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java @@ -53,4 +53,7 @@ public interface IDistributionStockArticleClient { @GetMapping(API_PREFIX + "/findByAdvanceId") DistributionStockArticleEntity findByAdvanceId(@RequestParam Integer advanceId); + + @PostMapping(API_PREFIX + "/saveOrUpdate") + void saveOrUpdate(DistributionStockArticleEntity distributionStockArticleEntity); } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java index f2c1d5dbb..b079e44de 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java @@ -24,7 +24,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; -import java.util.List; import java.util.Map; /** @@ -72,8 +71,7 @@ public interface IAdvanceDetailClient { @GetMapping(API_PREFIX + "/getOneByUnitNo") AdvanceDetailEntity getOneByUnitNo(@RequestParam String unitNo); - @GetMapping(API_PREFIX + "/getListByOrderSelfNum") - List getListByOrderSelfNum(@RequestParam String orderSelfNum); + @GetMapping(API_PREFIX + "/getByUnitNo") + DistributionParcelListEntityVO getByUnitNo(@RequestParam String unitNo); - void getOneByUnitNo(); } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java index eff4d0a1a..e8d68664b 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java @@ -18,6 +18,13 @@ public class DistributionParcelListEntityVO { */ @ApiModelProperty(value = "包条码") private String packetBarCode; + + @ApiModelProperty(value = "货区信息") + private String cargoTitle; + + @ApiModelProperty(value = "货架信息") + private String shelfTitle; + /** * 货位信息 */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index a9a07bfa7..9d876234a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -68,4 +68,10 @@ public class DistributionParcelListClient implements IDistributionParcelListClie return distributionParcelListService.saveBatch(parcelListEntityList); } + @Override + @PostMapping(API_PREFIX+"/add") + public boolean add(DistributionParcelListEntity entity) { + return distributionParcelListService.save(entity); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index 106adcf1e..6f6859763 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -71,4 +71,10 @@ public class DistributionStockArticleClient implements IDistributionStockArticle return distributionStockArticleService.getOne(queryWrapper); } + @Override + @PostMapping(API_PREFIX + "/saveOrUpdate") + public void saveOrUpdate(DistributionStockArticleEntity distributionStockArticleEntity) { + distributionStockArticleService.saveOrUpdate(distributionStockArticleEntity); + } + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java index 1274e8a5b..1917baf80 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java @@ -36,6 +36,7 @@ import com.logpm.oldproject.feign.IAdvanceClient; import com.logpm.oldproject.feign.IAdvanceDetailClient; import com.logpm.oldproject.feign.IOrderClient; import com.logpm.oldproject.feign.IWarehouseClient; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -322,6 +323,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { //判断新系统是否有这条订单数据 DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByAdvanceId(advanceId); + Long id = null; if(Objects.isNull(distributionStockArticleEntity)){ Date date = CommonUtil.StringToDate(operationTime); @@ -334,7 +336,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { distributionStockArticleEntity.setWarehouseEntryTime(date); distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal()); distributionStockArticleEntity.setHandQuantity(0); - distributionStockArticleEntity.setCompleteSet(1);//TODO + distributionStockArticleEntity.setCompleteSet(1); distributionStockArticleEntity.setBrand(advanceEntity.getType()); String customerName = advanceEntity.getCustomerName();//客户名称 @@ -353,29 +355,27 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { distributionStockArticleEntity.setGenre(1); distributionStockArticleEntity.setState(2); distributionStockArticleEntity.setAdvanceId(advanceId); - } - Long id = distributionStockArticleClient.addData(distributionStockArticleEntity); - if(id == 0){ - logger.warn("#################handleDataToPlatform: 保存订单信息失败 orderSelfNum={}",orderSelfNum); - throw new CustomerException(405,"保存订单信息失败"); + id = distributionStockArticleClient.addData(distributionStockArticleEntity); + if(id == 0){ + logger.warn("#################handleDataToPlatform: 保存订单信息失败 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"保存订单信息失败"); + } + }else{ + id = distributionStockArticleEntity.getId(); } - //存入包件明细 + //查询包件信息数据 + DistributionParcelListEntityVO vo = advanceDetailClient.getByUnitNo(unitNo); + DistributionParcelListEntity entity = new DistributionParcelListEntity(); + BeanUtil.copyProperties(vo,entity); - - -// List parcelListEntityList = new ArrayList<>(); -// for (DistributionParcelListEntityVO vo:detailList){ -// DistributionParcelListEntity entity = new DistributionParcelListEntity(); -// BeanUtil.copyProperties(vo,entity); -// entity.setStockArticleId(id+""); -// parcelListEntityList.add(entity); -// } -// boolean b = distributionParcelListClient.addBatch(parcelListEntityList); -// if(!b){ -// logger.warn("#################handleDataToPlatform: 保存包件信息失败 orderSelfNum={}",orderSelfNum); -// throw new CustomerException(405,"保存包件信息失败"); -// } + boolean b = distributionParcelListClient.add(entity); + if(!b){ + logger.warn("#################handleDataToPlatform: 保存包件信息失败 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"保存包件信息失败"); + } + distributionStockArticleEntity.setHandQuantity(distributionStockArticleEntity.getHandQuantity()+1); + distributionStockArticleClient.saveOrUpdate(distributionStockArticleEntity); logger.info("#################handleDataToPlatform: 数据处理完成"); }else{ diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java index c62a7d50a..a2657bd51 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java @@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; -import java.util.List; import java.util.Map; /** @@ -76,8 +75,8 @@ public class AdvanceDetailClient implements IAdvanceDetailClient { } @Override - public List getListByOrderSelfNum(String orderSelfNum) { - return advanceDetailService.getListByOrderSelfNum(orderSelfNum); + public DistributionParcelListEntityVO getByUnitNo(String UnitNo) { + return advanceDetailService.getByUnitNo(UnitNo); } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java index c37da4ec0..9a01d892b 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java @@ -52,6 +52,6 @@ public interface AdvanceDetailMapper extends BaseMapper { Map getSupplyData(@Param("unitNo") String unitNo); - List getListByOrderSelfNum(@Param("orderSelfNum") String orderSelfNum); + DistributionParcelListEntityVO getByUnitNo(@Param("unitNo") String unitNo); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml index 866618c9a..022d8af90 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml @@ -87,23 +87,28 @@ - + select w.title warehouse, + od.unitNo packetBarCode, + c.title cargoTitle, + s.title shelfTitle, + l.title goodsAllocation, + t.tray_no pallet, + ad.firstPackName firsts, + ad.secondPackName `second`, + ad.thirdPackName thirdProduct, + ad.productCode material, + ad.mscsNum quantity, + ad.mctsTruck trainNumber from ht_order_detail od - left join ht_advance_detail ad on od.unitNo = ad.unitNo and ad.delete_time = 0 + left join ht_advance_detail ad on ad.unitNo = od.unitNo left join ht_warehouse w on w.id = od.now_warehouse_id - left join ht_location l on l.id = od.location_id - where od.detail_number = #{orderSelfNum} + left join ht_location l on od.location_id = l.id + left join ht_shelf s on l.shelf_id = s.id + left join ht_cargo c on s.cargo_id = c.id + left join ht_tray_scan_des tsd on tsd.unitNo = od.unitNo + left join ht_tray t on t.id = tsd.tray_id + where od.unitNo = #{unitNo} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java index ef9ea212a..90c4e5d1d 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java @@ -19,7 +19,6 @@ package com.logpm.oldproject.service; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.vo.DistributionParcelListEntityVO; -import java.util.List; import java.util.Map; /** @@ -37,6 +36,6 @@ public interface IAdvanceDetailService { AdvanceDetailEntity getOneByUnitNo(String unitNo); - List getListByOrderSelfNum(String orderSelfNum); + DistributionParcelListEntityVO getByUnitNo(String unitNo); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java index fbc6f6779..e12a2c209 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java @@ -60,8 +60,8 @@ public class AdvanceDetailServiceImpl implements IAdvanceDetailService { } @Override - public List getListByOrderSelfNum(String orderSelfNum) { - return advanceDetailMapper.getListByOrderSelfNum(orderSelfNum); + public DistributionParcelListEntityVO getByUnitNo(String unitNo) { + return advanceDetailMapper.getByUnitNo(unitNo); }