fix:报告流程回调优化
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.qms.business.reportdoc.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
@@ -307,21 +308,41 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
//流程状态 3-拒绝 1-通过 2-完成 4-取消流程
|
||||
String PROCESS_STATUS = variables.getString(QmsBpmConstant.PROCESS_INSTANCE_VARIABLE_STATUS);
|
||||
String mainId = variables.getString("mainId");
|
||||
JSONArray fieldExtensions = new JSONArray();
|
||||
if(variables.containsKey(QmsBpmConstant.BPM_FIELD_EXTENSIONS)){
|
||||
fieldExtensions = variables.getJSONArray(QmsBpmConstant.BPM_FIELD_EXTENSIONS);
|
||||
}
|
||||
ReportDocumentMainDO entity = getReportDocumentMain(Long.valueOf(mainId));
|
||||
log.error("流程回调:{}", JSONObject.toJSONString(reqDTO));
|
||||
String currentActivityId = variables.getString(QmsBpmConstant.BPM_CALLBACK_ACTIVITY_ID);
|
||||
String RETURN_FLAG_PREFIX_KEY = variables.getString(QmsBpmConstant.BPM_CALLBACK_RETURN_FLAG_PREFIX_KEY);
|
||||
String returnFlagKey = RETURN_FLAG_PREFIX_KEY + "Activity_001";
|
||||
|
||||
//判断是否最后一个节点
|
||||
String lastActivityFlag = "0";
|
||||
String firstActivityFlag = "0";
|
||||
if(!fieldExtensions.isEmpty()){
|
||||
for(int i = 0; i < fieldExtensions.size(); i++){
|
||||
JSONObject fieldExtension = fieldExtensions.getJSONObject(i);
|
||||
if(fieldExtension.getString("fieldName").equals(QmsBpmConstant.BPM_LAST_ACTIVITY_FLAG)){
|
||||
lastActivityFlag = "1";
|
||||
}
|
||||
if(fieldExtension.getString("fieldName").equals(QmsBpmConstant.BPM_FIRST_ACTIVITY_FLAG)){
|
||||
firstActivityFlag = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ObjectUtils.isEmpty(RETURN_FLAG_PREFIX_KEY) || "null".equals(RETURN_FLAG_PREFIX_KEY))
|
||||
returnFlagKey = "false";
|
||||
// if("3".equals(PROCESS_STATUS)){
|
||||
//"RETURN_FLAG_Activity_001": true 标识驳回到发起环节
|
||||
if(variables.containsKey(returnFlagKey) && variables.getString(returnFlagKey).equals("true")){
|
||||
//拒绝(重制)
|
||||
entity.setFlowStatus(QmsCommonConstant.REJECTED);
|
||||
entity.setDocumentSignature("");
|
||||
}
|
||||
else if("2".equals(PROCESS_STATUS)){
|
||||
//完成
|
||||
entity.setFlowStatus(QmsCommonConstant.COMPLETED);
|
||||
}else if("2".equals(PROCESS_STATUS)){
|
||||
//提交(审批中)
|
||||
assembleSignature(currentActivityId, entity);
|
||||
}
|
||||
else if("4".equals(PROCESS_STATUS)){
|
||||
@@ -329,7 +350,12 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
entity.setFlowStatus(QmsCommonConstant.VOID);
|
||||
entity.setDocumentSignature("");
|
||||
}else if("1".equals(PROCESS_STATUS)){
|
||||
entity.setDocumentSignature("");
|
||||
//通过
|
||||
assembleSignature(currentActivityId, entity);
|
||||
if("1".equals(firstActivityFlag))
|
||||
entity.setFlowStatus(QmsCommonConstant.IN_PROGRESS); //驳回后重新提交
|
||||
if("1".equals(lastActivityFlag))
|
||||
entity.setFlowStatus(QmsCommonConstant.COMPLETED); //结束审批
|
||||
}
|
||||
reportDocumentMainMapper.updateById(entity);
|
||||
JSONObject ret = new JSONObject();
|
||||
@@ -337,12 +363,14 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
}
|
||||
|
||||
private void assembleSignature(String currentActivityId, ReportDocumentMainDO entity){
|
||||
if(ObjectUtils.isEmpty(currentActivityId) || "null".equals(currentActivityId))
|
||||
return;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String sign = entity.getDocumentSignature();
|
||||
JSONObject signObj = new JSONObject();
|
||||
if(!ObjectUtils.isEmpty( sign))
|
||||
signObj = JSONObject.parseObject(sign);
|
||||
if(!signObj.containsKey(currentActivityId))
|
||||
if(signObj.containsKey(currentActivityId))
|
||||
return;
|
||||
JSONObject obj = new JSONObject();
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
@@ -350,6 +378,7 @@ public class ReportDocumentMainServiceImpl implements ReportDocumentMainService,
|
||||
//当前登录用户昵称
|
||||
String nickName = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
ConfigUserSignatureDO configUserSignatureDO = configUserSignatureService.getByUserId(userId);
|
||||
obj.put("signatureId", "");
|
||||
if(configUserSignatureDO != null)
|
||||
obj.put("signatureId", configUserSignatureDO.getId());
|
||||
obj.put("userId", userId);
|
||||
|
||||
Reference in New Issue
Block a user