Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev-warehouse
caoyizhong 2 years ago
parent
commit
bde1d89761
  1. 71
      blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java
  2. 5
      blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  3. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAreaClient.java
  4. 10
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionReservationEntity.java
  5. 10
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  6. 6
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  7. 81
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrder.java
  8. 57
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtFactoryOrderMain.java
  9. 54
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java
  10. 8
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/OrderStatusLog.java
  11. 155
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/OrderEntity.java
  12. 9
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java
  13. 43
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IOrderClient.java
  14. 67
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/vo/DistributionParcelListEntityVO.java
  15. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataWarehouseController.java
  16. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java
  17. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  18. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  19. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  20. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  21. 14
      blade-service/logpm-factory/pom.xml
  22. 166
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java
  23. 124
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java
  24. 18
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryDataDTO.java
  25. 18
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtFactoryOrderDTO.java
  26. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtPackageInfoDTO.java
  27. 70
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  28. 30
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DirectQueueOneHandler.java
  29. 56
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ErrorQueueHandler.java
  30. 52
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java
  31. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/bean/Resp.java
  32. 70
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java
  33. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderInfoDTO.java
  34. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/dto/OrderStatusDTO.java
  35. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.java
  36. 20
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.xml
  37. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.java
  38. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.xml
  39. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryDataService.java
  40. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IMtFactoryOrderMainService.java
  41. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderStatusLogService.java
  42. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java
  43. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanOrderStatusLogService.java
  44. 39
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryDataServiceImpl.java
  45. 15
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/MtFactoryOrderMainServiceImpl.java
  46. 19
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderStatusLogServiceImpl.java
  47. 133
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java
  48. 19
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanOrderStatusLogServiceImpl.java
  49. 34
      blade-service/logpm-factory/src/main/resources/application.yml
  50. 14
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java
  51. 44
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OrderClient.java
  52. 4
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java
  53. 23
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml
  54. 31
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.java
  55. 7
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml
  56. 7
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java
  57. 11
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IOrderService.java
  58. 15
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java
  59. 25
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/OrderServiceImpl.java

71
blade-biz-common/src/main/java/org/springblade/common/constant/RabbitConstant.java

@ -6,53 +6,26 @@ package org.springblade.common.constant;
* @author yangkai.shen * @author yangkai.shen
*/ */
public interface RabbitConstant { public interface RabbitConstant {
/** //消费失败队列
* 直接模式1 String ERROR_QUEUE = "error_queue";
*/ String ERROR_EXCHANGE = "error_exchange";
String DIRECT_MODE_QUEUE_ONE = "queue.direct.1"; String ERROR_ROUTING = "error_routing";
/**
* 队列2 //订单状态消息队列配置
*/ String ORDER_STATUS_QUEUE = "order_status_queue";
String QUEUE_TWO = "queue.2"; String ORDER_STATUS_EXCHANGE = "order_status_exchange";
String ORDER_STATUS_ROUTING = "order_status_routing";
/**
* 队列3
*/ String OPEN_ORDER_QUEUE = "open_order_queue";
String QUEUE_THREE = "3.queue"; String OPEN_ORDER_EXCHANGE = "open_order_exchange";
String OPEN_ORDER_ROUTING = "open_order_routing";
/**
* 分列模式
*/ String DEAL_WITH_QUEUE = "deal_with_queue";
String FANOUT_MODE_QUEUE = "fanout.mode"; String DEAL_WITH_EXCHANGE = "deal_with_exchange";
String DEAL_WITH_ROUTING = "deal_with_routing";
/**
* 主题模式
*/
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";
} }

5
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.Date;
import java.util.Random; import java.util.Random;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.UUID;
/** /**
* 通用工具类 * 通用工具类
@ -91,4 +92,8 @@ public class CommonUtil {
} }
public static String getUUID(){
return UUID.randomUUID().toString().replace("-", "");
}
} }

2
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 { public interface IBasicdataGoodsAreaClient {
String API_PREFIX = "/client"; String API_PREFIX = "goodsArea/client";
String TOP = API_PREFIX + "/top"; String TOP = API_PREFIX + "/top";
/** /**

10
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 = "备注") @ApiModelProperty(value = "备注")
private String remarks; private String remarks;
/** // /**
* 预约单编号系统构建生成 // * 预约单编号,系统构建生成
*/ // */
@ApiModelProperty(value = "预约单编号") // @ApiModelProperty(value = "预约单编号")
private String reservationId; // private String reservationId;
/** /**
* 时段 * 时段
*/ */

