Example #1
0
 protected String getSimpleProcessedDataSetString() {
   StringBuffer htmlDataSet = new StringBuffer();
   List<List<Object>> rows = element.getData();
   if (rows == null) return "";
   for (List<Object> row : rows) {
     StringBuffer rowData = new StringBuffer();
     rowData.append("[");
     StringBuffer rowBuffer = new StringBuffer();
     String timeColumn = "";
     for (int i = 0; i < row.size(); i++) {
       Object column = row.get(i);
       if (column == null) {
         String dataType = headerIndexToTypeMap.get(i);
         if (dataType.equalsIgnoreCase(DashboardConstants.STRING)) rowBuffer.append("'',");
         else if (dataType.equalsIgnoreCase(DashboardConstants.DATETIME)) rowBuffer.append("'',");
         else rowBuffer.append("null,");
       } else {
         String dataType = headerIndexToTypeMap.get(i);
         if (dataType.equalsIgnoreCase(DashboardConstants.STRING)) {
           rowBuffer.append("'" + column.toString() + "',");
         } else if (dataType.equalsIgnoreCase(DashboardConstants.DATETIME)) {
           try {
             Date ts = sdf.parse(column.toString());
             String timeString =
                 (ts.getYear() + 1900)
                     + ","
                     + (ts.getMonth())
                     + ","
                     + ts.getDate()
                     + ","
                     + ts.getHours()
                     + ","
                     + ts.getMinutes();
             timeColumn = "new Date(" + timeString + "),";
           } catch (ParseException e) {
             rowBuffer.append("'" + column.toString() + "',");
             e.printStackTrace();
           }
         } else rowBuffer.append(column.toString() + ",");
       }
     }
     if (timeColumn != null && !timeColumn.isEmpty()) rowData.append(timeColumn);
     rowData.append(rowBuffer.subSequence(0, rowBuffer.lastIndexOf(",")) + "],\n");
     htmlDataSet.append(rowData);
   }
   if (htmlDataSet.lastIndexOf(",") > 1)
     return htmlDataSet.subSequence(0, htmlDataSet.lastIndexOf(",")) + "\n";
   else return htmlDataSet.toString();
 }
Example #2
0
  protected String getComplexProcessedDataSetString() {
    StringBuffer htmlDataSet = new StringBuffer();
    if (timeSeriesChart) {
      Set<Long> timeStamps = timeSeries.keySet();
      for (Long timeStamp : timeStamps) {
        StringBuffer rowData = new StringBuffer();
        rowData.append("[");
        StringBuffer rowBuffer = new StringBuffer();
        Date ts = new Date(timeStamp);
        String timeString =
            (ts.getYear() + 1900)
                + ","
                + (ts.getMonth())
                + ","
                + ts.getDate()
                + ","
                + ts.getHours()
                + ","
                + ts.getMinutes();
        String timeColumn = "new Date(" + timeString + ")";
        rowBuffer.append(timeColumn + ",");

        Object rows[] = timeSeries.get(timeStamp);
        for (int i = 0; i < newHeaderToIndex.size(); i++) rowBuffer.append(rows[i] + ",");
        rowData.append(rowBuffer.subSequence(0, rowBuffer.lastIndexOf(",")) + "],\n");
        htmlDataSet.append(rowData);
      }
    } else {
      Set<String> keys = keySeries.keySet();
      for (String key : keys) {
        StringBuffer rowData = new StringBuffer();
        rowData.append("[");
        StringBuffer rowBuffer = new StringBuffer();
        rowBuffer.append("'" + key + "',");

        Object rows[] = keySeries.get(key);
        for (int i = 0; i < newHeaderToIndex.size(); i++) rowBuffer.append(rows[i] + ",");
        rowData.append(rowBuffer.subSequence(0, rowBuffer.lastIndexOf(",")) + "],\n");
        htmlDataSet.append(rowData);
      }
    }
    if (htmlDataSet.lastIndexOf(",") > 1)
      return htmlDataSet.subSequence(0, htmlDataSet.lastIndexOf(",")) + "\n";
    else return htmlDataSet.toString();
  }
