Merge remote-tracking branch 'origin/master'
commit
c77cd70237
|
@ -1,119 +0,0 @@
|
||||||
package cn.palmte.work.controller.backend;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
|
||||||
import cn.palmte.work.model.ActScript;
|
|
||||||
import cn.palmte.work.model.ActScriptRepository;
|
|
||||||
import cn.palmte.work.service.ActScriptService;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程脚本管理
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/actScript")
|
|
||||||
public class ActScriptController extends BaseController {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActScriptController.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActScriptService actScriptService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActScriptRepository actScriptRepository;
|
|
||||||
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public String list(@RequestParam(value = "keywords", required = false) String keywords,
|
|
||||||
@RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber,
|
|
||||||
@RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize,
|
|
||||||
Map<String, Object> model) {
|
|
||||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
|
||||||
model.put("pager", actScriptService.list(searchInfo, pageNumber, pageSize));
|
|
||||||
return "/admin/act_script_list";
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "/add")
|
|
||||||
public String add(Map<String, Object> model) {
|
|
||||||
List<String> list = getScriptList();
|
|
||||||
model.put("actScript", new ActScript());
|
|
||||||
model.put("classList", list);
|
|
||||||
|
|
||||||
List<String> methodList = new ArrayList<>();
|
|
||||||
for (String l : list) {
|
|
||||||
methodList.addAll(getMethodList(l));
|
|
||||||
}
|
|
||||||
|
|
||||||
model.put("methodList", methodList);
|
|
||||||
return "/admin/act_script_input";
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getScriptList() {
|
|
||||||
List<String> list = new ArrayList<>(1);
|
|
||||||
list.add("cn.palmte.work.service.ActCallbackScript");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<String> getMethodList(String className) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
Method[] methods = Class.forName(className).getDeclaredMethods();
|
|
||||||
for (Method method : methods) {
|
|
||||||
list.add(method.getName());
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
logger.error("", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping(value = "/edit")
|
|
||||||
public String edit(@RequestParam int id, Map<String, Object> model) {
|
|
||||||
List<String> list = getScriptList();
|
|
||||||
model.put("actScript", actScriptRepository.findOne(id));
|
|
||||||
model.put("classList", list);
|
|
||||||
List<String> methodList = new ArrayList<>();
|
|
||||||
for (String l : list) {
|
|
||||||
methodList.addAll(getMethodList(l));
|
|
||||||
}
|
|
||||||
|
|
||||||
model.put("methodList", methodList);
|
|
||||||
return "/admin/act_script_input";
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public String save(ActScript actScript) {
|
|
||||||
actScriptService.save(actScript);
|
|
||||||
return "redirect:/actScript/list";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ResponseBody
|
|
||||||
@GetMapping(value = "/delete")
|
|
||||||
public ResponseMsg delete(@RequestParam("ids") String ids){
|
|
||||||
if ("".equals(ids)){
|
|
||||||
return ResponseMsg.buildFailedMsg("删除失败,无选中项!");
|
|
||||||
}else {
|
|
||||||
String[] deleteIds=ids.split("#%#");
|
|
||||||
for (String id : deleteIds) {
|
|
||||||
actScriptService.delete(Integer.parseInt(id));
|
|
||||||
}
|
|
||||||
return ResponseMsg.buildSuccessMsg("删除成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +1,6 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
|
||||||
import cn.palmte.work.bean.ResponseMsg;
|
import cn.palmte.work.bean.ResponseMsg;
|
||||||
import cn.palmte.work.model.ActScriptRepository;
|
|
||||||
import cn.palmte.work.model.ActTaskDef;
|
import cn.palmte.work.model.ActTaskDef;
|
||||||
import cn.palmte.work.model.AdminRepository;
|
import cn.palmte.work.model.AdminRepository;
|
||||||
import cn.palmte.work.pojo.ActHisTask;
|
import cn.palmte.work.pojo.ActHisTask;
|
||||||
|
@ -19,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程任务
|
* 流程任务
|
||||||
|
@ -35,8 +34,6 @@ public class ActTaskDefController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleService sysRoleService;
|
private SysRoleService sysRoleService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActScriptRepository actScriptRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActTaskDefService actTaskDefService;
|
private ActTaskDefService actTaskDefService;
|
||||||
|
@ -51,12 +48,14 @@ public class ActTaskDefController extends BaseController {
|
||||||
@RequestMapping("/config/{procDefId}")
|
@RequestMapping("/config/{procDefId}")
|
||||||
public String list(@PathVariable String procDefId, Map<String, Object> model) {
|
public String list(@PathVariable String procDefId, Map<String, Object> model) {
|
||||||
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
|
List<ActTaskDef> list = actTaskDefService.findByProcDefId(procDefId);
|
||||||
|
//过滤掉发起节点的全是审批节点
|
||||||
|
List<ActTaskDef> approveList = list.stream().filter(t-> t.getTaskIndex() == 0).collect(Collectors.toList());
|
||||||
model.put("procDefId", procDefId);
|
model.put("procDefId", procDefId);
|
||||||
model.put("taskList", list);
|
model.put("taskList", list);
|
||||||
|
model.put("approveList", approveList);
|
||||||
model.put("procDefName", list.get(0).getProcDefName());
|
model.put("procDefName", list.get(0).getProcDefName());
|
||||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||||
model.put("adminList", adminRepository.getAllEnable());
|
model.put("adminList", adminRepository.getAllEnable());
|
||||||
model.put("scriptList", actScriptRepository.findAll());
|
|
||||||
|
|
||||||
return "/admin/act_task_def";
|
return "/admin/act_task_def";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package cn.palmte.work.model;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 流程脚本
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Entity
|
|
||||||
@Table(name = "act_script")
|
|
||||||
public class ActScript {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
@Column(name = "script_name")
|
|
||||||
private String scriptName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 脚本所在类
|
|
||||||
*/
|
|
||||||
@Column(name = "class_name")
|
|
||||||
private String className;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 脚本方法名
|
|
||||||
*/
|
|
||||||
@Column(name = "class_method")
|
|
||||||
private String classMethod;
|
|
||||||
|
|
||||||
@Column(name = "created_time")
|
|
||||||
private Date createdTime;
|
|
||||||
|
|
||||||
@Column(name = "last_updated_time")
|
|
||||||
private Date lastUpdatedTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package cn.palmte.work.model;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
|
|
||||||
public interface ActScriptRepository extends JpaRepository<ActScript, Integer> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -69,13 +69,13 @@ public class ActTaskDef {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批通过执行的脚本 act_script表id
|
* 审批通过执行的脚本 act_script(弃用)表id 弃用
|
||||||
*/
|
*/
|
||||||
@Column(name = "end_script")
|
@Column(name = "end_script")
|
||||||
private int endScript;
|
private int endScript;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批驳回执行的脚本 act_script表id
|
* 审批驳回执行的脚本 act_script(弃用)表id 弃用
|
||||||
*/
|
*/
|
||||||
@Column(name = "rollback_script")
|
@Column(name = "rollback_script")
|
||||||
private int rollbackScript;
|
private int rollbackScript;
|
||||||
|
|
|
@ -20,4 +20,5 @@ public class ActProcIns {
|
||||||
|
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
|
private String projectName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,7 @@ public class ActListenerService {
|
||||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(procInsId).singleResult();
|
||||||
logger.info("addCandidateUsers : {}, taskName:{}, hasProcIns:{}", candidateUsers, delegateTask.getName(), processInstance != null);
|
logger.info("addCandidateUsers : {}, taskName:{}, hasProcIns:{}", candidateUsers, delegateTask.getName(), processInstance != null);
|
||||||
|
|
||||||
if (actUtil.isProjectProcessIns(processInstance)) {
|
updateProjectApprover(candidateUsers, processInstance, procDefId, taskDefKey);
|
||||||
updateProjectApprover(candidateUsers, processInstance, procDefId, taskDefKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
delegateTask.addCandidateUsers(candidateUsers);
|
delegateTask.addCandidateUsers(candidateUsers);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,8 @@ public class ActProcInsService {
|
||||||
taskService.setAssignee(taskId, adminId);
|
taskService.setAssignee(taskId, adminId);
|
||||||
taskService.complete(taskId);
|
taskService.complete(taskId);
|
||||||
|
|
||||||
if (actUtil.isProjectProcessIns(instance)) {
|
projectTaskRecordService.saveTaskRecord(Integer.parseInt(instance.getBusinessKey()),
|
||||||
projectTaskRecordService.saveTaskRecord(Integer.parseInt(instance.getBusinessKey()),
|
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActConstant.TASK_INDEX_FIRST_USER_TASK, comment);
|
||||||
task, ApproveStatusEnum.APPROVAL_PENDING.getApproveStatus(), ActConstant.TASK_INDEX_FIRST_USER_TASK, comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance.getId();
|
return instance.getId();
|
||||||
}
|
}
|
||||||
|
@ -123,10 +121,13 @@ public class ActProcInsService {
|
||||||
public Page<ActProcIns> list(ConcurrentHashMap<String, String> searchInfo, int pageNumber, int pageSize) {
|
public Page<ActProcIns> list(ConcurrentHashMap<String, String> searchInfo, int pageNumber, int pageSize) {
|
||||||
String select = "select h.proc_inst_id_ as procInsId,h.proc_def_id_ as procDefId," +
|
String select = "select h.proc_inst_id_ as procInsId,h.proc_def_id_ as procDefId," +
|
||||||
"h.start_time_ as startTime,h.end_time_ as endTime,p.key_ as procKey," +
|
"h.start_time_ as startTime,h.end_time_ as endTime,p.key_ as procKey," +
|
||||||
"p.name_ as procName,p.NAME_ as dgrmResourceName,p.version_ as version, GROUP_CONCAT(t.NAME_) as currentTask, GROUP_CONCAT(t.ID_) as currentTaskId";
|
"p.name_ as procName,p.NAME_ as dgrmResourceName,p.version_ as version," +
|
||||||
|
" GROUP_CONCAT(t.NAME_) as currentTask, GROUP_CONCAT(t.ID_) as currentTaskId," +
|
||||||
|
" pjct.name as projectName";
|
||||||
QueryHelper queryHelper = new QueryHelper(select, " act_hi_procinst h " +
|
QueryHelper queryHelper = new QueryHelper(select, " act_hi_procinst h " +
|
||||||
"left join ACT_RE_PROCDEF p on h.PROC_DEF_ID_ =p.ID_ " +
|
"left join ACT_RE_PROCDEF p on h.PROC_DEF_ID_ =p.ID_ " +
|
||||||
"LEFT JOIN act_ru_task t on t.PROC_INST_ID_=h.proc_inst_id_ ");
|
"LEFT JOIN act_ru_task t on t.PROC_INST_ID_=h.proc_inst_id_ " +
|
||||||
|
"LEFT JOIN project pjct on pjct.id=h.BUSINESS_KEY_");
|
||||||
queryHelper.addGroupProperty("h.PROC_INST_ID_");
|
queryHelper.addGroupProperty("h.PROC_INST_ID_");
|
||||||
queryHelper.addOrderProperty("h.start_time_", false);
|
queryHelper.addOrderProperty("h.start_time_", false);
|
||||||
Page<ActProcIns> paginate = pagination.paginate(queryHelper.getSql(), ActProcIns.class, pageNumber, pageSize);
|
Page<ActProcIns> paginate = pagination.paginate(queryHelper.getSql(), ActProcIns.class, pageNumber, pageSize);
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
package cn.palmte.work.service;
|
|
||||||
|
|
||||||
import cn.palmte.work.model.ActScript;
|
|
||||||
import cn.palmte.work.model.ActScriptRepository;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import top.jfunc.common.db.QueryHelper;
|
|
||||||
import top.jfunc.common.db.bean.Page;
|
|
||||||
import top.jfunc.common.db.utils.Pagination;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ActScriptService {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ActScriptService.class);
|
|
||||||
@Autowired
|
|
||||||
private ActScriptRepository actScriptRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
Pagination pagination;
|
|
||||||
|
|
||||||
|
|
||||||
public Page<ActScript> list(ConcurrentHashMap<String, String> searchInfo, int pageNumber, int pageSize) {
|
|
||||||
QueryHelper queryHelper = new QueryHelper("a.*", " act_script a");
|
|
||||||
String name = searchInfo.get("name");
|
|
||||||
queryHelper.addCondition(StringUtils.isNotEmpty(name), "a.script_name=? ", name);
|
|
||||||
queryHelper.addOrderProperty("a.last_updated_time", false);
|
|
||||||
return pagination.paginate(queryHelper.getSql(), ActScript.class, pageNumber, pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(ActScript actScript) {
|
|
||||||
Date now = new Date();
|
|
||||||
int id = actScript.getId();
|
|
||||||
if (id == 0) {
|
|
||||||
actScript.setCreatedTime(now);
|
|
||||||
}else {
|
|
||||||
ActScript one = actScriptRepository.findOne(id);
|
|
||||||
actScript.setCreatedTime(one.getCreatedTime());
|
|
||||||
}
|
|
||||||
actScript.setLastUpdatedTime(now);
|
|
||||||
actScriptRepository.save(actScript);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void delete(int id) {
|
|
||||||
actScriptRepository.delete(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -73,16 +73,12 @@ public class ActTaskDefService {
|
||||||
taskService.setAssignee(taskId, userId);
|
taskService.setAssignee(taskId, userId);
|
||||||
if (ActConstant.TASK_TYPE_SINGE == actTaskDef.getTaskType()) {
|
if (ActConstant.TASK_TYPE_SINGE == actTaskDef.getTaskType()) {
|
||||||
handleSinge(processInstance, taskId, type, actTaskDef);
|
handleSinge(processInstance, taskId, type, actTaskDef);
|
||||||
} else if (ActConstant.TASK_TYPE_MULTI == actTaskDef.getTaskType()) {
|
|
||||||
//多实列 会签处理
|
|
||||||
handleMulti(processInstance, taskId, type, actTaskDef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actUtil.isProjectProcessIns(processInstance)) {
|
|
||||||
//保存审批记录
|
//保存审批记录
|
||||||
projectTaskRecordService.saveTaskRecord(Integer.parseInt(processInstance.getBusinessKey()),
|
projectTaskRecordService.saveTaskRecord(Integer.parseInt(processInstance.getBusinessKey()),
|
||||||
currentTask, type, actTaskDef.getTaskIndex(), message);
|
currentTask, type, actTaskDef.getTaskIndex(), message);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,49 +90,12 @@ public class ActTaskDefService {
|
||||||
* @param comment
|
* @param comment
|
||||||
*/
|
*/
|
||||||
public void completeTaskByProcInsId(String procInsId, int type, String comment) {
|
public void completeTaskByProcInsId(String procInsId, int type, String comment) {
|
||||||
//int adminId = InterfaceUtil.getAdminId();
|
|
||||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
List<Task> taskList = taskService.createTaskQuery().processInstanceId(procInsId).list();
|
||||||
//List<String> assignUserList;
|
|
||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
//assignUserList = actUtil.getAssignUserList(task.getId());
|
|
||||||
//if (assignUserList.contains(String.valueOf(adminId))) {
|
|
||||||
completeTask(task.getId(), procInsId, comment, type);
|
completeTask(task.getId(), procInsId, comment, type);
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 会签处理
|
|
||||||
*
|
|
||||||
* @param taskId
|
|
||||||
* @param processInstance
|
|
||||||
* @param type
|
|
||||||
* @param actTaskDef
|
|
||||||
*/
|
|
||||||
private void handleMulti(ProcessInstance processInstance, String taskId, int type, ActTaskDef actTaskDef) {
|
|
||||||
if (ApproveStatusEnum.APPROVAL_UNPASS.getApproveStatus() == type) {
|
|
||||||
//一个人驳回 整个任务节点驳回
|
|
||||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
|
|
||||||
for (int i = 0; i < taskList.size(); i++) {
|
|
||||||
TaskEntity taskEntity = (TaskEntity) taskList.get(i);
|
|
||||||
if (!taskId.equals(taskEntity.getId())) {
|
|
||||||
/* taskEntity.setProcessInstanceId(null);
|
|
||||||
taskEntity.setExecutionId(null);
|
|
||||||
taskService.saveTask(taskEntity);*/
|
|
||||||
|
|
||||||
taskService.addComment(taskEntity.getId(), processInstance.getId(), "会签驳回,任务自动失效");
|
|
||||||
taskService.complete(taskEntity.getId());
|
|
||||||
//taskService.deleteTask(taskEntity.getId(), false); // 不删除历史记录
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//驳回到配置的节点
|
|
||||||
actUtil.jumpToTargetTask(taskId, actTaskDef.getRollbackTaskKey());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
taskService.complete(taskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 或签处理
|
* 或签处理
|
||||||
|
@ -152,38 +111,18 @@ public class ActTaskDefService {
|
||||||
//审批通过
|
//审批通过
|
||||||
taskService.complete(taskId);
|
taskService.complete(taskId);
|
||||||
|
|
||||||
//执行配置的审批通过脚本
|
//最后一个任务完成后 更新项目状态为审批通过
|
||||||
int endScript = actTaskDef.getEndScript();
|
updateProjectPassed(processInstance, actTaskDef, procDefKey);
|
||||||
if (endScript != 0) {
|
|
||||||
actUtil.invokeEventScript(endScript, processInstance.getId(), actTaskDef);
|
|
||||||
} else {
|
|
||||||
logger.info("未配置审批通过脚本 task:{}", actTaskDef.getTaskName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actUtil.isProjectProcessIns(procDefKey)) {
|
|
||||||
//最后一个任务完成后 更新项目状态为审批通过
|
|
||||||
updateProjectPassed(processInstance, actTaskDef, procDefKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (ApproveStatusEnum.APPROVAL_UNPASS.getApproveStatus() == type) {
|
} else if (ApproveStatusEnum.APPROVAL_UNPASS.getApproveStatus() == type) {
|
||||||
//驳回
|
//驳回
|
||||||
String rollbackTaskKey = actTaskDef.getRollbackTaskKey();
|
String rollbackTaskKey = actTaskDef.getRollbackTaskKey();
|
||||||
actUtil.jumpToTargetTask(taskId, rollbackTaskKey);
|
actUtil.jumpToTargetTask(taskId, rollbackTaskKey);
|
||||||
|
|
||||||
//执行配置的驳回脚本
|
|
||||||
int rollbackScript = actTaskDef.getRollbackScript();
|
|
||||||
if (rollbackScript != 0) {
|
|
||||||
actUtil.invokeEventScript(rollbackScript, processInstance.getId(), actTaskDef);
|
|
||||||
} else {
|
|
||||||
logger.info("未配置驳回脚本 task:{}", actTaskDef.getTaskName());
|
|
||||||
}
|
|
||||||
|
|
||||||
//驳回后 更新项目状态为审批不通过
|
//驳回后 更新项目状态为审批不通过
|
||||||
if (actUtil.isProjectProcessIns(procDefKey)) {
|
int projectId = Integer.parseInt(processInstance.getBusinessKey());
|
||||||
int projectId = Integer.parseInt(processInstance.getBusinessKey());
|
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_UNPASS);
|
||||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_UNPASS);
|
logger.info("updateProjectUnPassed projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||||
logger.info("updateProjectUnPassed projectId:{}, proDefKey:{}", projectId, procDefKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,13 +139,13 @@ public class ActTaskDefService {
|
||||||
//结算流程 财务总监审批完流程结束
|
//结算流程 财务总监审批完流程结束
|
||||||
if ("财务总监".equals(actTaskDef.getTaskName())) {
|
if ("财务总监".equals(actTaskDef.getTaskName())) {
|
||||||
logger.info("updateProjectPassed1 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
logger.info("updateProjectPassed1 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//其余流程 执行董事审批完流程结束
|
//其余流程 执行董事审批完流程结束
|
||||||
if ("执行董事".equals(actTaskDef.getTaskName())) {
|
if ("执行董事".equals(actTaskDef.getTaskName())) {
|
||||||
logger.info("updateProjectPassed2 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
logger.info("updateProjectPassed2 projectId:{}, proDefKey:{}", projectId, procDefKey);
|
||||||
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
projectInstanceService.updateApproveStatus(projectId, procDefKey, ApproveStatusEnum.APPROVAL_PASSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,8 +231,6 @@ public class ActTaskDefService {
|
||||||
one.setCandidateUsers(taskDef.getCandidateUsers());
|
one.setCandidateUsers(taskDef.getCandidateUsers());
|
||||||
one.setCandidateRoles(taskDef.getCandidateRoles());
|
one.setCandidateRoles(taskDef.getCandidateRoles());
|
||||||
one.setRollbackTaskKey(taskDef.getRollbackTaskKey());
|
one.setRollbackTaskKey(taskDef.getRollbackTaskKey());
|
||||||
one.setEndScript(taskDef.getEndScript());
|
|
||||||
one.setRollbackScript(taskDef.getRollbackScript());
|
|
||||||
one.setLastUpdatedTime(new Date());
|
one.setLastUpdatedTime(new Date());
|
||||||
|
|
||||||
actTaskDefRepository.save(one);
|
actTaskDefRepository.save(one);
|
||||||
|
|
|
@ -3,9 +3,6 @@ package cn.palmte.work.utils;
|
||||||
import cn.palmte.work.config.activiti.ActConstant;
|
import cn.palmte.work.config.activiti.ActConstant;
|
||||||
import cn.palmte.work.config.activiti.DeleteTaskCommand;
|
import cn.palmte.work.config.activiti.DeleteTaskCommand;
|
||||||
import cn.palmte.work.config.activiti.JumpCommand;
|
import cn.palmte.work.config.activiti.JumpCommand;
|
||||||
import cn.palmte.work.model.ActScript;
|
|
||||||
import cn.palmte.work.model.ActScriptRepository;
|
|
||||||
import cn.palmte.work.model.ActTaskDef;
|
|
||||||
import cn.palmte.work.service.AccountService;
|
import cn.palmte.work.service.AccountService;
|
||||||
import org.activiti.bpmn.model.BpmnModel;
|
import org.activiti.bpmn.model.BpmnModel;
|
||||||
import org.activiti.bpmn.model.FlowNode;
|
import org.activiti.bpmn.model.FlowNode;
|
||||||
|
@ -32,11 +29,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ActUtil {
|
public class ActUtil {
|
||||||
|
@ -47,8 +41,6 @@ public class ActUtil {
|
||||||
private RepositoryService repositoryService;
|
private RepositoryService repositoryService;
|
||||||
@Autowired
|
@Autowired
|
||||||
Pagination pagination;
|
Pagination pagination;
|
||||||
@Autowired
|
|
||||||
private ActScriptRepository actScriptRepository;
|
|
||||||
@Resource
|
@Resource
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -91,46 +83,6 @@ public class ActUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 反射执行脚本
|
|
||||||
*
|
|
||||||
* @param scriptId
|
|
||||||
* @param procInsId
|
|
||||||
*/
|
|
||||||
public void invokeEventScript(int scriptId, String procInsId, ActTaskDef actTaskDef) {
|
|
||||||
ActScript actScript = actScriptRepository.findOne(scriptId);
|
|
||||||
if (actScript == null) {
|
|
||||||
logger.info("脚本配置错误");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put(ActConstant.PROC_INS_ID, procInsId);
|
|
||||||
map.put(ActConstant.PROC_DEF_KEY, actTaskDef.getProcDefKey());
|
|
||||||
List<Record> variables = getVariables(procInsId);
|
|
||||||
for (Record variable : variables) {
|
|
||||||
map.put(variable.getStr("name"), variable.get("text"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//调用方法传递的参数
|
|
||||||
Object[] args = new Object[1];
|
|
||||||
args[0] = map;
|
|
||||||
|
|
||||||
logger.info("invokeEventScript class:{}, methond:{}, param:{}", actScript.getClassName(), actScript.getClassMethod(), map);
|
|
||||||
try {
|
|
||||||
Class<?> ownerClass = Class.forName(actScript.getClassName());
|
|
||||||
Object bean = applicationContext.getBean(ownerClass);
|
|
||||||
Class<?>[] paramsType = new Class[1];
|
|
||||||
paramsType[0] = Class.forName("java.util.Map");
|
|
||||||
//找到脚本方法对应的方法 注意:有且只有一个以Map为参数的方法
|
|
||||||
Method method = ownerClass.getDeclaredMethod(actScript.getClassMethod(), paramsType);
|
|
||||||
method.invoke(bean, args);
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到指定任务节点
|
* 跳转到指定任务节点
|
||||||
|
@ -249,23 +201,6 @@ public class ActUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isProjectProcessIns(ProcessInstance processInstance) {
|
|
||||||
if (processInstance == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult();
|
|
||||||
String procDefKey = processDefinition.getKey();
|
|
||||||
return isProjectProcessIns(procDefKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isProjectProcessIns(String procDefKey) {
|
|
||||||
return procDefKey.equals(ActConstant.PROCESS_DEFKEY_ESTIMATE)
|
|
||||||
|| procDefKey.equals(ActConstant.PROCESS_DEFKEY_BUDGET)
|
|
||||||
|| procDefKey.equals(ActConstant.PROCESS_DEFKEY_SETTLE)
|
|
||||||
|| procDefKey.equals(ActConstant.PROCESS_DEFKEY_FINAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成xml流
|
* 生成xml流
|
||||||
*
|
*
|
||||||
|
|
|
@ -109,15 +109,7 @@
|
||||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||||
onclick="location.href='${base}/actTaskDef/config/${list.id}'">
|
onclick="location.href='${base}/actTaskDef/config/${list.id}'">
|
||||||
<span class="am-icon-pencil-square-o"></span>
|
<span class="am-icon-pencil-square-o"></span>
|
||||||
任务配置
|
审批人配置
|
||||||
</button>
|
|
||||||
|
|
||||||
|
|
||||||
<button type="button"
|
|
||||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
|
||||||
onclick="startProcIns('${list.procKey}')">
|
|
||||||
<span class="am-icon-pencil-square-o"></span>
|
|
||||||
发起流程
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -252,23 +244,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var startProcIns = function (procDefKey) {
|
|
||||||
var params = {
|
|
||||||
projectType: 3
|
|
||||||
};
|
|
||||||
$.ajax({
|
|
||||||
url: '${base}/actProcIns/startProcIns/' + procDefKey,
|
|
||||||
data: JSON.stringify(params),
|
|
||||||
dataType: "json",
|
|
||||||
contentType: "application/json",
|
|
||||||
type: 'post',
|
|
||||||
async: false,
|
|
||||||
success: function (data) {
|
|
||||||
layer.msg(data.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var pngView = function (id) {
|
var pngView = function (id) {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
|
|
|
@ -19,9 +19,10 @@
|
||||||
<th class="table-title">流程名称</th>
|
<th class="table-title">流程名称</th>
|
||||||
<th class="table-title">流程标识</th>
|
<th class="table-title">流程标识</th>
|
||||||
<th class="table-title">流程版本</th>
|
<th class="table-title">流程版本</th>
|
||||||
|
<th class="table-title">项目名称</th>
|
||||||
<th class="table-date">申请人</th>
|
<th class="table-date">申请人</th>
|
||||||
<th class="table-date">申请时间</th>
|
<th class="table-date">申请时间</th>
|
||||||
<th class="table-date">当前任务</th>
|
<th class="table-date">当前任务节点</th>
|
||||||
<th class="table-date">当前审批人</th>
|
<th class="table-date">当前审批人</th>
|
||||||
<th class="table-date">结束时间</th>
|
<th class="table-date">结束时间</th>
|
||||||
<th class="table-set am-text-center">操作</th>
|
<th class="table-set am-text-center">操作</th>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
<td>${list.procName!}</td>
|
<td>${list.procName!}</td>
|
||||||
<td>${list.procKey!}</td>
|
<td>${list.procKey!}</td>
|
||||||
<td>${list.version!}</td>
|
<td>${list.version!}</td>
|
||||||
|
<td>${list.projectName!}</td>
|
||||||
<td>${list.user!}</td>
|
<td>${list.user!}</td>
|
||||||
<td>${list.startTime?datetime}</td>
|
<td>${list.startTime?datetime}</td>
|
||||||
<td>${list.currentTask!}</td>
|
<td>${list.currentTask!}</td>
|
||||||
|
|
|
@ -1,203 +0,0 @@
|
||||||
<#assign base=request.contextPath />
|
|
||||||
<#import "../common/defaultLayout.ftl" as defaultLayout>
|
|
||||||
<@defaultLayout.layout>
|
|
||||||
|
|
||||||
<div class="admin-content">
|
|
||||||
<div class="admin-content-body">
|
|
||||||
<div class="am-cf am-padding">
|
|
||||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">工作流程</strong> / <small>流程脚本</small></div>
|
|
||||||
</div>
|
|
||||||
<form method="post" class="am-form" id="tmpForm" action="${base}/actScript/save">
|
|
||||||
<!--选项卡(tabs)begin-->
|
|
||||||
<div class="am-tabs am-margin" data-am-tabs>
|
|
||||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
|
||||||
<li class="am-active">
|
|
||||||
<a href="#tab1">脚本编辑</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="am-tabs-bd">
|
|
||||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
|
||||||
|
|
||||||
<input name="id" id="id" type="hidden" value="${actScript.id!}"/>
|
|
||||||
|
|
||||||
<!--验证表单元素(validate) begin-->
|
|
||||||
<!--input begin-->
|
|
||||||
<div class="am-g am-form-group am-margin-top">
|
|
||||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
|
||||||
<span style="color: red;">*</span>
|
|
||||||
脚本名称
|
|
||||||
</div>
|
|
||||||
<div class="am-u-sm-6 am-u-md-6">
|
|
||||||
<input name="scriptName" class="js-ajax-validate"
|
|
||||||
data-validate-async data-validation-message="请输入脚本名称(20字符以内)"
|
|
||||||
type="text" id="scriptName" value="${actScript.scriptName!}" minlength="1" maxlength="100"
|
|
||||||
placeholder="请输入模型名称(100字符以内)" required onKeyUp="clearValidInfo()" />
|
|
||||||
</div>
|
|
||||||
<div class="am-u-sm-2 am-u-md-4 input-msg" id="role_name_valid"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="am-g am-form-group am-margin-top">
|
|
||||||
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>脚本所在类</div>
|
|
||||||
<div class="am-u-sm-6 am-u-md-6">
|
|
||||||
<select data-am-selected id="className" name="className" readonly="">
|
|
||||||
<#list classList as l>
|
|
||||||
<option value="${l}" <#if actScript.className! == l>selected</#if> >${l!}</option>
|
|
||||||
</#list>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="am-g am-form-group am-margin-top">
|
|
||||||
<div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>方法名称</div>
|
|
||||||
<div class="am-u-sm-6 am-u-md-6">
|
|
||||||
<select data-am-selected id="classMethod" name="classMethod" readonly="">
|
|
||||||
<#list methodList as l>
|
|
||||||
<option value="${l}" <#if actScript.classMethod! == l>selected</#if> >${l!}</option>
|
|
||||||
</#list>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--选项卡(tabs)end-->
|
|
||||||
<div class="am-margin">
|
|
||||||
<button type="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
|
|
||||||
<button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">返回上一级</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</@defaultLayout.layout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
/*名称检验 start*/
|
|
||||||
var urlBase = "${base}";
|
|
||||||
var url;
|
|
||||||
|
|
||||||
|
|
||||||
function clearValidInfo(){
|
|
||||||
showRoleNameAlert("");
|
|
||||||
}
|
|
||||||
function showRoleNameAlert(message){
|
|
||||||
var $alert = $("#role_name_valid").find('.am-alert');
|
|
||||||
if (!$alert.length) {
|
|
||||||
$alert = $('<div class="am-alert am-alert-danger"></div>').hide()
|
|
||||||
$alert.appendTo($("#role_name_valid"));
|
|
||||||
}
|
|
||||||
if(message.length==0){
|
|
||||||
$alert.hide();
|
|
||||||
}else{
|
|
||||||
$alert.text(message).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*角色名称检验 end*/
|
|
||||||
|
|
||||||
|
|
||||||
/*复选框 全选:start*/
|
|
||||||
$(".role-authority-checkall").click(function(){
|
|
||||||
var $parentNode = $(this).parent().parent();
|
|
||||||
var level = Number($parentNode.attr("level"));
|
|
||||||
var $allParentNextNode = $parentNode.nextUntil(".level-"+level);
|
|
||||||
var isChecked = $(this).is(":checked");
|
|
||||||
$allParentNextNode.each(function(){
|
|
||||||
var myLevel = Number($(this).attr("level"));
|
|
||||||
var $checks = $(this).children().find("input[type='checkbox']");
|
|
||||||
if(myLevel > level){
|
|
||||||
return changeCheckedStatus($checks,isChecked);
|
|
||||||
}else{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var $checks = $(this).parent().prev().find("input[type='checkbox']");
|
|
||||||
changeCheckedStatus($checks,isChecked);
|
|
||||||
});
|
|
||||||
|
|
||||||
function changeCheckedStatus(checksObj,isChecked){
|
|
||||||
checksObj.each(function(){
|
|
||||||
if(isChecked){
|
|
||||||
$(this).prop("checked",true);
|
|
||||||
}else{
|
|
||||||
$(this).prop("checked",false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/*复选框 全选:end*/
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
/*表单验证:begin*/
|
|
||||||
//自定义规则,用法:验证元素上加class="js-pattern-sort"
|
|
||||||
if ($.AMUI && $.AMUI.validator) {
|
|
||||||
$.AMUI.validator.patterns.sort = /^([0-9]+)$/;
|
|
||||||
}
|
|
||||||
$("#tmpForm").validator({
|
|
||||||
// 域通过验证时回调
|
|
||||||
onValid: function(validity) {
|
|
||||||
$(validity.field).closest('.am-form-group').find('.am-alert').hide();
|
|
||||||
},
|
|
||||||
// 域验证通过时添加的操作,通过该接口可定义各种验证提示
|
|
||||||
markValid: function(validity) {
|
|
||||||
// this is Validator instance
|
|
||||||
var $field = $(validity.field);
|
|
||||||
//add by zxl,只对有required属性的字段进行验证
|
|
||||||
if(typeof($field.attr("required"))!="undefined"){
|
|
||||||
var options = this.options;
|
|
||||||
var $parent = $field.closest('.am-form-group');
|
|
||||||
$field.addClass(options.validClass).
|
|
||||||
removeClass(options.inValidClass);
|
|
||||||
|
|
||||||
$parent.addClass('am-form-success').removeClass('am-form-error');
|
|
||||||
|
|
||||||
options.onValid.call(this, validity);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 验证出错时的回调, validity 对象包含相关信息,格式通 H5 表单元素的 validity 属性
|
|
||||||
onInValid: function(validity) {
|
|
||||||
var $field = $(validity.field);
|
|
||||||
var $group = $field.closest('.am-form-group');
|
|
||||||
var $alert = $group.find('.am-alert');
|
|
||||||
// 使用自定义的提示信息 或 插件内置的提示信息
|
|
||||||
var msg = $field.data('validationMessage') || this.getValidationMessage(validity);
|
|
||||||
|
|
||||||
if (!$alert.length) {
|
|
||||||
$alert = $("<div class='am-alert am-alert-danger'></div>").hide().
|
|
||||||
appendTo($group.find(".input-msg"));
|
|
||||||
}
|
|
||||||
console.log("onInValid : "+$field.val());
|
|
||||||
$alert.html(msg).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
/*表单验证:end*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<style type="text/css">
|
|
||||||
/*验证:提示信息样式 begin*/
|
|
||||||
.am-alert-danger {
|
|
||||||
background-color: transparent;
|
|
||||||
border-color: transparent;
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
.am-alert {
|
|
||||||
margin-bottom: 1em;
|
|
||||||
padding: .625em;
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
/*验证:提示信息样式 end*/
|
|
||||||
</style>
|
|
|
@ -1,204 +0,0 @@
|
||||||
<#assign base=request.contextPath />
|
|
||||||
<#import "../common/defaultLayout.ftl" as defaultLayout>
|
|
||||||
<@defaultLayout.layout>
|
|
||||||
<link rel="stylesheet" href="${base}/assets/css/amazeui.switch.css"/>
|
|
||||||
<div class="admin-content">
|
|
||||||
<div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
|
|
||||||
<!-- padding:1px 2px 3px 4px;上、右、下,和左 -->
|
|
||||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">工作流程</strong> /
|
|
||||||
<small>脚本管理</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<form class="am-form" id="list-form" action="${base}/actScript/list" method="post">
|
|
||||||
<input type="hidden" id="keywords" name="keywords" value='${keywords!""}'/>
|
|
||||||
<div class="am-g">
|
|
||||||
<div class="am-u-sm-12 am-u-md-6" style="padding:0px 1.6rem 1.6rem 1rem;margin:0px;">
|
|
||||||
<div class="am-btn-toolbar">
|
|
||||||
<div class="am-btn-group am-btn-group-xs">
|
|
||||||
<#--<@shiro.hasPermission name="ROLE_ADD">-->
|
|
||||||
<button type="button" class="am-btn am-btn-default"
|
|
||||||
onclick="location.href='${base}/actScript/add'">
|
|
||||||
<span class="am-icon-plus"></span>
|
|
||||||
新增
|
|
||||||
</button>
|
|
||||||
<#-- </@shiro.hasPermission>
|
|
||||||
<@shiro.hasPermission name="ROLE_DELRTE">-->
|
|
||||||
<button type="button" id="deleteButton" disabled="disabled"
|
|
||||||
class="am-btn am-btn-default"
|
|
||||||
onclick="deleteAll('${base}/actScript/delete')"><span
|
|
||||||
class="am-icon-trash-o"></span> 删除
|
|
||||||
</button>
|
|
||||||
<#--</@shiro.hasPermission>-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="am-u-sm-12 am-u-md-3">
|
|
||||||
<div class="am-input-group am-input-group-sm">
|
|
||||||
<input type="text" class="am-form-field" id="name" value="${name!}" placeholder="按名称搜索"/>
|
|
||||||
<span class="am-input-group-btn">
|
|
||||||
<button id="searchButton" class="am-btn am-btn-default" type="button">搜索</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<div class="am-g">
|
|
||||||
<div class="am-u-sm-12 am-scrollable-horizontal">
|
|
||||||
<!-- padding:1px 2px 3px 4px;上、右、下,和左 -->
|
|
||||||
<table class="am-table am-table-striped am-table-hover table-main">
|
|
||||||
<thead>
|
|
||||||
<tr class="am-text-nowrap">
|
|
||||||
<th class="table-check">
|
|
||||||
<input type="checkbox" id="allCheck"></th>
|
|
||||||
<th class="table-title">id</th>
|
|
||||||
<th class="table-title">脚本名称</th>
|
|
||||||
<th class="table-title">脚本所在类</th>
|
|
||||||
<th class="table-date">脚本方法</th>
|
|
||||||
<th class="table-date">创建日期</th>
|
|
||||||
<th class="table-date">最后更新日期</th>
|
|
||||||
<th class="table-set am-text-center">操作</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<#if (pager.list)?exists>
|
|
||||||
<#list pager.list as list>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="ids" value="${list.id}"/>
|
|
||||||
</td>
|
|
||||||
<td>${list.id!}</td>
|
|
||||||
<td>${list.scriptName!}</td>
|
|
||||||
<td>${list.className!}</td>
|
|
||||||
<td>${list.classMethod!}</td>
|
|
||||||
<td><#if list.createdTime??>${list.createdTime?datetime}</#if></td>
|
|
||||||
<td><#if list.lastUpdatedTime??>${list.lastUpdatedTime?datetime}</#if></td>
|
|
||||||
<td>
|
|
||||||
<div class="am-btn-toolbar">
|
|
||||||
<div class="am-btn-group am-btn-group-xs">
|
|
||||||
<button type="button"
|
|
||||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
|
||||||
onclick="location.href='${base}/actScript/edit?id=${list.id}'"><span
|
|
||||||
class="am-icon-pencil-square-o"></span>编辑
|
|
||||||
</button>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</#list>
|
|
||||||
</#if>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<div class="am-cf">
|
|
||||||
<!-- 分页 -->
|
|
||||||
<#if (pager.list)?exists && (pager.list?size>0) >
|
|
||||||
<div class="am-fr">
|
|
||||||
<#include "../common/common_pager.ftl">
|
|
||||||
</div>
|
|
||||||
<#else>
|
|
||||||
<div class="am-kai" align="center">
|
|
||||||
<h3>没有找到任何记录!</h3>
|
|
||||||
</div>
|
|
||||||
</#if>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</@defaultLayout.layout>
|
|
||||||
|
|
||||||
<script src="${base}/assets/js/amazeui.switch.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var urlBase = "${base}";
|
|
||||||
var url;
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
/*表单提交 start*/
|
|
||||||
var keywordsObj = {};
|
|
||||||
$("#searchButton").on("click", function () {
|
|
||||||
if ($("#name").val()) {
|
|
||||||
keywordsObj.name = $("#name").val();
|
|
||||||
}
|
|
||||||
var keywords = "";
|
|
||||||
if (!$.isEmptyObject(keywordsObj)) {
|
|
||||||
keywords = JSON.stringify(keywordsObj);
|
|
||||||
}
|
|
||||||
console.log("keywords = " + keywords);
|
|
||||||
$("#keywords").val(keywords);
|
|
||||||
$("#list-form").submit();
|
|
||||||
});
|
|
||||||
/*表单提交 end*/
|
|
||||||
|
|
||||||
/*复选框全选效果 start*/
|
|
||||||
$("body").on('click', '.list-item', function () {
|
|
||||||
$(".list-item").removeClass("tr-selected");
|
|
||||||
$(this).addClass('tr-selected');
|
|
||||||
});
|
|
||||||
$("#allCheck").click(function () {
|
|
||||||
$('input[name="ids"]').prop("checked", this.checked);
|
|
||||||
$("#deleteButton").prop("disabled", $("input[name='ids']:checked").length == 0 ? true : false);
|
|
||||||
});
|
|
||||||
var $citySubBox = $("input[name='ids']");
|
|
||||||
$citySubBox.click(function () {
|
|
||||||
$("#allCheckCity").prop("checked", $citySubBox.length == $("input[name='ids']:checked").length ? true : false);
|
|
||||||
$("#deleteButton").prop("disabled", $("input[name='ids']:checked").length == 0 ? true : false);
|
|
||||||
});
|
|
||||||
/*复选框全选效果 end*/
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/*批量删除 start*/
|
|
||||||
var deleteAll = function (url) {
|
|
||||||
var $deleteButton = $("#deleteButton");// 删除按钮
|
|
||||||
var ids = "";
|
|
||||||
$("input[name='ids']:checked").each(function () {
|
|
||||||
ids += $(this).val() + "#%#";
|
|
||||||
});
|
|
||||||
var params = {ids: ids};
|
|
||||||
if (window.confirm('确定要删除吗?')) {
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
data: params,
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
beforeSend: function (data) {
|
|
||||||
$deleteButton.prop("disabled", true)
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
$deleteButton.prop("disabled", false)
|
|
||||||
if (data.status == 0) {
|
|
||||||
alert(data.msg);
|
|
||||||
window.location.href = window.location.href;
|
|
||||||
} else if (data.status == 1) {
|
|
||||||
alert(data.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*批量删除 end*/
|
|
||||||
|
|
||||||
|
|
||||||
var deploy = function (id) {
|
|
||||||
var params = {id: id};
|
|
||||||
$.ajax({
|
|
||||||
url: '${base}/actScript/deploy',
|
|
||||||
data: params,
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
success: function (data) {
|
|
||||||
layer.msg(data.msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -17,109 +17,74 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="am-text-nowrap">
|
<tr class="am-text-nowrap">
|
||||||
<th class="table-title">序号</th>
|
<th class="table-title">序号</th>
|
||||||
<th class="table-title">任务名称</th>
|
<th class="table-title">任务节点名称</th>
|
||||||
<#--<th class="table-title">任务类型</th>-->
|
<th class="table-date">回退任务节点</th>
|
||||||
<th class="table-date">回退任务</th>
|
|
||||||
<th class="table-set ">按人员设置审批人</th>
|
<th class="table-set ">按人员设置审批人</th>
|
||||||
<th class="table-set ">按角色设置审批人</th>
|
<th class="table-set ">按角色设置审批人</th>
|
||||||
<th class="table-set ">审批通过脚本</th>
|
|
||||||
<th class="table-set ">审批驳回脚本</th>
|
|
||||||
<th class="table-set am-text-center">操作</th>
|
<th class="table-set am-text-center">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<#list taskList as list>
|
<#list approveList as list>
|
||||||
<tr>
|
<tr>
|
||||||
<td>${list_index+1}</td>
|
<td>${list_index+1}</td>
|
||||||
<td>${list.taskName!}</td>
|
<td>${list.taskName!}</td>
|
||||||
<#--<td>
|
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<#if list.taskType == 0>
|
|
||||||
或签
|
|
||||||
<#else>
|
|
||||||
会签
|
|
||||||
</#if>
|
|
||||||
</#if>
|
|
||||||
</td>-->
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<select data-am-selected="{btnSize: 'sm',btnWidth: '150px', maxHeight: 500}"
|
<select data-am-selected="{btnSize: 'sm',btnWidth: '150px', maxHeight: 500}"
|
||||||
id="rollbackTask_${list.id}">
|
id="rollbackTask_${list.id}">
|
||||||
<#list taskList as l>
|
<#list taskList as l>
|
||||||
<option value="${l.taskKey}"
|
<option value="${l.taskKey}"
|
||||||
<#if list.rollbackTaskKey == l.taskKey>selected</#if> >${l.taskName!}</option>
|
<#if list.rollbackTaskKey == l.taskKey>selected</#if> >${l.taskName!}</option>
|
||||||
</#list>
|
</#list>
|
||||||
</select>
|
</select>
|
||||||
</#if>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<select multiple data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
|
<select multiple
|
||||||
id="userSelect_${list.id}">
|
data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
|
||||||
<#list adminList as l>
|
id="userSelect_${list.id}">
|
||||||
<option value="${l.id}"
|
<#list adminList as l>
|
||||||
<#if list.candidateUserList?seq_contains(l.id?c)>selected</#if> >${l.realName!}</option>
|
<option value="${l.id}"
|
||||||
</#list>
|
<#if list.candidateUserList?seq_contains(l.id?c)>selected</#if> >${l.realName!}</option>
|
||||||
</select>
|
</#list>
|
||||||
</#if>
|
</select>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<select multiple data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
|
<select multiple
|
||||||
id="roleSelect_${list.id}">
|
data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500,searchBox: 1}"
|
||||||
<#list roleList as l>
|
id="roleSelect_${list.id}">
|
||||||
<option value="${l.id}"
|
<#list roleList as l>
|
||||||
<#if list.candidateRoleList?seq_contains(l.id?c)>selected</#if> >${l.name!}</option>
|
<option value="${l.id}"
|
||||||
</#list>
|
<#if list.candidateRoleList?seq_contains(l.id?c)>selected</#if> >${l.name!}</option>
|
||||||
</select>
|
</#list>
|
||||||
</#if>
|
</select>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<select data-am-selected="{btnSize: 'sm', btnWidth: '150px', maxHeight: 500, searchBox: 1}"
|
|
||||||
id="scriptSelect_${list.id}">
|
|
||||||
<option value="0"></option>
|
|
||||||
<#list scriptList as l>
|
|
||||||
<option value="${l.id}"
|
|
||||||
<#if list.endScript! == l.id>selected</#if> >${l.scriptName!}</option>
|
|
||||||
</#list>
|
|
||||||
</select>
|
|
||||||
</#if>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<#if list.taskIndex != 1>
|
|
||||||
<select data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 500, searchBox: 1}"
|
|
||||||
id="rollbackScriptSelect_${list.id}">
|
|
||||||
<option value="0"></option>
|
|
||||||
<#list scriptList as l>
|
|
||||||
<option value="${l.id}"
|
|
||||||
<#if list.rollbackScript! == l.id>selected</#if> >${l.scriptName!}</option>
|
|
||||||
</#list>
|
|
||||||
</select>
|
|
||||||
</#if>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
<div class="am-btn-toolbar">
|
||||||
<#if list.taskIndex != 1>
|
<div class="am-btn-group am-btn-group-xs">
|
||||||
<div class="am-btn-toolbar">
|
<button type="button"
|
||||||
<div class="am-btn-group am-btn-group-xs">
|
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||||
<button type="button"
|
onclick="saveConfig('${list.id}')">
|
||||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
<span class="am-icon-pencil-square-o"></span>
|
||||||
onclick="saveConfig('${list.id}')">
|
保存
|
||||||
<span class="am-icon-pencil-square-o"></span>
|
</button>
|
||||||
保存
|
|
||||||
</button>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</#if>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue