From 236c1ce888d262e56340b9898ebe9405319b6688 Mon Sep 17 00:00:00 2001 From: lcj <2331845269@qq.com> Date: Thu, 21 Aug 2025 00:49:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xinnengyuan/.gitignore | 1 + .../src/main/resources/application-local.yml | 2 +- .../src/main/resources/application-prod.yml | 3 ++ .../dromara/common/core/utils/DateUtils.java | 16 +++++++ .../bo/BusFormalitiesAreConsolidatedBo.java | 21 ++++---- ...FormalitiesAreConsolidatedServiceImpl.java | 48 +++++++++---------- .../PgsProgressCategoryController.java | 6 +-- .../PgsProgressCategoryCreatePriceReq.java | 2 + .../impl/PgsProgressCategoryServiceImpl.java | 13 +++++ .../workflow/domain/vo/FlowHisTaskVo.java | 7 +++ 10 files changed, 77 insertions(+), 42 deletions(-) diff --git a/xinnengyuan/.gitignore b/xinnengyuan/.gitignore index 7ee651bd..ac541149 100644 --- a/xinnengyuan/.gitignore +++ b/xinnengyuan/.gitignore @@ -52,3 +52,4 @@ nbdist/ logs/ docs /file +.idea/ diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml index 7b75c20d..790bc814 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application-local.yml @@ -289,4 +289,4 @@ recognizer: url: http://192.168.110.5:50070 qrCode: - url: http://192.168.110.151:7788 + url: http://xny.yj-3d.com:7171 diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml index 7e1a9dcf..847eb1be 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application-prod.yml @@ -287,3 +287,6 @@ id-card: encrypt-key: 7ae260d150a14027d2238a1cf80a48ef recognizer: url: http://192.168.110.5:50070 + +qrCode: + url: http://xny.yj-3d.com:7788 diff --git a/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java b/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java index fcf65000..533e6653 100644 --- a/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java +++ b/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java @@ -10,6 +10,7 @@ import java.text.SimpleDateFormat; import java.time.*; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; +import java.time.temporal.ChronoUnit; import java.util.Date; import java.util.concurrent.TimeUnit; @@ -209,6 +210,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24))); } + /** + * 计算两个日期之间的时间差 + * + * @param date1 第一个日期 + * @param date2 第二个日期 + * @param unit 时间单位(支持:ChronoUnit.DAYS, ChronoUnit.HOURS, ChronoUnit.MINUTES, ChronoUnit.SECONDS) + * @return 时间差(可能为负数,如果要绝对值可以再 Math.abs) + */ + public static long difference(Date date1, Date date2, ChronoUnit unit) { + // 转换成 Instant 再计算 + Instant instant1 = date1.toInstant(); + Instant instant2 = date2.toInstant(); + return unit.between(instant1, instant2); + } + /** * 计算两个日期之间的时间差,并以天、小时和分钟的格式返回 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/domain/bo/BusFormalitiesAreConsolidatedBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/domain/bo/BusFormalitiesAreConsolidatedBo.java index 4859dc08..ee6f9399 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/domain/bo/BusFormalitiesAreConsolidatedBo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/domain/bo/BusFormalitiesAreConsolidatedBo.java @@ -1,21 +1,17 @@ package org.dromara.formalities.domain.bo; -import org.dromara.formalities.domain.BusFormalitiesAreConsolidated; -import org.dromara.common.mybatis.core.domain.BaseEntity; -import org.dromara.common.core.validate.AddGroup; -import org.dromara.common.core.validate.EditGroup; import io.github.linpeilie.annotations.AutoMapper; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.EqualsAndHashCode; -import jakarta.validation.constraints.*; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.formalities.domain.BusFormalitiesAreConsolidated; import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.Date; import java.util.List; -import com.fasterxml.jackson.annotation.JsonFormat; - /** * 合规性手续合账业务对象 bus_formalities_are_consolidated * @@ -30,13 +26,13 @@ public class BusFormalitiesAreConsolidatedBo extends BaseEntity { /** * */ - @NotNull(message = "不能为空", groups = { EditGroup.class }) + @NotNull(message = "不能为空", groups = {EditGroup.class}) private Long id; /** * 项目id */ - @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + @NotNull(message = "不能为空", groups = {AddGroup.class, EditGroup.class}) private Long projectId; /** @@ -78,7 +74,7 @@ public class BusFormalitiesAreConsolidatedBo extends BaseEntity { /** * 实际完成时间 */ - private Date actualCompletionTime; + private LocalDate actualCompletionTime; /** * 办理状态 @@ -86,7 +82,6 @@ public class BusFormalitiesAreConsolidatedBo extends BaseEntity { private String processingStatus; - /** * 状态 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/service/impl/BusFormalitiesAreConsolidatedServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/service/impl/BusFormalitiesAreConsolidatedServiceImpl.java index c3e713ac..735cc635 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/service/impl/BusFormalitiesAreConsolidatedServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/formalities/service/impl/BusFormalitiesAreConsolidatedServiceImpl.java @@ -1,37 +1,35 @@ package org.dromara.formalities.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; -import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import lombok.RequiredArgsConstructor; +import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.formalities.domain.BusFormalitiesAnnex; +import org.dromara.formalities.domain.BusFormalitiesAreConsolidated; import org.dromara.formalities.domain.BusListOfFormalities; import org.dromara.formalities.domain.bo.AddBusFormalitiesAreConsolidatedBo; -import org.dromara.formalities.enums.FormalitiesStatusEnum; -import org.dromara.formalities.service.IBusFormalitiesAnnexService; -import org.dromara.formalities.service.IBusListOfFormalitiesService; -import org.dromara.formalities.utils.TreeUtil; -import org.dromara.system.domain.vo.SysOssUploadVo; -import org.dromara.system.service.ISysOssService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import org.dromara.formalities.domain.bo.BusFormalitiesAreConsolidatedBo; import org.dromara.formalities.domain.vo.BusFormalitiesAreConsolidatedVo; -import org.dromara.formalities.domain.BusFormalitiesAreConsolidated; +import org.dromara.formalities.enums.FormalitiesStatusEnum; import org.dromara.formalities.mapper.BusFormalitiesAreConsolidatedMapper; +import org.dromara.formalities.service.IBusFormalitiesAnnexService; import org.dromara.formalities.service.IBusFormalitiesAreConsolidatedService; -import org.springframework.web.multipart.MultipartFile; +import org.dromara.formalities.service.IBusListOfFormalitiesService; +import org.dromara.formalities.utils.TreeUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; import java.util.*; -import static org.dromara.common.constant.MinioPathConstant.FormalitiesAnnex; - /** * 合规性手续合账Service业务层处理 * @@ -58,7 +56,7 @@ public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; @@ -208,7 +206,7 @@ public class BusFormalitiesAreConsolidatedServiceImpl extends ServiceImpl getCoordinate(@NotNull(message = "主键不能为空") @PathVariable Long id) { @@ -89,7 +89,7 @@ public class PgsProgressCategoryController extends BaseController { * * @param projectId 项目主键 */ - @SaCheckPermission("progress:progressCategory:query") + @SaCheckPermission("progress:progressCategory:projectNumber") @GetMapping("/project/number/{projectId}") public R getProjectNumber(@NotNull(message = "项目主键不能为空") @PathVariable Long projectId) { @@ -101,7 +101,7 @@ public class PgsProgressCategoryController extends BaseController { * * @param id 主键 */ - @SaCheckPermission("progress:progressCategory:query") + @SaCheckPermission("progress:progressCategory:lastTime") @GetMapping("/lastTime/{id}") public R getLastTimeInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java index 492257d3..620f79c9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java @@ -1,5 +1,6 @@ package org.dromara.progress.domain.dto.progresscategory; +import jakarta.validation.constraints.NotNull; import lombok.Data; import java.math.BigDecimal; @@ -14,6 +15,7 @@ public class PgsProgressCategoryCreatePriceReq { /** * 类别id */ + @NotNull(message = "类别id不能为空") private Long id; /** 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 578028a1..0073ae87 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 @@ -345,6 +345,19 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl ids, Boolean isValid) { // todo 添加校验 + Long count = this.lambdaQuery() + .in(PgsProgressCategory::getParentId, ids) + .count(); + if (count > 0) { + throw new ServiceException("请先删除子进度类别", HttpStatus.BAD_REQUEST); + } + List categoryList = this.listByIds(ids); + for (PgsProgressCategory category : categoryList) { + BigDecimal completed = category.getCompleted(); + if (completed != null && completed.compareTo(BigDecimal.ZERO) > 0) { + throw new ServiceException("该分类已有完成数量,无法删除", HttpStatus.BAD_REQUEST); + } + } return this.removeBatchByIds(ids); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/FlowHisTaskVo.java b/xinnengyuan/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/FlowHisTaskVo.java index 8776a76b..1814767a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/FlowHisTaskVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/domain/vo/FlowHisTaskVo.java @@ -9,6 +9,7 @@ import org.dromara.workflow.common.constant.FlowConstant; import java.io.Serial; import java.io.Serializable; +import java.time.temporal.ChronoUnit; import java.util.Date; import java.util.List; @@ -203,6 +204,11 @@ public class FlowHisTaskVo implements Serializable { */ private String runDuration; + /** + * 运行时长数字 + */ + private Long runDurationNum; + /** * 设置创建时间并计算任务运行时长 * @@ -230,6 +236,7 @@ public class FlowHisTaskVo implements Serializable { // 如果创建时间和更新时间均不为空,计算它们之间的时长 if (this.updateTime != null && this.createTime != null) { this.runDuration = DateUtils.getTimeDifference(this.updateTime, this.createTime); + this.runDurationNum = DateUtils.difference(this.createTime, this.updateTime, ChronoUnit.SECONDS); } }