From 6e22e9929f1bc362041dd58ffbcadfb2a5ff946d Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Wed, 12 Oct 2022 16:08:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8E=86=E5=8F=B2=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=95=BF=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HistoryController.java | 2 +- .../activiti/dto/HistoryDetailDTO.java | 4 ++-- .../activiti/entity/HistoryDetailEntity.java | 2 +- .../activiti/service/ActivitiService.java | 2 ++ .../service/impl/ActivitiServiceImpl.java | 22 ++++++++++++++++++- .../TAbilityApplicationController.java | 2 +- .../mapper/device/TbDeviceApplyDao.xml | 2 ++ 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java index 0ce4d102..df5076df 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/HistoryController.java @@ -169,7 +169,7 @@ public class HistoryController { detailDTO.setActivityType(""); detailDTO.setStartTime(task.getCreateTime()); detailDTO.setEndTime(null); - detailDTO.setDurationInSeconds(null); + detailDTO.setDuration(""); detailDTO.setExecutionId(task.getExecutionId()); detailDTO.setProcessDefinitionId(task.getProcessDefinitionId()); detailDTO.setComment("待审核"); diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/dto/HistoryDetailDTO.java b/renren-admin/src/main/java/io/renren/modules/activiti/dto/HistoryDetailDTO.java index 615fdea8..465c68b5 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/dto/HistoryDetailDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/dto/HistoryDetailDTO.java @@ -45,8 +45,8 @@ public class HistoryDetailDTO { @ApiModelProperty(value = "结束时间") private Date endTime; - @ApiModelProperty(value = "时长(秒)") - private Long durationInSeconds; + @ApiModelProperty(value = "时长") + private String duration; @ApiModelProperty(value = "审批意见") private String comment; diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/entity/HistoryDetailEntity.java b/renren-admin/src/main/java/io/renren/modules/activiti/entity/HistoryDetailEntity.java index 4716e91e..4f2cef35 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/entity/HistoryDetailEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/entity/HistoryDetailEntity.java @@ -33,7 +33,7 @@ public class HistoryDetailEntity { private Date endTime; - private Long durationInSeconds; + private String duration; private String comment; diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActivitiService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActivitiService.java index 4a1ffe93..87339659 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActivitiService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActivitiService.java @@ -22,4 +22,6 @@ public interface ActivitiService extends BaseService { Page getDeptProcessInstancePage(Map params); List getTaskHandleDetailInfo(String processInstanceId); + + String getDurationInSecond(Long second); } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ActivitiServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ActivitiServiceImpl.java index c74cca65..4d282bbc 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ActivitiServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/impl/ActivitiServiceImpl.java @@ -18,6 +18,7 @@ import io.renren.modules.sys.service.SysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -81,9 +82,28 @@ public class ActivitiServiceImpl extends BaseServiceImpl0){ + builder.append(duration.toDays()+"d "); + builder.append(duration.minus(Duration.ofDays(duration.toDays())).toHours()+"h"); + }else if(duration.toHours()>0){ + builder.append(duration.toHours()+"h "); + builder.append(duration.minus(Duration.ofHours(duration.toHours())).toMinutes()+"m"); + }else if(duration.toMinutes()>0){ + builder.append(duration.toMinutes()+"m "); + builder.append(duration.minus(Duration.ofMinutes(duration.toMinutes())).getSeconds()+"s"); + }else { + builder.append(second+"s"); + } + return builder.toString(); + } } diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index 58e1f9b8..e73d3b5a 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -290,7 +290,7 @@ public class TAbilityApplicationController { detailDTO.setActivityType(""); detailDTO.setStartTime(task.getCreateTime()); detailDTO.setEndTime(null); - detailDTO.setDurationInSeconds(null); + detailDTO.setDuration(""); detailDTO.setExecutionId(task.getExecutionId()); detailDTO.setProcessDefinitionId(task.getProcessDefinitionId()); detailDTO.setComment("待审核"); diff --git a/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml b/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml index cf4f2ef8..bb378276 100644 --- a/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml +++ b/renren-admin/src/main/resources/mapper/device/TbDeviceApplyDao.xml @@ -15,6 +15,7 @@ #{item} + order by create_date desc \ No newline at end of file