Browse Source

增加非干仓配的数据推送的欧派系统的功能

1.需要维护现有的数据的经销商类型和 仓库id
training
pref_mail@163.com 1 year ago
parent
commit
264e8a47c0
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 10
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java
  3. 40
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpPackagePushLogEntity.java
  4. 16
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/ReceivingOrderEntity.java
  5. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/OrderStatusDTO.java
  6. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryOrderMapper.java
  7. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryOrderMapper.xml
  8. 11
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPackagePushLogMapper.java
  9. 5
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPackagePushLogMapper.xml
  10. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/ReceivingOrderMapper.java
  11. 3
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/ReceivingOrderMapper.xml
  12. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java
  13. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryOrderService.java
  14. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpPackagePushLogService.java
  15. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java
  16. 4
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java
  17. 14
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPackagePushLogServiceImpl.java
  18. 160
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java
  19. 11
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/OrderStatusHandler.java
  20. 24
      pom.xml

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -8,7 +8,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="";
public static final String DEVAUTH ="-pref";
/**
* 工厂对接服务名称

10
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java

@ -262,4 +262,14 @@ public class FactoryOrderEntity extends BaseEntity {
@ApiModelProperty(name = "商场名称", notes = "")
private String shopName;
/**
* 未设置:0
*
* 干仓配:1
*
* 经销商:2
*/
@ApiModelProperty(name = "欧派经营模式 ", notes = "")
private String businessModel;
}

40
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpPackagePushLogEntity.java

@ -0,0 +1,40 @@
package com.logpm.factory.oupai.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
/**
* 包件推送欧派数据日志;
* @author : http://www.chiner.pro
* @date : 2023-10-25
*/
@Data
@TableName("op_package_push_log")
@ApiModel(value = "包件推送欧派数据日志", description = "包件推送欧派数据日志")
@EqualsAndHashCode(callSuper = true)
public class OpPackagePushLogEntity extends BaseEntity {
/** 请求地址 */
@ApiModelProperty(name = "请求地址",notes = "")
private String url ;
/** 请求参数 */
@ApiModelProperty(name = "请求参数",notes = "")
private String args ;
/** 响应内容 */
@ApiModelProperty(name = "响应内容",notes = "")
private String resp ;
/** 推送类型 1.包件 */
@ApiModelProperty(name = "推送类型 1.包件",notes = "")
private Integer pushType ;
/** 关联ID 根据push_type来决定关联的表 */
@ApiModelProperty(name = "关联ID 根据push_type来决定关联的表",notes = "")
private Long refId ;
}

16
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/ReceivingOrderEntity.java

