????????У?鸚?????????????????QTPCommonServlet.java??QTPCommonDao.java
????????QTPCommonServlet.java???

 

package com.runqianapp.qtp;
import  java .io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.runqianapp.qtp.QTPCommonDao;
import com.geezn.exception.GeeznException;
import com.runqianapp.common.log.GEZLoggerManager;
import com.runqianapp.common.servlet.AbstractGezServlet;
/**
*  QTP ??????Servlet
* @author RAQ
*
*/
public class QTPCommonServlet extends AbstractGezServlet {
/**???????????????*/
private static final String GET_ALL_DATA = "getAllData";
/**?????????????*/
private static final String CHECK_DELETE_RESULT = "checkDeleteResult";
/**
* ??дservice()????
*/
public void service(HttpServletRequest request?? HttpServletResponse response){
response.setContentType("text/html");
PrintWriter out = null;
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
out = response.getWriter();
} catch (Exception e) {
GeeznException ge;
if(e instanceof GeeznException){
ge = (GeeznException) e;
}else{
ge = new GeeznException(QTPCommonDao.MODULE_QTP?? GEZLoggerManager.LOGLEVEL_ERROR??"?????????????????????????????????"?? e?? "{}");
}
out.print(ge.getErrorMessageJson());
}
String action = request.getParameter("action");
if(GET_ALL_DATA.equals(action)){
String sql = request.getParameter("sql");
String sqlDateNumber = request.getParameter("sqlDateNumber");
String allDatas = "";
try {
allDatas = QTPCommonDao.getAllDatas(sql??sqlDateNumber);
} catch (GeeznException e) {
GeeznException ge;
if(e instanceof GeeznException){
ge = (GeeznException) e;
}else{
ge = new GeeznException(QTPCommonDao.MODULE_QTP?? GEZLoggerManager.LOGLEVEL_ERROR??"??????????????????????"?? e?? "{}");
}
out.print(ge.getErrorMessageJson());
}
out.print(allDatas);
}else if(CHECK_DELETE_RESULT.equals(action)){
String sql = request.getParameter("sql");
boolean deleteResult = false;
try {
deleteResult = QTPCommonDao.checkDeleteResult(sql);
} catch (GeeznException e) {
GeeznException ge;
if(e instanceof GeeznException){
ge = (GeeznException) e;
}else{
ge = new GeeznException(QTPCommonDao.MODULE_QTP?? GEZLoggerManager.LOGLEVEL_ERROR??"????????????????????????"?? e?? "{}");
}
out.print(ge.getErrorMessageJson());
}
out.print(deleteResult);
}
}
}