Commit dbd45d81 authored by suhuiguang's avatar suhuiguang

1.jyjc bug 19252

parent d4a3d7e9
......@@ -123,13 +123,13 @@
<choose>
<when test="identity == 'apply'">
and tzjia.application_unit_code = #{currentApplicationUnitCode} OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )
and (tzjia.application_unit_code = #{currentApplicationUnitCode} OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
</when>
<when test="identity == 'receive'">
and tzjia.inspection_unit_code = #{currentInspectionUnitCode} OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )
and (tzjia.inspection_unit_code = #{currentInspectionUnitCode} OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
</when>
<when test="identity == 'all'">
and (tzjia.application_unit_code = #{currentApplicationUnitCode} or tzjia.inspection_unit_code = #{currentInspectionUnitCode}) OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )
and ((tzjia.application_unit_code = #{currentApplicationUnitCode} or tzjia.inspection_unit_code = #{currentInspectionUnitCode}) OR tzjia.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
</when>
<otherwise>
1=2
......
......@@ -5,7 +5,6 @@ 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.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
......@@ -229,74 +228,6 @@ public class TaskModelServiceImpl {
}
/**
* 待办编辑接口 【如果没有代办直接返回空,业务判断】 ---- 在用,误删
* 参数
* 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 = Systemctl.taskV2Client.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());
}
Systemctl.taskV2Client.batchUpdate(collect);
} else {
collect.get(0).setRoutePath(collect.get(0).getRoutePath().replace("roleIds=", "roleIds=55555&fq="));
Systemctl.taskV2Client.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
......@@ -406,22 +337,6 @@ public class TaskModelServiceImpl {
/**
* 根据流程状态name 获取流程状态code
*
* @param name 流程状态name
* @return 流程状态code
*/
public Integer getDictionaryCodeByName(String name) {
List<DataDictionary> jggzzz = iDataDictionaryService.getByType("JGGZZZ");
for (DataDictionary item : jggzzz) {
if (item.getName().equals(name)) {
return Integer.parseInt(item.getCode());
}
}
return null;
}
/**
* 根据工作流返回信息,组装业务需要的数据
*
* @param processTaskDTOS 工作流返回信息
......
......@@ -180,7 +180,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
model.setPromoter(RequestContext.getExeUserId());
model.setNextExecuteUserIds(nextUserIds);
model.setStatus(String.valueOf(FlowStatusEnum.TO_SUBMITTED.getCode())); //6611 对应数据字典 检验流程状态 待受理
commonService.saveExecuteFlowData2Redis(model.getInstanceId(), this.buildInstanceRuntimeData(model));
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(model));
} else if (model.getOperationType().equals("1")) { // 工作台暂存、详情保存逻辑
String[] inspectionUnit = model.getInspectionUnitCode().split("_");
if (inspectionUnit.length == 2) {
......@@ -368,8 +368,8 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
model.setNextTaskName(taskName1);
model.setNextExecuteIds(executorRoleIds);
model.setNextExecuteUserIds(nextUserIds);
executeOneStep(model, taskName1, nextUserIds);
commonService.saveExecuteFlowData2Redis(model.getInstanceId(), this.buildInstanceRuntimeData(model));
createNextTask(model, taskName1, nextUserIds);
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(model));
this.updateWithModel(model);
}
return this.buildRedundancyField(model);
......@@ -550,7 +550,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
throw new BadRequest("当前流程已经被执行!请重新打开页面查看并执行!");
}
// 流程执行时,状态及权限校验
// commonService.checkForExecuteFlow(nextTaskId, instanceId);
commonService.checkForExecuteFlow(nextTaskId, instanceId);
Long sequenceNbr = Long.parseLong(params.get("sequenceNbr") + "");
JyjcInspectionApplication entity = this.getBaseMapper().selectById(sequenceNbr);
//组装信息
......@@ -625,7 +625,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
this.pushInspectionApplication(model);
this.saveBatchResume(jgResumeInfoDtoList);
// 更新流程中的流程数据
commonService.saveExecuteFlowData2Redis(model.getInstanceId(), this.buildInstanceRuntimeData(entity));
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(entity));
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -636,7 +636,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
private void saveBatchResume( List<JgResumeInfoDto> jgResumeInfoDtoList){
private void saveBatchResume(List<JgResumeInfoDto> jgResumeInfoDtoList) {
try {
jgFeignClient.saveBatchResume(jgResumeInfoDtoList);
} catch (Exception e) {
......@@ -709,10 +709,10 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
// 流程执行时,状态及权限校验
commonService.checkForExecuteFlow(nextTaskId, instanceId);
Long sequenceNbr = Long.parseLong(params.get("sequenceNbr") + "");
JyjcInspectionApplication entity = this.getBaseMapper().selectById(sequenceNbr);
JyjcInspectionApplicationModel model = this.queryBySeq(sequenceNbr);
ArrayList<String> roleListAll = new ArrayList<>();
ArrayList<String> roleList = new ArrayList<>();
String taskId = entity.getNextTaskId();
String taskId = model.getNextTaskId();
//组装信息
TaskResultDTO task = new TaskResultDTO();
task.setResultCode("approvalStatus");
......@@ -722,26 +722,22 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
map.put("approvalStatus", "1");
task.setVariable(map);
//执行流程
task.setNextExecuteUserCompanyCode(entity.getInspectionUnitCode());
task.setNextExecuteUserCompanyCode(model.getInspectionUnitCode());
ProcessTaskDTO processTaskDTO = cmWorkflowService.reject(taskId, task);
String taskName1 = "";
String nextTaskName = "";
this.buildRoleList(Collections.singletonList(processTaskDTO), roleList, roleListAll);
List<WorkflowResultDto> workflowResultDtos = taskModelService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO));
entity.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
JyjcInspectionApplicationModel model = new JyjcInspectionApplicationModel();
BeanUtils.copyProperties(entity, model);
model.setStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
model.setStatusName(FlowStatusEnum.REJECTED.getName());
String processDescription = (String) params.get("comments");
if (StringUtils.isNotBlank(processDescription)) {
entity.setProcessDescription(processDescription);
model.setProcessDescription(processDescription);
}
String nextUserIds = workflowResultDtos.get(0).getNextExecutorUserIds();
String executorRoleIds = workflowResultDtos.get(0).getExecutorRoleIds();
if (processTaskDTO != null && processTaskDTO.getNextTask() != null && processTaskDTO.getNextTask().size() > 0) {
taskName1 = processTaskDTO.getNextTask().get(0).getName();
nextTaskId = processTaskDTO.getNextTask().get(0).getId();
}
nextTaskName = workflowResultDtos.get(0).getNextTaskName();
nextTaskId = workflowResultDtos.get(0).getNextTaskId();
model.setNextExecuteIds(String.join(",", roleList));
if (!org.springframework.util.ObjectUtils.isEmpty(model.getWorkflowRole())) {
model.setWorkflowRole(model.getWorkflowRole() + "," + String.join(",", roleList));
......@@ -750,14 +746,13 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
model.setNextTaskId(nextTaskId);
model.setPromoter(RequestContext.getExeUserId());
model.setNextTaskName(taskName1);
model.setNextTaskName(nextTaskName);
model.setNextExecuteIds(executorRoleIds);
model.setNextExecuteUserIds(nextUserIds);
executeOneStep(model, taskName1, nextUserIds);
BeanUtils.copyProperties(model, entity);
this.updateById(entity);
createNextTask(model, nextTaskName, nextUserIds);
this.updateWithModel(model);
// 更新流程中的流程数据
commonService.saveExecuteFlowData2Redis(model.getInstanceId(), this.buildInstanceRuntimeData(entity));
commonService.saveExecuteFlowData2Redis(model.getProcessInstanceId(), this.buildInstanceRuntimeData(model));
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
......@@ -878,7 +873,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
dto.setTaskCode(model.getApplicationNo());
dto.setTaskType(BizTypeEnum.getNumByCode(model.getBizType()));
dto.setTaskTypeLabel(BizTypeEnum.getNameByCode(model.getBizType()));
dto.setRelationId(model.getInstanceId());
dto.setRelationId(model.getProcessInstanceId());
dto.setExecuteUserIds(model.getNextExecuteUserIds());
dto.setTaskStatusLabel("未处理");
dto.setFlowStatus(Integer.valueOf(model.getStatus()));
......@@ -893,7 +888,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
private void executeOneStep(JyjcInspectionApplicationModel model, String taskName, String nextUserIds) {
private void createNextTask(JyjcInspectionApplicationModel model, String taskName, String nextUserIds) {
// 先更新之前的待办
TaskV2Model taskV2Model = updateTaskModel(model);
taskV2Model.setTaskDesc("");
......@@ -932,7 +927,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
private TaskV2Model updateTaskModel(JyjcInspectionApplicationModel model) {
Map<String, Object> params = new HashMap<>();
this.cleanNoUsedData(model);
params.put("relationId", model.getProcessInstanceId());
params.put("taskStatus", model.getStatus());
params.put("taskStatusLabel", model.getStatusName());
......@@ -942,14 +936,6 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
return taskModelService.updateTaskModel(params);
}
/**
* 清楚无用数据防止url过长
*
* @param model
*/
private void cleanNoUsedData(JyjcInspectionApplicationModel model) {
// todo 预留
}
/**
* 缓存当前正在流程中的实例的流程数据
......
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