From 9398b7743fa976b016dfbb2b9cf4a04db340508e Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 09 十月 2025 11:56:52 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetStatisticsController.java |   50 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetStatisticsController.java
index 0795b13..a24ffe2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetStatisticsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AssetStatisticsController.java
@@ -6,6 +6,8 @@
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.model.AssetInventoryRecord;
 import com.ruoyi.system.model.AssetMain;
+import com.ruoyi.system.model.AssetType;
+import com.ruoyi.system.query.AsseIdleListQuery;
 import com.ruoyi.system.query.AssetInventoryListQuery;
 import com.ruoyi.system.query.AssetStatisticsListDetailQuery;
 import com.ruoyi.system.query.AssetStatisticsListQuery;
@@ -13,9 +15,7 @@
 import com.ruoyi.system.service.AssetMainService;
 import com.ruoyi.system.service.AssetTypeService;
 import com.ruoyi.system.service.TDeptService;
-import com.ruoyi.system.vo.AssetInventoryVO;
-import com.ruoyi.system.vo.AssetStatisticsDetailVO;
-import com.ruoyi.system.vo.AssetStatisticsVO;
+import com.ruoyi.system.vo.*;
 import com.ruoyi.system.vo.asset.AssetTypeTreeVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +25,8 @@
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.time.YearMonth;
 import java.util.ArrayList;
@@ -136,10 +138,10 @@
                 query.setDeptIds(deptIds);
             }
         }
-        String[] dateList = query.getDate().split(",");
+        String[] dateList = query.getDate().split("-");
         String month = dateList[1];
         int monthValue = Integer.parseInt(month);
-        int year = LocalDateTime.now().getYear();
+        int year = Integer.parseInt(dateList[0]);
         LocalDateTime firstDay = LocalDateTime.of(year, monthValue, 1, 0, 0, 0);
         LocalDateTime lastDay = LocalDateTime.of(year, monthValue,
                 YearMonth.of(year, monthValue).lengthOfMonth(), 23, 59, 59);
@@ -229,7 +231,41 @@
         PageInfo<AssetStatisticsDetailVO> res = assetTypeService.pageListInventoryDetail(query);
         return R.ok(res);
     }
-
-    
+    @ApiOperation("闲置房产")
+    @PostMapping("/pageListIdle")
+    public R<AssetIdleVO> pageListIdle(@RequestBody AsseIdleListQuery query) {
+        AssetType child = assetTypeService.getById(8);
+        AssetType parent = assetTypeService.getById(child.getParentId());
+        AssetIdleVO res = new AssetIdleVO();
+        res.setAssetMainTypeName(parent.getTypeName()+">"+child.getTypeName());
+        if (StringUtils.hasLength(query.getNameOrCode())){
+            // 查询出资产名称或者资产编号符合条件的code
+            List<Integer> assetMainIds = assetMainService.lambdaQuery()
+                    .and(wrapper -> wrapper.like(AssetMain::getAssetName, query.getNameOrCode())
+                            .or()
+                            .like(AssetMain::getAssetCode, query.getNameOrCode()))
+                    .list()
+                    .stream()
+                    .map(AssetMain::getAssetTypeId)
+                    .collect(Collectors.toList());
+            query.setAssetMainIds(assetMainIds);
+            if (assetMainIds.isEmpty()){
+                res.setPageList(new PageInfo<>());
+                return R.ok(res);
+            }
+        }
+        PageInfo<AssetIdleListVO> pageList = assetTypeService.pageListIdle(query);
+        List<AssetIdleListVO> noLimit = assetTypeService.pageListIdleNoLimit(query);
+        Integer totalCount = 0;
+        BigDecimal totalValue = new BigDecimal(BigInteger.ZERO);
+        for (AssetIdleListVO assetIdleListVO : noLimit) {
+            totalCount+=assetIdleListVO.getQuantity();
+            totalValue = totalValue.add(new BigDecimal(assetIdleListVO.getQuantity()).multiply(assetIdleListVO.getUnitPrice()));
+        }
+        res.setTotalCount(totalCount);
+        res.setTotalValue(totalValue);
+        res.setPageList(pageList);
+        return R.ok(res);
+    }
 }
 

--
Gitblit v1.7.1