Example #3
0
 protected void writePayload(
     StringBuilder builder, StringWriter stringWriter, String contentType) throws Exception {
   StringBuffer buffer = stringWriter.getBuffer();
   if (buffer.length() > lim) {
     builder.append(buffer.subSequence(0, lim));
   } else {
     builder.append(buffer);
   }
 }
Example #4
0
  /**
   * 获得URL地址:如:http://127.0.0.1:8080/
   *
   * @param request
   * @return
   */
  public static String getServiceURL(HttpServletRequest request) {
    StringBuffer url_buffer = request.getRequestURL();
    String name = request.getContextPath();

    StringBuffer url = new StringBuffer();
    url.append(url_buffer.subSequence(0, url_buffer.indexOf(name)));
    // url.append("/");
    return url.toString();
  }
Example #5
0
 public void updateMappinRelation(String roleId, Integer[] ids) {
   StringBuffer buffer = new StringBuffer();
   for (Integer id : ids) {
     buffer.append(id.intValue()).append(",");
   }
   String sql =
       "update sys_user  set role_id = '"
           + roleId
           + "' where user_id in ("
           + buffer.subSequence(0, buffer.lastIndexOf(","))
           + " )";
   this.getJdbcTemplate().execute(sql);
 }
Example #6
0
 public void deleteMappinRelation(String roleId, String[] ids) {
   StringBuffer buffer = new StringBuffer();
   for (String id : ids) {
     buffer.append(id).append(",");
   }
   String sql =
       "delete from sys_user  where user_id in ("
           + buffer.subSequence(0, buffer.lastIndexOf(","))
           + " ) and role_id ='"
           + roleId
           + "'";
   this.getJdbcTemplate().execute(sql);
 }
Example #7
0
 public void removeMappinRelation(String roleId, String[] ids) {
   StringBuffer buffer = new StringBuffer();
   String sql = "";
   if (ids != null && ids.length > 0)
     for (String id : ids) {
       buffer.append(id).append(",");
       sql =
           "update sys_user  set role_id = null where user_id in ("
               + buffer.subSequence(0, buffer.lastIndexOf(","))
               + " )";
     }
   if (buffer.toString().length() > 1) this.getJdbcTemplate().execute(sql);
 }
