From 11a1a4aaf32a516a9499add4d912f9244a5e370c Mon Sep 17 00:00:00 2001 From: yitonglei Date: Fri, 17 Feb 2023 18:02:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=A6=96=E9=A1=B5"=E7=A7=8D=E7=B1=BB?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1"=E8=BF=94=E5=9B=9E=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A2=9E=E5=8A=A0=E9=A2=9C=E8=89=B2=202.=E6=8A=80?= =?UTF-8?q?=E6=9C=AF=E5=91=98=E5=8F=91=E8=B5=B7=E7=9A=84=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BC=80=E5=90=AF=E6=B5=81=E7=A8=8B=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9B=B4=E6=8E=A5=E6=8C=87=E5=AE=9A=E8=BF=90?= =?UTF-8?q?=E7=BB=B4=E5=85=AC=E5=8F=B8=203.=E5=AE=A1=E6=89=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E6=97=B6=E5=80=99=E5=A2=9E=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E4=B9=9F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=B0=E6=B5=81=E7=A8=8B=E5=8F=98=E9=87=8F=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homepage/enumutil/TaskTypeColorEnum.java | 46 +++++++++++++++++++ .../service/impl/HomePageServiceImpl.java | 21 +++++---- .../workflow/process/model/WfProcess.java | 2 + .../service/impl/WfProcessService.java | 5 ++ 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/enumutil/TaskTypeColorEnum.java diff --git a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/enumutil/TaskTypeColorEnum.java b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/enumutil/TaskTypeColorEnum.java new file mode 100644 index 0000000..ad6cf66 --- /dev/null +++ b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/enumutil/TaskTypeColorEnum.java @@ -0,0 +1,46 @@ +package org.springblade.plugin.homepage.enumutil; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Description 首页种类统计,饼图中不同类型对应的颜色 + * @Author ytl + * @Date 2023/2/17 0017 17:10 + */ +public enum TaskTypeColorEnum { + 数据管理("1624972213268574210", "#2689FF"), + 网络终端维护("1624972340112715778", "#6F33FF"), + 办公系统维护("1624972396853260289", "#2356F7"), + 系统优化("1624972448317370369", "#00C374"), + 网站维护("1624972507981344769", "#00CFDC"), + 公众号APP维护("1624972606014812162", "#FD4D66"); + + + private String code; + private String value; + + TaskTypeColorEnum(String code, String value){ + this.code = code; + this.value = value; + } + + public String getCode(){ + return code; + } + + public String getValue(){ + return value; + } + + + public static Map getAllToMap() { + Map re = new HashMap<>(); + TaskTypeColorEnum[] values = values(); + for(TaskTypeColorEnum r:values){ + re.put(r.code, r.getValue()); + } + return re; + } + +} diff --git a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/service/impl/HomePageServiceImpl.java b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/service/impl/HomePageServiceImpl.java index c152485..cfe492b 100644 --- a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/service/impl/HomePageServiceImpl.java +++ b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/homepage/service/impl/HomePageServiceImpl.java @@ -12,15 +12,14 @@ import org.flowable.engine.history.HistoricProcessInstanceQuery; import org.flowable.task.api.Task; import org.flowable.task.api.TaskQuery; import org.flowable.variable.api.history.HistoricVariableInstance; -import org.flowable.variable.api.history.HistoricVariableInstanceQuery; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.plugin.homepage.enumutil.TaskTypeColorEnum; import org.springblade.plugin.homepage.service.IHomePageService; import org.springblade.plugin.workflow.core.utils.WfTaskUtil; import org.springblade.system.cache.DictBizCache; -import org.springblade.system.entity.DictBiz; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.stereotype.Service; @@ -272,12 +271,12 @@ public class HomePageServiceImpl implements IHomePageService { LinkedHashMap map = new LinkedHashMap<>(); //根据工作流查询任务种类 collect.stream().forEach(his ->{ - HistoricVariableInstance renwuzhonglei = historyService.createHistoricVariableInstanceQuery().processInstanceId(his.getId()) - .variableName("$renwuzhonglei").singleResult(); - System.out.println("renwu zhonglei--" + renwuzhonglei); - if(!Func.isEmpty(renwuzhonglei)){ - if(renwuzhonglei.getValue() != null){ - Object renwuzhongleiValue = renwuzhonglei.getValue(); + HistoricVariableInstance renwufulei = historyService.createHistoricVariableInstanceQuery().processInstanceId(his.getId()) + .variableName("renwufulei").singleResult(); + System.out.println("renwu renwufulei--" + renwufulei); + if(!Func.isEmpty(renwufulei)){ + if(renwufulei.getValue() != null){ + Object renwuzhongleiValue = renwufulei.getValue(); map.put(String.valueOf(renwuzhongleiValue), map.get(String.valueOf(renwuzhongleiValue)) == null ? 1: map.get(String.valueOf(renwuzhongleiValue)) + 1); } } @@ -289,8 +288,12 @@ public class HomePageServiceImpl implements IHomePageService { Map.Entry next = iterator.next(); JSONObject jsonByDict = new JSONObject(); - jsonByDict.put("name",next.getKey()); + + jsonByDict.put("name", DictBizCache.getById(Long.parseLong(next.getKey())).getDictValue()); jsonByDict.put("value",next.getValue()); + JSONObject color = new JSONObject(); + color.put("color", TaskTypeColorEnum.getAllToMap().get(next.getKey())); + jsonByDict.put("itemStyle", color); result.add(jsonByDict); } diff --git a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/model/WfProcess.java b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/model/WfProcess.java index bfb878e..da545fe 100644 --- a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/model/WfProcess.java +++ b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/model/WfProcess.java @@ -242,4 +242,6 @@ public class WfProcess implements Serializable { */ private String formSearch; + private List> uploadrecord; + } diff --git a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/service/impl/WfProcessService.java b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/service/impl/WfProcessService.java index ca0787f..13ebef2 100644 --- a/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/service/impl/WfProcessService.java +++ b/lab-plugin/lab-workflow/src/main/java/org/springblade/plugin/workflow/process/service/impl/WfProcessService.java @@ -576,6 +576,11 @@ public class WfProcessService implements IWfProcessService { process.setTaskDefinitionKey(task.getTaskDefinitionKey()); runtimeService.setVariable(task.getProcessInstanceId(), "wf_latest_task_assignee", WfTaskUtil.getTaskUser()); + //重新给上传附件赋值,把新增的上传加上 + if(!Func.isEmpty(process.getUploadrecord())){ + runtimeService.setVariable(task.getExecutionId(), "uploadrecord", process.getUploadrecord()); + } + if (process.isPass()) { // 审核通过 this.passTask(process, task); } else { // 审核不通过