Browse Source

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

dev-warehouse
0.0 2 years ago
parent
commit
796f111fa9
  1. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java
  2. 5
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataWarehouseClient.java
  3. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  4. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  5. 70
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/NewDistributionContactEntity.java
  6. 40
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java
  7. 4
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWarehouseClient.java
  8. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataWarehouseClient.java
  9. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/ReceiveBodyDTO.java
  10. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/ReceiveInfoDTO.java
  11. 33
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtOrderStatusDTO.java
  12. 26
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveContentDTO.java
  13. 26
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveDTO.java
  14. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveImagesDTO.java
  15. 167
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  16. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  17. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  18. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java
  19. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java
  20. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ReceiveInfoHandler.java
  21. 20
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java
  22. 6
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WarehouseClient.java
  23. 7
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/NewDistributionContactMapper.java
  24. 11
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/NewDistributionContactMapper.xml
  25. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java
  26. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWarehouseService.java
  27. 19
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java
  28. 9
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WarehouseServiceImpl.java

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataClientClient.java

@ -48,5 +48,5 @@ public interface IBasicdataClientClient {
BladePage<BasicdataClientEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
@GetMapping(API_PREFIX+"/findByName")
BasicdataClientEntity findByName(String customerName);
BasicdataClientEntity findByName(@RequestParam String customerName);
}

5
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataWarehouseClient.java

