Commit c86819b6 authored by hezhuozhi's avatar hezhuozhi

26854 【智信户用(管理端)】迁移工作台相关代码

parent 254eba39
package com.yeejoin.amos.boot.module.hygf.api.Enum;
/**
* 业务类型枚举
*
* @author Administrator
*/
public enum BusinessTypeEnum {
/**
* 业务类型枚举
*/
JG_EQUIPMENT_HANDOVER("101", "设备移交"),
JG_INSTALLATION_NOTIFICATION("102", "安装告知"),
JG_MODIFICATION_NOTIFICATION("103", "改造告知"),
JG_MAINTENANCE_NOTIFICATION("104", "维修告知"),
JG_ADVICE_REMOVAL("105", "移装告知"),
JG_MAINTENANCE_RECORD("106", "维保备案"),
JG_USAGE_REGISTRATION("107", "使用登记"),
JG_NAME_CHANGE_REGISTRATION("108", "更名变更登记"),
JG_COMPANY_CHANGE_REGISTRATION("109", "单位变更登记"),
JG_CHANGE_REGISTRATION("110", "移装变更登记"),
JG_RENOVATION_REGISTRATION("111", "改造变更登记"),
JG_EQUIPMENT_START("112-1", "设备启用"),
JG_EQUIPMENT_STOP("112-2", "设备停用"),
JG_EQUIPMENT_MOVE("113-1", "移装注销"),
JG_EQUIPMENT_CANCEL("113-2", "报废注销"),
JY_OPENING_APPLICATION("114", "业务开通"),
JY_INSPECTION_APPLICATION_JD("115", "监督检验"),
JY_INSPECTION_APPLICATION_DS("116", "定(首)检验"),
JY_INSPECTION_APPLICATION_CHECK("117", "电梯检测"),
JG_VEHICLE_GAS_APPLICATION("118", "车用气瓶登记");
private final String code;
private final String name;
BusinessTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(String code) {
String name = null;
for (BusinessTypeEnum enumOne : BusinessTypeEnum.values()) {
if (enumOne.getCode().equals(code)) {
name = enumOne.getName();
break;
}
}
return name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.Getter;
/**
* 流程办理状态统一枚举
*/
@Getter
public enum FlowStatusEnum {
/**
* 已转办
*/
TO_BE_TRANSFER(6621, "已转办"),
/**
* 待提交
*/
TO_BE_SUBMITTED(6610, "待提交"),
/**
* 检测检测专用 已废弃 勿删
* */
@Deprecated
TO_SUBMITTED(6611, "待受理"),
/**
* 待受理
*/
TO_BE_PROCESSED(6612, "待受理"),
/**
* 已驳回
*/
REJECTED(6614, "已驳回"),
/**
* 已撤回
*/
ROLLBACK(6615, "已撤回"),
/**
* 已完成
*/
TO_BE_FINISHED(6616, "已完成"),
/**
* 已作废
*/
TO_BE_DISCARD(6617, "已作废");
private final int code;
private final String name;
FlowStatusEnum(int code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByType(Long code) {
String name = null;
for (FlowStatusEnum enumOne : FlowStatusEnum.values()) {
if (enumOne.getCode() == code) {
name = enumOne.getName();
break;
}
}
return name;
}
public static FlowStatusEnum getEumByCode(int code) {
for (FlowStatusEnum statusEnum : FlowStatusEnum.values()) {
if (statusEnum.getCode() == code) {
return statusEnum;
}
}
return null;
}
public static FlowStatusEnum getEumByName(String name) {
for (FlowStatusEnum statusEnum : FlowStatusEnum.values()) {
if (statusEnum.getName().equals(name)) {
return statusEnum;
}
}
return null;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author Administrator
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TaskModelDto {
/**
* 工作流创建时间
*/
private Date flowCreateDate;
/**
* 工作流返回节点名称
*/
private String taskName;
/**
* 任务编号 可以使用申请单编号
*/
private String taskCode;
/**
* 流程任务ID
*/
private String flowCode;
/**
* 统一定义的枚举code 例如 6612 待受理
*/
private Integer flowStatus;
/**
* 统一定义的枚举code 例如 6612 待受理
*/
private String flowStatusLabel;
/**
* 摘要-来源
*/
private String taskContent;
/**
* 描述-非必输
*/
private String taskDesc;
/**
* 任务类型 从BusinessTypeEnum中获取自己对应类型code
**/
private String taskType;
/**
* 任务类型名称 汉字 从BusinessTypeEnum中获取自己对应类型名称
**/
private String taskTypeLabel;
/***
* 关联id 传工作流实例id
* */
private String relationId;
/**
* 执行人id 从工作流中获取
**/
private String executeUserIds;
/**
* 任务状态 操作名称 0 待处理 1驳回 2通过 3重新提交
*/
private Integer taskStatus;
/**
* 任务状态 操作名称 0 待处理 1驳回 2通过 3重新提交
*/
private String taskStatusLabel;
/**
* 任务发起人id 不变 第一次提交的人
* 从业务表中 created_uesr_id
*/
private String startUserId;
/**
* 任务发起人名称 不变
* 名字
*/
private String startUser;
/**
* 任务发起人所在单位 不变
*/
private String startUserCompanyName;
/**
* 任务发起人发起时间 不变
*/
private Date startDate;
/**
* 跳转路径
*/
private String routePath;
/**
* 当前业务实体对象
*/
private Object model;
/**
* 下一节点执行角色
*/
private String nextExecuteUser;
/**
* 是否跳转编辑页面
* */
private String pageType;
}
package com.yeejoin.amos.boot.module.hygf.api.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import static com.alibaba.fastjson.JSON.parseArray;
public class JsonUtils {
//将json文件转化为Map<list<Map<>>>
public static Map getResourceJson(Resource resource) {
String json = null;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败");
}
return JSONObject.parseObject(json, Map.class);
}
//将json文件转化为List<Map>
public static List<Map> getResourceList(Resource resource) {
String json = null;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败");
}
List<Map> list = parseArray(json, Map.class);
return list;
}
}
package com.yeejoin.amos.boot.module.hygf.biz.feign;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
/**
* @author LiuLin
* @apiNote 待办Feign调用
* @date 2024-05-16
*/
@FeignClient(name = "AMOS-API-PRIVILEGE", path = "/systemctl/v2/task", configuration = {XidFeignConfiguration.class})
public interface TaskV2FeignService {
/**
* 批量新增任务
*
* @param modelList 新增待办
* @return TaskV2Model
* @throws InnerInvokException e
*/
@RequestMapping(value = "/batch/add", method = RequestMethod.POST)
FeignClientResult<List<TaskV2Model>> batchAdd(@RequestBody List<TaskV2Model> modelList) throws InnerInvokException;
/**
* 更新任务
*
* @param model 待办信息
* @param sequenceNbr 主键
* @return TaskV2Model
* @throws InnerInvokException e
*/
@RequestMapping(value = "/{sequenceNbr}", method = RequestMethod.PUT)
FeignClientResult<TaskV2Model> update(@RequestBody TaskV2Model model, @PathVariable("sequenceNbr") Long sequenceNbr) throws InnerInvokException;
/**
* 创建任务
*
* @param model 待办
* @return
* @throws InnerInvokException
*/
@RequestMapping(value = "", method = RequestMethod.POST)
FeignClientResult<TaskV2Model> create(@RequestBody TaskV2Model model) throws InnerInvokException;
/**
* 批量删除任务
*
* @param ids 主键
* @return Long
* @throws InnerInvokException e
*/
@RequestMapping(value = "/{ids}", method = RequestMethod.DELETE)
FeignClientResult<List<Long>> delete(@PathVariable("ids") String ids) throws InnerInvokException;
/**
* 查询指定任务
*
* @param relationId 关联Id
* @return List<TaskV2Model>
* @throws InnerInvokException
*/
@RequestMapping(value = "/queryByRelationId/{relationId}", method = RequestMethod.GET)
FeignClientResult<List<TaskV2Model>> selectListByRelationId(@PathVariable("relationId") String relationId) throws InnerInvokException;
/**
* 批量修改任务
*/
@RequestMapping(value = "/batch/update", method = RequestMethod.PUT)
FeignClientResult<List<TaskV2Model>> batchUpdate(@RequestBody List<TaskV2Model> modelList) throws InnerInvokException;
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.FlowStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.TaskModelDto;
import com.yeejoin.amos.boot.module.hygf.api.util.JsonUtils;
import com.yeejoin.amos.boot.module.hygf.biz.feign.TaskV2FeignService;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
* 公共服务实现类
*
* @author hzz
* @date 2024-06-20
*/
@Service
@Slf4j
public class CommonServiceImpl {
@Autowired
private TaskV2FeignService taskV2FeignService;
@Autowired
private RedisUtils redisUtils;
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
private static String toQueryParams2(JSONObject jsonObject) {
StringBuilder sb = new StringBuilder();
Set<String> keys = jsonObject.keySet();
keys.forEach(key -> {
Object value = jsonObject.get(key);
if (sb.length() > 0) {
sb.append('&');
}
try {
if (value != null && !"".equals(value)) {
sb.append(URLEncoder.encode(key, "UTF-8"))
.append('=')
.append(URLEncoder.encode(value.toString(), "UTF-8"));
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
});
return sb.toString();
}
public void deleteTaskModel(String id) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(id).getResult();
if (!result.isEmpty()) {
List<Long> idList = result.stream().map(TaskV2Model::getSequenceNbr).collect(Collectors.toList());
String ids = idList.stream().map(Object::toString).collect(Collectors.joining(","));
taskV2FeignService.delete(ids);
}
}
/**
* 待办新增接口
**/
public void buildTaskModel(List<TaskModelDto> list) {
List<TaskV2Model> taskV2Models = new ArrayList<>();
for (TaskModelDto obj : list) {
// 判断是否是暂存 新增若无下一节点执行人即为暂存
boolean flag = StringUtils.isEmpty(obj.getNextExecuteUser());
if (flag) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(obj.getRelationId()).getResult();
if (CollectionUtil.isNotEmpty(result) && !result.isEmpty()) {
break;
}
}
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
TaskV2Model model = new TaskV2Model();
BeanUtil.copyProperties(obj, model);
String urlParams = "";
try {
urlParams = "&" + toQueryParams(obj.getModel());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) {
// 获取暂存的可编辑页面url
if (flag && map.get("type").equals(obj.getTaskType()) && map.get("pageType").equals("draft")) {
model.setRoutePath(map.get("url").toString() + urlParams);
break;
}
// 维保需特殊获取页面 状态不等于监管单位审核的页面均取对应编辑页面
else if (map.get("type").equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && obj.getTaskType().equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && !obj.getFlowStatus().toString().equals("16723") && map.get("pageType").equals("edit")) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.getNextExecuteUser()) + urlParams + "&nextExecuteUserIds=" + model.getExecuteUserIds());
break;
}
// 其他逻辑均按详情页面获取
else if (map.get("type").equals(obj.getTaskType()) && map.get("pageType").equals(null == obj.getPageType() ? "look" : obj.getPageType())) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.getNextExecuteUser()) + urlParams + "&nextExecuteUserIds=" + model.getExecuteUserIds());
break;
}
}
// 是true则为暂存 除公共部分统一处理
if (flag) {
model.setFlowStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode());
model.setFlowStatusLabel(FlowStatusEnum.TO_BE_SUBMITTED.getName());
model.setStartUserId(RequestContext.getExeUserId());
model.setStartUser(reginParams.getUserModel().getRealName());
model.setStartUserCompanyName(reginParams.getCompany().getCompanyName());
model.setStartDate(new Date());
model.setExecuteUserIds(RequestContext.getExeUserId());
model.setFlowCreateDate(new Date());
model.setTaskStatus(FlowStatusEnum.TO_BE_SUBMITTED.getCode());
model.setTaskTitle("有一条待提交的草稿");
model.setTaskName(BusinessTypeEnum.getNameByType(obj.getTaskType()));
model.setTaskTypeLabel(BusinessTypeEnum.getNameByType(obj.getTaskType()));
// model.setTaskContent("【申请单号:"+obj.getTaskCode()+"】待提交");
} else {
model.setTaskStatus(0);
model.setTaskTitle(obj.getStartUser() + "发起了" + obj.getTaskName());
}
model.setFlowInstanceId(model.getRelationId());
model.setTaskSource("workFlow");
model.setExtras(JSON.toJSONString(obj.getModel()));
// model.setTerminal(params.getOrDefault("terminal","WEB").toString());
model.setCreateDate(new Date());
model.setRecUserId(RequestContext.getExeUserId());
model.setAgencyCode(RequestContext.getAgencyCode());
taskV2Models.add(model);
}
taskV2FeignService.batchAdd(taskV2Models);
}
/**
* 待办编辑接口
* 参数
* taskStatus
* taskStatusLabel 操作名称 6614驳回 6616已完成 6612待受理
* flowStatusLabel 任务状态枚举code
* 流程实例id instanceId
* flowCode 任务id
**/
public TaskV2Model updateTaskModel(Map<String, Object> params) {
String exeUserId = RequestContext.getExeUserId();
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(params.get("relationId").toString()).getResult();
List<TaskV2Model> collect = result.stream().sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr())).collect(Collectors.toList());
if (collect.isEmpty()) {
return null;
}
collect.get(0).setFlowStatus(Integer.valueOf(params.get("flowStatus").toString()));
collect.get(0).setFlowStatusLabel(params.get("flowStatusLabel").toString());
collect.get(0).setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
collect.get(0).setTaskStatusLabel(params.get("taskStatusLabel").toString());
collect.get(0).setEndUserId(exeUserId);
collect.get(0).setEndDate(new Date());
// String[] roleIds = model.getRoutePath().split("roleIds=");
// String[] userIds = roleIds[1].split("&userId");
// String url = roleIds[0]+"roleIds="+"55555"+"&userId"+ userIds[1];
// String tarUrl = url.replaceFirst("&executeUserIds=", "");
// tarUrl+"&executeUserIds="
// model.setRoutePath( roleIds[0]+"roleIds="+"55555"+"&userId"+userIds[1]);
// 当流程完成时将所有待办状态统一修改为已完成
if (collect.get(0).getFlowStatusLabel().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
String urlParams = "";
try {
urlParams = "&" + toQueryParams(params.get("model"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) {
if (map.get("type").equals(collect.get(0).getTaskType()) && map.get("pageType").equals("look")) {
urlParams = map.get("url").toString().replace("{roleIds}", "") + urlParams + "&taskStatus" + collect.get(0).getTaskStatus() + "&nextExecuteUserIds=";
break;
}
}
collect.get(0).setRoutePath(urlParams);
for (TaskV2Model taskV2Model : collect) {
taskV2Model.setTaskStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
taskV2Model.setFlowStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setFlowStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
}
taskV2FeignService.batchUpdate(collect);
} else {
collect.get(0).setRoutePath(collect.get(0).getRoutePath().replace("roleIds=", "roleIds=55555&fq="));
taskV2FeignService.update(collect.get(0), collect.get(0).getSequenceNbr());
}
// 修改model并返回 用于组装新待办
collect.get(0).setEndUserId(null);
collect.get(0).setTaskStatus(null);
collect.get(0).setEndDate(null);
collect.get(0).setSequenceNbr(null);
collect.get(0).setCreateDate(new Date());
collect.get(0).setStartDate(new Date());
return collect.get(0);
}
/**
* 待办编辑接口 【如果没有代办直接返回空,业务判断】 ---- 在用,误删
* 参数
* taskStatus
* taskStatusLabel 操作名称 1驳回 2通过 3重新提交
* flowStatusLabel 任务状态枚举code
* 流程实例id instanceId
* flowCode 任务id
**/
public TaskV2Model updateTaskModelNew(Map<String, Object> params) {
String exeUserId = RequestContext.getExeUserId();
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(params.get("relationId").toString()).getResult();
// TaskV2Model model = result.stream().filter(e->e.getFlowCode().equals(params.get("flowCode").toString())).sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r2.getSequenceNbr())) // 按时间降序排序
// .findFirst()
// .orElse(null);
List<TaskV2Model> collect = result.stream().sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr())).collect(Collectors.toList());
if (null == collect || collect.size() == 0) {
TaskV2Model model = new TaskV2Model();
model.setFlowStatus(Integer.valueOf(params.get("flowStatus").toString()));
model.setFlowStatusLabel(params.get("flowStatusLabel").toString());
model.setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
model.setTaskStatusLabel(params.get("taskStatusLabel").toString());
return model;
}
collect.get(0).setFlowStatus(Integer.valueOf(params.get("flowStatus").toString()));
collect.get(0).setFlowStatusLabel(params.get("flowStatusLabel").toString());
collect.get(0).setTaskStatus(Integer.valueOf(params.get("taskStatus").toString()));
collect.get(0).setTaskStatusLabel(params.get("taskStatusLabel").toString());
collect.get(0).setEndUserId(exeUserId);
collect.get(0).setEndDate(new Date());
// 当流程完成时将所有待办状态统一修改为已完成
if (collect.get(0).getFlowStatusLabel().equals(FlowStatusEnum.TO_BE_FINISHED.getName())) {
String urlParams = "";
try {
urlParams = "&" + toQueryParams(params.get("model"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
for (Map map : urlList) {
if (map.get("type").equals(collect.get(0).getTaskType()) && map.get("pageType").equals("look")) {
urlParams = map.get("url").toString().replace("{roleIds}", "") + urlParams + "&nextExecuteUserIds=";
break;
}
}
collect.get(0).setRoutePath(urlParams);
for (TaskV2Model taskV2Model : collect) {
taskV2Model.setTaskStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setTaskStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
taskV2Model.setFlowStatusLabel((FlowStatusEnum.TO_BE_FINISHED.getName()));
taskV2Model.setFlowStatus(FlowStatusEnum.TO_BE_FINISHED.getCode());
}
taskV2FeignService.batchUpdate(collect);
} else {
collect.get(0).setRoutePath(collect.get(0).getRoutePath().replace("roleIds=", "roleIds=55555&fq="));
taskV2FeignService.update(collect.get(0), collect.get(0).getSequenceNbr());
}
collect.get(0).setEndUserId(null);
collect.get(0).setTaskStatus(null);
collect.get(0).setEndDate(null);
collect.get(0).setSequenceNbr(null);
collect.get(0).setCreateDate(new Date());
collect.get(0).setStartDate(new Date());
return collect.get(0);
}
/**
* 待办 撤回
*
* @param id 工作流实例id
* @param obj 自己的实体:taskType为BusinessTypeEnum code;nextExecuteUser
*/
public void rollbackTask(String id, JSONObject obj) {
List<TaskV2Model> result = taskV2FeignService.selectListByRelationId(id).getResult();
List<TaskV2Model> list = result.stream().sorted((r1, r2) -> r2.getSequenceNbr().compareTo(r1.getSequenceNbr())).collect(Collectors.toList());
TaskV2Model model = list.get(0);
taskV2FeignService.delete(String.valueOf(model.getSequenceNbr()));
String urlParams = "";
urlParams = "&" + toQueryParams2(obj);
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
if (list.size() > 1) {
TaskV2Model lastTaskModel = list.get(1);
lastTaskModel.setEndUserId(null);
lastTaskModel.setEndDate(null);
lastTaskModel.setTaskStatus(FlowStatusEnum.TO_SUBMITTED.getCode());
lastTaskModel.setTaskStatusLabel("重新提交");
lastTaskModel.setFlowCode(obj.get("nextTaskId").toString());
if (obj.get("flowStatus") != null) {
lastTaskModel.setFlowStatus(Integer.valueOf(obj.get("flowStatus").toString()));
}
if (obj.get("flowStatusLabel") != null) {
lastTaskModel.setFlowStatusLabel(obj.get("flowStatusLabel").toString());
}
for (Map map : urlList) {
if (map.get("type").equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && obj.getString("taskType").equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && map.get("pageType").equals("edit")) {
lastTaskModel.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.getString("nextExecuteUser")) + urlParams);
break;
} else if (map.get("type").equals(obj.get("taskType")) && map.get("pageType").equals(obj.getOrDefault("pageType", "edit"))) {
lastTaskModel.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.get("nextExecuteUser").toString()) + urlParams);
break;
}
}
taskV2FeignService.update(lastTaskModel, lastTaskModel.getSequenceNbr());
} else if (list.size() == 1) {
model.setExecuteUserIds(model.getStartUserId());
model.setTaskStatusLabel("重新提交");
model.setTaskStatus(FlowStatusEnum.TO_SUBMITTED.getCode());
model.setSequenceNbr(null);
if (obj.get("flowStatus") != null) {
model.setFlowStatus(Integer.valueOf(obj.get("flowStatus").toString()));
}
if (obj.get("flowStatusLabel") != null) {
model.setFlowStatusLabel(obj.get("flowStatusLabel").toString());
}
for (Map map : urlList) {
if (map.get("type").equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && obj.getString("taskType").equals(BusinessTypeEnum.JG_MAINTENANCE_RECORD.getCode()) && map.get("pageType").equals("edit")) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.getString("nextExecuteUser")) + urlParams);
break;
} else if (map.get("type").equals(obj.get("taskType")) && map.get("pageType").equals("edit")) {
model.setRoutePath(map.get("url").toString().replace("{roleIds}", obj.get("nextExecuteUser").toString()) + urlParams);
break;
}
}
taskV2FeignService.create(model);
}
}
public <T> String toQueryParams(T obj) throws UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
for (Class<?> clazz = obj.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (!Modifier.isStatic(field.getModifiers())) {
field.setAccessible(true);
try {
Object value = field.get(obj);
if (value != null && !"".equals(value)) {
String encodedValue = URLEncoder.encode(value.toString(), "UTF-8");
sb.append(field.getName()).append('=').append(encodedValue).append('&');
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}
return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : "";
}
}
\ No newline at end of file
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
<springcloud.version>Hoxton.SR8</springcloud.version> <springcloud.version>Hoxton.SR8</springcloud.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<tyboot-version>1.1.25-SNAPSHOT</tyboot-version> <tyboot-version>1.1.25-SNAPSHOT</tyboot-version>
<amos.version>1.7.10-SNAPSHOT</amos.version> <!-- <amos.version>1.7.10-SNAPSHOT</amos.version>-->
<amos.version>1.10.8</amos.version>
<itext.version>7.1.1</itext.version> <itext.version>7.1.1</itext.version>
<elasticsearch.version>7.15.2</elasticsearch.version> <elasticsearch.version>7.15.2</elasticsearch.version>
</properties> </properties>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment