本文整理汇总了Java中me.kafeitu.activiti.chapter6.util.UserUtil类的典型用法代码示例。如果您正苦于以下问题:Java UserUtil类的具体用法?Java UserUtil怎么用?Java UserUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserUtil类属于me.kafeitu.activiti.chapter6.util包,在下文中一共展示了UserUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCandidates
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 添加候选人
*/
@RequestMapping("task/candidate/add/{taskId}")
@ResponseBody
public String addCandidates(@PathVariable("taskId") String taskId, @RequestParam("userOrGroupIds[]") String[] userOrGroupIds,
@RequestParam("type[]") String[] types, HttpServletRequest request) {
// 设置当前操作人,对于调用活动可以获取到当前操作人
String currentUserId = UserUtil.getUserFromSession(request.getSession()).getId();
identityService.setAuthenticatedUserId(currentUserId);
for (int i = 0; i < userOrGroupIds.length; i++) {
String type = types[i];
if (StringUtils.equals("user", type)) {
taskService.addCandidateUser(taskId, userOrGroupIds[i]);
} else if (StringUtils.equals("group", type)) {
taskService.addCandidateGroup(taskId, userOrGroupIds[i]);
}
}
return "success";
}
示例2: newFile
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 文件类型的附件
*/
@RequestMapping(value = "new/file")
public String newFile(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
@RequestParam("attachmentName") String attachmentName, @RequestParam(value = "attachmentDescription", required = false) String attachmentDescription,
@RequestParam("file") MultipartFile file, HttpSession session) {
try {
String attachmentType = file.getContentType() + ";" + FilenameUtils.getExtension(file.getOriginalFilename());
identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
Attachment attachment = taskService.createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription,
file.getInputStream());
taskService.saveAttachment(attachment);
} catch (IOException e) {
e.printStackTrace();
}
return "redirect:/chapter6/task/getform/" + taskId;
}
示例3: todoTasks
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 读取启动流程的表单字段
*/
@RequestMapping(value = "task/list")
public ModelAndView todoTasks(HttpSession session) throws Exception {
String viewName = "chapter6/task-list";
ModelAndView mav = new ModelAndView(viewName);
User user = UserUtil.getUserFromSession(session);
/*// 读取直接分配给当前人或者已经签收的任务
List<Task> doingTasks = taskService.createTaskQuery().taskAssignee(user.getId()).list();
// 等待签收的任务
List<Task> waitingClaimTasks = taskService.createTaskQuery().taskCandidateUser(user.getId()).list();
// 合并两种任务
List<Task> allTasks = new ArrayList<Task>();
allTasks.addAll(doingTasks);
allTasks.addAll(waitingClaimTasks);*/
// 5.16版本可以使用一下代码待办查询
List<Task> tasks = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).list();
mav.addObject("tasks", tasks);
return mav;
}
示例4: todoTasks
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 读取启动流程的表单字段
*/
@RequestMapping(value = "task/list")
public ModelAndView todoTasks(HttpSession session) throws Exception {
String viewName = "chapter6/task-list";
ModelAndView mav = new ModelAndView(viewName);
User user = UserUtil.getUserFromSession(session);
/*// 读取直接分配给当前人或者已经签收的任务
List<Task> doingTasks = taskService.createTaskQuery().taskAssignee(user.getId()).list();
// 等待签收的任务
List<Task> waitingClaimTasks = taskService.createTaskQuery().taskCandidateUser(user.getId()).list();
// 合并两种任务
List<Task> allTasks = new ArrayList<Task>();
allTasks.addAll(doingTasks);
allTasks.addAll(waitingClaimTasks);*/
// 5.16版本可以使用一下代码待办查询
List<Task> allTasks = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).list();
mav.addObject("tasks", allTasks);
return mav;
}
示例5: taskList
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 任务列表
*
* @param leave
*/
@RequestMapping(value = "task/list")
public ModelAndView taskList(HttpSession session) {
ModelAndView mav = new ModelAndView("/chapter7/leave/leave-task-list");
String userId = UserUtil.getUserFromSession(session).getId();
List<Leave> results = leaveService.findTodoTasks(userId);
mav.addObject("records", results);
return mav;
}
示例6: claim
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 签收任务
*/
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, @RequestParam(value = "nextDo", required = false) String nextDo, HttpSession session,
RedirectAttributes redirectAttributes) {
String userId = UserUtil.getUserFromSession(session).getId();
taskService.claim(taskId, userId);
redirectAttributes.addFlashAttribute("message", "任务已签收");
if (StringUtils.equals(nextDo, "handle")) {
return "redirect:/chapter6/task/getform/" + taskId;
} else {
return TASK_LIST;
}
}
示例7: addComment
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 保存意见
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Boolean addComment(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
@RequestParam("message") String message, HttpSession session) {
identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
taskService.addComment(taskId, processInstanceId, message);
return true;
}
示例8: addSubTask
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 添加子任务
*/
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
@RequestParam(value = "description", required = false) String description, HttpSession session) {
Task newTask = taskService.newTask();
newTask.setParentTaskId(parentTaskId);
String userId = UserUtil.getUserFromSession(session).getId();
newTask.setOwner(userId);
newTask.setAssignee(userId);
newTask.setName(taskName);
newTask.setDescription(description);
taskService.saveTask(newTask);
return "redirect:/chapter6/task/getform/" + parentTaskId;
}
示例9: deleteSubTask
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 删除子任务
*/
@RequestMapping("task/delete/{taskId}")
public String deleteSubTask(@PathVariable("taskId") String taskId, HttpSession session) {
String userId = UserUtil.getUserFromSession(session).getId();
taskService.deleteTask(taskId, "deleteByUser" + userId);
return "redirect:/chapter6/task/archived/" + taskId;
}
示例10: logon
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 登录系统
*
* @param userName
* @param password
* @param session
* @return
*/
@RequestMapping(value = "/logon")
public String logon(@RequestParam("username") String userName, @RequestParam("password") String password, HttpSession session) {
logger.debug("logon request: {username={}, password={}}", userName, password);
boolean checkPassword = identityService.checkPassword(userName, password);
if (checkPassword) {
// 查看用户是否存在
User user = identityService.createUserQuery().userId(userName).singleResult();
UserUtil.saveUserToSession(session, user);
/*
* 读取角色
*/
List<Group> groupList = identityService.createGroupQuery().groupMember(user.getId()).list();
session.setAttribute("groups", groupList);
String[] groupNames = new String[groupList.size()];
for (int i = 0; i < groupNames.length; i++) {
groupNames[i] = groupList.get(i).getName();
}
session.setAttribute("groupNames", ArrayUtils.toString(groupNames));
return "redirect:/main/index";
} else {
return "redirect:/login.jsp?error=true";
}
}
示例11: addComment
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 保存意见
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Boolean addComment(@RequestParam("taskId") String taskId, @RequestParam("processInstanceId") String processInstanceId,
@RequestParam("message") String message, HttpSession session) {
identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
taskService.addComment(taskId, processInstanceId, message);
return true;
}
示例12: claim
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 签收任务
*/
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, HttpSession session, RedirectAttributes redirectAttributes) {
String userId = UserUtil.getUserFromSession(session).getId();
taskService.claim(taskId, userId);
redirectAttributes.addFlashAttribute("message", "任务已签收");
return "redirect:/chapter7/leave/task/list";
}
示例13: newUrl
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* URL类型的附件
*/
@RequestMapping(value = "new/url")
public String newUrl(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
@RequestParam("attachmentName") String attachmentName, @RequestParam(value = "attachmentDescription", required = false) String attachmentDescription,
@RequestParam("url") String url, HttpSession session) {
String attachmentType = "url";
identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
/*Attachment attachment = */
taskService.createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, url);
/*
* 如果要更新附件内容,先读取附件对象,然后设置属性(只能更新name和description),最后保存附件对象
*/
// taskService.saveAttachment(attachment);
return "redirect:/chapter6/task/getform/" + taskId;
}
示例14: addParticipants
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 添加参与人
*/
@RequestMapping("task/participant/add/{taskId}")
@ResponseBody
public String addParticipants(@PathVariable("taskId") String taskId, @RequestParam("userId[]") String[] userIds, @RequestParam("type[]") String[] types,
HttpServletRequest request) {
// 设置当前操作人,对于调用活动可以获取到当前操作人
String currentUserId = UserUtil.getUserFromSession(request.getSession()).getId();
identityService.setAuthenticatedUserId(currentUserId);
for (int i = 0; i < userIds.length; i++) {
taskService.addUserIdentityLink(taskId, userIds[i], types[i]);
}
return "success";
}
示例15: claim
import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
* 签收任务
*/
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, HttpSession session, RedirectAttributes redirectAttributes) {
String userId = UserUtil.getUserFromSession(session).getId();
taskService.claim(taskId, userId);
redirectAttributes.addFlashAttribute("message", "任务已签收");
return TASK_LIST;
}