| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationProductMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private CommonFileMapper fileMapper; |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | @Autowired |
| | | private SalesQuotationMapper salesQuotationMapper; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | deviceRepairMapper.updateById(deviceRepair); |
| | | } |
| | | // 销售报价状态修改 |
| | | if(approveProcess.getApproveType().equals(6)){ |
| | | SalesQuotation salesQuote = salesQuotationMapper.selectOne(new LambdaQueryWrapper<SalesQuotation>() |
| | | .eq(SalesQuotation::getQuotationNo, approveProcess.getApproveReason()) |
| | | .last("limit 1")); |
| | | // 同意 |
| | | if(status.equals(2) && salesQuote != null){ |
| | | salesQuote.setStatus("通过"); |
| | | }else if(status.equals(3) && salesQuote != null){ |
| | | salesQuote.setStatus("拒绝"); |
| | | }else if(status.equals(1) && salesQuote != null){ |
| | | salesQuote.setStatus("审核中"); |
| | | } |
| | | |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | // 绑定附件 |
| | | if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){ |
| | | tempFileService.migrateTempFilesToFormal(approveNode.getId(), approveNode.getTempFileIds(), FileNameType.ApproveNode.getValue()); |
| | |
| | | approveProcess.setApproveReason(approveProcessVO.getApproveReason()); |
| | | approveProcess.setDeviceRepairId(approveProcessVO.getDeviceRepairId()); |
| | | approveProcess.setMaintenancePrice(approveProcessVO.getMaintenancePrice()); |
| | | approveProcess.setPrice(approveProcessVO.getPrice()); |
| | | approveProcess.setApproveOverTime(null); |
| | | approveProcess.setApproveStatus(0); |
| | | approveProcess.setApproveDelete(0); |
| | |
| | | |
| | | private final ApproveNodeMapper approveNodeMapper; |
| | | |
| | | // 报价审批编辑审核人 |
| | | public void updateApproveUser(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveType, approveGetAndUpdateVo.getApproveType()) |
| | | .eq(ApproveProcess::getApproveReason, approveGetAndUpdateVo.getApproveReason()) |
| | | .last("limit 1"); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectOne(approveProcessLambdaQueryWrapper); |
| | | if(approveProcess == null) throw new RuntimeException("请选择审批人"); |
| | | String[] split = approveGetAndUpdateVo.getApproveUserIds().split(","); |
| | | if(split.length == 0){ |
| | | throw new RuntimeException("请选择审批人"); |
| | | } |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(Arrays.asList(split).stream().map(Long::parseLong).collect(Collectors.toList())); |
| | | if(CollectionUtils.isEmpty(sysUsers)) throw new RuntimeException("请选择审批人"); |
| | | //审核中不可以编辑审核人 |
| | | if(approveProcess.getApproveStatus() != 1){ |
| | | approveProcess.setApproveUserCurrentId(Long.parseLong(split[0])); |
| | | approveProcess.setApproveUserCurrentName(sysUsers.stream().filter(user -> user.getUserId().equals(Long.parseLong(split[0]))).collect(Collectors.toList()).get(0).getNickName()); |
| | | } |
| | | if(approveGetAndUpdateVo.getApproveStatus() != null){ |
| | | approveProcess.setApproveStatus(approveGetAndUpdateVo.getApproveStatus()); |
| | | } |
| | | approveProcess.setApproveUserIds(approveGetAndUpdateVo.getApproveUserIds()); |
| | | updateById(approveProcess); |
| | | //修改审批人 |
| | | // 先删除 后新增 |
| | | LambdaQueryWrapper<ApproveNode> approveNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveNodeLambdaQueryWrapper.eq(ApproveNode::getApproveProcessId, approveProcess.getApproveId()) |
| | | .eq(ApproveNode::getDeleteFlag, 0) |
| | | .eq(ApproveNode::getTenantId, SecurityUtils.getLoginUser().getTenantId()) |
| | | .orderByAsc(ApproveNode::getApproveNodeOrder); |
| | | approveNodeMapper.delete(approveNodeLambdaQueryWrapper); |
| | | approveNodeService.initApproveNodes(approveGetAndUpdateVo.getApproveUserIds(),approveProcess.getApproveId(),approveProcess.getTenantId()); |
| | | /*消息通知*/ |
| | | String id = approveProcess.getApproveUserIds().split(",")[0]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveProcess.getApproveId()+"流程编号的审批需要您审核!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveProcess.getApproveDeptId(), |
| | | "/collaborativeApproval/approvalProcess?approveType="+approveProcess.getApproveType()+"&approveId="+approveProcess.getApproveId()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateByApproveId(ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.utils.uuid.UUID; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | // 执行查询 |
| | | Long aLong = mapper.selectCount(queryWrapper); |
| | | // 拼接订单编号 preFix + 时间(yyyyMMdd) + 订单数量(001) |
| | | return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)); |
| | | return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)) + "-" + new Date().getTime(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 供应商往来分页接口 |
| | | */ |
| | | @GetMapping("/supplierNameListPage") |
| | | public AjaxResult supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){ |
| | | return success(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 供应商往来分页接口 |
| | | */ |
| | | @GetMapping("/supplierNameListPageDetails") |
| | | public AjaxResult supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){ |
| | | return success(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 获取本月应付信息 |
| | | */ |
| | | @GetMapping(value = "/paymentMonthList") |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.purchase.dto.PaymentHistoryRecordVo; |
| | | import com.ruoyi.purchase.dto.PaymentLedgerDto; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @return 付款登记集合 |
| | | */ |
| | | IPage<PaymentRegistrationDto> paymentHistoryListPage(Page page, @Param("params") PaymentRegistrationDto paymentRegistrationDto); |
| | | |
| | | IPage<PaymentRegistrationDto> supplierNameListPage(Page page,@Param("req") PaymentLedgerDto paymentLedgerDto); |
| | | |
| | | List<PaymentRegistrationDto> supplierNameListPageDetails(@Param("req") PaymentLedgerDto paymentLedgerDto); |
| | | } |
| | |
| | | Boolean delete(Long[] ids); |
| | | |
| | | int delPaymentRegistration(Long ids); |
| | | |
| | | IPage<PaymentRegistrationDto> supplierNameListPage(Page page, PaymentLedgerDto paymentLedgerDto); |
| | | |
| | | List<PaymentRegistrationDto> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto); |
| | | } |
| | |
| | | return paymentRegistrationMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<PaymentRegistrationDto> supplierNameListPage(Page page, PaymentLedgerDto paymentLedgerDto) { |
| | | return paymentRegistrationMapper.supplierNameListPage(page, paymentLedgerDto); |
| | | } |
| | | |
| | | @Override |
| | | public List<PaymentRegistrationDto> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto) { |
| | | return paymentRegistrationMapper.supplierNameListPageDetails(paymentLedgerDto); |
| | | } |
| | | |
| | | // 批量查询采购台账(当月) |
| | | private Map<Long, List<PurchaseLedger>> batchQueryPurchaseLedgers(List<Long> supplierIds, LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<PurchaseLedger> query = new LambdaQueryWrapper<>(); |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseDto; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentRecordDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/customerInteractions") |
| | | public AjaxResult customerInteractions (ReceiptPaymentDto receiptPaymentDto) { |
| | | public AjaxResult customerInteractions (InvoiceLedgerDto receiptPaymentDto) { |
| | | return AjaxResult.success(receiptPaymentService.customerInteractions(receiptPaymentDto)); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesServiceDto; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | 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.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.service.SalesQuotationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | |
| | | /** 应收金额 */ |
| | | private BigDecimal unReceiptAmount; |
| | | |
| | | /** 销售合同号 */ |
| | | private String salesContractNo; |
| | | |
| | | /** 采购合同号 */ |
| | | private String purchaseContractNo; |
| | | |
| | | /** 发生日期 */ |
| | | private LocalDate happenTime; |
| | | |
| | |
| | | package com.ruoyi.sales.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.vo.FileVo; |
| | | import com.ruoyi.sales.pojo.InvoiceLedger; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | @ApiModelProperty(value = "客户名称") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty(value = "客户ID") |
| | | private Integer customerId; |
| | | |
| | | @ApiModelProperty(value = "客户合同号") |
| | | private String customerContractNo; |
| | | |
| | |
| | | @ApiModelProperty(value = "回款金额") |
| | | private BigDecimal receiptPaymentAmount; |
| | | |
| | | @ApiModelProperty(value = "回款日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date receiptPaymentDate; |
| | | |
| | | @ApiModelProperty(value = "未回款金额") |
| | | private BigDecimal unReceiptPaymentAmount; |
| | | |
| | |
| | | public class SalesQuotationDto extends SalesQuotation { |
| | | @ApiModelProperty(value = "报价商品") |
| | | private List<SalesQuotationProduct> products; |
| | | |
| | | /** |
| | | * 审批人id列表 |
| | | */ |
| | | // 审批人 |
| | | private String approveUserIds; |
| | | } |
| | |
| | | List<CustomerInteractionDto> customerInteractions (ReceiptPaymentDto receiptPaymentDto); |
| | | |
| | | /** |
| | | * 客户回款记录查询 |
| | | * @param invoiceLedgerDto |
| | | * @return |
| | | */ |
| | | List<InvoiceLedgerDto> invoiceLedgerSalesAccount(@Param("invoiceLedgerDto") InvoiceLedgerDto invoiceLedgerDto); |
| | | |
| | | /** |
| | | * 查询回款记录不分页 |
| | | */ |
| | | List<ReceiptPaymentDto> receiptPaymentHistoryListNoPage( @Param("params") ReceiptPaymentDto receiptPaymentDto); |
| | |
| | | private BigDecimal pendingInvoiceTotal; |
| | | |
| | | @ApiModelProperty(value = "回款总金额") |
| | | private BigDecimal invoiceTotal; |
| | | private BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | | |
| | | @ApiModelProperty(value = "待付款总金额") |
| | | private BigDecimal pendingTicketsTotal; |
| | | |
| | | @ApiModelProperty(value = "付款总金额") |
| | | private BigDecimal ticketsTotal; |
| | | private BigDecimal ticketsTotal = BigDecimal.ZERO; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | private String status; |
| | | @ApiModelProperty(value = "报价总金额") |
| | | @Excel(name = "报价金额") |
| | | private Double totalAmount; |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remark; |
| | |
| | | * @param receiptPaymentDto |
| | | * @return |
| | | */ |
| | | List<CustomerInteractionDto> customerInteractions (ReceiptPaymentDto receiptPaymentDto); |
| | | List<InvoiceLedgerDto> customerInteractions (InvoiceLedgerDto receiptPaymentDto); |
| | | |
| | | /** |
| | | * 查询回款记录分页 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<CustomerInteractionDto> customerInteractions(ReceiptPaymentDto receiptPaymentDto) { |
| | | ArrayList<CustomerInteractionDto> result = new ArrayList<>(); |
| | | List<CustomerInteractionDto> customerInteractionDtos = receiptPaymentMapper.customerInteractions(receiptPaymentDto); |
| | | if(CollectionUtils.isEmpty(customerInteractionDtos)){ |
| | | return result; |
| | | } |
| | | // 应收总金额金额计算 |
| | | BigDecimal amountTotal = BigDecimal.ZERO; |
| | | Map<LocalDate, List<CustomerInteractionDto>> dateListMap = customerInteractionDtos.stream().collect( |
| | | Collectors.groupingBy( |
| | | CustomerInteractionDto::getHappenTime, |
| | | LinkedHashMap::new, |
| | | Collectors.toList() |
| | | ) |
| | | ); |
| | | for (LocalDate localDate : dateListMap.keySet()) { |
| | | BigDecimal currentReceiptAmount = BigDecimal.ZERO; |
| | | BigDecimal invoiceAmount = BigDecimal.ZERO; |
| | | BigDecimal currentDateTotal = BigDecimal.ZERO; |
| | | List<CustomerInteractionDto> customerInteractionDtoList = dateListMap.get(localDate); |
| | | // 计算当天收款数 |
| | | currentReceiptAmount = customerInteractionDtoList.stream() |
| | | .filter(item ->item.getType() == 0) |
| | | .map(CustomerInteractionDto::getReceiptAmount) |
| | | .reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | // 计算当天开票数 |
| | | invoiceAmount = customerInteractionDtoList.stream() |
| | | .filter(item ->item.getType() == 1) |
| | | .map(CustomerInteractionDto::getInvoiceAmount) |
| | | .reduce(BigDecimal.ZERO,BigDecimal::add); |
| | | // 计算当日汇总 |
| | | currentDateTotal = currentDateTotal.add(invoiceAmount).subtract(currentReceiptAmount); |
| | | CustomerInteractionDto customerInteractionDto = new CustomerInteractionDto(); |
| | | customerInteractionDto.setHappenTime(localDate); |
| | | customerInteractionDto.setInvoiceAmount(invoiceAmount); |
| | | customerInteractionDto.setReceiptAmount(currentReceiptAmount); |
| | | amountTotal = customerInteractionDto.getInvoiceAmount().subtract(customerInteractionDto.getReceiptAmount()); |
| | | customerInteractionDto.setUnReceiptAmount(amountTotal); |
| | | result.add(customerInteractionDto); |
| | | } |
| | | ArrayList<CustomerInteractionDto> newResult = new ArrayList<>(); |
| | | for (int i = 0; i < result.size(); i++) { |
| | | CustomerInteractionDto customerInteractionDto = result.get(i); |
| | | if (i == 0) { |
| | | customerInteractionDto.setUnReceiptAmount(customerInteractionDto.getInvoiceAmount().subtract(customerInteractionDto.getReceiptAmount())); |
| | | }else { |
| | | CustomerInteractionDto customerInteractionDto1 = result.get(i-1); |
| | | customerInteractionDto.setUnReceiptAmount(customerInteractionDto1.getUnReceiptAmount() |
| | | .add(customerInteractionDto.getInvoiceAmount()).subtract(customerInteractionDto.getReceiptAmount())); |
| | | } |
| | | newResult.add(customerInteractionDto); |
| | | } |
| | | return newResult; |
| | | public List<InvoiceLedgerDto> customerInteractions(InvoiceLedgerDto receiptPaymentDto) { |
| | | return receiptPaymentMapper.invoiceLedgerSalesAccount(receiptPaymentDto); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveProcessService; |
| | | 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.common.utils.uuid.UUID; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationProductMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private SalesQuotationProductMapper salesQuotationProductMapper; |
| | | @Autowired |
| | | private SalesQuotationProductService salesQuotationProductService; |
| | | |
| | | @Autowired |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | @Override |
| | | public IPage<SalesQuotationDto> listPage(Page page, SalesQuotationDto salesQuotationDto) { |
| | | IPage<SalesQuotationDto> salesQuotationDtoIPage = salesQuotationMapper.listPage(page, salesQuotationDto); |
| | |
| | | |
| | | @Override |
| | | public boolean add(SalesQuotationDto salesQuotationDto) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | 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); |
| | | // 报价审批 |
| | | 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 |
| | | 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; |
| | | } |
| | |
| | | salesQuotationProduct.setSalesQuotationId(salesQuotation.getId()); |
| | | return salesQuotationProduct; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | salesQuotationProductService.saveBatch(products); |
| | | // 修改报价审批 |
| | | vo.setApproveUserIds(salesQuotationDto.getApproveUserIds()); |
| | | vo.setApproveType(6); |
| | | vo.setApproveReason(salesQuotationDto.getQuotationNo()); |
| | | approveProcessService.updateApproveUser(vo); |
| | | return true; |
| | | } |
| | | @Override |
| | |
| | | </where> |
| | | ORDER BY T1.payment_date,T1.create_time DESC |
| | | </select> |
| | | <select id="supplierNameListPage" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | | T1.supplier_id, |
| | | T1.supplier_name, |
| | | SUM(contract_amount) AS invoiceAmount, |
| | | IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount |
| | | FROM purchase_ledger T1 |
| | | LEFT JOIN payment_registration T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | | <if test="req.supplierName != null and req.supplierName != '' "> |
| | | T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.supplier_name |
| | | </select> |
| | | <select id="supplierNameListPageDetails" resultType="com.ruoyi.purchase.dto.PaymentRegistrationDto"> |
| | | SELECT |
| | | T1.supplier_id, |
| | | T1.supplier_name, |
| | | SUM(contract_amount) AS invoiceAmount, |
| | | IFNULL( SUM(T2.current_payment_amount) , 0 ) AS paymentAmount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.current_payment_amount),0)),0) AS payableAmount, |
| | | T1.purchase_contract_number, |
| | | T2.payment_date |
| | | FROM purchase_ledger T1 |
| | | LEFT JOIN payment_registration T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | | T1.supplier_id = #{req.supplierId} |
| | | <if test="req.supplierName != null and req.supplierName != '' "> |
| | | T1.supplier_name LIKE CONCAT ('%',#{req.supplierName},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.purchase_contract_number,T2.payment_date |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto"> |
| | | SELECT |
| | | T4.id,T4.customer_name , |
| | | SUM(invoice_total) AS invoice_total, |
| | | IFNULL( SUM(T5.receipt_payment_amount) , 0 ) AS receipt_payment_amount, |
| | | IFNULL((IFNULL(SUM(invoice_total),0) - IFNULL(SUM(T5.receipt_payment_amount),0)),0) AS unReceipt_payment_amount |
| | | FROM |
| | | invoice_ledger T1 |
| | | LEFT JOIN invoice_registration_product T2 ON T1.invoice_registration_product_id = T2.id |
| | | LEFT JOIN sales_ledger T3 ON T3.id = T2.sales_ledger_id |
| | | LEFT JOIN customer T4 ON T4.id = T3.customer_id |
| | | LEFT JOIN ( SELECT invoice_ledger_id, SUM( receipt_payment_amount ) AS receipt_payment_amount FROM receipt_payment GROUP BY invoice_ledger_id ) T5 ON T5.invoice_ledger_id = T1.id |
| | | T1.customer_id as id, |
| | | T1.customer_name, |
| | | SUM(contract_amount) AS invoice_total, |
| | | IFNULL( SUM(T2.receipt_payment_amount) , 0 ) AS receipt_payment_amount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount |
| | | FROM sales_ledger T1 |
| | | LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | | <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' "> |
| | | T4.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%') |
| | | T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T4.id,T4.customer_name |
| | | GROUP BY T1.customer_name |
| | | </select> |
| | | |
| | | <select id="invoiceLedgerProductInfo" resultType="com.ruoyi.sales.dto.InvoiceRegistrationProductDto"> |
| | |
| | | </where> |
| | | |
| | | </select> |
| | | <select id="invoiceLedgerSalesAccount" resultType="com.ruoyi.sales.dto.InvoiceLedgerDto"> |
| | | SELECT |
| | | T1.sales_contract_no, |
| | | SUM(contract_amount) AS invoice_total, |
| | | IFNULL( SUM(T2.receipt_payment_amount) , 0 ) AS receipt_payment_amount, |
| | | IFNULL((IFNULL(SUM(contract_amount),0) - IFNULL(SUM(T2.receipt_payment_amount),0)),0) AS unReceipt_payment_amount, |
| | | T2.receipt_payment_date |
| | | FROM sales_ledger T1 |
| | | LEFT JOIN receipt_payment T2 ON T1.id = T2.sales_ledger_id |
| | | <where> |
| | | T1.customer_id = #{invoiceLedgerDto.customerId} |
| | | <if test="invoiceLedgerDto.searchText != null and invoiceLedgerDto.searchText != '' "> |
| | | T1.customer_name LIKE CONCAT ('%',#{invoiceLedgerDto.searchText},'%') |
| | | </if> |
| | | </where> |
| | | GROUP BY T1.sales_contract_no,T2.receipt_payment_date |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.sales.mapper.SalesQuotationMapper"> |
| | | <select id="listPage" resultType="com.ruoyi.sales.dto.SalesQuotationDto"> |
| | | SELECT * FROM sales_quotation |
| | | SELECT t1.*, |
| | | t2.approve_user_ids |
| | | FROM sales_quotation t1 |
| | | LEFT JOIN approve_process t2 ON t1.quotation_no = t2.approve_reason and t2.approve_type = 6 |
| | | WHERE 1=1 |
| | | <if test="salesQuotationDto.quotationNo != null and salesQuotationDto.quotationNo != '' "> |
| | | AND quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%') |
| | | AND t1.quotation_no LIKE CONCAT('%',#{salesQuotationDto.quotationNo},'%') |
| | | </if> |
| | | <if test="salesQuotationDto.customer != null and salesQuotationDto.customer != '' "> |
| | | AND customer = #{salesQuotationDto.customer} |
| | | AND t1.customer = #{salesQuotationDto.customer} |
| | | </if> |
| | | <if test="salesQuotationDto.status != null and salesQuotationDto.status != '' "> |
| | | AND status = #{salesQuotationDto.status} |
| | | AND t1.status = #{salesQuotationDto.status} |
| | | </if> |
| | | </select> |
| | | </mapper> |