Browse Source

1.增加欧派的数据解析和同步老系统

training
pref_mail@163.com 2 years ago
parent
commit
effd8b718e
  1. 45
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryLogEntity.java
  2. 13
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java
  3. 4
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java
  4. 29
      blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpOrderStatusLogEntity.java
  5. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/constant/FactoryConstant.java
  6. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java
  7. 196
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java
  8. 41
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java
  9. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.java
  10. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml
  11. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.java
  12. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml
  13. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryLogService.java
  14. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpOrderStatusLogService.java
  15. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java
  16. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java
  17. 11
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryLogService.java
  18. 1
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java
  19. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageServiceImpl.java
  20. 11
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpOrderStatusLogServiceImpl.java
  21. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java
  22. 328
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java
  23. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/ReceivingOrderServiceImpl.java
  24. 20
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

45
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryLogEntity.java

@ -0,0 +1,45 @@
package com.logpm.factory.oupai.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("op_factory_log")
@ApiModel(value = "FactoryLog对象", description = "欧派工厂日志")
@EqualsAndHashCode(callSuper = true)
public class FactoryLogEntity extends BaseEntity {
/** 请求内容 */
@ApiModelProperty(name = "请求内容",notes = "")
private String reqArgs ;
/** 响应内容 */
@ApiModelProperty(name = "响应内容",notes = "")
private String resBody ;
/** 数据状态 0 待解析 1 解析成功 2 解析失败 */
@ApiModelProperty(name = "数据状态 0 待解析 1 解析成功 2 解析失败",notes = "")
private Integer dataStatus ;
/** 状态 */
@ApiModelProperty(name = "状态",notes = "")
private Integer status ;
/** 预留1 */
@ApiModelProperty(name = "预留1",notes = "")
private String reserve1 ;
/** 预留2 */
@ApiModelProperty(name = "预留2",notes = "")
private String reserve2 ;
/** 预留3 */
@ApiModelProperty(name = "预留3",notes = "")
private String reserve3 ;
/** 预留4 */
@ApiModelProperty(name = "预留4",notes = "")
private String reserve4 ;
/** 预留5 */
@ApiModelProperty(name = "预留5",notes = "")
private String reserve5 ;
}

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

