[新增] 审批历史的时间

This commit is contained in:
bupengxiang
2023-04-26 10:29:01 +08:00
parent 8ee3f2b86b
commit 7819bc6c0c
2 changed files with 29 additions and 10 deletions
@@ -28,10 +28,13 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import static com.adc.da.wkflow.util.date.DateTools.disposeApprovalTime;
@Api(tags = "流程明细管理")
@RestController
@RequestMapping("/${restPath}/task")
@@ -58,7 +61,7 @@ public class TaskController {
@ApiOperation(value = "流程实例明细列表")
@ApiImplicitParam(name = "prcNum", value = "流程实例id")
@GetMapping("/get_list_by_instance")
public List<Map<String, Object>> get_list_by_instance(String prcNum,String sortWord,String shunxu) {
public List<Map<String, Object>> get_list_by_instance(String prcNum,String sortWord,String shunxu) throws ParseException {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("PRC_NUM",prcNum);
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
@@ -130,11 +133,17 @@ public class TaskController {
historicTaskInstance.put("approvalResult",formValsJsonMap.get("flag")!=null ? formValsJsonMap.get("flag"):"");
historicTaskInstance.put("approvalFile",formValsJsonMap.get("approvalFile")!=null ? formValsJsonMap.get("approvalFile"):"");
}
Date createTime = (Date) historicTaskInstance.get("createTime");
Date endTime = (Date) historicTaskInstance.get("endTime");
if(endTime!=null){
long approvalTime = disposeApprovalTime(createTime,endTime);
historicTaskInstance.put("approvalTime",approvalTime + "小时");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date createTime = sdf.parse((String)historicTaskInstance.get("createTime"));
Object endTime1 = historicTaskInstance.get("endTime");
if(endTime1!=null){
Date endTime = sdf.parse((String)endTime1);
// long approvalTime = disposeApprovalTime(createTime,endTime);
LocalDateTime startDateTime = LocalDateTime.ofInstant(createTime.toInstant(), ZoneId.systemDefault());
LocalDateTime endDateTime = LocalDateTime.ofInstant(endTime.toInstant(), ZoneId.systemDefault());
long days = Duration.between(startDateTime.toLocalDate().atStartOfDay(), endDateTime.toLocalDate().atStartOfDay()).toDays() + 1;
historicTaskInstance.put("approvalTime",days + "");
}
}
if(StringUtils.isNotBlank(sortWord)){
@@ -10,6 +10,9 @@ import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -177,12 +180,19 @@ public class ActivitiTools {
map.put("assignee", model.getAssignee());
map.put("category", model.getCategory());
map.put("claimTime", model.getClaimTime());
map.put("createTime", model.getCreateTime());
LocalDateTime dt = LocalDateTime.ofInstant(model.getCreateTime().toInstant(), ZoneId.systemDefault());
String createTime = dt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
map.put("createTime",createTime);
map.put("deleteReason", model.getDeleteReason());
map.put("description", model.getDescription());
map.put("dueDate", model.getDueDate());
map.put("drationInMillis", model.getDurationInMillis());
map.put("endTime", model.getEndTime());
String endTime = null;
if (model.getEndTime() != null){
LocalDateTime end = LocalDateTime.ofInstant(model.getEndTime().toInstant(), ZoneId.systemDefault());
endTime = end.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
}
map.put("endTime", endTime);
map.put("executionId", model.getExecutionId());
map.put("formKey", model.getFormKey());
map.put("id", model.getId());