From b9b1c54aacf1d97e3a80104659696d1f6dbf61a5 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期三, 01 四月 2026 17:44:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java | 53 ++++++++++++++++++++++++++++++-----------------------
1 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
index 9174fd2..880acaa 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/ProjectController.java
@@ -2,6 +2,7 @@
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -40,6 +41,7 @@
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static java.util.stream.Collectors.groupingBy;
@@ -143,6 +145,7 @@
BeanUtils.copyProperties(project,projectVo);
List<String> properties = deviceUsageService.getDeviceUsageList(id);
+ properties = properties.stream().filter(e -> JSONObject.parseObject(e).containsKey("工程起重机械租赁单位") && JSONObject.parseObject(e).getString("工程起重机械租赁单位") != null && !JSONObject.parseObject(e).getString("工程起重机械租赁单位").isEmpty()).collect(Collectors.toList());
projectVo.setProperties( properties);
ProjectInfo projectInfo = projectInfoService.getOne(new LambdaUpdateWrapper<ProjectInfo>().eq(ProjectInfo::getProjectId, id).eq(ProjectInfo::getDeleted,false).orderByDesc(ProjectInfo::getCreateTime).last("limit 1"));
@@ -250,8 +253,8 @@
@ApiOperation(value = "获取检查资料列表")
@GetMapping("/getDeviceDetailCheckPlanList")
- public R<List<Check>> getDeviceDetailCheckPlanList(@RequestParam Integer planId) {
- List<Check> list = checkService.list(new LambdaQueryWrapper<Check>().eq(Check::getPlanId,planId).orderByDesc(Check::getTime));
+ public R<List<Check>> getDeviceDetailCheckPlanList(@RequestParam Integer planId,@RequestParam Integer projectId) {
+ List<Check> list = checkService.list(new LambdaQueryWrapper<Check>().eq(Check::getPlanId,planId).eq(projectId!=null,Check::getProjectId,projectId).orderByDesc(Check::getTime));
if(!list.isEmpty()){
List<Integer> planIds = list.stream().map(Check::getPlanId).toList();
List<Plan> plans = planService.listByIds(planIds);
@@ -309,9 +312,22 @@
@ApiOperation(value = "获取计划下拉框信息",response = Plan.class)
@GetMapping("/getPlanList")
- public R<List<Plan>> getPlanList() {
- List<Plan> list = planService.list(new LambdaQueryWrapper<Plan>().eq(Plan::getDeleted, false));
+ public R<List<Plan>> getPlanList(Integer projectId) {
+ List<Plan> list = planService.list(new LambdaQueryWrapper<Plan>().eq(projectId!=null,Plan::getProjectId,projectId).eq(Plan::getDeleted, false));
return R.ok(list);
+ }
+
+
+ @ApiOperation(value = "获取计划下拉框信息",response = Plan.class)
+ @GetMapping("/getPlanListFromOnDuty")
+ public R<List<Plan>> getPlanListFromOnDuty(Integer projectId) {
+ List<OnDuty> list = onDutyService.list(new LambdaQueryWrapper<OnDuty>().eq(OnDuty::getProjectId, projectId));
+ if(list.isEmpty()){
+ return R.ok(new ArrayList<>());
+ }
+ List<Integer> ids = list.stream().map(OnDuty::getPlanId).toList();
+ List<Plan> resultList = planService.list(new LambdaQueryWrapper<Plan>().in(Plan::getId,ids).eq(Plan::getDeleted, false));
+ return R.ok(resultList);
}
@@ -466,7 +482,7 @@
}
private ResponseEntity<org.springframework.core.io.Resource> downloadFile(UserFile userFile) throws IOException {
- InputStreamResource resource =resolveResource(userFile);
+ InputStreamResource resource =userFileService.resolveResource(userFile);
var fileSize = userFile.getSize();
// if(resource == null) {
// resource = new InputStreamResource(getClass().getClassLoader().getResourceAsStream("images/wukong.png"));
@@ -482,15 +498,6 @@
.body(resource);
}
- public InputStreamResource resolveResource(UserFile userFile) throws IOException {
- var filePath = fileLocation.resolve(userFile.getName() + "." + userFile.getExtension()).normalize();
- if(!Files.exists(filePath)){
- return null;
- }
- return new InputStreamResource(Files.newInputStream(filePath));
- }
-
- private Path fileLocation;
@@ -498,14 +505,14 @@
private String UPLOAD_DIR;
- @PostConstruct
- void init(){
- fileLocation = Path.of(UPLOAD_DIR).toAbsolutePath().normalize();
- try {
- Files.createDirectories(this.fileLocation);
- } catch (Exception ex) {
- throw new RuntimeException("Could not create the directory where the uploaded files will be stored.", ex);
- }
- }
+// @PostConstruct
+// void init(){
+// fileLocation = Path.of(UPLOAD_DIR).toAbsolutePath().normalize();
+// try {
+// Files.createDirectories(this.fileLocation);
+// } catch (Exception ex) {
+// throw new RuntimeException("Could not create the directory where the uploaded files will be stored.", ex);
+// }
+// }
}
--
Gitblit v1.7.1