加入审核公用dto

This commit is contained in:
wangliwen 2022-05-16 14:46:40 +08:00
parent f1b1063044
commit 51949f672d
18 changed files with 103 additions and 99 deletions

View File

@ -90,6 +90,7 @@ public class AbilityCenterController {
if (tAbilityApplicationDTO.getId() == null) {
return null;
}
tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE);
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();

View File

@ -67,7 +67,7 @@ public class DemandDataController {
if (tDemandDataDTO.getId() == null) {
return null;
}
tDemandDataDTO.setCompleteEntry(Boolean.TRUE);
logger.info("-------------------1.保存申请表单成功--------------------------");
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();

View File

@ -34,10 +34,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "资源上架")
@ -103,6 +100,7 @@ public class ResourceMountController {
if (tResourceMountApplyDTO.getId() == null) {
return null;
}
tResourceMountApplyDTO.setCompleteEntry(Boolean.TRUE);
logger.info("-------------------1.保存申请表单成功--------------------------");
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();
@ -121,7 +119,6 @@ public class ResourceMountController {
logger.info("-------------------更新updateInstanceId.成功--------------------------");
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId());
}
return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
}
@ -138,6 +135,7 @@ public class ResourceMountController {
logger.info(JSONObject.toJSONString(tResourceUndercarriageApplyDTO));
logger.info("####################################################");
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
List<ProcessInstanceDTO> dtoList = new ArrayList<>();
Long resourceId = Long.valueOf(index.get("resourceId"));
String resourceName = index.get("resourceName");
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
@ -152,21 +150,22 @@ public class ResourceMountController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
resourceService.update(dto);
logger.error(resourceDTO.get().toString());
resourceDTO.get().setCompleteEntry(Boolean.TRUE);
logger.info("-------------------1.保存申请表单成功--------------------------");
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(resourceId.toString());
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架
ObjectMapper oMapper = new ObjectMapper();
Map<String, Object> variables = oMapper.convertValue(resourceDTO.get(), Map.class);
processStartDTO.setVariables(variables);
ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + index_.getBusinessKey());
dtoList.add(index_);
});
logger.info("-------------------1.保存申请表单成功--------------------------");
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(resourceId.toString());
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架
ObjectMapper oMapper = new ObjectMapper();
Map<String, Object> variables = oMapper.convertValue(resourceDTO.get(), Map.class);
processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey());
return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
return dtoList.stream().findAny().orElse(null);
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
}
}

View File

@ -0,0 +1,33 @@
package io.renren.common.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 审核流程各数据类 基础DTO
*/
@Data
public class AuditingBaseDTO implements Serializable {
/**
* 流程中是否存在拒绝
*/
private Boolean reject = null;
/**
* 流程直接被终止
*/
private Boolean termination = null;
/**
* 流程被驳回到第一个用户任务
*/
private Boolean backToFirst = null;
/**
* 流程完成表单录入?
*/
private Boolean completeEntry = null;
}

View File

@ -159,7 +159,7 @@ public class ActTaskController {
* 任务委托
*/
@PostMapping("entrust")
@ApiOperation("任务委托")
@ApiOperation("任务委托(更改审批人)")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "assignee", value = "受理人", paramType = "query", dataType = "String")
@ -261,7 +261,7 @@ public class ActTaskController {
* 终止流程
*/
@PostMapping("endProcess")
@ApiOperation("终止流程")
@ApiOperation("终止流程(直接全拒绝)")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "终止审核意见", paramType = "query", dataType = "String")
@ -276,7 +276,7 @@ public class ActTaskController {
* 驳回
*/
@PostMapping("backToFirst")
@ApiOperation("驳回,回退至第一个用户任务")
@ApiOperation("驳回,回退至第一个用户任务(重新录入表单)")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "任务ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "comment", value = "驳回审核意见", paramType = "query", dataType = "String")

View File

@ -592,6 +592,7 @@ public class ActTaskService extends BaseServiceImpl {
throw new RenException(ErrorCode.SUPERIOR_NOT_EXIST);
}
variables = processInstance.getProcessVariables();
variables.put("backToFirst", Boolean.TRUE); // 标识驳回到第一个任务节点
for (Task task : tasks) {
String commentMode = MessageUtils.getMessage(ErrorCode.REJECT_MESSAGE);
if (StringUtils.isNotEmpty(comment)) {

View File

@ -1,5 +1,6 @@
package io.renren.modules.demanData.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -15,7 +16,7 @@ import java.util.Date;
*/
@Data
@ApiModel(value = "能力需求评审主体")
public class TDemandDataDTO implements Serializable {
public class TDemandDataDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")

View File

@ -1,7 +1,10 @@
package io.renren.modules.demanData.listener;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.sys.dto.SysDeptDTO;
@ -21,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.Map;
@ -108,11 +110,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -154,11 +152,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
logger.error("---------------------------流程节点完成---------------------------------");
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);

View File

@ -1,5 +1,6 @@
package io.renren.modules.processForm.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -14,7 +15,7 @@ import java.io.Serializable;
*/
@Data
@ApiModel(value = "能力申请表单")
public class TAbilityApplicationDTO implements Serializable {
public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;

View File

@ -1,5 +1,6 @@
package io.renren.modules.processForm.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -11,7 +12,7 @@ import java.util.Map;
@Data
@ApiModel(value = "批量能力申请表单")
public class TAbilityBatchApplicationDTO implements Serializable {
public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;

View File

@ -1,6 +1,9 @@
package io.renren.modules.processForm.listener;
import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.modules.activiti.service.ActTaskService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.service.ApiGatewayService;
@ -26,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
@ -114,11 +116,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
*/
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -139,11 +137,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
private void create(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -212,11 +206,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti
!ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) return;
try {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);

View File

@ -1,6 +1,9 @@
package io.renren.modules.processForm.listener;
import com.google.gson.*;
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.dto.TAbilityApplicationDTO;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
@ -21,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
@ -110,11 +112,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);

View File

@ -1,5 +1,6 @@
package io.renren.modules.resource.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.swagger.annotations.ApiModel;
@ -19,7 +20,7 @@ import java.util.Optional;
*/
@Data
@ApiModel(value = "资源表")
public class ResourceDTO implements Serializable {
public class ResourceDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")

View File

@ -1,6 +1,9 @@
package io.renren.modules.resource.listener;
import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.ResourceEntityDelFlag;
import io.renren.modules.resource.service.ResourceService;
@ -21,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.Map;
@ -89,11 +91,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
*/
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -115,11 +113,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);

View File

@ -1,5 +1,6 @@
package io.renren.modules.resourceMountApply.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.resource.dto.ResourceDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -11,7 +12,7 @@ import java.util.List;
@Data
@ApiModel(value = "批量资源挂载申请表单 前端录入用")
public class TResourceBatchMountApplyDTO implements Serializable {
public class TResourceBatchMountApplyDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "上架申请人id")

View File

@ -1,6 +1,7 @@
package io.renren.modules.resourceMountApply.dto;
import com.alibaba.fastjson.JSON;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.resource.dto.ResourceDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -16,7 +17,7 @@ import java.io.Serializable;
*/
@Data
@ApiModel(value = "资源挂载申请表单")
public class TResourceMountApplyDTO implements Serializable {
public class TResourceMountApplyDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;

View File

@ -1,5 +1,6 @@
package io.renren.modules.resourceMountApply.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -11,7 +12,7 @@ import java.util.Map;
@Data
@ApiModel(value = "资源下架申请表单")
public class TResourceUndercarriageApplyDTO implements Serializable {
public class TResourceUndercarriageApplyDTO extends AuditingBaseDTO implements Serializable {
@ApiModelProperty(value = "下架申请人id")
private String userId;
@ApiModelProperty(value = "下架申请人名字")

View File

@ -1,7 +1,10 @@
package io.renren.modules.resourceMountApply.listener;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.*;
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.ApiGatewayService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
@ -22,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.lang.reflect.Type;
import java.util.Date;
import java.util.Map;
@ -116,11 +118,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
*/
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
@ -146,18 +144,11 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
private void complete(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
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);
Long resourceID = resourceMountApplyDTO.getResourceDTO().getId();
// apiGatewayService.registerApi2Gateway(String.valueOf(resourceID));
ResourceDTO re = resourceMountApplyDTO.getResourceDTO();
if (re != null) {
re.setDelFlag(0);
@ -175,11 +166,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
private void create(DelegateTask delegateTask, final SysRoleDTO roleDTO) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);