10
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -16,12 +16,15 @@
*/ */
package com.logpm.distribution.feign; package com.logpm.distribution.feign;
import org.springblade.core.mp.support.BladePage;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
import org.springblade.core.mp.support.BladePage;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/** /**
* 在库订单包件清单 Feign接口类 * 在库订单包件清单 Feign接口类
* *
@ -46,4 +49,9 @@ public interface IDistributionParcelListClient {
@GetMapping(TOP) @GetMapping(TOP)
BladePage<DistributionParcelListEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); BladePage<DistributionParcelListEntity> 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<DistributionParcelListEntity> parcelListEntityList);
} }

6
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -16,10 +16,12 @@
*/ */
package com.logpm.distribution.feign; package com.logpm.distribution.feign;
import org.springblade.core.mp.support.BladePage;
import com.logpm.distribution.entity.DistributionStockArticleEntity; import com.logpm.distribution.entity.DistributionStockArticleEntity;
import org.springblade.core.mp.support.BladePage;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; 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 org.springframework.web.bind.annotation.RequestParam;
/** /**
@ -46,4 +48,6 @@ public interface IDistributionStockArticleClient {
@GetMapping(TOP) @GetMapping(TOP)
BladePage<DistributionStockArticleEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size); BladePage<DistributionStockArticleEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
@PostMapping(API_PREFIX + "/addData")
Long addData(@RequestBody DistributionStockArticleEntity distributionStockArticleEntity);
} }

81
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;
}

57
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;
}

54
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;
}

8
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/PanOrderStatusLog.java → 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; import org.springblade.core.mp.base.BaseEntity;
@Data @Data
@TableName("pan_order_status_log") @TableName("order_status_log")
@ApiModel(value = "PanOrderStatusLog对象", description = "皮艾诺订单状态日志") @ApiModel(value = "OrderStatusLog对象", description = "工厂订单状态日志")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class PanOrderStatusLog extends BaseEntity { public class OrderStatusLog extends BaseEntity {
private String args; private String args;
private Integer type; private Integer type;
private String brand;//品牌
} }

155
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;
}

9
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; package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -66,4 +68,11 @@ public interface IAdvanceDetailClient {
*/ */
@GetMapping(API_PREFIX + "/getSupplyData") @GetMapping(API_PREFIX + "/getSupplyData")
Map<String, String> getSupplyData(@RequestParam String unitNo); Map<String, String> getSupplyData(@RequestParam String unitNo);
@GetMapping(API_PREFIX + "/getOneByUnitNo")
AdvanceDetailEntity getOneByUnitNo(@RequestParam String unitNo);
@GetMapping(API_PREFIX + "/getListByOrderSelfNum")
List<DistributionParcelListEntityVO> getListByOrderSelfNum(@RequestParam String orderSelfNum);
} }

43
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<OrderEntity> getOrderByOrderSelfNum(@RequestParam String orderSelfNum);
}

67
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;
}

3
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.secure.BladeUser;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -84,6 +85,7 @@ public class BasicdataWarehouseController extends BladeController {
qw qw
.apply(startDate != null,"date_format (start_date,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')",startDate) .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); .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<BasicdataWarehouseEntity> page = warehouseService.page(Condition.getPage(query), qw); IPage<BasicdataWarehouseEntity> page = warehouseService.page(Condition.getPage(query), qw);
// IPage<BasicdataWarehouseEntity> pages = warehouseService.page(Condition.getPage(query), Condition.getQueryWrapper(warehouseWarehouse, BasicdataWarehouseEntity.class)); // IPage<BasicdataWarehouseEntity> pages = warehouseService.page(Condition.getPage(query), Condition.getQueryWrapper(warehouseWarehouse, BasicdataWarehouseEntity.class));
return R.data(page); return R.data(page);
@ -97,7 +99,6 @@ public class BasicdataWarehouseController extends BladeController {
@ApiOperation(value = "分页", notes = "传入warehouseWarehouse") @ApiOperation(value = "分页", notes = "传入warehouseWarehouse")
public R<List<BasicdataWarehouseEntity>> listName(String name) { public R<List<BasicdataWarehouseEntity>> listName(String name) {
List<BasicdataWarehouseEntity> pages = warehouseService.pageListName(name); List<BasicdataWarehouseEntity> pages = warehouseService.pageListName(name);
return R.data(pages); return R.data(pages);
} }

1
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) @ApiOperationSupport(order = 4)
@ApiOperation(value = "新增", notes = "传入distrbutionReservation") @ApiOperation(value = "新增", notes = "传入distrbutionReservation")
public R save(@Valid @RequestBody DistributionReservationDTO distributionReservationDTO) { public R save(@Valid @RequestBody DistributionReservationDTO distributionReservationDTO) {
boolean result = reservationService.insertReservation(distributionReservationDTO); boolean result = reservationService.insertReservation(distributionReservationDTO);
return R.status(result); return R.status(result);
} }

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -16,6 +16,7 @@
*/ */
package com.logpm.distribution.feign; package com.logpm.distribution.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.BladePage; 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 org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/** /**
* 在库订单包件清单 Feign实现类 * 在库订单包件清单 Feign实现类
* *
@ -50,4 +53,17 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return BladePage.of(page); return BladePage.of(page);
} }
@Override
@GetMapping(API_PREFIX+"/findByPacketBarCode")
public DistributionParcelListEntity findByPacketBarCode(String unitNo) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("packet_bar_code",unitNo);
return distributionParcelListService.getOne(queryWrapper);
}
@Override
public boolean addBatch(List<DistributionParcelListEntity> parcelListEntityList) {
return distributionParcelListService.saveBatch(parcelListEntityList);
}
} }

10
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); return BladePage.of(page);
} }
@Override
public Long addData(DistributionStockArticleEntity distributionStockArticleEntity) {
boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity);
if(saveFlag){
return distributionStockArticleEntity.getId();
}else{
return 0L;
}
}
} }

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -28,7 +28,7 @@
<result column="order_source" property="orderSource"/> <result column="order_source" property="orderSource"/>
<result column="stockup_status" property="stockupStatus"/> <result column="stockup_status" property="stockupStatus"/>
<result column="goods_shelf_id" property="goodsAreaId"/> <result column="goods_shelf_id" property="goodsAreaId"/>
<result column="reservation_id" property="reservationId"/> <!-- <result column="reservation_id" property="reservationId"/>-->
<result column="period_of_time" property="periodOfTime"/> <result column="period_of_time" property="periodOfTime"/>
<result column="reserve1" property="reserve1"/> <result column="reserve1" property="reserve1"/>
<result column="reserve2" property="reserve2"/> <result column="reserve2" property="reserve2"/>

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -205,6 +205,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} }
//修改预约备货状态 //修改预约备货状态
reservationEntity.setStockupStatus("2"); reservationEntity.setStockupStatus("2");
reservationEntity.setGoodsAreaId(goddsAreaId);
result = SqlHelper.retBool(distributionReservationMapper.updateById(reservationEntity)); result = SqlHelper.retBool(distributionReservationMapper.updateById(reservationEntity));
//构建中间表信息 //构建中间表信息
DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity(); DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity();

14
blade-service/logpm-factory/pom.xml

@ -76,10 +76,16 @@
<artifactId>xxl-job-core</artifactId> <artifactId>xxl-job-core</artifactId>
</dependency> </dependency>
<!--mq--> <!--mq-->
<!-- <dependency>--> <dependency>
<!-- <groupId>org.springframework.boot</groupId>--> <groupId>org.springframework.boot</groupId>
<!-- <artifactId>spring-boot-starter-amqp</artifactId>--> <artifactId>spring-boot-starter-amqp</artifactId>
<!-- </dependency>--> </dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>logpm-distribution-api</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

166
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java

@ -1,53 +1,161 @@
package com.logpm.factory.config; 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配置主要是配置队列如果提前存在该队列可以省略本配置类 * RabbitMQ配置主要是配置队列如果提前存在该队列可以省略本配置类
* *
* @author yangkai.shen * @author yangkai.shen
*/ */
//@Slf4j @Slf4j
//@Configuration(proxyBeanMethods = false) @Configuration
public class RabbitMqConfiguration { public class RabbitMqConfiguration {
// @Bean @Bean
// public RabbitTemplate rabbitTemplate() { public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){
// CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); RabbitTemplate template = new RabbitTemplate();
// connectionFactory.setPublisherConfirms(true); template.setConnectionFactory(connectionFactory);
// connectionFactory.setPublisherReturns(true); template.setMandatory(true);
// RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); template.setConfirmCallback(new RabbitTemplate.ConfirmCallback() {
// rabbitTemplate.setMandatory(true); @Override
// rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> log.info("消息发送成功:correlationData({}),ack({}),cause({})", correlationData, ack, cause)); public void confirm(CorrelationData correlationData, boolean b, String s) {
// rabbitTemplate.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> log.info("消息丢失:exchange({}),route({}),replyCode({}),replyText({}),message:{}", exchange, routingKey, replyCode, replyText, message)); System.out.println("确认回调-相关数据:"+correlationData);
// return rabbitTemplate; System.out.println("确认回调-确认情况:"+b);
// } System.out.println("确认回调-原因:"+s);
// Long id = Long.parseLong(correlationData.getId());
// UpdateWrapper<PanOrderStatusLog> 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 @Bean
// public Queue delayQueue() { public Queue orderStatusQueue() {
// return new Queue(RabbitConstant.DIRECT_MODE_QUEUE_ONE, true); return new Queue(RabbitConstant.ORDER_STATUS_QUEUE, true);
// } }
/** /**
* 延迟队列交换器, x-delayed-type x-delayed-message 固定 * 延迟队列交换器, x-delayed-type x-delayed-message 固定
*/ */
// @Bean @Bean
// public CustomExchange delayExchange() { public CustomExchange orderStatusExchange() {
// Map<String, Object> args = Maps.newHashMap(); Map<String, Object> args = Maps.newHashMap();
// args.put("x-delayed-type", "direct"); args.put("x-delayed-type", "direct");
// return new CustomExchange("TestDirectExchange", "x-delayed-message", true, false, args); return new CustomExchange(RabbitConstant.ORDER_STATUS_EXCHANGE, "x-delayed-message", true, false, args);
// } }
/** /**
* 延迟队列绑定自定义交换器 * 延迟队列绑定自定义交换器
* *
* @param delayQueue 队列 * @param orderStatusQueue 队列
* @param delayExchange 延迟交换器 * @param orderStatusExchange 延迟交换器
*/ */
// @Bean @Bean
// public Binding delayBinding(Queue delayQueue, CustomExchange delayExchange) { public Binding orderStatusBinding(Queue orderStatusQueue, CustomExchange orderStatusExchange) {
// return BindingBuilder.bind(delayQueue).to(delayExchange).with("TestDirectRouting").noargs(); 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<String, Object> 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<String, Object> 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();
}
} }

124
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<PanFactoryOrder> 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<PanPackageInfoDTO> 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> PanPackagelist = new ArrayList<>();
// List<PanPackageListDTO> 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");
}
}

18
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<MtFactoryOrderDTO> orderList = new ArrayList<>();
}

18
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<MtPackageInfoDTO> packageInfos = new ArrayList<>();
}

10
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 {
}

70
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<String,String> 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);
}
}
}

30
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DirectQueueOneHandler.java

@ -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();
// }
// }
// }
}

56
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<OrderStatusLog> 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();
}
}
}
}

52
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());
}
}
}

12
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 { public class Resp extends R {
private String orderNo; 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 resp = new Resp();
resp.setMsg(msg); resp.setMsg(msg);
resp.setCode(1); resp.setCode(1);
resp.setSuccess(true); resp.setSuccess(true);
resp.setOrderNo(orderNo); 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; return resp;
} }
} }

70
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 cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.dto.*; import com.logpm.factory.snm.dto.*;
import com.logpm.factory.snm.entity.PanFactoryOrder; 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.PanPackageInfo;
import com.logpm.factory.snm.entity.PanPackageList; import com.logpm.factory.snm.entity.PanPackageList;
import com.logpm.factory.snm.service.*; import com.logpm.factory.snm.service.*;
@ -30,15 +31,21 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; 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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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 IPanPackageListService packageListService;
private final IPanFactoryDataService factoryDataService; private final IPanFactoryDataService factoryDataService;
private final IAsyncDataService syncDataService; private final IAsyncDataService syncDataService;
private final IPanOrderStatusLogService panOrderStatusLogService; private RabbitTemplate rabbitTemplate;
private final IOrderStatusLogService panOrderStatusLogService;
// @ResponseBody // @ResponseBody
// @PostMapping("/token") // @PostMapping("/token")
@ -100,12 +108,22 @@ public class PanFactoryDataController extends BladeController {
String corpId = request.getHeader("corpId"); String corpId = request.getHeader("corpId");
//先保存原始请求数据 //先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); OrderStatusLog panOrderStatusLog = new OrderStatusLog();
panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO)); panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO));
panOrderStatusLog.setStatus(1); panOrderStatusLog.setStatus(1);
panOrderStatusLog.setType(3); panOrderStatusLog.setType(3);
panOrderStatusLogService.save(panOrderStatusLog); panOrderStatusLogService.save(panOrderStatusLog);
//判断数据是否已存入
String orderNo = factoryOrderDTO.getOrderNo();
QueryWrapper<PanFactoryOrder> 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(); PanFactoryOrder factoryOrder = new PanFactoryOrder();
BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); BeanUtil.copyProperties(factoryOrderDTO,factoryOrder);
factoryOrder.setCorpid(corpId); factoryOrder.setCorpid(corpId);
@ -141,7 +159,7 @@ public class PanFactoryDataController extends BladeController {
//开启异步线程处理数据 //开启异步线程处理数据
syncDataService.handlerPanDataToHt(); 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) { public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) {
log.info("############sendOrders: 请求参数{}",orderInfoDTO); log.info("############sendOrders: 请求参数{}",orderInfoDTO);
try{ 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<String,Object> 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){ }catch (CustomerException e){
log.error(e.message,e); log.error(e.message,e);
return R.fail(e.code,e.message); return R.fail(e.code,e.message);
@ -171,8 +205,28 @@ public class PanFactoryDataController extends BladeController {
public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) {
log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO);
try{ 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<String,Object> 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){ }catch (CustomerException e){
log.error(e.message,e); log.error(e.message,e);
return R.fail(e.code,e.message); return R.fail(e.code,e.message);

3
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 org.springblade.core.tool.utils.StringUtil;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/** /**
* PHP传过来的OrderInfo * PHP传过来的OrderInfo
@ -28,7 +29,7 @@ import javax.validation.constraints.NotEmpty;
* @since 2023-06-12 * @since 2023-06-12
*/ */
@Data @Data
public class OrderInfoDTO { public class OrderInfoDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotEmpty(message = "客户订单号不能为空") @NotEmpty(message = "客户订单号不能为空")

3
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 org.springblade.core.tool.utils.StringUtil;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/** /**
* OrderStatus * OrderStatus
@ -28,7 +29,7 @@ import javax.validation.constraints.NotEmpty;
* @since 2023-06-12 * @since 2023-06-12
*/ */
@Data @Data
public class OrderStatusDTO { public class OrderStatusDTO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotEmpty(message = "派车单号不能为空") @NotEmpty(message = "派车单号不能为空")

7
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<MtFactoryOrderMain> {
}

20
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/MtFactoryOrderMainMapper.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factory.snm.mapper.MtFactoryOrderMainMapper">
<!-- 通用查询映射结果 -->
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">-->
<!-- <result column="id" property="id"/>-->
<!-- <result column="req_args" property="reqArgs"/>-->
<!-- <result column="res_body" property="resBody"/>-->
<!-- <result column="type" property="type"/>-->
<!-- <result column="create_user" property="createUser"/>-->
<!-- <result column="create_time" property="createTime"/>-->
<!-- <result column="update_user" property="updateUser"/>-->
<!-- <result column="update_time" property="updateTime"/>-->
<!-- <result column="status" property="status"/>-->
<!-- <result column="is_deleted" property="isDeleted"/>-->
<!-- <result column="create_dept" property="createDept"/>-->
<!-- </resultMap>-->
</mapper>

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.java → blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.java

@ -17,7 +17,7 @@
package com.logpm.factory.snm.mapper; package com.logpm.factory.snm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.snm.entity.PanOrderStatusLog; import com.logpm.factory.snm.entity.OrderStatusLog;
/** /**
* 工厂推送数据接口日志 Mapper 接口 * 工厂推送数据接口日志 Mapper 接口
@ -25,7 +25,7 @@ import com.logpm.factory.snm.entity.PanOrderStatusLog;
* @author zhy * @author zhy
* @since 2023-03-28 * @since 2023-03-28
*/ */
public interface PanOrderStatusLogMapper extends BaseMapper<PanOrderStatusLog> { public interface OrderStatusLogMapper extends BaseMapper<OrderStatusLog> {
} }

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/PanOrderStatusLogMapper.xml → blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderStatusLogMapper.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.factory.snm.mapper.PanOrderStatusLogMapper"> <mapper namespace="com.logpm.factory.snm.mapper.OrderStatusLogMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">--> <!-- <resultMap id="orderLogResultMap" type="com.logpm.factory.snm.entity.FactoryOrder">-->

12
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);
}

8
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<MtFactoryOrderMain> {
}

8
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<OrderStatusLog> {
}

3
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 handleData(OrderInfoDTO orderInfoDTO);
R handleStatusData(OrderStatusDTO orderStatusDTO); R handleStatusData(OrderStatusDTO orderStatusDTO);
void handleDataToPlatform(String unitNo);
} }

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanOrderStatusLogService.java

@ -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<PanOrderStatusLog> {
}

39
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<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("invoice_order_code",invoiceOrderCode);
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper);
if(Objects.isNull(mtFactoryOrderMain)){
}
return false;
}
}

15
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<MtFactoryOrderMainMapper, MtFactoryOrderMain> implements IMtFactoryOrderMainService {
}

19
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<OrderStatusLogMapper, OrderStatusLog> implements IOrderStatusLogService {
private static final Logger logger = LoggerFactory.getLogger(OrderStatusLogServiceImpl.class);
}

133
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; package com.logpm.factory.snm.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder; import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.props.PanFactoryProperties;
import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.dto.OrderInfoDTO; import com.logpm.factory.snm.dto.OrderInfoDTO;
import com.logpm.factory.snm.dto.OrderStatusDTO; import com.logpm.factory.snm.dto.OrderStatusDTO;
import com.logpm.factory.snm.entity.PanFactoryOrder; 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.PanPackageInfo;
import com.logpm.factory.snm.service.IPanFactoryDataService; import com.logpm.factory.snm.service.IPanFactoryDataService;
import com.logpm.factory.snm.service.IPanFactoryOrderService; 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.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.IAdvanceDetailClient;
import com.logpm.oldproject.feign.IOrderClient;
import com.logpm.oldproject.feign.IWarehouseClient; import com.logpm.oldproject.feign.IWarehouseClient;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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.api.R;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.*;
import java.util.Map;
import java.util.Objects;
@AllArgsConstructor @AllArgsConstructor
@Service @Service
@ -42,11 +52,16 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IPanFactoryOrderService factoryOrderService; private final IPanFactoryOrderService factoryOrderService;
private final PanFactoryProperties panFactoryProperties; private final PanFactoryProperties panFactoryProperties;
private final IPanOrderStatusLogService panOrderStatusLogService; private final IOrderStatusLogService panOrderStatusLogService;
private final IPanPackageInfoService panPackageInfoService; private final IPanPackageInfoService panPackageInfoService;
private final IPanFactoryOrderService panFactoryOrderService; private final IPanFactoryOrderService panFactoryOrderService;
private final IAdvanceDetailClient advanceDetailClient; private final IAdvanceDetailClient advanceDetailClient;
private final IWarehouseClient warehouseClient; private final IWarehouseClient warehouseClient;
private final IOrderClient orderClient;
private final IAdvanceClient advanceClient;
private final IDistributionParcelListClient distributionParcelListClient;
private final IDistributionStockArticleClient distributionStockArticleClient;
// @Override // @Override
// public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException { // public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException {
@ -91,12 +106,12 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
// return factoryTokenVO; // return factoryTokenVO;
// } // }
@Transactional
@Override @Override
public R handleData(OrderInfoDTO orderInfoDTO) throws CustomerException { public R handleData(OrderInfoDTO orderInfoDTO) throws CustomerException {
//先保存原始请求数据 //先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); OrderStatusLog panOrderStatusLog = new OrderStatusLog();
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO));
panOrderStatusLog.setStatus(1); panOrderStatusLog.setStatus(1);
panOrderStatusLog.setType(1); panOrderStatusLog.setType(1);
@ -120,7 +135,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
//判断数据是都已存在 //判断数据是都已存在
if(!orderInfoDTO.verifyData()){ if(!orderInfoDTO.verifyData()){
logger.info("#############handleData: 数据不齐全 orderInfoDTO={}",orderInfoDTO); 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"); String message = payload.getString("data");
if(code.equals(1)){ if(code.equals(1)){
logger.info("##########handleData: 物流状态传递成功"); logger.info("##########handleData: 物流状态传递成功");
panOrderStatusLog.setStatus(0);
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
}else{ }else{
return R.fail(400,message); return R.fail(405,message);
} }
}else{ }else{
return R.fail(400,"返回格式有误:"+result); return R.fail(405,"返回格式有误:"+result);
} }
return Resp.success("SUCCESS"); return Resp.success("SUCCESS");
} }
@Transactional
@Override @Override
public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException { public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException {
//先保存原始请求数据 //先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); OrderStatusLog panOrderStatusLog = new OrderStatusLog();
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO));
panOrderStatusLog.setStatus(1); panOrderStatusLog.setStatus(1);
panOrderStatusLog.setType(2); panOrderStatusLog.setType(2);
@ -208,7 +222,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
//判断数据是都已存在 //判断数据是都已存在
if(!orderStatusDTO.verifyData()){ if(!orderStatusDTO.verifyData()){
logger.info("#############handleStatusData: 数据不齐全 orderStatusDTO={}",orderStatusDTO); 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"); String message = payload.getString("data");
if(code.equals(1)){ if(code.equals(1)){
logger.info("##########handleStatusData: 物流状态传递成功"); logger.info("##########handleStatusData: 物流状态传递成功");
panOrderStatusLog.setStatus(0);
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
}else{ }else{
return Resp.fail(400,message); return Resp.fail(405,message);
} }
}else{ }else{
return Resp.fail(400,"返回格式有误:"+result); return Resp.fail(405,"返回格式有误:"+result);
} }
return Resp.success("SUCCESS"); return Resp.success("SUCCESS");
} }
private String getPanToken(){ private String getPanToken(){
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("client_id",panFactoryProperties.getClientId()); 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<OrderEntity> 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<DistributionParcelListEntityVO> detailList = advanceDetailClient.getListByOrderSelfNum(orderSelfNum);
List<DistributionParcelListEntity> 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);
}
}
} }

19
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanOrderStatusLogServiceImpl.java

@ -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<PanOrderStatusLogMapper, PanOrderStatusLog> implements IPanOrderStatusLogService {
private static final Logger logger = LoggerFactory.getLogger(PanOrderStatusLogServiceImpl.class);
}

34
blade-service/logpm-factory/src/main/resources/application.yml

@ -35,14 +35,34 @@ logging:
spring: spring:
main: main:
allow-circular-references: true allow-circular-references: true
#rabbitmq配置 #rabbitmq配置
# rabbitmq: rabbitmq:
# host: 192.168.2.100 host: 192.168.2.100
# port: 5672 port: 5672
# username: admin username: admin
# password: admin password: admin
# #虚拟host 可以不设置,使用server默认host #虚拟host 可以不设置,使用server默认host
# virtual-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: xxl:
job: job:
accessToken: '' accessToken: ''

14
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.entity.AdvanceDetailEntity;
import com.logpm.oldproject.service.IAdvanceDetailService; import com.logpm.oldproject.service.IAdvanceDetailService;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -66,4 +68,16 @@ public class AdvanceDetailClient implements IAdvanceDetailClient {
return map; return map;
} }
@Override
@GetMapping(API_PREFIX + "/getOneByUnitNo")
public AdvanceDetailEntity getOneByUnitNo(String unitNo) {
//查询对应的包件信息
return advanceDetailService.getOneByUnitNo(unitNo);
}
@Override
public List<DistributionParcelListEntityVO> getListByOrderSelfNum(String orderSelfNum) {
return advanceDetailService.getListByOrderSelfNum(orderSelfNum);
}
} }

