コード例 #1
0
ファイル: UserUtil.java プロジェクト: superhealth/5.2.0.RC
 public static Set<String> getUsersByWorkGroup(Set<Workgroup> workgroupSet) {
   Set<String> userNames = new HashSet<String>();
   for (Workgroup workGroup : workgroupSet) {
     userNames.addAll(
         getUserLoginName(ApiFactory.getAcsService().getUsersByWorkgroupId(workGroup.getId())));
   }
   return userNames;
 }
コード例 #2
0
 /** 新建工作组 */
 @Action("work-group-inputWorkGroup")
 public String inputWorkGroup() throws Exception {
   companyId = companyManager.getCompanyId();
   if (workGroup.getId() == null) {
     workGroup.setCode(createWorkGroupCode());
     workGroup.setSubCompanyId(branchesId);
   }
   return "work-group-input";
 }
コード例 #3
0
 private String createWorkGroupCode() {
   int num = 0;
   List<Workgroup> Workgroups = workGroupManager.getDefaultCodeWorkGroups();
   if (Workgroups != null && Workgroups.size() > 0) {
     for (Workgroup w : Workgroups) {
       String codeNum = w.getCode().replace("workgroup-", "");
       if (codeNum.matches("^-?\\d+$") && Integer.valueOf(codeNum) > num) {
         num = Integer.valueOf(codeNum);
       }
     }
   } else {
     return "workgroup-1";
   }
   return "workgroup-" + (num + 1);
 }
コード例 #4
0
 private boolean validateOnly(List<Workgroup> workgroupList, Long id) {
   boolean repeat = false;
   if (id == null) {
     if (workgroupList != null && workgroupList.size() > 0) {
       repeat = true;
     }
   } else {
     for (Workgroup w : workgroupList) {
       if (!id.equals(w.getId())) {
         repeat = true;
         break;
       }
     }
   }
   return repeat;
 }
コード例 #5
0
 @Override
 @Action("work-group-delete")
 public String delete() throws Exception {
   String logSign = ""; // 该字段只是为了标识日志信息:工作组名称
   String[] str = ides.split(",");
   for (String sid : str) {
     workGroup = workGroupManager.getWorkGroup(Long.valueOf(sid));
     workGroupManager.cleanWorkGroup(workGroup.getId());
     if (StringUtils.isNotEmpty(logSign)) {
       logSign += ",";
     }
     logSign += workGroup.getName();
     workGroupManager.deleteWorkGroup(Long.valueOf(sid));
   }
   ApiFactory.getBussinessLogService()
       .log("工作组管理", "删除工作组:" + logSign, ContextUtils.getSystemId("acs"));
   this.renderText("ok");
   return null;
 }
コード例 #6
0
  /** 保存新建工作组信息 */
  @Action("work-group-saveWorkGroup")
  public String saveWorkGroup() throws Exception {
    boolean logSign = true; // 该字段只是为了标识日志信息:true表示新建工作组、false表示修改工作组
    if (id == null) {
      Company company = companyManager.getCompany(companyId);
      workGroup.setCompany(company);
      workGroupManager.saveWorkGroup(workGroup);
    } else {
      workGroupManager.saveWorkGroup(workGroup);
      logSign = false;
    }

    if (logSign) {
      ApiFactory.getBussinessLogService()
          .log("工作组管理", "新建工作组:" + workGroup.getName(), ContextUtils.getSystemId("acs"));
    } else {
      ApiFactory.getBussinessLogService()
          .log("工作组管理", "修改工作组:" + workGroup.getName(), ContextUtils.getSystemId("acs"));
    }
    addSuccessMessage("保存成功");
    return null;
  }