|
@@ -1,8 +1,11 @@
|
|
|
package com.willalp.flow.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.willalp.common.core.domain.DeptOrUserResp;
|
|
|
import com.willalp.common.exception.base.BaseException;
|
|
|
import com.willalp.common.utils.DateUtils;
|
|
|
import com.willalp.common.utils.SecurityUtils;
|
|
@@ -17,6 +20,9 @@ import com.willalp.flow.service.IHsFlowConditionModelService;
|
|
|
import com.willalp.flow.service.IHsFlowRunningRecordService;
|
|
|
import com.willalp.msg.domain.HsAppUserMsg;
|
|
|
import com.willalp.msg.service.IHsAppUserMsgService;
|
|
|
+import com.willalp.system.domain.HsPostConfig;
|
|
|
+import com.willalp.system.domain.vo.PostTreeVo;
|
|
|
+import com.willalp.system.service.IHsPostConfigService;
|
|
|
import com.willalp.wx.domain.WxMsgTemplateApproval;
|
|
|
import com.willalp.wx.domain.WxMsgTemplateApprovalResult;
|
|
|
import com.willalp.wx.enums.WxTemplateKeyEnum;
|
|
@@ -69,6 +75,8 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
|
|
|
@Resource
|
|
|
private IHsAppUserMsgService userMsgService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IHsPostConfigService postConfigService;
|
|
|
|
|
|
@Override
|
|
|
public void submitATask(HsFlowTask task, Map<String, String> params) {
|
|
@@ -88,11 +96,9 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
|
|
|
if (ObjectUtils.isNotNull(params)) {
|
|
|
String userName = params.get("candidate");
|
|
|
if (StringUtils.isNotBlank(userName)) {
|
|
|
- hsFlowBase.setOperator(userName);
|
|
|
task.setOperator(userName);
|
|
|
}
|
|
|
}
|
|
|
- hsFlowBaseMapper.updateById(hsFlowBase);
|
|
|
hsFlowTaskMapper.insert(task);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -148,18 +154,18 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
|
|
|
} else {
|
|
|
//查看有无条件组件
|
|
|
if (StringUtils.isNotBlank(hsFlowBase.getTermModuleId()) &&
|
|
|
+ hsFlowBase.getTermModuleId().contains(FlowEnum.NODE.getValue()) &&
|
|
|
null != jsonObject && resultTrue) {
|
|
|
//遍历绑定的条件组件 查找下一步 (待添加条件级别优化)
|
|
|
- List<HsFlowConditionModel> hsFlowConditionModels = flowConditionModelMapper.queryConditionGroup(hsFlowBase.getTermModuleId());
|
|
|
+ List<HsFlowConditionModel> hsFlowConditionModels = flowConditionModelMapper.queryConditionGroup(hsFlowBase.getUpStepId(), hsFlowBase.getTermModuleId());
|
|
|
for (HsFlowConditionModel item : hsFlowConditionModels) {
|
|
|
String paramName = item.getParamName();
|
|
|
if (null != jsonObject.get(paramName)) {
|
|
|
- if (conditionModelService.executeConditionJudgment(item, jsonObject.get(paramName)) && item.getConditionType().equals("2")) {
|
|
|
- stepId = item.getDownStepId();
|
|
|
- break;
|
|
|
- }
|
|
|
if (conditionModelService.executeConditionJudgment(item, jsonObject.get(paramName))) {
|
|
|
- stepId = item.getDownStepId();
|
|
|
+ //获取当前基础组件
|
|
|
+ HsFlowBase newHsFlowBase = hsFlowBaseMapper.selectById(item.getId());
|
|
|
+ stepId = newHsFlowBase.getDownStepId();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -369,4 +375,71 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<PostTreeVo> getTreePost(String taskId) {
|
|
|
+ if (StringUtils.isNotBlank(taskId)) {
|
|
|
+ HsFlowTask hsFlowTask = hsFlowTaskMapper.selectById(taskId);
|
|
|
+ if (null != hsFlowTask) {
|
|
|
+ String baseId = hsFlowTask.getBaseId();
|
|
|
+ if (StringUtils.isNotBlank(baseId)) {
|
|
|
+ HsFlowBase hsFlowBase = hsFlowBaseMapper.selectById(baseId);
|
|
|
+ if (null != hsFlowBase) {
|
|
|
+ String operator = hsFlowBase.getOperator();
|
|
|
+ if (StringUtils.isNotBlank(operator)) {
|
|
|
+ PostTreeVo postTreeVo = new PostTreeVo();
|
|
|
+ postTreeVo.setText("默认");
|
|
|
+ postTreeVo.setValue("defaultId");
|
|
|
+ List<DeptOrUserResp> deptOrUserResps = JSON.parseArray(operator, DeptOrUserResp.class);
|
|
|
+ List<PostTreeVo> childrens = new ArrayList<PostTreeVo>();
|
|
|
+ if (CollUtil.isNotEmpty(deptOrUserResps)) {
|
|
|
+ for (DeptOrUserResp deptOrUserResp : deptOrUserResps) {
|
|
|
+ PostTreeVo pv = new PostTreeVo();
|
|
|
+ pv.setText(deptOrUserResp.getName());
|
|
|
+ pv.setValue(deptOrUserResp.getId());
|
|
|
+ childrens.add(pv);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ postTreeVo.setChildren(childrens);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<HsPostConfig> hsPostConfigs = postConfigService.selectHsPostConfigList(null);
|
|
|
+ if (0 != hsPostConfigs.size()) {
|
|
|
+ List<PostTreeVo> list = new ArrayList<>();
|
|
|
+ String userBS = "AA";
|
|
|
+ hsPostConfigs.forEach(item -> {
|
|
|
+ PostTreeVo postTreeVo = new PostTreeVo();
|
|
|
+ postTreeVo.setText(item.getPostName());
|
|
|
+ postTreeVo.setValue(item.getId());
|
|
|
+ String postUserG = item.getPostUserG();
|
|
|
+ List<PostTreeVo> postTreeCVos = new ArrayList<>();
|
|
|
+ if (postUserG != null) {
|
|
|
+ String[] split = postUserG.split(",");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ PostTreeVo postTreeCVo = new PostTreeVo();
|
|
|
+ String nick;
|
|
|
+ String userId;
|
|
|
+ int of = split[i].indexOf(userBS);
|
|
|
+ if (of != -1) {
|
|
|
+ nick = split[i].substring(0, of);
|
|
|
+ userId = split[i].substring(of);
|
|
|
+ } else {
|
|
|
+ nick = "WILLALP";
|
|
|
+ userId = "admin";
|
|
|
+ }
|
|
|
+ postTreeCVo.setText(nick);
|
|
|
+ postTreeCVo.setValue(userId);
|
|
|
+ postTreeCVos.add(postTreeCVo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ postTreeVo.setChildren(postTreeCVos);
|
|
|
+ list.add(postTreeVo);
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|