Commit c6f92c78 authored by 李秀明's avatar 李秀明

Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register

parents f0f5f181 74eef11a
...@@ -55,7 +55,7 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -55,7 +55,7 @@ public class JyjcOpeningApplicationController extends BaseController {
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JyjcOpeningApplicationModel> updateBySequenceNbrJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateModel(model,false));
} }
/** /**
...@@ -141,4 +141,12 @@ public class JyjcOpeningApplicationController extends BaseController { ...@@ -141,4 +141,12 @@ public class JyjcOpeningApplicationController extends BaseController {
jyjcOpeningApplicationServiceImpl.stopFlow(instanceId); jyjcOpeningApplicationServiceImpl.stopFlow(instanceId);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/restartFlow/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "重新提交开通申请", notes = "重新提交开通申请")
public ResponseModel<JyjcOpeningApplicationModel> resubmitJyjcOpeningApplication(@RequestBody JyjcOpeningApplicationModel model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.updateModel(model, true));
}
} }
...@@ -122,11 +122,25 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -122,11 +122,25 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
} }
@Transactional (rollbackFor = {Exception.class, CommonException.class}) @Transactional (rollbackFor = {Exception.class, CommonException.class})
public JyjcOpeningApplicationModel updateModel(JyjcOpeningApplicationModel model) { public JyjcOpeningApplicationModel updateModel(JyjcOpeningApplicationModel model, Boolean restartFlow) {
if (model.getSequenceNbr() == null) { if (model.getSequenceNbr() == null) {
throw new BadRequest("sequenceNbr不能为空!"); throw new BadRequest("sequenceNbr不能为空!");
} }
return this.updateModel(model); try {
if (restartFlow) {
String instanceId = startFlow();
JSONObject dataObject = getTask(instanceId);
JSONArray executorArray = dataObject.getJSONObject("nodeInfo").getJSONArray("executor");
if(!ValidationUtil.isEmpty(executorArray)) {
String roleGroups = executorArray.stream().map(json -> Optional.ofNullable(((LinkedHashMap) json).get("groupId")).orElse("").toString()).collect(Collectors.joining(","));
model.setWorkflowRole(roleGroups);
}
}
return this.updateWithModel(model);
} catch (Exception e) {
log.error("saveModel: model={} error", model, e);
throw new BaseException(e.getMessage());
}
} }
public void updateModelByInstanceId(String instanceId) { public void updateModelByInstanceId(String instanceId) {
...@@ -153,17 +167,12 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp ...@@ -153,17 +167,12 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
} }
private JSONObject getTask(String instanceId) { private JSONObject getTask(String instanceId) {
try {
AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId); AjaxResult ajaxResult = Workflow.taskClient.getTask(instanceId);
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data"))); JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");// 工作流ID String taskId = dataObject.getString("id");// 工作流ID
FeignClientResult<JSONObject> nodeInfo = workflowFeignClient.getNodeInfotoken(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), taskId); FeignClientResult<JSONObject> nodeInfo = workflowFeignClient.getNodeInfotoken(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), taskId);
dataObject.put("nodeInfo", nodeInfo.getResult()); dataObject.put("nodeInfo", nodeInfo.getResult());
return dataObject; return dataObject;
} catch (Exception e) {
e.printStackTrace();
}
return null;
} }
/** /**
......
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