| | |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | List<PurchaseTemplate> resultList = result.getList(); |
| | | Map<String, List<PurchaseTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(PurchaseTemplate::getPoCode)); |
| | | Map<String, List<PurchaseTemplate>> listMap = resultList.stream().collect(Collectors.groupingBy(item -> |
| | | !Objects.isNull(item.getPoCode()) ? item.getPoCode() : SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_ORDER_PO_CODE, null) |
| | | )); |
| | | for (String key : listMap.keySet()) { |
| | | List<PurchaseTemplate> list = listMap.get(key); |
| | | Purchase serviceOne = purchaseService.getOne(new LambdaQueryWrapper<Purchase>().eq(Purchase::getCode, key)); |
| | | if (!Objects.isNull(serviceOne)) { |
| | | // return R.error(serviceOne.getCode() + "单据已存在!!"); |
| | | throw new CoolException(serviceOne.getCode() + "单据已存在!!"); |
| | | } |
| | | PurchaseTemplate template = list.stream().findFirst().get(); |
| | | Purchase purchase = new Purchase(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date = dateFormat.parse(template.getArrTime()); |
| | | Date date = template.getArrTime(); |
| | | BeanUtils.copyProperties(template, purchase); |
| | | purchase.setCode(template.getPoCode()); |
| | | if (StringUtils.isBlank(template.getPoCode())) { |
| | |
| | | throw new CoolException("供应商:" + template.getSplrName() + "不存在!!"); |
| | | } |
| | | } else { |
| | | throw new CoolException("供应商不能为空!!"); |
| | | throw new CoolException("供应商编码不能为空!!"); |
| | | } |
| | | if (!this.save(item)) { |
| | | throw new CoolException("单据明细保存失败!!"); |