| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.procurementrecord.mapper.ReturnManagementMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnManagement; |
| | | import com.ruoyi.procurementrecord.service.ReturnManagementService; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | |
| | | private final CommonFileServiceImpl commonFileService; |
| | | |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | private final ReturnManagementMapper returnManagementMapper; |
| | | |
| | | private final ReturnManagementService returnManagementService; |
| | | |
| | | private final InvoiceLedgerMapper invoiceLedgerMapper; |
| | | |
| | |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getSalesLedgerId, idList)); |
| | | if (CollectionUtils.isNotEmpty(shippingInfos)) { |
| | | shippingInfoServiceImpl.delete(shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList())); |
| | | List<Long> shippingIds = shippingInfos.stream().map(ShippingInfo::getId).collect(Collectors.toList()); |
| | | shippingInfoServiceImpl.delete(shippingIds); |
| | | // 删除退货台账记录 |
| | | List<ReturnManagement> returnManagements = returnManagementMapper.selectList(new LambdaQueryWrapper<ReturnManagement>() |
| | | .in(ReturnManagement::getShippingId, shippingIds)); |
| | | if (CollectionUtils.isNotEmpty(returnManagements)) { |
| | | List<Long> returnIds = returnManagements.stream().map(ReturnManagement::getId).collect(Collectors.toList()); |
| | | returnManagementService.delete(returnIds); |
| | | } |
| | | } |
| | | |
| | | // 删除附件表 |
| | | commonFileService.deleteByBusinessIds(idList, FileNameType.SALE.getValue()); |
| | | |
| | |
| | | // 3. 新增或更新主表 |
| | | if (salesLedger.getId() == null) { |
| | | String contractNo = generateSalesContractNo(); |
| | | salesLedger.setSalesContractNo(contractNo); |
| | | salesLedger.setSalesContractNo(salesLedgerDto.getSalesContractNo() == null ? contractNo : salesLedgerDto.getSalesContractNo()); |
| | | salesLedgerMapper.insert(salesLedger); |
| | | } else { |
| | | if(StringUtils.isNotEmpty(salesLedgerDto.getSalesContractNo())){ |
| | | salesLedger.setSalesContractNo(salesLedgerDto.getSalesContractNo()); |
| | | } |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | } |
| | | |