Example #8
0
  @RequestMapping("AuthDtlSubmit")
  public String AuthDtlSubmit(Model model, FTZ210205Form form) {
    FtzInMsgCtl query_FtzInMsgCtl = new FtzInMsgCtl();
    query_FtzInMsgCtl.setMsgId(form.getSelected_msgId());
    FtzInMsgCtl result_FtzInMsgCtl = ftz210205Serv.queryFtzInMsgCtl(query_FtzInMsgCtl);
    if (CommonConst.FTZ_MSG_STATUS_INPUTING.equals(result_FtzInMsgCtl.getMsgStatus())) {
      model.addAttribute(ResultMessages.error().add("e.ftzmis.210101.0032"));
      return "forward:/FTZ210205/QryAuthDtl";
    }
    UserInf userInfo = ContextConst.getCurrentUser();
    if (userInfo.getUserid().equals(result_FtzInMsgCtl.getMakUserId())) {
      model.addAttribute(ResultMessages.error().add("e.ftzmis.210101.0025"));
      return "forward:/FTZ210205/QryAuthDtl";
    }
    FtzInTxnDtl query_FtzInTxnDtl = new FtzInTxnDtl();
    query_FtzInTxnDtl.setMsgId(form.getSelected_msgId());
    List<FtzInTxnDtl> ftzInTxnDtls = ftz210205Serv.queryFtzInTxnDtlList(query_FtzInTxnDtl);
    if (null == ftzInTxnDtls || ftzInTxnDtls.size() < 1) {
      FtzInMsgCtl update_FtzInMsgCtl = new FtzInMsgCtl();
      update_FtzInMsgCtl.setMsgId(form.getFtzInMsgCtl().getMsgId());
      update_FtzInMsgCtl.setMsgNo(CommonConst.MSG_NO_210205);
      update_FtzInMsgCtl.setMsgStatus(CommonConst.FTZ_MSG_STATUS_AUTH_SUCC);
      update_FtzInMsgCtl.setChkUserId(userInfo.getUserid());
      update_FtzInMsgCtl.setRsv1(
          DateUtil.getFormatDateTimeRemoveSpritAndColon(form.getFtzInMsgCtl().getMakDatetime()));
      update_FtzInMsgCtl.setRsv2(
          DateUtil.getFormatDateTimeRemoveSpritAndColon(form.getFtzInMsgCtl().getChkDatetime()));
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      int i = ftz210205Serv.updateFtzInMsgCtl(update_FtzInMsgCtl, null);
      if (i < 1) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.2103.0008"));
      } else {
        model.addAttribute(ResultMessages.success().add("i.ftzmis.210301.0005"));
        form.setAuthFinishFlag("1");
        return "forward:/FTZ210205/QryAuthDtl";
      }
    } else {
      int count_unAuth = 0;
      int count_authFail = 0;
      StringBuffer sb_unAuth = new StringBuffer();
      StringBuffer sb_authFail = new StringBuffer();
      for (FtzInTxnDtl ftzInTxnDtl : ftzInTxnDtls) {
        String chkStatus = ftzInTxnDtl.getChkStatus();
        if (chkStatus.equals(CommonConst.FTZ_MSG_STATUS_INPUT_COMPLETED)) {
          count_unAuth++;
          sb_unAuth.append(ftzInTxnDtl.getSeqNo().toString() + ",");
        }
        if (chkStatus.equals(CommonConst.FTZ_MSG_STATUS_AUTH_FAIL)) {
          count_authFail++;
          sb_authFail.append(ftzInTxnDtl.getSeqNo().toString() + ",");
        }
      }
      if (count_unAuth > 0) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.210310.0012"));
        return "forward:/FTZ210205/QryAuthDtl";
      }
      if (count_authFail > 0) {
        model.addAttribute(
            ResultMessages.error()
                .add("e.ftzmis.210101.0031", sb_unAuth.subSequence(0, sb_authFail.length() - 1)));
        return "forward:/FTZ210205/QryAuthDtl";
      }

      FtzInMsgCtl update_FtzInMsgCtl = new FtzInMsgCtl();
      update_FtzInMsgCtl.setMsgStatus(CommonConst.FTZ_MSG_STATUS_AUTH_SUCC);
      if (form.getFtzInMsgCtl().getMsgId() != null
          && !"".equals(form.getFtzInMsgCtl().getMsgId())) {

        update_FtzInMsgCtl.setMsgId(form.getFtzInMsgCtl().getMsgId());
      } else {
        update_FtzInMsgCtl.setMsgId(form.getSelected_msgId());
      }
      update_FtzInMsgCtl.setMsgNo(CommonConst.MSG_NO_210205);

      update_FtzInMsgCtl.setChkUserId(userInfo.getUserid());
      update_FtzInMsgCtl.setRsv2(update_FtzInMsgCtl.getChkDatetime());
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      int i = ftz210205Serv.updateFtzInMsgCtl(update_FtzInMsgCtl, null);
      if (i < 1) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.210301.0008"));
      } else {
        model.addAttribute(ResultMessages.success().add("i.ftzmis.210301.0005"));
        form.setAuthFinishFlag("1");
        return "forward:/FTZ210205/QryAuthDtl";
      }
    }

    return "forward:/FTZ210205/QryAuthDtl";
  }
 /**
  * @param word
  * @param n sequence length
  */
 private void add(StringBuffer word, int n) {
   for (int i = 0; i <= word.length() - n; i++) {
     add(word.subSequence(i, i + n));
   }
 }