| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | zss | ![]() |
| 2026-02-13 | zss | ![]() |
| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | huminmin | ![]() |
| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | gongchunyi | ![]() |
| 2026-02-13 | zss | ![]() |
src/main/java/com/ruoyi/account/pojo/AccountExpense.java
@@ -48,9 +48,9 @@ private Date expenseDate; /** * 支出类型(办公用品,员工工资,差旅费,设备费用,其他) * 支出类型(办公用品,员工工资,差旅费,设备费用,来票付款,其他) */ @Excel(name = "支出类型",readConverterExp = "0=办公用品,1=员工工资,2=差旅费,3=设备费用,4=其他") @Excel(name = "支出类型",readConverterExp = "0=办公用品,1=员工工资,2=差旅费,3=设备费用,4=来票付款,5=其他") @NotBlank(message = "支出类型不能为空!!") private String expenseType; src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -145,6 +145,12 @@ @Autowired private ProductProcessMapper productProcessMapper; @Autowired private AccountExpenseMapper accountExpenseMapper; @Autowired private AccountIncomeMapper accountIncomeMapper; @Override public HomeBusinessDto business() { @@ -465,8 +471,8 @@ } // 应收 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, @@ -475,8 +481,8 @@ // 应付 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, @@ -484,8 +490,8 @@ BigDecimal payableMoney = sumAmount(procurementRecords, PurchaseLedger::getContractAmount); // 预收 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, @@ -494,8 +500,8 @@ // 预付 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, @@ -559,7 +565,7 @@ productionProgressDto.setCompletedOrderDetails(productOrderDtos); long totalCount = productOrderDtos.size(); long count = productOrderDtos.stream().filter( productOrderDto -> productOrderDto.getCompleteQuantity().compareTo(productOrderDto.getQuantity()) >= 0) productOrderDto -> productOrderDto.getCompleteQuantity().compareTo(productOrderDto.getQuantity()) >= 0) .count(); long count2 = productOrderDtos.stream() .filter(productOrderDto -> productOrderDto.getCompleteQuantity().compareTo(BigDecimal.ZERO) == 0) @@ -1032,28 +1038,20 @@ @Override public List<MapDto> salesPurchaseStorageProductCount() { LocalDate now = LocalDate.now(); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); LocalDateTime now = LocalDateTime.now(); LocalDateTime currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); LocalDateTime lastMonth = now.minusMonths(1); LocalDateTime lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); LocalDateTime lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); String currentMonthStart = now.with(TemporalAdjusters.firstDayOfMonth()).format(dtf); String currentMonthNow = now.format(dtf); LocalDate lastMonth = now.minusMonths(1); String lastMonthStart = lastMonth.with(TemporalAdjusters.firstDayOfMonth()).format(dtf); String lastMonthEnd = lastMonth.with(TemporalAdjusters.lastDayOfMonth()).format(dtf); // 销售 int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, currentMonthNow); // 销售 int currentSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, currentMonthStart, now); int lastSales = salesLedgerProductMapper.selectProductCountByTypeAndDate(1, lastMonthStart, lastMonthEnd); // 采购 int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, currentMonthNow); // 采购 int currentPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, currentMonthStart, now); int lastPurchase = salesLedgerProductMapper.selectProductCountByTypeAndDate(2, lastMonthStart, lastMonthEnd); // 储存 int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, currentMonthNow); // 储存 int currentStorage = stockInventoryMapper.selectStorageProductCountByDate(currentMonthStart, now); int lastStorage = stockInventoryMapper.selectStorageProductCountByDate(lastMonthStart, lastMonthEnd); List<MapDto> list = new ArrayList<>(); @@ -1152,12 +1150,6 @@ public List<MapDto> productTurnoverDays() { return homeMapper.productTurnoverDays(); } @Autowired private AccountExpenseMapper accountExpenseMapper; @Autowired private AccountIncomeMapper accountIncomeMapper; public List<Map<String, Object>> incomeExpenseAnalysis(Integer type) { @@ -1282,36 +1274,21 @@ String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // List<IncomeExpenseAnalysisDto> incomeList = // salesLedgerMapper.selectIncomeStats(startStr, endStr, dateFormat); List<IncomeExpenseAnalysisDto> incomeList = new ArrayList<>(); List<IncomeExpenseAnalysisDto> purchaseList = purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat); List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat); List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat); List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat); Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors .toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); Map<String, BigDecimal> purchaseMap = purchaseList.stream().collect(Collectors .toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); Map<String, BigDecimal> expenseMap = expenseList.stream().collect(Collectors .toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add)); List<MapDto> result = new ArrayList<>(); for (String month : months) { MapDto dto = new MapDto(); dto.setName(month); BigDecimal income = incomeMap.getOrDefault(month, BigDecimal.ZERO); BigDecimal purchase = purchaseMap.getOrDefault(month, BigDecimal.ZERO); income = BigDecimal.ZERO; BigDecimal expense = expenseMap.getOrDefault(month, BigDecimal.ZERO); BigDecimal totalExpense = purchase.add(expense); BigDecimal profit = income.subtract(totalExpense); BigDecimal profit = income.subtract(expense); dto.setValue(profit.setScale(2, RoundingMode.HALF_UP).toString()); result.add(dto); } @@ -1956,7 +1933,7 @@ endDate = today.with(DayOfWeek.SUNDAY); } return new LocalDate[] { startDate, endDate }; return new LocalDate[]{startDate, endDate}; } private QualityQualifiedAnalysisDto buildQualifiedAnalysis(List<QualityInspect> list) { @@ -2202,7 +2179,7 @@ */ public static String[] lastSevenDaysDateRange() { LocalDate today = LocalDate.now(); return new String[] { today.minusDays(6).toString(), today.toString() }; return new String[]{today.minusDays(6).toString(), today.toString()}; } @Override @@ -2435,7 +2412,7 @@ Map<String, List<QualityInspect>> groupedByCheckResult = qualityInspectList.stream() .collect(Collectors.groupingBy(QualityInspect::getCheckResult)); List<QualityInspect> qualityInspects = groupedByCheckResult.get("不合格"); if(ObjectUtils.isNull(qualityInspects) || qualityInspects.size()==0){ if (ObjectUtils.isNull(qualityInspects) || qualityInspects.size() == 0) { return null; } // 4. 处理图表项 (Item) @@ -2501,7 +2478,7 @@ @Override public List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processIds) { List<Long> processIds) { LoginUser loginUser = SecurityUtils.getLoginUser(); Long userId = SecurityUtils.isAdmin(loginUser.getUserId()) ? null : loginUser.getUserId(); src/main/java/com/ruoyi/purchase/service/impl/PaymentRegistrationServiceImpl.java
@@ -127,7 +127,7 @@ // 2. 处理账户支出 AccountExpense accountExpense = new AccountExpense(); accountExpense.setExpenseDate(purchaseLedger.getEntryDate()); accountExpense.setExpenseType("0"); accountExpense.setExpenseType("4"); accountExpense.setSupplierName(purchaseLedger.getSupplierName()); accountExpense.setExpenseMoney(paymentRegistration.getCurrentPaymentAmount()); accountExpense.setExpenseDescribed("付款支出"); src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductMapper.java
@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -21,7 +22,7 @@ * @date 2025-05-08 */ public interface SalesLedgerProductMapper extends MyBaseMapper<SalesLedgerProduct> { List<SalesLedgerProduct> selectProduct() ; List<SalesLedgerProduct> selectProduct(); List<SalesLedgerProduct> selectSalesLedgerProductList(@Param("salesLedgerProduct") SalesLedgerProduct salesLedgerProduct); @@ -29,9 +30,9 @@ IPage<SalesLedgerProductDto> listPage(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct); IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page,@Param("req") SalesLedgerProductDto salesLedgerProduct); IPage<SalesLedgerProductDto> listPagePurchaseLedger(Page page, @Param("req") SalesLedgerProductDto salesLedgerProduct); IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page,@Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto); IPage<ProcurementBusinessSummaryDto> procurementBusinessSummaryListPage(Page page, @Param("req") ProcurementBusinessSummaryDto procurementBusinessSummaryDto); List<LossProductModelDto> selectProductBomStructure(@Param("salesLedegerId") Long salesLedegerId); @@ -39,7 +40,7 @@ List<Map<String, Object>> selectRawMaterialPurchaseAnalysis(); int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") String startDate, @Param("endDate") String endDate); int selectProductCountByTypeAndDate(@Param("type") Integer type, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); BigDecimal selectRawMaterialExpense(); } src/main/java/com/ruoyi/sales/service/impl/MetricStatisticsServiceImpl.java
@@ -59,20 +59,74 @@ public AjaxResult statisticsTable(StatisticsTableDto statisticsTableDto) { Map<String, Object> map = new HashMap<>(); if (statisticsTableDto.getEntryDateStart() == null || statisticsTableDto.getEntryDateEnd() == null) { Calendar calendar = Calendar.getInstance(); // 结束时间默认是当前时间 statisticsTableDto.setEntryDateEnd(new Date()); // 开始时间默认是6个月前 calendar.add(Calendar.MONTH, -6); statisticsTableDto.setEntryDateStart(calendar.getTime()); Calendar calendar = Calendar.getInstance(); // 结束时间默认是当前时间 Date endDate = statisticsTableDto.getEntryDateEnd() != null ? statisticsTableDto.getEntryDateEnd() : new Date(); statisticsTableDto.setEntryDateEnd(endDate); // 开始时间默认是12个月前 Date startDate; if (statisticsTableDto.getEntryDateStart() != null) { startDate = statisticsTableDto.getEntryDateStart(); } else { calendar.setTime(endDate); calendar.add(Calendar.MONTH, -11); // 减11个月,加上当前月共12个月 calendar.set(Calendar.DAY_OF_MONTH, 1); // 设为月初 startDate = calendar.getTime(); } statisticsTableDto.setEntryDateStart(startDate); // 查询数据库获取有数据的月份 List<SalesTrendDto> salesTrendDtos = salesLedgerMapper.statisticsTable(statisticsTableDto); if(CollectionUtils.isEmpty(salesTrendDtos)) return AjaxResult.success(map); map.put("dateList", salesTrendDtos.stream().map(SalesTrendDto::getMonth).collect(Collectors.toList())); map.put("orderCountList", salesTrendDtos.stream().map(SalesTrendDto::getOrderCount).collect(Collectors.toList())); map.put("salesAmountList", salesTrendDtos.stream().map(SalesTrendDto::getSalesAmount).collect(Collectors.toList())); map.put("shippingRateList", salesTrendDtos.stream().map(SalesTrendDto::getShipRate).collect(Collectors.toList())); // 创建月份到数据的映射 Map<String, SalesTrendDto> trendMap = new HashMap<>(); if (!CollectionUtils.isEmpty(salesTrendDtos)) { for (SalesTrendDto dto : salesTrendDtos) { trendMap.put(dto.getMonth(), dto); } } // 生成月份列表 List<String> dateList = new ArrayList<>(); List<BigDecimal> orderCountList = new ArrayList<>(); List<BigDecimal> salesAmountList = new ArrayList<>(); List<BigDecimal> shippingRateList = new ArrayList<>(); Calendar tempCalendar = Calendar.getInstance(); tempCalendar.setTime(startDate); tempCalendar.set(Calendar.DAY_OF_MONTH, 1); // 确保从月初开始 Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(endDate); endCalendar.set(Calendar.DAY_OF_MONTH, 1); // 确保到月末 // 循环生成月份列表,直到达到结束月份 while (!tempCalendar.after(endCalendar)) { String monthStr = String.format("%04d-%02d", tempCalendar.get(Calendar.YEAR), tempCalendar.get(Calendar.MONTH) + 1); dateList.add(monthStr); // 获取当前月份的数据,如果没有则使用默认值 SalesTrendDto dto = trendMap.get(monthStr); if (dto != null) { orderCountList.add(new BigDecimal(dto.getOrderCount())); salesAmountList.add(dto.getSalesAmount() != null ? dto.getSalesAmount() : BigDecimal.ZERO); shippingRateList.add(new BigDecimal(String.valueOf(dto.getShipRate()))); } else { orderCountList.add(BigDecimal.ZERO); salesAmountList.add(BigDecimal.ZERO); shippingRateList.add(BigDecimal.ZERO); } // 下一个月 tempCalendar.add(Calendar.MONTH, 1); } map.put("dateList", dateList); map.put("orderCountList", orderCountList); map.put("salesAmountList", salesAmountList); map.put("shippingRateList", shippingRateList); return AjaxResult.success(map); } } src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
@@ -100,23 +100,12 @@ throw new BaseException(String.format("打卡失败:您当前位置距离考勤点%.2f米,超出允许范围(%s米)", actualDistance, allowedRadius)); } /*判断打卡时间*/ LocalTime endAt = locationConfig.getEndAt(); //下班时间 // 获取考勤下班时间点 int standardHour = endAt.getHour(); int standardMinute = endAt.getMinute(); // 当前时间 int actualHour = currentDateTime.getHour(); int actualMinute = currentDateTime.getMinute(); // 判断打卡时间是否晚于当前时间 if (actualHour < standardHour || (actualHour == standardHour && actualMinute < standardMinute)) { throw new BaseException(String.format("打卡失败:打卡时间不能早于下班时间(%02d:%02d)", standardHour, standardMinute)); } // 根据员工ID和当前日期查询打卡记录 QueryWrapper<PersonalAttendanceRecords> attendanceQueryWrapper = new QueryWrapper<>(); attendanceQueryWrapper.eq("staff_on_job_id", staffOnJob.getId()) .eq("date", currentDate); PersonalAttendanceRecords attendanceRecord = personalAttendanceRecordsMapper.selectOne(attendanceQueryWrapper); // 根据字典设置的考勤时间判断迟到早退 // 根据考勤时间判断迟到早退 if (attendanceRecord == null) { // 不存在打卡记录,创建新记录 PersonalAttendanceRecords personalAttendanceRecords = new PersonalAttendanceRecords(); src/main/java/com/ruoyi/stock/mapper/StockInventoryMapper.java
@@ -12,6 +12,7 @@ import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -41,11 +42,11 @@ BigDecimal selectTotal(); int selectStorageProductCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate); int selectStorageProductCountByDate(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); List<Map<String, Object>> selectDailyStockInCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate); List<Map<String, Object>> selectDailyStockOutCounts(@Param("rootCategoryId") Long rootCategoryId, @Param("startDate") String startDate, @Param("endDate") String endDate); BigDecimal selectTotalByDate( @Param("now") LocalDate now); BigDecimal selectTotalByDate(@Param("now") LocalDate now); } src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -76,7 +76,7 @@ IFNULL(SUM(income_money), 0) AS amount FROM account_income WHERE income_date BETWEEN #{startDate} AND #{endDate} AND business_type = 1 # AND business_type = 1 GROUP BY dateStr ORDER BY dateStr src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -196,11 +196,15 @@ </select> <select id="selectProductCountByTypeAndDate" resultType="int"> SELECT COUNT(*) SELECT IFNULL(COUNT(*), 0) FROM sales_ledger_product WHERE type = #{type} AND register_date >= #{startDate} AND register_date <= #{endDate} <if test="startDate != null"> AND register_date >= #{startDate} </if> <if test="endDate != null"> AND register_date <= #{endDate} </if> </select> <select id="selectRawMaterialExpense" resultType="java.math.BigDecimal"> src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -199,14 +199,16 @@ </select> <select id="selectStorageProductCountByDate" resultType="int"> SELECT COUNT(*) FROM (SELECT create_time SELECT SUM(total_count) FROM (SELECT COUNT(*) as total_count FROM stock_inventory WHERE create_time >= #{startDate} AND create_time <= #{endDate} UNION ALL SELECT create_time FROM stock_uninventory) combined WHERE create_time >= #{startDate} AND create_time <= #{endDate} SELECT COUNT(*) as total_count FROM stock_uninventory WHERE create_time >= #{startDate} AND create_time <= #{endDate}) AS combined_counts </select> <select id="selectDailyStockInCounts" resultType="java.util.Map">