From 0b1aec7d64fb10c44f5a46fc957fbc3189206bf4 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 22 五月 2026 13:37:46 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_天津_宝东pro

---
 src/main/resources/mapper/production/ProductionOperationTaskMapper.xml                |    2 
 /dev/null                                                                             |   39 -------------
 src/main/java/com/ruoyi/account/service/AccountingService.java                        |   19 ++++++
 src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java               |   36 +++++++++++
 src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java |    2 
 src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java                        |   19 +-----
 src/main/java/com/ruoyi/account/controller/AccountingController.java                  |   24 ++++++-
 src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java                          |   28 +++++++++
 8 files changed, 107 insertions(+), 62 deletions(-)

diff --git a/src/main/java/com/ruoyi/account/bean/dto/AccountDto.java b/src/main/java/com/ruoyi/account/bean/dto/AccountDto.java
deleted file mode 100644
index 5af0ca6..0000000
--- a/src/main/java/com/ruoyi/account/bean/dto/AccountDto.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ruoyi.account.bean.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃
- */
-
-@Data
-public class AccountDto implements Serializable {
-
-
-    /**
-     * 鎬绘敹鍏�
-     */
-    private BigDecimal totalIncome;
-
-    /**
-     * 鍚勭被鍨嬫敹鍏ラ噾棰�(閿�鍞敹鍏ワ紝鏈嶅姟鏀跺叆锛屽叾浠栨敹鍏�)
-     */
-    private List<AccountDto2> incomeType;
-
-
-    /**
-     * 鏀跺叆绗旀暟
-     */
-    private Long incomeNumber;
-
-    /**
-     * 鎬绘敮鍑�
-     */
-    private BigDecimal totalExpense;
-
-
-    /**
-     * 鍚勭被鍨嬫敮鍑洪噾棰�(鍔炲叕鐢ㄥ搧锛屽憳宸ュ伐璧勶紝宸梾璐癸紝璁惧璐圭敤锛屽叾浠�)
-     */
-    private List<AccountDto2> expenseType;
-
-    /**
-     * 鏀嚭绗旀暟
-     */
-    private Long expenseNumber;
-
-    /**
-     * 鍑�鏀跺叆
-     */
-    private BigDecimal netRevenue;
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/AccountDto2.java b/src/main/java/com/ruoyi/account/bean/dto/AccountDto2.java
deleted file mode 100644
index 7c4e9e5..0000000
--- a/src/main/java/com/ruoyi/account/bean/dto/AccountDto2.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ruoyi.account.bean.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃(绫诲瀷)
- */
-
-@Data
-public class AccountDto2 implements Serializable {
-
-
-    /**
-     * 绫诲瀷
-     */
-    private String typeName;
-
-
-    /**
-     * 鐧惧垎鍗犳瘮
-     */
-    private BigDecimal proportion;
-
-
-
-    /**
-     * 閲戦
-     */
-    private BigDecimal account;
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/AccountDto3.java b/src/main/java/com/ruoyi/account/bean/dto/AccountDto3.java
deleted file mode 100644
index 117fa77..0000000
--- a/src/main/java/com/ruoyi/account/bean/dto/AccountDto3.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.account.bean.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 璐㈠姟绠$悊--璐㈠姟鎶ヨ〃(绫诲瀷)
- */
-
-@Data
-public class AccountDto3 implements Serializable {
-
-
-    /**
-     * 绫诲瀷
-     */
-    private String typeName;
-
-
-    /**
-     * 鐧惧垎鍗犳瘮
-     */
-    private BigDecimal proportion;
-
-
-
-    /**
-     * 閲戦
-     */
-    private List<BigDecimal> account;
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/account/bean/dto/ReportDateDto.java b/src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
similarity index 70%
rename from src/main/java/com/ruoyi/account/bean/dto/ReportDateDto.java
rename to src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
index 5e89162..8d4bf31 100644
--- a/src/main/java/com/ruoyi/account/bean/dto/ReportDateDto.java
+++ b/src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
@@ -1,17 +1,16 @@
 package com.ruoyi.account.bean.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDate;
 
-/**
- * @author :yys
- * @date : 2026/1/16 16:57
- */
+
 @Data
-public class ReportDateDto {
+@Schema(name = "AccountReportDto", description = "璐㈠姟鎶ヨ〃--鏃ユ湡鍙傛暟")
+public class AccountReportDto {
 
     /**
      * 寮�濮嬫椂闂�
@@ -26,15 +25,5 @@
     @JsonFormat(pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDate entryDateEnd;
-
-    /**
-     * 寮�濮嬫湀浠�
-     */
-    private Integer startMonth;
-
-    /**
-     * 缁撴潫鏈堜唤
-     */
-    private Integer endMonth;
 
 }
diff --git a/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java b/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java
new file mode 100644
index 0000000..6d09a31
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java
@@ -0,0 +1,28 @@
+package com.ruoyi.account.bean.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+
+@Data
+@Schema(name = "AccountReportVo", description = "璐㈠姟鎶ヨ〃--杩斿洖鍙傛暟")
+public class AccountReportVo {
+
+    @Schema(description = "鎬昏惀鏀�")
+    private BigDecimal totalIncome;
+
+    @Schema(description = "鎬绘敮鍑�")
+    private BigDecimal totalExpense;
+
+    @Schema(description = "鎬绘敹鍏ョ瑪鏁�")
+    private Integer incomeNumber;
+
+    @Schema(description = "鎬绘敮鍑虹瑪鏁�")
+    private Integer expenseNumber;
+
+    @Schema(description = "鍑�鏀跺叆")
+    private BigDecimal netRevenue;
+
+}
diff --git a/src/main/java/com/ruoyi/account/controller/AccountingController.java b/src/main/java/com/ruoyi/account/controller/AccountingController.java
index 4688942..8ab5229 100644
--- a/src/main/java/com/ruoyi/account/controller/AccountingController.java
+++ b/src/main/java/com/ruoyi/account/controller/AccountingController.java
@@ -1,12 +1,16 @@
 package com.ruoyi.account.controller;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.account.service.impl.AccountingServiceImpl;
+import com.ruoyi.account.bean.dto.AccountReportDto;
+import com.ruoyi.account.service.AccountingService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import io.swagger.v3.oas.annotations.tags.Tag;
+import com.ruoyi.framework.web.domain.R;
 import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -19,11 +23,11 @@
 @Tag(name = "浼氳鏍哥畻")
 @RestController
 @RequestMapping("/accounting")
-@AllArgsConstructor
+@RequiredArgsConstructor
 public class AccountingController extends BaseController {
 
 
-    private AccountingServiceImpl accountingService;
+    private final AccountingService accountingService;
 
     @Operation(summary = "鎬昏")
     @GetMapping("/total")
@@ -43,4 +47,14 @@
         return accountingService.calculateDepreciation(page,year);
     }
 
+    /*****************************************璐㈠姟鎶ヨ〃******************************************************************************/
+
+    @GetMapping("/accountStatementDetailsByMonth")
+    @Log(title = "缁熻鎬诲簲鏀�+鎬绘敮鍑�+鎬绘敹鍏ョ瑪鏁�+鎬绘敮鍑虹瑪鏁�+鍑�鏀跺叆", businessType = BusinessType.OTHER)
+    @Operation(summary = "璐㈠姟鎶ヨ〃--缁熻鎬诲簲鏀�+鎬绘敮鍑�+鎬绘敹鍏ョ瑪鏁�+鎬绘敮鍑虹瑪鏁�+鍑�鏀跺叆")
+    public R getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
+        return R.ok(accountingService.getAccountStatementDetailsByMonth(accountReportDto));
+    }
+
+
 }
diff --git a/src/main/java/com/ruoyi/account/service/AccountingService.java b/src/main/java/com/ruoyi/account/service/AccountingService.java
new file mode 100644
index 0000000..6190dc8
--- /dev/null
+++ b/src/main/java/com/ruoyi/account/service/AccountingService.java
@@ -0,0 +1,19 @@
+package com.ruoyi.account.service;
+
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.AccountReportDto;
+import com.ruoyi.account.bean.vo.AccountReportVo;
+import com.ruoyi.framework.web.domain.AjaxResult;
+
+public interface AccountingService {
+
+    AjaxResult total(Integer year);
+
+    AjaxResult deviceTypeDistribution(Integer year);
+
+    AjaxResult calculateDepreciation(Page page, Integer year);
+
+    AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto);
+
+}
diff --git a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
index 01f5687..911c808 100644
--- a/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
+++ b/src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
@@ -3,9 +3,17 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.account.bean.dto.AccountReportDto;
 import com.ruoyi.account.bean.dto.DeviceTypeDetail;
 import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
+import com.ruoyi.account.bean.vo.AccountReportVo;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
+import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
+import com.ruoyi.account.pojo.sales.AccountSalesCollection;
+import com.ruoyi.account.service.AccountingService;
 import com.ruoyi.device.mapper.DeviceLedgerMapper;
 import com.ruoyi.device.pojo.DeviceLedger;
 import com.ruoyi.framework.web.domain.AjaxResult;
@@ -33,13 +41,17 @@
 @Service
 @Slf4j
 @RequiredArgsConstructor
-public class AccountingServiceImpl {
+public class AccountingServiceImpl implements AccountingService {
 
     private final DeviceLedgerMapper deviceLedgerMapper;
     private final CustomStorageMapper customStorageMapper;
     private final ProcurementRecordMapper procurementRecordMapper;
     private final ProcurementRecordOutMapper procurementRecordOutMapper;
+    private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+    private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
 
+
+    @Override
     public AjaxResult total(Integer year) {
         Map<String,Object> map = new HashMap<>();
         map.put("deprAmount",0); // 鎶樻棫閲戦
@@ -233,6 +245,7 @@
         return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
     }
 
+    @Override
     public AjaxResult deviceTypeDistribution(Integer year) {
         // 2. 缁勮杩斿洖VO
        DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
@@ -256,6 +269,7 @@
         return AjaxResult.success(vo);
     }
 
+    @Override
     public AjaxResult calculateDepreciation(Page page, Integer year) {
         LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
         deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
@@ -267,4 +281,24 @@
         }
         return AjaxResult.success(deviceLedgerIPage);
     }
+
+    @Override
+    public AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
+        AccountReportVo accountReportVo = new AccountReportVo();
+        //鎬昏惀鏀�=鏀舵鍗曟�婚噾棰�
+        //鎬绘敹鍏ョ瑪鏁�=鏀舵鍗曟�荤瑪鏁�
+        List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(Wrappers.<AccountSalesCollection>lambdaQuery()
+                .between(AccountSalesCollection::getCollectionDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
+        accountReportVo.setTotalIncome(accountSalesCollections.stream().map(AccountSalesCollection::getCollectionAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+        accountReportVo.setIncomeNumber(accountSalesCollections.size());
+        //鎬绘敮鍑�=浠樻鍗曟�婚噾棰�
+        //鎬绘敮鍑虹瑪鏁�=浠樻鍗曟�荤瑪鏁�
+        List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery()
+                .between(AccountPurchasePayment::getPaymentDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
+        accountReportVo.setTotalExpense(accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+        accountReportVo.setExpenseNumber(accountPurchasePayments.size());
+        //鍑�鍒╂鼎=鎬昏惀鏀�-鎬绘敮鍑�
+        accountReportVo.setNetRevenue(accountReportVo.getTotalIncome().subtract(accountReportVo.getTotalExpense()));
+        return accountReportVo;
+    }
 }
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
index 8c4d50d..c52892a 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionProductMainServiceImpl.java
@@ -401,7 +401,7 @@
             productionAccount.setSchedulingUserId(user == null ? null : user.getUserId());
             productionAccount.setSchedulingUserName(user == null ? dto.getUserName() : user.getNickName());
             productionAccount.setFinishedNum(productQty);
-            productionAccount.setWorkHours(technologyOperation.getSalaryQuota());
+            productionAccount.setWorkHours(technologyOperation != null ? technologyOperation.getSalaryQuota() : null);
             productionAccount.setTechnologyOperationName(technologyOperation == null ? null : technologyOperation.getName());
             productionAccount.setSchedulingDate(LocalDateTime.now());
             productionAccountMapper.insert(productionAccount);
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 199eb21..5ecf0e9 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -110,7 +110,7 @@
         select poro.operation_name as processName,
                sum(ifnull(ppi.input_quantity, 0)) as totalInput,
                sum(ifnull(ppo.scrap_qty, 0)) as totalScrap,
-               sum(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0)) as totalOutput
+               sum(greatest(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0), 0)) as totalOutput
         from production_product_output ppo
                  inner join production_product_main ppm on ppo.production_product_main_id = ppm.id
                  inner join production_operation_task pot on ppm.production_operation_task_id = pot.id

--
Gitblit v1.9.3