投标演示上线能力流程
This commit is contained in:
parent
b33527cf6c
commit
f67410ddf3
|
@ -0,0 +1,244 @@
|
||||||
|
package io.renren.common.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.renren.common.annotation.LogOperation;
|
||||||
|
import io.renren.common.page.PageData;
|
||||||
|
import io.renren.common.utils.CodeGenerationUtils;
|
||||||
|
import io.renren.common.utils.Result;
|
||||||
|
import io.renren.common.validator.ValidatorUtils;
|
||||||
|
import io.renren.common.validator.group.AddGroup;
|
||||||
|
import io.renren.common.validator.group.DefaultGroup;
|
||||||
|
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
|
||||||
|
import io.renren.modules.activiti.dto.ProcessStartDTO;
|
||||||
|
import io.renren.modules.activiti.service.ActProcessService;
|
||||||
|
import io.renren.modules.activiti.service.ActRunningService;
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.resourceMountApply.dto.TResourceBatchMountApplyDTO;
|
||||||
|
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||||
|
import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO;
|
||||||
|
import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
|
||||||
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
|
import io.renren.modules.sys.dto.SysUserDTO;
|
||||||
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.activiti.engine.TaskService;
|
||||||
|
import org.activiti.engine.task.Task;
|
||||||
|
import org.activiti.engine.task.TaskQuery;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Api(tags = "资源上架")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/resource/center")
|
||||||
|
public class ResourceMountShowController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ResourceMountShowController.class);
|
||||||
|
private static final ObjectMapper oMapper = new ObjectMapper();
|
||||||
|
@Autowired
|
||||||
|
private ActProcessService actProcessService;
|
||||||
|
@Autowired
|
||||||
|
private ActRunningService actRunningService;
|
||||||
|
@Autowired
|
||||||
|
private TResourceMountApplyService tResourceMountApplyService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected TaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
|
@Value("${big_date.name}")
|
||||||
|
private String bigDateDeptName; // 大数据局名称
|
||||||
|
|
||||||
|
private static final String APPLY_KEY = "resourcemountapply_show"; // 资源上架
|
||||||
|
|
||||||
|
private static final String UNDERCARRIAGE_KEY = "resourcundercarriageapply"; // 资源下架
|
||||||
|
|
||||||
|
private static final Map<String, Object> apply_params = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("isLatestVersion", true); // 取最新版本
|
||||||
|
put("key", APPLY_KEY); // 限定 能力资源上架
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final Map<String, Object> undercarriage_params = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("isLatestVersion", true); // 取最新版本
|
||||||
|
put("key", UNDERCARRIAGE_KEY); // 限定 资源下架
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/apply_show")
|
||||||
|
@ApiOperation("批量进行能力上架申请")
|
||||||
|
@LogOperation("批量进行能力上架申请")
|
||||||
|
public Result<List<ProcessInstanceDTO>> apply(@RequestBody TResourceBatchMountApplyDTO tResourceBatchMountApplyDTO) {
|
||||||
|
// 仿照请求接口 /act/process/lastestPage
|
||||||
|
PageData<Map<String, Object>> page = actProcessService.page(apply_params);
|
||||||
|
if (page.getTotal() <= 0) { //
|
||||||
|
return new Result().error("联系管理员添加流程");
|
||||||
|
}
|
||||||
|
logger.info("---------------------------------------------------");
|
||||||
|
logger.info(JSONObject.toJSONString(tResourceBatchMountApplyDTO));
|
||||||
|
logger.info("####################################################");
|
||||||
|
return new Result().ok(tResourceBatchMountApplyDTO.getResourceDTO().stream().map(index -> {
|
||||||
|
TResourceMountApplyDTO tResourceMountApplyDTO = new TResourceMountApplyDTO();
|
||||||
|
tResourceMountApplyDTO.setPhone(tResourceBatchMountApplyDTO.getPhone());
|
||||||
|
tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId());
|
||||||
|
tResourceMountApplyDTO.setUserId(tResourceBatchMountApplyDTO.getUserId());
|
||||||
|
tResourceMountApplyDTO.setUserName(tResourceBatchMountApplyDTO.getUserName());
|
||||||
|
tResourceMountApplyDTO.setParameterContent(JSON.toJSONString(index));
|
||||||
|
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSON.toJSONString(index)));
|
||||||
|
tResourceMountApplyDTO.setResourceDTO(index);
|
||||||
|
tResourceMountApplyDTO.setEnclosure(index.getEnclosure());
|
||||||
|
tResourceMountApplyDTO.setFlowType("资源上架");
|
||||||
|
try {
|
||||||
|
tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("资源上架异常", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(tResourceBatchMountApplyDTO.getDeptId())) {
|
||||||
|
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(tResourceBatchMountApplyDTO.getUserId())));
|
||||||
|
userDTO.ifPresent(user -> {
|
||||||
|
if (user.getSuperAdmin() == 1) {
|
||||||
|
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
||||||
|
tResourceMountApplyDTO.setDeptId(deptDTO.getId().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidatorUtils.validateEntity(tResourceMountApplyDTO, AddGroup.class, DefaultGroup.class);
|
||||||
|
tResourceMountApplyService.save(tResourceMountApplyDTO); // 保存单条资源申请记录
|
||||||
|
if (tResourceMountApplyDTO.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
codeGenerationUtils.setApplyNumber("NLSJ", Arrays.asList(tResourceMountApplyDTO.getId()), jdbcTemplate);
|
||||||
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
|
Task task = taskQuery.active().processInstanceBusinessKey(tResourceMountApplyDTO.getId().toString()).singleResult();
|
||||||
|
if (task != null) {
|
||||||
|
logger.error("该资源已发起上架");
|
||||||
|
throw new RuntimeException("该资源已发起上架");
|
||||||
|
}
|
||||||
|
|
||||||
|
tResourceMountApplyDTO.setCompleteEntry(Boolean.TRUE);
|
||||||
|
logger.info("-------------------1.保存申请表单成功--------------------------");
|
||||||
|
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||||
|
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||||
|
processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString());
|
||||||
|
processStartDTO.setProcessDefinitionKey(APPLY_KEY); // 限定资源上架
|
||||||
|
|
||||||
|
Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class);
|
||||||
|
processStartDTO.setVariables(variables);
|
||||||
|
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||||
|
logger.info("-------------------2.启动流程成功--------------------------");
|
||||||
|
logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey());
|
||||||
|
|
||||||
|
if (Long.valueOf(dto.getBusinessKey()) != null) {
|
||||||
|
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
|
||||||
|
tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
|
||||||
|
logger.info("-------------------更新updateInstanceId.成功--------------------------");
|
||||||
|
logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId());
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/undercarriage")
|
||||||
|
@ApiOperation("批量进行能力下架申请")
|
||||||
|
@LogOperation("批量进行能力下架申请")
|
||||||
|
public Result<Object> undercarriage(@RequestBody TResourceUndercarriageApplyDTO tResourceUndercarriageApplyDTO) {
|
||||||
|
// 仿照请求接口 /act/process/lastestPage
|
||||||
|
PageData<Map<String, Object>> page = actProcessService.page(undercarriage_params);
|
||||||
|
if (page.getTotal() <= 0) { //
|
||||||
|
return new Result().error("联系管理员添加流程");
|
||||||
|
}
|
||||||
|
logger.info("---------------------------------------------------");
|
||||||
|
logger.info(JSONObject.toJSONString(tResourceUndercarriageApplyDTO));
|
||||||
|
logger.info("####################################################");
|
||||||
|
Optional<Boolean> undercarriage =
|
||||||
|
tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
|
||||||
|
Long resourceId = Long.valueOf(index.get("resourceId"));
|
||||||
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
|
if (resourceDTO.isPresent()) {
|
||||||
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
|
long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count();
|
||||||
|
return task > 0;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}).filter(index -> index).findAny();
|
||||||
|
if (undercarriage.isPresent()) {
|
||||||
|
return new Result<>().ok("该资源已发起下架");
|
||||||
|
}
|
||||||
|
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
|
||||||
|
List<ProcessInstanceDTO> dtoList = new ArrayList<>();
|
||||||
|
Long resourceId = Long.valueOf(index.get("resourceId"));
|
||||||
|
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||||
|
resourceDTO.ifPresent(dto -> {
|
||||||
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
|
long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count();
|
||||||
|
if (task > 0) {
|
||||||
|
logger.error("该资源已发起下架");
|
||||||
|
throw new RuntimeException("该资源已发起下架");
|
||||||
|
}
|
||||||
|
dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason());
|
||||||
|
dto.setUndercarriageEnclosure(tResourceUndercarriageApplyDTO.getEnclosure());
|
||||||
|
dto.setUndercarriageEnclosureName(tResourceUndercarriageApplyDTO.getEnclosureName());
|
||||||
|
dto.setUndercarriageTitle(tResourceUndercarriageApplyDTO.getTitle());
|
||||||
|
dto.setUndercarriageUserPhone(tResourceUndercarriageApplyDTO.getPhone());
|
||||||
|
dto.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); // 设置为正常
|
||||||
|
dto.setFlowType("资源下架");
|
||||||
|
String userId = SecurityUser.getUserId().toString();
|
||||||
|
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId)));
|
||||||
|
userDTO.ifPresent(user -> {
|
||||||
|
dto.setUndercarriageUserName(user.getRealName());
|
||||||
|
});
|
||||||
|
codeGenerationUtils.setApplyNumber("NLXJ", Arrays.asList(dto.getId()), jdbcTemplate);
|
||||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
resourceService.update(dto);
|
||||||
|
logger.error(resourceDTO.get().toString());
|
||||||
|
dto.setCompleteEntry(Boolean.TRUE);
|
||||||
|
|
||||||
|
logger.info("-------------------1.保存申请表单成功--------------------------");
|
||||||
|
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||||
|
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||||
|
processStartDTO.setBusinessKey(resourceId.toString());
|
||||||
|
processStartDTO.setProcessDefinitionKey(UNDERCARRIAGE_KEY); // 限定资源下架
|
||||||
|
|
||||||
|
Map<String, Object> variables = oMapper.convertValue(dto, Map.class);
|
||||||
|
processStartDTO.setVariables(variables);
|
||||||
|
ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO);
|
||||||
|
logger.info("-------------------2.启动流程成功--------------------------");
|
||||||
|
logger.info("ProcessInstanceDTO.getBusinessKey:{}", index_.getBusinessKey());
|
||||||
|
dtoList.add(index_);
|
||||||
|
});
|
||||||
|
return dtoList.stream().findAny().orElse(null);
|
||||||
|
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,194 @@
|
||||||
|
package io.renren.modules.resourceMountApply.listener.show;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import io.renren.modules.processForm.service.ApiGateway;
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||||
|
import io.renren.modules.sys.dto.SysRoleDTO;
|
||||||
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
|
import io.renren.modules.sys.service.SysRoleService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import org.activiti.engine.TaskService;
|
||||||
|
import org.activiti.engine.delegate.*;
|
||||||
|
import org.activiti.engine.delegate.event.ActivitiEvent;
|
||||||
|
import org.activiti.engine.delegate.event.ActivitiEventListener;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源所有者节点审批
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ResourceOwnerShowListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ResourceOwnerShowListener.class);
|
||||||
|
|
||||||
|
@Value("${big_date.name}")
|
||||||
|
private String bigDateDeptName; // 大数据局名称
|
||||||
|
@Value("${big_date.default_assignee_role_id}")
|
||||||
|
private String defaultAssigneeRoleId; // 当某部门未设置部门审批人时,将使用该用户审批
|
||||||
|
@Value("${big_date.assignee_role_name}")
|
||||||
|
private String roleName; // 具备审批的角色名称
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysRoleService sysRoleService;
|
||||||
|
@Autowired
|
||||||
|
private TaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
@Resource(name = "${hisense.gateway.name}")
|
||||||
|
private ApiGateway apiGateway;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notify(DelegateExecution execution) throws Exception {
|
||||||
|
logger.error("----------------------进入审批通过节点---------------------------");
|
||||||
|
logger.error("事件类型:" + execution.getEventName());
|
||||||
|
final String eventName = execution.getEventName();
|
||||||
|
|
||||||
|
switch (eventName) {
|
||||||
|
case EVENTNAME_END: {
|
||||||
|
endTake(execution.getVariables());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(DelegateExecution execution) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notify(DelegateTask delegateTask) {
|
||||||
|
logger.error("----------------------进入资源所有者节点---------------------------");
|
||||||
|
logger.error("事件类型:" + delegateTask.getEventName());
|
||||||
|
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
|
||||||
|
logger.error("roleDTOId:" + roleDTO.getId());
|
||||||
|
final String eventName = delegateTask.getEventName();
|
||||||
|
switch (eventName) {
|
||||||
|
case EVENTNAME_CREATE: // 创建当前审批节点事件
|
||||||
|
create(delegateTask);
|
||||||
|
break;
|
||||||
|
case EVENTNAME_COMPLETE:
|
||||||
|
complete(delegateTask);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.error("未处理该事件:" + eventName);
|
||||||
|
}
|
||||||
|
logger.error("-----------------------结束资源所有者节点---------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when an event has been fired
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onEvent(ActivitiEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether or not the current operation should fail when this listeners execution
|
||||||
|
* throws an exception.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean isFailOnException() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入最后结束节点
|
||||||
|
*
|
||||||
|
* @param kv
|
||||||
|
*/
|
||||||
|
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
|
||||||
|
GsonBuilder builder = new GsonBuilder();
|
||||||
|
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||||
|
|
||||||
|
Gson gson = builder.create();
|
||||||
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
|
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
|
||||||
|
ResourceDTO re = resourceService.get(resourceMountApplyDTO.getResourceId());
|
||||||
|
if (resourceMountApplyDTO != null) {
|
||||||
|
if (resourceMountApplyDTO.getReject() != null && resourceMountApplyDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
|
||||||
|
if (re != null) {
|
||||||
|
re.setDelFlag(ResourceEntityDelFlag.REJECT_REVIEW.getFlag());
|
||||||
|
resourceService.update(re);
|
||||||
|
logger.error("审批未通过!资源id:" + re.getId());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resourceMountApplyDTO.getReject() == null || resourceMountApplyDTO.getReject() != Boolean.TRUE) { // 都是同意
|
||||||
|
if (re != null) {
|
||||||
|
re.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
|
resourceService.update(re);
|
||||||
|
logger.error("审批通过!资源id:" + re.getId());
|
||||||
|
try {
|
||||||
|
apiGateway.registerApi2Gateway(String.valueOf(re.getId())); // 发布到应用网关
|
||||||
|
} catch (Exception exception) {
|
||||||
|
logger.error("发布到应用网关", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error("能力上架资源信息故障-->" + JSON.toJSONString(kv));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程结束,推送
|
||||||
|
*
|
||||||
|
* @param delegateTask
|
||||||
|
*/
|
||||||
|
private void complete(DelegateTask delegateTask) {
|
||||||
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
|
GsonBuilder builder = new GsonBuilder();
|
||||||
|
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||||
|
|
||||||
|
Gson gson = builder.create();
|
||||||
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
|
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
|
||||||
|
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
|
||||||
|
if (re != null) {
|
||||||
|
re.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
|
||||||
|
resourceService.update(re);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点创建时分配发起人为审核人
|
||||||
|
*
|
||||||
|
* @param delegateTask
|
||||||
|
*/
|
||||||
|
private void create(DelegateTask delegateTask) {
|
||||||
|
Map<String, Object> kv = delegateTask.getVariables();
|
||||||
|
GsonBuilder builder = new GsonBuilder();
|
||||||
|
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
||||||
|
|
||||||
|
Gson gson = builder.create();
|
||||||
|
JsonElement jsonElement = gson.toJsonTree(kv);
|
||||||
|
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
|
||||||
|
logger.error(JSONObject.toJSONString(resourceMountApplyDTO));
|
||||||
|
taskService.setAssignee(delegateTask.getId(), resourceMountApplyDTO.getUserId());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue