diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index d54a35e6d..d60420fe5 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/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; /** * 欧派工厂数据模块 */ diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/dto/MtPushDataDTO.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/dto/MtPushDataDTO.java new file mode 100644 index 000000000..994324f3a --- /dev/null +++ b/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; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClient.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClient.java new file mode 100644 index 000000000..f656f2b99 --- /dev/null +++ b/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 orderPushData(@RequestParam("orderCode") Set orderCodes); + + + + +} diff --git a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java index 6b3f206e9..30a338e54 100644 --- a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java +++ b/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); } diff --git a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/NodePushMsg.java b/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/NodePushMsg.java index f2f6ed2e2..dc1292430 100644 --- a/blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/vo/NodePushMsg.java +++ b/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; @@ -43,13 +43,29 @@ public class NodePushMsg implements Serializable { /** * 操作时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private Date operatorTime; /** * 当前地址 */ private String address; + + /** + * 开单始发仓 + */ + private String startWarehouse; + + /** + * 当前仓 + */ + private String warehouse; + + /** + * 开单目的仓 + */ + private String endWarehouse; + /** * 文员复核环节状态(部分签收/全部签收) */ diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index 07e9dbd37..0a8a19904 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/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("欧派"))) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java index 0a678802b..10b9d98cd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java +++ b/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); + } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/Dockerfile b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/Dockerfile new file mode 100644 index 000000000..f30cbbc8f --- /dev/null +++ b/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"] diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/pom.xml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/pom.xml new file mode 100644 index 000000000..0fca386c7 --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/pom.xml @@ -0,0 +1,98 @@ + + 4.0.0 + + org.springblade + logpm-factory-data + 3.2.0.RELEASE + + logpm-factory-data-mengtian + + 8 + 8 + + + + + org.springblade + blade-core-boot + + + org.springblade + blade-core-auto + provided + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springblade + logpm-factory-data-api + 3.2.0.RELEASE + + + com.xuxueli + xxl-job-core + + + org.springblade + blade-starter-swagger + + + org.springblade + logpm-trunkline-api + 3.2.0.RELEASE + + + org.springblade + logpm-factory-data-base-api + ${bladex.project.version} + + + org.springblade + blade-starter-oss + + + io.minio + minio + + + org.springblade + blade-resource-api + 3.2.0.RELEASE + compile + + + org.springblade + logpm-factory-api + 3.2.0.RELEASE + + + + + + + + com.spotify + dockerfile-maven-plugin + + ${docker.username} + ${docker.password} + ${docker.registry.url}/${docker.namespace}/${project.artifactId} + ${project.version} + true + + target/${project.build.finalName}.jar + + false + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/FactoryDataMengTianApplication.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/FactoryDataMengTianApplication.java new file mode 100644 index 000000000..5c931c65f --- /dev/null +++ b/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); + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/AsyncAnnotationAspect.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/AsyncAnnotationAspect.java new file mode 100644 index 000000000..81afc9bea --- /dev/null +++ b/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; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/RabbitAnnotationAspect.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/aspect/RabbitAnnotationAspect.java new file mode 100644 index 000000000..13397e875 --- /dev/null +++ b/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; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/CustomMessageConverter.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/CustomMessageConverter.java new file mode 100644 index 000000000..61c7b8c1b --- /dev/null +++ b/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 headers = properties.getHeaders(); + HttpHeaders httpHeaders = new HttpHeaders(); + for (Map.Entry 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; + } + }; + } +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/ExecutorConfig.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/ExecutorConfig.java new file mode 100644 index 000000000..59a2ae9fd --- /dev/null +++ b/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 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(); + } + }; + } + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/FactoryDataOloConfiguration.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/FactoryDataOloConfiguration.java new file mode 100644 index 000000000..c7e101105 --- /dev/null +++ b/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; + +/** + * 配置feign、mybatis包名、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 { + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/InterceptorAdapterConfig.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/InterceptorAdapterConfig.java new file mode 100644 index 000000000..30c84f610 --- /dev/null +++ b/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); + + } +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/RabbitConfig.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/config/RabbitConfig.java new file mode 100644 index 000000000..bdeb8f2dc --- /dev/null +++ b/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; + } +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/controller/OrderController.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/controller/OrderController.java new file mode 100644 index 000000000..958de7abc --- /dev/null +++ b/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("成功"); + } + + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushOrderDTO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushOrderDTO.java new file mode 100644 index 000000000..bc179ab1c --- /dev/null +++ b/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 packages; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushPackageDTO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/dto/PushPackageDTO.java new file mode 100644 index 000000000..785b7ef35 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/entity/FactoryNodePushEntity.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/entity/FactoryNodePushEntity.java new file mode 100644 index 000000000..153619cde --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/FactoryNodeEnums.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/FactoryNodeEnums.java new file mode 100644 index 000000000..5ac05f189 --- /dev/null +++ b/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 getMustPushCode() { + List list = new ArrayList<>(); + for (FactoryNodeEnums value : FactoryNodeEnums.values()) { + if (value.getMustPush() == 1) { + list.add(value.getCode()); + } + } + return list; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeMappingEnums.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeMappingEnums.java new file mode 100644 index 000000000..dddbb4eb1 --- /dev/null +++ b/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; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeNeedEnums.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/enums/NodeNeedEnums.java new file mode 100644 index 000000000..35ad75321 --- /dev/null +++ b/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; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/interceptor/LocalServerLoginAccountsInterceptor.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/interceptor/LocalServerLoginAccountsInterceptor.java new file mode 100644 index 000000000..e6af2dcf0 --- /dev/null +++ b/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(); + } + } + } + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/launcher/FactoryDataBaseLauncherServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/launcher/FactoryDataBaseLauncherServiceImpl.java new file mode 100644 index 000000000..e07fbb407 --- /dev/null +++ b/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; + } +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.java new file mode 100644 index 000000000..a01790e3a --- /dev/null +++ b/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 { + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.xml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.xml new file mode 100644 index 000000000..7e12365b8 --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mapper/FactoryNodePushMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mq/NodeDataPushListener.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/mq/NodeDataPushListener.java new file mode 100644 index 000000000..64b94341c --- /dev/null +++ b/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 content = entries.getBeanList("content", PushData.class); + FactoryNodeEnums factoryByNodeAndStatus = NodeMappingEnums.getFactoryByNodeAndStatus(workNodeEnums); + List 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 mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO)); + String finalInWarehouseType = inWarehouseType; + List 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> collect = mtPushDataDTOS.stream().collect(Collectors.groupingBy(MtPushDataDTO::getSenderCode)); + if (CollUtil.isNotEmpty(collect)) { + for (Map.Entry> stringListEntry : collect.entrySet()) { + String senderCode = stringListEntry.getKey(); + List 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 mtPushDataDTOMap = mtPushDataDTOS.stream().collect(Collectors.toMap(MtPushDataDTO::getOrderCode, mtPushDataDTO -> mtPushDataDTO)); + // 表单数据 + String main = entries.getStr("main"); + JSONObject entries1 = JSONUtil.parseObj(main); + List 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 imageVOS = objects.stream() + .filter(m -> !m.toString().contains("blob")) + .map(m ->{ + return SignForConfirmImageVO.builder().image(m.toString()).build(); + }).collect(Collectors.toList()); + Map 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 content = entries.getBeanList("content", JSONObject.class); + if (CollUtil.isEmpty(content)) { + return true; + } + return false; + } + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/FactoryDataProperties.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/FactoryDataProperties.java new file mode 100644 index 000000000..6fdc1042f --- /dev/null +++ b/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; + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/MengTianProperties.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/pros/MengTianProperties.java new file mode 100644 index 000000000..6a43b9aa4 --- /dev/null +++ b/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; + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/FactoryNodePushService.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/FactoryNodePushService.java new file mode 100644 index 000000000..51eead25e --- /dev/null +++ b/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 { + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/impl/FactoryNodePushServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/service/impl/FactoryNodePushServiceImpl.java new file mode 100644 index 000000000..3dcff566c --- /dev/null +++ b/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 implements FactoryNodePushService { + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmOrderVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmOrderVO.java new file mode 100644 index 000000000..1ca739414 --- /dev/null +++ b/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 packageVOS; + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmPackageVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmPackageVO.java new file mode 100644 index 000000000..516eb192e --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInConfirmVO.java new file mode 100644 index 000000000..d82abc436 --- /dev/null +++ b/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 orderVOS; + + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/CentralStkInVO.java new file mode 100644 index 000000000..81b2f214f --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmImageVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmImageVO.java new file mode 100644 index 000000000..88ec53fd4 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmPackageVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmPackageVO.java new file mode 100644 index 000000000..9cf13170e --- /dev/null +++ b/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; + + + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForConfirmVO.java new file mode 100644 index 000000000..a878a29a6 --- /dev/null +++ b/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 packageVOS; + + @ApiModelProperty("签收图片") + @JsonProperty("签收图片") + private List imageVOS; +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForVO.java b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/java/com/logpm/factorydata/mengtian/vo/SignForVO.java new file mode 100644 index 000000000..e9999a0c6 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-dev.yml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-dev.yml new file mode 100644 index 000000000..a4dd4d96f --- /dev/null +++ b/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 diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-prod.yml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-prod.yml new file mode 100644 index 000000000..480928b7a --- /dev/null +++ b/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 diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-test.yml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application-test.yml new file mode 100644 index 000000000..1ae39cacf --- /dev/null +++ b/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 diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application.yml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/application.yml new file mode 100644 index 000000000..ca8dc27d5 --- /dev/null +++ b/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 + diff --git a/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/logback.xml b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/logback.xml new file mode 100644 index 000000000..7170050de --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-mengtian/src/main/resources/logback.xml @@ -0,0 +1,40 @@ + + + + logback + + + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + utf8 + + + + + ${log.path} + + ${log.path}.%d{yyyy-MM-dd}.zip + + + %date %level [%thread] %logger{36} [%file : %line] %msg%n + + + + + + + + + + diff --git a/blade-service/logpm-factory-data/pom.xml b/blade-service/logpm-factory-data/pom.xml index 78a672f0f..f3b3053e3 100644 --- a/blade-service/logpm-factory-data/pom.xml +++ b/blade-service/logpm-factory-data/pom.xml @@ -19,6 +19,7 @@ logpm-factory-data-jinpai logpm-factory-data-linsy logpm-factory-data-mwh + logpm-factory-data-mengtian diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/MtOrderLogFailRetryJob.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/MtOrderLogFailRetryJob.java index 050b1c49f..2d528c122 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/MtOrderLogFailRetryJob.java +++ b/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; diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClinet.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/feign/MtFactoryDataClinet.java new file mode 100644 index 000000000..b87910b6b --- /dev/null +++ b/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 orderPushData(Set orderCodes) { + if(CollUtil.isEmpty(orderCodes)){ + return null; + } + return mainMapper.orderPushData(orderCodes); + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java index f115e5530..7ce902a12 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.java +++ b/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 { @@ -26,4 +27,5 @@ public interface MtFactoryOrderMainMapper extends BaseMapper List selectMtFactoryOrderMainByPushType(IPage page, @Param("mtFactoryOrderMain") MtFactoryOrderMainVO mtFactoryOrderMain); + List orderPushData(@Param("orderCodes") Set orderCodes); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml index 4842eac76..1cec56457 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/mapper/MtFactoryOrderMainMapper.xml @@ -101,4 +101,19 @@ order by temp.create_time desc + diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/dto/LoadScanBrandDTO.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/dto/LoadScanBrandDTO.java index 2773d7268..1c4c07a45 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/dto/LoadScanBrandDTO.java +++ b/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; } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml index 82cb63d0f..115e43d43 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml @@ -580,13 +580,15 @@ diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java index 96e637012..dbd52e69a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/InComingServiceImpl.java +++ b/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) diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index cbd7765fc..ff3bb5579 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -404,6 +404,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl{ return PushData.builder() .packageCode(data) @@ -4371,6 +4374,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl 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 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)