@ -18,6 +18,7 @@ package com.logpm.basicdata.feign;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.mp.support.BladePage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -30,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @since 2023-05-15
*/
@FeignClient(
value = "blade-warehouseWarehouse"
value = ModuleNameConstant.APPLICATION_BASICDATA_NAME
)
public interface IBasicdataWarehouseClient {
@ -47,4 +48,6 @@ public interface IBasicdataWarehouseClient {
@GetMapping(TOP)
BladePage<BasicdataWarehouseEntity> topWarehouse(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
@GetMapping(API_PREFIX+"/findByName")
BasicdataWarehouseEntity findByName(@RequestParam String destinationWarehouse);
}

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

@ -17,6 +17,7 @@
package com.logpm.distribution.feign;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.mp.support.BladePage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -33,7 +34,7 @@ import java.util.List;
* @since 2023-06-13
*/
@FeignClient(
value = "blade-distributionParcelList"
value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME
)
public interface IDistributionParcelListClient {
@ -51,7 +52,7 @@ public interface IDistributionParcelListClient {
BladePage<DistributionParcelListEntity> top(@RequestParam("current") Integer current, @RequestParam("size") Integer size);
@GetMapping(API_PREFIX+"/findByPacketBarCode")
DistributionParcelListEntity findByPacketBarCode(String unitNo);
DistributionParcelListEntity findByPacketBarCode(@RequestParam String unitNo);
@PostMapping(API_PREFIX+"/addBatch")
boolean addBatch(@RequestBody List<DistributionParcelListEntity> parcelListEntityList);

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

@ -17,6 +17,7 @@
package com.logpm.distribution.feign;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.mp.support.BladePage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -31,7 +32,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @since 2023-06-13
*/
@FeignClient(
value = "blade-distributionStockArticle"
value = ModuleNameConstant.APPLICATION_DISTRIBUTION_NAME
)
public interface IDistributionStockArticleClient {

70
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/NewDistributionContactEntity.java

@ -0,0 +1,70 @@
package com.logpm.oldproject.entity;
import com.baomidou.mybatisplus.annotation.IdType;
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_new_distribution_contact")
@ApiModel(value = "NewDistributionContact对象", description = "配送--客户商场")
public class NewDistributionContactEntity {
@TableId(
value = "id",
type = IdType.AUTO
)
private Integer id ;
@ApiModelProperty(value = "联系人")
private String contact;
@ApiModelProperty(value = "电话")
private String phone;
@ApiModelProperty(value = "商场名【商配】")
private String storeName;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "配送id")
private Integer distributionId;
@ApiModelProperty(value = "计划数")
private Integer plan;
@ApiModelProperty(value = "实际装车数")
private Integer actualPlan;
@ApiModelProperty(value = "配送数")
private Integer delivery;
@ApiModelProperty(value = "签收数")
private Integer sign;
@ApiModelProperty(value = "签收状态:1=未签;2=已签")
private Integer state;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "删除时间")
private Integer deleteTime;
@ApiModelProperty(value = "备货数")
private Integer makeNum;
private Integer oldId;
@ApiModelProperty(value = "回库数量")
private Integer rollbackNum;
@ApiModelProperty(value = "配送失败原因id")
private Integer brokeId;
@ApiModelProperty(value = "配送失败原因")
private String brokeName;
private Date brokeTime;
@ApiModelProperty(value = "配送失败记录人id")
private Integer brokePersonId;
@ApiModelProperty(value = "配送失败记录人")
private String brokePerson;
}

40
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java

@ -0,0 +1,40 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 配送--客户商场 Feign接口类
*
* @author zhy
* @since 2023-06-29
*/
@FeignClient(
value = "logpm-old-project"
)
public interface INewDistributionContactClient {
String API_PREFIX = "/client";
String TOP = API_PREFIX + "/top";
@GetMapping(API_PREFIX + "/fingById")
NewDistributionContactEntity fingById(@RequestParam Integer NewDistributionContactId);
}

4
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWarehouseClient.java

@ -16,6 +16,7 @@
*/
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.WarehouseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -48,4 +49,7 @@ public interface IWarehouseClient {
@GetMapping("/selectNameById")
String selectNameById(@RequestParam Integer id);
@GetMapping("/findByName")
WarehouseEntity findByName(@RequestParam String destinationWarehouse);
}

8
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataWarehouseClient.java

@ -16,6 +16,7 @@
*/
package com.logpm.basicdata.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.service.IBasicdataWarehouseService;
@ -50,4 +51,11 @@ public class BasicdataWarehouseClient implements IBasicdataWarehouseClient {
return BladePage.of(page);
}
@Override
public BasicdataWarehouseEntity findByName(String destinationWarehouse) {
QueryWrapper<BasicdataWarehouseEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name",destinationWarehouse);
return warehouseWarehouseService.getOne(queryWrapper);
}
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/ReceiveBodyDTO.java

@ -7,8 +7,6 @@ import java.io.Serializable;
@Data
public class ReceiveBodyDTO implements Serializable {
private String produceOrderCode;//生产单号
private String orderCode;//订单自编码
private String unitNo;//包条码

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/ReceiveInfoDTO.java

@ -9,16 +9,12 @@ import java.util.List;
@Data
public class ReceiveInfoDTO implements Serializable {
private String invoiceOrderCode;//发运单编号
private String sendTaskId;//送货任务ID
private String warehouse;//仓库
private String warehouseCode;//仓库编码
private String receiver;//收货人
private Integer newDistributionContactId;//签收用户id
private List<ReceiveBodyDTO> receiveBodyList = new ArrayList<>();
private List<ReceivePhotoDTO> receivePhotoList = new ArrayList<>();

33
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtOrderStatusDTO.java

@ -0,0 +1,33 @@
package com.logpm.factory.mt.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 梦天
*/
@Data
public class MtOrderStatusDTO implements Serializable {
@JsonProperty("发运单编号")
private String invoiceOrderCode;
@JsonProperty("订单编号")
private String orderNo;
@JsonProperty("包条码")
private String unitNo;
@JsonProperty("操作时间")
private Date operationTime;
@JsonProperty("仓库编号")
private String warehouse;
@JsonProperty("经销商名称")
private String dealerName;
}

26
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveContentDTO.java

@ -0,0 +1,26 @@
package com.logpm.factory.mt.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Date;
@Data
public class MtReceiveContentDTO {
@JsonProperty("订单编号")
private String orderCode;//订单自编码
@JsonProperty("包条码")
private String unitNo;//包条码
@JsonProperty("签收时间")
private Date operateDate;//签收时间
@JsonProperty("仓库编号")
private String warehouseCode;//仓库编码
@JsonProperty("发运单编号")
private String invoiceOrderCode;//发运单编号
}

26
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveDTO.java

@ -0,0 +1,26 @@
package com.logpm.factory.mt.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class MtReceiveDTO implements Serializable {
@JsonProperty("送货任务ID")
private String sendTaskId;//送货任务ID
@JsonProperty("收货人")
private String receiver;//收货人
@JsonProperty("签收内容")
private List<MtReceiveContentDTO> receiveContentList = new ArrayList<>();
@JsonProperty("签收图片")
private List<MtReceiveImagesDTO> receiveImagesList = new ArrayList<>();
}

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/dto/MtReceiveImagesDTO.java

@ -0,0 +1,10 @@
package com.logpm.factory.mt.dto;
import lombok.Data;
@Data
public class MtReceiveImagesDTO {
private String image;
}

167
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java

@ -2,18 +2,12 @@ package com.logpm.factory.mt.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.com.google.gson.Gson;
import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.factory.comfac.dto.OrderInfoDTO;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.dto.ReceiveBodyDTO;
import com.logpm.factory.comfac.dto.ReceiveInfoDTO;
import com.logpm.factory.mt.dto.MtFactoryDataDTO;
import com.logpm.factory.mt.dto.MtFactoryOrderDTO;
import com.logpm.factory.mt.dto.MtPackageInfoDTO;
import com.logpm.factory.comfac.dto.*;
import com.logpm.factory.mt.dto.*;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.mt.service.IMtFactoryOrderService;
@ -23,19 +17,21 @@ import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.entity.MtFactoryOrder;
import com.logpm.factory.snm.entity.MtFactoryOrderMain;
import com.logpm.factory.snm.entity.MtPackageInfo;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.logpm.oldproject.feign.INewDistributionContactClient;
import com.logpm.oldproject.feign.IWarehouseClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.*;
@ -56,6 +52,8 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
private final MtFactoryProperties mtFactoryProperties;
private final INewDistributionContactClient newDistributionContactClient;
@Transactional
@Override
public R dealWithData(MtFactoryDataDTO mtFactoryDataDTO) {
@ -234,14 +232,13 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
String status = orderStatusDTO.getStatus();
String orderNo = orderStatusDTO.getOrderNo();
if("1".equals(status)||"2".equals(status)||"3".equals(status)||"6".equals(status)||"7".equals(status)||"8".equals(status)||"9".equals(status)){
if("1".equals(status)||"2".equals(status)||"3".equals(status)||"5".equals(status)||"6".equals(status)||"7".equals(status)||"8".equals(status)||"9".equals(status)){
logger.info("#############handleStatusData: 当前数据的状态不推送 status={}",status);
return Resp.fail(400,"当前数据的状态不推送");
}
//通过包件码查询是否是要推送的订单
String unitNo = orderStatusDTO.getUnitNo();//包件码
String currentWarehouse = orderStatusDTO.getCurrentWarehouse();
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>();
packageInfoQueryWrapper.eq("package_code",unitNo);
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper);
@ -262,44 +259,39 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
return Resp.fail(400,"未找到对应订单");
}
//根据仓库ID查询仓库名字
currentWarehouse = warehouseClient.selectNameById(Integer.parseInt(currentWarehouse));
//拼接参数
Map<String,Object> map = new HashMap<>();
map.put("发运单编号", mtFactoryOrderMain.getInvoiceOrderCode());
map.put("订单编号", orderNo);
map.put("包条码", unitNo);
map.put("操作时间", orderStatusDTO.getOperationTime());
map.put("仓库", currentWarehouse);
map.put("生产单号", mtFactoryOrder.getProduceOrderCode());
map.put("经销商名称", mtFactoryOrder.getDealerName());
map.put("状态", orderStatusDTO.getStatus());
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String s = gson.toJson(map);
MtOrderStatusDTO mtOrderStatusDTO = new MtOrderStatusDTO();
mtOrderStatusDTO.setInvoiceOrderCode(mtFactoryOrderMain.getInvoiceOrderCode());
mtOrderStatusDTO.setOrderNo(orderNo);
mtOrderStatusDTO.setUnitNo(unitNo);
mtOrderStatusDTO.setOperationTime(CommonUtil.StringToDate(orderStatusDTO.getOperationTime()));
mtOrderStatusDTO.setWarehouse(mtFactoryOrderMain.getCenterWarehouseCode());
mtOrderStatusDTO.setDealerName(mtFactoryOrder.getDealerName());
//先获取token
String panToken = "getPanToken()";
String token = getMtToken();
//请求参数
logger.info("##############handleStatusData: 推送包件状态请求参数 {}",s);
logger.info("##############handleStatusData: 推送包件状态请求参数 {}",mtOrderStatusDTO);
//处理逻辑
String result = HttpRequest.post("URL"+"/hitf/v1/rest/invoke?namespace=HZERO&serverCode=OPEN&interfaceCode=HUITONG_RECEIVE")
.header("Authorization","Bearer "+panToken)
String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text")
.header("APPKEY",mtFactoryProperties.getAppkey())
.header("Authorization",token)
.header("USERID",mtFactoryProperties.getUserid())
.header("USERPWD",mtFactoryProperties.getUserpwd())
.header("Content-Type","application/json")
.body(s).timeout(5 * 1000)
.body(JSONObject.toJSONString(mtOrderStatusDTO)).timeout(5 * 1000)
.execute().body();
logger.info("##############handleStatusData: 推送包件状态返回参数 {}",result);
//把结果字符串转为json对象
JSONObject jsonObject = JSONObject.parseObject(result);
JSONObject payload = jsonObject.getJSONObject("payload");
if(!Objects.isNull(payload)){
Integer code = payload.getInteger("code");
String message = payload.getString("data");
if(code.equals(1)){
if(!Objects.isNull(jsonObject)){
Integer code = jsonObject.getInteger("Result");
String message = jsonObject.getString("Message");
if(code.equals(0)){
logger.info("##########handleStatusData: 物流状态传递成功");
}else{
return Resp.fail(405,message);
@ -312,36 +304,103 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
@Transactional
@Override
public R sendReceiveInfo(ReceiveInfoDTO receiveInfoDTO) {
log.info("###########sendReceiveInfo: 处理签收图片数据开始");
Integer newDistributionContactId = receiveInfoDTO.getNewDistributionContactId();
List<ReceiveBodyDTO> receiveBodyList = receiveInfoDTO.getReceiveBodyList();
Long mainId = null;
List<ReceivePhotoDTO> receivePhotoList = receiveInfoDTO.getReceivePhotoList();
//查询签收人
NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingById(newDistributionContactId);
String receiver = null;
if (!Objects.isNull(newDistributionContactEntity)){
receiver = newDistributionContactEntity.getContact();
}
//处理头部数
MtReceiveDTO mtReceiveDTO = new MtReceiveDTO();
mtReceiveDTO.setReceiver(receiver);
mtReceiveDTO.setSendTaskId(receiveInfoDTO.getSendTaskId());
//循环处理签收信息
List<MtReceiveContentDTO> mtReceiveContentDTOList = new ArrayList<>();
for(ReceiveBodyDTO receiveBodyDTO:receiveBodyList){
String orderCode = receiveBodyDTO.getOrderCode();//订单自编号
QueryWrapper<MtFactoryOrder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_code",orderCode);
MtFactoryOrder one = mtFactoryOrderService.getOne(queryWrapper);
String unitNo = receiveBodyDTO.getUnitNo();//包条码
//通过订单编号查询总单信息
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>();
packageInfoQueryWrapper.eq("package_code",unitNo);
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper);
if(Objects.isNull(one)){
log.warn("################sendReceiveInfo: 订单数据不存在 orderCode={}",orderCode);
return R.fail(400,"订单数据不存在");
logger.info("#############sendReceiveInfo: 当前包条码未找到对应数据unitNo={}",unitNo);
continue;
}
Long orderId = one.getOrderId();
MtFactoryOrder mtFactoryOrder = mtFactoryOrderService.getById(orderId);
if(Objects.isNull(mtFactoryOrder)){
logger.info("#############sendReceiveInfo: 未找到对应订单orderId={}",orderId);
continue;
}
receiveBodyDTO.setProduceOrderCode(one.getProduceOrderCode());
mainId = one.getMainId();
Long mainId = mtFactoryOrder.getMainId();
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId);
if(Objects.isNull(mtFactoryOrderMain)){
logger.info("#############sendReceiveInfo: 未找到对应订单mainId={}",mainId);
continue;
}
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO();
mtReceiveContentDTO.setInvoiceOrderCode(mtFactoryOrderMain.getInvoiceOrderCode());
mtReceiveContentDTO.setWarehouseCode(mtFactoryOrderMain.getCenterWarehouseCode());
mtReceiveContentDTO.setOrderCode(mtFactoryOrder.getOrderCode());
mtReceiveContentDTO.setUnitNo(unitNo);
mtReceiveContentDTO.setOperateDate(CommonUtil.StringToDate(receiveBodyDTO.getOperateDate()));
mtReceiveContentDTOList.add(mtReceiveContentDTO);
}
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId);
if(Objects.isNull(mtFactoryOrderMain)){
log.warn("################sendReceiveInfo: 主订单数据不存在 mainId={}",mainId);
return R.fail(400,"主订单数据不存在");
//签收信息数据存入头部数据
mtReceiveDTO.setReceiveContentList(mtReceiveContentDTOList);
//处理签收图片数据
List<MtReceiveImagesDTO> mtReceiveImagesDTOList = new ArrayList<>();
for (ReceivePhotoDTO receivePhotoDTO:receivePhotoList){
MtReceiveImagesDTO mtReceiveImagesDTO = new MtReceiveImagesDTO();
mtReceiveImagesDTO.setImage(receivePhotoDTO.getUrl());
mtReceiveImagesDTOList.add(mtReceiveImagesDTO);
}
receiveInfoDTO.setInvoiceOrderCode(mtFactoryOrderMain.getInvoiceOrderCode());
receiveInfoDTO.setWarehouse(mtFactoryOrderMain.getCenterWarehouseName());
receiveInfoDTO.setWarehouseCode(mtFactoryOrderMain.getCenterWarehouseCode());
receiveInfoDTO.setReceiveBodyList(receiveBodyList);
//签收图片数据存入头部数据
mtReceiveDTO.setReceiveImagesList(mtReceiveImagesDTOList);
//推送数据到梦天
//先获取token
String token = getMtToken();
//拼装参数 ,推送数据到梦天
//请求参数
logger.info("##############sendReceiveInfo: 推送包件状态请求参数 {}",mtReceiveDTO);
//处理逻辑
String result = HttpRequest.post(mtFactoryProperties.getUrl()+"/Auth/text2")
.header("APPKEY",mtFactoryProperties.getAppkey())
.header("Authorization",token)
.header("USERID",mtFactoryProperties.getUserid())
.header("USERPWD",mtFactoryProperties.getUserpwd())
.header("Content-Type","application/json")
.body(JSONObject.toJSONString(mtReceiveDTO)).timeout(5 * 1000)
.execute().body();
logger.info("##############sendReceiveInfo: 推送包件状态返回参数 {}",result);
//把结果字符串转为json对象
JSONObject jsonObject = JSONObject.parseObject(result);
if(!Objects.isNull(jsonObject)){
Integer code = jsonObject.getInteger("Result");
String message = jsonObject.getString("Message");
if(code.equals(0)){
logger.info("##########sendReceiveInfo: 物流状态传递成功");
}else{
return Resp.fail(405,message);
}
}else{
return Resp.fail(405,"返回格式有误:"+result);
}
return R.success("处理签收数据完成");
}

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -8,8 +8,10 @@ import com.alibaba.nacos.shaded.com.google.gson.GsonBuilder;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
@ -76,6 +78,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IBasicdataClientClient basicdataClientClient;
private final IBasicdataStoreBusinessClient basicdataStoreBusinessClient;
private final IBasicdataWarehouseClient basicdataWarehouseClient;
// @Override
// public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException {
@ -319,6 +322,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
}
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
String destinationWarehouse = supplyData.get("destinationWarehouse");//目的仓名称
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.findByName(destinationWarehouse);
//判断新系统是否有这条订单数据
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByAdvanceId(advanceId);
@ -332,12 +337,15 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleEntity.setOrderSelfNumbering(advanceEntity.getOrderSelfNum());
distributionStockArticleEntity.setMallName(advanceEntity.getStoreName());
distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName());
distributionStockArticleEntity.setWarehouse(supplyData.get("destinationWarehouse"));
distributionStockArticleEntity.setWarehouse(destinationWarehouse);
distributionStockArticleEntity.setWarehouseEntryTime(date);
distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal());
distributionStockArticleEntity.setHandQuantity(0);
distributionStockArticleEntity.setCompleteSet(1);
distributionStockArticleEntity.setBrand(advanceEntity.getType());
if(!Objects.isNull(basicdataWarehouseEntity)){
distributionStockArticleEntity.setCreateDept(Long.parseLong(basicdataWarehouseEntity.getDepartment()));
}
String customerName = advanceEntity.getCustomerName();//客户名称
//通过客户名称去查询客户的服务类型

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -39,7 +39,7 @@ public class DealWithDataHandler {
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++);
log.info("##################dealWithDataHandler: 处理在库订单数据到新系统");
OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData");
String status = orderStatusDTO.getStatus();
String unitNo = orderStatusDTO.getUnitNo();

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OpenOrderHandler.java

@ -47,7 +47,7 @@ public class OpenOrderHandler {
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
final long deliveryTag = message.getMessageProperties().getDeliveryTag();
String msg = new String(message.getBody());
log.info("##################我进入这里了 retryCount={}",retryCount++);
log.info("##################openOrderStatusHandler: 处理开单数据");
OrderInfoDTO orderInfoDTO = (OrderInfoDTO) map.get("messageData");
String orderNoStr = orderInfoDTO.getOrderNo();//订单自编号
String[] split = orderNoStr.split(",");

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java

@ -47,7 +47,7 @@ public class OrderStatusHandler {
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
final long deliveryTag = message.getMessageProperties().getDeliveryTag();
String msg = new String(message.getBody());
log.info("##################我进入这里了 retryCount={}",retryCount++);
log.info("##################orderStatusHandler: 处理扫码作业数据");
OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData");
String orderNo = orderStatusDTO.getOrderNo();//订单自编号
//通过订单自编号去查询该条订单是属于哪个工厂

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/ReceiveInfoHandler.java

@ -50,7 +50,7 @@ public class ReceiveInfoHandler {
// 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉
final long deliveryTag = message.getMessageProperties().getDeliveryTag();
String msg = new String(message.getBody());
log.info("##################我进入这里了 retryCount={}",retryCount++);
log.info("##################receiveInfoHandler:处理签收信息数据");
ReceiveInfoDTO receiveInfoDTO = (ReceiveInfoDTO) map.get("messageData");
String orderCode = receiveInfoDTO.getReceiveBodyList().get(0).getOrderCode();

20
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java

@ -0,0 +1,20 @@
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
import com.logpm.oldproject.service.INewDistributionContactService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
@ApiIgnore()
@RestController
@AllArgsConstructor
public class NewDistributionContactClient implements INewDistributionContactClient{
private final INewDistributionContactService newDistributionContactService;
@Override
public NewDistributionContactEntity fingById(Integer NewDistributionContactId) {
return newDistributionContactService.fingById(NewDistributionContactId);
}
}

6
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WarehouseClient.java

@ -49,4 +49,10 @@ public class WarehouseClient implements IWarehouseClient {
WarehouseEntity warehouseEntity = warehouseService.getById(id);
return warehouseEntity.getTitle();
}
@Override
@GetMapping("/findByName")
public WarehouseEntity findByName(String destinationWarehouse) {
return warehouseService.findByName(destinationWarehouse);
}
}

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

@ -0,0 +1,7 @@
package com.logpm.oldproject.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
public interface NewDistributionContactMapper extends BaseMapper<NewDistributionContactEntity> {
}

11
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/NewDistributionContactMapper.xml

@ -0,0 +1,11 @@
<?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.NewDistributionContactMapper">
<!-- 通用查询映射结果 -->
<resultMap id="resultMap" type="com.logpm.oldproject.entity.NewDistributionContactEntity">
</resultMap>
</mapper>

8
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java

@ -0,0 +1,8 @@
package com.logpm.oldproject.service;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
public interface INewDistributionContactService {
NewDistributionContactEntity fingById(Integer newDistributionContactId);
}

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IWarehouseService.java

@ -39,6 +39,8 @@ public interface IWarehouseService {
Integer selectIdByName(String siteName);
WarehouseEntity getById(Integer id);
WarehouseEntity findByName(String destinationWarehouse);
}

19
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java

@ -0,0 +1,19 @@
package com.logpm.oldproject.service.impl;
import com.logpm.oldproject.entity.NewDistributionContactEntity;
import com.logpm.oldproject.mapper.NewDistributionContactMapper;
import com.logpm.oldproject.service.INewDistributionContactService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@AllArgsConstructor
public class NewDistributionContactServiceImpl implements INewDistributionContactService {
private final NewDistributionContactMapper newDistributionContactMapper;
@Override
public NewDistributionContactEntity fingById(Integer newDistributionContactId) {
return newDistributionContactMapper.selectById(newDistributionContactId);
}
}

9
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/WarehouseServiceImpl.java

@ -16,6 +16,7 @@
*/
package com.logpm.oldproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.oldproject.entity.WarehouseEntity;
import com.logpm.oldproject.mapper.WarehouseMapper;
@ -54,5 +55,13 @@ public class WarehouseServiceImpl implements IWarehouseService {
return warehouseMapper.selectById(id);
}
@Override
public WarehouseEntity findByName(String destinationWarehouse) {
QueryWrapper<WarehouseEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name",destinationWarehouse);
return warehouseMapper.selectOne(queryWrapper);
}
}

Loading…
Cancel
Save