Browse Source

feat(all): 增加梦天回传新逻辑

dist.1.3.0
zhaoqiaobo 9 months ago
parent
commit
e6228544b3
  1. 12
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 21
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/dto/MtPushDataDTO.java
  3. 31
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClient.java
  4. 1
      blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java
  5. 18
      blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/NodePushMsg.java
  6. 23
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  7. 37
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java
  8. 14
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/Dockerfile
  9. 98
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/pom.xml
  10. 20
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/FactoryDataMengTianApplication.java
  11. 51
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/AsyncAnnotationAspect.java
  12. 48
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/RabbitAnnotationAspect.java
  13. 161
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/CustomMessageConverter.java
  14. 82
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/ExecutorConfig.java
  15. 40
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/FactoryDataOloConfiguration.java
  16. 35
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/InterceptorAdapterConfig.java
  17. 17
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/RabbitConfig.java
  18. 48
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/controller/OrderController.java
  19. 23
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushOrderDTO.java
  20. 21
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushPackageDTO.java
  21. 89
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/entity/FactoryNodePushEntity.java
  22. 60
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/FactoryNodeEnums.java
  23. 73
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeMappingEnums.java
  24. 48
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeNeedEnums.java
  25. 96
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/interceptor/LocalServerLoginAccountsInterceptor.java
  26. 60
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/launcher/FactoryDataBaseLauncherServiceImpl.java
  27. 16
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.java
  28. 5
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.xml
  29. 259
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mq/NodeDataPushListener.java
  30. 20
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/FactoryDataProperties.java
  31. 56
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/MengTianProperties.java
  32. 14
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/FactoryNodePushService.java
  33. 22
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/impl/FactoryNodePushServiceImpl.java
  34. 32
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmOrderVO.java
  35. 26
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmPackageVO.java
  36. 45
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmVO.java
  37. 58
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInVO.java
  38. 26
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmImageVO.java
  39. 48
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmPackageVO.java
  40. 42
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmVO.java
  41. 50
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForVO.java
  42. 73
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-dev.yml
  43. 47
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-prod.yml
  44. 73
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-test.yml
  45. 19
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application.yml
  46. 40
      blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/logback.xml
  47. 1
      blade-service/logpm-factory-data/pom.xml
  48. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/MtOrderLogFailRetryJob.java
  49. 30
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClinet.java
  50. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java
  51. 15
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml
  52. 12
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/dto/LoadScanBrandDTO.java
  53. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml
  54. 1
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java
  55. 16
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

