From 4dba0eecc69d8d973e197e200440f00f2180811e Mon Sep 17 00:00:00 2001 From: dimengzhe <251008545@qq.com> Date: Thu, 28 Jul 2022 19:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../anrui/terminal/biz/app/AppService.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/app/AppService.java b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/app/AppService.java index 5809ec728c..344ff05e4f 100644 --- a/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/app/AppService.java +++ b/anrui-terminal/anrui-terminal-biz/src/main/java/com/yxt/anrui/terminal/biz/app/AppService.java @@ -1,17 +1,19 @@ package com.yxt.anrui.terminal.biz.app; import com.alibaba.fastjson.JSON; +import com.yxt.anrui.flowable.api.flowcomment.FlowComment; import com.yxt.anrui.flowable.api.flowtask.FlowRecordVo; import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; +import com.yxt.anrui.terminal.api.app.flowable.AppFlowCommentVo; import com.yxt.anrui.terminal.api.app.flowable.AppFlowableRecordQuery; import com.yxt.anrui.terminal.api.app.flowable.AppFlowableRecordVo; +import com.yxt.common.base.utils.StringUtils; import com.yxt.common.core.result.ResultBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; +import java.text.SimpleDateFormat; +import java.util.*; import java.util.stream.Collectors; /** @@ -27,10 +29,31 @@ public class AppService { public ResultBean> getProgressList(AppFlowableRecordQuery appFlowableRecordQuery) { ResultBean> rb = ResultBean.fireFail(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String procInsId = appFlowableRecordQuery.getProcInsId(); String deployId = appFlowableRecordQuery.getDeployId(); - ResultBean resultBean = flowTaskFeign.businessFlowRecord(procInsId,deployId); + ResultBean resultBean = flowTaskFeign.businessFlowRecord(procInsId, deployId); List voList = Optional.ofNullable(resultBean.getData().getFlowList()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), AppFlowableRecordVo.class)).collect(Collectors.toList()); + voList.removeAll(Collections.singleton(null)); + for (AppFlowableRecordVo vo : voList) { + String time = vo.getTime(); + if (StringUtils.isNotBlank(time)) { + AppFlowCommentVo commentVo = vo.getComment(); + //类型 + String type = commentVo.getType(); + String comment = commentVo.getComment(); + vo.setContent(comment); + String stateValue = FlowComment.getRemarkByType(type); + if (StringUtils.isNotBlank(stateValue)) { + vo.setStateValue(stateValue); + } + if (StringUtils.isNotBlank(type)) { + vo.setStateKey(type); + } + } + vo.setTime(sdf.format(new Date(Long.parseLong(time)))); + vo.setCreateTime(sdf.format(new Date(Long.parseLong(vo.getCreateTime())))); + } return rb.success().setData(voList); } }