예제 #1
0
 // 新建word/excel
 @Action("office-createOffice")
 public String createOffice() throws Exception {
   WorkflowInstance instance = null;
   WorkflowTask task = null;
   if (id == null) {
     task = ApiFactory.getTaskService().getTask(taskId);
     instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     document.setTaskName(task.getName());
     document.setTaskMode(task.getProcessingMode());
     document.setWorkflowId(instance.getProcessInstanceId());
     document.setCreator(ContextUtils.getLoginName());
     document.setCreatorName(ContextUtils.getUserName());
     document.setCompanyId(ContextUtils.getCompanyId());
     document.setEditType("-1,0,0,0,0,0,1,1"); // 允许编辑,不显示和保留痕迹,允许批注
     document.setPrintSetting(true);
     document.setDownloadSetting(true);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       String template =
           DefinitionXmlParse.getOfficialTextTemplate(
               instance.getProcessDefinitionId(), task.getName());
       if (StringUtils.isNotEmpty(template))
         document.setTemplateId(Long.valueOf(StringUtils.substringBetween(template, "[", "]")));
       setOfficeRight(document, instance, task);
       return "office-view";
     }
   } else {
     if (taskId == null) {
       instance = workflowInstanceManager.getWorkflowInstance(document.getWorkflowId());
       task = ApiFactory.getTaskService().getTask(instance.getFirstTaskId());
     } else {
       task = ApiFactory.getTaskService().getTask(taskId);
       instance = workflowInstanceManager.getWorkflowInstance(task.getProcessInstanceId());
     }
     setOfficeRight(document, instance, task);
     if (document.getFileType().equalsIgnoreCase("pdf")) {
       return "office-pdf";
     } else {
       return "office-view";
     }
   }
 }
예제 #2
0
 public void swingInform(WorkflowTask task) throws Exception {
   String msg =
       new StringBuilder("任务:")
           .append(task.getTitle())
           .append("的办理人")
           .append(task.getTransactorName())
           .append("被催办次数已经超过设置上限,请您核实情况。")
           .toString();
   if (StringUtils.isNotEmpty(task.getReminderNoticeUser())) {
     for (String userLoginName : task.getReminderNoticeUser().split(",")) {
       ApiFactory.getPortalService()
           .addMessage(
               "task",
               "系统管理员",
               ContextUtils.getLoginName(),
               userLoginName,
               "催办超期提醒",
               msg,
               "/task/message-task.htm?id=" + task.getId());
     }
   }
 }
예제 #3
0
 public void swingReminder(WorkflowTask task) throws Exception {
   if (StringUtils.isNotEmpty(task.getTransactor())) {
     String msg =
         new StringBuilder("(")
             .append(
                 new SimpleDateFormat("yyyy-MM-dd").format(new Date(System.currentTimeMillis())))
             .append(")任务:")
             .append(task.getTitle())
             .append("已经生成")
             .append(
                 ((System.currentTimeMillis() - task.getCreatedTime().getTime()) / MILLI_SECOND))
             .append("天了。请尽快办理!")
             .toString();
     ApiFactory.getPortalService()
         .addMessage(
             "task",
             "系统管理员",
             ContextUtils.getLoginName(),
             task.getTransactor(),
             "待办任务催办提醒",
             msg,
             "/task/message-task.htm?id=" + task.getId());
   }
 }
예제 #4
0
 public String getCurrentUserLonginName() {
   currentUserLonginName = ContextUtils.getLoginName();
   return currentUserLonginName;
 }
예제 #5
0
 public String getCurrentUser() {
   return ContextUtils.getLoginName();
 }