ruti 

解决方案 »

  1.   


    public class GsNotifyImp implements IGsNotify {
    private Logger logger = Logger.getLogger(GsNotifyImp.class);
    public void orderRelationUpdateNotifyReq(int OPType,String productID,String streamingNo,String userID,int userIDType) {
    try {
        Statement stmt = DbConn.getConnetion().createStatement();
    StringBuffer sql = new  StringBuffer();
    String spRevId = header.getSpRevId();
    String spRevpassword = header.getSpRevpassword();
    String spId = header.getSpId();
    String SAN = header.getSAN();
    String transactionId = header.getTransactionId();
    String linkId = header.getLinkId();
    StringBuffer aa = new  StringBuffer();
    if (spRevId != null && !spRevId.equals(""))
    aa.append(spRevId).append(",");
    else aa.append(",");
    if (spRevpassword != null && !spRevpassword.equals(""))
    aa.append(spRevpassword).append(",");
    else aa.append(",");
    if (spId != null && !spId.equals(""))
    aa.append(spId).append(",");
    else aa.append(",");
    if (SAN != null && !SAN.equals(""))
    aa.append(SAN).append(",");
    else aa.append(",");
    if (transactionId != null && !transactionId.equals(""))
    aa.append(transactionId).append(",");
    else aa.append(",");
    if (linkId != null && !linkId.equals(""))
    aa.append(linkId).append("");
    sql.append("insert into T_ISAPNOTIFY(STREAMINGNO,USERID,USERIDTYPE,PRODUCTID,OPTYPE,RMK,REPORT_FLAG) values(");
    if (streamingNo != null && !streamingNo.equals(""))
        sql.append("'").append(streamingNo).append("',");//STREAMINGNO
    if(userID !=null && !userID.equals(""))
        sql.append("'").append(userID).append("',");//USERID
        sql.append(userIDType).append(",");//USERIDTYPE
    if (productID != null && !productID.equals(""))
        sql.append("'").append(productID).append("',");//PRODUCTID
        sql.append(OPType).append(",");//OPTYPE
    if (aa != null && !aa.equals(""))
        sql.append("'").append(aa.toString()).append("',");//RMK
        sql.append(0).append(")");//REPORT_TYPE
    System.out.println("SQLStr==>" + sql.toString());
    stmt.execute(sql.toString());
    //-------------------------
    SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm:ss");
    System.out.println("插入成功");
    System.out.println("时间:"+sdf.format(new Date()));
                //-------------------------
    }
    catch (SQLException e) {
    System.out.println("SQLException:" + e.getMessage());
    }
    catch (Exception e) {
    System.out.println(e.toString());
    }finally {
    DbConn.closeCn();
    }
    }}