From 42131eb034e559dc361fe75d653e4d904aa6a316 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 23 十月 2025 17:51:32 +0800
Subject: [PATCH] 保修详情增加资产类型名称字段
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java | 84 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java
index 469bdb6..7c984aa 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectInventoryController.java
@@ -1,8 +1,28 @@
package com.ruoyi.web.controller.api;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.InventoryStorageListQuery;
+import com.ruoyi.system.query.ProjectMainListQuery;
+import com.ruoyi.system.service.*;
+import com.ruoyi.system.vo.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.util.List;
/**
* <p>
@@ -13,8 +33,72 @@
* @since 2025-10-16
*/
@RestController
+@Api(tags = "存量项目情况")
@RequestMapping("/project-inventory")
public class ProjectInventoryController {
+ @Resource
+ private ProjectInventoryService projectInventoryService;
+ @Resource
+ private ProjectStorageItemService projectStorageItemService;
+ @Resource
+ private ProjectStorageService projectStorageService;
+ @ApiOperation(value = "获取存量项目顶部数据")
+ @PostMapping(value = "/topData")
+ public R<ProjectInventory> topData() {
+ int year = LocalDate.now().getYear();
+ List<ProjectStorageItem> projectStorageItemList = projectStorageItemService.lambdaQuery()
+ .like(ProjectStorageItem::getMonth, year).list();
+ List<ProjectStorage> projectStorageList = projectStorageService.lambdaQuery()
+ .like(ProjectStorage::getInTime, year).list();
+ BigDecimal investmentTaskFinish = projectStorageItemList.stream().map(ProjectStorageItem::getAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
+ BigDecimal storageTaskFinish = projectStorageList.stream().map(ProjectStorage::getTotalAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
+ List<ProjectInventory> projectInventories = projectInventoryService.list();
+ if (projectInventories.isEmpty()){
+ ProjectInventory projectInventory = new ProjectInventory();
+ projectInventory.setInvestmentTask(BigDecimal.ZERO);
+ projectInventory.setInvestmentTaskFinish(investmentTaskFinish);
+ projectInventory.setInvestmentTaskRating(new BigDecimal("100"));
+ projectInventory.setStorageTask(BigDecimal.ZERO);
+ projectInventory.setStorageTaskFinish(storageTaskFinish);
+ projectInventory.setStorageTaskRating(new BigDecimal("100"));
+ projectInventoryService.save(projectInventory);
+ return R.ok(projectInventory);
+ }else{
+ ProjectInventory projectInventory = projectInventories.get(0);
+ projectInventory.setInvestmentTaskFinish(investmentTaskFinish);
+ projectInventory.setInvestmentTaskRating(investmentTaskFinish.divide(projectInventory.getInvestmentTask(),2, RoundingMode.HALF_UP));
+ projectInventory.setStorageTaskFinish(storageTaskFinish);
+ projectInventory.setStorageTaskRating(storageTaskFinish.divide(projectInventory.getStorageTask(),2, RoundingMode.HALF_UP));
+ return R.ok(projectInventory);
+ }
+ }
+ @ApiOperation(value = "修改存量项目顶部数据")
+ @Log(title = "修改存量项目顶部数据", businessType = BusinessType.UPDATE)
+ @PostMapping(value = "/saveOrUpdate")
+ public R<Boolean> saveOrUpdate(@RequestBody ProjectInventory entity) {
+ projectInventoryService.updateById( entity);
+ return R.ok();
+ }
+ @ApiOperation(value = "存量项目情况分页列表")
+ @PostMapping(value = "/storagePageList")
+ public R<PageInfo<InventoryStorageListVO>> storagePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) {
+ return R.ok(projectInventoryService.storagePageList(inventoryStorageListQuery));
+ }
+ @ApiOperation(value = "月新增入库项目情况分页列表")
+ @PostMapping(value = "/inStoragePageList")
+ public R<PageInfo<InStorageListVO>> inStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) {
+ return R.ok(projectInventoryService.inStoragePageList(inventoryStorageListQuery));
+ }
+ @ApiOperation(value = "月新增出库项目情况分页列表")
+ @PostMapping(value = "/outStoragePageList")
+ public R<PageInfo<OutStorageListVO>> outStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) {
+ return R.ok(projectInventoryService.outStoragePageList(inventoryStorageListQuery));
+ }
+ @ApiOperation(value = "月新增入库项目情况分页列表")
+ @PostMapping(value = "/monthStoragePageList")
+ public R<PageInfo<MonthStorageListVO>> monthStoragePageList(@RequestBody InventoryStorageListQuery inventoryStorageListQuery) {
+ return R.ok(projectInventoryService.monthStoragePageList(inventoryStorageListQuery));
+ }
}
--
Gitblit v1.7.1