Browse Source

1.皮阿诺数据接收逻辑修改 2023-06-16 20:06

test
zhenghaoyu 2 years ago
parent
commit
9c86243af8
  1. 3
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IWarehouseClient.java
  2. 45
      blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java
  3. 7
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/WarehouseClient.java

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

@ -45,4 +45,7 @@ public interface IWarehouseClient {
@GetMapping("/selectIdByName")
Integer selectIdByName(@RequestParam String siteName);
@GetMapping("/selectNameById")
String selectNameById(@RequestParam Integer id);
}

45
blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/PanFactoryDataServiceImpl.java

@ -6,6 +6,7 @@ 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.props.PanFactoryProperties;
import com.logpm.factory.snm.bean.Resp;
import com.logpm.factory.snm.dto.OrderInfoDTO;
import com.logpm.factory.snm.dto.OrderStatusDTO;
import com.logpm.factory.snm.entity.PanFactoryOrder;
@ -16,10 +17,12 @@ import com.logpm.factory.snm.service.IPanFactoryOrderService;
import com.logpm.factory.snm.service.IPanOrderStatusLogService;
import com.logpm.factory.snm.service.IPanPackageInfoService;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.logpm.oldproject.feign.IWarehouseClient;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
@ -43,6 +46,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IPanPackageInfoService panPackageInfoService;
private final IPanFactoryOrderService panFactoryOrderService;
private final IAdvanceDetailClient advanceDetailClient;
private final IWarehouseClient warehouseClient;
// @Override
// public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException {
@ -89,7 +93,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
@Override
public void handleData(OrderInfoDTO orderInfoDTO) throws CustomerException {
public R handleData(OrderInfoDTO orderInfoDTO) throws CustomerException {
//先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog();
@ -105,8 +109,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
queryWrapper.eq("order_no",orderNo);
PanFactoryOrder panFactoryOrder = factoryOrderService.getOne(queryWrapper);
if(Objects.isNull(panFactoryOrder)){
logger.info("#############handleData: 合同自编码orderNo={}",orderNo);
throw new CustomerException(400,"未找到订单数据");
logger.info("#############handleData: 未找到订单数据 合同自编码orderNo={}",orderNo);
return R.fail(400,"未找到订单数据");
}
String plantId = panFactoryOrder.getPlantId();//工厂id
String deliveryNumber = panFactoryOrder.getDeliveryNumber();
@ -116,7 +120,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
//判断数据是都已存在
if(!orderInfoDTO.verifyData()){
logger.info("#############handleData: 数据不齐全 orderInfoDTO={}",orderInfoDTO);
throw new CustomerException(400,"数据不齐全");
return R.fail(400,"数据不齐全");
}
//拼接参数
@ -151,17 +155,16 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
panOrderStatusLog.setStatus(0);
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
}else{
throw new CustomerException(400,message);
return R.fail(400,message);
}
}else{
throw new CustomerException(400,"返回格式有误:"+result);
return R.fail(400,"返回格式有误:"+result);
}
return Resp.success("SUCCESS");
}
@Override
public void handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException {
public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException {
//先保存原始请求数据
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog();
@ -173,28 +176,39 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
String status = orderStatusDTO.getStatus();
if("2".equals(status)||"4".equals(status)||"5".equals(status)||"8".equals(status)||"9".equals(status)){
logger.info("#############handleStatusData: 当前数据的状态不推送 status={}",status);
throw new CustomerException(400,"当前数据的状态不推送");
return Resp.fail(400,"当前数据的状态不推送");
}
//通过包件码查询是否是要推送的订单
String unitNo = orderStatusDTO.getUnitNo();//包件码
String currentWarehouse = orderStatusDTO.getCurrentWarehouse();
QueryWrapper<PanPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>();
packageInfoQueryWrapper.eq("unit_no",unitNo);
PanPackageInfo one = panPackageInfoService.getOne(packageInfoQueryWrapper);
if(Objects.isNull(one)){
logger.info("#############handleStatusData: 当前包条码未找到对应数据unitNo={}",unitNo);
throw new CustomerException(400,"未找到包件数据");
return Resp.fail(400,"未找到包件数据");
}
String plantId = one.getPlantId();
//查询destinationWarehouse logiBillNo plantId数据
Map<String,String> supplyData = advanceDetailClient.getSupplyData(unitNo);
orderStatusDTO.setPlantId(supplyData.get("plantId"));
//根据仓库ID查询仓库名字
currentWarehouse = warehouseClient.selectNameById(Integer.parseInt(currentWarehouse));
orderStatusDTO.setPlantId(plantId);
orderStatusDTO.setCurrentWarehouse(currentWarehouse);
orderStatusDTO.setDestinationWarehouse(supplyData.get("destinationWarehouse"));
// orderStatusDTO.setDestinationWarehouse("南充市");
orderStatusDTO.setLogiBillNo(supplyData.get("logiBillNo"));
// orderStatusDTO.setLogiBillNo("GZ23060001");
//判断数据是都已存在
if(!orderStatusDTO.verifyData()){
logger.info("#############handleStatusData: 数据不齐全 orderStatusDTO={}",orderStatusDTO);
throw new CustomerException(400,"数据不齐全");
return Resp.fail(400,"数据不齐全");
}
//拼接参数
@ -229,11 +243,12 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
panOrderStatusLog.setStatus(0);
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog);
}else{
throw new CustomerException(400,message);
return Resp.fail(400,message);
}
}else{
throw new CustomerException(400,"返回格式有误:"+result);
return Resp.fail(400,"返回格式有误:"+result);
}
return Resp.success("SUCCESS");
}

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

@ -16,6 +16,7 @@
*/
package com.logpm.oldproject.feign;
import com.logpm.oldproject.entity.WarehouseEntity;
import com.logpm.oldproject.service.IWarehouseService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
@ -42,4 +43,10 @@ public class WarehouseClient implements IWarehouseClient {
return warehouseService.selectIdByName(siteName);
}
@Override
public String selectNameById(Integer id) {
WarehouseEntity warehouseEntity = warehouseService.getById(id);
return warehouseEntity.getTitle();
}
}

Loading…
Cancel
Save