Browse Source

修改

zhanglei
dimengzhe 2 years ago
parent
commit
7d12d389ac
  1. 3
      anrui-base/anrui-base-api/src/main/java/com/yxt/anrui/base/api/busvehicleapply/BusVehicleApplyDto.java
  2. 21
      anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowListVo.java
  3. 6
      anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowableFallback.java
  4. 6
      anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowableFeign.java
  5. 14
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableMapper.java
  6. 8
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableMapper.xml
  7. 289
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableRest.java
  8. 6
      anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableService.java
  9. 9
      anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowcc/SysFlowccRest.java
  10. 23
      anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowcc/SysFlowccService.java

3
anrui-base/anrui-base-api/src/main/java/com/yxt/anrui/base/api/busvehicleapply/BusVehicleApplyDto.java

@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;
/**
@ -89,5 +90,5 @@ public class BusVehicleApplyDto implements Dto {
@ApiModelProperty("当前组织机构全路径sid")
private String orgPath;
@ApiModelProperty("附件信息")
private List<CommonAppendixDto> commonAppendixs; //附件信息
private List<CommonAppendixDto> commonAppendixs = new ArrayList<>(); //附件信息
}

21
anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowListVo.java

@ -0,0 +1,21 @@
package com.yxt.anrui.flowable.api.flow;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yxt.common.core.vo.Vo;
import lombok.Data;
/**
* @Author dimengzhe
* @Date 2023/2/22 11:06
* @Description
*/
@Data
public class FlowListVo implements Vo {
private static final long serialVersionUID = -1640222644080157655L;
@JsonProperty("key")
private String KEY_;
@JsonProperty("name")
private String NAME_;
@JsonProperty("id")
private String ID_;
}

6
anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowableFallback.java

@ -5,6 +5,7 @@ import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
@ -75,5 +76,10 @@ public class FlowableFallback implements FlowableFeign {
return null;
}
@Override
public ResultBean<List<FlowListVo>> selectFlowList() {
return null;
}
}

6
anrui-flowable/anrui-flowable-api/src/main/java/com/yxt/anrui/flowable/api/flow/FlowableFeign.java

@ -9,6 +9,7 @@ import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Api(tags = "Flowable")
@ -120,4 +121,9 @@ public interface FlowableFeign {
@PostMapping(value = "/breakProcess")
@ResponseBody
ResultBean<UpdateFlowFieldVo> breakProcess(@RequestBody com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl);
@ApiOperation(value = "所有流程名称")
@GetMapping(value = "/selectFlowList")
@ResponseBody
ResultBean<List<FlowListVo>> selectFlowList();
}

14
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableMapper.java

@ -1,20 +1,30 @@
package com.yxt.anrui.flowable.biz.flow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxt.anrui.flowable.api.flow.FlowListVo;
import com.yxt.anrui.flowable.api.flow.FlowProcinst;
import com.yxt.anrui.flowable.api.flow.Flowable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface FlowableMapper extends BaseMapper<Flowable> {
void insetFlowableTask(Map<String,Object> params);
void insetFlowableTask(Map<String, Object> params);
FlowProcinst getFlowProcinstById(@Param("id") String id);
@Select("select * from act_hi_procinst where proc_inst_id_=#{id}")
Map<String, String> getProcessInstanceById(@Param("id") String procInsId);
Map<String, String> getProcessInstanceById(@Param("id") String procInsId);
@Select("select * from act_re_procdef where id_=#{id}")
Map<String, String> getProcessDefByDefId(@Param("id") String id);
/**
* @return 查询所有流程名称及key
*/
List<FlowListVo> selectFlowList();
}

8
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableMapper.xml