44
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<OrderEntity> getOrderByOrderSelfNum(String orderSelfNum) {
return orderService.getOrderByOrderSelfNum(orderSelfNum);
}
}

4
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.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.vo.AdvanceDetailVO; import com.logpm.oldproject.vo.AdvanceDetailVO;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -50,4 +51,7 @@ public interface AdvanceDetailMapper extends BaseMapper<AdvanceDetailEntity> {
Boolean addAll(@Param("param") AdvanceDetailEntity advanceDetailEntity); Boolean addAll(@Param("param") AdvanceDetailEntity advanceDetailEntity);
Map<String, String> getSupplyData(@Param("unitNo") String unitNo); Map<String, String> getSupplyData(@Param("unitNo") String unitNo);
List<DistributionParcelListEntityVO> getListByOrderSelfNum(@Param("orderSelfNum") String orderSelfNum);
} }

23
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml

@ -78,7 +78,8 @@
<select id="getSupplyData" resultType="Map" > <select id="getSupplyData" resultType="Map" >
SELECT SELECT
wo.waybill_no logiBillNo, wo.waybill_no logiBillNo,
wb.arrive_site destinationWarehouse wb.arrive_site destinationWarehouse,
wb.arrive_site_id destinationWarehouseId
FROM ht_advance_detail d FROM ht_advance_detail d
left join ht_waybill_order wo on wo.advance_id = d.advance_id and wo.delete_time = 0 left join ht_waybill_order wo on wo.advance_id = d.advance_id and wo.delete_time = 0
left join ht_way_bill wb on wb.id = wo.way_bill_id and wb.delete_time = 0 left join ht_way_bill wb on wb.id = wo.way_bill_id and wb.delete_time = 0
@ -86,4 +87,24 @@
</select> </select>
<select id="getListByOrderSelfNum" resultType="com.logpm.oldproject.vo.DistributionParcelListEntityVO" >
select w.title warehouse, --仓库
2 conditions, --状态
od.unitNo packetBarCode, --包条码
l.title goodsAllocation, --货位信息
'托盘信息' pallet, --托盘信息
od.title firsts, --一级品
od.secondPackName `second`, --二级品
od.thirdPackName `thirdProduct`, --三级品
od.title material, --物料
ad.mscsNum quantity, --数量
od.start_cars_no trainNumber --车次号
from ht_order_detail od
left join ht_advance_detail ad on od.unitNo = ad.unitNo and ad.delete_time = 0
left join ht_warehouse w on w.id = od.now_warehouse_id
left join ht_location l on l.id = od.location_id
where od.detail_number = #{orderSelfNum}
</select>
</mapper> </mapper>

