コード例 #1
0
  /**
   * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLECRecommendation>历史记账凭证主表信息</A>表字段
   *
   * @param: strMessage String 包含一条纪录数据的字符串
   * @return: boolean
   */
  public boolean decode(String strMessage) {
    try {
      recommend = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER);
      recommended = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER);
      sendtimes =
          new Integer(ChgData.chgNumericStr(StrTool.getStr(strMessage, 3, SysConst.PACKAGESPILTER)))
              .intValue();
      success = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER);
      registered = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER);
      field1 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 6, SysConst.PACKAGESPILTER);
      field2 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 7, SysConst.PACKAGESPILTER);
      field3 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 8, SysConst.PACKAGESPILTER);
      makedate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 9, SysConst.PACKAGESPILTER);
      maketime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 10, SysConst.PACKAGESPILTER);
      modifydate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 11, SysConst.PACKAGESPILTER);
      modifytime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 12, SysConst.PACKAGESPILTER);
    } catch (NumberFormatException ex) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LECRecommendationSchema";
      tError.functionName = "decode";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      return false;
    }
    return true;
  }
コード例 #2
0
 /**
  * 数据打包,按 XML 格式打包,顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLECRecommendation描述/A>表字段
  *
  * @return: String 返回打包后字符串
  */
 public String encode() {
   StringBuffer strReturn = new StringBuffer(256);
   strReturn.append(StrTool.cTrim(recommend));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(recommended));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(ChgData.chgData(sendtimes));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(success));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(registered));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(field1));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(field2));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(field3));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(makedate));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(maketime));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(modifydate));
   strReturn.append(SysConst.PACKAGESPILTER);
   strReturn.append(StrTool.cTrim(modifytime));
   return strReturn.toString();
 }