import cn.estsh.i3plus.pojo.mes.bean.shipping.MesShippingOrderManagement import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList import cn.estsh.i3plus.pojo.mes.dbinterface.MesInterfaceDataMapper import cn.estsh.i3plus.pojo.mes.repository.MesLoadingListRepository import cn.estsh.i3plus.pojo.mes.repository.MesShippingOrderManagementRepository import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.util.StringUtils /** * @Description : MES2PISCES 装车单明细 * @Reference : * @Author : gsz * @CreateDate 2024/7/14 10:59 * @Modify: * */ class MesToPiscesMesLoadingListDetail { public static final Logger LOGGER = LoggerFactory.getLogger(MesToPiscesMesLoadingListDetail.class) @Autowired private MesLoadingListRepository mesLoadingListRepository; @Autowired private MesShippingOrderManagementRepository mesShippingRepository; def filterData(MesInterfaceDataMapper mapper, List> srcData) throws Exception { if (srcData == null || srcData.size() == 0) { return srcData } Map mesProductionRecordMap = new HashMap<>(); Map mesLoadingListMap = new HashMap<>(); for (Map rowMap : srcData) { //发运单 if (!StringUtils.isEmpty(rowMap.get("shipping_id"))) { long shippingId = Long.parseLong(String.valueOf(rowMap.get("shipping_id"))); if (Objects.isNull(mesProductionRecordMap) || !mesProductionRecordMap.containsKey(shippingId)) { mesProductionRecordMap.put(shippingId, mesShippingRepository.getById(shippingId)) } MesShippingOrderManagement mesProductionRecord = mesProductionRecordMap.get(shippingId) if (!Objects.isNull(mesProductionRecord)) { rowMap.put("SHIPPING_FID", mesProductionRecord.getFid()) } else { rowMap.put("SHIPPING_FID", null) LOGGER.info("发运单id:{},信息不存在", String.valueOf(rowMap.get(rowMap.get("shipping_id")))) } }else{ rowMap.put("SHIPPING_FID", null) } //装车单 if (!StringUtils.isEmpty(rowMap.get("pid"))) { long id = Long.parseLong(String.valueOf(rowMap.get("pid"))); if (Objects.isNull(mesLoadingListMap) || !mesLoadingListMap.containsKey(id)) { mesLoadingListMap.put(id, mesLoadingListRepository.getById(id)) } MesLoadingList mesLoadingList = mesLoadingListMap.get(id) if (!Objects.isNull(mesLoadingList)) { rowMap.put("LOADING_LIST_FID", mesLoadingList.getFid()) } else { rowMap.put("LOADING_LIST_FID", null) LOGGER.info("装车id:{},信息不存在", String.valueOf(rowMap.get(rowMap.get("pid")))) } }else{ rowMap.put("LOADING_LIST_FID", null) } } return srcData; } }