Пример #1
0
  @RequestMapping("user-status-save")
  public String save(
      @ModelAttribute UserStatus userStatus,
      @RequestParam("confirmPassword") String confirmPassword,
      RedirectAttributes redirectAttributes) {
    try {
      userStatusChecker.check(userStatus);

      if (userStatus.getPassword() != null) {
        if (!userStatus.getPassword().equals(confirmPassword)) {
          messageHelper.addFlashMessage(
              redirectAttributes, "user.user.input.passwordnotequals", "两次输入密码不符");

          return "auth/user-status-input";
        }

        if (customPasswordEncoder != null) {
          userStatus.setPassword(customPasswordEncoder.encode(userStatus.getPassword()));
        }
      }

      UserStatus dest = null;
      Long id = userStatus.getId();

      if (id != null) {
        dest = userStatusManager.get(id);
        beanMapper.copy(userStatus, dest);
      } else {
        dest = userStatus;
      }

      if (id == null) {
        dest.setUserRepoRef(ScopeHolder.getUserRepoRef());
        dest.setScopeId(ScopeHolder.getScopeId());
      }

      userStatusManager.save(dest);

      messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");
    } catch (CheckUserStatusException ex) {
      logger.warn(ex.getMessage(), ex);
      messageHelper.addFlashMessage(redirectAttributes, ex.getMessage());

      return "auth/user-status-input";
    }

    return "redirect:/auth/user-status-list.do";
  }
  @RequestMapping("sendmail-template-save")
  public String save(
      @ModelAttribute SendmailTemplate sendmailTemplate,
      @RequestParam(value = "attachmentIds", required = false) List<Long> attachmentIds,
      RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    Long id = sendmailTemplate.getId();
    SendmailTemplate dest = null;

    if (id != null) {
      dest = sendmailTemplateManager.get(id);
      beanMapper.copy(sendmailTemplate, dest);
    } else {
      dest = sendmailTemplate;
      dest.setTenantId(tenantId);
    }

    sendmailTemplateManager.save(dest);

    if (attachmentIds != null) {
      for (Long attachmentId : attachmentIds) {
        SendmailAttachment sendmailAttachment = sendmailAttachmentManager.get(attachmentId);
        sendmailAttachment.setSendmailTemplate(dest);
        sendmailAttachmentManager.save(sendmailAttachment);
      }
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/sendmail/sendmail-template-list.do";
  }
  @RequestMapping("job-type-save")
  public String save(
      @ModelAttribute JobType jobType,
      @RequestParam(value = "jobTypeId", required = false) Long jobTypeId,
      RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    JobType dest = null;
    Long id = jobType.getId();

    if (id != null) {
      dest = jobTypeManager.get(id);
      beanMapper.copy(jobType, dest);
    } else {
      dest = jobType;
      dest.setTenantId(tenantId);
    }

    if (jobTypeId != null) {
      dest.setJobType(jobTypeManager.get(jobTypeId));
    } else {
      dest.setJobType(null);
    }

    jobTypeManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/org/job-type-list.do";
  }
Пример #4
0
  @RequestMapping("admin-batch-remove")
  public String remove(
      @RequestParam("id") Long id,
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    PartyEntity group =
        partyEntityManager.findUnique(
            "from PartyEntity where partyType.id=2 and reference=?", Long.toString(id));

    for (Long userId : selectedItem) {
      PartyEntity user =
          partyEntityManager.findUnique(
              "from PartyEntity where partyType.id=1 and reference=?", Long.toString(userId));

      PartyStruct partyStruct =
          partyStructManager.findUnique(
              "from PartyStruct where partyStructType.id=2 and parentEntity=? and childEntity=?",
              group,
              user);

      if (partyStruct != null) {
        partyStructManager.remove(partyStruct);
      }
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/party/admin-batch-list.do";
  }
Пример #5
0
  @RequestMapping("admin-batch-save")
  public String save(
      @RequestParam("id") Long id,
      @RequestParam("userIds") List<Long> userIds,
      RedirectAttributes redirectAttributes) {
    PartyEntity group =
        partyEntityManager.findUnique(
            "from PartyEntity where partyType.id=2 and reference=?", Long.toString(id));

    for (Long userId : userIds) {
      PartyEntity user =
          partyEntityManager.findUnique(
              "from PartyEntity where partyType.id=1 and reference=?", Long.toString(userId));

      PartyStruct partyStruct =
          partyStructManager.findUnique(
              "from PartyStruct where partyStructType.id=2 and parentEntity=? and childEntity=?",
              group,
              user);

      if (partyStruct == null) {
        PartyStructId partyStructId = new PartyStructId(2L, group.getId(), user.getId());
        partyStruct = new PartyStruct();
        partyStruct.setId(partyStructId);
        partyStructManager.save(partyStruct);
      }
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/party/admin-batch-list.do";
  }
Пример #6
0
  @RequestMapping("role-def-save")
  public String save(@ModelAttribute RoleDef roleDef, RedirectAttributes redirectAttributes) {
    try {
      // before check
      roleDefChecker.check(roleDef);

      // after invoke
      RoleDef dest = null;
      Long id = roleDef.getId();

      if (id != null) {
        dest = roleDefManager.get(id);
        beanMapper.copy(roleDef, dest);
      } else {
        dest = roleDef;
      }

      if (id == null) {
        dest.setScopeId(ScopeHolder.getScopeId());
      }

      roleDefManager.save(dest);

      messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");
    } catch (CheckRoleException ex) {
      logger.warn(ex.getMessage(), ex);
      redirectAttributes.addFlashAttribute("message", ex.getMessage());

      return "auth/role-def-input";
    }

    return "redirect:/auth/role-def-list.do";
  }
  @RequestMapping("party-entity-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    partyEntityManager.removeAll(partyEntityManager.findByIds(selectedItem));
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/party/party-entity-list.do";
  }
  @RequestMapping("user-status-batch-input")
  public String input(
      @RequestParam(value = "userText", required = false) String userText,
      Model model,
      RedirectAttributes redirectAttributes) {
    if (userText != null) {
      List<UserStatus> userStatuses = new ArrayList<UserStatus>();

      for (String str : userText.split("\n")) {
        str = str.trim();

        if (str.length() == 0) {
          continue;
        }

        UserStatus userStatus =
            userStatusManager.findUnique(
                "from UserStatus where username=? and userRepoRef=?",
                str,
                tenantHolder.getUserRepoRef());

        if (userStatus == null) {
          messageHelper.addFlashMessage(redirectAttributes, str + " is not exists.");
        } else {
          try {
            userStatusChecker.check(userStatus);
            userStatuses.add(userStatus);
          } catch (CheckUserStatusException ex) {
            logger.warn(ex.getMessage(), ex);
            messageHelper.addFlashMessage(redirectAttributes, ex.getMessage());
          }
        }
      }

      model.addAttribute("userStatuses", userStatuses);
    }

    List<Role> roles = roleManager.find("from Role where tenantId=?", tenantHolder.getTenantId());

    model.addAttribute("roles", roles);

    return "auth/user-status-batch-input";
  }
  @RequestMapping("sendmail-template-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<SendmailTemplate> sendmailTemplates = sendmailTemplateManager.findByIds(selectedItem);
    sendmailTemplateManager.removeAll(sendmailTemplates);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/sendmail/sendmail-template-list.do";
  }
Пример #10
0
  @RequestMapping("perm-type-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<PermType> permTypes = permTypeManager.findByIds(selectedItem);
    permTypeManager.removeAll(permTypes);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/auth/perm-type-list.do";
  }
Пример #11
0
  @RequestMapping("store-info-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<StoreInfo> storeInfos = storeInfoManager.findByIds(selectedItem);
    storeInfoManager.removeAll(storeInfos);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/store/store-info-list.do";
  }
  @RequestMapping("bpm-task-def-notice-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      @RequestParam("bpmProcessId") Long bpmProcessId,
      RedirectAttributes redirectAttributes) {
    List<BpmTaskDefNotice> bpmCategories = bpmTaskDefNoticeManager.findByIds(selectedItem);
    bpmTaskDefNoticeManager.removeAll(bpmCategories);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/bpm/bpm-task-def-notice-list.do?bpmProcessId=" + bpmProcessId;
  }
Пример #13
0
  @RequestMapping("bpm-category-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<BpmCategory> bpmCategories = bpmCategoryManager.findByIds(selectedItem);
    bpmCategoryManager.removeAll(bpmCategories);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/bpm/bpm-category-list.do";
  }
Пример #14
0
  @RequestMapping("user-status-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    try {
      List<UserStatus> userStatuses = userStatusManager.findByIds(selectedItem);

      for (UserStatus userStatus : userStatuses) {
        userStatusChecker.check(userStatus);
      }

      userStatusManager.removeAll(userStatuses);
      messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");
    } catch (CheckUserStatusException ex) {
      logger.warn(ex.getMessage(), ex);
      messageHelper.addFlashMessage(redirectAttributes, ex.getMessage());
    }

    return "redirect:/auth/user-status-list.do";
  }
Пример #15
0
  @RequestMapping("role-def-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    try {
      List<RoleDef> roleDefs = roleDefManager.findByIds(selectedItem);

      for (RoleDef roleDef : roleDefs) {
        roleDefChecker.check(roleDef);
      }

      roleDefManager.removeAll(roleDefs);
      messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");
    } catch (CheckRoleException ex) {
      logger.warn(ex.getMessage(), ex);

      messageHelper.addFlashMessage(redirectAttributes, ex.getMessage());
    }

    return "redirect:/auth/role-def-list.do";
  }
  @RequestMapping("portal-widget-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<PortalWidget> portalWidgets = portalWidgetManager.findByIds(selectedItem);

    portalWidgetManager.removeAll(portalWidgets);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/portal/portal-widget-list.do";
  }
  @RequestMapping("job-type-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<JobType> jobTypes = jobTypeManager.findByIds(selectedItem);

    for (JobType jobType : jobTypes) {
      jobTypeManager.remove(jobType);
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/org/job-type-list.do";
  }
Пример #18
0
  @RequestMapping("user-status-initPassword")
  public String initPassword(
      @RequestParam("newPassword") String newPassword,
      @RequestParam("confirmPassword") String confirmPassword,
      @RequestParam("id") Long id,
      RedirectAttributes redirectAttributes) {
    if ((newPassword != null) && newPassword.equals(confirmPassword)) {
      UserStatus userStatus = userStatusManager.get(id);
      userStatus.setPassword(newPassword);
      userStatusManager.save(userStatus);
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "操作成功");

    return "redirect:/auth/user-status-password.do";
  }
Пример #19
0
  @RequestMapping("bpm-category-save")
  public String save(
      @ModelAttribute BpmCategory bpmCategory, RedirectAttributes redirectAttributes) {
    BpmCategory dest = null;
    Long id = bpmCategory.getId();

    if (id != null) {
      dest = bpmCategoryManager.get(id);
      beanMapper.copy(bpmCategory, dest);
    } else {
      dest = bpmCategory;
    }

    bpmCategoryManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/bpm/bpm-category-list.do";
  }
Пример #20
0
  @RequestMapping("store-info-save")
  public String save(@ModelAttribute StoreInfo storeInfo, RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    Long id = storeInfo.getId();
    StoreInfo dest = null;

    if (id != null) {
      dest = storeInfoManager.get(id);
      beanMapper.copy(storeInfo, dest);
    } else {
      dest = storeInfo;
      dest.setTenantId(tenantId);
    }

    storeInfoManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/store/store-info-list.do";
  }
Пример #21
0
  @RequestMapping("whitelist-type-save")
  public String save(
      @ModelAttribute WhitelistType whitelistType, RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    Long id = whitelistType.getId();
    WhitelistType dest = null;

    if (id != null) {
      dest = whitelistTypeManager.get(id);
      beanMapper.copy(whitelistType, dest);
    } else {
      dest = whitelistType;
      dest.setTenantId(tenantId);
    }

    whitelistTypeManager.save(dest);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/whitelist/whitelist-type-list.do";
  }
  @RequestMapping("portal-widget-save")
  public String save(
      @ModelAttribute PortalWidget portalWidget,
      @RequestParam Map<String, Object> parameterMap,
      RedirectAttributes redirectAttributes) {
    PortalWidget dest = null;

    Long id = portalWidget.getId();

    if (id != null) {
      dest = portalWidgetManager.get(id);
      beanMapper.copy(portalWidget, dest);
    } else {
      dest = portalWidget;
    }

    portalWidgetManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/portal/portal-widget-list.do";
  }
Пример #23
0
  @RequestMapping("perm-type-save")
  public String save(@ModelAttribute PermType permType, RedirectAttributes redirectAttributes) {
    // copy
    PermType dest = null;
    Long id = permType.getId();

    if (id != null) {
      dest = permTypeManager.get(id);
      beanMapper.copy(permType, dest);
    } else {
      dest = permType;
    }

    if (id == null) {
      dest.setTenantId(tenantHolder.getTenantId());
    }

    // save
    permTypeManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/auth/perm-type-list.do";
  }
  @RequestMapping("party-entity-save")
  public String save(
      @ModelAttribute PartyEntity partyEntity,
      @RequestParam("partyTypeId") Long partyTypeId,
      RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    PartyEntity dest = null;
    Long id = partyEntity.getId();

    if (id != null) {
      dest = partyEntityManager.get(id);
      beanMapper.copy(partyEntity, dest);
    } else {
      dest = partyEntity;
      dest.setTenantId(tenantId);
    }

    dest.setPartyType(partyTypeManager.get(partyTypeId));
    partyEntityManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/party/party-entity-list.do";
  }
  @RequestMapping("bpm-task-def-notice-save")
  public String save(
      @ModelAttribute BpmTaskDefNotice bpmTaskDefNotice,
      @RequestParam("bpmProcessId") Long bpmProcessId,
      @RequestParam("bpmMailTemplateId") Long bpmMailTemplateId,
      RedirectAttributes redirectAttributes) {
    BpmTaskDefNotice dest = null;
    Long id = bpmTaskDefNotice.getId();

    if (id != null) {
      dest = bpmTaskDefNoticeManager.get(id);
      beanMapper.copy(bpmTaskDefNotice, dest);
    } else {
      dest = bpmTaskDefNotice;
    }

    dest.setBpmProcess(bpmProcessManager.get(bpmProcessId));
    dest.setBpmMailTemplate(bpmMailTemplateManager.get(bpmMailTemplateId));
    bpmTaskDefNoticeManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/bpm/bpm-task-def-notice-list.do?bpmProcessId=" + bpmProcessId;
  }