public static ChgResponse loadCustomerListBySpecificSUserStatus(String Status) {

    Connection con = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    StringBuilder sb = new StringBuilder();
    List chgCustomerUserList = new ArrayList<ChgCustomerUser>();
    sb.append("SELECT * FROM CHG_USER_CUSTOMER ");
    sb.append("INNER JOIN ");
    sb.append("CHG_USER ");
    sb.append("ON ");
    sb.append("CHG_USER_CUSTOMER.CUS_USERNAME = CHG_USER.USERNAME ");
    sb.append("AND ");
    sb.append("CHG_USER.TYPE = 'CHG_CUSTOMER' ");
    sb.append("AND ");
    sb.append("CHG_USER.USER_STATUS = ? ");
    try {
      con =
          (CHGConnectionPoolFactory.getCGConnectionPool(CHGConnectionPoolFactory.MYSQL))
              .getConnection();
      ps = con.prepareStatement(sb.toString());
      ps.setString(1, Status);
      rs = ps.executeQuery();
      while (rs.next()) {
        ChgCustomerUser chgCustomerUser = new ChgCustomerUser();
        chgCustomerUser.init();
        chgCustomerUser.load(rs, con, 0);
        chgCustomerUserList.add(chgCustomerUser);
      }
      return new ChgResponse(
          ChgResponse.SUCCESS, "Load Charging Stations Successfully", chgCustomerUserList);

    } catch (SQLException e) {
      e.printStackTrace();
      return new ChgResponse(ChgResponse.ERROR, e.getMessage());
    } catch (Exception e) {
      e.printStackTrace();
      return new ChgResponse(ChgResponse.ERROR, e.getMessage());
    } finally {
      DBUtility.close(rs);
      DBUtility.close(ps);
      DBUtility.close(con);
    }
  }
コード例 #2
0
  @Override
  public void createBean(Object object) {
    ChgCustomerUser chgCustomerUser = (ChgCustomerUser) object;
    setUserId(chgCustomerUser.getUserId());
    setUserName(chgCustomerUser.getUserName());
    setNfcRef(chgCustomerUser.getNfcRef());
    setUserCusMappingID(chgCustomerUser.getUserCusMappingID());
    setCreatedTimeStamp(chgCustomerUser.getCreatedTimeStamp());
    setLastUpdateTimeStamp(chgCustomerUser.getLastUpdateTimeStamp());
    setCreatedBy(chgCustomerUser.getCreatedBy());
    setUserStatus(chgCustomerUser.getUserStatus());
    setUserType(chgCustomerUser.getUserType());
    setCustomerPoints(chgCustomerUser.getCustomerPoints());

    // Set Special Values;
    setNfcReferenceBeanList(loadNFCReferences(chgCustomerUser.getNfcReferenceList()));
    if (!getNfcReferenceBeanList().isEmpty()) {
      setNetworkIds(loadNetworkIds(chgCustomerUser.getNfcReferenceList()));
      setNetworks(
          loadChargeNetworksBeanList(
              StringUtil.getCommaSeparatedStringFromStringList(getNetworkIds())));
    }
  }
コード例 #3
0
 @Override
 public void decodeBeanToReal(Object object) {
   ChgCustomerUser chgCustomerUser = (ChgCustomerUser) object;
   chgCustomerUser.init();
   chgCustomerUser.setUserId(getUserId());
   chgCustomerUser.setUserName(getUserName());
   chgCustomerUser.setNfcRef(getNfcRef());
   chgCustomerUser.setUserCusMappingID(getUserCusMappingID());
   chgCustomerUser.setCreatedTimeStamp(getCreatedTimeStamp());
   chgCustomerUser.setLastUpdateTimeStamp(getLastUpdateTimeStamp());
   chgCustomerUser.setCreatedBy(getCreatedBy());
   chgCustomerUser.setUserStatus(getUserStatus());
   chgCustomerUser.setUserType(getUserType());
   chgCustomerUser.setCustomerPoints(getCustomerPoints());
 }