|
|
@ -41,10 +41,7 @@ import com.yxt.anrui.flowable.feign.form.MessageFlowableQuery; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.UserByRolesAndOrgQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.UserQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.*; |
|
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
@ -618,4 +615,86 @@ public class FlowableRest implements FlowableFeign { |
|
|
|
} |
|
|
|
return rb.success().setData(process); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultBean shareFlowable(FlowableShareQuery flowableShareQuery) { |
|
|
|
ResultBean rb = ResultBean.fireSuccess(); |
|
|
|
log.info("分享功能,参数:{}", JSONObject.toJSONString(flowableShareQuery)); |
|
|
|
//勾选的人员sid
|
|
|
|
List<String> memberSidList = flowableShareQuery.getMembers(); |
|
|
|
//勾选的部门sid
|
|
|
|
List<String> orgSidList = flowableShareQuery.getGroups(); |
|
|
|
ShareUserQuery shareUserQuery = new ShareUserQuery(); |
|
|
|
shareUserQuery.setOrgSids(orgSidList); |
|
|
|
shareUserQuery.setMemberSids(memberSidList); |
|
|
|
//查询所勾选的人员和勾选的部门下的去重后的所有人员的用户sid
|
|
|
|
ResultBean<List<String>> staffList = sysUserFeign.shareSelectUser(shareUserQuery); |
|
|
|
if(memberSidList == null && orgSidList != null && orgSidList.size()>0){ |
|
|
|
if(staffList.getData() == null || staffList.getData().size() == 0){ |
|
|
|
return rb.setMsg("所选部门下无分享人员"); |
|
|
|
} |
|
|
|
} |
|
|
|
if(memberSidList == null && orgSidList == null && orgSidList.size() == 0){ |
|
|
|
return rb.setMsg("请选择人员"); |
|
|
|
} |
|
|
|
//组装分享的消息数据
|
|
|
|
String taskId = flowableShareQuery.getTaskId(); |
|
|
|
//流程定义id
|
|
|
|
String modelId = flowableShareQuery.getProcDefId(); |
|
|
|
String proInstId = flowableShareQuery.getProcInsId(); |
|
|
|
String taskDefKey = flowableShareQuery.getTaskDefKey(); |
|
|
|
//移动端参数
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery() |
|
|
|
.includeProcessVariables().taskId(taskId).singleResult(); |
|
|
|
if (historicTaskInstance == null) { |
|
|
|
log.info("分享失败:没有获取到业务参数!"); |
|
|
|
return rb.setMsg("分享失败!"); |
|
|
|
} |
|
|
|
Map<String, Object> processVariables = historicTaskInstance.getProcessVariables(); |
|
|
|
if (historicTaskInstance == null) { |
|
|
|
log.info("分享失败:没有获取到业务参数!"); |
|
|
|
return rb.setMsg("分享失败!"); |
|
|
|
} |
|
|
|
Map<String, Object> app = new HashMap<>(); |
|
|
|
if (processVariables.get("app") != null) { |
|
|
|
app = (Map<String, Object>) processVariables.get("app"); |
|
|
|
} |
|
|
|
log.info("分享方法-historicTaskInstance:{}", JSONObject.toJSONString(historicTaskInstance)); |
|
|
|
StringBuilder userSids = new StringBuilder(); |
|
|
|
staffList.getData().forEach(f->{ |
|
|
|
userSids.append(f).append(","); |
|
|
|
}); |
|
|
|
userSids.deleteCharAt(userSids.length() - 1); |
|
|
|
MessageFlowableQuery mfq = new MessageFlowableQuery(); |
|
|
|
mfq.setAppMap(app); |
|
|
|
mfq.setBusinessSid(flowableShareQuery.getBusinessSid()); |
|
|
|
mfq.setMsgContent("分享的流程审批,请查看"); |
|
|
|
mfq.setUserSid(flowableShareQuery.getUserSid()); |
|
|
|
mfq.setUserSids(userSids.toString()); |
|
|
|
|
|
|
|
UpdateFlowFieldVo uff = new UpdateFlowFieldVo(); |
|
|
|
uff.setTaskDefKey(taskDefKey); |
|
|
|
uff.setTaskId(taskId); |
|
|
|
uff.setProcInsId(proInstId); |
|
|
|
uff.setProcDefId(modelId); |
|
|
|
Map<String, String> process = processService.getProcessDefByDefId(historicTaskInstance.getProcessDefinitionId()); |
|
|
|
log.info("分享成功-process:{}", process); |
|
|
|
if (process == null) { |
|
|
|
log.info("分享失败,流程定义不存在!"); |
|
|
|
return rb.setMsg("分享失败,流程定义不存在!"); |
|
|
|
} |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
mfq.setUfVo(messageFlowVo); |
|
|
|
mfq.setModuleName(process.get("NAME_")); |
|
|
|
mfq.setMsgTitle(process.get("NAME_")); |
|
|
|
ResultBean<String> resultBean = messageFeign.pushMessageCC(mfq); |
|
|
|
log.info("分享成功-resultBean:{}", resultBean); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
log.info("分享失败,分享消息异常!:{}", JSONObject.toJSONString(resultBean)); |
|
|
|
return rb.setMsg("分享失败,分享消息异常!"); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|