resource 更新失败

This commit is contained in:
wangliwen 2022-07-11 15:33:23 +08:00
parent 97cd4bede6
commit 588b41669d
3 changed files with 27 additions and 23 deletions

View File

@ -88,7 +88,8 @@ public class AbilityCenterControllerV2 {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
abilityBatchApplicationDTO.setApplyFlag(UUID.randomUUID().toString()); // 同一次的申请标识 final String applyFlag = UUID.randomUUID().toString();
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
final UserDetail user = SecurityUser.getUser(); final UserDetail user = SecurityUser.getUser();
@ -106,9 +107,9 @@ public class AbilityCenterControllerV2 {
tAbilityApplicationDTO.setInstanceId(abilityBatchApplicationDTO.getInstanceId()); tAbilityApplicationDTO.setInstanceId(abilityBatchApplicationDTO.getInstanceId());
tAbilityApplicationDTO.setUnit(abilityBatchApplicationDTO.getUnit()); tAbilityApplicationDTO.setUnit(abilityBatchApplicationDTO.getUnit());
tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser()); tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser());
tAbilityApplicationDTO.setResourceId(index.get("resourceId")); tAbilityApplicationDTO.setResourceId(index.get("resourceId").toString());
tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser()); tAbilityApplicationDTO.setUser(abilityBatchApplicationDTO.getUser());
tAbilityApplicationDTO.setSystem(index.get("resourceName")); tAbilityApplicationDTO.setSystem(index.get("resourceName").toString());
tAbilityApplicationDTO.setEnclosure(abilityBatchApplicationDTO.getEnclosure()); // 附件 tAbilityApplicationDTO.setEnclosure(abilityBatchApplicationDTO.getEnclosure()); // 附件
tAbilityApplicationDTO.setUserId(abilityBatchApplicationDTO.getUserId()); tAbilityApplicationDTO.setUserId(abilityBatchApplicationDTO.getUserId());
tAbilityApplicationDTO.setApproveStatus("审核中"); tAbilityApplicationDTO.setApproveStatus("审核中");
@ -178,7 +179,7 @@ public class AbilityCenterControllerV2 {
put("tAbilityApplicationDTOList", dtoList); // 归属该部门的申请 put("tAbilityApplicationDTOList", dtoList); // 归属该部门的申请
put("key", processStartDTO.getBusinessKey()); // 归属该部门申请的表单id put("key", processStartDTO.getBusinessKey()); // 归属该部门申请的表单id
put("deptId", deptId); // 归属部门 put("deptId", deptId); // 归属部门
put("id", UUID.randomUUID().toString()); //申请id put("id", applyFlag); //申请id
put("creator", user == null ? null : user.getId()); // 创建人 put("creator", user == null ? null : user.getId()); // 创建人
put("userId", user == null ? null : user.getId()); // 创建人 put("userId", user == null ? null : user.getId()); // 创建人
put("basic_facilities", basic_facilities); // 是否为基础设施 put("basic_facilities", basic_facilities); // 是否为基础设施

View File

@ -26,7 +26,6 @@ import java.util.Map;
/** /**
* 运行中的流程 * 运行中的流程
*
*/ */
@Service @Service
public class ActRunningService { public class ActRunningService {
@ -43,24 +42,24 @@ public class ActRunningService {
* 流程定义列表 * 流程定义列表
*/ */
public PageData<Map<String, Object>> page(Map<String, Object> params) { public PageData<Map<String, Object>> page(Map<String, Object> params) {
String id = (String)params.get("id"); String id = (String) params.get("id");
String definitionKey = (String)params.get("definitionKey"); String definitionKey = (String) params.get("definitionKey");
//分页参数 //分页参数
int curPage = 1; int curPage = 1;
int limit = 10; int limit = 10;
if(params.get(Constant.PAGE) != null){ if (params.get(Constant.PAGE) != null) {
curPage = Integer.parseInt((String)params.get(Constant.PAGE)); curPage = Integer.parseInt((String) params.get(Constant.PAGE));
} }
if(params.get(Constant.LIMIT) != null){ if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String)params.get(Constant.LIMIT)); limit = Integer.parseInt((String) params.get(Constant.LIMIT));
} }
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery(); ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
if (StringUtils.isNotBlank(id)){ if (StringUtils.isNotBlank(id)) {
processInstanceQuery.processInstanceId(id); processInstanceQuery.processInstanceId(id);
} }
if (StringUtils.isNotBlank(definitionKey)){ if (StringUtils.isNotBlank(definitionKey)) {
processInstanceQuery.processDefinitionKey(definitionKey); processInstanceQuery.processDefinitionKey(definitionKey);
} }
@ -69,7 +68,7 @@ public class ActRunningService {
for (ProcessInstance processInstance : processInstanceList) { for (ProcessInstance processInstance : processInstanceList) {
objectList.add(processInstanceConvert(processInstance)); objectList.add(processInstanceConvert(processInstance));
} }
return new PageData<>(objectList, (int)processInstanceQuery.count()); return new PageData<>(objectList, (int) processInstanceQuery.count());
} }
/** /**
@ -85,7 +84,7 @@ public class ActRunningService {
map.put("businessKey", processInstance.getBusinessKey()); map.put("businessKey", processInstance.getBusinessKey());
map.put("activityId", processInstance.getActivityId()); map.put("activityId", processInstance.getActivityId());
ProcessDefinitionEntity definition = (ProcessDefinitionEntity)((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId()); ProcessDefinitionEntity definition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
ActivityImpl activity = definition.findActivity(processInstance.getActivityId()); ActivityImpl activity = definition.findActivity(processInstance.getActivityId());
map.put("activityName", activity.getProperty("name")); map.put("activityName", activity.getProperty("name"));
map.put("suspended", processInstance.isSuspended()); map.put("suspended", processInstance.isSuspended());
@ -95,21 +94,23 @@ public class ActRunningService {
/** /**
* 删除实例 * 删除实例
*
* @param id 实例ID * @param id 实例ID
*/ */
public void delete(String id){ public void delete(String id) {
runtimeService.deleteProcessInstance(id, null); runtimeService.deleteProcessInstance(id, null);
} }
/** /**
* 启动流程实例 * 启动流程实例
*
* @param key 流程定义标识key * @param key 流程定义标识key
*/ */
public ProcessInstanceDTO startProcess(String key){ public ProcessInstanceDTO startProcess(String key) {
String userId = SecurityUser.getUserId().toString(); String userId = SecurityUser.getUserId().toString();
identityService.setAuthenticatedUserId(userId); identityService.setAuthenticatedUserId(userId);
ProcessDefinitionEntity definition = (ProcessDefinitionEntity)repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult(); ProcessDefinitionEntity definition = (ProcessDefinitionEntity) repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult();
if(definition.isSuspended()){ if (definition.isSuspended()) {
throw new RenException(ErrorCode.PROCESS_START_ERROR); throw new RenException(ErrorCode.PROCESS_START_ERROR);
} }
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key);
@ -134,17 +135,18 @@ public class ActRunningService {
/** /**
* 根据流程Key启动实例 * 根据流程Key启动实例
*
* @param processStartDTO * @param processStartDTO
* @return * @return
*/ */
public ProcessInstanceDTO startOfBusinessKey(ProcessStartDTO processStartDTO) { public ProcessInstanceDTO startOfBusinessKey(ProcessStartDTO processStartDTO) {
String userId = SecurityUser.getUserId().toString(); String userId = SecurityUser.getUserId().toString();
identityService.setAuthenticatedUserId(userId); identityService.setAuthenticatedUserId(userId);
ProcessDefinitionEntity definition = (ProcessDefinitionEntity)repositoryService.createProcessDefinitionQuery().processDefinitionKey(processStartDTO.getProcessDefinitionKey()).latestVersion().singleResult(); ProcessDefinitionEntity definition = (ProcessDefinitionEntity) repositoryService.createProcessDefinitionQuery().processDefinitionKey(processStartDTO.getProcessDefinitionKey()).latestVersion().singleResult();
if(definition.isSuspended()){ if (definition.isSuspended()) {
throw new RenException(ErrorCode.PROCESS_START_ERROR); throw new RenException(ErrorCode.PROCESS_START_ERROR);
} }
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processStartDTO.getProcessDefinitionKey(), processStartDTO.getBusinessKey(),processStartDTO.getVariables()); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processStartDTO.getProcessDefinitionKey(), processStartDTO.getBusinessKey(), processStartDTO.getVariables());
ProcessInstanceDTO dto = new ProcessInstanceDTO(); ProcessInstanceDTO dto = new ProcessInstanceDTO();
this.convertInstance(processInstance, dto); this.convertInstance(processInstance, dto);
return dto; return dto;

View File

@ -346,6 +346,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
attrEntities.forEach(item -> { attrEntities.forEach(item -> {
item.setId(null); item.setId(null);
item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); item.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
item.setDataResourceId(resourceEntity.getId());
attrDao.insert(item); attrDao.insert(item);
}); });
} }