12
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -114,6 +114,14 @@ public interface ModuleNameConstant {
* 林氏工厂数据模块
*/
String LOGPM_FACTORY_DATA_LINSY_NAME = "logpm-factory-data-linsy" + DEVAUTH;
/**
* 梦天工厂数据模块
*/
String LOGPM_FACTORY_DATA_MENGTIAN_NAME = "logpm-factory-data-mengtian" + DEVAUTH;
/**
* 欧派工厂数据模块
*/
String LOGPM_FACTORY_DATA_OUPAI_NAME = "logpm-factory-data-oupai" + DEVAUTH;
/**
* 曼好家工厂数据模块
*/
@ -126,10 +134,6 @@ public interface ModuleNameConstant {
* 诗尼曼工厂数据模块
*/
String LOGPM_FACTORY_DATA_SNIMAY_NAME = "logpm-factory-data-snimay" + DEVAUTH;
/**
* 梦天工厂数据模块
*/
String LOGPM_FACTORY_DATA_MENGTIAN_NAME = "logpm-factory-data-mengtian" + DEVAUTH;
/**
* 欧派工厂数据模块
*/

21
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/dto/MtPushDataDTO.java

@ -0,0 +1,21 @@
package com.logpm.factory.mt.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class MtPushDataDTO implements Serializable {
/** 发货单编号 */
private String senderCode;
/** 发货单编号 */
private String orderCode;
/** 工厂出库方式 */
private String outWarehouseType;
/** 经销商名称 */
private String dealerName;
/** 仓库编号 */
private String warehouseCode;
}

31
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClient.java

@ -0,0 +1,31 @@
package com.logpm.factory.mt.feign;
import com.logpm.factory.mt.dto.MtPushDataDTO;
import org.springblade.common.constant.ModuleNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Set;
@FeignClient(
value = ModuleNameConstant.APPLICATION_FACTORY_NAME
)
public interface MtFactoryDataClient {
String API_PREFIX = "/client";
String HANDLEDATATOPLATFORM = API_PREFIX + "/mt/fatory/orderPushData";
/**
* 根据订单编号查询梦天的数据
* @param orderCodes
*/
@GetMapping(HANDLEDATATOPLATFORM)
List<MtPushDataDTO> orderPushData(@RequestParam("orderCode") Set<String> orderCodes);
}

1
blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java

@ -26,6 +26,7 @@ public class FactoryDataUtil {
factorys.put(BrandEnums.LINSY.getValue(), FactoryDataConstants.Mq.RoutingKeys.LINSY_NODE_DATA_PUSH);
factorys.put(BrandEnums.OLO.getValue(), FactoryDataConstants.Mq.RoutingKeys.OLO_NODE_DATA_PUSH);
factorys.put(BrandEnums.SFY.getValue(), FactoryDataConstants.Mq.RoutingKeys.SFY_NODE_DATA_PUSH);
factorys.put(BrandEnums.MTMM.getValue(), FactoryDataConstants.Mq.RoutingKeys.MENGTIAN_NODE_DATA_PUSH);
}

18
blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/NodePushMsg.java

@ -2,12 +2,12 @@ package com.logpm.factorydata.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.logpm.factorydata.enums.BrandEnums;
import org.springblade.common.constant.WorkNodeEnums;
import com.logpm.factorydata.enums.SignForStatusEnums;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springblade.common.constant.WorkNodeEnums;
import java.io.Serializable;
import java.util.Date;
@ -50,6 +50,22 @@ public class NodePushMsg implements Serializable {
* 当前地址
*/
private String address;
/**
* 开单始发仓
*/
private String startWarehouse;
/**
* 当前仓
*/
private String warehouse;
/**
* 开单目的仓
*/
private String endWarehouse;
/**
* 文员复核环节状态部分签收/全部签收
*/

23
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -1532,6 +1532,29 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
if (Func.isNotEmpty(brand.get("梦天"))) {
mtReceiveDTO.setReceiveContentList(brand.get("梦天"));
orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO);
try {
JSONObject js = new JSONObject();
js.put("boId", mtReceiveDTO.getSendTaskId());
js.put("consignee", mtReceiveDTO.getReceiver());
js.put("images", mtReceiveDTO.getReceiveImagesList().stream().map(m -> m.getImage()).collect(Collectors.toList()));
NodePushMsg msg = new NodePushMsg();
msg.setNode(WorkNodeEnums.CLERK_REVIEW);
msg.setBrand(BrandEnums.MTMM);
msg.setOperator(AuthUtil.getNickName());
msg.setOperatorTime(new Date());
msg.setContent(mtReceiveDTO.getReceiveContentList().stream().map(m ->{
return PushData.builder()
.warehouseName(m.getWarehouse())
.orderCode(m.getOrderCode())
.packageCode(m.getUnitNo())
.build();
}).collect(Collectors.toList()));
msg.setMain(JSONUtil.toJsonStr(js));
log.info("推送工厂数据:{}", JSONUtil.toJsonStr(msg));
factoryDataMessageSender.sendNodeDataByBrand(msg);
}catch (Exception e){
log.error("推送失败");
}
}
if (Func.isNotEmpty(brand.get("欧派"))) {

37
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java

@ -1,11 +1,16 @@
package com.logpm.distribution.service.impl;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.service.IDistributionNodeWorkService;
import com.logpm.factorydata.enums.BrandEnums;
import com.logpm.factorydata.util.FactoryDataMessageSender;
import com.logpm.factorydata.vo.NodePushMsg;
import com.logpm.factorydata.vo.PushData;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.model.BroadcastNodeData;
import org.springblade.common.model.FanoutMsg;
@ -15,12 +20,16 @@ import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Date;
@Service
@AllArgsConstructor
@Slf4j
public class DistributionNodeWorkServiceImpl implements IDistributionNodeWorkService {
private final RabbitTemplate rabbitTemplate;
private final FactoryDataMessageSender factoryDataMessageSender;
@Override
public void nodeLoad() {
@ -65,6 +74,30 @@ public class DistributionNodeWorkServiceImpl implements IDistributionNodeWorkSer
.exchange(FanoutConstants.distribution.signfor.EXCHANGE).build();
sendFanoutMsg(build);
try {
JSONObject main = new JSONObject();
main.set("boId", taskId.toString());
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.warehouse(parcelListEntity.getWarehouse())
.startWarehouse(parcelListEntity.getSendWarehouseName())
.endWarehouse(parcelListEntity.getAcceptWarehouseName())
.address("在【" + parcelListEntity.getWarehouse() + "】签收")
.brand(BrandEnums.getByValue(parcelListEntity.getBrandName()))
.node(WorkNodeEnums.DISTRIBUTION_SIGN_FOR)
.main(JSONUtil.toJsonStr(main))
.content(Collections.singletonList(PushData.builder()
.packageCode(parcelListEntity.getOrderPackageCode())
.warehouseName(parcelListEntity.getWarehouse())
.waybillNumber(parcelListEntity.getWaybillNumber())
.orderCode(parcelListEntity.getOrderCode())
.build()))
.build();
factoryDataMessageSender.sendNodeDataByBrand(nodePushMsg);
}catch (Exception e){
log.error("推送工厂失败:{}",e);
}
}

14
blade-service/logpm-factory-data/logpm-factory-data-mengtian/Dockerfile

@ -0,0 +1,14 @@
FROM 192.168.2.110:7777/hwy/hwy_base:v1.0
MAINTAINER h5u@163.com
RUN mkdir -p /logpm/logpm-factory-data-mengtian
WORKDIR /logpm/logpm-factory-data-mengtian
EXPOSE 18980
ADD ./target/logpm-factory-data-mengtian.jar ./app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar","-Xms128m","-Xmx512m", "app.jar"]
CMD ["--spring.profiles.active=test"]

98
blade-service/logpm-factory-data/logpm-factory-data-mengtian/pom.xml

@ -0,0 +1,98 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data</artifactId>
<version>3.2.0.RELEASE</version>
</parent>
<artifactId>logpm-factory-data-mengtian</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-auto</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data-api</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-trunkline-api</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-data-base-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss</artifactId>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-resource-api</artifactId>
<version>3.2.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-factory-api</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<username>${docker.username}</username>
<password>${docker.password}</password>
<repository>${docker.registry.url}/${docker.namespace}/${project.artifactId}</repository>
<tag>${project.version}</tag>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

20
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/FactoryDataMengTianApplication.java

@ -0,0 +1,20 @@
package com.logpm.factorydata;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
/**
* 梦天工厂数据启动类
*
* @author zhaoqiaobo
* @create 2024-4-26
*/
@BladeCloudApplication
public class FactoryDataMengTianApplication {
public static void main(String[] args) {
BladeApplication.run(ModuleNameConstant.LOGPM_FACTORY_DATA_MENGTIAN_NAME, FactoryDataMengTianApplication.class, args);
}
}

51
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/AsyncAnnotationAspect.java

@ -0,0 +1,51 @@
package com.logpm.factorydata.mengtian.aspect;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springblade.common.annotations.LogpmAsync;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
@Aspect
@Component
@Slf4j
@Order(-1)
public class AsyncAnnotationAspect {
/**
* 定义一个切点匹配所有带有@LogpmAsync("asyncExecutor")注解的方法
* 注意实际上Spring Framework自带对@LogpmAsync("asyncExecutor")的处理直接这样配置可能会导致预期之外的行为
*/
@Around("@annotation(org.springblade.common.annotations.LogpmAsync)")
public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
LogpmAsync myAsync = method.getAnnotation(LogpmAsync.class);
String annotationValue = myAsync.value();
log.info(">>>>>>>>>>>>>>>>>> annotationValue={}",annotationValue);
log.info("@LogpmAsync注解的值为asyncExecutor,进行数据源切换 ");
// 在方法执行前的操作
String tenantId = AuthUtil.getTenantId();
log.info(">> tenandId {} ",tenantId);
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后的操作
DynamicDataSourceContextHolder.poll();
return result;
}
}

48
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/RabbitAnnotationAspect.java

@ -0,0 +1,48 @@
package com.logpm.factorydata.mengtian.aspect;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springblade.core.secure.utils.AuthUtil;
import org.springframework.stereotype.Component;
@Aspect
@Component
@Slf4j
public class RabbitAnnotationAspect {
/**
* 该方法为一个切面用于对标记了@RabbitListener注解的方法进行增强主要增加了日志记录和数据源上下文处理的功能
*
* @param joinPoint 切面的连接点表示当前被拦截的方法
* @return 返回被拦截方法的执行结果
* @throws Throwable 如果执行过程中发生异常则抛出
*/
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)")
public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
@Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)")
public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable {
// 在方法执行前,获取当前租户ID并设置到数据源上下文中
String tenantId = AuthUtil.getTenantId();
DynamicDataSourceContextHolder.push(tenantId);
// 执行原方法
Object result = joinPoint.proceed();
// 在方法执行后,从数据源上下文中移除租户ID
DynamicDataSourceContextHolder.poll();
return result;
}
}

161
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/CustomMessageConverter.java

@ -0,0 +1,161 @@
package com.logpm.factorydata.mengtian.config;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.AllowedListDeserializingMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException;
import org.springframework.amqp.utils.SerializationUtils;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.http.HttpHeaders;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.remoting.rmi.CodebaseAwareObjectInputStream;
import org.springframework.stereotype.Component;
import org.springframework.util.ClassUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-05-08
*/
@Component
public class CustomMessageConverter extends AllowedListDeserializingMessageConverter implements BeanClassLoaderAware {
private volatile String defaultCharset = "UTF-8";
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
private String codebaseUrl;
@Deprecated
public void setCodebaseUrl(String codebaseUrl) {
this.codebaseUrl = codebaseUrl;
}
@Override
public Object fromMessage(Message message) throws MessageConversionException {
Object content = null;
MessageProperties properties = message.getMessageProperties();
if (properties != null) {
String contentType = properties.getContentType();
if (contentType != null && contentType.startsWith("text")) {
String encoding = properties.getContentEncoding();
if (encoding == null) {
encoding = "UTF-8";
}
try {
content = new String(message.getBody(), encoding);
} catch (UnsupportedEncodingException var8) {
throw new MessageConversionException("failed to convert text-based Message content", var8);
}
} else if (contentType != null && contentType.equals("application/x-java-serialized-object")) {
try {
content = SerializationUtils.deserialize(this.createObjectInputStream(new ByteArrayInputStream(message.getBody()), this.codebaseUrl));
} catch (IllegalArgumentException | IllegalStateException | IOException var7) {
throw new MessageConversionException("failed to convert serialized Message content", var7);
}
}
}
Map<String, Object> headers = properties.getHeaders();
HttpHeaders httpHeaders = new HttpHeaders();
for (Map.Entry<String, Object> entry : headers.entrySet()) {
if (StrUtil.equals("Blade-Auth", entry.getKey())
|| StrUtil.equals("Authorization", entry.getKey())
|| StrUtil.equals("blade-auth", entry.getKey())
|| StrUtil.equals("authorization", entry.getKey())) {
List value = (List) entry.getValue();
for (Object o : value) {
httpHeaders.add(entry.getKey(), String.valueOf(o));
}
}
}
ThreadLocalUtil.put("bladeContext", httpHeaders);
Object bladeUser = headers.get("bladeUser");
MockHttpServletRequest request = new MockHttpServletRequest();
BladeUser bladeUser1 = JSONUtil.toBean(bladeUser.toString(), BladeUser.class);
request.setAttribute("_BLADE_USER_REQUEST_ATTR_", bladeUser1);
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
if (content == null) {
content = message.getBody();
}
return content;
}
@Override
protected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException {
byte[] bytes = null;
if (object instanceof byte[]) {
bytes = (byte[]) object;
messageProperties.setContentType("application/octet-stream");
} else if (object instanceof String) {
try {
bytes = ((String) object).getBytes(this.defaultCharset);
} catch (UnsupportedEncodingException var6) {
throw new MessageConversionException("failed to convert to Message content", var6);
}
messageProperties.setContentType("text/plain");
messageProperties.setContentEncoding(this.defaultCharset);
} else if (object instanceof Serializable) {
try {
bytes = SerializationUtils.serialize(object);
} catch (IllegalArgumentException var5) {
throw new MessageConversionException("failed to convert to serialized Message content", var5);
}
messageProperties.setContentType("application/x-java-serialized-object");
}
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
if (headers != null && !headers.isEmpty()) {
headers.forEach((key, values) -> {
values.forEach((value) -> {
messageProperties.setHeader(key, new String[]{value});
});
});
}
BladeUser user = AuthUtil.getUser();
BladeUser bladeUser = new BladeUser();
bladeUser.setTenantId(user.getTenantId());
bladeUser.setUserId(user.getUserId());
bladeUser.setAccount(user.getAccount());
bladeUser.setRoleId(user.getRoleId());
messageProperties.setHeader("bladeUser", JSONUtil.toJsonStr(bladeUser));
if (bytes != null) {
messageProperties.setContentLength((long) bytes.length);
return new Message(bytes, messageProperties);
} else {
throw new IllegalArgumentException(this.getClass().getSimpleName() + " only supports String, byte[] and Serializable payloads, received: " + object.getClass().getName());
}
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = beanClassLoader;
}
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException {
return new CodebaseAwareObjectInputStream(is, this.beanClassLoader, codebaseUrl) {
@Override
protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
Class<?> clazz = super.resolveClass(classDesc);
CustomMessageConverter.this.checkAllowedList(clazz);
return clazz;
}
};
}
}

82
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/ExecutorConfig.java

@ -0,0 +1,82 @@
package com.logpm.factorydata.mengtian.config;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskDecorator;
import org.springframework.http.HttpHeaders;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import javax.annotation.Nonnull;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@Slf4j
@EnableAsync
public class ExecutorConfig {
@Bean
public Executor asyncExecutor() {
log.info("start async executor");
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
// 配置核心线程数
threadPoolTaskExecutor.setCorePoolSize(10);
// 配置最大线程数
threadPoolTaskExecutor.setMaxPoolSize(20);
// 配置队列大小
threadPoolTaskExecutor.setQueueCapacity(50);
// 配置线程池中线程的名称前缀
threadPoolTaskExecutor.setThreadNamePrefix("ASYNC_THREAD_");
// HelloWorldServiceImpl rejection-policy: 当pool已经达到max size时,如何处理新任务:
// CallerRunsPolicy: 不在新线程中执行任务,而是由调用者所在的线程来执行;
// AbortPolicy: 拒绝执行新任务,并抛出RejectedExecutionException异常;
// DiscardPolicy:丢弃当前将要加入队列的任务;
// DiscardOldestPolicy:丢弃任务队列中最旧的任务;
threadPoolTaskExecutor.setRejectedExecutionHandler(
new ThreadPoolExecutor.CallerRunsPolicy()
);
threadPoolTaskExecutor.setTaskDecorator(new ContextCopyingDecorator());
threadPoolTaskExecutor.initialize();
return threadPoolTaskExecutor;
}
static class ContextCopyingDecorator implements TaskDecorator {
@Nonnull
@Override
public Runnable decorate(@Nonnull Runnable runnable) {
RequestAttributes context = RequestContextHolder.currentRequestAttributes();
HttpHeaders headers = (HttpHeaders) ThreadLocalUtil.get("bladeContext");
Map<String, String> mdcMap = MDC.getCopyOfContextMap();
return () -> {
try {
ThreadLocalUtil.put("bladeContext", headers);
if (mdcMap != null && !mdcMap.isEmpty()) {
MDC.setContextMap(mdcMap);
}
RequestContextHolder.setRequestAttributes(context);
DynamicDataSourceContextHolder.push(AuthUtil.getTenantId());
runnable.run();
DynamicDataSourceContextHolder.poll();
} finally {
RequestContextHolder.resetRequestAttributes();
if (mdcMap != null) {
mdcMap.clear();
}
ThreadLocalUtil.clear();
MDC.clear();
}
};
}
}
}

40
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/FactoryDataOloConfiguration.java

@ -0,0 +1,40 @@
/*
* 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.factorydata.mengtian.config;
import com.logpm.factorydata.mengtian.pros.FactoryDataProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* 配置feignmybatis包名properties
*
* @author chaos
*/
@Configuration(proxyBeanMethods = false)
@ComponentScan({"org.springblade", "com.logpm"})
@EnableFeignClients({"org.springblade", "com.logpm"})
@MapperScan({"org.springblade.**.mapper.**", "com.logpm.**.mapper.**"})
@EnableConfigurationProperties(FactoryDataProperties.class)
public class FactoryDataOloConfiguration {
}

35
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/InterceptorAdapterConfig.java

@ -0,0 +1,35 @@
package com.logpm.factorydata.mengtian.config;
import com.logpm.factorydata.mengtian.interceptor.LocalServerLoginAccountsInterceptor;
import lombok.AllArgsConstructor;
import org.springblade.common.component.MockLoginService;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
@AllArgsConstructor
public class InterceptorAdapterConfig implements WebMvcConfigurer {
// private final IFactoryTokenService factoryTokenService;
private final BladeRedis redis;
private final Environment environment;
private final RedisLockClient redisLockClient;
private final MockLoginService mockLoginService;
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
// interceptorRegistry.addInterceptor(new FactoryAccountsInterceptor(factoryTokenService))
// .addPathPatterns("/**")
// .excludePathPatterns("/**/sendMsg")
// .order(2);
interceptorRegistry.addInterceptor(new LocalServerLoginAccountsInterceptor(redis, environment,redisLockClient,mockLoginService))
.addPathPatterns("/**").order(1);
}
}

17
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/RabbitConfig.java

@ -0,0 +1,17 @@
package com.logpm.factorydata.mengtian.config;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class RabbitConfig {
@Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory factory, CustomMessageConverter converter) {
RabbitTemplate template = new RabbitTemplate(factory);
template.setMessageConverter(converter);
return template;
}
}

48
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/controller/OrderController.java

@ -0,0 +1,48 @@
package com.logpm.factorydata.mengtian.controller;
import cn.hutool.json.JSONUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.core.tool.api.R;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 工厂订单 前端控制器
*
* @author zhaoqiaobo
* @create 2024-03-21 19:27
*/
@Slf4j
@RestController
@RequestMapping("/factory/order/v1")
@AllArgsConstructor
@Api(value = "工厂订单", tags = "工厂订单")
public class OrderController {
private final RabbitTemplate rabbitTemplate;
@ResponseBody
@PostMapping("sendMsg")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "推送工厂订单", notes = "推送工厂订单")
public R sendMsg(@RequestBody Map vo) {
log.info("推送工厂订单:{} ", JSONUtil.toJsonStr(vo));
rabbitTemplate.convertAndSend(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH,
FactoryDataConstants.Mq.RoutingKeys.LINSY_NODE_DATA_PUSH, JSONUtil.toJsonStr(vo));
return R.success("成功");
}
}

23
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushOrderDTO.java

@ -0,0 +1,23 @@
package com.logpm.factorydata.mengtian.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 回传订单状态
*
* @author zhaoqiaobo
* @create 2024-05-16
*/
@Data
public class PushOrderDTO implements Serializable {
private String billCode;
private String status;
private List<PushPackageDTO> packages;
}

21
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushPackageDTO.java

@ -0,0 +1,21 @@
package com.logpm.factorydata.mengtian.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 回传包件
*
* @author zhaoqiaobo
* @create 2024-05-16
*/
@Data
public class PushPackageDTO implements Serializable {
/**
* 包条码
*/
private String barcode;
}

89
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/entity/FactoryNodePushEntity.java

@ -0,0 +1,89 @@
package com.logpm.factorydata.mengtian.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springblade.core.mp.base.BaseEntity;
/**
* 节点数据推送成功数据
*
* @Author zqb
* @Date 2024/3/26
**/
@Builder
@Data
@TableName("mt_factory_node_push")
@ApiModel(value = "节点数据推送成功数据", description = "节点数据推送成功数据")
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class FactoryNodePushEntity extends BaseEntity {
/**
* 预留1
*/
@ApiModelProperty(name = "预留1", notes = "")
private String reserve1;
/**
* 预留2
*/
@ApiModelProperty(name = "预留2", notes = "")
private String reserve2;
/**
* 预留3
*/
@ApiModelProperty(name = "预留3", notes = "")
private String reserve3;
/**
* 预留4
*/
@ApiModelProperty(name = "预留4", notes = "")
private String reserve4;
/**
* 预留5
*/
@ApiModelProperty(name = "预留5", notes = "")
private String reserve5;
/**
* 发货单编号
*/
@ApiModelProperty(name = "发货单编号", notes = "")
private String senderCode;
/**
* 订单号
*/
@ApiModelProperty(name = "订单号", notes = "")
private String orderCode;
/**
* 节点
*/
@ApiModelProperty(name = "节点", notes = "")
private String node;
/**
* 包条码
*/
@ApiModelProperty(name = "包条码", notes = "")
private String packageCode;
/**
* 节点名称
*/
@ApiModelProperty(name = "节点名称", notes = "")
private String nodeName;
/**
* 内容
*/
@ApiModelProperty(name = "内容", notes = "")
private String content;
/**
* 返回值
*/
@ApiModelProperty(name = "返回值", notes = "")
private String resultContent;
}

60
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/FactoryNodeEnums.java

@ -0,0 +1,60 @@
package com.logpm.factorydata.mengtian.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/**
* 工厂节点枚举
*
* @author zhaoqiaobo
* @create 2024-03-20 15:19
*/
@Getter
public enum FactoryNodeEnums {
/**
* 收货
*/
CENTRAL_STK_IN(101020, "收货", 1),
/**
* 确认收货
*/
CENTRAL_STK_IN_CONFIRM(105010, "确认收货", 1),
/**
* 签收扫描
*/
SIGN_FOR(105020, "签收扫描", 1),
/**
* 确认签收
*/
SIGN_FOR_CONFIRM(105040, "确认签收", 1),
;
private Integer code;
private String text;
private Integer mustPush;
FactoryNodeEnums(Integer code, String text, Integer mustPush) {
this.code = code;
this.text = text;
this.mustPush = mustPush;
}
/**
* 获取所有必推节点的编码
*
* @return
*/
public static List<Integer> getMustPushCode() {
List<Integer> list = new ArrayList<>();
for (FactoryNodeEnums value : FactoryNodeEnums.values()) {
if (value.getMustPush() == 1) {
list.add(value.getCode());
}
}
return list;
}
}

73
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeMappingEnums.java

@ -0,0 +1,73 @@
package com.logpm.factorydata.mengtian.enums;
import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;
import org.springblade.common.constant.WorkNodeEnums;
/**
* 系统和工厂节点映射枚举
*
* @author zhaoqiaobo
* @create 2024-03-20 15:19
*/
@Getter
public enum NodeMappingEnums {
/**
* 收货
*/
CENTRAL_STK_IN_INITIAL_DEPART(FactoryNodeEnums.CENTRAL_STK_IN, WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY, 1),
CENTRAL_STK_IN_TRANSFER_DEPART(FactoryNodeEnums.CENTRAL_STK_IN, WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE, 1),
/**
* 确认收货
*/
CENTRAL_STK_IN_CONFIRM(FactoryNodeEnums.CENTRAL_STK_IN_CONFIRM, WorkNodeEnums.TRANSFER_WAREHOUSE_UNLOADING, 1),
CENTRAL_STK_IN_CONFIRM_END(FactoryNodeEnums.CENTRAL_STK_IN_CONFIRM, WorkNodeEnums.END_WAREHOUSE_UNLOADING, 1),
/**
* 签收扫描
*/
SIGN_FOR(FactoryNodeEnums.SIGN_FOR, WorkNodeEnums.DISTRIBUTION_SIGN_FOR, 1),
SIGN_FOR_ZT(FactoryNodeEnums.SIGN_FOR, WorkNodeEnums.SIGN_BILLOFLADING, 1),
/**
* 确认签收
*/
SIGN_FOR_CONFIRM(FactoryNodeEnums.SIGN_FOR_CONFIRM, WorkNodeEnums.CLERK_REVIEW, 1);
/**
* 系统作业节点
*/
private WorkNodeEnums workNodeEnums;
/**
* 工厂作业节点
*/
private FactoryNodeEnums factoryNodeEnums;
/**
* 状态码
* 存在我们系统同一个作业节点对应工厂多个节点的情况通过状态码区分
*/
private Integer status;
NodeMappingEnums(FactoryNodeEnums factoryNodeEnums, WorkNodeEnums workNodeEnums, Integer status) {
this.workNodeEnums = workNodeEnums;
this.factoryNodeEnums = factoryNodeEnums;
this.status = status;
}
public static FactoryNodeEnums getFactoryByNodeAndStatus(WorkNodeEnums workNodeEnums) {
return getFactoryByNodeAndStatus(workNodeEnums, 1);
}
public static FactoryNodeEnums getFactoryByNodeAndStatus(WorkNodeEnums workNodeEnums, Integer status) {
NodeMappingEnums[] values = values();
for (NodeMappingEnums value : values) {
WorkNodeEnums workNodeEnums1 = value.getWorkNodeEnums();
Integer status1 = value.getStatus();
FactoryNodeEnums factoryNodeEnums = value.getFactoryNodeEnums();
if (ObjectUtil.equal(workNodeEnums1, workNodeEnums) && ObjectUtil.equal(status1, status)) {
return factoryNodeEnums;
}
}
return null;
}
}

48
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeNeedEnums.java

@ -0,0 +1,48 @@
package com.logpm.factorydata.mengtian.enums;
import lombok.Getter;
import java.io.Serializable;
/**
* 作业节点枚举
*
* @author zhaoqiaobo
* @create 2024-03-20 15:19
*/
@Getter
public enum NodeNeedEnums implements Serializable {
/**
* 始发仓入库
*/
INITIAL_WAREHOUSE_ENTRY(101020, "始发仓入库"),
/** 卸车入库 */
UNLOAD_INCOMING_WAREHOUSE(105010,"卸车入库"),
/** 卸车确认 */
TRANSFER_WAREHOUSE_UNLOADING(105020, "卸车确认"),
/**
* 末端仓卸车确认
*/
END_WAREHOUSE_UNLOADING(105040, "末端仓卸车确认"),
/** 配送签收 */
DISTRIBUTION_SIGN_FOR(302060, "配送签收"),
/** 自提签收 */
SIGN_BILLOFLADING(301050, "自提签收"),
/** 直发商家签收 */
// SIGN_DIRECT_SHIPPER(105030,"直发商家签收"),
/** 三方中转签收 */
// SIGN_TRIPARTITE_TRANSFER_DEPART(104040, "三方中转签收"),
/** 文员复核 */
CLERK_REVIEW(303010, "文员复核")
;
private Integer code;
private String value;
NodeNeedEnums(Integer code, String value) {
this.code = code;
this.value = value;
}
}

96
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/interceptor/LocalServerLoginAccountsInterceptor.java

@ -0,0 +1,96 @@
package com.logpm.factorydata.mengtian.interceptor;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.cache.CacheNames;
import org.springblade.common.component.MockLoginService;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.wrapper.CustomHttpServletRequestWrapper;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.redis.lock.LockType;
import org.springblade.core.redis.lock.RedisLockClient;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ThreadLocalUtil;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpHeaders;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
@Log4j2
@AllArgsConstructor
public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapter {
private final BladeRedis bladeRedis;
private final Environment environment;
private final RedisLockClient redisLockClient;
private final MockLoginService mockLoginService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws CustomerException {
try {
CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
String account ="shujutongbu";
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
boolean flag = redisLockClient.tryLock("local_server_user", LockType.FAIR, 5000, 10000, TimeUnit.MILLISECONDS);
if(flag){
data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+account);
if(Objects.isNull(data)){
data = mockLoginService.mockToken("627683",account);
bladeRedis.setEx(CacheNames.LOCAL_SERVER_USER+account,data,2591990L);
redisLockClient.unLock("local_server_user", LockType.FAIR);
}
}
}
// 修改或添加header
// 发送登录请求
log.info("##########preHandle: request={}", request);
wrappedRequest.addHeader("Blade-Auth", "bearer "+data.getString("access_token"));
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Blade-Auth","bearer "+data.get("access_token") );
httpHeaders.add( "Authorization", "Basic bG9jYWw6bG9jYWxfc2VjcmV0");
ThreadLocalUtil.put("bladeContext", httpHeaders);
// 用包装后的request替换原始request
request = wrappedRequest;
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
return true;
} catch (Exception e) {
returnJson(response, JSONObject.toJSONString(R.fail(500, "服务异常,请联系管理员")));
return false;
}
}
private void returnJson(HttpServletResponse response, String json) {
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
try {
writer = response.getWriter();
writer.print(json);
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
if (writer != null) {
writer.close();
}
}
}
}

60
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/launcher/FactoryDataBaseLauncherServiceImpl.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.factorydata.mengtian.launcher;
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 FactoryDataBaseLauncherServiceImpl 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(appName, 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;
}
}

16
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.java

@ -0,0 +1,16 @@
package com.logpm.factorydata.mengtian.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factorydata.mengtian.entity.FactoryNodePushEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 装箱包信息 mapper
*
* @author zqb
* @since 2024-03-26
*/
@Mapper
public interface FactoryNodePushMapper extends BaseMapper<FactoryNodePushEntity> {
}

5
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factorydata.mengtian.mapper.FactoryNodePushMapper">
</mapper>

259
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mq/NodeDataPushListener.java

