首页 > 技术文章 > mes平台Action类模版

timeleader 2017-03-12 14:17 原文

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;

         }

推荐阅读