| | |
| | | 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; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.*; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | |
| | | private PaymentRegistrationMapper paymentRegistrationMapper; |
| | | |
| | | @Autowired |
| | | private LavorIssueMapper lavorIssueMapper; |
| | | |
| | | @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(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()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ApproveProcess> todos() { |
| | | public List<ApproveProcess> todos() throws ParseException { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | LambdaQueryWrapper<ApproveProcess> approveProcessLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | approveProcessLambdaQueryWrapper.eq(ApproveProcess::getApproveDelete, 0) |
| | | .eq(ApproveProcess::getApproveUserCurrentId, loginUser.getUserId()) |
| | | .ne(ApproveProcess::getApproveStatus, 2) |
| | | .eq(ApproveProcess::getTenantId, loginUser.getTenantId()); |
| | | return approveProcessMapper.selectList(approveProcessLambdaQueryWrapper); |
| | | List<ApproveProcess> approveProcesses = approveProcessMapper.selectList(approveProcessLambdaQueryWrapper); |
| | | 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); |
| | | } |
| | | } |
| | | return approveProcesses; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | // 应收 |
| | | 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); |
| | | |