@ -43,24 +43,40 @@ public class ReceivingOrderEntity extends BaseEntity {
/** 收货类型 未知:0 中转:1 配送:2 */
@ApiModelProperty(name = "收货类型 未知:0 中转:1 配送:2",notes = "")
private Integer type ;
/** 收货中心OID */
@ApiModelProperty(name = "收货中心OID",notes = "")
private String currentWarehouseOid ;
/** 收货中心编码 */
@ApiModelProperty(name = "收货中心编码",notes = "")
private String currentWarehouseCode ;
/** 收货中心名称 */
@ApiModelProperty(name = "收货中心名称",notes = "")
private String currentWarehouseName ;
/** 发货中心发货中心Oid */
@ApiModelProperty(name = "发货中心Oid",notes = "")
private String fromWarehouseOid ;
/** 发货中心编码 */
@ApiModelProperty(name = "发货中心编码",notes = "")
private String fromWarehouseCode ;
/** 发货中心名称 */
@ApiModelProperty(name = "发货中心名称",notes = "")
private String fromWarehouseName ;
/** 目的站点Oid */
@ApiModelProperty(name = "目的站点Oid",notes = "")
private String endWarehouseOid ;
/** 目的站点编码 */
@ApiModelProperty(name = "目的站点编码",notes = "")
private String endWarehouseCode ;
/** 目的站点名称 */
@ApiModelProperty(name = "目的站点名称",notes = "")
private String endWarehouseName ;
/** 现存包数 */
@ApiModelProperty(name = "现存包数",notes = "")
private Integer packagesCount ;

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/OrderStatusDTO.java

@ -68,6 +68,9 @@ public class OrderStatusDTO implements Serializable {
@NotEmpty(message = "托盘编码")
private String trayNo;
@NotEmpty(message = "操作人名称")
private String username;
/**
* 验证参数是否都存在

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryOrderMapper.java

@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.oupai.entity.FactoryOrderEntity;
import com.logpm.factory.oupai.vo.FactoryOrderVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -41,5 +42,5 @@ public interface FactoryOrderMapper extends BaseMapper<FactoryOrderEntity> {
List<FactoryOrderVO> selectFactoryOrderPage(IPage page, FactoryOrderVO factoryOrder);
FactoryOrderEntity selectEntityByOrderPackageCode(@Param("unitNo") String unitNo);
}

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryOrderMapper.xml

@ -11,5 +11,15 @@
select * from op_factory_order where is_deleted = 0
</select>
<select id="selectEntityByOrderPackageCode" resultType="com.logpm.factory.oupai.entity.FactoryOrderEntity">
SELECT
*
FROM
op_factory_order ofo
LEFT JOIN op_factory_package ofp ON ofo.id = ofp.order_id
WHERE
ofp.CODE = #{unitNo}
</select>
</mapper>

11
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPackagePushLogMapper.java

@ -0,0 +1,11 @@
package com.logpm.factory.oupai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.oupai.entity.OpPackagePushLogEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OpPackagePushLogMapper extends BaseMapper<OpPackagePushLogEntity> {
}

5
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpPackagePushLogMapper.xml

@ -0,0 +1,5 @@
<?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.oupai.mapper.OpPackagePushLogMapper">
</mapper>

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/ReceivingOrderMapper.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.oupai.entity.ReceivingOrderEntity;
import com.logpm.factory.oupai.vo.ReceivingOrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -44,4 +45,7 @@ public interface ReceivingOrderMapper extends BaseMapper<ReceivingOrderEntity> {
}

3
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/ReceivingOrderMapper.xml

@ -13,4 +13,7 @@
</mapper>

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpOldReceivingDataHandler.java

@ -91,7 +91,7 @@ public class OpOldReceivingDataHandler {
// 需要查询映射表 如果映射表没有值 这个字段为null
BasicdataTripartiteWarehouseEntity warehouse = basicdataTripartiteWarehouseClient.getWarehouse(warehouseName, "");
if (ObjectUtils.isNotNull(warehouse)) {
String warehouseCode = warehouse.getAssociationCode();
String warehouseCode = warehouse.getWarehouseCode();
WarehouseEntity warehouseEntity = warehouseClient.findByCode(warehouseCode);
// 请求老系统的登录接口
@ -169,10 +169,8 @@ public class OpOldReceivingDataHandler {
private boolean sendPackageData(Map<String,Object> map) {
// 构建请求头
String authCode = map.get("authCode").toString();
log.info("##################sendPackageData: 请求老系统接口 start map {}", map);
String url = oldSystemProperties.getUrl() + "openApi/newSystem.OptimsWarehouseScan/index";

7
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryOrderService.java

@ -40,4 +40,11 @@ public interface IFactoryOrderService extends BaseService<FactoryOrderEntity> {
FactoryOrderEntity selectEntityBySelfCode(String selfCode);
/**
* 根据包件查询订单
* @param unitNo
* @return
*/
FactoryOrderEntity selectEntityByOrderPackageCode(String unitNo);
}

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpPackagePushLogService.java

@ -0,0 +1,8 @@
package com.logpm.factory.oupai.service;
import com.logpm.factory.oupai.entity.OpPackagePushLogEntity;
import com.logpm.factory.oupai.entity.OpSignPictureEntity;
import org.springblade.core.mp.base.BaseService;
public interface IOpPackagePushLogService extends BaseService<OpPackagePushLogEntity> {
}

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java

@ -1,5 +1,8 @@
package com.logpm.factory.oupai.service;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import org.springblade.core.tool.api.R;
public interface IOuPaiFactoryService {
@ -18,4 +21,11 @@ public interface IOuPaiFactoryService {
String savaOuPaiSignBillByCode(String orderCode, Integer event);
String saveOuPaiPackageStatusByCodeByOld(String key, Integer event, String warehouseName);
/**
* 欧派推送包件状态
* @param orderStatusDTO
* @return
*/
R handleStatusData(OrderStatusDTO orderStatusDTO);
}

4
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java

@ -48,4 +48,8 @@ public class FactoryOrderServiceImpl extends BaseServiceImpl<FactoryOrderMapper,
}
@Override
public FactoryOrderEntity selectEntityByOrderPackageCode(String unitNo) {
return baseMapper.selectEntityByOrderPackageCode(unitNo);
}
}

14
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpPackagePushLogServiceImpl.java

@ -0,0 +1,14 @@
package com.logpm.factory.oupai.service.impl;
import com.logpm.factory.oupai.entity.OpOutGoingOrderEntity;
import com.logpm.factory.oupai.entity.OpPackagePushLogEntity;
import com.logpm.factory.oupai.mapper.OpOutGoingOrderMapper;
import com.logpm.factory.oupai.mapper.OpPackagePushLogMapper;
import com.logpm.factory.oupai.service.IOpPackagePushLogService;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class OpPackagePushLogServiceImpl extends BaseServiceImpl<OpPackagePushLogMapper, OpPackagePushLogEntity> implements IOpPackagePushLogService {
}

160
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

@ -4,13 +4,20 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.logpm.factory.comfac.constant.FactoryConstant;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.oupai.entity.*;
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper;
import com.logpm.factory.oupai.service.*;
import com.logpm.factory.props.OuPaiProperties;
import com.logpm.factory.snm.bean.Resp;
import com.logpm.oldproject.feign.IAdvanceClient;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@ -22,6 +29,7 @@ import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileLogsUtil;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.resource.feign.IOssClient;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@ -69,6 +77,15 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
@Autowired
private IOssClient ossClient;
@Autowired
private IAdvanceClient advanceClient;
@Autowired
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IOpPackagePushLogService opPackagePushLogService;
@Override
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) {
@ -136,14 +153,14 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
QueryWrapper<FactoryPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("oid", key);
FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper);
String code=null;
String code = null;
String endWarehouseName = null;
String opShipNo=null;
String orderSelfNum =null;
String carNumber=null;
String opShipNo = null;
String orderSelfNum = null;
String carNumber = null;
String siteName = null;
String packageDetailNames = null;
String firstPackName,secondPackName,thirdPackName = null;
String firstPackName, secondPackName, thirdPackName = null;
if (Objects.isNull(packageEntity)) {
log.warn("############oid 查询数据失败: {}", key);
// 查询欧派系统的的数据
@ -160,31 +177,31 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
secondPackName = jsonObject.getString("SecondPackName");
thirdPackName = jsonObject.getString("ThirdPackName");
if(isInventory){
if (isInventory) {
log.warn("############库存品数据 不进行推送: {}", code);
return key;
}
JSONObject order = jsonObject.getJSONObject("Order");
if (order != null){
if (order != null) {
orderSelfNum = order.getString("SelfCode");
}
JSONArray ls = jsonObject.getJSONArray("ReceivingOrders");
if(ls!=null&& !ls.isEmpty()){
if (ls != null && !ls.isEmpty()) {
JSONObject t = ls.getJSONObject(0);
if(t!=null){
if (t != null) {
opShipNo = t.getString("Code");
JSONObject endWarehouse = t.getJSONObject("EndWarehouse");
log.info("############仓库对象: endWarehouse={}",endWarehouse);
log.info("############仓库对象: endWarehouse={}", endWarehouse);
endWarehouseName = endWarehouse.getString("Name");
JSONObject fromWarehouse = t.getJSONObject("FromWarehouse");
log.info("############基地对象: fromWarehouse={}",fromWarehouse);
log.info("############基地对象: fromWarehouse={}", fromWarehouse);
siteName = fromWarehouse.getString("Name");
}
}else{
} else {
log.warn("############没有收货单oid:{}", key);
return key;
}
@ -193,7 +210,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
packageEntity.setPackageStatus(5);
factoryPackageService.updateById(packageEntity);
code = packageEntity.getCode();
packageDetailNames =packageEntity.getPackageDetailNames();
packageDetailNames = packageEntity.getPackageDetailNames();
firstPackName = packageEntity.getFirstClassName();
secondPackName = packageEntity.getSecondClassName();
@ -293,6 +310,89 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
return orderCode;
}
@Override
public R handleStatusData(OrderStatusDTO orderStatusDTO) {
// 推送数据
String status = orderStatusDTO.getStatus();
String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
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)) {
log.warn(FactoryConstant.OUPAI,"#############oupai-handleStatusData: 当前数据的状态不推送 status={}", status);
return Resp.fail(400, "当前数据的状态不推送");
}
//继续判断是否到达目的仓
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
//查询destinationWarehouse logiBillNo plantId数据
log.info("oupai-handleStatusData >>> unitNo={}", unitNo);
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
if (ObjectUtils.isEmpty(supplyData)) {
return Resp.fail(400, "未查询到该单据信息");
}
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
if (StringUtil.isBlank(currentWarehouseId) || StringUtil.isBlank(destinationWarehouseId)) {
log.warn(FactoryConstant.OUPAI,"##############oupai-handleStatusData: 仓库数据有问题currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
return Resp.fail(400, "仓库数据有误");
}
if (!currentWarehouseId.equals(destinationWarehouseId)) {
log.info(FactoryConstant.OUPAI,"##############oupai-handleStatusData: 不用处理的状态 currentWarehouseId={} destinationWarehouseId={}", currentWarehouseId, destinationWarehouseId);
return Resp.fail(400, "不是目的仓");
}
// 查询这个包件对应到新系统的订单
FactoryOrderEntity factoryOrder = factoryOrderService.selectEntityByOrderPackageCode(unitNo);
if (Objects.isNull(factoryOrder)) {
return Resp.fail(400, "未查询到该单据推送订单信息");
}
// 如何判断这个包间是非干仓配的数据
if (!"经销商".equals(factoryOrder.getBusinessModel())) {
log.info(FactoryConstant.OUPAI,"oupai- 该包条为干仓配的数据类型 不进行推送 >>> unitNo={} businessModel:{}", unitNo, factoryOrder.getBusinessModel());
return Resp.fail(400, "包条为干仓配的数据类型");
}
// 通过仓库编码查询
ReceivingOrderEntity receivingOrderEntity = receivingOrderMapper.selectById(factoryOrder.getReceivingId());
if (Objects.isNull(receivingOrderEntity)) {
log.info(FactoryConstant.OUPAI,"oupai- 该订单为没有收货单 不进行推送 >>> receivingId={} ", factoryOrder.getReceivingId());
return Resp.fail(400, "未查询到该单据推送收货单信息");
}
JSONObject detailObject = new JSONObject();
detailObject.put("WarehouseOid", receivingOrderEntity.getEndWarehouseOid());
detailObject.put("WarehouseBelong", "oppein");
detailObject.put("Creator", orderStatusDTO.getUsername());
detailObject.put("PackageCode", unitNo);
detailObject.put("Operate", "到货");
// 查询系统的包件对象
LambdaQueryWrapper<FactoryPackageEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FactoryPackageEntity::getCode,unitNo);
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(lambdaQueryWrapper);
if(ObjectUtils.isNotNull(factoryPackageEntity)){
// 推送数据
String url = ouPaiProperties.getUri()+"tims_odata_api/api/odata/PackageFeedbackRecord";
OpPackagePushLogEntity opPackagePushLogEntity = sendPushOuPaiData(factoryPackageEntity.getId(), url, 1, detailObject);
// 需要盘点这个对象的
String resp = opPackagePushLogEntity.getResp();
// 转换为json
// JSONObject respJson = JSONObject.parseObject(resp);
log.info(FactoryConstant.OUPAI,">>>>>>>>>>>>>>>>>>>>>>> 推送欧派返回数据 {}", resp);
// TODO: 2023/10/25 不知道返回成功的状态是多少
// 需要修改包件对应的状态
factoryPackageEntity.setPushStatus(1);
factoryPackageService.updateById(factoryPackageEntity);
}
return Resp.success("物流状态传递成功");
}
private void handleSignBillData(String url, Integer event) {
OpOrderStatusLogEntity opOrderStatusLogEntity = sendRequestData(url, event);
@ -319,7 +419,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
try {
rabbitTemplate.convertAndSend(RabbitConstant.OUPAI_SIGN_EXCHANGE, RabbitConstant.OUPAI_SIGN_ROUTING, map);
} catch (Exception e) {
log.error("############handlePackageData: {}", e.getMessage());
log.error(FactoryConstant.OUPAI,"############handlePackageData: {}", e.getMessage());
}
}
@ -368,15 +468,12 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
private OpOrderStatusLogEntity sendRequestData(String url, Integer event) {
// log.info("#################sendRequestData: 请求地址 url={}", url);
String token = buildToken();
// log.info(">>> Authorization token {}",token);
HttpResponse httpResponse = HttpRequest.get(url).header("Authorization", token).execute();
String result = httpResponse.body();
OpOrderStatusLogEntity orderStatusLog = new OpOrderStatusLogEntity();
orderStatusLog.setArgs(url);
orderStatusLog.setStatus(1);
@ -387,10 +484,29 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
orderStatusLog.setResponseUrl(uploadFile(result));
opOrderStatusLogService.save(orderStatusLog);
return orderStatusLog;
}
/**
* 发送请求
*
* @return
*/
private OpPackagePushLogEntity sendPushOuPaiData(Long refId, String url, Integer pushType, JSONObject data) {
OpPackagePushLogEntity opPackagePushLogEntity = new OpPackagePushLogEntity();
opPackagePushLogEntity.setArgs(data.toJSONString());
opPackagePushLogEntity.setPushType(pushType);
opPackagePushLogEntity.setUrl(url);
opPackagePushLogEntity.setRefId(refId);
String token = buildToken();
HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", token).body(data.toJSONString()).execute();
String result = httpResponse.body();
opPackagePushLogEntity.setResp(result);
opPackagePushLogService.save(opPackagePushLogEntity);
return opPackagePushLogEntity;
}
/**
* 处理返回的JSON数据
@ -448,14 +564,17 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
receivingOrderEntity.setType(0);
}
if (!Objects.isNull(currentWarehouse)) {
receivingOrderEntity.setCurrentWarehouseOid(currentWarehouse.getString("Oid"));
receivingOrderEntity.setCurrentWarehouseCode(currentWarehouse.getString("Code"));
receivingOrderEntity.setCurrentWarehouseName(currentWarehouse.getString("Name"));
}
if (!Objects.isNull(fromWarehouse)) {
receivingOrderEntity.setFromWarehouseOid(fromWarehouse.getString("Oid"));
receivingOrderEntity.setFromWarehouseCode(fromWarehouse.getString("Code"));
receivingOrderEntity.setCurrentWarehouseName(fromWarehouse.getString("Name"));
receivingOrderEntity.setFromWarehouseName(fromWarehouse.getString("Name"));
}
if (!Objects.isNull(endWarehouse)) {
receivingOrderEntity.setEndWarehouseOid(endWarehouse.getString("Oid"));
receivingOrderEntity.setEndWarehouseCode(endWarehouse.getString("Code"));
receivingOrderEntity.setEndWarehouseName(endWarehouse.getString("Name"));
}
@ -552,6 +671,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
if (!Objects.isNull(shop)) {
factoryOrderEntity.setShopCode(shop.getString("Code"));
factoryOrderEntity.setShopName(shop.getString("Name"));
factoryOrderEntity.setBusinessModel(shop.getString("BusinessModel"));
}
}
@ -736,7 +856,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
"&$expand=PackageDetails($select=Code,Name,Type,Unit,OrgCode)" +
"&$expand=CurrentWarehouse($select=Name,Code)" +
"&$expand=SendWarehouse($select=Name,Code)" +
")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)";
")&$expand=FromWarehouse($select=Oid,Name,Code)&$expand=CurrentWarehouse($select=Oid,Name,Code)&$expand=EndWarehouse($select=Oid,Name,Code)";
// log.info(">>> findOurPaiDataByCarNumber url {}", url);

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

@ -3,11 +3,13 @@ package com.logpm.factory.receiver;
import com.logpm.factory.comfac.constant.FactoryConstant;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.mt.service.IMtFactoryDataService;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.factory.zb.service.IZbFactoryDataService;
import com.logpm.oldproject.entity.AdvanceEntity;
import com.logpm.oldproject.feign.IAdvanceClient;
import com.rabbitmq.client.Channel;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException;
@ -44,6 +46,9 @@ public class OrderStatusHandler {
@Autowired
private IZbFactoryDataService zbFactoryDataService;
@Autowired
private IOuPaiFactoryService ouPaiFactoryService;
private Integer retryCount = 1;
@RabbitHandler
@ -105,6 +110,12 @@ public class OrderStatusHandler {
throw new CustomerException(resultCode, r.getMsg());
}
break;
case FactoryConstant.OUPAI:
r = ouPaiFactoryService.handleStatusData(orderStatusDTO);
default:
log.info("##################orderStatusHandler: 未知品牌 type={}", type);
}

24
pom.xml

@ -89,14 +89,14 @@
</dependencies>
<!-- 本地私服仓库地址 -->
<distributionManagement>
<!-- <distributionManagement>-->
<repository>
<!--此名称要和.m2/settings.xml中设置的ID一致 -->
<id>logpm</id>
<url>http://192.168.10.100:8081/repository/logpm-release/</url>
</repository>
</distributionManagement>
<!-- <repository>-->
<!-- &lt;!&ndash;此名称要和.m2/settings.xml中设置的ID一致 &ndash;&gt;-->
<!-- <id>logpm</id>-->
<!-- <url>http://192.168.10.100:8081/repository/logpm-release/</url>-->
<!-- </repository>-->
<!-- </distributionManagement>-->
<build>
<finalName>${project.name}</finalName>
<resources>
@ -202,11 +202,11 @@
<repositories>
<!-- 本地私服地址-->
<repository>
<id>logpm</id>
<name>BladeX Release Repository</name>
<url>http://192.168.10.100:8081/repository/maven-public/</url>
</repository>
<!-- <repository>-->
<!-- <id>logpm</id>-->
<!-- <name>BladeX Release Repository</name>-->
<!-- <url>http://192.168.10.100:8081/repository/maven-public/</url>-->
<!-- </repository>-->
<repository>
<id>aliyun-repos</id>
<name>Aliyun Public Repository</name>

Loading…
Cancel
Save