From abad289c2be2ee73e76a8d9717819c932e3b0a0f Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Tue, 9 Sep 2025 15:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E7=BA=A7=E5=A4=A7=E5=B1=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/listener/UserActionListener.java | 5 +- .../EnterpriseBigScreenController.java | 53 ++++++ .../bigscreen/domain/dto/WeatherQueryReq.java | 28 +++ .../bigscreen/domain/vo/WeatherVo.java | 67 +++++++ .../service/EnterpriseBigScreenService.java | 21 +++ .../impl/EnterpriseBigScreenServiceImpl.java | 27 +++ .../common/utils/baiduUtil/BaiDuFace.java | 5 +- .../SubConstructionUserController.java | 34 +++- .../app/SubConstructionUserAppController.java | 10 + .../service/ISubConstructionUserService.java | 10 +- .../SubConstructionUserFileServiceImpl.java | 3 - .../impl/SubConstructionUserServiceImpl.java | 65 +++++-- .../service/impl/FacMatrixServiceImpl.java | 4 +- .../PgsProgressCategoryController.java | 12 +- ...PgsProgressCategoryTemplateController.java | 8 +- .../controller/PgsProgressPlanController.java | 3 +- .../app/PgsProgressCategoryAppController.java | 23 +++ .../app/PgsProgressPlanAppController.java | 37 +++- .../PgsProgressPlanDetailAppController.java | 60 +++++- .../progress/domain/PgsProgressPlan.java | 6 +- .../PgsProgressCategoryQueryByParentReq.java | 27 +++ ...gressCategoryTemplateQueryByParentReq.java | 27 +++ .../PgsProgressPlanCreateReq.java | 16 +- .../progressplan/PgsProgressPlanQueryReq.java | 9 +- .../PgsProgressCategoryLastTimeVo.java | 6 +- .../PgsProgressCategorySecondVo.java | 14 ++ .../vo/progressplan/PgsProgressPlanVo.java | 9 +- .../service/IPgsProgressCategoryService.java | 17 +- .../IPgsProgressCategoryTemplateService.java | 5 +- .../impl/PgsProgressCategoryServiceImpl.java | 173 +++++++++++++----- ...gsProgressCategoryTemplateServiceImpl.java | 10 +- .../impl/PgsProgressPlanServiceImpl.java | 19 +- .../system/service/ISysOssService.java | 2 +- .../org/dromara/websocket/ChatServer.java | 2 +- 34 files changed, 676 insertions(+), 141 deletions(-) create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/dto/WeatherQueryReq.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/vo/WeatherVo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryByParentReq.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryByParentReq.java diff --git a/xinnengyuan/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java b/xinnengyuan/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java index 07595e09..0e99caf4 100644 --- a/xinnengyuan/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java +++ b/xinnengyuan/ruoyi-admin/src/main/java/org/dromara/web/listener/UserActionListener.java @@ -55,7 +55,8 @@ public class UserActionListener implements SaTokenListener { String username = (String) loginModel.getExtra(LoginHelper.USER_NAME_KEY); String tenantId = (String) loginModel.getExtra(LoginHelper.TENANT_KEY); dto.setUserName(username); - dto.setClientKey((String) loginModel.getExtra(LoginHelper.CLIENT_KEY)); + String clientId = (String) loginModel.getExtra(LoginHelper.CLIENT_KEY); + dto.setClientKey(clientId); dto.setDeviceType(loginModel.getDevice()); dto.setDeptName((String) loginModel.getExtra(LoginHelper.DEPT_NAME_KEY)); TenantHelper.dynamic(tenantId, () -> { @@ -75,7 +76,7 @@ public class UserActionListener implements SaTokenListener { SpringUtils.context().publishEvent(logininforEvent); // 更新登录信息 loginService.recordLoginInfo((Long) loginModel.getExtra(LoginHelper.USER_KEY), ip); - log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue); + log.info("user doLogin, userId:{}, token:{}, clientid{}", loginId, tokenValue, clientId); } /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java new file mode 100644 index 00000000..75a28a80 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/controller/EnterpriseBigScreenController.java @@ -0,0 +1,53 @@ +package org.dromara.bigscreen.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.annotation.Resource; +import org.dromara.bigscreen.domain.dto.WeatherQueryReq; +import org.dromara.bigscreen.domain.vo.WeatherVo; +import org.dromara.bigscreen.service.EnterpriseBigScreenService; +import org.dromara.common.core.domain.R; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.List; + +/** + * 企业级大屏 + * + * @author lilemy + * @date 2025-09-09 14:55 + */ +@Validated +@RestController +@RequestMapping("/enterprise/big/screen") +public class EnterpriseBigScreenController { + + @Resource + private EnterpriseBigScreenService enterpriseBigScreenService; + + /** + * 查询天气 + */ + @SaCheckPermission("enterprise:bigScreen:weather") + @GetMapping("/weather") + public R> getProjectWeather(WeatherQueryReq req) { + return R.ok(enterpriseBigScreenService.getWeather3DaysList(req)); + } + + /** + * 查询安全天数 + */ + @SaCheckPermission("enterprise:bigScreen:safetyDay") + @GetMapping("/safetyDay") + public R getProjectSafetyDay() { + LocalDate date = LocalDate.of(2023, 1, 1); + LocalDate now = LocalDate.now(); + long days = Math.abs(ChronoUnit.DAYS.between(date, now)); + return R.ok(days); + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/dto/WeatherQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/dto/WeatherQueryReq.java new file mode 100644 index 00000000..6072d69c --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/dto/WeatherQueryReq.java @@ -0,0 +1,28 @@ +package org.dromara.bigscreen.domain.dto; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lilemy + * @date 2025-09-09 15:16 + */ +@Data +public class WeatherQueryReq implements Serializable { + + @Serial + private static final long serialVersionUID = -2550570761981859666L; + + /** + * 经度 + */ + private String lng; + + /** + * 纬度 + */ + private String lat; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/vo/WeatherVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/vo/WeatherVo.java new file mode 100644 index 00000000..6200f514 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/domain/vo/WeatherVo.java @@ -0,0 +1,67 @@ +package org.dromara.bigscreen.domain.vo; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lilemy + * @date 2025-09-09 15:14 + */ +@Data +public class WeatherVo implements Serializable { + + @Serial + private static final long serialVersionUID = 6518020416043269221L; + + /** + * 日期 + */ + private String date; + + /** + * 星期 + */ + private String week; + + /** + * 最高温度 + */ + private String tempMax; + + /** + * 最低温度 + */ + private String tempMin; + + /** + * 日出时间 + */ + private String sunRise; + + /** + * 日落时间 + */ + private String sunSet; + + /** + * 白天天气状态 + */ + private String dayStatus; + + /** + * 白天天气图标 + */ + private String dayIcon; + + /** + * 晚上天气状态 + */ + private String nightStatus; + + /** + * 晚上天气图标 + */ + private String nightIcon; +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java new file mode 100644 index 00000000..931737ac --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/EnterpriseBigScreenService.java @@ -0,0 +1,21 @@ +package org.dromara.bigscreen.service; + +import org.dromara.bigscreen.domain.dto.WeatherQueryReq; +import org.dromara.bigscreen.domain.vo.WeatherVo; + +import java.util.List; + +/** + * @author lilemy + * @date 2025-09-09 15:31 + */ +public interface EnterpriseBigScreenService { + + /** + * 获取3天的天气列表 + * + * @param req 查询参数 + * @return 天气列表 + */ + List getWeather3DaysList(WeatherQueryReq req); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java new file mode 100644 index 00000000..d8157d94 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/bigscreen/service/impl/EnterpriseBigScreenServiceImpl.java @@ -0,0 +1,27 @@ +package org.dromara.bigscreen.service.impl; + +import org.dromara.bigscreen.domain.dto.WeatherQueryReq; +import org.dromara.bigscreen.domain.vo.WeatherVo; +import org.dromara.bigscreen.service.EnterpriseBigScreenService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author lilemy + * @date 2025-09-09 15:32 + */ +@Service +public class EnterpriseBigScreenServiceImpl implements EnterpriseBigScreenService { + + /** + * 获取3天的天气列表 + * + * @param req 查询参数 + * @return 天气列表 + */ + @Override + public List getWeather3DaysList(WeatherQueryReq req) { + return List.of(); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/baiduUtil/BaiDuFace.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/baiduUtil/BaiDuFace.java index 481bd9ff..8f8dc798 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/baiduUtil/BaiDuFace.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/common/utils/baiduUtil/BaiDuFace.java @@ -2,6 +2,7 @@ package org.dromara.common.utils.baiduUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.dromara.common.utils.baiduUtil.entity.face.ComparisonRes; import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceReq; import org.dromara.common.utils.baiduUtil.entity.face.HumanFaceRes; @@ -23,6 +24,7 @@ import java.util.List; * @Version 1.0 * 处理百度人脸相关逻辑:人脸检测、人脸对比 */ +@Slf4j @Service public class BaiDuFace { @@ -92,7 +94,8 @@ public class BaiDuFace { // 7. 处理API返回错误 if (faceRep.getErrorCode() != 0) { - throw new RuntimeException("错误码说明:" + faceRep.getErrorMsg()); + log.warn("百度人脸API返回错误码:{}", faceRep.getErrorCode()); + throw new RuntimeException("未检测到有效人脸信息"); } // 8. 验证人脸信息(无人脸时抛出异常) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java index 92fc00f3..6a2d9adb 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/SubConstructionUserController.java @@ -17,10 +17,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; import org.dromara.contractor.domain.dto.constructionuser.*; import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; -import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserAttendanceMonthVo; -import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserAttendanceTotalVo; -import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserGisVo; -import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo; +import org.dromara.contractor.domain.vo.constructionuser.*; import org.dromara.contractor.service.ISubConstructionUserService; import org.dromara.project.domain.dto.project.BusProjectQueryReq; import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq; @@ -30,8 +27,10 @@ import org.dromara.project.domain.vo.projectteam.BusProjectTeamVo; import org.dromara.project.service.IBusProjectService; import org.dromara.project.service.IBusProjectTeamMemberService; import org.dromara.project.service.IBusProjectTeamService; +import org.dromara.system.domain.vo.SysOssVo; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -233,7 +232,34 @@ public class SubConstructionUserController extends BaseController { return R.ok(busProjectTeamMemberService.insertByBo(req)); } + /** + * 根据身份证图片获取身份证信息 + */ + @SaCheckPermission("contractor:constructionUser:add") + @Log(title = "施工人员", businessType = BusinessType.OTHER) + @PostMapping("/idCard") + public R getIdCardMessage(@RequestParam("file") MultipartFile file, String idCardSide) { + return R.ok(constructionUserService.getIdCardMessageByPic(file, idCardSide)); + } + /** + * 根据银行卡图片获取银行卡信息 + */ + @SaCheckPermission("contractor:constructionUser:add") + @Log(title = "施工人员", businessType = BusinessType.OTHER) + @PostMapping("/bankCard") + public R getBankCardMessage(@RequestParam("file") MultipartFile file) { + return R.ok(constructionUserService.getBankCardMessageByPic(file)); + } + /** + * 人脸识别 + */ + @SaCheckPermission("contractor:constructionUser:add") + @Log(title = "施工人员", businessType = BusinessType.OTHER) + @PostMapping("/face/recognize") + public R faceRecognize(@RequestParam("file") MultipartFile file) { + return R.ok(constructionUserService.faceRecognize(file)); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java index 5563649e..ff67b806 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/controller/app/SubConstructionUserAppController.java @@ -15,6 +15,7 @@ import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcB import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserOrcIdCardVo; import org.dromara.contractor.domain.vo.constructionuser.SubConstructionUserVo; import org.dromara.contractor.service.ISubConstructionUserService; +import org.dromara.system.domain.vo.SysOssVo; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -111,6 +112,15 @@ public class SubConstructionUserAppController { return R.ok(constructionUserService.insertByAuthentication(req)); } + /** + * 人脸识别 + */ + @Log(title = "施工人员", businessType = BusinessType.OTHER) + @PostMapping("/face/recognize") + public R faceRecognize(@RequestParam("file") MultipartFile file) { + return R.ok(constructionUserService.faceRecognize(file)); + } + /** * 施工人员人脸比对 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/ISubConstructionUserService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/ISubConstructionUserService.java index 8de9a8a3..7a6e3e0a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/ISubConstructionUserService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/ISubConstructionUserService.java @@ -9,6 +9,7 @@ import org.dromara.contractor.domain.SubConstructionUser; import org.dromara.contractor.domain.dto.constructionuser.*; import org.dromara.contractor.domain.exportvo.BusConstructionUserExportVo; import org.dromara.contractor.domain.vo.constructionuser.*; +import org.dromara.system.domain.vo.SysOssVo; import org.springframework.web.multipart.MultipartFile; import java.util.Collection; @@ -198,6 +199,14 @@ public interface ISubConstructionUserService extends IService lqw = Wrappers.lambdaQuery(SubConstructionUserFile.class) - .eq(SubConstructionUserFile::getUserId, userId); List constructionUserFileList = this.lambdaQuery() .eq(SubConstructionUserFile::getUserId, userId) .list(); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java index 2653ab87..6df151f7 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/contractor/service/impl/SubConstructionUserServiceImpl.java @@ -645,9 +645,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl constructionUserFileLqw = Wrappers.lambdaQuery(SubConstructionUserFile.class) .in(SubConstructionUserFile::getUserId, ids); - boolean removeFile = constructionUserFileService.remove(constructionUserFileLqw); - if (!removeFile) { - throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR); + List fileList = constructionUserFileService.list(constructionUserFileLqw); + if (CollUtil.isNotEmpty(fileList)) { + boolean removeFile = constructionUserFileService.remove(constructionUserFileLqw); + if (!removeFile) { + throw new ServiceException("删除施工人员信息失败,施工人员文件信息删除失败", HttpStatus.ERROR); + } } // 批量删除施工人员信息 return this.removeBatchByIds(ids); @@ -676,7 +679,10 @@ public class SubConstructionUserServiceImpl extends ServiceImpl panelVoList = panelList.stream().map(obj -> diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java index 77db1db7..07bded95 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java @@ -19,10 +19,7 @@ import org.dromara.common.log.annotation.Log; import org.dromara.common.log.enums.BusinessType; import org.dromara.common.web.core.BaseController; import org.dromara.progress.domain.PgsProgressCategory; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq; +import org.dromara.progress.domain.dto.progresscategory.*; import org.dromara.progress.domain.vo.progresscategory.*; import org.dromara.progress.service.IPgsProgressCategoryService; import org.springframework.transaction.annotation.Transactional; @@ -65,10 +62,9 @@ public class PgsProgressCategoryController extends BaseController { * 根据进度父级查询进度类别列表 */ @SaCheckPermission("progress:progressCategory:listByParent") - @GetMapping("/listByParent/{parentId}") - public R> listByParent(@NotNull(message = "项目id不能为空") - @PathVariable Long parentId) { - List list = pgsProgressCategoryService.queryListByParent(parentId); + @GetMapping("/listByParent") + public R> listByParent(PgsProgressCategoryQueryByParentReq req) { + List list = pgsProgressCategoryService.queryListByParent(req); return R.ok(list); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java index d7d5ac6f..a5bc2c04 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java @@ -14,6 +14,7 @@ import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateCreateReq; +import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryByParentReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateUpdateReq; import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo; @@ -60,10 +61,9 @@ public class PgsProgressCategoryTemplateController extends BaseController { * 根据进度父级查询进度类别模版列表 */ @SaCheckPermission("progress:progressCategoryTemplate:listByParent") - @GetMapping("/listByParent/{parentId}") - public R> listByParent(@NotNull(message = "父级类别主键不能为空") - @PathVariable Long parentId) { - List list = pgsProgressCategoryTemplateService.queryListByParent(parentId); + @GetMapping("/listByParent") + public R> listByParent(PgsProgressCategoryTemplateQueryByParentReq req) { + List list = pgsProgressCategoryTemplateService.queryListByParent(req); return R.ok(list); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanController.java index 5f2375c5..b70d7959 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanController.java @@ -6,7 +6,6 @@ import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; import org.dromara.common.core.domain.R; -import org.dromara.common.core.validate.AddGroup; import org.dromara.common.excel.utils.ExcelUtil; import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.log.annotation.Log; @@ -76,7 +75,7 @@ public class PgsProgressPlanController extends BaseController { @Log(title = "进度计划", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() - public R add(@Validated(AddGroup.class) @RequestBody PgsProgressPlanCreateReq req) { + public R add(@Validated @RequestBody PgsProgressPlanCreateReq req) { return R.ok(pgsProgressPlanService.insertByBo(req)); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressCategoryAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressCategoryAppController.java index 13c3aba6..bf46eb3f 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressCategoryAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressCategoryAppController.java @@ -4,7 +4,10 @@ import jakarta.annotation.Resource; import jakarta.validation.constraints.NotNull; import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.domain.R; +import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryByParentReq; +import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryLastTimeVo; import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryTopVo; +import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo; import org.dromara.progress.service.IPgsProgressCategoryService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -39,4 +42,24 @@ public class PgsProgressCategoryAppController { return R.ok(list); } + /** + * 根据进度父级查询进度类别列表 + */ + @GetMapping("/listByParent") + public R> listByParent(PgsProgressCategoryQueryByParentReq req) { + List list = progressCategoryService.queryListByParent(req); + return R.ok(list); + } + + /** + * 获取进度类别最后一次进度信息 + * + * @param id 主键 + */ + @GetMapping("/lastTime/{id}") + public R getLastTimeInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(progressCategoryService.queryLastTimeById(id)); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanAppController.java index 8b6580dd..1f2b22d5 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanAppController.java @@ -1,9 +1,20 @@ package org.dromara.progress.controller.app; +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.annotation.Resource; +import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; +import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq; +import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq; +import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo; +import org.dromara.progress.service.IPgsProgressPlanService; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 进度计划 app 接口 @@ -15,4 +26,26 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/app/progress/progressPlan") public class PgsProgressPlanAppController extends BaseController { + + @Resource + private IPgsProgressPlanService progressPlanService; + + /** + * 查询进度计划列表 + */ + @GetMapping("/list") + public TableDataInfo list(PgsProgressPlanQueryReq req, PageQuery pageQuery) { + return progressPlanService.queryPageList(req, pageQuery); + } + + /** + * 新增进度计划 + */ + @Log(title = "进度计划", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated @RequestBody PgsProgressPlanCreateReq req) { + return R.ok(progressPlanService.insertByBo(req)); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanDetailAppController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanDetailAppController.java index 86e9929b..3c4a3f50 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanDetailAppController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/app/PgsProgressPlanDetailAppController.java @@ -1,9 +1,19 @@ package org.dromara.progress.controller.app; +import jakarta.annotation.Resource; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; +import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq; +import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; +import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo; +import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 进度计划详情 app 接口 @@ -15,4 +25,50 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/app/progress/progressPlanDetail") public class PgsProgressPlanDetailAppController extends BaseController { + + @Resource + private IPgsProgressPlanDetailService progressPlanDetailService; + + /** + * 新增进度计划详情(普通设施) + */ + @RepeatSubmit() + @PostMapping("/insert/detail") + public R insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) { + return toAjax(progressPlanDetailService.insertFinishedDetail(req)); + } + + /** + * 获取进度计划详情已完成设施详细信息 + * + * @param id 主键 + */ + @GetMapping("/detail/finished/{id}") + public TableDataInfo getFinishedDetail(@NotNull(message = "主键不能为空") + @PathVariable Long id, + PageQuery pageQuery) { + return progressPlanDetailService.queryFinishedById(id, pageQuery); + } + + /** + * 获取进度计划详情未完成设施详细信息 + * + * @param id 主键 + */ + @GetMapping("/detail/unFinish/{id}") + public TableDataInfo getUnFinishDetail(@NotNull(message = "主键不能为空") + @PathVariable Long id, + PageQuery pageQuery) { + return progressPlanDetailService.queryUnFinishById(id, pageQuery); + } + + /** + * 删除进度计划详情 + */ + @RepeatSubmit() + @DeleteMapping("/remove/detail") + public R removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) { + return toAjax(progressPlanDetailService.removeDetail(req)); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressPlan.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressPlan.java index 29aaabb9..21066f89 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressPlan.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressPlan.java @@ -8,7 +8,7 @@ import org.dromara.common.mybatis.core.domain.BaseEntity; import java.io.Serial; import java.math.BigDecimal; -import java.util.Date; +import java.time.LocalDate; /** * 进度计划对象 pgs_progress_plan @@ -58,12 +58,12 @@ public class PgsProgressPlan extends BaseEntity { /** * 计划开始时间 */ - private Date startDate; + private LocalDate startDate; /** * 计划结束时间 */ - private Date endDate; + private LocalDate endDate; /** * 计划数量/百分比 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryByParentReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryByParentReq.java new file mode 100644 index 00000000..c255699a --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryByParentReq.java @@ -0,0 +1,27 @@ +package org.dromara.progress.domain.dto.progresscategory; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lilemy + * @date 2025-09-08 16:14 + */ +@Data +public class PgsProgressCategoryQueryByParentReq implements Serializable { + + @Serial + private static final long serialVersionUID = 9086069361042762679L; + + /** + * 父级id + */ + private Long parentId; + + /** + * 类别名称 + */ + private String name; +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryByParentReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryByParentReq.java new file mode 100644 index 00000000..6c5ff6c0 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryByParentReq.java @@ -0,0 +1,27 @@ +package org.dromara.progress.domain.dto.progresscategorytemplate; + +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author lilemy + * @date 2025-09-08 16:21 + */ +@Data +public class PgsProgressCategoryTemplateQueryByParentReq implements Serializable { + + @Serial + private static final long serialVersionUID = -8113409205840032942L; + + /** + * 父类别id + */ + private Long parentId; + + /** + * 类别名称 + */ + private String name; +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanCreateReq.java index 1bdfb0e6..4a75bc21 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanCreateReq.java @@ -1,13 +1,13 @@ package org.dromara.progress.domain.dto.progressplan; -import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto; import java.io.Serial; import java.io.Serializable; import java.math.BigDecimal; -import java.util.Date; +import java.time.LocalDate; import java.util.List; /** @@ -23,6 +23,7 @@ public class PgsProgressPlanCreateReq implements Serializable { /** * 项目id */ + @NotNull(message = "项目id不能为空") private Long projectId; /** @@ -33,28 +34,31 @@ public class PgsProgressPlanCreateReq implements Serializable { /** * 进度类型id */ + @NotNull(message = "进度类型id不能为空") private Long progressCategoryId; /** * 计划开始时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private Date startDate; + @NotNull(message = "计划开始时间不能为空") + private LocalDate startDate; /** * 计划结束时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private Date endDate; + @NotNull(message = "计划结束时间不能为空") + private LocalDate endDate; /** * 计划数量/百分比 */ + @NotNull(message = "计划数量/百分比不能为空") private BigDecimal planNumber; /** * 计划详情列表 */ + @NotNull(message = "计划详情列表不能为空") List detailList; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanQueryReq.java index a66ff54b..249d60c0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplan/PgsProgressPlanQueryReq.java @@ -1,11 +1,10 @@ package org.dromara.progress.domain.dto.progressplan; -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; import java.io.Serializable; -import java.util.Date; +import java.time.LocalDate; /** * @author lilemy @@ -35,13 +34,11 @@ public class PgsProgressPlanQueryReq implements Serializable { /** * 计划开始时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private Date startDate; + private LocalDate startDate; /** * 计划结束时间 */ - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") - private Date endDate; + private LocalDate endDate; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java index 116de182..40c5fac1 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java @@ -1,12 +1,11 @@ package org.dromara.progress.domain.vo.progresscategory; -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; import java.io.Serializable; import java.math.BigDecimal; -import java.util.Date; +import java.time.LocalDate; /** * @author lilemy @@ -21,8 +20,7 @@ public class PgsProgressCategoryLastTimeVo implements Serializable { /** * 计划结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - private Date endDate; + private LocalDate endDate; /** * 剩余数量 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategorySecondVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategorySecondVo.java index 2f4b8cea..be080715 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategorySecondVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategorySecondVo.java @@ -15,5 +15,19 @@ public class PgsProgressCategorySecondVo implements Serializable { @Serial private static final long serialVersionUID = 5297363236416903392L; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + + /** + * 主键id + */ + private Long id; + + /** + * 类别名称 + */ + private String name; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progressplan/PgsProgressPlanVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progressplan/PgsProgressPlanVo.java index 544d0b26..46aa2b5f 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progressplan/PgsProgressPlanVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progressplan/PgsProgressPlanVo.java @@ -2,7 +2,6 @@ package org.dromara.progress.domain.vo.progressplan; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.fasterxml.jackson.annotation.JsonFormat; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import org.dromara.progress.domain.PgsProgressPlan; @@ -11,7 +10,7 @@ import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNu import java.io.Serial; import java.io.Serializable; import java.math.BigDecimal; -import java.util.Date; +import java.time.LocalDate; import java.util.List; @@ -50,16 +49,14 @@ public class PgsProgressPlanVo implements Serializable { /** * 计划开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") @ExcelProperty(value = "计划开始时间") - private Date startDate; + private LocalDate startDate; /** * 计划结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") @ExcelProperty(value = "计划结束时间") - private Date endDate; + private LocalDate endDate; /** * 计划数量/百分比 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java index af9c4cca..3aed1c89 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java @@ -4,10 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.IService; import org.dromara.facility.domain.FacMatrix; import org.dromara.progress.domain.PgsProgressCategory; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq; +import org.dromara.progress.domain.dto.progresscategory.*; import org.dromara.progress.domain.vo.progresscategory.*; import java.math.BigDecimal; @@ -42,10 +39,10 @@ public interface IPgsProgressCategoryService extends IService queryListByParent(Long parentId); + List queryListByParent(PgsProgressCategoryQueryByParentReq req); /** * 查询设施剩余数量 @@ -176,6 +173,14 @@ public interface IPgsProgressCategoryService extends IService getLeafNodesByTopIds(List topIds); + /** + * 获取子节点(支持多个顶级id) + * + * @param topIds 顶级节点id集合 + * @return 子节点 + */ + List getChildrenNodeByTopIds(List topIds); + /** * 获取项目进度百分比 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java index 16d7694a..8e265627 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java @@ -7,6 +7,7 @@ import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.progress.domain.PgsProgressCategoryTemplate; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateCreateReq; +import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryByParentReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateUpdateReq; import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo; @@ -50,10 +51,10 @@ public interface IPgsProgressCategoryTemplateService extends IService queryListByParent(Long parentId); + List queryListByParent(PgsProgressCategoryTemplateQueryByParentReq req); /** * 新增进度类别模版 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java index e79ddc3e..444a6942 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java @@ -12,7 +12,6 @@ import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; -import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.utils.BigDecimalUtil; @@ -24,10 +23,7 @@ import org.dromara.progress.domain.PgsProgressCategory; import org.dromara.progress.domain.PgsProgressCategoryTemplate; import org.dromara.progress.domain.PgsProgressPlan; import org.dromara.progress.domain.PgsProgressPlanDetail; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreatePriceReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryCreateReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryQueryReq; -import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdateReq; +import org.dromara.progress.domain.dto.progresscategory.*; import org.dromara.progress.domain.enums.PgsCoordinateTypeEnum; import org.dromara.progress.domain.enums.PgsFinishStatusEnum; import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum; @@ -51,6 +47,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -139,13 +136,16 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl queryListByParent(Long parentId) { + public List queryListByParent(PgsProgressCategoryQueryByParentReq req) { + Long parentId = req.getParentId(); + String name = req.getName(); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.apply("FIND_IN_SET({0}, ancestors)", parentId); + queryWrapper.apply(parentId != null, "FIND_IN_SET({0}, ancestors)", parentId); + queryWrapper.like(StringUtils.isNotBlank(name), "name", name); return this.getVoList(this.list(queryWrapper)); } @@ -175,13 +175,11 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl getTopListByProjectId(Long subProjectId) { + // 查询该子项目下的顶级进度类别(父ID为0) List list = this.lambdaQuery() .eq(PgsProgressCategory::getProjectId, subProjectId) .eq(PgsProgressCategory::getParentId, PgsProgressCategoryConstant.TOP_PARENT_ID) .list(); + // 如果没有查询到顶级进度类别,直接返回空集合 if (CollUtil.isEmpty(list)) { return List.of(); } List topList = new ArrayList<>(); - // 获取关联子项的数据 + // 获取这些顶级类别的所有子节点 + List ids = list.stream().map(PgsProgressCategory::getId).distinct().toList(); + List childrenNodes = this.getChildrenNodeByTopIds(ids); + // ============================= 处理关联子项目的数据 ============================= + // 筛选出关联子项目的顶级类别 List subList = list.stream() .filter(category -> category.getRelevancyStructure().equals(PgsRelevancyStructureEnum.SUB_PROJECT.getValue())) .toList(); if (CollUtil.isNotEmpty(subList)) { - List topIds = subList.stream().map(PgsProgressCategory::getId).distinct().toList(); - List leafNodesByTopIds = this.getLeafNodesByTopIds(topIds); + // 将子项目类别转换为VO对象 List subVoList = subList.stream().map(category -> { - PgsProgressCategoryTopVo vo = new PgsProgressCategoryTopVo(); - BeanUtils.copyProperties(category, vo); - List children = leafNodesByTopIds.stream() + PgsProgressCategoryTopVo topVo = new PgsProgressCategoryTopVo(); + // 属性拷贝 + BeanUtils.copyProperties(category, topVo); + // 统计深度 + AtomicInteger count = new AtomicInteger(1); + // 找出当前类别对应的所有叶子节点(根据 ancestors 字段包含关系) + List children = childrenNodes.stream() .filter(node -> { - Set ancestorSet = Arrays.stream(node.getAncestors().split(",")).map(Long::parseLong).collect(Collectors.toSet()); - return ancestorSet.contains(category.getId()); - }) - .toList(); + Set ancestorSet = Arrays.stream(node.getAncestors().split(",")) + .map(Long::parseLong) + .collect(Collectors.toSet()); + boolean result = ancestorSet.contains(category.getId()); + if (result) { + count.set(Math.max(ancestorSet.size(), count.get())); + } + return result; + }).toList(); + // 如果有子级,统计总进度和状态;否则初始化为未完成 if (CollUtil.isNotEmpty(children)) { - vo.setProgressTotal(this.getCompletedPercentage(children)); - vo.setStatus(this.getParentStatus(children)); + topVo.setProgressTotal(this.getCompletedPercentage(children)); + topVo.setStatus(this.getParentStatus(children)); + if (count.get() == 2) { + topVo.setType("1"); + } else if (count.get() == 3) { + topVo.setType("2"); + List second = children.stream() + .filter(node -> { + Set ancestorSet = Arrays.stream(node.getAncestors().split(",")) + .map(Long::parseLong) + .collect(Collectors.toSet()); + return ancestorSet.size() == 2; + }).map(node -> { + PgsProgressCategorySecondVo vo = new PgsProgressCategorySecondVo(); + BeanUtils.copyProperties(node, vo); + return vo; + }) + .toList(); + topVo.setCategorySecondList(second); + } } else { - vo.setProgressTotal(BigDecimal.ZERO); + topVo.setProgressTotal(BigDecimal.ZERO); + topVo.setStatus(PgsFinishStatusEnum.UNFINISH.getValue()); + topVo.setType("1"); } - return vo; + return topVo; }).toList(); + // 将处理好的子项目VO加入结果集 topList.addAll(subVoList); } - // 获取关联方阵数据 + // ============================= 处理关联方阵的数据 ============================= + // 筛选出关联方阵的顶级类别 List matrixList = list.stream() .filter(category -> category.getRelevancyStructure().equals(PgsRelevancyStructureEnum.MATRIX.getValue())) .toList(); if (CollUtil.isNotEmpty(matrixList)) { + // 按名称分组(同名的放在一起) Map> matrixMap = matrixList.stream() .collect(Collectors.groupingBy(PgsProgressCategory::getName)); for (Map.Entry> entry : matrixMap.entrySet()) { PgsProgressCategoryTopVo topVo = new PgsProgressCategoryTopVo(); topVo.setName(entry.getKey()); topVo.setRelevancyStructure(PgsRelevancyStructureEnum.MATRIX.getValue()); + // 取分组中的第一条记录的排序字段作为当前VO的排序值 List value = entry.getValue(); topVo.setSort(value.getFirst().getSort()); + // 转换为方阵结构的VO列表 List matrixVoList = value.stream().map(category -> { PgsProgressCategoryMatrixStructureTopVo vo = new PgsProgressCategoryMatrixStructureTopVo(); BeanUtils.copyProperties(category, vo); return vo; }).toList(); topVo.setMatrixStructureList(matrixVoList); - // 获取所有子级,并进行统计 + // 统计深度 + AtomicInteger count = new AtomicInteger(1); + // 获取这些类别下的所有叶子节点 List topIds = value.stream().map(PgsProgressCategory::getId).distinct().toList(); - List leafNodesByTopIds = this.getLeafNodesByTopIds(topIds); + List leafNodesByTopIds = childrenNodes.stream() + .filter(node -> { + Set ancestorSet = Arrays.stream(node.getAncestors().split(",")) + .map(Long::parseLong) + .collect(Collectors.toSet()); + boolean result = topIds.stream().anyMatch(ancestorSet::contains); + if (result) { + count.set(Math.max(ancestorSet.size(), count.get())); + } + return result; + }).toList(); + // 如果有叶子节点,统计进度和状态;否则初始化为未完成 if (CollUtil.isNotEmpty(leafNodesByTopIds)) { topVo.setProgressTotal(this.getCompletedPercentage(leafNodesByTopIds)); topVo.setStatus(this.getParentStatus(leafNodesByTopIds)); + if (count.get() == 2) { + topVo.setType("3"); + } else if (count.get() == 3) { + topVo.setType("4"); + List second = leafNodesByTopIds.stream() + .filter(node -> { + Set ancestorSet = Arrays.stream(node.getAncestors().split(",")) + .map(Long::parseLong) + .collect(Collectors.toSet()); + return ancestorSet.size() == 2; + }).map(node -> { + PgsProgressCategorySecondVo vo = new PgsProgressCategorySecondVo(); + BeanUtils.copyProperties(node, vo); + return vo; + }) + .toList(); + topVo.setCategorySecondList(second); + } } else { topVo.setProgressTotal(BigDecimal.ZERO); + topVo.setStatus(PgsFinishStatusEnum.UNFINISH.getValue()); + topVo.setType("3"); } + // 加入结果集 topList.add(topVo); } } + // ============================= 排序 & 返回结果 ============================= + // 按 sort 字段升序排序 topList.sort(Comparator.comparing(PgsProgressCategoryTopVo::getSort)); return topList; } @@ -1214,12 +1288,32 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl getLeafNodesByTopIds(List topIds) { - if (topIds == null || topIds.isEmpty()) { + List allChildren = this.getChildrenNodeByTopIds(topIds); + if (allChildren.isEmpty()) { return Collections.emptyList(); } + // 过滤掉那些还有子节点的,只保留最底层 + Set parentIds = allChildren.stream() + .map(PgsProgressCategory::getParentId) + .collect(Collectors.toSet()); + return allChildren.stream() + .filter(item -> !parentIds.contains(item.getId())) // 没有被当作别人父id的,就是叶子节点 + .toList(); + } - // 1. 查出所有属于这些顶级节点的子孙节点 - List allChildren = this.list( + /** + * 获取子节点(支持多个顶级id) + * + * @param topIds 顶级节点id集合 + * @return 子节点 + */ + @Override + public List getChildrenNodeByTopIds(List topIds) { + if (CollUtil.isEmpty(topIds)) { + return Collections.emptyList(); + } + // 查出所有属于这些顶级节点的子孙节点 + return this.list( Wrappers.lambdaQuery() .and(wrapper -> { for (Long topId : topIds) { @@ -1228,19 +1322,6 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl parentIds = allChildren.stream() - .map(PgsProgressCategory::getParentId) - .collect(Collectors.toSet()); - - return allChildren.stream() - .filter(item -> !parentIds.contains(item.getId())) // 没有被当作别人父id的,就是叶子节点 - .toList(); } /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java index 14aca3ba..56fbfc16 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java @@ -18,6 +18,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.progress.constant.PgsProgressCategoryConstant; import org.dromara.progress.domain.PgsProgressCategoryTemplate; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateCreateReq; +import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryByParentReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateQueryReq; import org.dromara.progress.domain.dto.progresscategorytemplate.PgsProgressCategoryTemplateUpdateReq; import org.dromara.progress.domain.vo.progresscategorytemplate.PgsProgressCategoryTemplateVo; @@ -89,13 +90,16 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl queryListByParent(Long parentId) { + public List queryListByParent(PgsProgressCategoryTemplateQueryByParentReq req) { + Long parentId = req.getParentId(); + String name = req.getName(); QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.apply("FIND_IN_SET({0}, ancestors)", parentId); + queryWrapper.apply(parentId != null, "FIND_IN_SET({0}, ancestors)", parentId); + queryWrapper.like(StringUtils.isNotBlank(name), "name", name); return this.list(queryWrapper).stream().map(this::getVo).toList(); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java index 727f11d9..1e56bd16 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java @@ -38,7 +38,6 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -119,10 +118,10 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl 完成数量 planFinishSum = planFinishSum.add(finishedNumber); } else { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysOssService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysOssService.java index 0a1fbd8f..5b9fc79d 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysOssService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysOssService.java @@ -61,7 +61,7 @@ public interface ISysOssService { * @param filePath 文件路径 * @return 上传成功后的 SysOssVo 对象,包含文件信息 */ - SysOssVo upload(MultipartFile file,String filePath); + SysOssVo upload(MultipartFile file, String filePath); /** * 上传 MultipartFile 到对象存储服务,不保存文件信息到数据库 diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/websocket/ChatServer.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/websocket/ChatServer.java index 462d7a04..4131cfab 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/websocket/ChatServer.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/websocket/ChatServer.java @@ -23,7 +23,7 @@ import org.springframework.stereotype.Component; @Slf4j @Configuration public class ChatServer { - private final int port = 9099; // 聊天服务器端口 + private final int port = 19099; // 聊天服务器端口 private EventLoopGroup bossGroup; private EventLoopGroup workerGroup;