src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -176,19 +176,8 @@ } @Override public List<Map<String, Object>> 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()); public List<Customer> customerList(Customer customer) { return customerMapper.selectList( null); } /** src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -586,17 +586,15 @@ } @Autowired private ReceiptPaymentServiceImpl receiptPaymentService; @Override public Long overdueReceivable() { // 通过开票日期超过15天的未回款提示 ReceiptPaymentDto receiptPaymentDto = new ReceiptPaymentDto(); receiptPaymentDto.setTimeOut(true); receiptPaymentDto.setStatus(false); IPage<ReceiptPaymentDto> receiptPaymentDtoIPage = receiptPaymentService.bindInvoiceNoRegPage(new Page<>(-1, -1), receiptPaymentDto); return receiptPaymentDtoIPage.getTotal(); // 通过登记日期超过15天的未回款提示 LambdaQueryWrapper<SalesLedgerProduct> lambdaWrapper = new LambdaQueryWrapper<>(); // 时间条件:registerDate < 当前时间 - 15天 lambdaWrapper.apply("register_date < DATE_SUB(NOW(), INTERVAL 15 DAY)"); // 未回款条件:pendingInvoiceTotal > 0 lambdaWrapper.gt(SalesLedgerProduct::getPendingInvoiceTotal, 0); return salesLedgerProductMapper.selectCount(lambdaWrapper); } src/main/java/com/ruoyi/production/controller/ProductOrderController.java
@@ -10,6 +10,8 @@ import com.ruoyi.production.pojo.ProcessRoute; import com.ruoyi.production.pojo.ProductOrder; import com.ruoyi.production.service.ProductOrderService; import com.ruoyi.sales.pojo.SalesLedgerProduct; import com.ruoyi.sales.service.impl.SalesLedgerProductServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +28,16 @@ @Autowired private ProductOrderService productOrderService; @Autowired private SalesLedgerProductServiceImpl salesLedgerProductService; @PostMapping("/add") @ApiOperation("添加生产订单") public R add(@RequestBody SalesLedgerProduct salesLedgerProduct) { salesLedgerProductService.addProductionData(salesLedgerProduct); return R.ok(1); } @ApiOperation("分页查询") @GetMapping("page") src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
@@ -51,6 +51,21 @@ 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/pojo/SalesLedgerProduct.java
@@ -104,7 +104,7 @@ private String invoiceType; /** * 台账类型 1.销售 2,采购 * 台账类型 1.销售 2,采购 3: 生产订单 */ private Integer type; 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,14 @@ 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,8 @@ import com.ruoyi.sales.pojo.SalesQuotation; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import java.math.BigDecimal; public interface SalesQuotationService extends IService<SalesQuotation> { IPage listPage(Page page, SalesQuotationDto salesQuotationDto); @@ -14,4 +16,7 @@ boolean delete(Long id); boolean edit(SalesQuotationDto salesQuotationDto); BigDecimal detail(String type, String productName, String specification); } src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.utils.OrderUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.production.mapper.*; import com.ruoyi.production.pojo.*; @@ -32,6 +34,7 @@ import java.lang.reflect.Field; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.function.Function; @@ -260,11 +263,18 @@ /** * 新增生产数据 */ @Transactional(rollbackFor = Exception.class) public void addProductionData(SalesLedgerProduct salesLedgerProduct) { // 因为生产需求改动,需要额外给sales_ledger_product新增数据,type:3 salesLedgerProduct.setType(3); salesLedgerProduct.setRegister(SecurityUtils.getLoginUser().getNickName()); salesLedgerProduct.setRegisterDate(LocalDateTime.now()); salesLedgerProductMapper.insert(salesLedgerProduct); ProductOrder productOrder = new ProductOrder(); productOrder.setSalesLedgerId(salesLedgerProduct.getSalesLedgerId()); productOrder.setProductModelId(salesLedgerProduct.getId()); productOrder.setNpsNo("SC" + String.format("%08d", salesLedgerProduct.getId())); productOrder.setNpsNo(OrderUtils.countTodayByCreateTime(productOrderMapper, "SC")); productOrder.setQuantity(salesLedgerProduct.getQuantity());//需求数量 productOrder.setCompleteQuantity(BigDecimal.ZERO);//完成数量 productOrderMapper.insert(productOrder); @@ -422,9 +432,9 @@ salesLedgerProductDtoIPage.getRecords().forEach(item -> { // 判断状态 if(item.getTaxInclusiveTotalPrice().compareTo(item.getInvoiceTotal()) == 0){ item.setStatusName("已完成付款"); item.setStatusName("已完成回款"); }else{ item.setStatusName("未完成付款"); item.setStatusName("未完成回款"); } }); return salesLedgerProductDtoIPage; src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -695,13 +695,14 @@ // 执行插入操作 if (!insertList.isEmpty()) { for (SalesLedgerProduct salesLedgerProduct : insertList) { salesLedgerProduct.setRegisterDate(LocalDateTime.now()); salesLedgerProduct.setType(type); salesLedgerProduct.setNoInvoiceNum(salesLedgerProduct.getQuantity()); salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice()); salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); salesLedgerProductMapper.insert(salesLedgerProduct); // 添加生产数据 salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); // salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); } } } src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -13,6 +13,7 @@ import com.ruoyi.approve.vo.ApproveProcessVO; import com.ruoyi.common.utils.OrderUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.framework.security.LoginUser; @@ -28,6 +29,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDate; import java.util.List; import java.util.stream.Collectors; @@ -59,7 +61,7 @@ @Override public boolean add(SalesQuotationDto salesQuotationDto) { LoginUser loginUser = SecurityUtils.getLoginUser(); // LoginUser loginUser = SecurityUtils.getLoginUser(); SalesQuotation salesQuotation = new SalesQuotation(); BeanUtils.copyProperties(salesQuotationDto, salesQuotation); String quotationNo = OrderUtils.countTodayByCreateTime(salesQuotationMapper, "QT"); @@ -77,20 +79,20 @@ }).collect(Collectors.toList()); salesQuotationProductService.saveBatch(products); // 报价审批 ApproveProcessVO approveProcessVO = new ApproveProcessVO(); approveProcessVO.setApproveType(6); approveProcessVO.setApproveDeptId(loginUser.getTenantId()); approveProcessVO.setApproveReason(quotationNo); approveProcessVO.setApproveUserIds(salesQuotationDto.getApproveUserIds()); approveProcessVO.setApproveUser(loginUser.getUserId()); approveProcessVO.setApproveTime(LocalDate.now().toString()); approveProcessVO.setPrice(salesQuotationDto.getTotalAmount()); try { approveProcessService.addApprove(approveProcessVO); }catch (Exception e){ log.error("SalesQuotationServiceImpl error:{}", e); throw new RuntimeException("审批失败"); } // ApproveProcessVO approveProcessVO = new ApproveProcessVO(); // approveProcessVO.setApproveType(6); // approveProcessVO.setApproveDeptId(loginUser.getTenantId()); // approveProcessVO.setApproveReason(quotationNo); // approveProcessVO.setApproveUserIds(salesQuotationDto.getApproveUserIds()); // approveProcessVO.setApproveUser(loginUser.getUserId()); // approveProcessVO.setApproveTime(LocalDate.now().toString()); // approveProcessVO.setPrice(salesQuotationDto.getTotalAmount()); // try { // approveProcessService.addApprove(approveProcessVO); // }catch (Exception e){ // log.error("SalesQuotationServiceImpl error:{}", e); // throw new RuntimeException("审批失败"); // } return true; } @Override @@ -117,13 +119,31 @@ }).collect(Collectors.toList()); salesQuotationProductService.saveBatch(products); // 修改报价审批 vo.setApproveUserIds(salesQuotationDto.getApproveUserIds()); vo.setApproveType(6); vo.setApproveReason(salesQuotationDto.getQuotationNo()); approveProcessService.updateApproveUser(vo); // // 修改报价审批 // vo.setApproveUserIds(salesQuotationDto.getApproveUserIds()); // vo.setApproveType(6); // vo.setApproveReason(salesQuotationDto.getQuotationNo()); // approveProcessService.updateApproveUser(vo); return true; } @Override public BigDecimal detail(String type, String productName, String specification) { if(StringUtils.isEmpty(type)) return null; 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); src/main/resources/application-hsxny.yml
@@ -62,7 +62,7 @@ druid: # 主库数据源 master: url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-hsxny?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://172.17.0.1:3306/product-inventory-management-hsxnynew?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: xd@123456.. # 从库数据源