src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -35,7 +35,7 @@ /** * 纳税人识别号 */ @Excel(name = "纳税人识别号") // @Excel(name = "纳税人识别号") private String taxpayerIdentificationNumber; /** @@ -47,19 +47,19 @@ /** * 公司电话 */ @Excel(name = "公司电话") // @Excel(name = "公司电话") private String companyPhone; /** * 联系人 */ @Excel(name = "联系人") // @Excel(name = "联系人") private String contactPerson; /** * 联系电话 */ @Excel(name = "联系电话") // @Excel(name = "联系电话") private String contactPhone; /** @@ -85,14 +85,20 @@ private String addressPhone; @ApiModelProperty(value = "银行基本户") @Excel(name = "银行基本户") // @Excel(name = "银行基本户") private String basicBankAccount; @ApiModelProperty(value = "银行账号") @Excel(name = "银行账号") // @Excel(name = "银行账号") private String bankAccount; @ApiModelProperty(value = "开户行号") @Excel(name = "开户行号") // @Excel(name = "开户行号") private String bankCode; @Excel(name = "客户类型") private String type; } src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -172,19 +172,10 @@ } @Override public List<Map<String, Object>> customerList(Customer customer) { public List<Customer> customerList(Customer customer) { LambdaQueryWrapper<Customer> queryWrapper = Wrappers.lambdaQuery(); queryWrapper.select(Customer::getId, Customer::getCustomerName, Customer::getTaxpayerIdentificationNumber); // 获取原始查询结果 List<Map<String, Object>> result = customerMapper.selectMaps(queryWrapper); // 将下划线命名转换为驼峰命名 return result.stream().map(map -> map.entrySet().stream() .collect(Collectors.toMap( entry -> underlineToCamel(entry.getKey()), Map.Entry::getValue)) ).collect(Collectors.toList()); queryWrapper.select(Customer::getId, Customer::getCustomerName, Customer::getTaxpayerIdentificationNumber,Customer::getType); return customerMapper.selectList(queryWrapper); } /** src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
@@ -1,6 +1,7 @@ package com.ruoyi.sales.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.poi.ExcelUtil; @@ -40,8 +41,11 @@ * @return */ @PostMapping("/saveOrUpdate") public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody ReceiptPayment receiptPayment) { receiptPaymentService.receiptPaymentSaveOrUpdate(receiptPayment); public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) { if(CollectionUtils.isEmpty(receiptPayment)) return AjaxResult.success("回款数据不可为空"); for (ReceiptPayment payment : receiptPayment) { receiptPaymentService.receiptPaymentSaveOrUpdate(payment); } return AjaxResult.success(); } src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
@@ -1,23 +1,16 @@ package com.ruoyi.sales.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.aftersalesservice.dto.AfterSalesServiceDto; import com.ruoyi.aftersalesservice.pojo.AfterSalesService; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.domain.AjaxResult; import com.ruoyi.sales.dto.SalesQuotationDto; import com.ruoyi.sales.service.SalesQuotationService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/sales/quotation") @@ -47,6 +40,22 @@ public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) { return AjaxResult.success(salesQuotationService.edit(salesQuotationDto)); } /** * 详情 * @param type 客户类型 * @param productName 产品名称 * @param specification 规格 * @return */ @ApiOperation("详情") @GetMapping("/detail") public AjaxResult detail(@RequestParam("type") String type, @RequestParam("productName")String productName, @RequestParam("specification")String specification) { return AjaxResult.success(salesQuotationService.detail(type, productName, specification)); } @DeleteMapping("/delete") public AjaxResult delete(@RequestBody Long id) { return AjaxResult.success(salesQuotationService.delete(id)); src/main/java/com/ruoyi/sales/mapper/SalesQuotationMapper.java
@@ -2,9 +2,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.sales.dto.SalesQuotationDto; import com.ruoyi.sales.pojo.SalesQuotation; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.springframework.data.repository.query.Param; src/main/java/com/ruoyi/sales/pojo/SalesQuotationProduct.java
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; @Data @@ -21,8 +22,15 @@ private String specification; @ApiModelProperty(value = "单位") private String unit; @ApiModelProperty(value = "一批商单价") private BigDecimal unitPrice; @ApiModelProperty(value = "终端商单价") private BigDecimal unitPriceTwo; @ApiModelProperty(value = "单价") private Double unitPrice; private BigDecimal unitPriceThree; @ApiModelProperty(value = "数量") private Integer quantity; @ApiModelProperty(value = "金额") src/main/java/com/ruoyi/sales/service/SalesQuotationService.java
@@ -6,6 +6,9 @@ import com.ruoyi.sales.pojo.SalesQuotation; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.math.BigDecimal; import java.util.List; public interface SalesQuotationService extends IService<SalesQuotation> { IPage listPage(Page page, SalesQuotationDto salesQuotationDto); @@ -14,4 +17,6 @@ boolean delete(Long id); boolean edit(SalesQuotationDto salesQuotationDto); BigDecimal detail(String type, String productName, String specification); } src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -162,7 +162,9 @@ public IPage<ReceiptPaymentDto> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) { IPage<ReceiptPaymentDto> receiptPaymentDtoIPage = receiptPaymentMapper.bindInvoiceNoRegPage(page, receiptPaymentDto); if (receiptPaymentDto.getStatus()) { long count = receiptPaymentDtoIPage.getRecords().stream().filter(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getNoReceiptAmount())).count(); receiptPaymentDtoIPage.getRecords().removeIf(receiptPaymentDto1 -> new BigDecimal("0.00").equals(receiptPaymentDto1.getNoReceiptAmount())); receiptPaymentDtoIPage.setTotal(receiptPaymentDtoIPage.getTotal() - count); } receiptPaymentDtoIPage.getRecords().forEach(item -> { // 比较回款金额 == 待回款金额 src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; import com.ruoyi.approve.vo.ApproveGetAndUpdateVo; import com.ruoyi.approve.vo.ApproveProcessVO; import com.ruoyi.common.utils.OrderUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.framework.security.LoginUser; import com.ruoyi.sales.dto.SalesQuotationDto; import com.ruoyi.sales.mapper.SalesQuotationMapper; import com.ruoyi.sales.mapper.SalesQuotationProductMapper; @@ -15,10 +21,12 @@ import com.ruoyi.sales.service.SalesQuotationProductService; import com.ruoyi.sales.service.SalesQuotationService; import org.springframework.beans.factory.annotation.Autowired; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -48,18 +56,17 @@ public boolean add(SalesQuotationDto salesQuotationDto) { SalesQuotation salesQuotation = new SalesQuotation(); BeanUtils.copyProperties(salesQuotationDto, salesQuotation); String quotationNo = salesQuotation.getQuotationNo(); String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT"); salesQuotation.setQuotationNo(quotationNo); salesQuotation.setStatus("待审批"); salesQuotationMapper.insert(salesQuotation); // if(salesQuotationMapper.insert(salesQuotation)!=1){ // return false; // } if(CollectionUtils.isEmpty(salesQuotationDto.getProducts())){ return true; } List<SalesQuotationProduct> products = salesQuotationDto.getProducts().stream().map(product -> { SalesQuotationProduct salesQuotationProduct = new SalesQuotationProduct(); BeanUtils.copyProperties(product, salesQuotationProduct); salesQuotationProduct.setSalesQuotationId(salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>().eq(SalesQuotation::getQuotationNo, quotationNo)).getId()); salesQuotationProduct.setSalesQuotationId(salesQuotation.getId()); return salesQuotationProduct; }).collect(Collectors.toList()); salesQuotationProductService.saveBatch(products); @@ -69,6 +76,11 @@ public boolean edit(SalesQuotationDto salesQuotationDto) { SalesQuotation salesQuotation = new SalesQuotation(); BeanUtils.copyProperties(salesQuotationDto, salesQuotation); ApproveGetAndUpdateVo vo = new ApproveGetAndUpdateVo(); if("拒绝".equals(salesQuotationDto.getStatus())){ vo.setApproveStatus(0); salesQuotation.setStatus("待审批"); } if(salesQuotationMapper.updateById(salesQuotation)!=1){ return false; } @@ -85,6 +97,24 @@ salesQuotationProductService.saveBatch(products); return true; } @Override public BigDecimal detail(String type, String productName, String specification) { SalesQuotationProduct salesQuotationProduct = salesQuotationProductMapper.selectOne(new LambdaQueryWrapper<SalesQuotationProduct>() .eq(SalesQuotationProduct::getProduct, productName) .eq(SalesQuotationProduct::getSpecification, specification) .last("limit 1")); if(salesQuotationProduct==null) return null; switch (type){ case "一批商": return salesQuotationProduct.getUnitPrice(); case "终端商": return salesQuotationProduct.getUnitPriceTwo(); default: return salesQuotationProduct.getUnitPriceThree(); } } @Override public boolean delete(Long id) { salesQuotationMapper.deleteById(id);