예제 #1
0
  // @RequiresPermissions("sys:user:view")
  @RequestMapping
  public String index(
      PgTaskList pgTaskList,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model) {
    model.addAttribute("site", site);

    Page<PgTaskList> pgPage =
        pgTaskListService.findPage(new Page<PgTaskList>(request, response), pgTaskList);
    List<PgTaskList> pgTaskListList = pgPage.getList();

    Task task = null;
    List<Task> taskList = new ArrayList<Task>();
    if (null != pgTaskListList && pgTaskListList.size() > 0) {
      for (PgTaskList t : pgTaskListList) {
        task = new Task();
        String uuid = t.getQuestionId();
        // 0:线上任务,1:线下任务
        if (t.getTaskType().equals("0")) {
          PgOnlineQuestion online = pgOnlineQuestionService.get(uuid);
          task.setQuestionId(online.getId());
          task.setName(online.getQuestion());
          task.setType("0");
        } else if (t.getTaskType().equals("1")) {
          PgOfflineQuestion offline = pgOfflineQuestionService.get(uuid);
          task.setQuestionId(offline.getId());
          task.setName(offline.getOfflineTask());
          task.setType("1");
        }
        task.setId(t.getId());
        task.setCreateDate(t.getCreateDate());
        // task.setUserName(systemService.getUser(t.getCreateBy().getId()).getName());
        taskList.add(task);
      }
      Page<Task> page =
          pgTaskListService.findPage(new Page<Task>(request, response), task, taskList);
      model.addAttribute("page", page);
    }

    return "modules/cms/front/themes/" + site.getTheme() + "/taskList";
  }
예제 #2
0
  /**
   * 我接受的任务列表
   *
   * @param taskType
   * @param request
   * @param response
   * @param model
   * @return
   */
  @RequestMapping(value = "list-{taskType}${urlSuffix}")
  public String taskList(
      @PathVariable String taskType,
      PgOnlineTask pgOnlineTask,
      PgOfflineTask pgOfflineTask,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model) {
    model.addAttribute("site", site);
    // 0:线上任务,1:线下任务
    Page p = null;
    Task task = null;
    List<Task> taskList = new ArrayList<Task>();

    // 0:线上任务
    if (taskType.equals("0") || taskType.equals("all")) {
      pgOnlineTask.setUser(UserUtils.getUser());
      p = pgOnlineTaskService.findPage(new Page<PgOnlineTask>(request, response), pgOnlineTask);
      List<PgOnlineTask> list = p.getList();
      if (null != list && list.size() > 0) {
        for (PgOnlineTask on : list) {
          PgOnlineQuestion onlineQuestion =
              pgOnlineQuestionService.get(pgTaskListService.get(on.getTaskId()).getQuestionId());
          String id = on.getTaskId(); // 任务ID
          String questionId = onlineQuestion.getId();
          String name = onlineQuestion.getQuestion();
          String type = "0";
          String status = on.getOnlineTaskStatus();
          String time = DateUtils.formatDateTime(on.getCreateDate());
          String userName = UserUtils.getUser().getName();
          task = new Task(id, questionId, name, type, status, time, userName);
          taskList.add(task);
        }
      }
    }
    // 1:线下任务
    if (taskType.equals("1") || taskType.equals("all")) {
      pgOfflineTask.setUser(UserUtils.getUser());
      p = pgOfflineTaskService.findPage(new Page<PgOfflineTask>(request, response), pgOfflineTask);
      List<PgOfflineTask> list = p.getList();
      if (null != list && list.size() > 0) {
        for (PgOfflineTask off : list) {
          PgOfflineQuestion offlineQuestion =
              pgOfflineQuestionService.get(pgTaskListService.get(off.getTaskId()).getQuestionId());
          // public Task(String questionId,String name,String type,String time)
          String id = off.getTaskId();
          String questionId = offlineQuestion.getId();
          String name = offlineQuestion.getOfflineTask();
          String type = "1";
          String status = off.getOfflineStatus();
          String time = DateUtils.formatDateTime(off.getCreateDate());
          String userName = UserUtils.getUser().getName();
          task = new Task(id, questionId, name, type, status, time, userName);
          taskList.add(task);
        }
      }
    }
    if (taskList.size() != 0) {
      Page<Task> page =
          pgTaskListService.findPage(new Page<Task>(request, response), task, taskList);
      model.addAttribute("page", page);
    }
    return "modules/cms/front/themes/" + site.getTheme() + "/myTaskList";
  }