合并分支 'dev_foton_DBQ' 到 'FOTON'

Dev foton dbq

查看合并请求 laws-foton-slrs/foton-wkflow-rest!6
This commit is contained in:
陈栋
2022-12-27 16:43:25 +08:00
2 changed files with 208 additions and 2 deletions
@@ -3,7 +3,6 @@ package com.ydw.bat.wkflow.business_activiti.task;
import java.text.SimpleDateFormat;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydw.bat.wkflow.business_auth.LawsUserInfoService;
import com.ydw.bat.wkflow.business_main.datas.entity.*;
@@ -179,4 +178,140 @@ public class TaskController {
}
return list;
}
@ApiOperation(value = "流程实例汇总列表")
@ApiImplicitParam(name = "prcNum", value = "流程实例id")
@GetMapping("/get_gather_by_instance")
public List<Map<String, Object>> get_gather_by_instance(String prcNum,String sortWord,String shunxu) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("PRC_NUM",prcNum);
Boolean isGather=false;
Integer index=-1;
Map<String,String> typeData=new HashMap<>();
typeData.put("1","起草");// 标准入库流程数据
typeData.put("buss1","批准");//企标入库
typeData.put("buss2","意见汇总修订");//企标入库
typeData.put("buss3","汇总");//企标复审
typeData.put("4","起草");//标准清单发布流程数据
typeData.put("5","批准");//标准项目合规评估
typeData.put("6","批准");//标准项目合规评估 项目维度
typeData.put("8","合规排查(上传合规举证材料)");// 未符合项整改
typeData.put("9","批准");// 标准解读流程
typeData.put("2","调研结果处理");//标准调研流程
typeData.put("3","意见处理");//标准征求意见
typeData.put("10","清单发布");//项目清单确认
typeData.put("24","起草人修改标准状态");//企标废止
typeData.put("25","起草");//企标制修订计划管控
typeData.put("26","起草");//企标制修订立项计划
typeData.put("23","汇总");//企标复审
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(one.getPrcId()).orderByHistoricTaskInstanceEndTime().asc();
List<HistoricTaskInstance> list2 = historicTaskInstanceQuery.list();
List<HistoricTaskInstance> middle =new ArrayList<>();
list2.forEach(historicTaskInstance -> {
if (null==historicTaskInstance.getEndTime()){
middle.add(historicTaskInstance);
}
});
list2.removeAll(middle);
list2.addAll(middle);
List<Map<String,Object>> list = ActivitiTools.turnHistoricTaskInstance(list2);
for(int i=0;i<list.size();i++){
Map<String, Object> historicTaskInstance= list.get(i);
// if(ChkUtil.isNull(historicTaskInstance.get("assignee"))) {
// continue;
// }
//需要修改 根据当前表结构查询
// Map<String, Object> map = jt.queryForMap("select t.USR_NAME from view_t_au_usr t where t.OBJECT_ID=?", historicTaskInstance.get("assignee"));
// if(ChkUtil.isNotNull(map)) {
// historicTaskInstance.put("assignee", map.get("USR_NAME"));
// }
if(StringUtils.isNotBlank(one.getId())){
historicTaskInstance.put("bpnId",one.getId());
}
if(ChkUtil.isNull(historicTaskInstance.get("assignee"))) {
// ResponseMessage<List<OrgEO>> listUser = lawsUserInfoService.getManagerByOrgIdNew("企业标准管理工程师");
ResponseMessage<List<OrgEO>> listUser = new ResponseMessage<>();
if(false){
List<String> qbgcs = new ArrayList<>();
for (OrgEO orgEO : listUser.getData()) {
qbgcs.add(orgEO.getUserName());
}
String str= StringUtils.join(qbgcs, ",");
historicTaskInstance.put("assignee", str);
}
}else{
ResponseMessage<UserVO> assignee = lawsUserInfoService.getById(historicTaskInstance.get("assignee").toString());
if(assignee.getData()!=null){
historicTaskInstance.put("assignee", assignee.getData().getUname());
historicTaskInstance.put("assigneeId", assignee.getData().getUsid());
QueryWrapper queryWrapper2 = new QueryWrapper();
queryWrapper2.eq("TASK_ID",historicTaskInstance.get("id"));
queryWrapper2.orderByDesc("CREATE_TIME");
List<BusProcessEntrust> list1 = iBusProcessEntrustService.list(queryWrapper2);
String str = "";
if(list1.size()>0){
ResponseMessage<UserVO> assignee1 = lawsUserInfoService.getById(list1.get(0).getUserId());
historicTaskInstance.put("assignee", assignee.getData().getUname()+"("+assignee1.getData().getUname()+" 转办)");
}
}
}
historicTaskInstance.put("prcType",one.getPrcType());
historicTaskInstance.put("prcName",one.getPrcName());
historicTaskInstance.put("prcNum",one.getPrcNum());
QueryWrapper queryWrapper1 = new QueryWrapper();
queryWrapper1.eq("TASK_ID",historicTaskInstance.get("id"));
queryWrapper1.eq("TASK_INFO",historicTaskInstance.get("name"));
queryWrapper1.isNotNull("COMMIT_TEXT");
List<BusProcessNew> list1 = iBusProcessNewService.list(queryWrapper1);
if(!list1.isEmpty()){
historicTaskInstance.put("comment",list1.get(0).getCommitFlag());
historicTaskInstance.put("commentText",list1.get(0).getCommitText());
}else{
historicTaskInstance.put("comment","");
historicTaskInstance.put("commentText","");
}
//判断是否可汇总功能
String prcType=historicTaskInstance.get("prcType").toString();
String name=historicTaskInstance.get("name").toString();
Boolean endTime=historicTaskInstance.get("endTime")!=null;
if (typeData.get(prcType).equals(name)) {
if(endTime) {
isGather = true;
index = i;
}else{
isGather=false;
index=-1;
}
}
}
if(StringUtils.isNotBlank(sortWord)){
Collections.sort(list, new Comparator<Map<String, Object>>() {
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
String id1="";
String id2="";
if(sortWord.equals("startTime")){
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
id1 = df.format(o1.get(sortWord));
id2 = df.format(o2.get(sortWord));
}else{
id1 = (String) o1.get(sortWord);
id2 = (String) o2.get(sortWord);
}
if(shunxu.equals("desc")){
return id2.compareTo(id1);
}else{
return id1.compareTo(id2);
}
}
});
}
Map<String,Object> m=new HashMap<>();
m.put("isGather",isGather);
m.put("index",index);
list.add(m);
return list;
}
}
@@ -597,7 +597,6 @@ public class TodoTaskController extends BaseAction {
}
}
JSONObject object3 = JSONObject.parseObject(list.get(0).getMesg());
JSONArray arr2 = new JSONArray();
object3.put("taskBreak", arr2);
@@ -609,6 +608,7 @@ public class TodoTaskController extends BaseAction {
long count = oaTaskExecService.count(wrapper);
processNew.setCommitStatus(count);
return processNew;
}
/**
@@ -1775,6 +1775,77 @@ public class TodoTaskController extends BaseAction {
}
}
@ApiOperation(value = "解读流程汇总详情")
@GetMapping("/decodeDetail")
public BusProcessNew Detail(String taskIds, String pId) {
QueryWrapper<BusProcessNew> q=new QueryWrapper<>();
Map<String,JSONObject> msgData =new HashMap<>();
List<String> nameData=new ArrayList<>();
List<BusProcessNew> listData = iBusProcessNewService.list(q.eq("P_ID", pId));
for (BusProcessNew bpn:listData) {
String mesg = bpn.getMesg();
JSONObject object = JSONObject.parseObject(mesg);
String resolveFlag = object.getString("resolveFlag");
if(bpn.getTaskInfo().equals("审核")&&resolveFlag.equals("1")){
nameData.add(bpn.getUserId());
msgData.put(bpn.getUserId(),JSONObject.parseObject(bpn.getMesg()));
}
}
JSONArray jsonArray=new JSONArray();
for (String name:nameData) {
jsonArray.addAll(msgData.get(name).getJSONArray("itemList"));
}
List<String> taskIdList = new ArrayList<>(Arrays.asList(taskIds.split(",")));
List<BusProcessNew> list = iBusProcessNewService.findNoExecuteBusProcessNewForEnd(taskIdList);
if (list.isEmpty()) {
return null;
}
BusProcessNew processNew = new BusProcessNew();
BeanUtils.copyProperties(list.get(0), processNew);
if(StringUtils.isNotBlank(pId)){
List<Task> list2 = taskService.createTaskQuery().processInstanceId(pId).active().list();
if(!list2.isEmpty()){
processNew.setNowTaskInfo(list2.get(0).getName());
}
}
JSONObject object3 = JSONObject.parseObject(list.get(0).getMesg());
JSONArray arr2 = new JSONArray();
object3.put("taskBreak", arr2);
object3.put("itemList",jsonArray);
processNew.setMesg(object3.toJSONString());
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("TODO_ID",processNew.getId());
wrapper.eq("EXEC_TYPE",2);
wrapper.eq("EXEC_STATUS",0);
long count = oaTaskExecService.count(wrapper);
processNew.setCommitStatus(count);
return processNew;
}
/**
* 查询 taskIds项
* @param prcId
* @return
*/
@ApiOperation(value = "查询汇总项")
@GetMapping("/queryTaskIndex")
public BusProcessNew queryTaskIndex(String prcId,String taskIds) {
QueryWrapper<BusProcessNew> q=new QueryWrapper<>();
List<BusProcessNew> list = iBusProcessNewService.list(q.eq("P_ID", prcId));
if (list.size()>0) {
for (BusProcessNew bpn:list) {
if (bpn.getTaskId().equals(taskIds)) return bpn;
}
} else {
return null;
}
return null;
}
/**
* 查询草稿
*