@ -0,0 +1,259 @@
package com.logpm.factorydata.mengtian.mq;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.EnumUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.factory.mt.dto.MtPushDataDTO;
import com.logpm.factory.mt.feign.MtFactoryDataClient;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.mengtian.enums.FactoryNodeEnums;
import com.logpm.factorydata.mengtian.enums.NodeMappingEnums;
import com.logpm.factorydata.mengtian.enums.NodeNeedEnums;
import com.logpm.factorydata.mengtian.pros.MengTianProperties;
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmOrderVO;
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmPackageVO;
import com.logpm.factorydata.mengtian.vo.CentralStkInConfirmVO;
import com.logpm.factorydata.mengtian.vo.CentralStkInVO;
import com.logpm.factorydata.mengtian.vo.SignForConfirmImageVO;
import com.logpm.factorydata.mengtian.vo.SignForConfirmPackageVO;
import com.logpm.factorydata.mengtian.vo.SignForConfirmVO;
import com.logpm.factorydata.mengtian.vo.SignForVO;
import com.logpm.factorydata.vo.PushData;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 监听业务系统推送给志邦的节点数据
*
* @author zhaoqiaobo
* @create 2024-03-18 0:02
*/
@Slf4j
@Component
@AllArgsConstructor
public class NodeDataPushListener {
private final IFactoryDataClient factoryDataClient;
private final MtFactoryDataClient mtFactoryDataClient;
private final MengTianProperties mengTianProperties;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FactoryDataConstants.Mq.Queues.MENGTIAN_NODE_DATA_PUSH, durable = "true"),
exchange = @Exchange(name = FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH, type = ExchangeTypes.TOPIC),
key = FactoryDataConstants.Mq.RoutingKeys.MENGTIAN_NODE_DATA_PUSH
))
@Transactional(rollbackFor = Exception.class)
public void nodeDataPush(String msg) {
// {"brand":"ZBOM","node":"TRANSFER_WAREHOUSE_DEPART","operator":"","operatorTime":"","content":[{"packageCode":"1423090693445"}]}
log.info("接收到节点数据推送:{}", msg);
// 1 校验数据
if (checkData(msg)) {
return;
}
JSONObject entries = JSONUtil.parseObj(msg);
// 节点
String node = entries.getStr("node");
String operatorTime = entries.getStr("operatorTime");
String startWarehouse = entries.getStr("startWarehouse");
String warehouse = entries.getStr("warehouse");
String endWarehouse = entries.getStr("endWarehouse");
String inWarehouseType = "";
WorkNodeEnums workNodeEnums = EnumUtil.fromString(WorkNodeEnums.class, node);
if (workNodeEnums.equals(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)) {
inWarehouseType = "始发入库";
} else if (StrUtil.equals(endWarehouse, warehouse)) {
inWarehouseType = "目的入库";
} else {
inWarehouseType = "中转入库";
}
// 2 获取业务数据
List<PushData> content = entries.getBeanList("content", PushData.class);
FactoryNodeEnums factoryByNodeAndStatus = NodeMappingEnums.getFactoryByNodeAndStatus(workNodeEnums);
List<MtPushDataDTO> mtPushDataDTOS = mtFactoryDataClient.orderPushData(content.stream().map(m -> m.getOrderCode()).collect(Collectors.toSet()));
// 收货
if (factoryByNodeAndStatus.equals(FactoryNodeEnums.CENTRAL_STK_IN)) {
if (CollUtil.isNotEmpty(mtPushDataDTOS)) {
// 转map
Map<String, MtPushDataDTO> mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO));
String finalInWarehouseType = inWarehouseType;
List<CentralStkInVO> collect = content.stream().map(pushData -> {
MtPushDataDTO mtPushDataDTO = mtPushDataDTOMap.get(pushData.getOrderCode());
if (ObjectUtil.isNotEmpty(mtPushDataDTO)) {
return CentralStkInVO.builder()
.dealerName(mtPushDataDTO.getDealerName())
.inWarehouseType(finalInWarehouseType)
.operatingTime(operatorTime)
.operatingWarehouseName(warehouse)
.orderCode(pushData.getOrderCode())
.outWarehouseType(mtPushDataDTO.getOutWarehouseType())
.packageCode(pushData.getPackageCode())
.senderCode(mtPushDataDTO.getSenderCode())
.warehouseCode(mtPushDataDTO.getWarehouseCode())
.build();
}
return null;
}).collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
for (CentralStkInVO centralStkInVO : collect) {
// 按包件维度推送
sendFactory(JSONUtil.toJsonStr(centralStkInVO), "mt.poc.ht_yc_noms.CentralStkIn", mengTianProperties.getCentralStkInUrl());
}
}
}
}
// 收货确认
if (factoryByNodeAndStatus.equals(FactoryNodeEnums.CENTRAL_STK_IN_CONFIRM)) {
// 按发货单编号推送
// mtPushDataDTOS按发货单分组
Map<String, List<MtPushDataDTO>> collect = mtPushDataDTOS.stream().collect(Collectors.groupingBy(MtPushDataDTO::getSenderCode));
if (CollUtil.isNotEmpty(collect)) {
for (Map.Entry<String, List<MtPushDataDTO>> stringListEntry : collect.entrySet()) {
String senderCode = stringListEntry.getKey();
List<MtPushDataDTO> mtPushDataDTOS1 = stringListEntry.getValue();
CentralStkInConfirmVO confirmVO = CentralStkInConfirmVO.builder()
.senderCode(senderCode)
.operatingTime(operatorTime)
.operatingWarehouseName(warehouse)
.inWarehouseType(inWarehouseType)
.orderVOS(
mtPushDataDTOS1.stream().map(mtPushDataDTO -> {
return CentralStkInConfirmOrderVO.builder()
.orderCode(mtPushDataDTO.getOrderCode())
.packageVOS(
content.stream()
.filter(pushData -> StrUtil.equals(pushData.getOrderCode(), mtPushDataDTO.getOrderCode()))
.map(pushData -> {
return CentralStkInConfirmPackageVO.builder()
.packageCode(pushData.getPackageCode())
.build();
})
.collect(Collectors.toList())
)
.build();
}).collect(Collectors.toList())
).build();
sendFactory(JSONUtil.toJsonStr(confirmVO), "mt.poc.ht_yc_noms.CentralStkInConfirm", mengTianProperties.getCentralStkInConfirmUrl());
}
}
}
// 签收扫描
if (factoryByNodeAndStatus.equals(FactoryNodeEnums.SIGN_FOR)) {
Map<String, MtPushDataDTO> mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO));
// 表单数据
String main = entries.getStr("main");
JSONObject entries1 = JSONUtil.parseObj(main);
List<SignForVO> signForVOS = content.stream().map(pushData -> {
MtPushDataDTO mtPushDataDTO = mtPushDataDTOMap.get(pushData.getOrderCode());
if (ObjectUtil.isNotEmpty(mtPushDataDTO)) {
return SignForVO.builder()
.sendTaskId(entries1.getStr("boId"))
.senderCode(mtPushDataDTO.getSenderCode())
.orderCode(pushData.getOrderCode())
.warehouseCode(mtPushDataDTO.getWarehouseCode())
.operatingWarehouseName(warehouse)
.packageCode(pushData.getPackageCode())
.operatingTime(operatorTime)
.build();
}
return null;
}).collect(Collectors.toList());
if (CollUtil.isNotEmpty(signForVOS)) {
for (SignForVO signForVO : signForVOS) {
sendFactory(JSONUtil.toJsonStr(signForVO), "mt.poc.ht_yc_noms.SignFor", mengTianProperties.getSignForUrl());
}
}
}
// 签收确认
if (factoryByNodeAndStatus.equals(FactoryNodeEnums.SIGN_FOR_CONFIRM)) {
String main = entries.getStr("main");
JSONObject entries1 = JSONUtil.parseObj(main);
String images = entries1.getStr("images");
JSONArray objects = new JSONArray(images);
List<SignForConfirmImageVO> imageVOS = objects.stream()
.filter(m -> !m.toString().contains("blob"))
.map(m ->{
return SignForConfirmImageVO.builder().image(m.toString()).build();
}).collect(Collectors.toList());
Map<String, MtPushDataDTO> mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO));
SignForConfirmVO confirmVO = SignForConfirmVO.builder()
.sendTaskId(entries1.getStr("boId"))
.consignee(entries1.getStr("consignee"))
.operatingWarehouseName(warehouse)
.packageVOS(content.stream().map(
pushData -> {
return SignForConfirmPackageVO.builder()
.orderCode(pushData.getOrderCode())
.packageCode(pushData.getPackageCode())
.operatingTime(operatorTime)
.warehouseCode(mtPushDataDTOMap.get(pushData.getOrderCode()).getWarehouseCode())
.operatingWarehouseName(warehouse)
.senderCode(mtPushDataDTOMap.get(pushData.getOrderCode()).getSenderCode())
.build();
}
).collect(Collectors.toList()))
.imageVOS(imageVOS)
.build();
sendFactory(JSONUtil.toJsonStr(confirmVO), "mt.poc.ht_yc_noms.SignForConfirm", mengTianProperties.getSignForConfirmUrl());
}
}
private void sendFactory(String body, String operationCode, String url) {
log.info("推送工厂:{}", body);
HttpRequest post = HttpUtil.createPost(mengTianProperties.getHost() + url);
post.header("ClientId", "mt.ht");
post.header("OperationCode", operationCode);
post.body(body);
HttpResponse execute = post.execute();
String resBody = execute.body();
log.info("推送工厂结果:{}", resBody);
}
private boolean checkData(String msg) {
if (StrUtil.isEmpty(msg)) {
return true;
}
if (!msg.contains("brand") || !msg.contains("content") || !msg.contains("node")) {
return true;
}
JSONObject entries = JSONUtil.parseObj(msg);
String node = entries.getStr("node");
if (StrUtil.isEmpty(node)) {
return true;
}
// 不是志邦需要的节点数据直接不处理
if (!EnumUtil.contains(NodeNeedEnums.class, node)) {
return true;
}
WorkNodeEnums workNodeEnums = EnumUtil.fromString(WorkNodeEnums.class, node);
if (ObjectUtil.isEmpty(workNodeEnums)) {
return true;
}
List<JSONObject> content = entries.getBeanList("content", JSONObject.class);
if (CollUtil.isEmpty(content)) {
return true;
}
return false;
}
}

20
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/FactoryDataProperties.java

@ -0,0 +1,20 @@
package com.logpm.factorydata.mengtian.pros;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "logpm")
public class FactoryDataProperties {
/**
* 名称
*/
private String name;
}

56
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/MengTianProperties.java

@ -0,0 +1,56 @@
package com.logpm.factorydata.mengtian.pros;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* FactoryProperties
*
* @author pref
*/
@Data
@ConfigurationProperties(prefix = "mt")
@Component
public class MengTianProperties {
/**
* 收货 url
*/
private String centralStkInUrl;
/** 确认收货 url */
private String centralStkInConfirmUrl;
/** 签收扫描 url */
private String signForUrl;
/** 确认签收 url */
private String signForConfirmUrl;
/**
* 是否推送工厂
*/
private Boolean enable = true;
/**
* 梦天工厂主机地址
*/
private String host;
/**
* 补节点数据时的延时时间分钟
*/
private Integer delayedTime = 30;
/** 生成老系统暂存单 */
private Boolean oldAdvance = false;
/** 生成新系统暂存单 */
private Boolean newAdvance = false;
/** 老系统host */
private String oldSystemHost;
/** 老系统暂存单url */
private String oldSystemAdvanceUrl;
/** 老系统取消暂存单url */
private String oldSystemCancelAdvanceUrl;
}

14
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/FactoryNodePushService.java

@ -0,0 +1,14 @@
package com.logpm.factorydata.mengtian.service;
import com.logpm.factorydata.mengtian.entity.FactoryNodePushEntity;
import org.springblade.core.mp.base.BaseService;
/**
* 推送工厂节点数据 服务类
*
* @Author zqb
* @Date 2024/4/26
**/
public interface FactoryNodePushService extends BaseService<FactoryNodePushEntity> {
}

22
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/impl/FactoryNodePushServiceImpl.java

@ -0,0 +1,22 @@
package com.logpm.factorydata.mengtian.service.impl;
import com.logpm.factorydata.mengtian.entity.FactoryNodePushEntity;
import com.logpm.factorydata.mengtian.mapper.FactoryNodePushMapper;
import com.logpm.factorydata.mengtian.service.FactoryNodePushService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* 装箱包信息 业务实现类
*
* @Author zqb
* @Date 2024/4/26
**/
@Slf4j
@Service
@AllArgsConstructor
public class FactoryNodePushServiceImpl extends BaseServiceImpl<FactoryNodePushMapper, FactoryNodePushEntity> implements FactoryNodePushService {
}

32
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmOrderVO.java

@ -0,0 +1,32 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 收货确认订单 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "收货确认订单", description = "收货确认订单")
@Builder
public class CentralStkInConfirmOrderVO implements Serializable {
@ApiModelProperty("订单号")
@JsonProperty("订单号")
private String orderCode;
@ApiModelProperty("包件列表")
@JsonProperty("包件列表")
private List<CentralStkInConfirmPackageVO> packageVOS;
}

26
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmPackageVO.java

@ -0,0 +1,26 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 收货确认包件 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "收货确认包件", description = "收货确认包件")
@Builder
public class CentralStkInConfirmPackageVO implements Serializable {
@ApiModelProperty("包条码")
@JsonProperty("包条码")
private String packageCode;
}

45
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmVO.java

@ -0,0 +1,45 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 收货确认 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "收货确认", description = "收货确认")
@Builder
public class CentralStkInConfirmVO implements Serializable {
@ApiModelProperty("发货单编号")
@JsonProperty("发货单编号")
private String senderCode;
@ApiModelProperty("确认收货时间")
@JsonProperty("确认收货时间")
private String operatingTime;
@ApiModelProperty("入库方式")
@JsonProperty("入库方式")
private String inWarehouseType;
@ApiModelProperty("作业仓库")
@JsonProperty("作业仓库")
private String operatingWarehouseName;
@ApiModelProperty("订单列表")
@JsonProperty("订单列表")
private List<CentralStkInConfirmOrderVO> orderVOS;
}

58
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInVO.java

@ -0,0 +1,58 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 收货 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "收货", description = "收货")
@Builder
public class CentralStkInVO implements Serializable {
@ApiModelProperty("发货单编号")
@JsonProperty("发货单编号")
private String senderCode;
@ApiModelProperty("订单编号")
@JsonProperty("订单编号")
private String orderCode;
@ApiModelProperty("包条码")
@JsonProperty("包条码")
private String packageCode;
@ApiModelProperty("操作时间")
@JsonProperty("操作时间")
private String operatingTime;
@ApiModelProperty("仓库编号")
@JsonProperty("仓库编号")
private String warehouseCode;
@ApiModelProperty("经销商名称")
@JsonProperty("经销商名称")
private String dealerName;
@ApiModelProperty("入库方式")
@JsonProperty("入库方式")
private String inWarehouseType;
@ApiModelProperty("工厂出库方式")
@JsonProperty("工厂出库方式")
private String outWarehouseType;
@ApiModelProperty("作业仓库")
@JsonProperty("作业仓库")
private String operatingWarehouseName;
}

26
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmImageVO.java

@ -0,0 +1,26 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 签收确认图片 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@Builder
@ApiModel(value = "签收确认图片", description = "签收确认图片")
public class SignForConfirmImageVO implements Serializable {
@ApiModelProperty("image")
@JsonProperty("image")
private String image;
}

48
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmPackageVO.java

@ -0,0 +1,48 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 签收确认包件 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@Builder
@ApiModel(value = "签收确认包件", description = "签收确认包件")
public class SignForConfirmPackageVO implements Serializable {
@ApiModelProperty("发货单编号")
@JsonProperty("发货单编号")
private String senderCode;
@ApiModelProperty("订单编号")
@JsonProperty("订单编号")
private String orderCode;
@ApiModelProperty("包条码")
@JsonProperty("包条码")
private String packageCode;
@ApiModelProperty("签收时间")
@JsonProperty("签收时间")
private String operatingTime;
@ApiModelProperty("仓库编号")
@JsonProperty("仓库编号")
private String warehouseCode;
@ApiModelProperty("作业仓库")
@JsonProperty("作业仓库")
private String operatingWarehouseName;
}

42
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmVO.java

@ -0,0 +1,42 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 签收确认 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@Builder
@ApiModel(value = "签收确认", description = "签收确认")
public class SignForConfirmVO implements Serializable {
@ApiModelProperty("送货任务ID")
@JsonProperty("送货任务ID")
private String sendTaskId;
@ApiModelProperty("收货人")
@JsonProperty("收货人")
private String consignee;
@ApiModelProperty("作业仓库")
@JsonProperty("作业仓库")
private String operatingWarehouseName;
@ApiModelProperty("签收内容")
@JsonProperty("签收内容")
private List<SignForConfirmPackageVO> packageVOS;
@ApiModelProperty("签收图片")
@JsonProperty("签收图片")
private List<SignForConfirmImageVO> imageVOS;
}

50
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForVO.java

@ -0,0 +1,50 @@
package com.logpm.factorydata.mengtian.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 签收 实体类
*
* @author zhaoqiaobo
* @create 2024-04-26
*/
@Data
@ApiModel(value = "签收", description = "签收")
@Builder
public class SignForVO implements Serializable {
@ApiModelProperty("送货任务ID")
@JsonProperty("送货任务ID")
private String sendTaskId;
@ApiModelProperty("发货单编号")
@JsonProperty("发货单编号")
private String senderCode;
@ApiModelProperty("订单编号")
@JsonProperty("订单编号")
private String orderCode;
@ApiModelProperty("包条码")
@JsonProperty("包条码")
private String packageCode;
@ApiModelProperty("扫描时间")
@JsonProperty("扫描时间")
private String operatingTime;
@ApiModelProperty("仓库编号")
@JsonProperty("仓库编号")
private String warehouseCode;
@ApiModelProperty("作业仓库")
@JsonProperty("作业仓库")
private String operatingWarehouseName;
}

73
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-dev.yml

@ -0,0 +1,73 @@
#服务器端口
server:
port: 18980
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#rabbitmq配置
rabbitmq:
host: 192.168.2.46
port: 5672
username: admin
password: admin
#虚拟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
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure,com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.master.url}
username: ${blade.datasource.factorydata-mengtian.master.username}
password: ${blade.datasource.factorydata-mengtian.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.627683.url}
username: ${blade.datasource.factorydata-mengtian.627683.username}
password: ${blade.datasource.factorydata-mengtian.627683.password}
blade:
data-scope:
enabled: false

47
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-prod.yml

@ -0,0 +1,47 @@
#服务器端口
server:
port: 18980
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure,com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.master.url}
username: ${blade.datasource.factorydata-mengtian.master.username}
password: ${blade.datasource.factorydata-mengtian.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.627683.url}
username: ${blade.datasource.factorydata-mengtian.627683.username}
password: ${blade.datasource.factorydata-mengtian.627683.password}
blade:
data-scope:
enabled: false

73
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-test.yml

@ -0,0 +1,73 @@
#服务器端口
server:
port: 18980
#数据源配置
#spring:
# datasource:
# url: ${blade.datasource.dev.url}
# username: ${blade.datasource.dev.username}
# password: ${blade.datasource.dev.password}
spring:
#rabbitmq配置
rabbitmq:
host: 192.168.2.110
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
#排除DruidDataSourceAutoConfigure
autoconfigure:
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure,com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration
datasource:
dynamic:
druid:
#通用校验配置
validation-query: select 1
#启用sql日志拦截器
proxy-filters:
- sqlLogInterceptor
#设置默认的数据源或者数据源组,默认值即为master
primary: master
datasource:
master:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.master.url}
username: ${blade.datasource.factorydata-mengtian.master.username}
password: ${blade.datasource.factorydata-mengtian.master.password}
627683:
druid:
#独立校验配置
validation-query: select 1
#oracle校验
#validation-query: select 1 from dual
url: ${blade.datasource.factorydata-mengtian.627683.url}
username: ${blade.datasource.factorydata-mengtian.627683.username}
password: ${blade.datasource.factorydata-mengtian.627683.password}
blade:
data-scope:
enabled: false

19
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application.yml

@ -0,0 +1,19 @@
#mybatis-plus配置
mybatis-plus:
mapper-locations: classpath:com/logpm/**/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.logpm.**.entity
#swagger扫描路径配置
swagger:
base-packages:
- org.springblade
- com.logpm
logging:
config: classpath:logback.xml
spring:
main:
allow-circular-references: true

40
blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/logback.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" debug="false">
<contextName>logback</contextName>
<property name="log.path" value="./data/logpm-basic/logs/logs.log"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
</root>
</configuration>

1
blade-service/logpm-factory-data/pom.xml

@ -19,6 +19,7 @@
<module>logpm-factory-data-jinpai</module>
<module>logpm-factory-data-linsy</module>
<module>logpm-factory-data-mwh</module>
<module>logpm-factory-data-mengtian</module>
</modules>
<properties>

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/MtOrderLogFailRetryJob.java

@ -4,7 +4,6 @@ package com.logpm.factory.jobhandler;
import com.logpm.factory.mt.entity.MtOrderLogEntity;
import com.logpm.factory.mt.mapper.MtOrderLogFailRetryMapper;
import com.logpm.factory.mt.service.MtOrderLogFailRetryService;
import com.logpm.factory.oupai.entity.OpFailRetryPushPackageEntity;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;

30
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClinet.java

@ -0,0 +1,30 @@
package com.logpm.factory.mt.feign;
import cn.hutool.core.collection.CollUtil;
import com.logpm.factory.mt.dto.MtPushDataDTO;
import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Set;
@ApiIgnore
@RestController
@AllArgsConstructor
@Slf4j
public class MtFactoryDataClinet implements MtFactoryDataClient {
private final MtFactoryOrderMainMapper mainMapper;
@Override
public List<MtPushDataDTO> orderPushData(Set<String> orderCodes) {
if(CollUtil.isEmpty(orderCodes)){
return null;
}
return mainMapper.orderPushData(orderCodes);
}
}

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java

@ -1,14 +1,15 @@
package com.logpm.factory.mt.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.mt.dto.MtPushDataDTO;
import com.logpm.factory.mt.entity.MtFactoryOrderMain;
import com.logpm.factory.mt.vo.MtFactoryOrderMainVO;
import com.logpm.factory.snm.vo.MTOrderPackageRelationVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface MtFactoryOrderMainMapper extends BaseMapper<MtFactoryOrderMain> {
@ -26,4 +27,5 @@ public interface MtFactoryOrderMainMapper extends BaseMapper<MtFactoryOrderMain>
List<MtFactoryOrderMain> selectMtFactoryOrderMainByPushType(IPage page, @Param("mtFactoryOrderMain") MtFactoryOrderMainVO mtFactoryOrderMain);
List<MtPushDataDTO> orderPushData(@Param("orderCodes") Set<String> orderCodes);
}

15
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml

@ -101,4 +101,19 @@
order by temp.create_time desc
</select>
<select id="orderPushData" resultType="com.logpm.factory.mt.dto.MtPushDataDTO">
select t.order_code orderCode,
m.invoice_order_code senderCode,
t.outbound_type outWarehouseType,
t.dealer_name dealerName,
m.center_warehouse_code warehouseCode
from mt_factory_order t
left join mt_factory_order_main m on m.id = t.main_id
where t.order_code in (
<foreach collection="orderCodes" item="orderCode" separator=",">
#{orderCode}
</foreach>
)
;
</select>
</mapper>

12
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/dto/LoadScanBrandDTO.java

@ -30,4 +30,16 @@ public class LoadScanBrandDTO implements Serializable {
* 始发仓
*/
private String startWarehouseId;
/**
* 始发仓
*/
private String startWarehouseName;
/**
* 目的仓
*/
private String endWarehouseId;
/**
* 目的仓
*/
private String endWarehouseName;
}

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml

@ -580,13 +580,15 @@
</select>
<select id="fingPackageCodeByLoadId" resultType="com.logpm.trunkline.dto.LoadScanBrandDTO">
select dpl.brand_name brand,dpl.order_code,dpl.waybill_number,
dpl.send_warehouse_id startWarehouseId,
dpl.send_warehouse_id startWarehouseId,dpl.send_warehouse_name startWarehouseName,
dpl.accept_warehouse_id endWarehouseId,dpl.accept_warehouse_name endWarehouseName,
group_concat(dpl.order_package_code) packageCode
from logpm_trunkline_cars_load_scan t
left join logpm_distribution_parcel_list dpl on dpl.order_package_code = t.scan_code and dpl.warehouse_id = #{warehouseId}
where t.load_id = #{loadId}
and dpl.id is not null
group by dpl.brand_name,dpl.accept_warehouse_id,dpl.order_code,dpl.waybill_number
group by dpl.brand_name,dpl.send_warehouse_id,dpl.send_warehouse_name ,
dpl.accept_warehouse_id ,dpl.accept_warehouse_name ,dpl.order_code,dpl.waybill_number
</select>
<update id="updateWaybillOrderIsCustemer">

1
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java

@ -750,6 +750,7 @@ public class InComingServiceImpl implements IInComingService {
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.warehouse(warehouseName)
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(advanceDetailEntity.getBrand()))
.node(WorkNodeEnums.INITIAL_WAREHOUSE_ENTRY)

16
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -404,6 +404,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
.address(warehouseAddress)
.brand(BrandEnums.getByValue(brand.getBrand()))
.node(node)
.warehouse(warehouseEntity.getName())
.startWarehouse(brand.getStartWarehouseName())
.endWarehouse(brand.getEndWarehouseName())
.content(StrUtil.split(packageCode, ",").stream().map(data->{
return PushData.builder()
.packageCode(data)
@ -4371,6 +4374,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.warehouse(warehouseName)
.startWarehouse(entity.getSendWarehouseName())
.endWarehouse(entity.getAcceptWarehouseName())
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(entity.getBrandName()))
.node(WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE)
@ -7291,10 +7297,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.warehouse(warehouseName)
.startWarehouse(ObjectUtil.isNotEmpty(parcelListEntity) ? parcelListEntity.getSendWarehouseName():"")
.endWarehouse(ObjectUtil.isNotEmpty(parcelListEntity) ? parcelListEntity.getAcceptWarehouseName():"")
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(distributionParcelListEntity.getBrandName()))
.node(WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE)
@ -7955,10 +7964,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Map<String, Object> map = new HashMap<>();
map.put("messageData", JSONUtil.toJsonStr(orderStatusDTO));
rabbitTemplate.convertAndSend(RabbitConstant.HWY_ORDER_STATUS_EXCHANGE, RabbitConstant.HWY_ORDER_STATUS_ROUTING, map);
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
NodePushMsg nodePushMsg = NodePushMsg.builder()
.operator(AuthUtil.getNickName())
.operatorTime(new Date())
.warehouse(warehouseName)
.startWarehouse(ObjectUtil.isNotEmpty(parcelListEntity) ? parcelListEntity.getSendWarehouseName():"")
.endWarehouse(ObjectUtil.isNotEmpty(parcelListEntity) ? parcelListEntity.getAcceptWarehouseName():"")
.address("在【" + warehouseName + "】入库")
.brand(BrandEnums.getByValue(distributionParcelListEntity.getBrandName()))
.node(WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE)

Loading…
Cancel
Save