Browse Source

提取保存包件推送失败的处理方法 增加到异常捕获中

single_db
pref_mail@163.com 1 year ago
parent
commit
5a73f6e3d1
  1. 12
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IOrderPackageStatusPushFailLogService.java
  2. 46
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  3. 45
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/OrderPackageStatusPushFailLogServiceImpl.java

12
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IOrderPackageStatusPushFailLogService.java

@ -0,0 +1,12 @@
package com.logpm.factory.comfac.service;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.logpm.factory.snm.entity.OrderStatusLog;
import org.springblade.core.mp.base.BaseService;
public interface IOrderPackageStatusPushFailLogService extends BaseService<OrderPackageStatusPushFailLogEntity> {
void saveOrderPackageStatusFaleLog(String unitNo, String currentWarehouseId, String status,String operationTime, Integer trayId);
}

46
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -8,6 +8,7 @@ import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.comfac.service.IOrderPackageStatusPushFailLogService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.entity.TrayEntity;
@ -41,7 +42,8 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
private final IAdvanceDetailClient advanceDetailClient;
private final IPanFactoryDataService panFactoryDataService;
private final OrderPackageStatusPushFailLogMapper orderPackageStatusPushFailLogMapper;
private final IOrderPackageStatusPushFailLogService orderPackageStatusPushFailLogService;
private final ITrayClient trayClient;
private final ITrayScanClient trayScanClient;
@ -135,7 +137,9 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
//查询destinationWarehouse logiBillNo plantId数据
Map<String, String> supplyData = advanceDetailClient.getSupplyData(unitNo);
log.info(">>>>>>>>>>>>>>> extracted supplyData {}",supplyData);
log.info(">>>>>>>>>>>>>>> extracted supplyData {}", supplyData);
if (supplyData != null && !supplyData.isEmpty()) {
String destinationWarehouseId = supplyData.get("destinationWarehouseId");//目的仓id
@ -150,53 +154,25 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
//真正的处理需要的数据
if (OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)) {
try {
if ("1".equals(status)) {
if ("1".equals(status) || "4".equals(status)) {
// 始发仓和目的仓入库
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
} else if ("2".equals(status)) {
bladeRedis.setEx("tray-" + unitNo, trayId, 30L);
} else {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> 错误的状态");
}
//同步打托数据
// syncTrayTypeData(unitNo, trayId, currentWarehouseId);
} catch (Exception e) {
log.error(e.getMessage());
log.error(">>>> 数据推送异常", e);
orderPackageStatusPushFailLogService.saveOrderPackageStatusFaleLog(unitNo, currentWarehouseId, status, operationTime, trayId);
log.error(">>>> 保存到错误数据推送记录 {}", unitNo);
}
}
}
}
} else {
log.info("##############dealWithDataHandler: unitNo={} 没有查询到数据 保存到待处理数据库", unitNo);
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("unit_no", unitNo);
queryWrapper.eq("warehouse_id", currentWarehouseId);
List list = orderPackageStatusPushFailLogMapper.selectList(queryWrapper);
if (list == null || list.isEmpty()) {
OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity = new OrderPackageStatusPushFailLogEntity();
orderPackageStatusPushFailLogEntity.setOrderPackageStatus(status);
orderPackageStatusPushFailLogEntity.setUnitNo(unitNo);
orderPackageStatusPushFailLogEntity.setWarehouseId(currentWarehouseId);
orderPackageStatusPushFailLogEntity.setOperationTime(operationTime);
orderPackageStatusPushFailLogEntity.setTrayId(trayId);
orderPackageStatusPushFailLogEntity.setDataStatus(0);
// 插入之前判断这条数据是否存在系统中
log.info(">>>>>>>>>>>>>>>> 保存到定时任务队列");
orderPackageStatusPushFailLogMapper.insert(orderPackageStatusPushFailLogEntity);
}else{
throw new CustomerException(405, "失败的包件数据状态记录已存在");
}
orderPackageStatusPushFailLogService.saveOrderPackageStatusFaleLog(unitNo, currentWarehouseId, status, operationTime, trayId);
}
}

45
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/OrderPackageStatusPushFailLogServiceImpl.java

@ -0,0 +1,45 @@
package com.logpm.factory.comfac.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.factory.comfac.mapper.OrderPackageStatusPushFailLogMapper;
import com.logpm.factory.comfac.service.IOrderPackageStatusPushFailLogService;
import com.logpm.factory.entity.OrderPackageStatusPushFailLogEntity;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
public class OrderPackageStatusPushFailLogServiceImpl extends BaseServiceImpl<OrderPackageStatusPushFailLogMapper, OrderPackageStatusPushFailLogEntity> implements IOrderPackageStatusPushFailLogService {
@Override
public void saveOrderPackageStatusFaleLog(String unitNo, String currentWarehouseId, String status,String operationTime, Integer trayId) {
log.info("##############dealWithDataHandler: unitNo={} 没有查询到数据 保存到待处理数据库", unitNo);
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("unit_no", unitNo);
queryWrapper.eq("warehouse_id", currentWarehouseId);
List list = baseMapper.selectList(queryWrapper);
if (list == null || list.isEmpty()) {
OrderPackageStatusPushFailLogEntity orderPackageStatusPushFailLogEntity = new OrderPackageStatusPushFailLogEntity();
orderPackageStatusPushFailLogEntity.setOrderPackageStatus(status);
orderPackageStatusPushFailLogEntity.setUnitNo(unitNo);
orderPackageStatusPushFailLogEntity.setWarehouseId(currentWarehouseId);
orderPackageStatusPushFailLogEntity.setOperationTime(operationTime);
orderPackageStatusPushFailLogEntity.setTrayId(trayId);
orderPackageStatusPushFailLogEntity.setDataStatus(0);
// 插入之前判断这条数据是否存在系统中
log.info(">>>>>>>>>>>>>>>> 保存到定时任务队列");
baseMapper.insert(orderPackageStatusPushFailLogEntity);
}else{
throw new CustomerException(405, "失败的包件数据状态记录已存在");
}
}
}
Loading…
Cancel
Save