| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.mapper.ProductRecordMapper; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.purchase.service.IProductRecordService; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private CommonFileMapper commonFileMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | @Autowired |
| | | private PurchaseLedgerMapper purchaseLedgerMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | }); |
| | | return productRecordDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateRecord(ProductRecordDto productRecordDto) { |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecordDto.getSaleLedgerProjectId()); |
| | | ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId()); |
| | | if (salesLedgerProduct != null) { |
| | | salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount()).subtract(productRecordDto.getTicketsAmount())); |
| | | salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum().subtract(productRecordDto.getTicketsNum()))); |
| | | salesLedgerProductMapper.updateById(salesLedgerProduct); |
| | | |
| | | } |
| | | PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(productRecord.getPurchaseLedgerId()); |
| | | if (purchaseLedger != null) { |
| | | purchaseLedger.setReceiptPaymentAmount(purchaseLedger.getReceiptPaymentAmount()); |
| | | } |
| | | BeanUtils.copyProperties(productRecordDto,productRecord); |
| | | productRecordMapper.updateById(productRecord); |
| | | |
| | | return AjaxResult.success("修改成功"); |
| | | } |
| | | |
| | | @Override |
| | | public ProductRecordDto getProductRecordById(Long id) { |
| | | ProductRecordDto productRecordDto = productRecordMapper.getProductRecordById(id); |
| | | return productRecordDto; |
| | | } |
| | | } |