| | |
| | | package com.ruoyi.home.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.collaborativeApproval.mapper.NoticeMapper; |
| | |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductWorkOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | | import com.ruoyi.sales.mapper.ReceiptPaymentMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.ReceiptPayment; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.impl.ReceiptPaymentServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private NoticeMapper noticeMapper; |
| | | @Autowired |
| | | private ProductOrderMapper productOrderMapper; |
| | | @Autowired |
| | | private ProductionProductMainMapper productionProductMainMapper; |
| | | @Autowired |
| | | private ProductWorkOrderMapper productWorkOrderMapper; |
| | | |
| | | @Override |
| | | public HomeBusinessDto business() { |
| | |
| | | if(CollectionUtils.isEmpty(approveProcesses)){ |
| | | approveProcesses = new ArrayList<>(); |
| | | } |
| | | // 查询未领用劳保记录 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | LaborIssue laborIssue1 = new LaborIssue(); |
| | | laborIssue1.setAdoptedDate(new Date()); |
| | | laborIssue1.setIssueDate(sdf.parse(sdf.format(new Date()))); |
| | | List<LaborIssue> laborIssues = lavorIssueMapper.list(laborIssue1); |
| | | if(!CollectionUtils.isEmpty(laborIssues)){ |
| | | for (LaborIssue laborIssue : laborIssues) { |
| | | ApproveProcess approveProcess = new ApproveProcess(); |
| | | approveProcess.setApproveId(laborIssue.getOrderNo()); |
| | | approveProcess.setApproveDeptName(sysDeptMapper.selectDeptById(loginUser.getTenantId()).getDeptName()); |
| | | approveProcess.setApproveTime(laborIssue.getIssueDate()); |
| | | approveProcess.setApproveReason(laborIssue.getDictTypeName() + "-" + laborIssue.getDictName() + "超时未领取"); |
| | | approveProcesses.add(approveProcess); |
| | | } |
| | | } |
| | | // // 查询未领用劳保记录 |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // |
| | | // LaborIssue laborIssue1 = new LaborIssue(); |
| | | // laborIssue1.setAdoptedDate(new Date()); |
| | | // laborIssue1.setIssueDate(sdf.parse(sdf.format(new Date()))); |
| | | // List<LaborIssue> laborIssues = lavorIssueMapper.list(laborIssue1); //staff_join_leave_record表被删除 |
| | | // if(!CollectionUtils.isEmpty(laborIssues)){ |
| | | // for (LaborIssue laborIssue : laborIssues) { |
| | | // ApproveProcess approveProcess = new ApproveProcess(); |
| | | // approveProcess.setApproveId(laborIssue.getOrderNo()); |
| | | // approveProcess.setApproveDeptName(sysDeptMapper.selectDeptById(loginUser.getTenantId()).getDeptName()); |
| | | // approveProcess.setApproveTime(laborIssue.getIssueDate()); |
| | | // approveProcess.setApproveReason(laborIssue.getDictTypeName() + "-" + laborIssue.getDictName() + "超时未领取"); |
| | | // approveProcesses.add(approveProcess); |
| | | // } |
| | | // } |
| | | return approveProcesses; |
| | | } |
| | | |
| | |
| | | .eq(Notice::getStatus, 1) // 1表示发布状态 |
| | | .ge(Notice::getExpirationDate, new Date())); // 过期时间大于等于当前日期 |
| | | } |
| | | |
| | | @Override |
| | | public ProductionProgressDto productionProgress() { |
| | | ProductionProgressDto productionProgressDto = new ProductionProgressDto(); |
| | | List<ProductOrder> productOrderList = productOrderMapper.selectList(new LambdaQueryWrapper<ProductOrder>()); |
| | | List<ProductOrderDto> productOrderDtoList = new ArrayList<>(); |
| | | productOrderList.forEach(productOrder -> { |
| | | ProductOrderDto productOrderDto = productOrderMapper.productMainByOrderId(productOrder); |
| | | // if (productOrderDto != null && productOrderDto.getPlanQuantity() != null && productOrderDto.getQuantity() != null) { |
| | | // productOrderDto.setCompletionStatus((productOrderDto.getPlanQuantity().subtract(productOrderDto.getQuantity())).divide(productOrderDto.getPlanQuantity(), 2, RoundingMode.HALF_UP)); |
| | | // } |
| | | productOrderDtoList.add(productOrderDto); |
| | | }); |
| | | productionProgressDto.setCompletedOrderDetails(productOrderDtoList); |
| | | // 1. 查询所有生产订单(可根据需求添加过滤条件,如排除已删除、已取消的订单) |
| | | IPage<ProductOrderDto> productOrderDtoIPage = productOrderMapper.pageProductOrder(new Page<>(1, -1), new ProductOrderDto()); |
| | | |
| | | // 2. 初始化汇总数据 |
| | | int totalCount = productOrderDtoIPage.getRecords().size(); |
| | | int completedCount = (int) productOrderDtoIPage.getRecords().stream().map(productOrderDto -> productOrderMapper.productMainByOrderId(productOrderDto)).filter(productOrderDto1 -> productOrderDto1.getQuantity() != null && productOrderDto1.getQuantity().compareTo(BigDecimal.ZERO) == 0).count(); |
| | | |
| | | // 6. 赋值汇总数据 |
| | | productionProgressDto.setTotalOrderCount(totalCount); |
| | | productionProgressDto.setCompletedOrderCount(completedCount); |
| | | productionProgressDto.setUncompletedOrderCount(totalCount - completedCount); |
| | | productionProgressDto.setCompletedProgressCount(BigDecimal.valueOf(completedCount).divide(BigDecimal.valueOf(totalCount), 2, RoundingMode.HALF_UP)); |
| | | return productionProgressDto; |
| | | } |
| | | @Override |
| | | public Map<Integer, List<ProductWorkOrderDto>> workInProcessTurnover() { |
| | | List<ProductWorkOrderDto> productWorkOrderDtoList = productWorkOrderMapper.selectProductWorkOrderDtoList(); |
| | | //根据状态区分工单的各个状态 |
| | | Map<Integer, List<ProductWorkOrderDto>> productWorkOrderDtoMap = productWorkOrderDtoList.stream().collect(Collectors.groupingBy(ProductWorkOrderDto::getStatus)); |
| | | |
| | | return productWorkOrderDtoMap; |
| | | |
| | | } |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | |
| | | } |