diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java index 53981590a..41cfee1e0 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/OrderPackageStatusFallJob.java @@ -47,6 +47,7 @@ public class OrderPackageStatusFallJob { orderPackageStatusPushFailLogEntity.setDataStatus(1); + }catch (CustomerException e){ XxlJobLogger.log(e); log.error("##################getOrderPackageFromOldSystem: 处理推送失败数据",e); diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java index 27fae10dd..c0d47a346 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWarehousingEntryServiceImpl.java @@ -87,8 +87,6 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl selectWarehouseWarehousingEntryPage(IPage page, WarehouseWarehousingEntryVO warehouseWarehousingEntry) { return page.setRecords(baseMapper.selectWarehouseWarehousingEntryPage(page, warehouseWarehousingEntry)); @@ -107,16 +105,16 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl list = warehouseWarehousingEntryDTO.getList(); WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity(); - BeanUtil.copyProperties(warehouseWarehousingEntryDTO,warehouseWarehousingEntry); + BeanUtil.copyProperties(warehouseWarehousingEntryDTO, warehouseWarehousingEntry); //入库批次号 - if(ObjectUtils.isNull( warehouseWarehousingEntry.getReceiptBatch() )){ + if (ObjectUtils.isNull(warehouseWarehousingEntry.getReceiptBatch())) { long time = new Date().getTime(); BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); String s = "RK" + myCurrentWarehouse.getWarehouseCode() + time; @@ -126,21 +124,21 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl{ + //添加 + //获取当前登录人仓库 + BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getMyCurrentWarehouse(); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("#####操作人,当前未查询到仓库信息"); + return false; + } + warehouseWarehousingEntry.setWarehouseId(basicdataWarehouseEntity.getId()); + warehouseWarehousingEntry.setWarehouse(basicdataWarehouseEntity.getName()); + warehouseWarehousingEntry.setSource("添加"); + warehouseWarehousingEntry.setConditions("3"); + this.save(warehouseWarehousingEntry); + list.forEach(i -> { //添加库存品 - addInventory(i.getCreateInventory(),warehouseWarehousingEntryDTO,i); + addInventory(i.getCreateInventory(), warehouseWarehousingEntryDTO, i); }); //添加入库明细 // Iterator iterator = list.iterator(); @@ -149,8 +147,8 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl{ + if (!list.isEmpty()) { + list.forEach(i -> { i.setWarehousingEntryId(warehouseWarehousingEntry.getId()); i.setConditions("3"); } @@ -158,46 +156,46 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl list = warehouseWarehousingEntryDTO.getList(); WarehouseWarehousingEntryEntity warehouseWarehousingEntry = new WarehouseWarehousingEntryEntity(); - BeanUtil.copyProperties(warehouseWarehousingEntryDTO,warehouseWarehousingEntry); + BeanUtil.copyProperties(warehouseWarehousingEntryDTO, warehouseWarehousingEntry); WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); - BeanUtil.copyProperties(warehouseWarehousingEntryDTO,entryEntity); + BeanUtil.copyProperties(warehouseWarehousingEntryDTO, entryEntity); //入库批次号 - if(ObjectUtils.isNull( warehouseWarehousingEntry.getReceiptBatch() )){ + if (ObjectUtils.isNull(warehouseWarehousingEntry.getReceiptBatch())) { long time = new Date().getTime(); BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - warehouseWarehousingEntry.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); + warehouseWarehousingEntry.setReceiptBatch("RK" + myCurrentWarehouse.getWarehouseCode() + time); } entryEntity.setId(warehouseWarehousingEntryDTO.getId()); - if(ObjectUtils.isNotNull(warehouseWarehousingEntryDTO.getId())){ + if (ObjectUtils.isNotNull(warehouseWarehousingEntryDTO.getId())) { //修改 List detailEntityList = new ArrayList<>(); List list1 = warehouseWarehousingDetailService.list(Wrappers.query().lambda() .eq(WarehouseWarehousingDetailEntity::getWarehousingEntryId, warehouseWarehousingEntry.getId()) .apply("conditions in (1,2) ") );//查询不是确定的数据 - if(!list1.isEmpty()){ + if (!list1.isEmpty()) { AtomicReference num = new AtomicReference<>(0); - list1.forEach( i ->{ + list1.forEach(i -> { boolean b = list.stream().anyMatch(w -> w.getMaterialId().equals(i.getMaterialId())); - if(b){ + if (b) { //存在 Iterator iterator = list.iterator(); - while (iterator.hasNext()){ + while (iterator.hasNext()) { WarehouseWarehousingDetailEntity next = iterator.next(); - if(next.getMaterialId().equals(i.getMaterialId())){ + if (next.getMaterialId().equals(i.getMaterialId())) { //修改 WarehouseWarehousingDetailEntity detailEntity = new WarehouseWarehousingDetailEntity(); detailEntity.setId(i.getId()); detailEntity.setActualReceipt(next.getActualReceipt()); //实际 - if(next.getActualReceipt().equals(i.getCreateInventory()) || next.getActualReceipt() > i.getCreateInventory()){ + if (next.getActualReceipt().equals(i.getCreateInventory()) || next.getActualReceipt() > i.getCreateInventory()) { detailEntity.setConditions("3"); num.updateAndGet(v -> v + 1); - }else if(next.getActualReceipt() > 0 ){ + } else if (next.getActualReceipt() > 0) { detailEntity.setConditions("2"); entryEntity.setConditions("2"); warehouseWarehousingEntry.setConditions("2"); @@ -206,13 +204,13 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl iterator = list.iterator(); - while (iterator.hasNext()){ + while (iterator.hasNext()) { WarehouseWarehousingDetailEntity next = iterator.next(); - if(ObjectUtils.isNotNull(next.getConditions() ) && "3".equals(next.getConditions())){ + if (ObjectUtils.isNotNull(next.getConditions()) && "3".equals(next.getConditions())) { iterator.remove(); } } - if(!list.isEmpty()){ - list.forEach(i ->{ + if (!list.isEmpty()) { + list.forEach(i -> { i.setWarehousingEntryId(warehouseWarehousingEntry.getId()); i.setConditions("1"); } @@ -262,7 +260,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl>>>>>>>>>>>{}",one); - if(ObjectUtils.isNotNull(one) && ObjectUtils.isNotNull(one.getId())){ + log.info("one>>>>>>>>>>>>{}", one); + if (ObjectUtils.isNotNull(one) && ObjectUtils.isNotNull(one.getId())) { List list = warehouseWarehousingDetailService.list(Wrappers.query().lambda() .eq(WarehouseWarehousingDetailEntity::getWarehousingEntryId, one.getId()) ); WarehouseWarehousingEntryVO warehouseWarehousingEntryVO = new WarehouseWarehousingEntryVO(); - BeanUtils.copyProperties(one,warehouseWarehousingEntryVO); + BeanUtils.copyProperties(one, warehouseWarehousingEntryVO); warehouseWarehousingEntryVO.setList(list); return warehouseWarehousingEntryVO; - }else{ + } else { return null; } } /** * 导入 + * * @param data * @param isCovered */ @@ -398,51 +394,51 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl> collect = data.stream().map(x -> { return x; - }).collect(Collectors.groupingBy(o ->{ - System.out.println("====<<<<<<<<"+o); - if(ObjectUtils.isEmpty(o) || ObjectUtils.isNull(o.getCustomerName()) || ObjectUtils.isNull(o.getCustomerCode()) ){ + }).collect(Collectors.groupingBy(o -> { + System.out.println("====<<<<<<<<" + o); + if (ObjectUtils.isEmpty(o) || ObjectUtils.isNull(o.getCustomerName()) || ObjectUtils.isNull(o.getCustomerCode())) { return ""; - }else{ + } else { WarehouseWarehousingEntryEntity entryEntity = new WarehouseWarehousingEntryEntity(); - if(ObjectUtils.isNull(o.getReceiptBatch())){ + if (ObjectUtils.isNull(o.getReceiptBatch())) { long time = new Date().getTime(); BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - entryEntity.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); - }else{ + entryEntity.setReceiptBatch("RK" + myCurrentWarehouse.getWarehouseCode() + time); + } else { entryEntity.setReceiptBatch(o.getReceiptBatch()); } entryEntity.setReceiptDate(o.getReceiptDate()); //入库批次号 - if(ObjectUtils.isNull( o.getReceiptBatch() )){ + if (ObjectUtils.isNull(o.getReceiptBatch())) { long time = new Date().getTime(); BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - entryEntity.setReceiptBatch("RK"+myCurrentWarehouse.getWarehouseCode()+time); + entryEntity.setReceiptBatch("RK" + myCurrentWarehouse.getWarehouseCode() + time); } entryEntity.setConditions("1"); // entryEntity.setReceiptBatch("1"); BasicdataClientEntity customer = basicdataClientClient.getCustomer(o.getCustomerName(), o.getCustomerCode()); - if(ObjectUtils.isNotEmpty(customer) ){ - if(StringUtils.isNotBlank(o.getStoreName())){ + if (ObjectUtils.isNotEmpty(customer)) { + if (StringUtils.isNotBlank(o.getStoreName())) { BasicdataClientEntity customer1 = basicdataClientClient.findByName(o.getStoreName()); - if(Func.isNotEmpty(customer1)){ + if (Func.isNotEmpty(customer1)) { entryEntity.setStoreId(customer1.getId()); entryEntity.setStoreName(o.getStoreName()); - }else{ - throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"门店信息不存在!!请维护门店数据!!!"); + } else { + throw new ServiceException(o.getCustomerName() + o.getCustomerCode() + "门店信息不存在!!请维护门店数据!!!"); } } entryEntity.setClientId(customer.getId());//客户id entryEntity.setCustomerName(o.getCustomerName()); entryEntity.setCustomerCode(o.getCustomerCode()); - }else{ - throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"客户信息不存在!!请维护客户数据!!!"); + } else { + throw new ServiceException(o.getCustomerName() + o.getCustomerCode() + "客户信息不存在!!请维护客户数据!!!"); } BasicdataWarehouseEntity warehouse = basicdataWarehouseClient.getWarehouse(o.getWarehouse(), o.getWarehouseCode()); - if(Func.isNotEmpty(warehouse)){ + if (Func.isNotEmpty(warehouse)) { entryEntity.setWarehouseId(warehouse.getId());//仓库id entryEntity.setWarehouse(o.getWarehouse());//仓库名称 - }else{ - throw new ServiceException(o.getCustomerName()+o.getCustomerCode()+"仓库信息不存在!!请维护仓库数据!!!"); + } else { + throw new ServiceException(o.getCustomerName() + o.getCustomerCode() + "仓库信息不存在!!请维护仓库数据!!!"); } entryEntity.setLogisticsCompany(Optional.ofNullable(o.getLogisticsCompany()).orElse(null)); entryEntity.setTrainNumber(Optional.ofNullable(o.getTrainNumber()).orElse(null)); //仓库名称 @@ -451,7 +447,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl> distriType = dictBizClient.getList("distribution_type"); - if(ObjectUtils.isNotNull(distriType)){ + if (ObjectUtils.isNotNull(distriType)) { List data1 = distriType.getData(); // data1.forEach( a ->{ // if(o.getServiceType().equals(a.getDictValue())){ @@ -469,15 +465,15 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl{ + collect.forEach((k, v) -> { // System.out.println(">>>>>>>>>>>+++++"+k+v); WarehouseWarehousingEntryEntity entryEntity = JSON.parseObject(k, WarehouseWarehousingEntryEntity.class); // WarehouseWarehousingEntryEntity entryEntity = JSONObject.parseObject(JSONObject.toJSONString(k), WarehouseWarehousingEntryEntity.class); this.save(entryEntity); List detailEntityList = new ArrayList<>(); - v.forEach( i ->{ + v.forEach(i -> { WarehouseWarehousingDetailEntity detail = new WarehouseWarehousingDetailEntity(); detail.setConditions("1"); detail.setSku(i.getSku()); @@ -492,28 +488,28 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl a.getProductCode().equals(detail.getProductCode()) && a.getProductName().equals(detail.getProductName()) && a.getSku().equals(detail.getSku())); - if(b){ - detailEntityList.stream().filter(a -> a.getProductCode().equals(detail.getProductCode()) && a.getProductName().equals(detail.getProductName()) && a.getSku().equals(detail.getSku())).forEach( f->f.setCreateInventory(f.getCreateInventory()+detail.getCreateInventory())); - }else{ + if (b) { + detailEntityList.stream().filter(a -> a.getProductCode().equals(detail.getProductCode()) && a.getProductName().equals(detail.getProductName()) && a.getSku().equals(detail.getSku())).forEach(f -> f.setCreateInventory(f.getCreateInventory() + detail.getCreateInventory())); + } else { detailEntityList.add(detail); } - }else{ + } else { detailEntityList.add(detail); } }); @@ -525,13 +521,13 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl exportWarehouseWarehousing(Map paramMap) { // 获取当前登录的仓库信息 BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); - if(ObjectUtils.isNull(myCurrentWarehouse)){ + if (ObjectUtils.isNull(myCurrentWarehouse)) { throw new ServiceException("没有仓库信息!"); } // 用户勾选数据的ids Object ids = paramMap.get("ids"); List idArr = null; - if (null != ids && !ids.toString().isEmpty()){ + if (null != ids && !ids.toString().isEmpty()) { idArr = Arrays.asList(paramMap.get("ids").toString().split(",")); } @@ -539,9 +535,9 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl list = baseMapper.exportWarehouseWarehousing(paramMap, idArr); List listExcel = new ArrayList<>(); - list.forEach(s->{ + list.forEach(s -> { WarehouseWarehousingEntryExcel excel = new WarehouseWarehousingEntryExcel(); - switch (s.getConditions()){ + switch (s.getConditions()) { case "1": s.setConditions("待确定"); break; @@ -552,7 +548,7 @@ public class WarehouseWarehousingEntryServiceImpl extends BaseServiceImpl