| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.collaborativeApproval.mapper.NoticeMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.Notice; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.dto.MapDto; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import com.ruoyi.lavorissue.mapper.LavorIssueMapper; |
| | | import com.ruoyi.lavorissue.pojo.LaborIssue; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | |
| | | @Autowired |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | @Autowired |
| | | private CustomStorageMapper customStorageMapper; |
| | | |
| | | @Override |
| | | public HomeBusinessDto business() { |
| | | // 构建结果 |
| | |
| | | } |
| | | |
| | | LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductMapperLambdaQueryWrapperCopy = new LambdaQueryWrapper<SalesLedgerProduct>(); |
| | | salesLedgerProductMapperLambdaQueryWrapper.eq(SalesLedgerProduct::getType, 2) |
| | | salesLedgerProductMapperLambdaQueryWrapperCopy.eq(SalesLedgerProduct::getType, 2) |
| | | .in(SalesLedgerProduct::getSalesLedgerId, purchaseLedgers.stream().map(PurchaseLedger::getId).collect(Collectors.toList())); |
| | | List<SalesLedgerProduct> salesLedgerProductsCopy = salesLedgerProductMapper.selectList(salesLedgerProductMapperLambdaQueryWrapperCopy); |
| | | // 合计合同金额 |
| | |
| | | .map(PurchaseLedger::getContractAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 未开票金额 |
| | | // 未来票金额 |
| | | BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream() |
| | | .map(SalesLedgerProduct::getNoInvoiceAmount) |
| | | .map(SalesLedgerProduct::getFutureTicketsAmount) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | |
| | | .map(ProcurementRecordStorage::getInboundNum) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 成品入库 |
| | | List<CustomStorage> customStorages = customStorageMapper.selectList(null); |
| | | BigDecimal stockAmountCustom = customStorages.stream() |
| | | .map(CustomStorage::getInboundNum) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | stockAmount = stockAmount.add(stockAmountCustom); |
| | | List<ProcurementRecordOut> procurementRecordOuts = procurementRecordOutMapper.selectList(null); |
| | | BigDecimal outboundAmount = procurementRecordOuts.stream() |
| | | .map(ProcurementRecordOut::getInboundNum) |
| | |
| | | .map(ProcurementRecordStorage::getInboundNum) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 获取当天成品入库数量 |
| | | LambdaQueryWrapper<CustomStorage> customStorageLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | customStorageLambdaQueryWrapper.ge(CustomStorage::getCreateTime, now) // 大于等于当天 |
| | | .lt(CustomStorage::getCreateTime, now.plusDays(1)); |
| | | List<CustomStorage> customStorages1 = customStorageMapper.selectList(customStorageLambdaQueryWrapper); |
| | | BigDecimal stockAmountCustom1 = customStorages1.stream() |
| | | .map(CustomStorage::getInboundNum) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | stockAmount1 = stockAmount1.add(stockAmountCustom1); |
| | | |
| | | homeBusinessDto.setMonthPurchaseMoney(receiveAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | | homeBusinessDto.setMonthPurchaseHaveMoney(unReceiptPaymentAmount.setScale(2, RoundingMode.HALF_UP).toString()); |
| | |
| | | } |
| | | // 应收 |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new LambdaQueryWrapper<SalesLedger>() |
| | | .ge(SalesLedger::getEntryDate, startDate) |
| | | .lt(SalesLedger::getEntryDate, endDate) |
| | | // .ge(SalesLedger::getEntryDate, startDate) |
| | | // .lt(SalesLedger::getEntryDate, endDate) |
| | | ); |
| | | BigDecimal receivableMoney = salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 应付 |
| | | List<PurchaseLedger> procurementRecords = purchaseLedgerMapper.selectList(new LambdaQueryWrapper<PurchaseLedger>() |
| | | .ge(PurchaseLedger::getEntryDate, startDate) |
| | | .lt(PurchaseLedger::getEntryDate, endDate) |
| | | // .ge(PurchaseLedger::getEntryDate, startDate) |
| | | // .lt(PurchaseLedger::getEntryDate, endDate) |
| | | ); |
| | | BigDecimal payableMoney = procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 预收 |
| | | List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>() |
| | | .ge(ReceiptPayment::getReceiptPaymentDate, startDate) |
| | | .lt(ReceiptPayment::getReceiptPaymentDate, endDate)); |
| | | // .ge(ReceiptPayment::getReceiptPaymentDate, startDate) |
| | | // .lt(ReceiptPayment::getReceiptPaymentDate, endDate) |
| | | ); |
| | | BigDecimal advanceMoney = receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 预付 |
| | | List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new LambdaQueryWrapper<PaymentRegistration>() |
| | | .ge(PaymentRegistration::getPaymentDate, startDate) |
| | | .lt(PaymentRegistration::getPaymentDate, endDate)); |
| | | // .ge(PaymentRegistration::getPaymentDate, startDate) |
| | | // .lt(PaymentRegistration::getPaymentDate, endDate) |
| | | ); |
| | | BigDecimal prepayMoney = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | StatisticsReceivablePayableDto statisticsReceivablePayableDto = new StatisticsReceivablePayableDto(); |
| | | statisticsReceivablePayableDto.setPayableMoney(payableMoney); |
| | | statisticsReceivablePayableDto.setReceivableMoney(receivableMoney); |
| | | statisticsReceivablePayableDto.setPayableMoney(payableMoney.subtract(prepayMoney)); |
| | | statisticsReceivablePayableDto.setReceivableMoney(receivableMoney.subtract(advanceMoney)); |
| | | statisticsReceivablePayableDto.setAdvanceMoney(advanceMoney); |
| | | statisticsReceivablePayableDto.setPrepayMoney(prepayMoney); |
| | | |
| | | return statisticsReceivablePayableDto; |
| | | } |
| | | |
| | | @Autowired |
| | | private DeviceRepairMapper deviceRepairMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private NoticeMapper noticeMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> approveAndDeviceTodos() { |
| | | // 审批协同待办 |
| | | Long aLong = approveProcessMapper.selectCount(new LambdaQueryWrapper<ApproveProcess>() |
| | | .eq(ApproveProcess::getApproveUserCurrentId, SecurityUtils.getUserId()) |
| | | .eq(ApproveProcess::getApproveDelete, 0) |
| | | .in(ApproveProcess::getApproveStatus, 0, 1, 3)); |
| | | // 设备报修待办 |
| | | Long aLong1 = deviceRepairMapper.selectCount(new LambdaQueryWrapper<DeviceRepair>() |
| | | .eq(DeviceRepair::getStatus, 0) |
| | | .eq(DeviceRepair::getRepairName, SecurityUtils.getLoginUser().getNickName())); |
| | | return new HashMap<String, Object>() {{ |
| | | put("approveTodo", aLong); |
| | | put("deviceRepairTodo", aLong1); |
| | | }}; |
| | | } |
| | | |
| | | @Override |
| | | public Long noticesCount() { |
| | | // 查询未过期的通知数量:状态为发布且过期时间大于等于当前日期 |
| | | return noticeMapper.selectCount(new LambdaQueryWrapper<Notice>() |
| | | .eq(Notice::getStatus, 1) // 1表示发布状态 |
| | | .ge(Notice::getExpirationDate, new Date())); // 过期时间大于等于当前日期 |
| | | } |
| | | } |