| | |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.common.enums.IsDeleteEnum; |
| | | import com.ruoyi.common.utils.AmountUtils; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | |
| | | return salesQuotationDtoIPage; |
| | | } |
| | | salesQuotationDtoIPage.getRecords().forEach(record -> { |
| | | record.setTotalAmount(AmountUtils.scaleAmount(record.getTotalAmount())); |
| | | List<SalesQuotationProduct> products = salesQuotationProductMapper.selectBySalesQuotationId(record.getId()); |
| | | if (!CollectionUtils.isEmpty(products)) { |
| | | products.forEach(product -> { |
| | | product.setUnitPrice(AmountUtils.scaleAmount(product.getUnitPrice())); |
| | | product.setAmount(AmountUtils.scaleAmount(product.getAmount())); |
| | | }); |
| | | } |
| | | record.setProducts(products); |
| | | }); |
| | | return salesQuotationDtoIPage; |
| | | } |
| | | |
| | | private void normalizeAmounts(SalesQuotationDto salesQuotationDto) { |
| | | salesQuotationDto.setTotalAmount(AmountUtils.scaleAmount(salesQuotationDto.getTotalAmount())); |
| | | if (CollectionUtils.isEmpty(salesQuotationDto.getProducts())) { |
| | | return; |
| | | } |
| | | salesQuotationDto.getProducts().forEach(product -> { |
| | | product.setUnitPrice(AmountUtils.scaleAmount(product.getUnitPrice())); |
| | | product.setAmount(AmountUtils.scaleAmount(product.getAmount())); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public boolean add(SalesQuotationDto salesQuotationDto) { |
| | | normalizeAmounts(salesQuotationDto); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SalesQuotation salesQuotation = new SalesQuotation(); |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | |
| | | } |
| | | @Override |
| | | public boolean edit(SalesQuotationDto salesQuotationDto) { |
| | | normalizeAmounts(salesQuotationDto); |
| | | SalesQuotation salesQuotation = new SalesQuotation(); |
| | | BeanUtils.copyProperties(salesQuotationDto, salesQuotation); |
| | | ApproveGetAndUpdateVo vo = new ApproveGetAndUpdateVo(); |