123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.sinosoft.lz.system.focusControl.service;
- import java.io.UnsupportedEncodingException;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import org.jfree.util.Log;
- import com.formaction.Utils;
- import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
- import com.sinosoft.lz.system.focusControl.dao.FocusControl;
- @Path("/FocusControlServer/")
- public class FocusControlServer {
- @POST
- @ProduceMime("application/json")
- @Path("/query/")
- public String query(String params){
- StringBuffer sql=new StringBuffer();
- ORGTemplate org = new ORGTemplate();
- List<Map<String,String>> list = new ArrayList<Map<String,String>>();
- int total=0;
- String firstPageNum="";
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- System.out.println(params);
- firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
- .getParameter("pager.pageNo", params);
- String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
- .getParameter("pager.pageSize", params);
- String name=Utils.getParameter("codename", params) ;
- sql.append("select TOP "+(Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)+","+(Integer.parseInt(limit))+" * , (select count(1) from app_data_value) total from app_data_value order by gathertime desc \n");
- if(name!=null){
- sql.append("where code='"+name+"' \n");
- }
- System.out.println("123123"+sql.toString());
- list = org.query(sql.toString());
-
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Log.info(org.listToString(list));
- if(list.size()>0){
- System.out.println(list.get(0).get("TOTAL"));
- total=Integer.parseInt(list.get(0).get("TOTAL"));
- }
-
- return "{\"pager.totalRows\":"+total+",\"pager.pageNo\":"+Integer.parseInt(firstPageNum)+","+"\"rows\":["+org.listToString(list)+"]}";
- }
-
-
- @POST
- @ProduceMime("application/json")
- @Path("/query1/")
- public String query1(String params){
- StringBuffer sql=new StringBuffer();
- ORGTemplate org = new ORGTemplate();
- List<Map<String,String>> list = new ArrayList<Map<String,String>>();
- int total=0;
- String firstPageNum="";
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- String name=Utils.getParameter("codename", params) ;
- sql.append("select * , (select count(1) from app_data_value where code='"+name+"') total from app_data_value where code='"+name+"' order by gathertime desc \n");
- System.out.println(sql.toString());
- list = org.query(sql.toString());
- if(list.size()>0){
- System.out.println(list.get(0).get("TOTAL"));
- total=Integer.parseInt(list.get(0).get("TOTAL"));
- }
-
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Log.info(org.listToString(list));
- return "{\"pager.totalRows\":"+total+",\"pager.pageNo\":"+1+","+"\"rows\":["+org.listToString(list)+"]}";
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/personquery/")
- public String personquery(String params){
- ORGTemplate org = new ORGTemplate();
- List<Map<String,String>> list = new ArrayList<Map<String,String>>();
- try {
- params=java.net.URLDecoder.decode(params, "UTF-8");
- String date=Utils.getParameter("date", params) == null ? "0" : Utils.getParameter("date", params);
- String date2=date+" 23:59:59";
- String sql="select * from app_user_list where gathertime between ? and ? ";
- System.out.println(date+",,"+",,"+date2+sql);
- list=org.query(sql, date,date2);
-
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- System.out.println(org.listToString(list));
- return "{\"rows\":["+org.listToString(list)+"]}";
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/query2/")
- public String query2(){
- FocusControl foc=new FocusControlService();
- foc.getDataRegisterUsers();
- foc.getOnlineUsers();
- foc.getSessionConnect();
- foc.getAccessTimes();
- foc.getFirstLoginUsers();
- foc.getDataLoginUsers();
- foc.getDataLoginUsersTimes();
- foc.getDataLoginList();
- foc.LoginResponseTime();
- foc.waitToDo();
-
-
- return "";
- }
-
- }
|