From effd8b718efd184a490de2678efccbd45442829c Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" <123456> Date: Thu, 24 Aug 2023 18:53:53 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=AC=A7=E6=B4=BE=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A7=A3=E6=9E=90=E5=92=8C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=80=81=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oupai/entity/FactoryLogEntity.java | 45 +++ .../oupai/entity/FactoryOrderEntity.java | 13 +- .../oupai/entity/FactoryPackageEntity.java | 4 +- .../oupai/entity/OpOrderStatusLogEntity.java | 29 ++ .../comfac/constant/FactoryConstant.java | 1 + .../comfac/service/IAsyncDataService.java | 2 +- .../service/impl/AsyncDataServiceImpl.java | 196 ++++++++++- .../OupaiFactoryDataController.java | 41 ++- .../oupai/mapper/FactoryLogMapper.java | 7 + .../factory/oupai/mapper/FactoryLogMapper.xml | 8 + .../oupai/mapper/OpOrderStatusLogMapper.java | 7 + .../oupai/mapper/OpOrderStatusLogMapper.xml | 7 + .../oupai/service/IFactoryLogService.java | 7 + .../service/IOpOrderStatusLogService.java | 7 + .../service/IOuPaiFactoryDataService.java | 2 +- .../oupai/service/IOuPaiFactoryService.java | 2 +- .../oupai/service/impl/FactoryLogService.java | 11 + .../service/impl/FactoryOrderServiceImpl.java | 1 + .../impl/FactoryPackageServiceImpl.java | 12 +- .../impl/OpOrderStatusLogServiceImpl.java | 11 + .../impl/OuPaiFactoryDataServiceImpl.java | 12 +- .../service/impl/OuPaiFactoryServiceImpl.java | 328 ++++++++++-------- .../impl/ReceivingOrderServiceImpl.java | 10 +- .../java/com/logpm/factory/TestService.java | 20 +- 24 files changed, 571 insertions(+), 212 deletions(-) create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryLogEntity.java create mode 100644 blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpOrderStatusLogEntity.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryLogService.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpOrderStatusLogService.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryLogService.java create mode 100644 blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpOrderStatusLogServiceImpl.java diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryLogEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryLogEntity.java new file mode 100644 index 000000000..d07494867 --- /dev/null +++ b/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 ; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java index a8900c3e1..ab41659d9 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryOrderEntity.java +++ b/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; /** * 客户名称 */ diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java index 694c4f5f2..f6e4aec10 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java +++ b/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 ; + + } diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpOrderStatusLogEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/OpOrderStatusLogEntity.java new file mode 100644 index 000000000..ad2e7dca7 --- /dev/null +++ b/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; + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/constant/FactoryConstant.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/constant/FactoryConstant.java index 43c07e277..1839b4687 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/constant/FactoryConstant.java +++ b/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 = "欧派"; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java index c00ef548a..f7dfe659d 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java +++ b/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); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java index af0dfe89b..348662acb 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java +++ b/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 list = receivingOrderService.lambdaQuery().eq(ReceivingOrderEntity::getCarNumber, carNumber).eq(ReceivingOrderEntity::getTurnStatus, 0).list(); + for (ReceivingOrderEntity receivingOrderEntity : list) { + // 查询这个派车单下面的订单 + List factoryOrderEntities = factoryOrderService.lambdaQuery().eq(FactoryOrderEntity::getReceivingId, receivingOrderEntity.getId()).eq(FactoryOrderEntity::getTurnStatus, 0).list(); + addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities); + } + + +// // 需要将需要处理的数据进行查询 查询包件 +// List list = factoryPackageService.lambdaQuery().eq(FactoryPackageEntity::getCarNumber, carNumber).list(); +// // 将这里数据加入到老的advance + + + } + + /** + * 欧派数据保存到老系统 + * + * @param receivingOrderEntity + * @param factoryOrderEntities + */ + private void addAdvanceEntityBtOuPai(ReceivingOrderEntity receivingOrderEntity, List 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 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); + } + + } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java index f3c3fe950..cedc1fb81 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/controller/OupaiFactoryDataController.java +++ b/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()); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.java new file mode 100644 index 000000000..c143c96ec --- /dev/null +++ b/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 { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml new file mode 100644 index 000000000..8f89769b9 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryLogMapper.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.java new file mode 100644 index 000000000..996c26708 --- /dev/null +++ b/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 { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml new file mode 100644 index 000000000..7ab2c4ed6 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/OpOrderStatusLogMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IFactoryLogService.java new file mode 100644 index 000000000..2592f199b --- /dev/null +++ b/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 { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpOrderStatusLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOpOrderStatusLogService.java new file mode 100644 index 000000000..3585e1d95 --- /dev/null +++ b/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 { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java index a0aff0d65..e453f0cd3 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryDataService.java +++ b/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); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java index d1ae208fa..469dc0ad9 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/IOuPaiFactoryService.java +++ b/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); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryLogService.java new file mode 100644 index 000000000..5aa144700 --- /dev/null +++ b/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 implements IFactoryLogService { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java index 241b4d176..e525e65ed 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryOrderServiceImpl.java @@ -42,6 +42,7 @@ public class FactoryOrderServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.select("self_code","id"); queryWrapper.eq("self_code",selfCode); return baseMapper.selectOne(queryWrapper); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageServiceImpl.java index 3e47e467f..2f65adf29 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/FactoryPackageServiceImpl.java +++ b/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 exportFactoryPackage(Wrapper queryWrapper) { - List factoryPackageList = baseMapper.exportFactoryPackage(queryWrapper); - //factoryPackageList.forEach(factoryPackage -> { - // factoryPackage.setTypeName(DictCache.getValue(DictEnum.YES_NO, FactoryPackage.getType())); - //}); - return factoryPackageList; - } + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpOrderStatusLogServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OpOrderStatusLogServiceImpl.java new file mode 100644 index 000000000..138f838b3 --- /dev/null +++ b/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 implements IOpOrderStatusLogService { +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java index 2e41a02d7..a3985a628 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java +++ b/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; } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 208fc0656..23043b265 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/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 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 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; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/ReceivingOrderServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/ReceivingOrderServiceImpl.java index 888099929..ce563872b 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/ReceivingOrderServiceImpl.java +++ b/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 exportReceivingOrder(Wrapper queryWrapper) { - List receivingOrderList = baseMapper.exportReceivingOrder(queryWrapper); - //receivingOrderList.forEach(receivingOrder -> { - // receivingOrder.setTypeName(DictCache.getValue(DictEnum.YES_NO, ReceivingOrder.getType())); - //}); - return receivingOrderList; - } + } diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index 17005bfd4..f048883a4 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/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"); +// +// } }