Browse Source

1.修改同步数据到老系统的bug

test
zhenghaoyu 2 years ago
parent
commit
aba3015f00
  1. 11
      blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  2. 11
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java
  3. 5
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java
  4. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java
  5. 48
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  6. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java
  7. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  8. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java
  9. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java
  10. 17
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  11. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  12. 6
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/ServiceNumClient.java
  13. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IServiceNumService.java
  14. 8
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ServiceNumServiceImpl.java

11
blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@ -19,6 +19,7 @@ package org.springblade.common.utils;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -96,4 +97,14 @@ public class CommonUtil {
return UUID.randomUUID().toString().replace("-", ""); return UUID.randomUUID().toString().replace("-", "");
} }
public static Date StringToDate(String value) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.parse(value);
} catch (Exception e) {
return null;
}
}
} }

11
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java

@ -17,14 +17,12 @@
package com.logpm.oldproject.entity; package com.logpm.oldproject.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tenant.mp.TenantEntity;
import java.time.LocalDate; import java.time.LocalDate;
@ -49,11 +47,13 @@ public class ServiceNumEntity {
* 服务号 * 服务号
*/ */
@ApiModelProperty(value = "服务号") @ApiModelProperty(value = "服务号")
@TableField("serviceNum")
private String serviceNum; private String serviceNum;
/** /**
* 订单数量 * 订单数量
*/ */
@ApiModelProperty(value = "订单数量") @ApiModelProperty(value = "订单数量")
@TableField("total")
private String total; private String total;
/** /**
* 包数量 * 包数量
@ -64,26 +64,31 @@ public class ServiceNumEntity {
* 商场名 * 商场名
*/ */
@ApiModelProperty(value = "商场名") @ApiModelProperty(value = "商场名")
@TableField("storeName")
private String storeName; private String storeName;
/** /**
* 商场编号 * 商场编号
*/ */
@ApiModelProperty(value = "商场编号") @ApiModelProperty(value = "商场编号")
@TableField("storeNo")
private String storeNo; private String storeNo;
/** /**
* 顾客姓名 * 顾客姓名
*/ */
@ApiModelProperty(value = "顾客姓名") @ApiModelProperty(value = "顾客姓名")
@TableField("customerName")
private String customerName; private String customerName;
/** /**
* 顾客电话 * 顾客电话
*/ */
@ApiModelProperty(value = "顾客电话") @ApiModelProperty(value = "顾客电话")
@TableField("customerPhone")
private String customerPhone; private String customerPhone;
/** /**
* 顾客地址 * 顾客地址
*/ */
@ApiModelProperty(value = "顾客地址") @ApiModelProperty(value = "顾客地址")
@TableField("customerRoad")
private String customerRoad; private String customerRoad;
/** /**
* 是否干仓配 * 是否干仓配

5
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java

@ -18,8 +18,10 @@ package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.ServiceNumEntity; import com.logpm.oldproject.entity.ServiceNumEntity;
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.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 java.util.List; import java.util.List;
@ -53,4 +55,7 @@ public interface IServiceNumClient {
*/ */
@PostMapping(API_PREFIX + "/addServiceNum") @PostMapping(API_PREFIX + "/addServiceNum")
Boolean addServiceNum(@RequestBody List<ServiceNumEntity> serviceNumEntity); Boolean addServiceNum(@RequestBody List<ServiceNumEntity> serviceNumEntity);
@GetMapping(API_PREFIX + "/findByserviceNum")
ServiceNumEntity findByserviceNum(@RequestParam String sn);
} }

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java

@ -3,9 +3,9 @@ package com.logpm.factory.comfac.service;
public interface IAsyncDataService { public interface IAsyncDataService {
void handlerPanDataToHt(); void handlerPanDataToHt(Long orderId);
void handlerMtDataToHt(); void handlerMtDataToHt(Long mainId);
} }

48
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java

@ -57,11 +57,12 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
*/ */
@Override @Override
@Async @Async
public void handlerPanDataToHt() { public void handlerPanDataToHt(Long id) {
log.info("################handlerDataToHt: 处理皮阿诺订单数据到"); log.info("################handlerDataToHt: 处理皮阿诺订单数据到");
//查询需要同步的订单 //查询需要同步的订单
QueryWrapper<PanFactoryOrder> orderQueryWrapper = new QueryWrapper<>(); QueryWrapper<PanFactoryOrder> orderQueryWrapper = new QueryWrapper<>();
orderQueryWrapper.eq("status",1) orderQueryWrapper.eq("status",1)
.eq("id",id)
.eq("is_deleted",0); .eq("is_deleted",0);
List<PanFactoryOrder> panFactoryOrders = panFactoryOrderService.list(orderQueryWrapper); List<PanFactoryOrder> panFactoryOrders = panFactoryOrderService.list(orderQueryWrapper);
List<ServiceNumEntity> serviceNumEntityList = new ArrayList<>(); List<ServiceNumEntity> serviceNumEntityList = new ArrayList<>();
@ -69,9 +70,12 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
for (PanFactoryOrder panFactoryOrder:panFactoryOrders){ for (PanFactoryOrder panFactoryOrder:panFactoryOrders){
Long orderId = panFactoryOrder.getId(); Long orderId = panFactoryOrder.getId();
log.info("#########handlerDataToHt: 当前处理的订单id={}",orderId); log.info("#########handlerDataToHt: 当前处理的订单id={}",orderId);
String orderNo = panFactoryOrder.getOrderNo();//订单自编码
AdvanceEntity advanceEntity = iAdvanceClient.getQueryDataOne(orderNo);
Integer advanceId = null;
if(Objects.isNull(advanceEntity)){
//添加订单信息 //添加订单信息
AdvanceEntity advanceEntity = new AdvanceEntity(); advanceEntity = new AdvanceEntity();
advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号 advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号
advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地 advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地
advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域 advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域
@ -93,8 +97,8 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话 advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话
advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址 advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址
advanceEntity.setSystemType("线上"); //订单类型 advanceEntity.setSystemType("线上"); //订单类型
advanceEntity.setStoreNo(""); //门店编码 advanceEntity.setStoreNo(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //门店编码
advanceEntity.setStoreName(""); //门店名称 advanceEntity.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //门店名称
advanceEntity.setSerialKey(""); //序列号 advanceEntity.setSerialKey(""); //序列号
advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号
advanceEntity.setMatingCode("");//齐套模式 可以为空 advanceEntity.setMatingCode("");//齐套模式 可以为空
@ -103,19 +107,22 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空 advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空
advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空 advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空
advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空 advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空
advanceEntity.setAdministratorsId(0);// 导入人 advanceEntity.setAdministratorsId(1078);// 导入人
advanceEntity.setCreateTime(LocalDate.now()); //添加时间 advanceEntity.setCreateTime(LocalDate.now()); //添加时间
advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空
advanceEntity.setDeleteTime(0); // 删除时间 advanceEntity.setDeleteTime(0); // 删除时间
advanceEntity.setWaybillNo("");//运单号 可以为空 advanceEntity.setWaybillNo("");//运单号 可以为空
Integer id = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); Integer warehouseId = PanFactoryEnum.getId(panFactoryOrder.getPlantId());
advanceEntity.setWarehouseId(id); //导入人仓库id advanceEntity.setWarehouseId(warehouseId); //导入人仓库id
advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单 advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单
advanceEntity.setOldId(0);// advanceEntity.setOldId(0);//
advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结 advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结
advanceEntity.setDeleteReason("");//删除原因 advanceEntity.setDeleteReason("");//删除原因
advanceEntity.setDeleteAdministratorsId(0);//删除用户 advanceEntity.setDeleteAdministratorsId(0);//删除用户
Integer advanceId = iAdvanceClient.addAdvanceClient(advanceEntity); advanceId = iAdvanceClient.addAdvanceClient(advanceEntity);
}else{
advanceId = advanceEntity.getId();
}
if(advanceId > 0){ if(advanceId > 0){
//更改订单状态 //更改订单状态
panFactoryOrder.setStatus(0); panFactoryOrder.setStatus(0);
@ -130,6 +137,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
//通过订单id查询对应的包件 //通过订单id查询对应的包件
QueryWrapper<PanPackageInfo> packageQueryWrapper = new QueryWrapper<>(); QueryWrapper<PanPackageInfo> packageQueryWrapper = new QueryWrapper<>();
packageQueryWrapper.eq("order_id",orderId) packageQueryWrapper.eq("order_id",orderId)
.eq("status",1)
.eq("is_deleted",0); .eq("is_deleted",0);
List<PanPackageInfo> packages = panPackageInfoService.list(packageQueryWrapper); List<PanPackageInfo> packages = panPackageInfoService.list(packageQueryWrapper);
for(PanPackageInfo panPackageInfo:packages){ for(PanPackageInfo panPackageInfo:packages){
@ -222,41 +230,49 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
} }
} }
ServiceNumEntity serviceNum = new ServiceNumEntity(); String sn = StringUtil.isBlank(panFactoryOrder.getServiceNum()) ? "" : panFactoryOrder.getServiceNum();
serviceNum.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 ServiceNumEntity serviceNum = serviceNumClient.findByserviceNum(sn);
if(Objects.isNull(serviceNum)){
serviceNum = new ServiceNumEntity();
serviceNum.setServiceNum(sn); //服务号
serviceNum.setTotal("1"); //订单数量 serviceNum.setTotal("1"); //订单数量
serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量 serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量
serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名 serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名
serviceNum.setStoreNo(""); // 商场编号 serviceNum.setStoreNo(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); // 商场编号
serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名 serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名
serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话 serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话
serviceNum.setCustomerRoad(""); //顾客地址 serviceNum.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress()); //顾客地址
serviceNum.setIsOpai(1); //是否干仓配 serviceNum.setIsOpai(1); //是否干仓配
serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知 serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知
// serviceNum.setCreateTime(LocalDate.now()); // serviceNum.setCreateTime(LocalDate.now());
serviceNum.setDeleteTime(0); serviceNum.setDeleteTime(0);
serviceNumEntityList.add(serviceNum); serviceNumEntityList.add(serviceNum);
}else{
log.info("#############handlerDataToHt: 当前服务号已存在数据serviceNum={}",sn);
}
} }
if(!serviceNumEntityList.isEmpty()){
serviceNumClient.addServiceNum(serviceNumEntityList); serviceNumClient.addServiceNum(serviceNumEntityList);
}
log.info("##############handlerDataToHt: 处理数据完成"); log.info("##############handlerDataToHt: 处理数据完成");
} }
@Override @Override
@Async @Async
public void handlerMtDataToHt() { public void handlerMtDataToHt(Long mainId) {
log.info("################handlerMtDataToHt: 处理梦天订单数据到"); log.info("################handlerMtDataToHt: 处理梦天订单数据到");
//查询需要同步的订单 //查询需要同步的订单
QueryWrapper<MtFactoryOrder> orderQueryWrapper = new QueryWrapper<>(); QueryWrapper<MtFactoryOrder> orderQueryWrapper = new QueryWrapper<>();
orderQueryWrapper.eq("status",1) orderQueryWrapper.eq("status",1)
.eq("main_id",mainId)
.eq("is_deleted",0); .eq("is_deleted",0);
List<MtFactoryOrder> mtFactoryOrders = mtFactoryOrderService.list(orderQueryWrapper); List<MtFactoryOrder> mtFactoryOrders = mtFactoryOrderService.list(orderQueryWrapper);
List<ServiceNumEntity> serviceNumEntityList = new ArrayList<>(); List<ServiceNumEntity> serviceNumEntityList = new ArrayList<>();
log.info("#########handlerMtDataToHt: 待处理的订单数量为{}",mtFactoryOrders.size()); log.info("#########handlerMtDataToHt: 待处理的订单数量为{}",mtFactoryOrders.size());
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId);
for (MtFactoryOrder mtFactoryOrder:mtFactoryOrders){ for (MtFactoryOrder mtFactoryOrder:mtFactoryOrders){
Long orderId = mtFactoryOrder.getId(); Long orderId = mtFactoryOrder.getId();
Long mainId = mtFactoryOrder.getMainId();
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId);
log.info("#########handlerMtDataToHt: 当前处理的订单id={}",orderId); log.info("#########handlerMtDataToHt: 当前处理的订单id={}",orderId);

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java

@ -34,6 +34,7 @@ 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.Map;
/** /**
* 梦天数据 控制器 * 梦天数据 控制器
@ -79,7 +80,8 @@ public class MtFactoryDataController extends BladeController {
if(code == 200){ if(code == 200){
orderStatusLog.setStatus(0); orderStatusLog.setStatus(0);
//开启异步线程处理数据 //开启异步线程处理数据
asyncDataService.handlerMtDataToHt(); Map<String,Long> map = (Map<String, Long>) r.getData();
asyncDataService.handlerMtDataToHt(map.get("mainId"));
}else{ }else{
orderStatusLog.setStatus(2); orderStatusLog.setStatus(2);
} }

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

@ -55,6 +55,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
//先判断该发货单编码是否已经存在 //先判断该发货单编码是否已经存在
QueryWrapper<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>(); QueryWrapper<MtFactoryOrderMain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("invoice_order_code",invoiceOrderCode); queryWrapper.eq("invoice_order_code",invoiceOrderCode);
Long mainId = null;
MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper); MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper);
if(!Objects.isNull(mtFactoryOrderMain)){ if(!Objects.isNull(mtFactoryOrderMain)){
log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode); log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode);
@ -64,7 +65,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain); BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain);
boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain); boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain);
if(saveMain){ if(saveMain){
Long mainId = mtFactoryOrderMain.getId();//发货单id mainId = mtFactoryOrderMain.getId();//发货单id
List<MtFactoryOrderDTO> orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 List<MtFactoryOrderDTO> orderList = mtFactoryDataDTO.getOrderList();//所有订单数据
for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){
String orderCode = mtFactoryOrderDTO.getOrderCode(); String orderCode = mtFactoryOrderDTO.getOrderCode();
@ -99,7 +100,10 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
log.warn("#############dealWithData: 保存发货单失败 invoiceOrderCode={}",invoiceOrderCode); log.warn("#############dealWithData: 保存发货单失败 invoiceOrderCode={}",invoiceOrderCode);
throw new CustomerException(405,"保存发货单失败"); throw new CustomerException(405,"保存发货单失败");
} }
return R.success("接收成功"); Map<String,Long> map = new HashMap<>();
map.put("mainId",mainId);
return R.data(map);
} }
@Override @Override

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java

@ -139,8 +139,9 @@ public class PanFactoryDataController extends BladeController {
factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes); factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes);
} }
Long orderId = null;
try{ try{
panFactoryDataService.saveData(factoryOrderDTO); orderId = panFactoryDataService.saveData(factoryOrderDTO);
panOrderStatusLog.setStatus(0); panOrderStatusLog.setStatus(0);
}catch (Exception e){ }catch (Exception e){
log.warn("############data: 保存数据失败 orderNo={}",orderNo); log.warn("############data: 保存数据失败 orderNo={}",orderNo);
@ -151,7 +152,10 @@ public class PanFactoryDataController extends BladeController {
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
//开启异步线程处理数据 //开启异步线程处理数据
syncDataService.handlerPanDataToHt(); if(!Objects.isNull(orderId)){
syncDataService.handlerPanDataToHt(orderId);
}
return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS"); return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS");
} }

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java

@ -16,7 +16,7 @@ public interface IPanFactoryDataService {
R handleStatusData(OrderStatusDTO orderStatusDTO); R handleStatusData(OrderStatusDTO orderStatusDTO);
void handleDataToPlatform(String unitNo); void handleDataToPlatform(String unitNo,String operationTime);
void saveData(PanFactoryOrderDTO factoryOrderDTO); Long saveData(PanFactoryOrderDTO factoryOrderDTO);
} }

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

@ -36,6 +36,7 @@ import lombok.AllArgsConstructor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
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;
@ -287,7 +288,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Transactional @Transactional
@Override @Override
public void handleDataToPlatform(String unitNo) { public void handleDataToPlatform(String unitNo,String operationTime) {
logger.info("############handleDataToPlatform: 处理数据到platform unitNo={}",unitNo); logger.info("############handleDataToPlatform: 处理数据到platform unitNo={}",unitNo);
//先查询包件是否已存入到新系统数据库 //先查询包件是否已存入到新系统数据库
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo); DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo);
@ -315,6 +316,10 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
} }
OrderEntity orderEntity = orderEntityList.get(0); OrderEntity orderEntity = orderEntityList.get(0);
Integer warehouseId = orderEntity.getWarehouseId();//仓库id Integer warehouseId = orderEntity.getWarehouseId();//仓库id
Date date = CommonUtil.StringToDate(operationTime);
Date now = new Date();
//根据仓库id查询仓库 //根据仓库id查询仓库
String warehouseName = warehouseClient.selectNameById(warehouseId); String warehouseName = warehouseClient.selectNameById(warehouseId);
@ -324,7 +329,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleEntity.setMallName(advanceEntity.getStoreName()); distributionStockArticleEntity.setMallName(advanceEntity.getStoreName());
distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName()); distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName());
distributionStockArticleEntity.setWarehouse(warehouseName); distributionStockArticleEntity.setWarehouse(warehouseName);
distributionStockArticleEntity.setWarehouseEntryTime(null);//TODO 入库时间没找到 distributionStockArticleEntity.setWarehouseEntryTime(date);
distributionStockArticleEntity.setStoreTime(0);//TODO distributionStockArticleEntity.setStoreTime(0);//TODO
distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal()); distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal());
distributionStockArticleEntity.setHandQuantity(0);//TODO distributionStockArticleEntity.setHandQuantity(0);//TODO
@ -334,7 +339,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
distributionStockArticleEntity.setCustomerName(orderEntity.getContact()); distributionStockArticleEntity.setCustomerName(orderEntity.getContact());
distributionStockArticleEntity.setCustomerTelephone(orderEntity.getPhone()); distributionStockArticleEntity.setCustomerTelephone(orderEntity.getPhone());
distributionStockArticleEntity.setCustomerAddress(orderEntity.getAddress()); distributionStockArticleEntity.setCustomerAddress(orderEntity.getAddress());
distributionStockArticleEntity.setGenre(2); distributionStockArticleEntity.setGenre(1);
distributionStockArticleEntity.setState(2); distributionStockArticleEntity.setState(2);
if(size > 1){ if(size > 1){
distributionStockArticleEntity.setReserve1("multiple"); distributionStockArticleEntity.setReserve1("multiple");
@ -369,7 +374,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Transactional @Transactional
@Override @Override
public void saveData(PanFactoryOrderDTO factoryOrderDTO) { public Long saveData(PanFactoryOrderDTO factoryOrderDTO) {
QueryWrapper<PanFactoryOrder> qw = new QueryWrapper<>(); QueryWrapper<PanFactoryOrder> qw = new QueryWrapper<>();
qw.eq("order_no",factoryOrderDTO.getOrderNo()); qw.eq("order_no",factoryOrderDTO.getOrderNo());
@ -382,6 +387,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
//保存订单数据 //保存订单数据
factoryOrderService.save(factoryOrder); factoryOrderService.save(factoryOrder);
}else{ }else{
factoryOrder.setStatus(1);
factoryOrderService.saveOrUpdate(factoryOrder);
flag = true; flag = true;
} }
@ -427,6 +434,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
packageListService.saveBatch(panPackagelist); packageListService.saveBatch(panPackagelist);
return factoryOrder.getId();
} }
private void checkListunitNo(PanPackageList packages, List<PanPackageInfo> panPackageInfos) { private void checkListunitNo(PanPackageList packages, List<PanPackageInfo> panPackageInfos) {

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

@ -43,6 +43,7 @@ public class DealWithDataHandler {
OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData"); OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData");
String status = orderStatusDTO.getStatus(); String status = orderStatusDTO.getStatus();
String unitNo = orderStatusDTO.getUnitNo(); String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
if("4".equals(status)){ if("4".equals(status)){
//继续判断是否到达目的仓 //继续判断是否到达目的仓
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
@ -58,7 +59,7 @@ public class DealWithDataHandler {
// channel.basicAck(deliveryTag,false); // channel.basicAck(deliveryTag,false);
}else{ }else{
//真正的处理需要的数据 //真正的处理需要的数据
panFactoryDataService.handleDataToPlatform(unitNo); panFactoryDataService.handleDataToPlatform(unitNo,operationTime);
} }
} }

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

@ -46,6 +46,12 @@ public class ServiceNumClient implements IServiceNumClient {
return serviceNumService.addServiceNum(serviceNumEntity); return serviceNumService.addServiceNum(serviceNumEntity);
} }
@Override
@GetMapping(API_PREFIX + "/findByserviceNum")
public ServiceNumEntity findByserviceNum(String sn) {
return serviceNumService.findByserviceNum(sn);
}
// @Override // @Override
// @GetMapping(TOP) // @GetMapping(TOP)
// public BladePage<ServiceNumEntity> top(Integer current, Integer size) { // public BladePage<ServiceNumEntity> top(Integer current, Integer size) {

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

@ -32,4 +32,6 @@ public interface IServiceNumService {
//添加 //添加
Boolean addServiceNum(List<ServiceNumEntity> serviceNum); Boolean addServiceNum(List<ServiceNumEntity> serviceNum);
ServiceNumEntity findByserviceNum(String sn);
} }

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

@ -16,6 +16,7 @@
*/ */
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.ServiceNumEntity; import com.logpm.oldproject.entity.ServiceNumEntity;
import com.logpm.oldproject.mapper.ServiceNumMapper; import com.logpm.oldproject.mapper.ServiceNumMapper;
import com.logpm.oldproject.service.IServiceNumService; import com.logpm.oldproject.service.IServiceNumService;
@ -44,4 +45,11 @@ public class ServiceNumServiceImpl implements IServiceNumService {
} }
return true; return true;
} }
@Override
public ServiceNumEntity findByserviceNum(String sn) {
QueryWrapper<ServiceNumEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("serviceNum",sn);
return serviceNumMapper.selectOne(queryWrapper);
}
} }

Loading…
Cancel
Save