|
@@ -1,6 +1,7 @@
|
|
|
package com.gyee.frame.service.impl.ticket;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.frame.common.exception.TicketException;
|
|
|
import com.gyee.frame.model.ticket.*;
|
|
|
import com.gyee.frame.mapper.ticket.WfinstanceMapper;
|
|
|
import com.gyee.frame.service.ticket.*;
|
|
@@ -121,14 +122,19 @@ public class WfinstanceServiceImpl extends ServiceImpl<WfinstanceMapper, Wfinsta
|
|
|
*/
|
|
|
if (wfinstance.getActive().equals("是")) {
|
|
|
// 添加最后一条待办信息
|
|
|
- Wfassignment lastItem = wfassignmentService.getLastItem(wfinstance.getId(), wfinstance.getWfrevision(), wfinstance.getOwnerid(), "活动");
|
|
|
- FlowStep obj = new FlowStep("节点:" + nodeMap.get(lastItem.getNodeid()),
|
|
|
- "人员:" + laborMap.get(lastItem.getAssigncode()),
|
|
|
+ List<Wfassignment> items = wfassignmentService.getActiveItem(wfinstance.getId(), wfinstance.getWfrevision(), wfinstance.getOwnerid(), "活动");
|
|
|
+ String labor = "";
|
|
|
+ for (int i = 0; i < items.size(); i++){
|
|
|
+ String code = laborMap.get(items.get(i).getAssigncode());
|
|
|
+ labor = labor + " " + code;
|
|
|
+ }
|
|
|
+ FlowStep obj = new FlowStep("节点:" + nodeMap.get(items.get(0).getNodeid()),
|
|
|
+ "人员:" + labor,
|
|
|
"日期:");
|
|
|
list.add(obj);
|
|
|
map.put("flow", list);
|
|
|
map.put("status", 2);
|
|
|
- map.put("nodeid", lastItem.getNodeid());
|
|
|
+ map.put("nodeid", items.get(0).getNodeid());
|
|
|
map.put("version", wfinstance.getWfrevision());
|
|
|
map.put("instid", wfinstance.getId());
|
|
|
}
|
|
@@ -147,7 +153,11 @@ public class WfinstanceServiceImpl extends ServiceImpl<WfinstanceMapper, Wfinsta
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean initInstance(double ownerId, String wfName, String ticketNum, String principal, String stater, String labor, String role) {
|
|
|
+ public boolean initInstance(double ownerId, String wfName, String ticketNum, String principal, String stater, List<String> labor, String role, String online) {
|
|
|
+ // 如果在线人员不是工作负责人,则不可启动流程
|
|
|
+ if (!online.equals(principal))
|
|
|
+ throw new TicketException("只有工作票负责人可以启动流程");
|
|
|
+
|
|
|
QueryWrapper<Wfinstance> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("OWNERID", ownerId);
|
|
|
List<Wfinstance> wfinstances = baseMapper.selectList(wrapper);
|
|
@@ -183,34 +193,36 @@ public class WfinstanceServiceImpl extends ServiceImpl<WfinstanceMapper, Wfinsta
|
|
|
throw new RuntimeException();
|
|
|
|
|
|
Wftaskassign task= wftaskassignService.taskAssign(action.getEndnodeid(), process.getWfrevision(), wfName);
|
|
|
- Wfassignment assignment = new Wfassignment();
|
|
|
- assignment.setDescription(task.getDescription().replace(":{TICKETNUM}", ticketNum));
|
|
|
- assignment.setId((double)wfassignmentService.selectMaxId() + 1);
|
|
|
- assignment.setAssigncode(labor);
|
|
|
- assignment.setApp(TicketUtil.wfNameFormat(wfName));
|
|
|
- assignment.setStartdate(new Date());
|
|
|
- assignment.setEmailnotify("否");
|
|
|
- assignment.setAssignstatus("活动");
|
|
|
- assignment.setWfinstid((double)id + 1);
|
|
|
- assignment.setWfname(wfName);
|
|
|
- assignment.setWfrevision(process.getWfrevision());
|
|
|
- assignment.setInitperson("");
|
|
|
- assignment.setOwnertable(process.getTablename());
|
|
|
- assignment.setOwnerid(ownerId);
|
|
|
- assignment.setInitperson(stater);
|
|
|
- assignment.setWfrole(role);
|
|
|
- assignment.setDealtimeout(0.0);
|
|
|
- assignment.setDealtype("0");
|
|
|
- assignment.setDealtype("自动发送");
|
|
|
- assignment.setPriority(0.0);
|
|
|
- assignment.setEnddate(null);
|
|
|
- assignment.setNodeid(action.getEndnodeid());
|
|
|
- assignment.setTaskid(task.getId());
|
|
|
- assignment.setNeedpass("否");
|
|
|
-
|
|
|
- boolean save = wfassignmentService.save(assignment);
|
|
|
- if(!save)
|
|
|
- throw new RuntimeException();
|
|
|
+ for (int i = 0; i < labor.size(); i++){
|
|
|
+ Wfassignment assignment = new Wfassignment();
|
|
|
+ assignment.setDescription(task.getDescription().replace(":{TICKETNUM}", ticketNum));
|
|
|
+ assignment.setId((double)wfassignmentService.selectMaxId() + 1);
|
|
|
+ assignment.setAssigncode(labor.get(i));
|
|
|
+ assignment.setApp(TicketUtil.wfNameFormat(wfName));
|
|
|
+ assignment.setStartdate(new Date());
|
|
|
+ assignment.setEmailnotify("否");
|
|
|
+ assignment.setAssignstatus("活动");
|
|
|
+ assignment.setWfinstid((double)id + 1);
|
|
|
+ assignment.setWfname(wfName);
|
|
|
+ assignment.setWfrevision(process.getWfrevision());
|
|
|
+ assignment.setInitperson("");
|
|
|
+ assignment.setOwnertable(process.getTablename());
|
|
|
+ assignment.setOwnerid(ownerId);
|
|
|
+ assignment.setInitperson(stater);
|
|
|
+ assignment.setWfrole(role);
|
|
|
+ assignment.setDealtimeout(0.0);
|
|
|
+ assignment.setDealtype("0");
|
|
|
+ assignment.setDealtype("自动发送");
|
|
|
+ assignment.setPriority(0.0);
|
|
|
+ assignment.setEnddate(null);
|
|
|
+ assignment.setNodeid(action.getEndnodeid());
|
|
|
+ assignment.setTaskid(task.getId());
|
|
|
+ assignment.setNeedpass("否");
|
|
|
+
|
|
|
+ boolean save = wfassignmentService.save(assignment);
|
|
|
+ if(!save)
|
|
|
+ throw new RuntimeException();
|
|
|
+ }
|
|
|
|
|
|
Wftrans trans = new Wftrans();
|
|
|
trans.setId((double)wftransService.selectMaxId() + 1);
|