31
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<OrderEntity> {
}

7
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/OrderMapper.xml

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

7
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java

@ -17,7 +17,9 @@
package com.logpm.oldproject.service; package com.logpm.oldproject.service;
import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -32,4 +34,9 @@ public interface IAdvanceDetailService {
Boolean addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity); Boolean addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity);
Map<String, String> getSupplyData(String unitNo); Map<String, String> getSupplyData(String unitNo);
AdvanceDetailEntity getOneByUnitNo(String unitNo);
List<DistributionParcelListEntityVO> getListByOrderSelfNum(String orderSelfNum);
} }

11
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<OrderEntity> getOrderByOrderSelfNum(String orderSelfNum);
}

15
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; package com.logpm.oldproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.entity.AdvanceDetailEntity;
import com.logpm.oldproject.mapper.AdvanceDetailMapper; import com.logpm.oldproject.mapper.AdvanceDetailMapper;
import com.logpm.oldproject.service.IAdvanceDetailService; import com.logpm.oldproject.service.IAdvanceDetailService;
import com.logpm.oldproject.vo.DistributionParcelListEntityVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -49,5 +52,17 @@ public class AdvanceDetailServiceImpl implements IAdvanceDetailService {
return map; return map;
} }
@Override
public AdvanceDetailEntity getOneByUnitNo(String unitNo) {
QueryWrapper<AdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("unitNo",unitNo);
return advanceDetailMapper.selectOne(queryWrapper);
}
@Override
public List<DistributionParcelListEntityVO> getListByOrderSelfNum(String orderSelfNum) {
return advanceDetailMapper.getListByOrderSelfNum(orderSelfNum);
}
} }

25
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<OrderEntity> getOrderByOrderSelfNum(String orderSelfNum) {
QueryWrapper<OrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("selfnumber",orderSelfNum)
.orderByAsc("create_time");
return orderMapper.selectList(queryWrapper);
}
}
Loading…
Cancel
Save