码迷,mamicode.com
首页 > 其他好文 > 详细

mes平台Action类模版

时间:2017-03-12 15:26:48      阅读:163      评论:0      收藏:0      [点我收藏+]

标签:tar   ace   nal   rate   array   prepare   json   exce   dstat   

Connection conn = null;

         PreparedStatement pst = null;

         ResultSet rs = null;

         @Override

         public String excute() throws ExedoException {

                   // TODO Auto-generated method stub

                   String success = "success";

                   String uid = DOGlobals.getInstance().getSessoinContext().getUser().getUid();

                   String headjson = DOGlobals.getInstance().getSessoinContext().getFormInstance().getValue("jsons");

                   conn = DataSource.getDataSource().getConnection();

                   try {

                            conn.setAutoCommit(false);

                            if(headjson == null ||headjson.equals("")){

                                     return success = "没有接受到前段数据";

                            }

                           

                            JSONArray jsonArr = new JSONArray(headjson);

                            JSONObject jsonObject = jsonArr.getJSONObject(0);

                           

                            String objuid = jsonObject.getString("objuid");

                            String scx_uid = jsonObject.getString("scx_uid");

                            String ph = jsonObject.getString("ph");

                            String pm = jsonObject.getString("pm");

                            String gg = jsonObject.getString("gg");

                            String zt = jsonObject.getString("zt");

                            String ts = jsonObject.getString("ts");

                           

                            StringBuffer sql = new StringBuffer();

                            /*

                             *

                             */

                            sql.append("");

                            pst = conn.prepareStatement(sql.toString());

                            pst.setString(1, "");

                            pst.executeUpdate();

                            sql.delete(start, end)

} catch (SQLException | JSONException e) {

                            // TODO Auto-generated catch block

                            e.printStackTrace();

                            try {

                                     conn.rollback();

                                     success = "error";

                            } catch (SQLException e1) {

                                     // TODO Auto-generated catch block

                                     e1.printStackTrace();

                            }

                   }finally{

                            try {

                                     conn.commit();

                                     if(rs != null){

                                               rs.close();

                                     }

                                     if(pst != null){

                                               pst.close();

                                     }

                                     if(rs != null){

                                               rs.close();

                                     }

                            } catch (SQLException e) {

                                     // TODO Auto-generated catch block

                                     e.printStackTrace();

                            }

                   }

                  

                  

                  

                  

                   return success;

         }

mes平台Action类模版

标签:tar   ace   nal   rate   array   prepare   json   exce   dstat   

原文地址:http://www.cnblogs.com/timeleader/p/6537786.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!