@SuppressWarnings("unchecked")
  @Action(value = "listStatusTypeAction")
  public String listStatusType() {
    response.setContentType("text/xml");
    response.setHeader("Cache-Control", "no-cache");
    String parentCode = StringUtil.getNotNullValueString(request.getParameter("parentid"));
    String type = StringUtil.getNotNullValueString(request.getParameter("type"));
    List list = new ArrayList();
    // 判断此处是找TListStatusType的第一层节点,还是去找TListStatus的子节点
    Boolean firstLevel = tlssSerivce.findChildRecord(parentCode);
    Boolean otherLevel = tlssSerivce.Exist(parentCode);
    if (!firstLevel) {
      if (!otherLevel) {
        list = tlstsService.findAll(type);
      } else {
        list = tlssSerivce.findTListStatusByRefId(parentCode);
      }

    } else {
      list = tlssSerivce.findTListStatusByCode(parentCode);
    }

    Iterator iter = list.iterator();
    TListStatusType tempListStatusType = null;
    TListStatus tempListStatus = null;
    String temps = "";

    while (iter.hasNext()) {
      if (!firstLevel) {
        if (!otherLevel) {
          tempListStatusType = (TListStatusType) iter.next();

          String tmpVal =
              tempListStatusType.getCode()
                  + splitExp
                  + tempListStatusType.getName()
                  + splitExp
                  + tempListStatusType.getMemo()
                  + splitExp
                  + ""
                  + splitExp
                  + firstLevel.toString()
                  + splitExp
                  + otherLevel.toString()
                  + splitExp
                  + "root"
                  + "@|@";
          temps += tmpVal;
        } else {
          tempListStatus = (TListStatus) iter.next();
          String tmpVal =
              tempListStatus.getSid()
                  + splitExp
                  + tempListStatus.getContent()
                  + splitExp
                  + tempListStatus.getMemo()
                  + splitExp
                  + tempListStatus.getOptorder()
                  + splitExp
                  + firstLevel.toString()
                  + splitExp
                  + otherLevel.toString()
                  + splitExp
                  + "child"
                  + "@|@";
          temps += tmpVal;
        }
      } else {
        tempListStatus = (TListStatus) iter.next();
        String tmpVal =
            tempListStatus.getSid()
                + splitExp
                + tempListStatus.getContent()
                + splitExp
                + tempListStatus.getMemo()
                + splitExp
                + tempListStatus.getOptorder()
                + splitExp
                + firstLevel.toString()
                + splitExp
                + otherLevel.toString()
                + splitExp
                + "child1"
                + "@|@";
        temps += tmpVal;
      }
    }

    // String last_xml = xml;
    // System.out.println("==========" +temps + "============");
    Writer w = null;
    try {
      response.setCharacterEncoding("UTF-8");
      w = response.getWriter();
      w.write(temps);
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      try {
        if (w != null) w.flush();
        if (w != null) w.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    return null;
  }
  @Action(value = "saveChildDict")
  public String saveChildDict() {
    String xh = StringUtil.getNotNullValueString(request.getParameter("xh"));
    String name = StringUtil.getNotNullValueString(request.getParameter("name"));
    String memo = StringUtil.getNotNullValueString(request.getParameter("memo"));
    String sid = StringUtil.getNotNullValueString(request.getParameter("sid"));
    String belongKindCode = request.getParameter("belongKindCode");
    Date date = null;
    Calendar cl = Calendar.getInstance();
    cl.setTime(new java.util.Date());
    date = cl.getTime();
    SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateTime = time.format(date); // 系统日期
    // 保存子科目

    if (tlstsService.ExistSameChildDict(name)) {
      TListStatus tls = new TListStatus();
      tls.setContent(name);
      if (!xh.equals("")) {
        tls.setOptorder(Integer.parseInt(xh));
      } else {
      }
      tls.setMemo(memo);
      tls.setState("1");
      tls.setUptdate(dateTime);
      tls.setInfotype(tlstsService.findTListStatusTypeByCode(belongKindCode));
      if (!sid.equals("")) {
        tls.setRefsid((TListStatus) tlssSerivce.findTListStatusBySID(sid).get(0));
      }
      tlssSerivce.saveChildListStatus(tls);
    } else {
      TListStatus tls = new TListStatus();
      tls.setContent(name);
      if (!xh.equals("")) {
        tls.setOptorder(Integer.parseInt(xh));
      } else {
      }
      tls.setMemo(memo);
      tls.setState("1");
      tls.setUptdate(dateTime);
      tls.setInfotype(tlstsService.findTListStatusTypeByCode(belongKindCode));
      if (!sid.equals("")) {
        tls.setRefsid((TListStatus) tlssSerivce.findTListStatusBySID(sid).get(0));
      }
      tlssSerivce.saveChildListStatus(tls);
      // 同样在T_LIST_TYPE中也要保存字典项,如果belongKindCode为JS_UnitType
      if (belongKindCode.equals("JS_UnitType")) {
        TListStatusType tlst = new TListStatusType();
        tlst.setCode("JS_" + name);
        tlst.setName(name + "字典项");
        tlst.setUptdate(getCurrentTime());
        tlst.setState("1");
        tlst.setMemo(memo);
        tlstsService.saveFaDict(tlst);
      }
    }

    return null;
  }