66 changed files with 2067 additions and 41 deletions
@ -0,0 +1,15 @@
|
||||
FROM bladex/alpine-java:openjdk8-openj9_cn_slim |
||||
|
||||
MAINTAINER h5u@163.com |
||||
|
||||
RUN mkdir -p /logpm/logpm-data-sharing |
||||
|
||||
WORKDIR /logpm/logpm-data-sharing |
||||
|
||||
EXPOSE 17010 |
||||
|
||||
ADD ./target/logpm-data-sharing.jar ./app.jar |
||||
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar","-Xms128m","-Xmx512m", "app.jar"] |
||||
CMD ["--spring.profiles.active=test"] |
||||
|
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<parent> |
||||
<artifactId>blade-service</artifactId> |
||||
<groupId>org.springblade</groupId> |
||||
<version>3.2.0.RELEASE</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<artifactId>logpm-data-sharing</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>8</maven.compiler.source> |
||||
<maven.compiler.target>8</maven.compiler.target> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>org.springblade</groupId> |
||||
<artifactId>blade-core-boot</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springblade</groupId> |
||||
<artifactId>blade-starter-swagger</artifactId> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springblade</groupId> |
||||
<artifactId>blade-core-auto</artifactId> |
||||
<scope>provided</scope> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>org.springblade</groupId> |
||||
<artifactId>logpm-basicdata-api</artifactId> |
||||
<version>3.2.0.RELEASE</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
<build> |
||||
<plugins> |
||||
<plugin> |
||||
<groupId>io.fabric8</groupId> |
||||
<artifactId>docker-maven-plugin</artifactId> |
||||
<configuration> |
||||
<skip>${docker.fabric.skip}</skip> |
||||
</configuration> |
||||
</plugin> |
||||
<plugin> |
||||
<groupId>org.apache.maven.plugins</groupId> |
||||
<artifactId>maven-antrun-plugin</artifactId> |
||||
</plugin> |
||||
</plugins> |
||||
</build> |
||||
|
||||
</project> |
@ -0,0 +1,16 @@
|
||||
package com.logpm.datasharing; |
||||
|
||||
import org.springblade.common.constant.ModuleNameConstant; |
||||
import org.springblade.core.cloud.client.BladeCloudApplication; |
||||
import org.springblade.core.launch.BladeApplication; |
||||
|
||||
/** |
||||
* @author zqb |
||||
*/ |
||||
@BladeCloudApplication |
||||
public class DataSharingApplication { |
||||
|
||||
public static void main(String[] args) { |
||||
BladeApplication.run(ModuleNameConstant.APPLICATION_DATA_SHARING_NAME, DataSharingApplication.class, args); |
||||
} |
||||
} |
@ -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.datasharing.config; |
||||
|
||||
|
||||
import com.logpm.datasharing.pros.DataSharingProperties; |
||||
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(DataSharingProperties.class) |
||||
public class DataSharingConfiguration { |
||||
|
||||
|
||||
} |
@ -0,0 +1,50 @@
|
||||
/* |
||||
* 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.datasharing.controller; |
||||
|
||||
import com.logpm.datasharing.service.MerchantService; |
||||
import com.logpm.datasharing.vo.MerchantOrderVO; |
||||
import io.swagger.annotations.Api; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* 商家获取信息 控制器 |
||||
* |
||||
* @Author zqb |
||||
* @Date 2024/4/15 |
||||
**/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/merchant") |
||||
@Api(value = "商家获取货物信息", tags = "商家获取货物信息") |
||||
public class MerchantController extends BladeController { |
||||
|
||||
private final MerchantService merchantService; |
||||
|
||||
@GetMapping("goods") |
||||
public R<MerchantOrderVO> goods(@RequestParam("contract_number") String contract_number, @RequestParam("auth_key") String auth_key) { |
||||
return R.data(merchantService.goods(contract_number,auth_key)); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.logpm.datasharing.dto; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 订单信息 |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantOrderDTO implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "收件地址") |
||||
private String receiveAddress; |
||||
@ApiModelProperty(value = "是否零担订单") |
||||
private String zeroOrder; |
||||
@ApiModelProperty(value = "收件人电话") |
||||
private String receivePhone; |
||||
@ApiModelProperty(value = "订单合同号") |
||||
private String orderCode; |
||||
@ApiModelProperty(value = "订单总件数") |
||||
private String total; |
||||
|
||||
} |
@ -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.datasharing.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 DataSharingLauncherServiceImpl 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; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.logpm.datasharing.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.logpm.datasharing.dto.MerchantOrderDTO; |
||||
import com.logpm.datasharing.vo.MerchantPackageVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 15:54 |
||||
*/ |
||||
@Mapper |
||||
public interface MerchantMapeer extends BaseMapper { |
||||
|
||||
|
||||
/** |
||||
* 根据合同号和仓库ID列表查找商家订单。 |
||||
* |
||||
* @param contractNumber 合同编号,用于查找相关的商家订单。 |
||||
* @param warehouseId 仓库ID列表,用于筛选在指定仓库中的订单。 |
||||
* @return 返回一个MerchantOrderDTO对象,包含符合条件的商家订单信息。 |
||||
*/ |
||||
MerchantOrderDTO findMerchantOrder(@Param("contractNumber") String contractNumber, @Param("warehouseId") List<String> warehouseId); |
||||
|
||||
/** |
||||
* 根据授权密钥查找仓库ID列表。 |
||||
* |
||||
* @param authKey 授权密钥,用于权限验证和特定仓库的访问。 |
||||
* @return 返回一个字符串列表,包含匹配的仓库ID。如果没有找到匹配的仓库ID,则返回空列表。 |
||||
*/ |
||||
List<String> findWarehouseIdByAuthKey(@Param("authKey") String authKey); |
||||
|
||||
/** |
||||
* 根据合同编号查找包件信息。 |
||||
* |
||||
* @param contractNumber 合同编号,用于查询特定合同下的包件信息。 |
||||
* @return 返回一个MerchantPackageVO类型的列表,包含符合条件的包件信息。 |
||||
*/ |
||||
List<MerchantPackageVO> findPackage(@Param("contractNumber") String contractNumber); |
||||
|
||||
} |
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.logpm.datasharing.mapper.MerchantMapeer"> |
||||
|
||||
<select id="findMerchantOrder" resultType="com.logpm.datasharing.dto.MerchantOrderDTO"> |
||||
select t.customer_address receiveAddress, |
||||
t.customer_telephone receivePhone, |
||||
t.order_code orderCode, |
||||
t.is_zero zeroOrder, |
||||
t.total_number total |
||||
from logpm_distribution_stock_article t |
||||
where t.order_code = #{contractNumber} |
||||
<if test="warehouseId != null and warehouseId.size() > 0"> |
||||
and t.warehouse_id in |
||||
<foreach collection="warehouseId" item="item" separator="," open="(" close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
</select> |
||||
<select id="findWarehouseIdByAuthKey" resultType="java.lang.String"> |
||||
select lbss.serve_warehouse_id |
||||
from logpm_basicdata_client t |
||||
left join logpm_basicdata_storage_services lbss on t.id = lbss.client_id |
||||
where t.client_code = #{authKey} |
||||
and t.is_deleted = 0 |
||||
</select> |
||||
<select id="findPackage" resultType="com.logpm.datasharing.vo.MerchantPackageVO"> |
||||
select lww.shipper_address sendAddress, |
||||
ldpl.waybill_number waybillNumber, |
||||
ldpl.order_package_code orderPackageCode, |
||||
ldpl.order_package_status orderPackageStatus, |
||||
t.update_time updateTime, |
||||
ifnull(driver.lname, driver.ltname) distributionName, |
||||
ifnull(driver.lphone, driver.ltphone) distributionPhone |
||||
from logpm_distribution_stock_article t |
||||
left join logpm_distribution_reservation_stockarticle ldrs |
||||
on ldrs.stock_article_id = t.id and ldrs.stock_article_status !=2 |
||||
left join logpm_distribution_reservation ldr |
||||
on ldr.id = ldrs.reservation_id and ldr.reservation_status !=40 |
||||
join logpm_distribution_reservation_package ldrp |
||||
on ldrp.reservation_id = ldr.id and ldrp.packet_bar_status != 2 |
||||
left join logpm_distribution_parcel_list ldpl on ldpl.id = ldrp.parce_list_id |
||||
left join logpm_warehouse_waybill lww on lww.waybill_no = ldpl.waybill_number |
||||
left join logpm_distribution_signfor lds on lds.reservation_id = ldr.id |
||||
left join logpm_distribution_delivery_list lddl on lddl.id = lds.delivery_id |
||||
left join (select lddl.id, |
||||
group_concat(ldd.driver_name) lname, |
||||
group_concat(lddt.driver_name) ltname, |
||||
group_concat(ldd.driver_phone) lphone, |
||||
group_concat(lddt.driver_phone) ltphone |
||||
from logpm_distribution_delivery_list lddl |
||||
left join logpm_distribution_delivery_self ldd on ldd.delivery_id = lddl.id |
||||
left join logpm_distribution_delivery_tripartite lddt on lddt.delivery_id = lddl.id |
||||
group by lddl.id) driver on driver.id = lddl.id |
||||
where t.order_code = #{contractNumber} |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,21 @@
|
||||
package com.logpm.datasharing.pros; |
||||
|
||||
import lombok.Data; |
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
||||
/** |
||||
* FactoryProperties |
||||
* |
||||
* @author pref |
||||
*/ |
||||
@Data |
||||
@ConfigurationProperties(prefix = "logpm") |
||||
public class DataSharingProperties { |
||||
/** |
||||
* 名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.logpm.datasharing.service; |
||||
|
||||
import com.logpm.datasharing.vo.MerchantOrderVO; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
public interface MerchantService { |
||||
|
||||
/** |
||||
* 根据合同编号和授权密钥获取商户订单信息 |
||||
* |
||||
* @param contractNumber 合同编号,用于识别特定的合同 |
||||
* @param authKey 授权密钥,用于验证请求的合法性 |
||||
* @return MerchantOrderVO 商户订单的视图对象,包含订单的详细信息 |
||||
*/ |
||||
MerchantOrderVO goods(String contractNumber, String authKey); |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.logpm.datasharing.service.impl; |
||||
|
||||
import cn.hutool.core.bean.BeanUtil; |
||||
import cn.hutool.core.collection.CollUtil; |
||||
import cn.hutool.core.util.ObjectUtil; |
||||
import com.logpm.datasharing.dto.MerchantOrderDTO; |
||||
import com.logpm.datasharing.mapper.MerchantMapeer; |
||||
import com.logpm.datasharing.service.MerchantService; |
||||
import com.logpm.datasharing.vo.MerchantOrderPackageVO; |
||||
import com.logpm.datasharing.vo.MerchantOrderVO; |
||||
import com.logpm.datasharing.vo.MerchantPackageVO; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author zhaoqiaobo |
||||
* @create 2024-03-06 15:52 |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class MerchantServiceImpl implements MerchantService { |
||||
|
||||
private final MerchantMapeer merchantMapeer; |
||||
|
||||
@Override |
||||
public MerchantOrderVO goods(String contractNumber, String authKey) { |
||||
MerchantOrderDTO dto = null; |
||||
// 根据 authKey 获取仓库信息
|
||||
List<String> warehouseId = merchantMapeer.findWarehouseIdByAuthKey(authKey); |
||||
if (CollUtil.isNotEmpty(warehouseId)) { |
||||
// 根据合同编号获取合同信息
|
||||
dto = merchantMapeer.findMerchantOrder(contractNumber, warehouseId); |
||||
if (ObjectUtil.isNotEmpty(dto)) { |
||||
// TODO 这里分几种情况 零担订单,包件,库存品有数据/无数据 目前只实现了包件,其他的后续处理
|
||||
// 零担订单
|
||||
// 定制品
|
||||
// 包件/库存品
|
||||
List<MerchantPackageVO> packageVO = merchantMapeer.findPackage(contractNumber); |
||||
MerchantOrderPackageVO orderPackageVO = new MerchantOrderPackageVO(); |
||||
BeanUtil.copyProperties(dto, orderPackageVO); |
||||
orderPackageVO.setPackageInfor(packageVO); |
||||
return orderPackageVO; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.logpm.datasharing.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 订单信息 包件 |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantOrderPackageVO extends MerchantOrderVO { |
||||
|
||||
@ApiModelProperty(value = "包件信息") |
||||
private List<MerchantPackageVO> packageInfor; |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.logpm.datasharing.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 订单信息 |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantOrderVO implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "收件地址") |
||||
private String receiveAddress; |
||||
@ApiModelProperty(value = "收件人电话") |
||||
private String receivePhone; |
||||
@ApiModelProperty(value = "订单合同号") |
||||
private String orderCode; |
||||
@ApiModelProperty(value = "订单总件数") |
||||
private String total; |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.logpm.datasharing.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 订单信息 包件 |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantOrderZeroVO extends MerchantOrderVO { |
||||
|
||||
@ApiModelProperty(value = "零担在库数") |
||||
private String stockTotal; |
||||
|
||||
@ApiModelProperty(value = "零担配送信息") |
||||
private List<MerchantZeroDispatchVO> packageInfor; |
||||
|
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.logpm.datasharing.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 订单包件信息 |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantPackageVO implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "发货地址") |
||||
private String sendAddress; |
||||
@ApiModelProperty(value = "快递单号【运单号】") |
||||
private String waybillNumber; |
||||
@ApiModelProperty(value = "包件码") |
||||
private String orderPackageCode; |
||||
@ApiModelProperty(value = "包件状态 20 入库 70 签收") |
||||
private String orderPackageStatus; |
||||
@ApiModelProperty(value = "更新时间") |
||||
private String updateTime; |
||||
@ApiModelProperty(value = "配送人姓名") |
||||
private String distributionName; |
||||
@ApiModelProperty(value = "配送人联系电话") |
||||
private String distributionPhone; |
||||
|
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.logpm.datasharing.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 订单包件信息 |
||||
* |
||||
* @author zhaoqiaobo |
||||
* @create 2024-04-15 |
||||
*/ |
||||
@Data |
||||
public class MerchantZeroDispatchVO implements Serializable { |
||||
|
||||
@ApiModelProperty(value = "发货地址") |
||||
private String sendAddress; |
||||
@ApiModelProperty(value = "快递单号【运单号】") |
||||
private String waybillNumber; |
||||
@ApiModelProperty(value = "配送数量") |
||||
private String dispatchNumber; |
||||
@ApiModelProperty(value = "配送人姓名") |
||||
private String distributionName; |
||||
@ApiModelProperty(value = "配送人联系电话") |
||||
private String distributionPhone; |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
#服务器端口 |
||||
server: |
||||
port: 17010 |
||||
|
||||
#zb: |
||||
# enable: false |
||||
#数据源配置 |
||||
#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 |
||||
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.datasharing.master.url} |
||||
username: ${blade.datasource.datasharing.master.username} |
||||
password: ${blade.datasource.datasharing.master.password} |
||||
slave: |
||||
druid: |
||||
#独立校验配置 |
||||
validation-query: select 1 |
||||
#oracle校验 |
||||
#validation-query: select 1 from dual |
||||
url: ${blade.datasource.datasharing.slave.url} |
||||
username: ${blade.datasource.datasharing.slave.username} |
||||
password: ${blade.datasource.datasharing.slave.password} |
||||
|
@ -0,0 +1,45 @@
|
||||
#服务器端口 |
||||
server: |
||||
port: 17010 |
||||
|
||||
#数据源配置 |
||||
#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 |
||||
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.datasharing.master.url} |
||||
username: ${blade.datasource.datasharing.master.username} |
||||
password: ${blade.datasource.datasharing.master.password} |
||||
slave: |
||||
druid: |
||||
#独立校验配置 |
||||
validation-query: select 1 |
||||
#oracle校验 |
||||
#validation-query: select 1 from dual |
||||
url: ${blade.datasource.datasharing.slave.url} |
||||
username: ${blade.datasource.datasharing.slave.username} |
||||
password: ${blade.datasource.datasharing.slave.password} |
||||
|
@ -0,0 +1,45 @@
|
||||
#服务器端口 |
||||
server: |
||||
port: 17010 |
||||
|
||||
#数据源配置 |
||||
#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 |
||||
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.datasharing.master.url} |
||||
username: ${blade.datasource.datasharing.master.username} |
||||
password: ${blade.datasource.datasharing.master.password} |
||||
slave: |
||||
druid: |
||||
#独立校验配置 |
||||
validation-query: select 1 |
||||
#oracle校验 |
||||
#validation-query: select 1 from dual |
||||
url: ${blade.datasource.datasharing.slave.url} |
||||
username: ${blade.datasource.datasharing.slave.username} |
||||
password: ${blade.datasource.datasharing.slave.password} |
||||
|
@ -0,0 +1,32 @@
|
||||
#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 |
||||
|
||||
#oss配置 |
||||
oss: |
||||
enabled: true |
||||
name: minio |
||||
tenant-mode: false |
||||
endpoint: http://8.137.14.82:9000 |
||||
access-key: minio |
||||
secret-key: 123123123 |
||||
bucket-name: bladex |
||||
|
||||
|
||||
logging: |
||||
config: classpath:logback.xml |
||||
|
||||
|
||||
spring: |
||||
main: |
||||
allow-circular-references: true |
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<configuration scan="false" debug="false"> |
||||
|
||||
<contextName>logback</contextName> |
||||
<property name="log.path" value="./data/logpm-basic/logs/logs.log"/> |
||||
|
||||
<!-- 彩色日志依赖的渲染类 --> |
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> |
||||
<conversionRule conversionWord="wex" |
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/> |
||||
<conversionRule conversionWord="wEx" |
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/> |
||||
<!-- 彩色日志格式 --> |
||||
<property name="CONSOLE_LOG_PATTERN" |
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
<!-- 控制台输出 --> |
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> |
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> |
||||
<charset>utf8</charset> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
<file>${log.path}</file> |
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
<fileNamePattern>${log.path}.%d{yyyy-MM-dd}.zip</fileNamePattern> |
||||
</rollingPolicy> |
||||
<encoder> |
||||
<pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n |
||||
</pattern> |
||||
</encoder> |
||||
</appender> |
||||
|
||||
<root level="info"> |
||||
<appender-ref ref="console"/> |
||||
<appender-ref ref="file"/> |
||||
</root> |
||||
|
||||
</configuration> |
@ -0,0 +1,264 @@
|
||||
/* |
||||
* 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.distribution.excel; |
||||
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
|
||||
/** |
||||
* 配送在库订单 Excel实体类 |
||||
* |
||||
* @author cyz |
||||
* @since 2023-06-13 |
||||
*/ |
||||
@Data |
||||
@ColumnWidth(25) |
||||
@HeadRowHeight(20) |
||||
@ContentRowHeight(18) |
||||
public class DistributionSignForStockArticleExcel implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
/** |
||||
* 运单号 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("运单号") |
||||
private String waybillNumber; |
||||
|
||||
|
||||
/** |
||||
* 服务号 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("服务号") |
||||
private String serviceNumber; |
||||
|
||||
/** |
||||
* 订单自编号 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("订单自编号") |
||||
private String orderCode; |
||||
|
||||
/** |
||||
* 商场名称 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("商场名称") |
||||
private String mallName; |
||||
|
||||
/** |
||||
* 仓库名称 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("仓库名称") |
||||
private String warehouseName; |
||||
|
||||
/** |
||||
* 最新入库时间 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("最新入库时间") |
||||
private Date warehouseEntryTime; |
||||
|
||||
/** |
||||
* 收货单位 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("收货单位") |
||||
private String consigneeUnit; |
||||
|
||||
/** |
||||
* 运单收货人 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("运单收货人") |
||||
private String consigneePerson; |
||||
|
||||
/** |
||||
* 品牌 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("品牌") |
||||
private String brand; |
||||
|
||||
/** |
||||
* 总数量 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("总数量") |
||||
private Integer totalNumber; |
||||
|
||||
/** |
||||
* 在库数 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("在库数") |
||||
private Integer handQuantity; |
||||
/** |
||||
* 配送数量 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("配送数量") |
||||
private Integer deliveryNumber; |
||||
|
||||
/** |
||||
* 出库数 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("出库数") |
||||
private Integer signForNumber; |
||||
|
||||
/** |
||||
* 备货数 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("备货数") |
||||
private Integer stockUpNumber; |
||||
|
||||
/** |
||||
* 预约数 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("预约数") |
||||
private Integer reservationNumber; |
||||
|
||||
/** |
||||
* 订单状态 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("订单状态") |
||||
private String orderStatusName; |
||||
|
||||
/** |
||||
* 是否零担 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("是否零担") |
||||
private String isZeroName; |
||||
|
||||
/** |
||||
* 预约状态 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("预约状态") |
||||
private String orderReservationStatusName; |
||||
|
||||
/** |
||||
* 是否齐套 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("是否齐套") |
||||
private String isCompleteSet; |
||||
|
||||
/** |
||||
* 服务类型 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("服务类型") |
||||
private String typeServiceName; |
||||
|
||||
/** |
||||
* 预约信息 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("预约信息") |
||||
private String reservationInfo; |
||||
|
||||
/** |
||||
* 车次信息 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("车次信息") |
||||
private String deliveryListInfo; |
||||
|
||||
/** |
||||
* 司机信息 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("司机信息") |
||||
private String driverName; |
||||
|
||||
/** |
||||
* 车辆信息 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("车辆信息") |
||||
private String vehicleName; |
||||
|
||||
/** |
||||
* 审核人 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("审核人") |
||||
private String examineUserNames; |
||||
|
||||
/** |
||||
* 最早入库时间 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("最早入库时间") |
||||
private Date earliestWarehouseEntryTime; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("创建时间") |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 签收扫描时间 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("签收扫描时间") |
||||
private Date scanSigningTime; |
||||
|
||||
|
||||
// /**
|
||||
// * 创建人
|
||||
// */
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty("创建人")
|
||||
// private Long createUser;
|
||||
/** |
||||
* 创建人 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("创建人") |
||||
private String createUserName; |
||||
|
||||
|
||||
/** |
||||
* 复核时间 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("复核时间") |
||||
private Date signinTime; |
||||
|
||||
} |
@ -0,0 +1,107 @@
|
||||
package com.logpm.trunkline.mq; |
||||
|
||||
import cn.hutool.json.JSONObject; |
||||
import cn.hutool.json.JSONUtil; |
||||
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
||||
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
||||
import com.logpm.distribution.entity.DistributionParcelListEntity; |
||||
import com.logpm.distribution.feign.IDistributionParcelListClient; |
||||
import com.logpm.trunkline.dto.InComingDTO; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||
import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; |
||||
import com.logpm.trunkline.service.*; |
||||
import com.rabbitmq.client.Channel; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.constant.IncomingTypeEnum; |
||||
import org.springblade.common.constant.RabbitConstant; |
||||
import org.springblade.common.constant.TenantNum; |
||||
import org.springblade.common.utils.CommonUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.amqp.core.Message; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.*; |
||||
|
||||
@Slf4j |
||||
@Component |
||||
@AllArgsConstructor |
||||
@RabbitListener(queues = RabbitConstant.INCOMING_TO_LOAD_QUEUE) |
||||
public class AdvanceToLoadListener { |
||||
|
||||
private final IInComingService inComingService; |
||||
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||
private final ITrunklineCarsLoadScanService carsLoadScanService; |
||||
private final IBasicdataWarehouseClient warehouseClient; |
||||
private final IDistributionParcelListClient distributionParcelListClient; |
||||
private final ITrunklineCarsLoadService carsLoadService; |
||||
private final ITrunklineCarsOrderService carsOrderService; |
||||
private final ITrunklineCarsLoadLineService carsLoadLineService; |
||||
private final ITrunklineWaybillOrderService waybillOrderService; |
||||
|
||||
@RabbitHandler |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public void advanceToLoad(Map map, Message message, Channel channel){ |
||||
String msg = (String) map.get("messageData"); |
||||
if(StringUtil.isNotBlank(msg)){ |
||||
log.info("#############advanceToLoad: 暂存单包件入库并且绑定到对应车次上 {}", msg); |
||||
JSONObject jsonObject = JSONUtil.parseObj(msg); |
||||
TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(jsonObject, TrunklineAdvanceEntity.class); |
||||
if(Objects.isNull(advanceEntity)){ |
||||
return; |
||||
} |
||||
Long advanceId = advanceEntity.getId(); |
||||
String orderCode = advanceEntity.getOrderCode(); |
||||
Long warehouseId = advanceEntity.getWarehouseId(); |
||||
BasicdataWarehouseEntity warehouseEntity = warehouseClient.getEntityWarehouseId(warehouseId); |
||||
if(Objects.isNull(warehouseEntity)){ |
||||
log.warn("#############advanceToLoad: 仓库信息不存在 warehouseId={}",warehouseId); |
||||
return; |
||||
} |
||||
String warehouseName = warehouseEntity.getName(); |
||||
|
||||
//查询暂存单下所有包件
|
||||
Set<Long> loadIds = new HashSet<>(); |
||||
List<TrunklineAdvanceDetailEntity> advanceDetailEntities = advanceDetailService.findListByAdvanceId(advanceId); |
||||
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntities) { |
||||
String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); |
||||
TrunklineCarsLoadScanEntity carsLoadScanEntity = carsLoadScanService.findEntityByOrderPackageCodeAndScanStatus(orderPackageCode, "1"); |
||||
if(Objects.isNull(carsLoadScanEntity)){ |
||||
continue; |
||||
} |
||||
InComingDTO inComingDTO = new InComingDTO(); |
||||
inComingDTO.setIncomingType(IncomingTypeEnum.FACTORY_TO_INCOMING.getCode()); |
||||
inComingDTO.setTenantId(TenantNum.HUITONGCODE); |
||||
inComingDTO.setOrderPackageCode(orderPackageCode); |
||||
inComingDTO.setWarehouseId(warehouseId); |
||||
inComingDTO.setWarehouseName(warehouseName); |
||||
R r = inComingService.incomingPackage(inComingDTO); |
||||
if(r.getCode() == 200){ |
||||
carsLoadScanEntity.setFromWarehouseId(warehouseId); |
||||
carsLoadScanEntity.setOrderCode(orderCode); |
||||
Date createTime = carsLoadScanEntity.getCreateTime(); |
||||
Long createUser = carsLoadScanEntity.getCreateUser(); |
||||
Long createDept = carsLoadScanEntity.getCreateDept(); |
||||
carsLoadScanService.updateById(carsLoadScanEntity); |
||||
loadIds.add(carsLoadScanEntity.getLoadId()); |
||||
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); |
||||
parcelListEntity.setWarehouseEntryTimeEnd(CommonUtil.addDate(createTime,-60)); |
||||
parcelListEntity.setUpdateUser(createUser); |
||||
parcelListEntity.setCreateUser(createUser); |
||||
parcelListEntity.setCreateDept(createDept); |
||||
parcelListEntity.setOrderPackageStatus("60"); |
||||
distributionParcelListClient.update(parcelListEntity); |
||||
} |
||||
} |
||||
for (Long loadId : loadIds) { |
||||
carsLoadService.updateNumByLoadId(loadId); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,113 @@
|
||||
package com.logpm.trunkline.mq; |
||||
|
||||
import cn.hutool.json.JSONArray; |
||||
import cn.hutool.json.JSONObject; |
||||
import cn.hutool.json.JSONUtil; |
||||
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; |
||||
import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; |
||||
import com.logpm.trunkline.entity.TrunklineCarsOrderEntity; |
||||
import com.logpm.trunkline.service.*; |
||||
import com.rabbitmq.client.Channel; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.common.constant.RabbitConstant; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.amqp.core.Message; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.*; |
||||
|
||||
@Slf4j |
||||
@AllArgsConstructor |
||||
@Component |
||||
@RabbitListener(queues = RabbitConstant.OPEN_ORDER_LOAD_SCAN_QUEUE) |
||||
public class OpenOrderToLoadListener { |
||||
|
||||
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||
private final ITrunklineCarsLoadScanService carsLoadScanService; |
||||
private final ITrunklineCarsLoadService carsLoadService; |
||||
private final ITrunklineCarsOrderService carsOrderService; |
||||
private final ITrunklineCarsLoadLineService carsLoadLineService; |
||||
private final ITrunklineWaybillOrderService waybillOrderService; |
||||
|
||||
|
||||
@RabbitHandler |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public void openOrderToLoadScan(Map map, Message message, Channel channel){ |
||||
String msg = (String) map.get("messageData"); |
||||
log.info("###########openOrderToLoadScan: 开单补录包件运单信息 msg={}",msg); |
||||
if(StringUtil.isNotBlank(msg)){ |
||||
JSONObject jsonObject = JSONUtil.parseObj(msg); |
||||
Long waybillId = jsonObject.getLong("waybillId"); |
||||
String waybillNo = jsonObject.getStr("waybillNo"); |
||||
JSONArray advanceIds = jsonObject.getJSONArray("advanceIds"); |
||||
Set<Long> loadIds = new HashSet<>(); |
||||
for (Object object : advanceIds) { |
||||
Long advanceId = (Long) object; |
||||
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.findListByAdvanceId(advanceId); |
||||
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) { |
||||
String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); |
||||
TrunklineCarsLoadScanEntity carsLoadScanEntity = carsLoadScanService.findEntityByOrderPackageCodeAndScanStatus(orderPackageCode, "1"); |
||||
if(Objects.isNull(carsLoadScanEntity)){ |
||||
continue; |
||||
} |
||||
carsLoadScanEntity.setWaybillId(waybillId); |
||||
carsLoadScanEntity.setWaybillNo(waybillNo); |
||||
carsLoadScanEntity.setIsData(1); |
||||
carsLoadScanEntity.setIsSupple(1); |
||||
carsLoadScanEntity.setLoadingAbnormal(0); |
||||
carsLoadScanEntity.setUnloadAbnormal(0); |
||||
carsLoadScanService.updateById(carsLoadScanEntity); |
||||
Long loadId = carsLoadScanEntity.getLoadId(); |
||||
Long warehouseId = carsLoadScanEntity.getWarehouseId(); |
||||
String warehouseName = carsLoadScanEntity.getWarehouseName(); |
||||
String orderCode = carsLoadScanEntity.getOrderCode(); |
||||
Long finalNodeId = carsLoadScanEntity.getFinalNodeId(); |
||||
Long createUser = carsLoadScanEntity.getCreateUser(); |
||||
String tenantId = carsLoadScanEntity.getTenantId(); |
||||
Long createDept = carsLoadScanEntity.getCreateDept(); |
||||
TrunklineCarsLoadLineEntity carsLoadLineEntity = carsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); |
||||
if(Objects.isNull(carsLoadLineEntity)){ |
||||
continue; |
||||
} |
||||
TrunklineCarsOrderEntity trunklineCarsOrderEntity = carsOrderService.findEntityByLoadIdAndWarehouseIdAndOrderCodeAndWaybillNo(loadId, warehouseId, orderCode, waybillNo); |
||||
if(Objects.isNull(trunklineCarsOrderEntity)){ |
||||
trunklineCarsOrderEntity = new TrunklineCarsOrderEntity(); |
||||
trunklineCarsOrderEntity.setTenantId(tenantId); |
||||
trunklineCarsOrderEntity.setCreateUser(createUser); |
||||
trunklineCarsOrderEntity.setCreateDept(createDept); |
||||
trunklineCarsOrderEntity.setUpdateUser(createUser); |
||||
trunklineCarsOrderEntity.setLoadId(loadId); |
||||
trunklineCarsOrderEntity.setNodeId(warehouseId); |
||||
trunklineCarsOrderEntity.setNodeName(warehouseName); |
||||
trunklineCarsOrderEntity.setLoadLineId(carsLoadLineEntity.getId()); |
||||
trunklineCarsOrderEntity.setOrderCode(orderCode); |
||||
trunklineCarsOrderEntity.setWaybillNo(waybillNo); |
||||
Integer totalNum = waybillOrderService.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode); |
||||
trunklineCarsOrderEntity.setTotalNum(totalNum); |
||||
trunklineCarsOrderEntity.setPlanNum(0); |
||||
trunklineCarsOrderEntity.setIsCustomer("0"); |
||||
trunklineCarsOrderEntity.setRealNum(0); |
||||
trunklineCarsOrderEntity.setType(1); |
||||
trunklineCarsOrderEntity.setFinalNodeId(finalNodeId); |
||||
trunklineCarsOrderEntity.setUnloadNum(0); |
||||
trunklineCarsOrderEntity.setStartNum(0); |
||||
} |
||||
trunklineCarsOrderEntity.setPlanNum(trunklineCarsOrderEntity.getPlanNum()+1); |
||||
carsOrderService.saveOrUpdate(trunklineCarsOrderEntity); |
||||
loadIds.add(loadId); |
||||
} |
||||
} |
||||
|
||||
for (Long loadId : loadIds) { |
||||
carsLoadService.updateNumByLoadId(loadId); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue