|
@@ -2,11 +2,13 @@ package com.jeeplus.centerservice.utils;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
+import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.jeeplus.centerservice.dto.flow.NotifyListDTO;
|
|
import com.jeeplus.centerservice.dto.reimbursement.ReimbursementAmountInfo;
|
|
import com.jeeplus.centerservice.dto.reimbursement.ReimbursementAmountInfo;
|
|
import com.jeeplus.centerservice.dto.reimbursement.ReimbursementDetailInfo;
|
|
import com.jeeplus.centerservice.dto.reimbursement.ReimbursementDetailInfo;
|
|
import com.jeeplus.centerservice.dto.reimbursement.SaveInfoDto;
|
|
import com.jeeplus.centerservice.dto.reimbursement.SaveInfoDto;
|
|
@@ -29,21 +31,27 @@ public class ConvertServiceUtil {
|
|
*/
|
|
*/
|
|
public static List<ProcessVo> convertProcessVoList(List<Map<String, Object>> res) throws Exception {
|
|
public static List<ProcessVo> convertProcessVoList(List<Map<String, Object>> res) throws Exception {
|
|
ArrayList<ProcessVo> processVoList = new ArrayList<>();
|
|
ArrayList<ProcessVo> processVoList = new ArrayList<>();
|
|
- String ccpm_task = Global.getConfig("CCPM_TASK"); // 获取ccpm可查看的待办数据
|
|
|
|
- if (StringUtils.isNotBlank(ccpm_task)) {
|
|
|
|
- String[] taskAliasList = ccpm_task.split(","); // 获取到ccpm待办
|
|
|
|
- if(CollectionUtil.isNotEmpty(res) && ArrayUtil.isNotEmpty(taskAliasList)) {
|
|
|
|
- String[] distinctTaskAlias = ArrayUtil.distinct(taskAliasList); // ccpm待办去重
|
|
|
|
- for (Map<String, Object> item : res) {
|
|
|
|
- for (String taskAlias : distinctTaskAlias) {
|
|
|
|
- if (taskAlias.equals(item.get("type").toString()) && item.get("remarks").toString().contains("待审批")) {
|
|
|
|
- ProcessVo processVo = convertProcessVo(item);
|
|
|
|
- processVoList.add(processVo);
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(res)) {
|
|
|
|
+ List<ProcessVo> processVos = JSON.parseArray(JSON.toJSONString(res), ProcessVo.class);
|
|
|
|
+ String ccpm_task = Global.getConfig("CCPM_TASK"); // 获取ccpm可查看的待办数据
|
|
|
|
+ if (StringUtils.isNotBlank(ccpm_task)) {
|
|
|
|
+ String[] taskAliasList = ccpm_task.split(","); // 获取到ccpm待办
|
|
|
|
+ if(CollectionUtil.isNotEmpty(res) && ArrayUtil.isNotEmpty(taskAliasList)) {
|
|
|
|
+ String[] distinctTaskAlias = ArrayUtil.distinct(taskAliasList); // ccpm待办去重
|
|
|
|
+ for (ProcessVo item : processVos) {
|
|
|
|
+ TaskVo task = item.getTask();
|
|
|
|
+ Map vars = item.getVars();
|
|
|
|
+ for (String taskAlias : distinctTaskAlias) {
|
|
|
|
+ if (Objects.nonNull(task) && taskAlias.equals(task.getProcessDefKey()) &&
|
|
|
|
+ Objects.nonNull(vars) && vars.get("remarks").toString().contains("待审批")) {
|
|
|
|
+ processVoList.add(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
return processVoList;
|
|
return processVoList;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -105,7 +113,7 @@ public class ConvertServiceUtil {
|
|
*/
|
|
*/
|
|
public static Page getSortAndPaging(Page page,List<ProcessVo> list) {
|
|
public static Page getSortAndPaging(Page page,List<ProcessVo> list) {
|
|
// 将数据按照creaTime倒序排序
|
|
// 将数据按照creaTime倒序排序
|
|
- List<ProcessVo> sort = CollectionUtil.sort(list, new Comparator<ProcessVo>() {
|
|
|
|
|
|
+ CollectionUtil.sort(list, new Comparator<ProcessVo>() {
|
|
@Override
|
|
@Override
|
|
public int compare(ProcessVo o1, ProcessVo o2) {
|
|
public int compare(ProcessVo o1, ProcessVo o2) {
|
|
return o2.getTask().getCreateTime().compareTo(o1.getTask().getCreateTime());
|
|
return o2.getTask().getCreateTime().compareTo(o1.getTask().getCreateTime());
|
|
@@ -306,4 +314,88 @@ public class ConvertServiceUtil {
|
|
String format = sdf.format(dt);
|
|
String format = sdf.format(dt);
|
|
return format;
|
|
return format;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 当前系统待办数据转换为ccpm待办 批量转换
|
|
|
|
+ * @param processVoList
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static List<Map<String,Object>> copyNotifyListToCcpm(List<ProcessVo> processVoList) throws Exception {
|
|
|
|
+ List<Map<String,Object>> res = new ArrayList<>();
|
|
|
|
+ for (ProcessVo processVo : processVoList) {
|
|
|
|
+ Map<String, Object> respMap = copyNotifyToCcpm(processVo);
|
|
|
|
+ if (MapUtil.isNotEmpty(respMap)) {
|
|
|
|
+ res.add(respMap);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 当前系统待办数据转换为ccpm待办
|
|
|
|
+ * @param processVo
|
|
|
|
+ * @return
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ public static Map<String,Object> copyNotifyToCcpm(ProcessVo processVo) throws Exception {
|
|
|
|
+ Map<String,Object> res = new HashMap<>();
|
|
|
|
+ Map<String, Object> vars = processVo.getVars();
|
|
|
|
+ TaskVo task = processVo.getTask();
|
|
|
|
+ // 只查询待审批状态的数据
|
|
|
|
+ // vars.get("agree") 的值为false时,此流程为驳回状态。值为null或其他时,此流程为待审批状态
|
|
|
|
+ if (Objects.nonNull(vars) && (Objects.isNull(vars.get("agree")) || Boolean.parseBoolean(vars.get("agree").toString()))) {
|
|
|
|
+ res.put("belongProject",processVo.getBelongProject());
|
|
|
|
+ // 流程名称
|
|
|
|
+ if (StringUtils.isNotBlank(processVo.getProcessDefinitionName())){
|
|
|
|
+ res.put("typeLabel", processVo.getProcessDefinitionName());
|
|
|
|
+ }
|
|
|
|
+ // 标题
|
|
|
|
+ if (Objects.nonNull(vars.get("title"))){
|
|
|
|
+ res.put("title", "cpa " + vars.get("title").toString()); // 标题
|
|
|
|
+ res.put("content", vars.get("title").toString()); // 内容
|
|
|
|
+ }
|
|
|
|
+ // 流程发起人
|
|
|
|
+ if (Objects.nonNull(vars.get("userName"))){
|
|
|
|
+ res.put("createUserName",vars.get("userName").toString());
|
|
|
|
+ }
|
|
|
|
+ // 数据id
|
|
|
|
+ if (Objects.nonNull(vars.get("id"))){
|
|
|
|
+ res.put("notifyId",vars.get("id").toString());
|
|
|
|
+ }
|
|
|
|
+ // 审批状态
|
|
|
|
+ res.put("remarks","待审批");
|
|
|
|
+ if (Objects.nonNull(vars.get("agree"))) {
|
|
|
|
+ if (!Boolean.parseBoolean(vars.get("agree").toString())) {
|
|
|
|
+ res.put("remarks","重新发起"); // vars.get("agree")的值为false时,此流程为驳回状态,其他值为待审批状态
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (Objects.nonNull(task)) {
|
|
|
|
+ // 流程类型
|
|
|
|
+ if (StringUtils.isNotBlank(task.getProcessDefKey())){
|
|
|
|
+ // Process_1665383385070 评估-报销审批
|
|
|
|
+// if ("Process_1665383385070".equals(task.getProcessDefKey())) {
|
|
|
|
+// res.put("type", "13");
|
|
|
|
+// }
|
|
|
|
+ res.put("type", task.getProcessDefKey());
|
|
|
|
+ }
|
|
|
|
+ // 当前环节
|
|
|
|
+ if (Objects.nonNull(task.getName())){
|
|
|
|
+ res.put("notifyRole", task.getName());
|
|
|
|
+ }
|
|
|
|
+ // 创建时间
|
|
|
|
+ if (Objects.nonNull(task.getCreateTime())){
|
|
|
|
+ res.put("createDate", task.getCreateTime());
|
|
|
|
+ }
|
|
|
|
+ // 流程id
|
|
|
|
+ if (Objects.nonNull(task.getId())){
|
|
|
|
+ res.put("id",task.getId());
|
|
|
|
+ }
|
|
|
|
+ // 审核人
|
|
|
|
+ if (Objects.nonNull(task.getAssignee())){
|
|
|
|
+ res.put("auditUserName",task.getAssignee());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
}
|
|
}
|