@ -15,6 +15,14 @@
<select id="getFlowProcinstById" resultType="com.yxt.anrui.flowable.api.flow.FlowProcinst">
select * from act_hi_procinst where ID_=#{id}
</select>
<select id="selectFlowList" resultType="com.yxt.anrui.flowable.api.flow.FlowListVo">
select t1.KEY_ ,t1.NAME_,t1.ID_
FROM act_re_procdef t1
INNER JOIN
(select SUBSTRING_INDEX(GROUP_CONCAT(ID_ order by VERSION_ desc),',',1) AS id
from act_re_procdef GROUP BY KEY_) AS t2 ON t2.id = t1.ID_
</select>
<!--
<insert id="insetFlowableTask">
insert into `act_ru_task` (`REV`, `EXECUTION_ID`, `PROC_INST_ID`, `PROC_DEF_ID`,

289
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableRest.java

@ -29,6 +29,7 @@ package com.yxt.anrui.flowable.biz.flow;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.yxt.anrui.flowable.api.flow.*;
import com.yxt.anrui.flowable.api.flowcomment.FlowComment;
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo;
@ -49,6 +50,7 @@ import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.tomcat.util.threads.ThreadPoolExecutor;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.HistoryService;
@ -63,6 +65,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.*;
/**
* Project: anrui-parent <br/>
@ -98,49 +101,58 @@ public class FlowableRest implements FlowableFeign {
private MessageFeign messageFeign;
@Resource
protected HistoryService historyService;
/**
* 流程抄送的功能
*
* @param map
* @return
*/
@Override
public ResultBean cc(Map<String,Object> map) {
log.info("FlowableRest-cc:{}",JSONObject.toJSONString(map));
public ResultBean cc(Map<String, Object> map) {
ResultBean rb = ResultBean.fireFail();
log.info("FlowableRest-cc:{}", JSONObject.toJSONString(map));
Object bv1 = map.get("bv");
BusinessVariables bv= new BusinessVariables();
BeanUtil.copyProperties(bv1,bv);
BusinessVariables bv = new BusinessVariables();
BeanUtil.copyProperties(bv1, bv);
Object uff1 = map.get("uff");
UpdateFlowFieldVo uff= new UpdateFlowFieldVo();
BeanUtil.copyProperties(uff1,uff);
UpdateFlowFieldVo uff = new UpdateFlowFieldVo();
BeanUtil.copyProperties(uff1, uff);
//流程定义的id
String modelId = bv.getModelId();
//将modelId根据冒号:分成三部分,取第一部分作为key
List<String> stringList = Arrays.asList(modelId.split(":"));
modelId = stringList.get(0);
//抄送的角色的sid
ResultBean<SysFlowccVo> roleSidByModelId = sysFlowccFeign.getRoleSidByModelId(modelId);
//组织机构sid
String orgSidPath = bv.getOrgSidPath();
if(!roleSidByModelId.getSuccess()){
return roleSidByModelId;
if (roleSidByModelId.getData() == null) {
log.info("抄送失败,没有配置对应的角色!");
return rb.setMsg("抄送失败,没有配置对应的角色!");
}
SysFlowccVo data = roleSidByModelId.getData();
if(StringUtils.isBlank(data.getRoleSid())){
return ResultBean.fireFail().setMsg("抄送失败,没有配置对应的角色!");
if (StringUtils.isBlank(data.getRoleSid())) {
log.info("抄送失败,没有配置对应的角色!");
return rb.setMsg("抄送失败,没有配置对应的角色!");
}
List<String> list = Arrays.asList(data.getRoleSid().split(","));
UserByRolesAndOrgQuery userQuery = new UserByRolesAndOrgQuery();
userQuery.setRoleSids(list);
userQuery.setOrgSidPath(orgSidPath);
List<SysUserVo> sysUserVos = sysUserFeign.getUserByRoles(userQuery).getData();
if(sysUserVos==null||sysUserVos.size()<1){
return ResultBean.fireFail().setMsg("抄送失败,没有用户!");
if (sysUserVos == null || sysUserVos.size() < 1) {
log.info("抄送失败,没有用户!");
return rb.setMsg("抄送失败,没有用户!");
}
StringBuilder userName=new StringBuilder();
StringBuilder userSids=new StringBuilder();
sysUserVos.forEach(f->{
StringBuilder userName = new StringBuilder();
StringBuilder userSids = new StringBuilder();
sysUserVos.forEach(f -> {
userName.append(f.getName()).append(",");
userSids.append(f.getSid()).append(",");
});
userSids.deleteCharAt(userSids.length()-1);
userSids.deleteCharAt(userSids.length() - 1);
//抄送的业务逻辑
MessageFlowableQuery mfq = new MessageFlowableQuery();
MessageFlowVo messageFlowVo = new MessageFlowVo();
@ -150,46 +162,47 @@ public class FlowableRest implements FlowableFeign {
//Map<String,Object> app = (Map<String, Object>) bv.getFormVariables().get("app");
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery()
.includeProcessVariables().taskId(bv.getTaskId()).singleResult();
if(historicTaskInstance==null){
if (historicTaskInstance == null) {
log.info("抄送失败:没有获取到业务参数!");
return ResultBean.fireFail().setMsg("抄送失败!");
return rb.setMsg("抄送失败!");
}
Map<String, Object> processVariables = historicTaskInstance.getProcessVariables();
if(historicTaskInstance==null){
if (historicTaskInstance == null) {
log.info("抄送失败:没有获取到业务参数!");
return ResultBean.fireFail().setMsg("抄送失败!");
return rb.setMsg("抄送失败!");
}
Map<String,Object> app=new HashMap<>();
if(processVariables.get("app")!=null){
app= (Map<String, Object>) processVariables.get("app");
Map<String, Object> app = new HashMap<>();
if (processVariables.get("app") != null) {
app = (Map<String, Object>) processVariables.get("app");
}
log.info("抄送方法-historicTaskInstance:{}",JSONObject.toJSONString(historicTaskInstance));
log.info("抄送方法-historicTaskInstance:{}", JSONObject.toJSONString(historicTaskInstance));
mfq.setAppMap(app);
mfq.setBusinessSid(bv.getBusinessSid());
mfq.setMsgContent( "系统抄送的流程审批,请查看");
mfq.setMsgContent("系统抄送的流程审批,请查看");
// act_re_procdef
Map<String,String> process= processService.getProcessDefByDefId(historicTaskInstance.getProcessDefinitionId());
log.info("抄送成功-process:{}",process);
if(process==null){
return ResultBean.fireFail().setMsg("抄送失败,流程定义不存在!");
Map<String, String> process = processService.getProcessDefByDefId(historicTaskInstance.getProcessDefinitionId());
log.info("抄送成功-process:{}", process);
if (process == null) {
log.info("抄送失败,流程定义不存在!");
return rb.setMsg("抄送失败,流程定义不存在!");
}
mfq.setModuleName(process.get("NAME_"));
mfq.setMsgTitle(process.get("NAME_"));
mfq.setUserSids(userSids.toString());
ResultBean<String> resultBean = messageFeign.pushMessageCC(mfq);
log.info("抄送成功:{}",userName.toString());
log.info("抄送成功-resultBean:{}",resultBean);
if(!resultBean.getSuccess()){
log.info("抄送失败,同送消息异常!:{}",JSONObject.toJSONString(resultBean));
return ResultBean.fireFail().setMsg("抄送失败,同送消息异常!");
log.info("抄送成功:{}", userName.toString());
log.info("抄送成功-resultBean:{}", resultBean);
if (!resultBean.getSuccess()) {
log.info("抄送失败,同送消息异常!:{}", JSONObject.toJSONString(resultBean));
return rb.setMsg("抄送失败,同送消息异常!");
}
return ResultBean.fireSuccess().setMsg("抄送"+userName.toString()+"成功!");
return rb.success().setMsg("抄送" + userName.toString() + "成功!");
}
@Override
public ResultBean businessStart(BusinessVariables bv) {
return flowableService.businessStart( bv);
return flowableService.businessStart(bv);
}
@Override
@ -219,31 +232,31 @@ public class FlowableRest implements FlowableFeign {
@Override
public ResultBean<UserAndOrgPath> getNextNodeUserSidsOfCreate(BusinessVariables bv) {
//根据业务参数取流程流转的环节 信息
return flowtaskService.getNextNodeUserSidsOfCreate(bv) ;
return flowtaskService.getNextNodeUserSidsOfCreate(bv);
}
@Override
public ResultBean<UserAndOrgPath> getNextNodeUserSidsOfSubmit(BusinessVariables bv) {
ResultBean<UserAndOrgPath> rb = ResultBean.fireSuccess();
String orgSidPath=bv.getOrgSidPath();
String taskDefKey=bv.getTaskDefKey();
String orgSidPath = bv.getOrgSidPath();
String taskDefKey = bv.getTaskDefKey();
//根据业务参数取流程流转的环节 信息
List<Map<String, Object>> list = (List<Map<String, Object>>)
flowtaskService.getProcessCirculationNodesByMap(bv).getData();
Map<String, Object> task_map=new HashMap<>();
Map<String, Object> task_map = new HashMap<>();
//取第二个环节的配置角色
boolean endTask=true;
for (int i=0;i< list.size();i++){
String id=list.get(i).get("id").toString();
if(id.equals(taskDefKey)&&i+1<list.size()){
task_map=list.get(i+1);
endTask=false;
}
}
if(endTask){
task_map.put("name","结束");
boolean endTask = true;
for (int i = 0; i < list.size(); i++) {
String id = list.get(i).get("id").toString();
if (id.equals(taskDefKey) && i + 1 < list.size()) {
task_map = list.get(i + 1);
endTask = false;
}
}
if (endTask) {
task_map.put("name", "结束");
return rb.setData(new UserAndOrgPath());
}else{
} else {
Object o = task_map.get("candidateGroups");
return flowtaskService.getNextUserSids(rb, orgSidPath, o);
}
@ -251,32 +264,32 @@ public class FlowableRest implements FlowableFeign {
@Override
public ResultBean<UpdateFlowFieldVo> startProcess(BusinessVariables dto) {
log.info("startProcess.dto:{}",dto);
log.info("startProcess.dto:{}", dto);
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(dto.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
return rb.setMsg("businessSid 不能为空!");
}
if(dto.getFormVariables()==null)
if (dto.getFormVariables() == null)
dto.setFormVariables(new HashMap<String, Object>());
Map<String, Object> formVariables = dto.getFormVariables();
if(StringUtils.isNotBlank(dto.getOrgSidPath())){
String orgPath=dto.getOrgSidPath();
formVariables.put("createrOrgPath",orgPath);//发起人的组织结构sid
if (StringUtils.isNotBlank(dto.getOrgSidPath())) {
String orgPath = dto.getOrgSidPath();
formVariables.put("createrOrgPath", orgPath);//发起人的组织结构sid
//dto.setFormVariables(formVariables);
}
dto.getFormVariables().put("businessSid",dto.getBusinessSid());
dto.getFormVariables().put("businessSid", dto.getBusinessSid());
String nextNodeUserSids_ = dto.getNextNodeUserSids();
if(StringUtils.isBlank(nextNodeUserSids_)){
if (StringUtils.isBlank(nextNodeUserSids_)) {
ResultBean<UserAndOrgPath> nextNodeUserSidsOfCreate = getNextNodeUserSidsOfCreate(dto);
boolean success = nextNodeUserSidsOfCreate.getSuccess();
if(!success){
if (!success) {
return rb.setMsg(nextNodeUserSidsOfCreate.getMsg());
}
nextNodeUserSids_=nextNodeUserSidsOfCreate.getData().getUserSid();
dto.getFormVariables().put(BusinessVariables.ORGPATH,nextNodeUserSidsOfCreate.getData().getOrgPath());
nextNodeUserSids_ = nextNodeUserSidsOfCreate.getData().getUserSid();
dto.getFormVariables().put(BusinessVariables.ORGPATH, nextNodeUserSidsOfCreate.getData().getOrgPath());
}
dto.setNextNodeUserSids(nextNodeUserSids_);
ResultBean resultBean1 = flowableService.businessStart(dto);
@ -294,28 +307,62 @@ public class FlowableRest implements FlowableFeign {
return rb.success().setData(vo);
}
Logger log= LoggerFactory.getLogger(FlowableRest.class);
Logger log = LoggerFactory.getLogger(FlowableRest.class);
@Override
public ResultBean<UpdateFlowFieldVo> handleProsess(BusinessVariables dto) {
ResultBean<UpdateFlowFieldVo> rb = ResultBean.fireFail();
ResultBean<UpdateFlowFieldVo> updateFlowFieldVoResultBean = handleProsess(dto, true);
//需要判断办结后再执行 TODO
if(updateFlowFieldVoResultBean.getSuccess()){
HashMap<String, Object> map = new HashMap<>();
map.put("bv",dto);
map.put("uff",updateFlowFieldVoResultBean.getData());
//cc(map);
if (updateFlowFieldVoResultBean.getSuccess()) {
/* if ("Event_end".equals(updateFlowFieldVoResultBean.getData().getTaskDefKey())) {
try {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
.setNameFormat("demo-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(2, 100,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
Future future1 = pool.submit(() -> {
HashMap<String, Object> map = new HashMap<>();
map.put("bv", dto);
map.put("uff", updateFlowFieldVoResultBean.getData());
cc(map);
});
} catch (Exception e) {
e.printStackTrace();
return rb.setMsg("抄送失败");
}
}*/
try {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
.setNameFormat("demo-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(2, 100,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
Future future1 = pool.submit(() -> {
HashMap<String, Object> map = new HashMap<>();
map.put("bv", dto);
map.put("uff", updateFlowFieldVoResultBean.getData());
cc(map);
});
} catch (Exception e) {
e.printStackTrace();
return rb.setMsg("抄送失败");
}
}
return updateFlowFieldVoResultBean;
}
/**
*
* @param dto
* @param b 是否连续跳转环节
* @param b 是否连续跳转环节
* @return
*/
public ResultBean<UpdateFlowFieldVo> handleProsess(BusinessVariables dto,boolean b) {
public ResultBean<UpdateFlowFieldVo> handleProsess(BusinessVariables dto, boolean b) {
log.info("BusinessVariables:{}", JSONObject.toJSONString(dto));
log.info("b:{}", b);
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
@ -332,23 +379,23 @@ public class FlowableRest implements FlowableFeign {
/*if(formVariables==null){
return rb.setMsg("业务参数集合 不能为空!");
}*/
if(dto.getFormVariables()==null)
if (dto.getFormVariables() == null)
dto.setFormVariables(new HashMap<String, Object>());
Map<String, Object> formVariables = dto.getFormVariables();
formVariables.put("businessSid",dto.getBusinessSid());
formVariables.put("businessSid", dto.getBusinessSid());
String nextUserSid = dto.getNextNodeUserSids();
if(StringUtils.isBlank(nextUserSid)){
if (StringUtils.isBlank(nextUserSid)) {
ResultBean<UserAndOrgPath> nextNodeUserSidsOfSubmit = getNextNodeUserSidsOfSubmit(dto);
if (!nextNodeUserSidsOfSubmit.getSuccess()) {
return rb.setMsg("nextUserSid 不能为空!");
}
nextUserSid=nextNodeUserSidsOfSubmit.getData().getUserSid();
formVariables.put(BusinessVariables.ORGPATH,nextNodeUserSidsOfSubmit.getData().getOrgPath());
nextUserSid = nextNodeUserSidsOfSubmit.getData().getUserSid();
formVariables.put(BusinessVariables.ORGPATH, nextNodeUserSidsOfSubmit.getData().getOrgPath());
}
String comment = dto.getComment();
if (StringUtils.isBlank(comment)) {
comment="";
comment = "";
//return rb.setMsg("comment 不能为空!");
}
String instanceId = dto.getInstanceId();
@ -360,7 +407,7 @@ public class FlowableRest implements FlowableFeign {
return rb.setMsg("userSid 不能为空!");
}
String businessSid =dto.getBusinessSid();
String businessSid = dto.getBusinessSid();
if (StringUtils.isBlank(businessSid)) {
return rb.setMsg("业务sid 不能为空!");
}
@ -369,7 +416,7 @@ public class FlowableRest implements FlowableFeign {
return rb.setMsg("任务不存在");
}
String assignee = task.getAssignee();
if(b&&(StringUtils.isNotBlank(assignee)&& assignee.indexOf(userSid)<0)){
if (b && (StringUtils.isNotBlank(assignee) && assignee.indexOf(userSid) < 0)) {
return rb.setMsg("当前用户不是环节的待办人,不能进行办理操作!");
}
String nodeState = "";
@ -382,9 +429,9 @@ public class FlowableRest implements FlowableFeign {
// Map<String,Object> values =(Map<String,Object>) formVariables.get("values");
taskService.resolveTask(taskId, formVariables);
} else {
taskService.addComment(taskId, instanceId, FlowComment.NORMAL.getType(), comment);
log.error("taskid:{},userSid:{}",taskId, userSid);
log.error("formVariables:{}",JSON.toJSONString(formVariables));
taskService.addComment(taskId, instanceId, FlowComment.NORMAL.getType(), comment);
log.error("taskid:{},userSid:{}", taskId, userSid);
log.error("formVariables:{}", JSON.toJSONString(formVariables));
taskService.setAssignee(taskId, userSid);
//formVariables.remove("userSid");
/*for(Map.Entry<String, Object> entry:formVariables.entrySet()){
@ -405,9 +452,9 @@ public class FlowableRest implements FlowableFeign {
System.out.println(entry.getKey()+"--->"+entry.getValue());
}*/
// taskService.setVariables(id_,formVariables);
// taskService.setVariables(id_,formVariables);
//在act_ru_variable表中增加环节上的业务参数的变量
taskService.setVariablesLocal(id_,formVariables);
taskService.setVariablesLocal(id_, formVariables);
nodeState = latestTaskVo.getName_();
taskDefKey = latestTaskVo.getTask_def_key_();
} else {
@ -419,45 +466,45 @@ public class FlowableRest implements FlowableFeign {
//ResultBean<FlowRecordVo> flowRecordVoResultBean = flowableService.flowRecord(dto.getInstanceId(), dto.getModelId());
List<FlowElement> flowElements = processService.calApprovePath(dto.getModelId(), dto.getModelId(),
dto.getFormVariables());
boolean contains=false;
for(int i=0;i<flowElements.size();i++){
boolean contains = false;
for (int i = 0; i < flowElements.size(); i++) {
FlowElement flowElement = flowElements.get(i);
String id = flowElement.getId();
if(taskDefKey.equals(id)&&i+1<flowElements.size()){
if (taskDefKey.equals(id) && i + 1 < flowElements.size()) {
FlowElement flowElement1 = flowElements.get(i + 1);
if(flowElement1 instanceof UserTask){
UserTask userTask=(UserTask)flowElement1;
if (flowElement1 instanceof UserTask) {
UserTask userTask = (UserTask) flowElement1;
List<String> candidateGroups = userTask.getCandidateGroups();
List<SysUserVo> sysUserVoLists=new ArrayList<>();
List<SysUserVo> sysUserVoLists = new ArrayList<>();
//根据角色查询用户
for(String roleSid:candidateGroups){
for (String roleSid : candidateGroups) {
UserQuery userQuery = new UserQuery();
userQuery.setRoleSid(roleSid);
userQuery.setOrgSidPath(dto.getOrgSidPath());
ResultBean<List<SysUserVo>> userByRole = sysUserFeign.getUserByRole(userQuery);
boolean success = userByRole.getSuccess();
if(!success){
if (!success) {
continue;
}
sysUserVoLists.addAll(userByRole.getData());
}
//当前环节运营部总经理 刘丽艳 点击同意 下一环节 事业部副总经理 (nextUserSid) 和事业部总经理(sysUserVoLists.get(0).getSid())
//判断查询回来的用户的集合size是1 并且用户的sid和下一环节的用户的sid相同。
if(sysUserVoLists.size()==1&&sysUserVoLists.get(0).getSid().equals(nextUserSid)){
contains=true;
if (sysUserVoLists.size() == 1 && sysUserVoLists.get(0).getSid().equals(nextUserSid)) {
contains = true;
break;
}
}
}
if(contains){
if (contains) {
break;
}
}
if(contains){
if (contains) {
dto.setUserSid(nextUserSid);
dto.setTaskId(vo.getTaskId());
dto.setTaskDefKey(taskDefKey);
return handleProsess(dto,false);
return handleProsess(dto, false);
}
vo.setProcInsId(instanceId);
vo.setProcDefId(task.getProcessDefinitionId());
@ -466,19 +513,20 @@ public class FlowableRest implements FlowableFeign {
vo.setNextNodeUserSids(nextUserSid);
return rb.success().setData(vo);
}
@Override
public ResultBean<UpdateFlowFieldVo> revokeProcess(com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl) {
ResultBean rb = ResultBean.fireFail();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
return rb.setMsg("businessSid 不能为空!");
}
if( fl.getValues()==null){
fl.setValues(new HashMap<String,Object>());
if (fl.getValues() == null) {
fl.setValues(new HashMap<String, Object>());
}
fl.getValues().put("businessSid",fl.getBusinessSid());
fl.getValues().put("businessSid", fl.getBusinessSid());
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
ResultBean<FlowProcinst> flowProcinstById = flowableService.getFlowProcinstById(fl.getInstanceId());
if(!StringUtils.isBlank(flowProcinstById.getData().getEND_TIME_())){
if (!StringUtils.isBlank(flowProcinstById.getData().getEND_TIME_())) {
return rb.setMsg("撤回失败,流程已办结或终止");
}
ResultBean<List<LatestTaskVo>> resultBean = flowtaskService.revokeProcess(fl);
@ -494,8 +542,8 @@ public class FlowableRest implements FlowableFeign {
vo.setNodeState(nodeState);
vo.setTaskDefKey(taskDefKey);
} else {
vo.setNodeState( nodeState);
vo.setTaskDefKey( taskDefKey);
vo.setNodeState(nodeState);
vo.setTaskDefKey(taskDefKey);
}
return rb.success().setData(vo);
}
@ -506,12 +554,12 @@ public class FlowableRest implements FlowableFeign {
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
return rb.setMsg("businessSid 不能为空!");
}
if( fl.getValues()==null){
fl.setValues(new HashMap<String,Object>());
if (fl.getValues() == null) {
fl.setValues(new HashMap<String, Object>());
}
fl.getValues().put("businessSid",fl.getBusinessSid());
fl.getValues().put("businessSid", fl.getBusinessSid());
ResultBean<List<LatestTaskVo>> resultBean = flowtaskService.taskReject(fl);
if (!resultBean.getSuccess()) {
@ -523,16 +571,16 @@ public class FlowableRest implements FlowableFeign {
String incomingSourceRef = resultBean.getData().get(0).getIncomingSourceRef();
String taskId = resultBean.getData().get(0).getId_();
vo.setSid(fl.getBusinessSid());
vo.setNodeState( nodeState);
vo.setTaskDefKey( taskDefKey);
vo.setNodeState(nodeState);
vo.setTaskDefKey(taskDefKey);
vo.setTaskId(taskId);
/* if (incomingSourceRef.contains("start")) {
vo.setNodeState( SysFormLinkFlowStateEnum.REJECT.getCode());
}*/
Map<String, Object> formVariables=new HashMap<>();
formVariables.put(BusinessVariables.ORGPATH,orgPath);
Map<String, Object> formVariables = new HashMap<>();
formVariables.put(BusinessVariables.ORGPATH, orgPath);
//在act_ru_variable表中增加环节上的业务参数的变量
taskService.setVariablesLocal(taskId,formVariables);
taskService.setVariablesLocal(taskId, formVariables);
ResultBean resultBean1 = ResultBean.fireSuccess();
return resultBean1.success().setData(vo);
}
@ -541,12 +589,12 @@ public class FlowableRest implements FlowableFeign {
public ResultBean<UpdateFlowFieldVo> breakProcess(com.yxt.anrui.flowable.api.flowtask.FlowTaskVo fl) {
ResultBean<UpdateFlowFieldVo> rb = ResultBean.fireFail();
if (StringUtils.isBlank(fl.getBusinessSid())) {
return rb.setMsg("businessSid 不能为空!");
return rb.setMsg("businessSid 不能为空!");
}
if( fl.getValues()==null){
fl.setValues(new HashMap<String,Object>());
if (fl.getValues() == null) {
fl.setValues(new HashMap<String, Object>());
}
fl.getValues().put("businessSid",fl.getBusinessSid());
fl.getValues().put("businessSid", fl.getBusinessSid());
UpdateFlowFieldVo vo = new UpdateFlowFieldVo();
ResultBean<UpdateFlowFieldVo> resultBean = flowableService.breakProcess(fl);
if (!resultBean.getSuccess()) {
@ -554,7 +602,12 @@ public class FlowableRest implements FlowableFeign {
}
vo.setSid(fl.getBusinessSid());
vo.setNodeState(resultBean.getData().getNodeState());
vo.setTaskDefKey( "Event_end");
vo.setTaskDefKey("Event_end");
return rb.success().setData(vo);
}
@Override
public ResultBean<List<FlowListVo>> selectFlowList() {
return flowableService.selectFlowList();
}
}

6
anrui-flowable/anrui-flowable-biz/src/main/java/com/yxt/anrui/flowable/biz/flow/FlowableService.java

@ -278,4 +278,10 @@ public class FlowableService extends MybatisBaseService<FlowableMapper, Flowable
public Map<String, String> getProcessDefByDefId(String processDefinitionId) {
return baseMapper.getProcessDefByDefId(processDefinitionId);
}
public ResultBean<List<FlowListVo>> selectFlowList() {
ResultBean<List<FlowListVo>> rb = ResultBean.fireFail();
List<FlowListVo> list = baseMapper.selectFlowList();
return rb.success().setData(list);
}
}

9
anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowcc/SysFlowccRest.java

@ -25,8 +25,7 @@
*********************************************************/
package com.yxt.anrui.portal.biz.sysflowcc;
import com.yxt.anrui.portal.api.sysuserrole.SysUserRole;
import com.yxt.anrui.portal.api.sysuserrole.SysUserRoleFeign;
import com.yxt.anrui.portal.api.sysflowcc.*;
import com.yxt.anrui.portal.biz.sysuserrole.SysUserRoleService;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
@ -38,12 +37,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowcc;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccQuery;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccVo;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccDetailsVo;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccDto;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccFeign;
/**
* Project: anrui-portal(流程抄送) <br/>

23
anrui-portal/anrui-portal-biz/src/main/java/com/yxt/anrui/portal/biz/sysflowcc/SysFlowccService.java

@ -28,20 +28,13 @@ package com.yxt.anrui.portal.biz.sysflowcc;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.R;
import org.apache.commons.lang3.StringUtils;
import com.yxt.anrui.portal.api.sysflowcc.*;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowcc;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccQuery;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccVo;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccDetailsVo;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccDto;
import com.yxt.anrui.portal.api.sysflowcc.SysFlowccFeign;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
@ -91,10 +84,10 @@ public class SysFlowccService extends MybatisBaseService<SysFlowccMapper, SysFlo
return rb.setMsg("请选择角色");
}
for (String roleSid : roleSids) {
roleSidPath.append(roleSid).append("");
roleSidPath.append(roleSid).append(",");
}
for (String roleName : roleNames) {
roleNamePath.append(roleName).append("");
roleNamePath.append(roleName).append(",");
}
if (StringUtils.isBlank(dtoSid)) {
SysFlowccVo sysFlowccVo = baseMapper.selectByFlowKey(dto.getFlowKey());
@ -104,8 +97,8 @@ public class SysFlowccService extends MybatisBaseService<SysFlowccMapper, SysFlo
SysFlowcc sysFlowcc = new SysFlowcc();
sysFlowcc.setFlowKey(dto.getFlowKey());
sysFlowcc.setFlowName(dto.getFlowName());
sysFlowcc.setRoleSid(roleSidPath.substring(0,roleSidPath.lastIndexOf("")));
sysFlowcc.setRoleName(roleNamePath.substring(0,roleNamePath.lastIndexOf("")));
sysFlowcc.setRoleSid(roleSidPath.substring(0,roleSidPath.lastIndexOf(",")));
sysFlowcc.setRoleName(roleNamePath.substring(0,roleNamePath.lastIndexOf(",")));
save(sysFlowcc);
return rb.success().setMsg("添加成功");
}
@ -119,8 +112,8 @@ public class SysFlowccService extends MybatisBaseService<SysFlowccMapper, SysFlo
}
sysFlowcc.setFlowKey(dto.getFlowKey());
sysFlowcc.setFlowName(dto.getFlowName());
sysFlowcc.setRoleSid(roleSidPath.substring(0,roleSidPath.lastIndexOf("")));
sysFlowcc.setRoleName(roleNamePath.substring(0,roleNamePath.lastIndexOf("")));
sysFlowcc.setRoleSid(roleSidPath.substring(0,roleSidPath.lastIndexOf(",")));
sysFlowcc.setRoleName(roleNamePath.substring(0,roleNamePath.lastIndexOf(",")));
baseMapper.updateById(sysFlowcc);
return rb.success().setMsg("修改成功");
}

Loading…
Cancel
Save