@ -97,11 +97,18 @@ public class FactoryOrderEntity extends BaseEntity {
*/
@ApiModelProperty(name = "可预约状态 不可预约:0 可预约:1", notes = "")
private Integer reservationStatus;
/**
* 所属门店
*/
@ApiModelProperty(name = "所属门店名称", notes = "")
private String storeName;
/**
* 所属门店
*/
@ApiModelProperty(name = "所属门店", notes = "")
private String store;
@ApiModelProperty(name = "所属门店编码", notes = "")
private String storeCode;
/**
* 齐套模式
*/
@ -121,7 +128,7 @@ public class FactoryOrderEntity extends BaseEntity {
* 是否遗留
*/
@ApiModelProperty(name = "是否遗留", notes = "")
private Integer leave;
private Integer leaveStatus;
/**
* 客户名称
*/

4
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java

@ -99,7 +99,7 @@ public class FactoryPackageEntity extends BaseEntity {
@ApiModelProperty(name = "推送状态 1推送 0未推送",notes = "")
private Integer pushStatus ;
/** 转发状态 1转送 0未转送 */
@ApiModelProperty(name = "转发状态 1转送 0未转送",notes = "")
@ApiModelProperty(name = "转发状态 1转送 0未转送 2 转送失败",notes = "")
private Integer turnStatus ;
/** 车次号 */
@ApiModelProperty(name = "车次号",notes = "")
@ -121,4 +121,6 @@ public class FactoryPackageEntity extends BaseEntity {
private String reserve5 ;
}

29
blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpOrderStatusLogEntity.java

@ -0,0 +1,29 @@
package com.logpm.factory.oupai.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
@Data
@TableName("order_status_log")
@ApiModel(value = "OrderStatusLog对象", description = "欧派的数据")
@EqualsAndHashCode(callSuper = true)
public class OpOrderStatusLogEntity extends BaseEntity {
private String args;
/**
* 数据用途 1. 发车数据
*/
private Integer type;
private String brand;//品牌
/**
* 数据状态 0 待解析 1 解析成功 2 解析失败
*/
private Integer dataStatus;
}

1
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/constant/FactoryConstant.java

@ -9,5 +9,6 @@ public class FactoryConstant {
public static final String PIANO = "皮阿诺";
public static final String MENGT = "梦天";
public static final String OUPAI = "欧派";
}

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

@ -9,6 +9,6 @@ public interface IAsyncDataService {
void handlerMtDataToHt(Long mainId);
void handlerOuPaiDataToHt(Long mainId);
void handlerOuPaiDataToHt(String carNum);
}

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

@ -2,6 +2,7 @@ package com.logpm.factory.comfac.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.factory.comfac.constant.FactoryConstant;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.mt.entity.MtFactoryOrder;
@ -10,6 +11,13 @@ import com.logpm.factory.mt.entity.MtPackageInfo;
import com.logpm.factory.mt.service.IMtFactoryOrderMainService;
import com.logpm.factory.mt.service.IMtFactoryOrderService;
import com.logpm.factory.mt.service.IMtPackageInfoService;
import com.logpm.factory.oupai.entity.FactoryOrderEntity;
import com.logpm.factory.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.entity.ReceivingOrderEntity;
import com.logpm.factory.oupai.service.IFactoryOrderService;
import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.oupai.service.IReceivingOrderService;
import com.logpm.factory.pan.service.IPanFactoryOrderService;
import com.logpm.factory.pan.service.IPanPackageInfoService;
import com.logpm.factory.pan.service.IPanPackageListService;
@ -57,6 +65,16 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
private final IMtFactoryOrderMainService mtFactoryOrderMainService;
private final IMtPackageInfoService mtPackageInfoService;
// oupai
private final IFactoryPackageService factoryPackageService;
private final IFactoryOrderService factoryOrderService;
private final IReceivingOrderService receivingOrderService;
//工厂查询
private final IOuPaiFactoryService ouPaiFactoryService;
/**
* 处理皮阿诺数据推送到汇通老库
@ -319,7 +337,183 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
}
@Override
public void handlerOuPaiDataToHt(Long mainId) {
public void handlerOuPaiDataToHt(String carNumber) {
// 查询需要处理的派车单 查询没有转发的shuju
List<ReceivingOrderEntity> list = receivingOrderService.lambdaQuery().eq(ReceivingOrderEntity::getCarNumber, carNumber).eq(ReceivingOrderEntity::getTurnStatus, 0).list();
for (ReceivingOrderEntity receivingOrderEntity : list) {
// 查询这个派车单下面的订单
List<FactoryOrderEntity> factoryOrderEntities = factoryOrderService.lambdaQuery().eq(FactoryOrderEntity::getReceivingId, receivingOrderEntity.getId()).eq(FactoryOrderEntity::getTurnStatus, 0).list();
addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities);
}
// // 需要将需要处理的数据进行查询 查询包件
// List<FactoryPackageEntity> list = factoryPackageService.lambdaQuery().eq(FactoryPackageEntity::getCarNumber, carNumber).list();
// // 将这里数据加入到老的advance
}
/**
* 欧派数据保存到老系统
*
* @param receivingOrderEntity
* @param factoryOrderEntities
*/
private void addAdvanceEntityBtOuPai(ReceivingOrderEntity receivingOrderEntity, List<FactoryOrderEntity> factoryOrderEntities) {
for (FactoryOrderEntity factoryOrderEntity : factoryOrderEntities) {
AdvanceEntity advanceEntity = new AdvanceEntity();
advanceEntity.setOrderSelfNum(StringUtil.isBlank(factoryOrderEntity.getSelfCode()) ? "" : factoryOrderEntity.getSelfCode()); //订单自编号
advanceEntity.setSiteName(""); // 基地 TODO 需要映射
advanceEntity.setArea(""); // 区域
advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空
advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空
advanceEntity.setType(FactoryConstant.OUPAI);
advanceEntity.setTotal(factoryOrderEntity.getFactorySendQty()); //订单总数据
advanceEntity.setMctsTruck(receivingOrderEntity.getCarNumber()); //车次
advanceEntity.setMtdsNo("");// 生产单号
advanceEntity.setMctsTruckNo(receivingOrderEntity.getPlate());// 车牌//字段没有了
advanceEntity.setFirstPackName(""); //一级品类
advanceEntity.setFirstPackCode(""); //一级品类
advanceEntity.setDealerName(factoryOrderEntity.getShopReceiver()); //商场名称
advanceEntity.setDealerCode(""); //商场编码
advanceEntity.setDueDate(""); // 交期
advanceEntity.setIsOpai(0); //是否干仓配
advanceEntity.setOrderNum("");//MSCS订单号 可以为空
advanceEntity.setCarrierName("汇通");//承运商 可以为空
advanceEntity.setCustomerName(StringUtil.isBlank(factoryOrderEntity.getCustomer()) ? "" : factoryOrderEntity.getCustomer()); //顾客名称
advanceEntity.setCustomerPhone(StringUtil.isBlank(factoryOrderEntity.getCustomerPhone()) ? "" : factoryOrderEntity.getCustomerPhone()); // 顾客电话
advanceEntity.setCustomerRoad(StringUtil.isBlank(factoryOrderEntity.getCustomerAddress()) ? "" : factoryOrderEntity.getCustomerAddress());//顾客地址
advanceEntity.setSystemType("线上"); //订单类型
advanceEntity.setStoreNo(StringUtil.isBlank(factoryOrderEntity.getStoreCode()) ? "" : factoryOrderEntity.getStoreCode()); //门店编码
advanceEntity.setStoreName(StringUtil.isBlank(factoryOrderEntity.getStoreName()) ? "" : factoryOrderEntity.getStoreCode()); //门店名称
advanceEntity.setSerialKey(""); //序列号
advanceEntity.setServiceNum(StringUtil.isBlank(factoryOrderEntity.getServiceNumber()) ? "" : factoryOrderEntity.getServiceNumber()); //服务号
advanceEntity.setMatingCode("");//齐套模式 可以为空
advanceEntity.setContractNum("");//合同号 可以为空
advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否
advanceEntity.setSenderMobile("");//发货人电话 可以为空
advanceEntity.setSenderAddress(""); //发货地址 可以为空
advanceEntity.setSenderName(""); //发货工厂名称 可以为空
advanceEntity.setAdministratorsId(1078);// 导入人
advanceEntity.setCreateTime(LocalDate.now()); //添加时间
advanceEntity.setCarsNum("");
advanceEntity.setDeleteTime(0); // 删除时间
advanceEntity.setWaybillNo("");//运单号 可以为空
// Integer id = PanFactoryEnum.getId(panFactoryOrder.getPlantId());
advanceEntity.setWarehouseId(141); //导入人仓库id TODO 需要提供映射
advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单
advanceEntity.setOldId(0);//
advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结
advanceEntity.setDeleteReason("");//删除原因
advanceEntity.setDeleteAdministratorsId(0);//删除用户
Integer advanceId = iAdvanceClient.addAdvanceClient(advanceEntity);
if (ObjectUtils.isNull(advanceId)) {
continue;
}
advanceEntity.setId(advanceId);
factoryOrderEntity.setTurnStatus(1);
// 处理订单下面的包件数据
List<FactoryPackageEntity> list = factoryPackageService.lambdaQuery().eq(FactoryPackageEntity::getOrderId, factoryOrderEntity.getId()).eq(FactoryPackageEntity::getTurnStatus, 0).list();
for (FactoryPackageEntity factoryPackageEntity : list) {
addAdvanceDetailEntityByOuPai(factoryPackageEntity,factoryOrderEntity,advanceEntity);
}
}
factoryOrderService.updateBatchById(factoryOrderEntities);
}
/**
* 保存包件数据-- 欧派
* @param factoryPackageEntity
* @param factoryOrderEntity
* @param advanceEntity
*/
private void addAdvanceDetailEntityByOuPai(FactoryPackageEntity factoryPackageEntity, FactoryOrderEntity factoryOrderEntity, AdvanceEntity advanceEntity) {
AdvanceDetailEntity advanceDetailEntity = advanceDetailClient.getOneByUnitNo(factoryPackageEntity.getCode());
if (ObjectUtil.isNotEmpty(advanceDetailEntity)) {
// 一 er san 级包件信息
// 更新物料
// 当这个包条存在老系统的时候
advanceDetailEntity.setMctsTruckNo(factoryPackageEntity.getCarNumber());
//更新包件
advanceDetailClient.updateAdvanceDetail(advanceDetailEntity);
} else {
advanceDetailEntity = new AdvanceDetailEntity();
advanceDetailEntity.setAdvanceId(advanceEntity.getId());//预仓id
advanceDetailEntity.setIsPay(Byte.parseByte("0"));//
advanceDetailEntity.setLineID("");//线下订单明细标时 可以为空
advanceDetailEntity.setSerialKey("");//序列号 可以为空
advanceDetailEntity.setArea("");//区域
advanceDetailEntity.setOrderSelfNum(advanceEntity.getOrderSelfNum());//订单自编号
advanceDetailEntity.setType(FactoryConstant.OUPAI);//订单来源
advanceDetailEntity.setSystemType("线上");//订单类型
advanceDetailEntity.setOrderNum("");//MSCS单号 可以为空
advanceDetailEntity.setIsOpai(0);//是否干仓配:1=是,0=否
advanceDetailEntity.setMtdsNo("");//MTDS单号 可以为空
advanceDetailEntity.setFirstPackName(factoryPackageEntity.getFirstClassName());//一级品类
advanceDetailEntity.setFirstPackCode(factoryPackageEntity.getFirstClassCode());//二级品类
advanceDetailEntity.setFirstPackCode(factoryPackageEntity.getFirstClassCode());//二级品类
advanceDetailEntity.setSiteName("");//基地名称 基地 TODO 需要映射
advanceDetailEntity.setSiteCode("");//基地编码
advanceDetailEntity.setProductCode("");//货品名称 可以为空
advanceDetailEntity.setSecondPackName(factoryPackageEntity.getSecondClassName());//二级品类名称
advanceDetailEntity.setSecondPackCode(factoryPackageEntity.getSecondClassCode());//二级品类
advanceDetailEntity.setThirdPackName(factoryPackageEntity.getThirdClassName());//三级品类名称
advanceDetailEntity.setThirdPackCode(factoryPackageEntity.getThirdClassCode());//三级品类
advanceDetailEntity.setGoodName("");//v产品类型 可以为空
advanceDetailEntity.setIsAddin("Y");//例放:N=正常,Y=例放
advanceDetailEntity.setIsThirdAddin("N");//三级例放:N=正常,Y=例放
advanceDetailEntity.setIsSuppin("N");//补进:N=正常,Y=例放
advanceDetailEntity.setMscsNum("1");//发货数量
advanceDetailEntity.setMtdsNum(0);//销售数量
advanceDetailEntity.setVolume("");//体积
advanceDetailEntity.setUnitNo(StringUtil.isBlank(factoryPackageEntity.getCode()) ? "" : factoryPackageEntity.getCode());//包条码
advanceDetailEntity.setMctsTruck(factoryPackageEntity.getCarNumber());//车次号
advanceDetailEntity.setMctsTruckNo(advanceEntity.getMctsTruckNo());//车牌号
advanceDetailEntity.setDate100(null);//基地发货日期
advanceDetailEntity.setDate2("");//预约到厂时间
advanceDetailEntity.setDate3("");//实际到厂时间
advanceDetailEntity.setDate4("");//开始装车时间
advanceDetailEntity.setDate5("");//完成装车时间
advanceDetailEntity.setDate6("");//车辆离厂时间
advanceDetailEntity.setCreateTime(LocalDate.now());//创建时间
advanceDetailEntity.setDeleteTime(0);//删除时间
advanceDetailEntity.setServiceNum(StringUtil.isBlank(advanceEntity.getServiceNum()) ? "" : advanceEntity.getServiceNum());//服务号
advanceDetailEntity.setAdmin("");//
advanceDetailEntity.setAdministratorsId(0);//导入人
advanceDetailEntity.setRemark("");//备注
advanceDetailEntity.setOldId(0);//
Integer detailId = advanceDetailClient.addAdvanceDetail(advanceDetailEntity);
if (detailId > 0) {
//修改数据状态
factoryPackageEntity.setTurnStatus(2);
factoryPackageService.saveOrUpdate(factoryPackageEntity);
} else {
factoryPackageEntity.setTurnStatus(1);
factoryPackageService.saveOrUpdate(factoryPackageEntity);
}
}
}

41
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java

@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.factory.comfac.service.IAsyncDataService;
import com.logpm.factory.comfac.service.IOrderStatusLogService;
import com.logpm.factory.oupai.entity.FactoryLogEntity;
import com.logpm.factory.oupai.entity.FactoryOrderEntity;
import com.logpm.factory.oupai.service.IFactoryLogService;
import com.logpm.factory.oupai.service.IOuPaiFactoryDataService;
import com.logpm.factory.oupai.vo.OuPaiDataPushVO;
import com.logpm.factory.snm.entity.OrderStatusLog;
@ -13,10 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@ -28,44 +28,43 @@ import java.util.Objects;
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("oupaiFactoryData")
@RequestMapping("/factory/oupai")
@Api(value = "欧派工厂数据", tags = "欧派工厂数据")
public class OupaiFactoryDataController {
private final IOuPaiFactoryDataService mtFactoryDataService;
private final IOrderStatusLogService orderStatusLogService;
private final IFactoryLogService factoryLogService;
private final IAsyncDataService syncDataService;
@GetMapping("/acceptOupaiFactoryData")
@PostMapping("/data")
public R acceptOupaiFactoryData(@Validated @RequestBody OuPaiDataPushVO ouPaiDataPushVO, HttpServletRequest request) {
log.info("acceptOupaiFactoryData 参数ouPaiDataPushVO {}",ouPaiDataPushVO.toString());
//先保存原始请求数据
OrderStatusLog orderStatusLog = new OrderStatusLog();
orderStatusLog.setArgs(JSONObject.toJSONString(ouPaiDataPushVO));
FactoryLogEntity orderStatusLog = new FactoryLogEntity();
orderStatusLog.setReqArgs(JSONObject.toJSONString(ouPaiDataPushVO));
orderStatusLog.setStatus(1);
orderStatusLog.setType(3);
orderStatusLog.setBrand("欧派");
orderStatusLogService.save(orderStatusLog);
Long id = null;
orderStatusLog.setDataStatus(0);
factoryLogService.save(orderStatusLog);
String carNum = null;
try {
id = mtFactoryDataService.saveData(ouPaiDataPushVO);
orderStatusLog.setStatus(0);
carNum = mtFactoryDataService.saveData(ouPaiDataPushVO);
orderStatusLog.setDataStatus(1);
} catch (ServiceException e) {
log.warn("############data: 保存数据失败 carNum={}",ouPaiDataPushVO.getCarNum());
log.error("############data: 保存数据失败",e);
//修改保存数据的状态
orderStatusLog.setStatus(2);
orderStatusLog.setDataStatus(2);
}
orderStatusLogService.saveOrUpdate(orderStatusLog);
factoryLogService.saveOrUpdate(orderStatusLog);
// //开启异步线程处理数据
// if(!Objects.isNull(id)){
// syncDataService.handlerOuPaiDataToHt(id);
// }
//开启异步线程处理数据
if(ObjectUtils.isNotNull(carNum)){
syncDataService.handlerOuPaiDataToHt(ouPaiDataPushVO.getCarNum());
}
return R.data(ouPaiDataPushVO.getCarNum());

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

@ -0,0 +1,7 @@
package com.logpm.factory.oupai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.oupai.entity.FactoryLogEntity;
public interface FactoryLogMapper extends BaseMapper<FactoryLogEntity> {
}

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml

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

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

@ -0,0 +1,7 @@
package com.logpm.factory.oupai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
public interface OpOrderStatusLogMapper extends BaseMapper<OpOrderStatusLogEntity> {
}

7
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml

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

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

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

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

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

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java

@ -9,5 +9,5 @@ public interface IOuPaiFactoryDataService {
* @param ouPaiDataPushVO
* @return
*/
Long saveData(OuPaiDataPushVO ouPaiDataPushVO);
String saveData(OuPaiDataPushVO ouPaiDataPushVO);
}

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

@ -8,7 +8,7 @@ public interface IOuPaiFactoryService {
* @param CarNumber
* @return
*/
void findOuPaiFactoryOrderDTOByCarCarNumber(String CarNumber);
String saveOuPaiFactoryOrderDTOByCarCarNumber(String CarNumber);
}

11
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryLogService.java

@ -0,0 +1,11 @@
package com.logpm.factory.oupai.service.impl;
import com.logpm.factory.oupai.entity.FactoryLogEntity;
import com.logpm.factory.oupai.mapper.FactoryLogMapper;
import com.logpm.factory.oupai.service.IFactoryLogService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class FactoryLogService extends BaseServiceImpl<FactoryLogMapper, FactoryLogEntity> implements IFactoryLogService {
}

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

@ -42,6 +42,7 @@ public class FactoryOrderServiceImpl extends BaseServiceImpl<FactoryOrderMapper,
@Override
public FactoryOrderEntity selectEntityBySelfCode(String selfCode) {
QueryWrapper<FactoryOrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.select("self_code","id");
queryWrapper.eq("self_code",selfCode);
return baseMapper.selectOne(queryWrapper);
}

12
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageServiceImpl.java

@ -16,17 +16,14 @@
*/
package com.logpm.factory.oupai.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.excel.FactoryPackageExcel;
import com.logpm.factory.oupai.mapper.FactoryPackageMapper;
import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.oupai.vo.FactoryPackageVO;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 欧派工厂包件 服务实现类
@ -43,13 +40,6 @@ public class FactoryPackageServiceImpl extends BaseServiceImpl<FactoryPackageMap
}
@Override
public List<FactoryPackageExcel> exportFactoryPackage(Wrapper<FactoryPackageEntity> queryWrapper) {
List<FactoryPackageExcel> factoryPackageList = baseMapper.exportFactoryPackage(queryWrapper);
//factoryPackageList.forEach(factoryPackage -> {
// factoryPackage.setTypeName(DictCache.getValue(DictEnum.YES_NO, FactoryPackage.getType()));
//});
return factoryPackageList;
}
}

11
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpOrderStatusLogServiceImpl.java

@ -0,0 +1,11 @@
package com.logpm.factory.oupai.service.impl;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
import com.logpm.factory.oupai.mapper.OpOrderStatusLogMapper;
import com.logpm.factory.oupai.service.IOpOrderStatusLogService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class OpOrderStatusLogServiceImpl extends BaseServiceImpl<OpOrderStatusLogMapper, OpOrderStatusLogEntity> implements IOpOrderStatusLogService {
}

12
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java

@ -19,18 +19,12 @@ public class OuPaiFactoryDataServiceImpl implements IOuPaiFactoryDataService {
@Override
public Long saveData(OuPaiDataPushVO ouPaiDataPushVO) {
public String saveData(OuPaiDataPushVO ouPaiDataPushVO) {
// 获取需要处理的数据并存入数据库
ouPaiFactoryService.findOuPaiFactoryOrderDTOByCarCarNumber(ouPaiDataPushVO.getCarNum());
String carNum =ouPaiFactoryService.saveOuPaiFactoryOrderDTOByCarCarNumber(ouPaiDataPushVO.getCarNum());
// 将需要将数据
return null;
return carNum;
}
}

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

@ -8,10 +8,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.logpm.factory.oupai.entity.FactoryOrderEntity;
import com.logpm.factory.oupai.entity.FactoryPackageEntity;
import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity;
import com.logpm.factory.oupai.entity.ReceivingOrderEntity;
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper;
import com.logpm.factory.oupai.service.IFactoryOrderService;
import com.logpm.factory.oupai.service.IFactoryPackageService;
import com.logpm.factory.oupai.service.IOpOrderStatusLogService;
import com.logpm.factory.oupai.service.IOuPaiFactoryService;
import com.logpm.factory.props.OuPaiProperties;
import lombok.extern.slf4j.Slf4j;
@ -38,31 +40,57 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
@Autowired
private IFactoryPackageService factoryPackageService;
@Override
public void findOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) {
// 查询工厂数据
@Autowired
private IOpOrderStatusLogService opOrderStatusLogService;
JSONArray ourPaiDataByCarNumber = findOurPaiDataByCarNumber(carNumber);
@Override
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String carNumber) {
// 对返回i的数据进行处理 按照 发车单-->订单-->包件 完成保存
handleData(ourPaiDataByCarNumber);
handleData(carNumber);
return carNumber;
}
/**
* 处理返回的JSON数据
* @param ourPaiDataByCarNumber
*
* @param carNumber
*/
private void handleData(JSONArray ourPaiDataByCarNumber) {
log.info("############handleData: 数据处理开始");
private void handleData(String carNumber) {
OpOrderStatusLogEntity opOrderStatusLogEntity = findOurPaiDataByCarNumber(carNumber);
// 保存需要解析的数据
// 获取返回内容
try {
JSONObject jsonObject = JSONObject.parseObject(opOrderStatusLogEntity.getArgs());
JSONArray resultArray = jsonObject.getJSONArray("value");
log.info("############handleData: 数据处理开始");
analyzeData(resultArray);
opOrderStatusLogEntity.setDataStatus(1);
} catch (Exception e) {
e.printStackTrace();
log.error(">>>> error {}", e.getMessage());
opOrderStatusLogEntity.setDataStatus(2);
}
opOrderStatusLogService.saveOrUpdate(opOrderStatusLogEntity);
}
/**
* 解析数据
*
* @param resultArray
*/
private void analyzeData(JSONArray resultArray) {
Date start = new Date();
//循环出来jsonArray
for (int i=0;i<ourPaiDataByCarNumber.size();i++){
JSONObject valueObject = ourPaiDataByCarNumber.getJSONObject(i);
if(Objects.isNull(valueObject)){
for (int i = 0; i < resultArray.size(); i++) {
JSONObject valueObject = resultArray.getJSONObject(i);
if (Objects.isNull(valueObject)) {
log.warn("############handleData: value中没有数据");
throw new CustomerException(403,"value中没有数据");
throw new CustomerException(403, "value中没有数据");
}
JSONObject fromWarehouse = valueObject.getJSONObject("FromWarehouse");
JSONObject currentWarehouse = valueObject.getJSONObject("CurrentWarehouse");
@ -72,22 +100,22 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
ReceivingOrderEntity receivingOrderEntity = new ReceivingOrderEntity();
receivingOrderEntity.setCode(code);
String type = valueObject.getString("Type");
if("中转".equals(type)){
if ("中转".equals(type)) {
receivingOrderEntity.setType(1);
}else if("配送".equals(type)){
} else if ("配送".equals(type)) {
receivingOrderEntity.setType(2);
}else{
} else {
receivingOrderEntity.setType(0);
}
if(!Objects.isNull(currentWarehouse)){
if (!Objects.isNull(currentWarehouse)) {
receivingOrderEntity.setCurrentWarehouseCode(currentWarehouse.getString("Code"));
receivingOrderEntity.setCurrentWarehouseName(currentWarehouse.getString("Name"));
}
if(!Objects.isNull(fromWarehouse)){
if (!Objects.isNull(fromWarehouse)) {
receivingOrderEntity.setFromWarehouseCode(fromWarehouse.getString("Code"));
receivingOrderEntity.setCurrentWarehouseName(fromWarehouse.getString("Name"));
}
if(!Objects.isNull(endWarehouse)){
if (!Objects.isNull(endWarehouse)) {
receivingOrderEntity.setEndWarehouseCode(endWarehouse.getString("Code"));
receivingOrderEntity.setEndWarehouseName(endWarehouse.getString("Name"));
}
@ -95,13 +123,13 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
receivingOrderEntity.setPackagesCount(valueObject.getInteger("PackagesCount"));
receivingOrderEntity.setReceivePackageCount(valueObject.getInteger("ReceivePackageCount"));
String status = valueObject.getString("Status");
if("待收货".equals(status)){
if ("待收货".equals(status)) {
receivingOrderEntity.setFactoryStatus("0");
}else if("已收货".equals(status)){
} else if ("已收货".equals(status)) {
receivingOrderEntity.setFactoryStatus("1");
}else if("收货中".equals(status)){
} else if ("收货中".equals(status)) {
receivingOrderEntity.setFactoryStatus("2");
}else if("已跳过".equals(status)){
} else if ("已跳过".equals(status)) {
receivingOrderEntity.setFactoryStatus("3");
}
receivingOrderEntity.setPlate(valueObject.getString("Plate"));
@ -116,9 +144,11 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
receivingOrderEntity.setReceiptStatus(0);
receivingOrderEntity.setPushStatus(0);
receivingOrderEntity.setTurnStatus(0);
receivingOrderEntity.setIsDeleted(0);
receivingOrderEntity.setCreateTime(new Date());
int row = receivingOrderMapper.insert(receivingOrderEntity);
if(row == 1){
log.info("############handleData: 保存发货单数据 成功成功成功成功 code={}",code);
if (row == 1) {
log.info("############handleData: 保存发货单数据 成功成功成功成功 code={}", code);
Long receivingId = receivingOrderEntity.getId();//发货单id
JSONArray packages = valueObject.getJSONArray("Packages");
for (int j = 0; j < packages.size(); j++) {
@ -127,7 +157,8 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String selfCode = orderEntity.getString("SelfCode");//订单自编码
//先查询是否存在订单自编码
FactoryOrderEntity factoryOrderEntity = factoryOrderService.selectEntityBySelfCode(selfCode);
if(Objects.isNull(factoryOrderEntity)){
if (Objects.isNull(factoryOrderEntity)) {
factoryOrderEntity = new FactoryOrderEntity();
factoryOrderEntity.setCode(orderEntity.getString("Code"));
factoryOrderEntity.setSelfCode(selfCode);
@ -136,58 +167,58 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryOrderEntity.setOrderClass(orderEntity.getString("OrderClass"));
factoryOrderEntity.setOrderType(orderEntity.getString("OrderType"));
String factoryStatus = orderEntity.getString("Status");
if("待送货".equals(factoryStatus)){
if ("待送货".equals(factoryStatus)) {
factoryOrderEntity.setFactoryStatus(0);
}else if("已签收".equals(factoryStatus)){
} else if ("已签收".equals(factoryStatus)) {
factoryOrderEntity.setFactoryStatus(2);
}else if("已取消".equals(factoryStatus)){
} else if ("已取消".equals(factoryStatus)) {
factoryOrderEntity.setFactoryStatus(3);
}else if("部分签收".equals(factoryStatus)){
} else if ("部分签收".equals(factoryStatus)) {
factoryOrderEntity.setFactoryStatus(6);
}
String factoryShipStatus = orderEntity.getString("FactoryShipStatus");
if("工厂未发货".equals(factoryShipStatus)){
if ("工厂未发货".equals(factoryShipStatus)) {
factoryOrderEntity.setFactoryShipStatus(0);
}else if("工厂部分发货".equals(factoryShipStatus)){
} else if ("工厂部分发货".equals(factoryShipStatus)) {
factoryOrderEntity.setFactoryShipStatus(1);
}else if("工厂齐套发货".equals(factoryShipStatus)){
} else if ("工厂齐套发货".equals(factoryShipStatus)) {
factoryOrderEntity.setFactoryShipStatus(2);
}
factoryOrderEntity.setFactorySendQty(orderEntity.getInteger("FactorySendQty"));
String warehouseReceiveStatus = orderEntity.getString("WarehouseReceiveStatus");
if("仓库未收货".equals(warehouseReceiveStatus)){
if ("仓库未收货".equals(warehouseReceiveStatus)) {
factoryOrderEntity.setWarehouseReceiveStatus(0);
}else if("仓库部分收货".equals(warehouseReceiveStatus)){
} else if ("仓库部分收货".equals(warehouseReceiveStatus)) {
factoryOrderEntity.setWarehouseReceiveStatus(1);
}else if("仓库全部收货".equals(warehouseReceiveStatus)){
} else if ("仓库全部收货".equals(warehouseReceiveStatus)) {
factoryOrderEntity.setWarehouseReceiveStatus(2);
}
factoryOrderEntity.setWarehouseReceiveQty(orderEntity.getInteger("WarehouseReceiveQty"));
String reservationStatus = orderEntity.getString("ReservationStatus");
if("不可预约".equals(reservationStatus)){
if ("不可预约".equals(reservationStatus)) {
factoryOrderEntity.setReservationStatus(0);
}else if("可预约".equals(reservationStatus)){
} else if ("可预约".equals(reservationStatus)) {
factoryOrderEntity.setReservationStatus(1);
}
factoryOrderEntity.setStore("");//TODO 没有找到门店字段
factoryOrderEntity.setStoreName("");//TODO 没有找到门店字段
factoryOrderEntity.setMatingCode(orderEntity.getString("MatingCode"));
Boolean isMating = orderEntity.getBoolean("IsMating");
if(isMating){
if (isMating) {
factoryOrderEntity.setIsMating(1);
}else{
} else {
factoryOrderEntity.setIsMating(0);
}
factoryOrderEntity.setFirstClassCode(orderEntity.getString("FirstClassCode"));
Boolean leave = orderEntity.getBoolean("Leave");
if(leave){
factoryOrderEntity.setLeave(1);
}else{
factoryOrderEntity.setLeave(0);
if (leave) {
factoryOrderEntity.setLeaveStatus(1);
} else {
factoryOrderEntity.setLeaveStatus(0);
}
factoryOrderEntity.setCustomer(orderEntity.getString("Customer"));
factoryOrderEntity.setProvince(orderEntity.getString("Province"));
@ -202,9 +233,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryOrderEntity.setFirstReceiveTime(orderEntity.getDate("FirstReceiveTime"));
factoryOrderEntity.setMatingReceiveTime(orderEntity.getDate("MatingReceiveTime"));
Boolean freeze = orderEntity.getBoolean("Freeze");
if(freeze){
if (freeze) {
factoryOrderEntity.setFreeze(1);
}else{
} else {
factoryOrderEntity.setFreeze(0);
}
factoryOrderEntity.setOutGoingTime(orderEntity.getDate("OutGoingTime"));
@ -214,117 +245,119 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryOrderEntity.setPushStatus(0);
factoryOrderEntity.setTurnStatus(0);
boolean save = factoryOrderService.save(factoryOrderEntity);
if(save){
//保存订单成功,继续保存包件
Long orderId = factoryOrderEntity.getId();
String packageCode = packageEntity.getString("Code");
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>();
packageEntityQueryWrapper.eq("code",packageCode);
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper);
if(Objects.isNull(factoryPackageEntity)){
factoryPackageEntity = new FactoryPackageEntity();
factoryPackageEntity.setOrderId(orderId);
factoryPackageEntity.setCode(packageCode);
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode"));
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassName"));
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode"));
factoryPackageEntity.setSecondClassName(packageEntity.getString("secondClassName"));
factoryPackageEntity.setThirdClassCode(packageEntity.getString("ThirdClassCode"));
factoryPackageEntity.setThirdClassName(packageEntity.getString("ThirdClassName"));
Boolean buyIn = packageEntity.getBoolean("BuyIn");
if(buyIn){
factoryPackageEntity.setBuyin(1);
}else{
factoryPackageEntity.setBuyin(0);
}
factoryPackageEntity.setCosourcingCode(packageEntity.getString("CosourcingCode"));
factoryPackageEntity.setCosourcingUnit(packageEntity.getString("CosourcingUnit"));
String packageStatus = packageEntity.getString("PackageStatus");
//未知:0 已调度:1 已装车:2 待收货:3 已收货:4 已在库:5 待理货:6 待上架:7 已上架:8 已下架:9 已发运:10 已签收:11 待返货:12 已提件:13 已拒收:14 异常:-1
if("已调度".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(1);
}else if("已装车".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(2);
}else if("待收货".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(3);
}else if("已收货".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(4);
}else if("已在库".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(5);
}else if("待理货".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(6);
}else if("待上架".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(7);
}else if("已上架".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(8);
}else if("已下架".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(9);
}else if("已发运".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(10);
}else if("已签收".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(11);
}else if("待返货".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(12);
}else if("已提件".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(13);
}else if("已拒收".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(14);
}else if("异常".equals(packageStatus)){
factoryPackageEntity.setPackageStatus(-1);
}else{
factoryPackageEntity.setPackageStatus(0);
}
factoryPackageEntity.setLength(packageEntity.getBigDecimal("Length"));
factoryPackageEntity.setWidth(packageEntity.getBigDecimal("Width"));
factoryPackageEntity.setHeight(packageEntity.getBigDecimal("Height"));
factoryPackageEntity.setWeight(packageEntity.getBigDecimal("Weight"));
Boolean isInventory = packageEntity.getBoolean("IsInventory");
if(isInventory){
factoryPackageEntity.setIsInventory(1);
}else{
factoryPackageEntity.setIsInventory(0);
}
Boolean packageFreeze = packageEntity.getBoolean("Freeze");
if(packageFreeze){
factoryPackageEntity.setFreeze(1);
}else{
factoryPackageEntity.setFreeze(0);
}
//保存包件信息
factoryPackageService.save(factoryPackageEntity);
}else{
log.warn("############handleData: 包件码已存在 packageCode={}",packageCode);
throw new CustomerException(403,"包件码已存在");
}
}else{
log.warn("############handleData: 保存订单失败 selfCode={}",selfCode);
throw new CustomerException(403,"保存订单失败");
if (!save) {
log.warn("############handleData: 保存订单失败 selfCode={}", selfCode);
throw new CustomerException(403, "保存订单失败");
}
}
//保存订单成功,继续保存包件
Long orderId = factoryOrderEntity.getId();
String packageCode = packageEntity.getString("Code");
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>();
packageEntityQueryWrapper.eq("code", packageCode);
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper);
if (Objects.isNull(factoryPackageEntity)) {
factoryPackageEntity = new FactoryPackageEntity();
factoryPackageEntity.setOrderId(orderId);
factoryPackageEntity.setCode(packageCode);
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode"));
factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassName"));
factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode"));
factoryPackageEntity.setSecondClassName(packageEntity.getString("secondClassName"));
factoryPackageEntity.setThirdClassCode(packageEntity.getString("ThirdClassCode"));
factoryPackageEntity.setThirdClassName(packageEntity.getString("ThirdClassName"));
Boolean buyIn = packageEntity.getBoolean("BuyIn");
if (buyIn) {
factoryPackageEntity.setBuyin(1);
} else {
factoryPackageEntity.setBuyin(0);
}
factoryPackageEntity.setCosourcingCode(packageEntity.getString("CosourcingCode"));
factoryPackageEntity.setCosourcingUnit(packageEntity.getString("CosourcingUnit"));
String packageStatus = packageEntity.getString("PackageStatus");
//未知:0 已调度:1 已装车:2 待收货:3 已收货:4 已在库:5 待理货:6 待上架:7 已上架:8 已下架:9 已发运:10 已签收:11 待返货:12 已提件:13 已拒收:14 异常:-1
if ("已调度".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(1);
} else if ("已装车".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(2);
} else if ("待收货".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(3);
} else if ("已收货".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(4);
} else if ("已在库".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(5);
} else if ("待理货".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(6);
} else if ("待上架".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(7);
} else if ("已上架".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(8);
} else if ("已下架".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(9);
} else if ("已发运".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(10);
} else if ("已签收".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(11);
} else if ("待返货".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(12);
} else if ("已提件".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(13);
} else if ("已拒收".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(14);
} else if ("异常".equals(packageStatus)) {
factoryPackageEntity.setPackageStatus(-1);
} else {
factoryPackageEntity.setPackageStatus(0);
}
factoryPackageEntity.setLength(packageEntity.getBigDecimal("Length"));
factoryPackageEntity.setWidth(packageEntity.getBigDecimal("Width"));
factoryPackageEntity.setHeight(packageEntity.getBigDecimal("Height"));
factoryPackageEntity.setWeight(packageEntity.getBigDecimal("Weight"));
Boolean isInventory = packageEntity.getBoolean("IsInventory");
if (isInventory) {
factoryPackageEntity.setIsInventory(1);
} else {
factoryPackageEntity.setIsInventory(0);
}
Boolean packageFreeze = packageEntity.getBoolean("Freeze");
if (packageFreeze) {
factoryPackageEntity.setFreeze(1);
} else {
factoryPackageEntity.setFreeze(0);
}
//保存包件信息
factoryPackageEntity.setReceiptStatus(0);
factoryPackageEntity.setPushStatus(0);
factoryPackageEntity.setTurnStatus(0);
factoryPackageService.save(factoryPackageEntity);
} else {
log.warn("############handleData: 包件码已存在 packageCode={}", packageCode);
throw new CustomerException(403, "包件码已存在");
}
}
}else{
log.warn("############handleData: 保存发货单数据失败 code={}",code);
throw new CustomerException(403,"保存发货单数据失败");
} else {
log.warn("############handleData: 保存发货单数据失败 code={}", code);
throw new CustomerException(403, "保存发货单数据失败");
}
Date end = new Date();
long startLong = start.getTime();
long endLong = end.getTime();
long l = endLong - startLong;
log.info("############handleData: 数据处理完成 耗时 {} 毫秒",l);
log.info("############handleData: 数据处理完成 耗时 {} 毫秒", l);
}
}
/**
* 请求工厂返回的的数据
*
* @param carNumber
* @return
*/
private JSONArray findOurPaiDataByCarNumber(String carNumber) {
private OpOrderStatusLogEntity findOurPaiDataByCarNumber(String carNumber) {
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '"+carNumber+"'&select=Code,Type,Status,Plate,PlateNum,CarNumber,CarrierCode,PackagesCount,ReceivePackageCount,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" +
String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=CarNumber eq '" + carNumber + "'&select=Code,Type,Status,Plate,PlateNum,CarNumber,CarrierCode,PackagesCount,ReceivePackageCount,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" +
"&$expand=Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,PackageDetails,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus;\n" +
"$expand=Order($select=" +
"Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime\n" +
@ -339,10 +372,17 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String result = httpResponse.body();
log.info(">>> findOurPaiDataByCarNumber result {}", result);
// 获取返回内容
JSONObject jsonObject = JSONObject.parseObject(result);
JSONArray resultArray = jsonObject.getJSONArray("value");
return resultArray;
OpOrderStatusLogEntity orderStatusLog = new OpOrderStatusLogEntity();
orderStatusLog.setArgs(result);
orderStatusLog.setStatus(1);
orderStatusLog.setType(1);
orderStatusLog.setDataStatus(0);
orderStatusLog.setBrand("欧派");
opOrderStatusLogService.save(orderStatusLog);
return orderStatusLog;
}

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

@ -19,7 +19,6 @@ package com.logpm.factory.oupai.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.factory.oupai.entity.ReceivingOrderEntity;
import com.logpm.factory.oupai.excel.ReceivingOrderExcel;
import com.logpm.factory.oupai.mapper.ReceivingOrderMapper;
import com.logpm.factory.oupai.service.IReceivingOrderService;
import com.logpm.factory.oupai.vo.ReceivingOrderVO;
@ -43,13 +42,6 @@ public class ReceivingOrderServiceImpl extends BaseServiceImpl<ReceivingOrderMap
}
@Override
public List<ReceivingOrderExcel> exportReceivingOrder(Wrapper<ReceivingOrderEntity> queryWrapper) {
List<ReceivingOrderExcel> receivingOrderList = baseMapper.exportReceivingOrder(queryWrapper);
//receivingOrderList.forEach(receivingOrder -> {
// receivingOrder.setTypeName(DictCache.getValue(DictEnum.YES_NO, ReceivingOrder.getType()));
//});
return receivingOrderList;
}
}

20
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -42,15 +42,15 @@ import java.util.stream.Collectors;
public class TestService {
@Autowired
private IOuPaiFactoryService ouPaiFactoryService;
@Test
public void test2() {
ouPaiFactoryService.findOuPaiFactoryOrderDTOByCarCarNumber("LCD230505047");
}
// @Autowired
// private IOuPaiFactoryService ouPaiFactoryService;
//
//
//
// @Test
// public void test2() {
// ouPaiFactoryService.findOuPaiFactoryOrderDTOByCarCarNumber("LCD230505047");
//
// }
}

Loading…
Cancel
Save