コード例 #1
0
  @Override
  public String save() {
    boolean pass = false;
    StringBuffer buff = new StringBuffer("{");
    if (this.standSalary.getStandardId() == null) {
      if (this.standSalaryService.checkStandNo(this.standSalary.getStandardNo())) {
        pass = true;
      } else {
        buff.append("msg:'标准编号已存在,请重新输入.',");
      }
    } else {
      pass = true;
    }

    if (pass) {
      if (this.standSalary.getStandardId() != null) {
        this.standSalary.setModifyName(ContextUtil.getCurrentUser().getFullname());
        this.standSalary.setModifyTime(new Date());
      } else {
        this.standSalary.setSetdownTime(new Date());
        this.standSalary.setFramer(ContextUtil.getCurrentUser().getFullname());
      }
      this.standSalary.setStatus(Short.valueOf(StandSalaryAction.STATUS_DRAFT));
      if (StringUtils.isNotEmpty(this.deleteItemIds)) {
        String[] ids = this.deleteItemIds.split(",");
        for (String id : ids) {
          if (StringUtils.isNotEmpty(id)) {
            this.standSalaryItemService.remove(new Long(id));
          }
        }
      }
      this.standSalaryService.save(this.standSalary);
      if (StringUtils.isNotEmpty(this.data)) {
        Gson gson = new Gson();
        StandSalaryItem[] standSalaryItems =
            (StandSalaryItem[])
                gson.fromJson(this.data, new TypeToken<StandSalaryItem[]>() {}.getType());
        for (StandSalaryItem standSalaryItem : standSalaryItems) {
          if (standSalaryItem.getItemId().longValue() == -1L) {
            standSalaryItem.setItemId(null);
          }
          standSalaryItem.setStandardId(this.standSalary.getStandardId());
          this.standSalaryItemService.save(standSalaryItem);
        }
      }
      buff.append("success:true}");
    } else {
      buff.append("failure:true}");
    }
    this.setJsonString(buff.toString());
    return "success";
  }
コード例 #2
0
 @Override
 public String save() {
   this.appointment.setAppUser(ContextUtil.getCurrentUser());
   this.appointmentService.save(this.appointment);
   this.setJsonString("{success:true}");
   return "success";
 }
コード例 #3
0
 public String publicList() {
   PagingBean pb = getInitPagingBean();
   String strFolderId = getRequest().getParameter("folderId");
   String path = null;
   if (StringUtils.isNotEmpty(strFolderId)) {
     Long folderId = new Long(strFolderId);
     if (folderId.longValue() > 0L) {
       path = (this.docFolderService.get(new Long(strFolderId))).getPath();
     }
   }
   List<Document> list =
       this.documentService.findByPublic(
           path, this.document, this.from, this.to, ContextUtil.getCurrentUser(), pb);
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   Gson gson =
       new GsonBuilder()
           .excludeFieldsWithoutExposeAnnotation()
           .setDateFormat("yyyy-MM-dd")
           .create();
   buff.append(gson.toJson(list, type));
   buff.append("}");
   this.jsonString = buff.toString();
   return "success";
 }
コード例 #4
0
 public String shareList() {
   PagingBean pb = getInitPagingBean();
   AppUser appUser = ContextUtil.getCurrentUser();
   Set<AppRole> appRoles = appUser.getRoles();
   Long depId = null;
   if (!appUser.getUserId().equals(AppUser.SUPER_USER)) {
     Department dep = appUser.getDepartment();
     depId = dep.getDepId();
   }
   Iterator<AppRole> it = appRoles.iterator();
   ArrayList<Long> arrayList = new ArrayList<Long>();
   while (it.hasNext()) {
     arrayList.add((it.next()).getRoleId());
   }
   List<Document> list =
       this.documentService.findByIsShared(
           this.document, this.from, this.to, appUser.getUserId(), arrayList, depId, pb);
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   Gson gson =
       new GsonBuilder()
           .excludeFieldsWithoutExposeAnnotation()
           .setDateFormat("yyyy-MM-dd")
           .create();
   buff.append(gson.toJson(list, type));
   buff.append("}");
   setJsonString(buff.toString());
   return "success";
 }
コード例 #5
0
  @Override
  public String save() {
    String fileIds = getRequest().getParameter("fileIds");
    String folderId = getRequest().getParameter("folderId");
    this.document.setSharedDepIds(this.document.getSharedDepIds());
    this.document.setSharedRoleIds(this.document.getSharedRoleIds());
    this.document.setSharedUserIds(this.document.getSharedUserIds());
    if (StringUtils.isNotEmpty(fileIds)) {
      this.document.getAttachFiles().clear();
      String[] fIds = fileIds.split(",");
      for (int i = 0; i < fIds.length; i++) {
        FileAttach fileAttach = this.fileAttachService.get(new Long(fIds[i]));
        this.document.getAttachFiles().add(fileAttach);
      }
    }

    if ((StringUtils.isNotEmpty(folderId)) && (!"0".equals(folderId))) {
      DocFolder folder = this.docFolderService.get(new Long(folderId));
      this.document.setDocFolder(folder);
    }
    if (this.document.getDocId() == null) {
      AppUser appUser = ContextUtil.getCurrentUser();
      this.document.setAppUser(appUser);
      this.document.setFullname(appUser.getFullname());
      this.document.setCreatetime(new Date());
      this.document.setUpdatetime(new Date());
      this.document.setIsShared(Document.NOT_SHARED);

      if (this.document.getAttachFiles().size() > 0)
        this.document.setHaveAttach(Document.HAVE_ATTACH);
      else {
        this.document.setHaveAttach(Document.NOT_HAVE_ATTACH);
      }
      this.documentService.save(this.document);
    } else {
      Document doc = this.documentService.get(this.document.getDocId());
      doc.setUpdatetime(new Date());
      doc.setDocName(this.document.getDocName());
      doc.setContent(this.document.getContent());
      doc.setAttachFiles(this.document.getAttachFiles());
      if (this.document.getAttachFiles().size() > 0) doc.setHaveAttach(Document.HAVE_ATTACH);
      else {
        doc.setHaveAttach(Document.NOT_HAVE_ATTACH);
      }
      this.documentService.save(doc);
    }
    setJsonString("{success:true}");
    return "success";
  }
コード例 #6
0
  public String check() {
    String status = this.getRequest().getParameter("status");
    StandSalary checkStandard = this.standSalaryService.get(this.standSalary.getStandardId());
    checkStandard.setCheckName(ContextUtil.getCurrentUser().getFullname());
    checkStandard.setCheckTime(new Date());
    checkStandard.setCheckOpinion(this.standSalary.getCheckOpinion());
    if ((StringUtils.isNotEmpty(status))
        && (Short.valueOf(status).shortValue() == StandSalaryAction.STATUS_PASS)) {
      checkStandard.setStatus(Short.valueOf(StandSalaryAction.STATUS_PASS));
    } else {
      checkStandard.setStatus(Short.valueOf(StandSalaryAction.STATUS_NOT_PASS));
    }
    this.standSalaryService.save(checkStandard);

    return "success";
  }
コード例 #7
0
 public String search() {
   PagingBean pb = getInitPagingBean();
   String content = getRequest().getParameter("content");
   AppUser appUser = ContextUtil.getCurrentUser();
   List<Document> list = this.documentService.searchDocument(appUser, content, pb);
   Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
   Type type = new TypeToken<List<Document>>() {}.getType();
   StringBuffer buff =
       new StringBuffer("{success:true,'totalCounts':")
           .append(pb.getTotalItems())
           .append(",result:");
   buff.append(gson.toJson(list, type));
   buff.append("}");
   this.jsonString = buff.toString();
   return "success";
 }
コード例 #8
0
  public String right() {
    String strDocId = getRequest().getParameter("docId");
    Integer right = Integer.valueOf(0);
    Document document = new Document();
    AppUser appUser = ContextUtil.getCurrentUser();
    if (StringUtils.isNotEmpty(strDocId)) {
      Long docId = new Long(strDocId);
      right = this.docPrivilegeService.getRightsByDocument(appUser, docId);
      document = this.documentService.get(docId);
    }
    Integer rightD = Integer.valueOf(0);
    Integer rightM = Integer.valueOf(0);
    String strRight = Integer.toBinaryString(right.intValue());
    char[] cc = strRight.toCharArray();
    if ((cc.length == 2) && (cc[0] == '1')) {
      rightM = Integer.valueOf(1);
    }

    if (cc.length == 3) {
      if (cc[0] == '1') {
        rightD = Integer.valueOf(1);
      }
      if (cc[1] == '1') {
        rightM = Integer.valueOf(1);
      }
    }

    setJsonString(
        "{success:true,rightM:'"
            + rightM
            + "',rightD:'"
            + rightD
            + "',docName:'"
            + document.getDocName()
            + "'}");
    return "success";
  }