Merge branch 'develop' into 'FOTON'
Develop See merge request foton-wkflow-group/foton-wkflow-rest!68
This commit is contained in:
+52
@@ -9,6 +9,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ydw.bat.wkflow.business_activiti.dto.ProcessRollBackEO;
|
||||
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.BusProcessName;
|
||||
import com.ydw.bat.wkflow.business_main.datas.entity.ResponseMessage;
|
||||
@@ -25,6 +26,8 @@ import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.tmsps.fk.common.base.action.BaseAction;
|
||||
@@ -195,6 +198,55 @@ public class ActivitDefineController extends BaseAction {
|
||||
return WrapMapper.ok(task.getId());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "启动流程-以流程定义id")
|
||||
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "流程定义Id"),
|
||||
@ApiImplicitParam(name = "userId", value = "流程发起人Id") })
|
||||
@PostMapping("/activiti_define_start_user_rollBack")
|
||||
public Wrapper<String> activiti_define_start_user_rollBack(@RequestBody ProcessRollBackEO processRollBackEO) {
|
||||
// 创建查询对象
|
||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||
// 使用流程定义的名称模糊查询
|
||||
processDefinitionQuery.processDefinitionCategory("e05707228fa5ed7b549198208ab19d97");
|
||||
long total = processDefinitionQuery.count();
|
||||
List<ProcessDefinition> list = processDefinitionQuery.orderByProcessDefinitionKey().asc().list();
|
||||
List<Map<String, Object>> definitions = ActivitiTools.turnProcessDefinitions(list);
|
||||
String pid = "";
|
||||
for(Map<String, Object> map:definitions){
|
||||
if(map.get("key").toString().equals(processRollBackEO.getId())){
|
||||
pid = map.get("id").toString();
|
||||
}
|
||||
}
|
||||
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(pid).singleResult();
|
||||
|
||||
ProcessInstance pi = runtimeService.startProcessInstanceById(pid);
|
||||
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
|
||||
task.setAssignee(processRollBackEO.getUserId());
|
||||
taskService.saveTask(task);
|
||||
|
||||
if(processRollBackEO.getBpnId() == null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
BusProcessName busProcessName = new BusProcessName();
|
||||
busProcessName.setPrcId(pi.getId());
|
||||
busProcessName.setCreatTime(sdf.format(new Date()));
|
||||
busProcessName.setCreatUser(processRollBackEO.getUserId());
|
||||
ResponseMessage<UserVO> byId = lawsUserInfoService.getById(processRollBackEO.getUserId());
|
||||
busProcessName.setCreatUserName(byId.getData().getUname());
|
||||
busProcessName.setPrcNum(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||
busProcessName.setMes(processRollBackEO.getJson());
|
||||
ibusprocessnameService.save(busProcessName);
|
||||
}else {
|
||||
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("ID", processRollBackEO.getBpnId());
|
||||
BusProcessName one = ibusprocessnameService.getOne(queryWrapper);
|
||||
one.setPrcNum(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
|
||||
one.setPrcId(pi.getId());
|
||||
ibusprocessnameService.saveOrUpdate(one);
|
||||
}
|
||||
logger.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName());
|
||||
return WrapMapper.ok(task.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 企标复审流程专用
|
||||
* @param id
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ydw.bat.wkflow.business_activiti.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProcessRollBackEO {
|
||||
|
||||
private String json;
|
||||
|
||||
private String type;
|
||||
|
||||
private String id;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String bpnId;
|
||||
}
|
||||
+8
-8
@@ -47,7 +47,7 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
||||
@Override
|
||||
public String mergeModelFile(String pid, String taskId,String fileSuffix){
|
||||
|
||||
String fileSavePath = filePath +"bussEdit"+ getUUIDPath(pid,taskId);
|
||||
String fileSavePath = "bussEdit"+ getUUIDPath(pid,taskId);
|
||||
|
||||
StringBuilder builder=new StringBuilder();
|
||||
builder.append(filePath);
|
||||
@@ -64,12 +64,12 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
||||
try {
|
||||
if(!hisList.isEmpty()){
|
||||
newFileName = fileSavePath+taskId + "_" + pid + "_count." + fileSuffix;
|
||||
|
||||
String changeFile = filePath + newFileName;
|
||||
for (int i = 0; i < hisList.size(); i++) {
|
||||
if(i == 0){
|
||||
PoiWord.wordRedDocument(modelPath,null,newFileName,hisList.get(i).getEditFilePath());
|
||||
PoiWord.wordRedDocument(filePath+hisList.get(i).getEditFilePath(),null,changeFile,modelPath);
|
||||
}else {
|
||||
PoiWord.wordRedDocument(newFileName,null,newFileName,hisList.get(i).getEditFilePath());
|
||||
PoiWord.wordRedDocument(filePath+hisList.get(i).getEditFilePath(),null,changeFile,changeFile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
||||
*/
|
||||
public String saveProcessFile(String filePath,String pid,String taskId,String fileSuffix){
|
||||
|
||||
String fileSavePath = filePath +"bussEdit"+ getUUIDPath(pid,taskId);
|
||||
String fileSavePath = "bussEdit"+ getUUIDPath(pid,taskId);
|
||||
String newFileName = "";
|
||||
try {
|
||||
|
||||
@@ -111,15 +111,15 @@ public class BusProcessModelHisServiceImpl extends ServiceImpl<BusProcessModelHi
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
newFileName = taskId + "_" + pid + "_node." + fileSuffix;
|
||||
File saveFile = new File(fileSavePath + newFileName);
|
||||
newFileName = fileSavePath + taskId + "_" + pid + "_node." + fileSuffix;
|
||||
File saveFile = new File(filePath + newFileName);
|
||||
FileUtils.write(saveFile, "","UTF-8");
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
return fileSavePath+newFileName;
|
||||
return newFileName;
|
||||
}
|
||||
|
||||
public static String getUUIDPath(String pid,String taskId){
|
||||
|
||||
+4
@@ -15,6 +15,7 @@ import com.ydw.bat.wkflow.util.http.ResponseMessage;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -91,7 +92,9 @@ public class StartSurveyAfter implements TaskListener {
|
||||
busBean.save(busProcessNew);
|
||||
|
||||
if(nextUserList != null && !nextUserList.isEmpty()){
|
||||
int i=0;
|
||||
for(String nextUser : nextUserList){
|
||||
object.put("onlyKey", i);
|
||||
BusProcessNew busProcessNewNext = new BusProcessNew();
|
||||
busProcessNewNext.setMsgType("clause");
|
||||
busProcessNewNext.setPId(delegateTask.getProcessInstanceId());
|
||||
@@ -102,6 +105,7 @@ public class StartSurveyAfter implements TaskListener {
|
||||
busProcessNewNext.setUserId(nextUser);
|
||||
busProcessNewNext.setPrcName(prcName);
|
||||
busBean.save(busProcessNewNext);
|
||||
i++;
|
||||
}
|
||||
}else{
|
||||
BusProcessNew busProcessNewNext = new BusProcessNew();
|
||||
|
||||
+5
-11
@@ -44,18 +44,12 @@ public class Step1After implements TaskListener {
|
||||
nextUserList.add(object.getString("responUserList"));
|
||||
}
|
||||
delegateTask.setVariable("zrIdList",nextUserList);
|
||||
if (null==delegateTask.getVariable("zrList")){
|
||||
delegateTask.setVariable("zrList",nextUserList);
|
||||
if (null==delegateTask.getVariable("zrList"+object.getString("onlyKey"))){
|
||||
delegateTask.setVariable("zrList"+object.getString("onlyKey"),nextUserList);
|
||||
}else {
|
||||
List<String> strings=delegateTask.getVariable("zrList",List.class);
|
||||
List<String> middle=new ArrayList<>();
|
||||
nextUserList.forEach(s -> {
|
||||
if (!strings.contains(s)){
|
||||
middle.add(s);
|
||||
}
|
||||
});
|
||||
strings.addAll(middle);
|
||||
delegateTask.setVariable("zrList",strings);
|
||||
List<String> strings=delegateTask.getVariable("zrList"+object.getString("onlyKey"),List.class);
|
||||
strings.addAll(nextUserList);
|
||||
delegateTask.setVariable("zrList"+object.getString("onlyKey"),strings);
|
||||
}
|
||||
//截止时间 流程描述 创建人
|
||||
String OVERTIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
@@ -37,16 +37,16 @@ public class Step2After implements TaskListener {
|
||||
|
||||
List<String> nextUserList = new ArrayList();
|
||||
//整备数据
|
||||
if (null==delegateTask.getVariable("count")){
|
||||
delegateTask.setVariable("count",1);
|
||||
if (null==delegateTask.getVariable("count"+object.getString("onlyKey"))){
|
||||
delegateTask.setVariable("count"+object.getString("onlyKey"),1);
|
||||
}else {
|
||||
delegateTask.setVariable("count",delegateTask.getVariable("count",Integer.class)+1);
|
||||
delegateTask.setVariable("count"+object.getString("onlyKey"),delegateTask.getVariable("count"+object.getString("onlyKey"),Integer.class)+1);
|
||||
}
|
||||
|
||||
if (delegateTask.getVariable("count",Integer.class) == delegateTask.getVariable("zrIdList",List.class).size()){
|
||||
if (delegateTask.getVariable("count"+object.getString("onlyKey"),Integer.class) == delegateTask.getVariable("zrList"+object.getString("onlyKey"),List.class).size()){
|
||||
//对数据进行合并归属
|
||||
QueryWrapper<BusProcessNew> wrapper=new QueryWrapper<>();
|
||||
wrapper.eq("TASK_ID","SCN");
|
||||
wrapper.eq("TASK_ID",object.getString("onlyKey"));
|
||||
wrapper.eq("P_ID",delegateTask.getProcessInstanceId());
|
||||
List<BusProcessNew> busProcessNews= busBean.list(wrapper);
|
||||
|
||||
@@ -101,8 +101,8 @@ public class Step2After implements TaskListener {
|
||||
busProcessNewNext.setMesg(object.toJSONString());
|
||||
busProcessNewNext.setTaskInfo(delegateTask.getTaskDefinitionKey());
|
||||
busProcessNewNext.setFinishFlag("0");
|
||||
if (delegateTask.getVariable("count",Integer.class) < delegateTask.getVariable("zrIdList",List.class).size()){
|
||||
busProcessNewNext.setTaskId("SCN");
|
||||
if (delegateTask.getVariable("count"+object.getString("onlyKey"),Integer.class) < delegateTask.getVariable("zrList"+object.getString("onlyKey"),List.class).size()){
|
||||
busProcessNewNext.setTaskId(object.getString("onlyKey"));
|
||||
}
|
||||
busProcessNewNext.setTaskInfo(delegateTask.getName());
|
||||
busProcessNewNext.setUserId(nextUser);
|
||||
|
||||
@@ -40,8 +40,8 @@ public class Step4After implements TaskListener {
|
||||
String prcName = "";
|
||||
//整备数据
|
||||
if ("0".equals(object.getString("spFlag"))) {
|
||||
nextUserList.add(delegateTask.getVariable("user",String.class));
|
||||
delegateTask.setVariable("bzfgId", delegateTask.getVariable("user",String.class));
|
||||
nextUserList.add(object.getString("bzfgId"));
|
||||
delegateTask.setVariable("bzfgId", object.getString("bzfgId"));
|
||||
prcName = delegateTask.getVariable("cid")+"-标准征求意见流程-标准法规工程师分线审核";
|
||||
delegateTask.setVariable("spFlag","0");
|
||||
}else {
|
||||
|
||||
@@ -51,20 +51,18 @@ public class BLApplicantAfter implements TaskListener{
|
||||
String prcName = "企标制修订流程及企业标准库流程";
|
||||
|
||||
// 下个节点执行人处理逻辑
|
||||
List<String> nextUserList = new ArrayList();
|
||||
List<String> finalNextUserList = new ArrayList();
|
||||
List<BusProcessModelHis> busProcessModelHisList = new ArrayList<>();
|
||||
if(StringUtils.isNotBlank(object.getString("modelData"))){
|
||||
List<JSONObject> valueArr = JSONArray.parseArray(object.getString("modelData"),JSONObject.class);
|
||||
Map<String, List<JSONObject>> listMap = valueArr.stream().collect(
|
||||
Collectors.groupingBy(a -> Utils.format("{0}", a.getString("userId"))));
|
||||
List<String> finalNextUserList = nextUserList;
|
||||
Collectors.groupingBy(a -> Utils.format("{0}", a.getString("zrUserId"))));
|
||||
listMap.forEach((s, jsonObjects) -> {
|
||||
String json = JSONArray.toJSONString(jsonObjects);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
BusProcessModelHis modelHis = new BusProcessModelHis();
|
||||
modelHis.setPId(delegateTask.getProcessInstanceId());
|
||||
modelHis.setMesg(json);
|
||||
modelHis.setTaskInfo(delegateTask.getName());
|
||||
modelHis.setUserId(s);
|
||||
modelHis.setPrcName(prcName);
|
||||
modelHis.setEditType("node");
|
||||
@@ -73,15 +71,14 @@ public class BLApplicantAfter implements TaskListener{
|
||||
busProcessModelHisList.add(modelHis);
|
||||
finalNextUserList.add(s);
|
||||
});
|
||||
nextUserList.addAll(finalNextUserList);
|
||||
// if(object.getString("qcUserId").contains(",")){
|
||||
// nextUserList = Arrays.asList(object.getString("qcUserId").split(","));
|
||||
// }else {
|
||||
// nextUserList.add(object.getString("qcUserId"));
|
||||
// }
|
||||
// 配置多实例
|
||||
delegateTask.setVariable("qcUserList",nextUserList);
|
||||
delegateTask.addCandidateUsers(nextUserList);
|
||||
delegateTask.setVariable("qcUserList",finalNextUserList);
|
||||
delegateTask.addCandidateUsers(finalNextUserList);
|
||||
}else {
|
||||
throw new ActivitiException("1#2其他起草人参数不存在,请配置相关用户");
|
||||
}
|
||||
@@ -110,8 +107,8 @@ public class BLApplicantAfter implements TaskListener{
|
||||
busProcessNew.setTaskInfo(delegateTask.getName());
|
||||
busBean.save(busProcessNew);
|
||||
|
||||
if(nextUserList != null && !nextUserList.isEmpty()){
|
||||
for(String nextUser : nextUserList){
|
||||
if(finalNextUserList != null && !finalNextUserList.isEmpty()){
|
||||
for(String nextUser : finalNextUserList){
|
||||
BusProcessNew busProcessNewNext = new BusProcessNew();
|
||||
busProcessNewNext.setMsgType("clause");
|
||||
busProcessNewNext.setPId(delegateTask.getProcessInstanceId());
|
||||
|
||||
@@ -50,6 +50,7 @@ public class BussLibrary2Before implements TaskListener{
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
BusProcessModelHis modelHis = hisList.get(0);
|
||||
modelHis.setTaskId(delegateTask.getId());
|
||||
modelHis.setTaskInfo(delegateTask.getName());
|
||||
String filePath = hisService.saveBussModelFile(delegateTask.getProcessInstanceId(),delegateTask.getId());
|
||||
modelHis.setEditFilePath(filePath);
|
||||
modelHis.setUpdateTime(sdf.format(new Date()));
|
||||
|
||||
@@ -601,7 +601,7 @@ public class PoiWord {
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
wordRedDocument("E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc-1.docx",null,"E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc3.docx","E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc-2.docx");
|
||||
wordRedDocument("E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc-2.docx",null,"E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc3.docx","E:\\Software\\rtpro\\Foton\\File\\doc\\create_toc-1.docx");
|
||||
// writeWordBanch();
|
||||
// writeToDocx();
|
||||
// writeTOC();
|
||||
|
||||
Reference in New Issue
Block a user