diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java index 6d22799d6..2fc1f0f38 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java @@ -6,53 +6,26 @@ package org.springblade.common.constant; * @author yangkai.shen */ public interface RabbitConstant { - /** - * 直接模式1 - */ - String DIRECT_MODE_QUEUE_ONE = "queue.direct.1"; - - /** - * 队列2 - */ - String QUEUE_TWO = "queue.2"; - - /** - * 队列3 - */ - String QUEUE_THREE = "3.queue"; - - /** - * 分列模式 - */ - String FANOUT_MODE_QUEUE = "fanout.mode"; - - /** - * 主题模式 - */ - String TOPIC_MODE_QUEUE = "topic.mode"; - - /** - * 路由1 - */ - String TOPIC_ROUTING_KEY_ONE = "queue.#"; - - /** - * 路由2 - */ - String TOPIC_ROUTING_KEY_TWO = "*.queue"; - - /** - * 路由3 - */ - String TOPIC_ROUTING_KEY_THREE = "3.queue"; - - /** - * 延迟队列 - */ - String DELAY_QUEUE = "delay.queue"; - - /** - * 延迟队列交换器 - */ - String DELAY_MODE_QUEUE = "delay.mode"; + //消费失败队列 + String ERROR_QUEUE = "error_queue"; + String ERROR_EXCHANGE = "error_exchange"; + String ERROR_ROUTING = "error_routing"; + + + //订单状态消息队列配置 + String ORDER_STATUS_QUEUE = "order_status_queue"; + String ORDER_STATUS_EXCHANGE = "order_status_exchange"; + String ORDER_STATUS_ROUTING = "order_status_routing"; + + + String OPEN_ORDER_QUEUE = "open_order_queue"; + String OPEN_ORDER_EXCHANGE = "open_order_exchange"; + String OPEN_ORDER_ROUTING = "open_order_routing"; + + + String DEAL_WITH_QUEUE = "deal_with_queue"; + String DEAL_WITH_EXCHANGE = "deal_with_exchange"; + String DEAL_WITH_ROUTING = "deal_with_routing"; + + } diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java index 3bd699c93..9432d8745 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java @@ -25,6 +25,7 @@ import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Random; import java.util.TimeZone; +import java.util.UUID; /** * 通用工具类 @@ -91,4 +92,8 @@ public class CommonUtil { } + public static String getUUID(){ + return UUID.randomUUID().toString().replace("-", ""); + } + } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAreaClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAreaClient.java index 4a0b333f1..388e48ea3 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAreaClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAreaClient.java @@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RequestParam; ) public interface IBasicdataGoodsAreaClient { - String API_PREFIX = "/client"; + String API_PREFIX = "goodsArea/client"; String TOP = API_PREFIX + "/top"; /** diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java index 36486ba95..cac2448ed 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java @@ -119,11 +119,11 @@ public class DistributionReservationEntity extends TenantEntity { */ @ApiModelProperty(value = "备注") private String remarks; - /** - * 预约单编号,系统构建生成 - */ - @ApiModelProperty(value = "预约单编号") - private String reservationId; +// /** +// * 预约单编号,系统构建生成 +// */ +// @ApiModelProperty(value = "预约单编号") +// private String reservationId; /** * 时段 */ diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java index 5b2b38963..ba7f33a9e 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java @@ -16,12 +16,15 @@ */ package com.logpm.distribution.feign; -import org.springblade.core.mp.support.BladePage; import com.logpm.distribution.entity.DistributionParcelListEntity; +import org.springblade.core.mp.support.BladePage; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + /** * 在库订单包件清单 Feign接口类 * @@ -46,4 +49,9 @@ public interface IDistributionParcelListClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @GetMapping(API_PREFIX+"/findByPacketBarCode") + DistributionParcelListEntity findByPacketBarCode(String unitNo); + + @GetMapping(API_PREFIX+"/addBatch") + boolean addBatch(@RequestBody List parcelListEntityList); } diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java index 125dde48d..c13476c35 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java @@ -16,10 +16,12 @@ */ package com.logpm.distribution.feign; -import org.springblade.core.mp.support.BladePage; import com.logpm.distribution.entity.DistributionStockArticleEntity; +import org.springblade.core.mp.support.BladePage; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; /** @@ -46,4 +48,6 @@ public interface IDistributionStockArticleClient { @GetMapping(TOP) BladePage top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); + @PostMapping(API_PREFIX + "/addData") + Long addData(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity); } diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrder.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrder.java new file mode 100644 index 000000000..9ae20bf49 --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrder.java @@ -0,0 +1,81 @@ +package com.logpm.factory.snm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +@Data +@TableName("mt_factory_order") +@ApiModel(value = "MtFactoryOrder对象", description = "梦天工厂订单") +@EqualsAndHashCode(callSuper = true) +public class MtFactoryOrder extends BaseEntity { + + @JsonProperty("总单编号") + @ApiModelProperty(value = "总单编号") + private String mainOrderCode; + + @JsonProperty("订单编号") + @ApiModelProperty(value = "订单编号") + private String orderCode; + + @JsonProperty("客户姓名") + @ApiModelProperty(value = "客户姓名") + private String customName; + + @JsonProperty("客户电话") + @ApiModelProperty(value = "客户电话") + private String customPhone; + + @JsonProperty("客户地址") + @ApiModelProperty(value = "客户地址") + private String customAddress; + + @JsonProperty("经销商编号") + @ApiModelProperty(value = "经销商编码") + private String dealerCode; + + @JsonProperty("经销商名称") + @ApiModelProperty(value = "经销商名称") + private String dealerName; + + @JsonProperty("专卖店编号") + @ApiModelProperty(value = "专卖店编号") + private String exclusiveCode; + + @JsonProperty("专卖店名称") + @ApiModelProperty(value = "专卖店名称") + private String exclusiveName; + + @JsonProperty("收货人") + @ApiModelProperty(value = "收货人") + private String consignee; + + @JsonProperty("收货人电话") + @ApiModelProperty(value = "收货人电话") + private String consigneePhone; + + @JsonProperty("收货地址") + @ApiModelProperty(value = "收货人地址") + private String consigneeAddress; + + @JsonProperty("出库方式") + @ApiModelProperty(value = "出库方式") + private String outboundType; + + @JsonProperty("品牌") + @ApiModelProperty(value = "品牌") + private String brand; + + @JsonProperty("生产单号") + @ApiModelProperty(value = "生产单号") + private String produceOrderCode; + + @JsonProperty("包件数") + @ApiModelProperty(value = "包件数") + private String quantity; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java new file mode 100644 index 000000000..7f778932e --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java @@ -0,0 +1,57 @@ +package com.logpm.factory.snm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +@Data +@TableName("mt_factory_order_main") +@ApiModel(value = "MtFactoryOrderMain对象", description = "梦天工厂订单主对象") +@EqualsAndHashCode(callSuper = true) +public class MtFactoryOrderMain extends BaseEntity { + + @JsonProperty("发货单编号") + @ApiModelProperty(value = "发货单编号") + private String invoiceOrderCode; + + @JsonProperty("中心仓编号") + @ApiModelProperty(value = "中心仓编号") + private String centerWarehouseCode; + + @JsonProperty("中心仓") + @ApiModelProperty(value = "中心仓") + private String centerWarehouseName; + + @JsonProperty("仓库类型") + @ApiModelProperty(value = "仓库类型") + private String warehouseType; + + @JsonProperty("送货车号") + @ApiModelProperty(value = "送货车号") + private String sendCarNumber; + + @JsonProperty("送货司机") + @ApiModelProperty(value = "送货车司机") + private String sendCarDriver; + + @JsonProperty("送货司机电话") + @ApiModelProperty(value = "送货车司机电话") + private String sendCarDriverPhone; + + @JsonProperty("确认发车人") + @ApiModelProperty(value = "确认发车人") + private String reallyMan; + + @JsonProperty("确认发车时间") + @ApiModelProperty(value = "确认发车时间") + private String reallyDate; + + @JsonProperty("备注") + @ApiModelProperty(value = "备注") + private String remark; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java new file mode 100644 index 000000000..1d7c812ad --- /dev/null +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java @@ -0,0 +1,54 @@ +package com.logpm.factory.snm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.mp.base.BaseEntity; + +@Data +@TableName("mt_package_info") +@ApiModel(value = "MtPackageInfo对象", description = "梦天工厂包件信息") +@EqualsAndHashCode(callSuper = true) +public class MtPackageInfo extends BaseEntity { + + + @JsonProperty("出库人") + @ApiModelProperty(value = "出库人") + private String outboundMan; + + @JsonProperty("出库时间") + @ApiModelProperty(value = "出库时间") + private String outboundDate; + + @JsonProperty("包装编号") + @ApiModelProperty(value = "包装编号") + private String packageCode; + + @JsonProperty("包装类型") + @ApiModelProperty(value = "包装类型") + private String packageType; + + @JsonProperty("大类") + @ApiModelProperty(value = "大类") + private String bigType; + + @JsonProperty("小类") + @ApiModelProperty(value = "小类") + private String smallType; + + @JsonProperty("油漆颜色") + @ApiModelProperty(value = "油漆颜色") + private String color; + + @JsonProperty("型号") + @ApiModelProperty(value = "型号") + private String model; + + @JsonProperty("门扇尺寸") + @ApiModelProperty(value = "尺寸") + private String size; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/OrderStatusLog.java similarity index 62% rename from blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java rename to blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/OrderStatusLog.java index 9367fde74..e6474eac4 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/OrderStatusLog.java @@ -7,13 +7,15 @@ import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; @Data -@TableName("pan_order_status_log") -@ApiModel(value = "PanOrderStatusLog对象", description = "皮艾诺订单状态日志") +@TableName("order_status_log") +@ApiModel(value = "OrderStatusLog对象", description = "工厂订单状态日志") @EqualsAndHashCode(callSuper = true) -public class PanOrderStatusLog extends BaseEntity { +public class OrderStatusLog extends BaseEntity { private String args; private Integer type; + private String brand;//品牌 + } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/OrderEntity.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/OrderEntity.java new file mode 100644 index 000000000..d338be7d3 --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/OrderEntity.java @@ -0,0 +1,155 @@ +package com.logpm.oldproject.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("ht_order") +@ApiModel(value = "Order对象", description = "订单信息") +public class OrderEntity { + + @TableId( + value = "id", + type = IdType.AUTO + ) + private Integer id; + + private Integer test; + + @ApiModelProperty(value = "订单号") + @TableField("number") + private String number; + + @ApiModelProperty(value = "服务号") + @TableField("servicenum") + private String servicenum; + + @ApiModelProperty(value = "仓库id") + @TableField("warehouse_id") + private Integer warehouseId; + + @ApiModelProperty(value = "货区id") + @TableField("cargo_id") + private Integer cargoId; + + @ApiModelProperty(value = "货架id") + @TableField("shelf_id") + private Integer shelfId; + + @ApiModelProperty(value = "货位id") + @TableField("location_id") + private String locationId; + + @ApiModelProperty(value = "订单来源") + @TableField("source") + private String source; + + @ApiModelProperty(value = "紧急程度:0=正常,1=加急") + @TableField("emergency") + private Integer emergency; + + @ApiModelProperty(value = "订单自编号") + @TableField("selfnumber") + private String selfnumber; + + @ApiModelProperty(value = "客户姓名") + @TableField("contact") + private String contact; + + @ApiModelProperty(value = "联系方式") + @TableField("phone") + private String phone; + + @ApiModelProperty(value = "收货地址") + @TableField("address") + private String address; + + @ApiModelProperty(value = "上门提货:0=否,1=是") + @TableField("door") + private Integer door; + + @ApiModelProperty(value = "总订单数量【未使用】") + @TableField("total") + private Integer total; + + @ApiModelProperty(value = "付款方式") + @TableField("payment") + private String payment; + + @ApiModelProperty(value = "入库状态") + @TableField("status") + private Integer status; + + @ApiModelProperty(value = "入库数量【未使用】") + @TableField("in_num") + private Integer inNum; + + @ApiModelProperty(value = "装车数量【未使用】") + @TableField("trans_num") + private Integer transNum; + + @ApiModelProperty(value = "分拣数量【未使用】") + @TableField("sorting") + private Integer sorting; + + @ApiModelProperty(value = "出库数量【未使用】") + @TableField("out_num") + private Integer outNum; + + @ApiModelProperty(value = "配送数量【未使用】") + @TableField("delive_num") + private Integer deliveNum; + + @ApiModelProperty(value = "签收数量【未使用】") + @TableField("sign_num") + private Integer signNum; + + @ApiModelProperty(value = "创建时间") + @TableField("create_time") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + @TableField("update_time") + private Date updateTime; + + @ApiModelProperty(value = "删除时间") + @TableField("delete_time") + private Integer deleteTime; + + @ApiModelProperty(value = "创建人") + @TableField("administrators_id") + private Integer administratorsId; + + @ApiModelProperty(value = "是否异常") + @TableField("abnormal") + private Integer abnormal; + + @ApiModelProperty(value = "寄件人") + @TableField("sender") + private String sender; + + @ApiModelProperty(value = "寄件人电话") + @TableField("sender_tel") + private String senderTel; + + @ApiModelProperty(value = "寄件人地址") + @TableField("sender_address") + private String senderAddress; + + @ApiModelProperty(value = "上架状态:0未上架,1已上架,2部分上架,3已下架") + @TableField("on_shelf_type") + private Integer onShelfType; + + @ApiModelProperty(value = "旧id") + @TableField("old_id") + private Integer oldId; + + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java index 6a37d05fc..ec3198c37 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java @@ -17,12 +17,14 @@ package com.logpm.oldproject.feign; import com.logpm.oldproject.entity.AdvanceDetailEntity; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; import java.util.Map; /** @@ -66,4 +68,11 @@ public interface IAdvanceDetailClient { */ @GetMapping(API_PREFIX + "/getSupplyData") Map getSupplyData(@RequestParam String unitNo); + + @GetMapping(API_PREFIX + "/getOneByUnitNo") + AdvanceDetailEntity getOneByUnitNo(@RequestParam String unitNo); + + @GetMapping(API_PREFIX + "/getListByOrderSelfNum") + List getListByOrderSelfNum(@RequestParam String orderSelfNum); + } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java new file mode 100644 index 000000000..2725b5fae --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java @@ -0,0 +1,43 @@ +/* + * 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.oldproject.feign; + +import com.logpm.oldproject.entity.OrderEntity; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * 订单 Feign接口类 + * + * @author zhy + * @since 2023-06-24 + */ +@FeignClient( + value = "logpm-old-project" +) +public interface IOrderClient { + + String API_PREFIX = "/client"; + + @GetMapping(API_PREFIX + "/getOrderByOrderSelfNum") + List getOrderByOrderSelfNum(@RequestParam String orderSelfNum); + + +} diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java new file mode 100644 index 000000000..eff4d0a1a --- /dev/null +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java @@ -0,0 +1,67 @@ +package com.logpm.oldproject.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class DistributionParcelListEntityVO { + + @ApiModelProperty(value = "仓库") + private String warehouse; + /** + * 状态 + */ + @ApiModelProperty(value = "状态") + private Integer conditions; + /** + * 包条码 + */ + @ApiModelProperty(value = "包条码") + private String packetBarCode; + /** + * 货位信息 + */ + @ApiModelProperty(value = "货位信息") + private String goodsAllocation; + /** + * 所在托盘 + */ + @ApiModelProperty(value = "所在托盘") + private String pallet; + /** + * 一级品 + */ + @ApiModelProperty(value = "一级品") + private String firsts; + /** + * 二级品 + */ + @ApiModelProperty(value = "二级品") + private String second; + /** + * 三级品 + */ + @ApiModelProperty(value = "三级品") + private String thirdProduct; + /** + * 物料 + */ + @ApiModelProperty(value = "物料") + private String material; + /** + * 数量 + */ + @ApiModelProperty(value = "数量") + private Integer quantity; + /** + * 车次号 + */ + @ApiModelProperty(value = "车次号") + private String trainNumber; + /** + * 在库订单ID + */ + @ApiModelProperty(value = "在库订单ID") + private String stockArticleId; + +} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java index 89303f9f3..f2186145a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java @@ -30,6 +30,7 @@ import javax.validation.Valid; import org.springblade.core.secure.BladeUser; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -84,6 +85,7 @@ public class BasicdataWarehouseController extends BladeController { qw .apply(startDate != null,"date_format (start_date,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')",startDate) .apply(endDate != null,"date_format (end_date,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')",endDate); + qw.lambda().eq(BasicdataWarehouseEntity::getTenantId, AuthUtil.getTenantId()); IPage page = warehouseService.page(Condition.getPage(query), qw); // IPage pages = warehouseService.page(Condition.getPage(query), Condition.getQueryWrapper(warehouseWarehouse, BasicdataWarehouseEntity.class)); return R.data(page); @@ -97,7 +99,6 @@ public class BasicdataWarehouseController extends BladeController { @ApiOperation(value = "分页", notes = "传入warehouseWarehouse") public R> listName(String name) { List pages = warehouseService.pageListName(name); - return R.data(pages); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java index 069c15c9e..d605bafee 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java @@ -100,7 +100,6 @@ public class DistributionReservationController extends BladeController { @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入distrbutionReservation") public R save(@Valid @RequestBody DistributionReservationDTO distributionReservationDTO) { - boolean result = reservationService.insertReservation(distributionReservationDTO); return R.status(result); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java index 7252708ce..25ea5fc26 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java @@ -16,6 +16,7 @@ */ package com.logpm.distribution.feign; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.AllArgsConstructor; import org.springblade.core.mp.support.BladePage; @@ -27,6 +28,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; + /** * 在库订单包件清单 Feign实现类 * @@ -50,4 +53,17 @@ public class DistributionParcelListClient implements IDistributionParcelListClie return BladePage.of(page); } + @Override + @GetMapping(API_PREFIX+"/findByPacketBarCode") + public DistributionParcelListEntity findByPacketBarCode(String unitNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("packet_bar_code",unitNo); + return distributionParcelListService.getOne(queryWrapper); + } + + @Override + public boolean addBatch(List parcelListEntityList) { + return distributionParcelListService.saveBatch(parcelListEntityList); + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index 353567e33..03637f1f4 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -50,4 +50,14 @@ public class DistributionStockArticleClient implements IDistributionStockArticle return BladePage.of(page); } + @Override + public Long addData(DistributionStockArticleEntity distributionStockArticleEntity) { + boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); + if(saveFlag){ + return distributionStockArticleEntity.getId(); + }else{ + return 0L; + } + } + } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml index c61a98f70..40c283da8 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml @@ -28,7 +28,7 @@ - + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java index 5e8969b91..37d42f40f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java @@ -205,6 +205,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImplxxl-job-core - - - - + + org.springframework.boot + spring-boot-starter-amqp + + + org.springblade + logpm-distribution-api + 3.1.0.RELEASE + compile + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java index 41615f918..ee86d4d42 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java @@ -1,53 +1,161 @@ package com.logpm.factory.config; +import com.alibaba.nacos.shaded.com.google.common.collect.Maps; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springframework.amqp.core.*; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.connection.CorrelationData; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.amqp.rabbit.retry.MessageRecoverer; +import org.springframework.amqp.rabbit.retry.RepublishMessageRecoverer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Map; + /** * RabbitMQ配置,主要是配置队列,如果提前存在该队列,可以省略本配置类 * * @author yangkai.shen */ -//@Slf4j -//@Configuration(proxyBeanMethods = false) +@Slf4j +@Configuration public class RabbitMqConfiguration { -// @Bean -// public RabbitTemplate rabbitTemplate() { -// CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); -// connectionFactory.setPublisherConfirms(true); -// connectionFactory.setPublisherReturns(true); -// RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); -// rabbitTemplate.setMandatory(true); -// rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> log.info("消息发送成功:correlationData({}),ack({}),cause({})", correlationData, ack, cause)); -// rabbitTemplate.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> log.info("消息丢失:exchange({}),route({}),replyCode({}),replyText({}),message:{}", exchange, routingKey, replyCode, replyText, message)); -// return rabbitTemplate; -// } + @Bean + public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){ + RabbitTemplate template = new RabbitTemplate(); + template.setConnectionFactory(connectionFactory); + template.setMandatory(true); + template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { + @Override + public void confirm(CorrelationData correlationData, boolean b, String s) { + System.out.println("确认回调-相关数据:"+correlationData); + System.out.println("确认回调-确认情况:"+b); + System.out.println("确认回调-原因:"+s); +// Long id = Long.parseLong(correlationData.getId()); +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// if(b){ +// //修改处理日志为已处理 +// updateWrapper.set("status",0) +// .eq("id",id); +// +// }else{ +// //修改处理日志为已处理 +// updateWrapper.set("status",2) +// .eq("id",id); +// } +// panOrderStatusLogService.update(updateWrapper); + } + }); + + template.setReturnsCallback(new RabbitTemplate.ReturnsCallback() { + @Override + public void returnedMessage(ReturnedMessage returnedMessage) { + System.out.println("返回回调-消息:"+returnedMessage.getMessage()); + System.out.println("返回回调-回应码:"+returnedMessage.getReplyCode()); + System.out.println("返回回调-回应信息:"+returnedMessage.getReplyText()); + System.out.println("返回回调-交换机:"+returnedMessage.getExchange()); + System.out.println("返回回调-路由键:"+returnedMessage.getRoutingKey()); + } + }); + return template; + } + + @Bean + public DirectExchange errorMessageExchange(){ + return new DirectExchange(RabbitConstant.ERROR_EXCHANGE); + } + @Bean + public Queue errorQueue(){ + return new Queue(RabbitConstant.ERROR_QUEUE, true); + } + @Bean + public Binding errorBinding(Queue errorQueue, DirectExchange errorMessageExchange){ + return BindingBuilder.bind(errorQueue).to(errorMessageExchange).with(RabbitConstant.ERROR_ROUTING); + } + + /** + * 消费失败队列 + * @param rabbitTemplate + * @return + */ + @Bean + public MessageRecoverer republishMessageRecoverer(RabbitTemplate rabbitTemplate){ + return new RepublishMessageRecoverer(rabbitTemplate, RabbitConstant.ERROR_EXCHANGE, RabbitConstant.ERROR_ROUTING); + } + /** * 延迟队列 */ -// @Bean -// public Queue delayQueue() { -// return new Queue(RabbitConstant.DIRECT_MODE_QUEUE_ONE, true); -// } + @Bean + public Queue orderStatusQueue() { + return new Queue(RabbitConstant.ORDER_STATUS_QUEUE, true); + } /** * 延迟队列交换器, x-delayed-type 和 x-delayed-message 固定 */ -// @Bean -// public CustomExchange delayExchange() { -// Map args = Maps.newHashMap(); -// args.put("x-delayed-type", "direct"); -// return new CustomExchange("TestDirectExchange", "x-delayed-message", true, false, args); -// } + @Bean + public CustomExchange orderStatusExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.ORDER_STATUS_EXCHANGE, "x-delayed-message", true, false, args); + } /** * 延迟队列绑定自定义交换器 * - * @param delayQueue 队列 - * @param delayExchange 延迟交换器 + * @param orderStatusQueue 队列 + * @param orderStatusExchange 延迟交换器 */ -// @Bean -// public Binding delayBinding(Queue delayQueue, CustomExchange delayExchange) { -// return BindingBuilder.bind(delayQueue).to(delayExchange).with("TestDirectRouting").noargs(); -// } + @Bean + public Binding orderStatusBinding(Queue orderStatusQueue, CustomExchange orderStatusExchange) { + return BindingBuilder.bind(orderStatusQueue).to(orderStatusExchange).with(RabbitConstant.ORDER_STATUS_ROUTING).noargs(); + } + + + @Bean + DirectExchange lonelyDirectExchange() { + return new DirectExchange("lonelyDirectExchange"); + } + + @Bean + public Queue openOrderQueue() { + return new Queue(RabbitConstant.OPEN_ORDER_QUEUE, true); + } + + @Bean + public CustomExchange openOrderExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.OPEN_ORDER_EXCHANGE, "x-delayed-message", true, false, args); + } + + @Bean + public Binding openOrderBinding(Queue openOrderQueue, CustomExchange openOrderExchange) { + return BindingBuilder.bind(openOrderQueue).to(openOrderExchange).with(RabbitConstant.OPEN_ORDER_ROUTING).noargs(); + } + + + @Bean + public Queue dealWithQueue() { + return new Queue(RabbitConstant.DEAL_WITH_QUEUE, true); + } + + @Bean + public CustomExchange dealWithExchange() { + Map args = Maps.newHashMap(); + args.put("x-delayed-type", "direct"); + return new CustomExchange(RabbitConstant.DEAL_WITH_EXCHANGE, "x-delayed-message", true, false, args); + } + + @Bean + public Binding dealWithBinding(Queue dealWithQueue, CustomExchange dealWithExchange) { + return BindingBuilder.bind(dealWithQueue).to(dealWithExchange).with(RabbitConstant.DEAL_WITH_ROUTING).noargs(); + } + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java new file mode 100644 index 000000000..b153d4b44 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package com.logpm.factory.mt.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.factory.mt.dto.MtFactoryDataDTO; +import com.logpm.factory.snm.bean.Resp; +import com.logpm.factory.snm.entity.OrderStatusLog; +import com.logpm.factory.snm.service.IMtFactoryDataService; +import com.logpm.factory.snm.service.IOrderStatusLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.tool.api.R; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 梦天数据 控制器 + * + * @author zhy + * @since 2023-06-06 + */ +@Log4j2 +@RestController +@AllArgsConstructor +@RequestMapping("/factory/mt") +@Api(value = "工厂数据", tags = "工厂数据接口") +public class MtFactoryDataController extends BladeController { + + private final IOrderStatusLogService orderStatusLogService; + private final IMtFactoryDataService mtFactoryDataService; + + /** + * 工厂数据推送接口 + */ + @ResponseBody + @PostMapping("/data") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "通常数据推送", notes = "传入factoryOrderDTO") + public R data(@Validated @RequestBody MtFactoryDataDTO mtFactoryDataDTO, HttpServletRequest request) { + log.info("############data: "); + String corpId = request.getHeader("corpId"); + + //先保存原始请求数据 + OrderStatusLog orderStatusLog = new OrderStatusLog(); + orderStatusLog.setArgs(JSONObject.toJSONString(mtFactoryDataDTO)); + orderStatusLog.setStatus(1); + orderStatusLog.setType(3); + orderStatusLog.setBrand("梦天"); + orderStatusLogService.save(orderStatusLog); + + //数据存入数据库 + boolean flag = mtFactoryDataService.dealWithData(mtFactoryDataDTO); + + +// //判断数据是否已存入 +// String orderNo = factoryOrderDTO.getOrderNo(); +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("order_no",orderNo); +// PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); +// if(!Objects.isNull(one)){ +// log.warn("############data: 订单数据已存在 orderNo={}",orderNo); +// return Resp.fail(400,"订单数据已存在"); +// } +// +// PanFactoryOrder factoryOrder = new PanFactoryOrder(); +// BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); +// factoryOrder.setCorpid(corpId); +// //保存订单数据 +// factoryOrderService.save(factoryOrder); +// +// List packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES(); +// +// for (PanPackageInfoDTO dto:packageInfos){ +// PanPackageInfo packageInfo = new PanPackageInfo(); +// BeanUtil.copyProperties(dto,packageInfo); +// packageInfo.setOrderId(factoryOrder.getId()); +// //保存包件信息数据 +// //因为需要先保存包件明细需要包件的id +// packageInfoService.save(packageInfo); +// +// //再存入包件明细 +// List PanPackagelist = new ArrayList<>(); +// List order_attributes_line = dto.getORDER_ATTRIBUTES_LINE(); +// for (PanPackageListDTO panPackageListDTO:order_attributes_line){ +// PanPackageList panPackageList = new PanPackageList(); +// BeanUtil.copyProperties(panPackageListDTO,panPackageList); +// panPackageList.setPackageId(packageInfo.getId()); +// PanPackagelist.add(panPackageList); +// } +// packageListService.saveBatch(PanPackagelist); +// } +// +// //修改保存数据的状态 +// panOrderStatusLog.setStatus(0); +// panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); +// +// //开启异步线程处理数据 +// syncDataService.handlerPanDataToHt(); + + return Resp.fail(400,"fail"); + } + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryDataDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryDataDTO.java new file mode 100644 index 000000000..a737cd87d --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryDataDTO.java @@ -0,0 +1,18 @@ +package com.logpm.factory.mt.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.ArrayList; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +public class MtFactoryDataDTO extends MtFactoryOrderMain { + + @JsonProperty("发货单明细") + private List orderList = new ArrayList<>(); + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryOrderDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryOrderDTO.java new file mode 100644 index 000000000..cc59e95a2 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryOrderDTO.java @@ -0,0 +1,18 @@ +package com.logpm.factory.mt.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.logpm.factory.snm.entity.MtFactoryOrder; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.ArrayList; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = true) +public class MtFactoryOrderDTO extends MtFactoryOrder { + + @JsonProperty("包装明细") + private List packageInfos = new ArrayList<>(); + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtPackageInfoDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtPackageInfoDTO.java new file mode 100644 index 000000000..35eef1c9a --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtPackageInfoDTO.java @@ -0,0 +1,10 @@ +package com.logpm.factory.mt.dto; + +import com.logpm.factory.snm.entity.MtPackageInfo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class MtPackageInfoDTO extends MtPackageInfo { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java new file mode 100644 index 000000000..5c7314161 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java @@ -0,0 +1,70 @@ +package com.logpm.factory.receiver; + +import com.logpm.factory.snm.dto.OrderStatusDTO; +import com.logpm.factory.snm.service.IPanFactoryDataService; +import com.logpm.oldproject.feign.IAdvanceDetailClient; +import com.rabbitmq.client.Channel; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.exception.CustomerException; +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.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + + +/** + * 获取订单数据 处理器 + * + * @author yangkai.shen + */ +@Slf4j +@RabbitListener(queues = RabbitConstant.DEAL_WITH_QUEUE) +@Component +public class DealWithDataHandler { + + @Autowired + private IAdvanceDetailClient advanceDetailClient; + @Autowired + private IPanFactoryDataService panFactoryDataService; + + private Integer retryCount = 1; + + @RabbitHandler + public void dealWithDataHandler(Map map, Message message, Channel channel) throws IOException { + // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 + final long deliveryTag = message.getMessageProperties().getDeliveryTag(); + log.info("##################我进入这里了 retryCount={}",retryCount++); + OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData"); + String status = orderStatusDTO.getStatus(); + String unitNo = orderStatusDTO.getUnitNo(); + if("4".equals(status)){ + //继续判断是否到达目的仓 + String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id + //查询destinationWarehouse logiBillNo plantId数据 + Map supplyData = advanceDetailClient.getSupplyData(unitNo); + String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id + if(StringUtil.isBlank(currentWarehouseId)||StringUtil.isBlank(destinationWarehouseId)){ + log.warn("##############dealWithDataHandler: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId); + throw new CustomerException(405,"仓库数据有误"); + }else{ + if(!currentWarehouseId.equals(destinationWarehouseId)){ + log.info("##############dealWithDataHandler: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}",currentWarehouseId,destinationWarehouseId); + channel.basicAck(deliveryTag,false); + }else{ + //真正的处理需要的数据 + panFactoryDataService.handleDataToPlatform(unitNo); + } + } + + }else{ + log.info("##############dealWithDataHandler: 不用处理的状态 status={}",status); + channel.basicAck(deliveryTag,false); + } + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DirectQueueOneHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DirectQueueOneHandler.java deleted file mode 100644 index 9c644acab..000000000 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DirectQueueOneHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.logpm.factory.receiver; - -/** - * 直接队列1 处理器 - * - * @author yangkai.shen - */ -//@Slf4j -//@RabbitListener(queues = RabbitConstant.DIRECT_MODE_QUEUE_ONE) -//@Component -public class DirectQueueOneHandler { - -// @RabbitHandler -// public void directHandlerManualAck(PanFactoryOrderDTO factoryOrderDTO, Message message, Channel channel) { -// // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 -// final long deliveryTag = message.getMessageProperties().getDeliveryTag(); -// try { -// log.info("直接队列1,手动ACK,接收消息:{}", factoryOrderDTO); -// //通知 MQ 消息已被成功消费,可以ACK了 -// channel.basicAck(deliveryTag, false); -// } catch (IOException e) { -// try { -// // 处理失败,重新压入MQ -// channel.basicRecover(); -// } catch (IOException e1) { -// e1.printStackTrace(); -// } -// } -// } -} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ErrorQueueHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ErrorQueueHandler.java new file mode 100644 index 000000000..8410156ec --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ErrorQueueHandler.java @@ -0,0 +1,56 @@ +package com.logpm.factory.receiver; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.logpm.factory.snm.entity.OrderStatusLog; +import com.logpm.factory.snm.service.IOrderStatusLogService; +import com.rabbitmq.client.Channel; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + + +/** + * 异常消息队列 处理器 + * + * @author zhy + */ +@Slf4j +@RabbitListener(queues = RabbitConstant.ERROR_QUEUE) +@Component +public class ErrorQueueHandler { + + @Autowired + private IOrderStatusLogService orderStatusLogService; + + @RabbitHandler + public void orderStatusHandlerManualAck(Map map, Message message, Channel channel) { + // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 + final long deliveryTag = message.getMessageProperties().getDeliveryTag(); + try { + Long logId = (Long) map.get("logId"); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("status",2) + .eq("id",logId); + boolean updateFlag = orderStatusLogService.update(updateWrapper); + if(updateFlag){ + channel.basicAck(deliveryTag, false); + }else{ + channel.basicReject(deliveryTag,true); + } + } catch (IOException e) { + try { + // 处理失败,重新压入MQ + channel.basicReject(deliveryTag,true); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java new file mode 100644 index 000000000..bb1787d7e --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java @@ -0,0 +1,52 @@ +package com.logpm.factory.receiver; + +import com.logpm.factory.snm.dto.OrderInfoDTO; +import com.logpm.factory.snm.service.IPanFactoryDataService; +import com.rabbitmq.client.Channel; +import lombok.extern.slf4j.Slf4j; +import org.springblade.common.constant.RabbitConstant; +import org.springblade.common.exception.CustomerException; +import org.springblade.core.tool.api.R; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Map; + + +/** + * 直接队列1 处理器 + * + * @author yangkai.shen + */ +@Slf4j +@RabbitListener(queues = RabbitConstant.OPEN_ORDER_QUEUE) +@Component +public class OpenOrderHandler { + + @Autowired + private IPanFactoryDataService panFactoryDataService; + + private Integer retryCount = 1; + + @RabbitHandler + public void openOrderStatusHandler(Map map, Message message, Channel channel) throws IOException { + // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 + final long deliveryTag = message.getMessageProperties().getDeliveryTag(); + String msg = new String(message.getBody()); + log.info("##################我进入这里了 retryCount={}",retryCount++); + OrderInfoDTO orderInfoDTO = (OrderInfoDTO) map.get("messageData"); + String orderNo = orderInfoDTO.getOrderNo(); + R r = panFactoryDataService.handleData(orderInfoDTO); + int code = r.getCode(); + if(code == 400 || code == 200){ + log.info("##################openOrderStatusHandler: 该条数据不用处理 orderNo={}",orderNo); + channel.basicAck(deliveryTag,true); + }else{ + throw new CustomerException(code,r.getMsg()); + } + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/bean/Resp.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/bean/Resp.java index 8ff501472..3e7383b06 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/bean/Resp.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/bean/Resp.java @@ -7,13 +7,23 @@ import org.springblade.core.tool.api.R; public class Resp extends R { private String orderNo; + private String deliveryNumber; - public static Resp successOrderNo(String orderNo,String msg){ + public static Resp successOrderNo(String orderNo,String deliveryNumber,String msg){ Resp resp = new Resp(); resp.setMsg(msg); resp.setCode(1); resp.setSuccess(true); resp.setOrderNo(orderNo); + resp.setDeliveryNumber(deliveryNumber); + return resp; + } + + public static Resp fail(int code,String message){ + Resp resp = new Resp(); + resp.setMsg(message); + resp.setCode(code); + resp.setSuccess(false); return resp; } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java index 92ee6f8d7..0746f1dc9 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java @@ -18,11 +18,12 @@ package com.logpm.factory.snm.controller; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.dto.*; import com.logpm.factory.snm.entity.PanFactoryOrder; -import com.logpm.factory.snm.entity.PanOrderStatusLog; +import com.logpm.factory.snm.entity.OrderStatusLog; import com.logpm.factory.snm.entity.PanPackageInfo; import com.logpm.factory.snm.entity.PanPackageList; import com.logpm.factory.snm.service.*; @@ -30,15 +31,21 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.common.constant.RabbitConstant; import org.springblade.common.exception.CustomerException; +import org.springblade.common.utils.CommonUtil; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; +import org.springframework.amqp.rabbit.connection.CorrelationData; +import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.*; /** * 皮阿诺数据 控制器 @@ -58,7 +65,8 @@ public class PanFactoryDataController extends BladeController { private final IPanPackageListService packageListService; private final IPanFactoryDataService factoryDataService; private final IAsyncDataService syncDataService; - private final IPanOrderStatusLogService panOrderStatusLogService; + private RabbitTemplate rabbitTemplate; + private final IOrderStatusLogService panOrderStatusLogService; // @ResponseBody // @PostMapping("/token") @@ -100,12 +108,22 @@ public class PanFactoryDataController extends BladeController { String corpId = request.getHeader("corpId"); //先保存原始请求数据 - PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); + OrderStatusLog panOrderStatusLog = new OrderStatusLog(); panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO)); panOrderStatusLog.setStatus(1); panOrderStatusLog.setType(3); panOrderStatusLogService.save(panOrderStatusLog); + //判断数据是否已存入 + String orderNo = factoryOrderDTO.getOrderNo(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_no",orderNo); + PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); + if(!Objects.isNull(one)){ + log.warn("############data: 订单数据已存在 orderNo={}",orderNo); + return Resp.fail(400,"订单数据已存在"); + } + PanFactoryOrder factoryOrder = new PanFactoryOrder(); BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); factoryOrder.setCorpid(corpId); @@ -141,7 +159,7 @@ public class PanFactoryDataController extends BladeController { //开启异步线程处理数据 syncDataService.handlerPanDataToHt(); - return Resp.successOrderNo(factoryOrder.getOrderNo(),"SUCCESS"); + return Resp.successOrderNo(factoryOrder.getOrderNo(),factoryOrder.getDeliveryNumber(),"SUCCESS"); } @@ -152,8 +170,24 @@ public class PanFactoryDataController extends BladeController { public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { log.info("############sendOrders: 请求参数{}",orderInfoDTO); try{ - R r = factoryDataService.handleData(orderInfoDTO); - return r; + + //先保存原始请求数据 + OrderStatusLog panOrderStatusLog = new OrderStatusLog(); + panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); + panOrderStatusLog.setStatus(1); + panOrderStatusLog.setType(1); + panOrderStatusLogService.save(panOrderStatusLog); + + Map map=new HashMap<>(); + map.put("messageId", CommonUtil.getUUID()); + map.put("logId", panOrderStatusLog.getId()); + map.put("messageData",orderInfoDTO); + map.put("createTime",new Date().getTime()); + //将消息携带绑定键值 + rabbitTemplate.convertAndSend(RabbitConstant.OPEN_ORDER_EXCHANGE, RabbitConstant.OPEN_ORDER_ROUTING, map,new CorrelationData(String.valueOf(panOrderStatusLog.getId()))); + +// R r = factoryDataService.handleData(orderInfoDTO); + return R.success("调用成功"); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); @@ -171,8 +205,28 @@ public class PanFactoryDataController extends BladeController { public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); try{ - R r = factoryDataService.handleStatusData(orderStatusDTO); - return r; + + //先保存原始请求数据 + OrderStatusLog panOrderStatusLog = new OrderStatusLog(); + panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); + panOrderStatusLog.setStatus(1); + panOrderStatusLog.setType(2); + panOrderStatusLogService.save(panOrderStatusLog); + + Map map=new HashMap<>(); + map.put("messageId", CommonUtil.getUUID()); + map.put("logId", panOrderStatusLog.getId()); + map.put("type", "Push"); + map.put("messageData",orderStatusDTO); + map.put("createTime",new Date().getTime()); + //将消息携带绑定键值 + rabbitTemplate.convertAndSend(RabbitConstant.ORDER_STATUS_EXCHANGE, RabbitConstant.ORDER_STATUS_ROUTING, map); + map.put("type", "DealWith"); + rabbitTemplate.convertAndSend(RabbitConstant.DEAL_WITH_EXCHANGE, RabbitConstant.DEAL_WITH_ROUTING,map); + + +// R r = factoryDataService.handleStatusData(orderStatusDTO); + return R.success("调用成功"); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java index f3b519335..365f29449 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java @@ -20,6 +20,7 @@ import lombok.Data; import org.springblade.core.tool.utils.StringUtil; import javax.validation.constraints.NotEmpty; +import java.io.Serializable; /** * PHP传过来的OrderInfo @@ -28,7 +29,7 @@ import javax.validation.constraints.NotEmpty; * @since 2023-06-12 */ @Data -public class OrderInfoDTO { +public class OrderInfoDTO implements Serializable { private static final long serialVersionUID = 1L; @NotEmpty(message = "客户订单号不能为空") diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderStatusDTO.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderStatusDTO.java index 084f7d865..852b4f929 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderStatusDTO.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderStatusDTO.java @@ -20,6 +20,7 @@ import lombok.Data; import org.springblade.core.tool.utils.StringUtil; import javax.validation.constraints.NotEmpty; +import java.io.Serializable; /** * OrderStatus @@ -28,7 +29,7 @@ import javax.validation.constraints.NotEmpty; * @since 2023-06-12 */ @Data -public class OrderStatusDTO { +public class OrderStatusDTO implements Serializable { private static final long serialVersionUID = 1L; @NotEmpty(message = "派车单号不能为空") diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.java new file mode 100644 index 000000000..5be6cb8c7 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.java @@ -0,0 +1,7 @@ +package com.logpm.factory.snm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.factory.snm.entity.MtFactoryOrderMain; + +public interface MtFactoryOrderMainMapper extends BaseMapper { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.xml new file mode 100644 index 000000000..5093c771a --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.java similarity index 88% rename from blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.java rename to blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.java index 231109f40..04b6b31b1 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.java @@ -17,7 +17,7 @@ package com.logpm.factory.snm.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.logpm.factory.snm.entity.PanOrderStatusLog; +import com.logpm.factory.snm.entity.OrderStatusLog; /** * 工厂推送数据接口日志 Mapper 接口 @@ -25,7 +25,7 @@ import com.logpm.factory.snm.entity.PanOrderStatusLog; * @author zhy * @since 2023-03-28 */ -public interface PanOrderStatusLogMapper extends BaseMapper { +public interface OrderStatusLogMapper extends BaseMapper { } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.xml similarity index 93% rename from blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.xml rename to blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.xml index ce887dc99..3e4056f86 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.xml +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryDataService.java new file mode 100644 index 000000000..f0d37d1ce --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryDataService.java @@ -0,0 +1,12 @@ +package com.logpm.factory.snm.service; + +import com.logpm.factory.mt.dto.MtFactoryDataDTO; + +/** + * 工厂推送数据接口 + */ +public interface IMtFactoryDataService { + + boolean dealWithData(MtFactoryDataDTO mtFactoryDataDTO); + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryOrderMainService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryOrderMainService.java new file mode 100644 index 000000000..e44d9a8b2 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryOrderMainService.java @@ -0,0 +1,8 @@ +package com.logpm.factory.snm.service; + +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import org.springblade.core.mp.base.BaseService; + +public interface IMtFactoryOrderMainService extends BaseService { + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderStatusLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderStatusLogService.java new file mode 100644 index 000000000..2c0de1db6 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderStatusLogService.java @@ -0,0 +1,8 @@ +package com.logpm.factory.snm.service; + +import com.logpm.factory.snm.entity.OrderStatusLog; +import org.springblade.core.mp.base.BaseService; + +public interface IOrderStatusLogService extends BaseService { + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java index 09bd2788a..003238c1d 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java @@ -14,4 +14,7 @@ public interface IPanFactoryDataService { R handleData(OrderInfoDTO orderInfoDTO); R handleStatusData(OrderStatusDTO orderStatusDTO); + + void handleDataToPlatform(String unitNo); + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanOrderStatusLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanOrderStatusLogService.java deleted file mode 100644 index d4c4bf09b..000000000 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanOrderStatusLogService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.logpm.factory.snm.service; - -import com.logpm.factory.snm.entity.PanOrderStatusLog; -import org.springblade.core.mp.base.BaseService; - -public interface IPanOrderStatusLogService extends BaseService { - -} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryDataServiceImpl.java new file mode 100644 index 000000000..ca983967d --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryDataServiceImpl.java @@ -0,0 +1,39 @@ +package com.logpm.factory.snm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.factory.mt.dto.MtFactoryDataDTO; +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.service.IMtFactoryDataService; +import com.logpm.factory.snm.service.IMtFactoryOrderMainService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Objects; + +@Slf4j +@Service +@AllArgsConstructor +public class MtFactoryDataServiceImpl implements IMtFactoryDataService { + + private final IMtFactoryOrderMainService mtFactoryOrderMainService; + + @Transactional + @Override + public boolean dealWithData(MtFactoryDataDTO mtFactoryDataDTO) { + log.info("#############dealWithData: 处理梦天工厂数据 开始"); + String invoiceOrderCode = mtFactoryDataDTO.getInvoiceOrderCode();//发货单编码 + //先判断该发货单编码是否已经存在 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("invoice_order_code",invoiceOrderCode); + MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper); + if(Objects.isNull(mtFactoryOrderMain)){ + + } + + + + return false; + } +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryOrderMainServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryOrderMainServiceImpl.java new file mode 100644 index 000000000..cc557b5bb --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryOrderMainServiceImpl.java @@ -0,0 +1,15 @@ +package com.logpm.factory.snm.service.impl; + +import com.logpm.factory.snm.entity.MtFactoryOrderMain; +import com.logpm.factory.snm.mapper.MtFactoryOrderMainMapper; +import com.logpm.factory.snm.service.IMtFactoryOrderMainService; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@AllArgsConstructor +@Service +public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl implements IMtFactoryOrderMainService { + + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderStatusLogServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderStatusLogServiceImpl.java new file mode 100644 index 000000000..305b4ec25 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderStatusLogServiceImpl.java @@ -0,0 +1,19 @@ +package com.logpm.factory.snm.service.impl; + +import com.logpm.factory.snm.entity.OrderStatusLog; +import com.logpm.factory.snm.mapper.OrderStatusLogMapper; +import com.logpm.factory.snm.service.IOrderStatusLogService; +import lombok.AllArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@AllArgsConstructor +@Service +public class OrderStatusLogServiceImpl extends BaseServiceImpl implements IOrderStatusLogService { + + private static final Logger logger = LoggerFactory.getLogger(OrderStatusLogServiceImpl.class); + + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java index 79b7d6542..181ada612 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java @@ -1,23 +1,34 @@ package com.logpm.factory.snm.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.distribution.entity.DistributionParcelListEntity; +import com.logpm.distribution.entity.DistributionStockArticleEntity; +import com.logpm.distribution.feign.IDistributionParcelListClient; +import com.logpm.distribution.feign.IDistributionStockArticleClient; import com.logpm.factory.props.PanFactoryProperties; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.dto.OrderInfoDTO; import com.logpm.factory.snm.dto.OrderStatusDTO; import com.logpm.factory.snm.entity.PanFactoryOrder; -import com.logpm.factory.snm.entity.PanOrderStatusLog; +import com.logpm.factory.snm.entity.OrderStatusLog; import com.logpm.factory.snm.entity.PanPackageInfo; import com.logpm.factory.snm.service.IPanFactoryDataService; import com.logpm.factory.snm.service.IPanFactoryOrderService; -import com.logpm.factory.snm.service.IPanOrderStatusLogService; +import com.logpm.factory.snm.service.IOrderStatusLogService; import com.logpm.factory.snm.service.IPanPackageInfoService; +import com.logpm.oldproject.entity.AdvanceDetailEntity; +import com.logpm.oldproject.entity.AdvanceEntity; +import com.logpm.oldproject.entity.OrderEntity; +import com.logpm.oldproject.feign.IAdvanceClient; import com.logpm.oldproject.feign.IAdvanceDetailClient; +import com.logpm.oldproject.feign.IOrderClient; import com.logpm.oldproject.feign.IWarehouseClient; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,10 +36,9 @@ import org.springblade.common.exception.CustomerException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; +import java.util.*; @AllArgsConstructor @Service @@ -42,11 +52,16 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { private final IPanFactoryOrderService factoryOrderService; private final PanFactoryProperties panFactoryProperties; - private final IPanOrderStatusLogService panOrderStatusLogService; + private final IOrderStatusLogService panOrderStatusLogService; private final IPanPackageInfoService panPackageInfoService; private final IPanFactoryOrderService panFactoryOrderService; private final IAdvanceDetailClient advanceDetailClient; private final IWarehouseClient warehouseClient; + private final IOrderClient orderClient; + private final IAdvanceClient advanceClient; + + private final IDistributionParcelListClient distributionParcelListClient; + private final IDistributionStockArticleClient distributionStockArticleClient; // @Override // public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException { @@ -91,12 +106,12 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { // return factoryTokenVO; // } - + @Transactional @Override public R handleData(OrderInfoDTO orderInfoDTO) throws CustomerException { //先保存原始请求数据 - PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); + OrderStatusLog panOrderStatusLog = new OrderStatusLog(); panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); panOrderStatusLog.setStatus(1); panOrderStatusLog.setType(1); @@ -120,7 +135,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { //判断数据是都已存在 if(!orderInfoDTO.verifyData()){ logger.info("#############handleData: 数据不齐全 orderInfoDTO={}",orderInfoDTO); - return R.fail(400,"数据不齐全"); + return R.fail(405,"数据不齐全"); } //拼接参数 @@ -152,22 +167,21 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { String message = payload.getString("data"); if(code.equals(1)){ logger.info("##########handleData: 物流状态传递成功"); - panOrderStatusLog.setStatus(0); - panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); }else{ - return R.fail(400,message); + return R.fail(405,message); } }else{ - return R.fail(400,"返回格式有误:"+result); + return R.fail(405,"返回格式有误:"+result); } return Resp.success("SUCCESS"); } + @Transactional @Override public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException { //先保存原始请求数据 - PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); + OrderStatusLog panOrderStatusLog = new OrderStatusLog(); panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); panOrderStatusLog.setStatus(1); panOrderStatusLog.setType(2); @@ -208,7 +222,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { //判断数据是都已存在 if(!orderStatusDTO.verifyData()){ logger.info("#############handleStatusData: 数据不齐全 orderStatusDTO={}",orderStatusDTO); - return Resp.fail(400,"数据不齐全"); + return Resp.fail(405,"数据不齐全"); } //拼接参数 @@ -240,18 +254,15 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { String message = payload.getString("data"); if(code.equals(1)){ logger.info("##########handleStatusData: 物流状态传递成功"); - panOrderStatusLog.setStatus(0); - panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); }else{ - return Resp.fail(400,message); + return Resp.fail(405,message); } }else{ - return Resp.fail(400,"返回格式有误:"+result); + return Resp.fail(405,"返回格式有误:"+result); } return Resp.success("SUCCESS"); } - private String getPanToken(){ Map map = new HashMap<>(); map.put("client_id",panFactoryProperties.getClientId()); @@ -277,4 +288,86 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { } + @Transactional + @Override + public void handleDataToPlatform(String unitNo) { + logger.info("############handleDataToPlatform: 处理数据到platform unitNo={}",unitNo); + //先查询包件是否已存入到新系统数据库 + DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo); + if(Objects.isNull(distributionParcelListEntity)){ + //未找到包件信息那就去新增 + //1.根据包条码去老系统数据库找到对应的包条信息 + AdvanceDetailEntity advanceDetailEntity = advanceDetailClient.getOneByUnitNo(unitNo); + if(Objects.isNull(advanceDetailEntity)){ + logger.warn("#################handleDataToPlatform: 未找到对应的包条信息 unitNo={}",unitNo); + throw new CustomerException(405,"未找到对应的包条信息"); + } + //2.根据包条信息拿到订单信息 + String orderSelfNum = advanceDetailEntity.getOrderSelfNum();//订单自编码 + //2.1如果订单信息出现两条,就正序排列取时间最早的一条,并在存入platform的时候打上标记 + List orderEntityList = orderClient.getOrderByOrderSelfNum(orderSelfNum); + AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderSelfNum); + if(Objects.isNull(advanceEntity)){ + logger.warn("#################handleDataToPlatform: 未找到对应的订单信息 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"未找到对应的订单信息"); + } + int size = orderEntityList.size();//数据数量 + if(size < 1){ + logger.warn("#################handleDataToPlatform: 未找到对应的订单信息 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"未找到对应的订单信息"); + } + OrderEntity orderEntity = orderEntityList.get(0); + Integer warehouseId = orderEntity.getWarehouseId();//仓库id + //根据仓库id查询仓库 + String warehouseName = warehouseClient.selectNameById(warehouseId); + + DistributionStockArticleEntity distributionStockArticleEntity = new DistributionStockArticleEntity(); + distributionStockArticleEntity.setServiceNumber(orderEntity.getServicenum()); + distributionStockArticleEntity.setOrderSelfNumbering(orderEntity.getSelfnumber()); + distributionStockArticleEntity.setMallName(advanceEntity.getStoreName()); + distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName()); + distributionStockArticleEntity.setWarehouse(warehouseName); + distributionStockArticleEntity.setWarehouseEntryTime(null);//TODO 入库时间没找到 + distributionStockArticleEntity.setStoreTime(0);//TODO + distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal()); + distributionStockArticleEntity.setHandQuantity(0);//TODO + distributionStockArticleEntity.setCompleteSet(1);//TODO + distributionStockArticleEntity.setBrand(advanceEntity.getType()); + distributionStockArticleEntity.setTypeService(orderEntity.getDoor()); + distributionStockArticleEntity.setCustomerName(orderEntity.getContact()); + distributionStockArticleEntity.setCustomerTelephone(orderEntity.getPhone()); + distributionStockArticleEntity.setCustomerAddress(orderEntity.getAddress()); + distributionStockArticleEntity.setGenre(2); + distributionStockArticleEntity.setState(2); + if(size > 1){ + distributionStockArticleEntity.setReserve1("multiple"); + } + Long id = distributionStockArticleClient.addData(distributionStockArticleEntity); + if(id == 0){ + logger.warn("#################handleDataToPlatform: 保存订单信息失败 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"保存订单信息失败"); + } + //通过订单自编号查询包件信息 + List detailList = advanceDetailClient.getListByOrderSelfNum(orderSelfNum); + + List parcelListEntityList = new ArrayList<>(); + for (DistributionParcelListEntityVO vo:detailList){ + DistributionParcelListEntity entity = new DistributionParcelListEntity(); + BeanUtil.copyProperties(vo,entity); + entity.setStockArticleId(id+""); + parcelListEntityList.add(entity); + } + boolean b = distributionParcelListClient.addBatch(parcelListEntityList); + if(!b){ + logger.warn("#################handleDataToPlatform: 保存包件信息失败 orderSelfNum={}",orderSelfNum); + throw new CustomerException(405,"保存包件信息失败"); + } + + logger.info("#################handleDataToPlatform: 数据处理完成"); + }else{ + //已存在包件信息那就不处理 + logger.info("#################handleDataToPlatform: 包件信息已存在,不用处理 unitNo={}",unitNo); + } + } + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanOrderStatusLogServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanOrderStatusLogServiceImpl.java deleted file mode 100644 index c69058c1a..000000000 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanOrderStatusLogServiceImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.logpm.factory.snm.service.impl; - -import com.logpm.factory.snm.entity.PanOrderStatusLog; -import com.logpm.factory.snm.mapper.PanOrderStatusLogMapper; -import com.logpm.factory.snm.service.IPanOrderStatusLogService; -import lombok.AllArgsConstructor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -@AllArgsConstructor -@Service -public class PanOrderStatusLogServiceImpl extends BaseServiceImpl implements IPanOrderStatusLogService { - - private static final Logger logger = LoggerFactory.getLogger(PanOrderStatusLogServiceImpl.class); - - -} diff --git a/blade-service/logpm-factory/src/main/resources/application.yml b/blade-service/logpm-factory/src/main/resources/application.yml index ed6606aa2..cf42bc689 100644 --- a/blade-service/logpm-factory/src/main/resources/application.yml +++ b/blade-service/logpm-factory/src/main/resources/application.yml @@ -35,14 +35,34 @@ logging: spring: main: allow-circular-references: true + #rabbitmq配置 -# rabbitmq: -# host: 192.168.2.100 -# port: 5672 -# username: admin -# password: admin -# #虚拟host 可以不设置,使用server默认host -# virtual-host: / + rabbitmq: + host: 192.168.2.100 + 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 + xxl: job: accessToken: '' diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java index 60097cf6e..c62a7d50a 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java @@ -18,12 +18,14 @@ package com.logpm.oldproject.feign; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.service.IAdvanceDetailService; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; import java.util.Map; /** @@ -66,4 +68,16 @@ public class AdvanceDetailClient implements IAdvanceDetailClient { return map; } + @Override + @GetMapping(API_PREFIX + "/getOneByUnitNo") + public AdvanceDetailEntity getOneByUnitNo(String unitNo) { + //查询对应的包件信息 + return advanceDetailService.getOneByUnitNo(unitNo); + } + + @Override + public List getListByOrderSelfNum(String orderSelfNum) { + return advanceDetailService.getListByOrderSelfNum(orderSelfNum); + } + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java new file mode 100644 index 000000000..be6e55042 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java @@ -0,0 +1,44 @@ +/* + * 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.oldproject.feign; + +import com.logpm.oldproject.entity.OrderEntity; +import com.logpm.oldproject.service.IOrderService; +import lombok.AllArgsConstructor; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import java.util.List; + +/** + * order Feign实现类 + * + * @author zhy + * @since 2023-06-24 + */ +@ApiIgnore() +@RestController +@AllArgsConstructor +public class OrderClient implements IOrderClient { + + private IOrderService orderService; + + @Override + public List getOrderByOrderSelfNum(String orderSelfNum) { + return orderService.getOrderByOrderSelfNum(orderSelfNum); + } +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java index d4f3eb109..c37da4ec0 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java @@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.vo.AdvanceDetailVO; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -50,4 +51,7 @@ public interface AdvanceDetailMapper extends BaseMapper { Boolean addAll(@Param("param") AdvanceDetailEntity advanceDetailEntity); Map getSupplyData(@Param("unitNo") String unitNo); + + List getListByOrderSelfNum(@Param("orderSelfNum") String orderSelfNum); + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml index 72107c5f2..dac7e55a3 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml @@ -78,7 +78,8 @@ + + + diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java new file mode 100644 index 000000000..4fc4849f1 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java @@ -0,0 +1,31 @@ +/* + * 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.oldproject.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.logpm.oldproject.entity.OrderEntity; + +/** + * 订单 Mapper 接口 + * + * @author zhy + * @since 2023-06-24 + */ +public interface OrderMapper extends BaseMapper { + + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml new file mode 100644 index 000000000..ebb7cb43e --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java index a17098c74..ef9ea212a 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java @@ -17,7 +17,9 @@ package com.logpm.oldproject.service; import com.logpm.oldproject.entity.AdvanceDetailEntity; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; +import java.util.List; import java.util.Map; /** @@ -32,4 +34,9 @@ public interface IAdvanceDetailService { Boolean addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity); Map getSupplyData(String unitNo); + + AdvanceDetailEntity getOneByUnitNo(String unitNo); + + List getListByOrderSelfNum(String orderSelfNum); + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java new file mode 100644 index 000000000..ba76f2798 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java @@ -0,0 +1,11 @@ +package com.logpm.oldproject.service; + +import com.logpm.oldproject.entity.OrderEntity; + +import java.util.List; + +public interface IOrderService { + + List getOrderByOrderSelfNum(String orderSelfNum); + +} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java index 2d4257d82..fbc6f6779 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java @@ -16,12 +16,15 @@ */ package com.logpm.oldproject.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.mapper.AdvanceDetailMapper; import com.logpm.oldproject.service.IAdvanceDetailService; +import com.logpm.oldproject.vo.DistributionParcelListEntityVO; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -49,5 +52,17 @@ public class AdvanceDetailServiceImpl implements IAdvanceDetailService { return map; } + @Override + public AdvanceDetailEntity getOneByUnitNo(String unitNo) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("unitNo",unitNo); + return advanceDetailMapper.selectOne(queryWrapper); + } + + @Override + public List getListByOrderSelfNum(String orderSelfNum) { + return advanceDetailMapper.getListByOrderSelfNum(orderSelfNum); + } + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java new file mode 100644 index 000000000..c6fee8115 --- /dev/null +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java @@ -0,0 +1,25 @@ +package com.logpm.oldproject.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.logpm.oldproject.entity.OrderEntity; +import com.logpm.oldproject.mapper.OrderMapper; +import com.logpm.oldproject.service.IOrderService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@AllArgsConstructor +public class OrderServiceImpl implements IOrderService { + + private OrderMapper orderMapper; + + @Override + public List getOrderByOrderSelfNum(String orderSelfNum) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("selfnumber",orderSelfNum) + .orderByAsc("create_time"); + return orderMapper.selectList(queryWrapper); + } +}