Newer
Older
huludao / src / main / java / com / newfiber / api / pc / controller / EventsManage / WaterQualityEvaluateController.java
package com.newfiber.api.pc.controller.EventsManage;

import com.alibaba.fastjson.JSONObject;
import com.newfiber.api.core.utils.ConfigParams;
import com.newfiber.api.core.utils.HttpClienter;
import com.newfiber.api.core.utils.WriterUtil;
import com.newfiber.api.pc.model.Users;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

@Controller
public class WaterQualityEvaluateController  extends ConfigParams {
	
	//跳转河道水质页面
	@PostMapping(value="gotowaterQuality")
	public String gotowaterQuality(){
		return "riverMessage/waterQuality";
	}
	
	//跳转河道水质手动录入页面
	@PostMapping(value="gotomanually")
	public String gotomanually(){
		return "riverMessage/manually";
	}
	
	
	
	
	
	  //获取站点最新实时数据
	
	  @PostMapping(value = "WaterQualityEvaluate/GetSiteRealTimeData.do")
      @ResponseBody
      //@LogOne(descriptionType="6",description = "获取站点最新实时数据")
		public  String GetSiteRealTimeData(String SiteNo, HttpServletRequest request, HttpServletResponse response1)throws Exception{
			
		   
			
			String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetSiteRealTimeData";	
			List<NameValuePair> parameters = new ArrayList<NameValuePair>();
			parameters.add(new BasicNameValuePair("SiteNo", SiteNo));
			return HttpClienter.doPost1(url, parameters, request, response1);
	        
		}
	
	  //获取录入的因子名称数据:
	  
	  @PostMapping(value = "WaterQualityEvaluate/GetWriteFieldNames.do")
	  @ResponseBody
	  //@LogOne(descriptionType="6",description = "获取站点最新实时数据")
	  public  String GetWriteFieldNames(String SiteNo, HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetWriteFieldNames";	
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		 
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  //添加站点水质化验数据,并判断水质等级:	  
	  @PostMapping(value = "WaterQualityEvaluate/AddSiteWaterQualityDatas.do")
	  @ResponseBody
	  //@LogOne(descriptionType="1",description = "获取站点最新实时数据")
	  public  String AddSiteWaterQualityDatas(String SiteNo, String StrData, HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
          /*JSONObject  jsonObject =new  JSONObject();*/
		 /* JSONArray jsonarray = JSONArray.toJSONObject(StrData);*/
		 //String  StrData1=  JSON.toJSONString(StrData);
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/AddSiteWaterQualityDatas";	
		  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();
			 List<NameValuePair> parameters = new ArrayList<NameValuePair>();
			 
			parameters.add(new BasicNameValuePair("SiteNo", SiteNo));
			parameters.add(new BasicNameValuePair("UserNo", userNo1));
			parameters.add(new BasicNameValuePair("StrData", "["+StrData+"]"));
			parameters.add(new BasicNameValuePair("Data_Name", "检验数据名称"));
			
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	  //获取上传数据的站点水质等级: 
	  @PostMapping(value = "WaterQualityEvaluate/GetJudegSiteDataWaterQuality.do")
	  @ResponseBody
	  public  String GetJudegSiteDataWaterQuality(String SiteNo, String StrData, HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  //String  StrData1=  JSON.toJSONString(StrData);
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetJudegSiteDataWaterQuality";	
		  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
		  parameters.add(new BasicNameValuePair("SiteNo", SiteNo));
		  parameters.add(new BasicNameValuePair("UserNo", userNo1));
		  parameters.add(new BasicNameValuePair("StrData", "["+StrData+"]"));
	
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  //获取站点水质综合页面表头: 
	  @PostMapping(value = "WaterQualityEvaluate/GetSiteWaterQualityColums.do")
	  @ResponseBody
	  public  String GetJudegSiteDataWaterQuality(HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetSiteWaterQualityColums";	
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
		
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	  //6.获取站点水质综合页面表格数据:
	  //localhost:7428/WaterQualityEvaluate/GetSiteWaterQualityGrid?ST=0971010006&StartDateTime=2017-12-25 16:05:36.283&EndDateTime=2017-12-29 16:05:36.283&page=1&rowsCount=10
    
	  @PostMapping(value = "WaterQualityEvaluate/GetSiteWaterQualityGrid.do")
	  @ResponseBody
	  public  String GetSiteWaterQualityGrid(String ST, String StartDateTime, String EndDateTime, String page, String rows , HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetSiteWaterQualityGrid";	
		/*  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = "Lyf";*/
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
			/*parameters.add(new BasicNameValuePair("StartDateTime", (StartDateTime+".000").replace("%20", " ")));
			parameters.add(new BasicNameValuePair("EndDateTime", (EndDateTime+".000").replace("%20", " ")));*/
			parameters.add(new BasicNameValuePair("StartDateTime", (StartDateTime+".000").replace("%20", " ")));
			parameters.add(new BasicNameValuePair("EndDateTime", (EndDateTime+".000").replace("%20", " ")));
			
		    parameters.add(new BasicNameValuePair("ST", ST));
		    parameters.add(new BasicNameValuePair("page", page));
		    parameters.add(new BasicNameValuePair("rowsCount", rows));
	
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  //7.获取站点水质信息明细数据列名
	 
	  @PostMapping(value = "WaterQualityEvaluate/GetSiteWaterQualityDataColums.do")
	  @ResponseBody
	  public  String GetSiteWaterQualityDataColums(HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetSiteWaterQualityDataColums";	
		/*  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();*/
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
		 
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	  //8.获取站点水质详情明细数据:
	 
	  @PostMapping(value = "WaterQualityEvaluate/GetSiteWaterQualityDataGrid.do")
	  @ResponseBody
	
	  public  String GetSiteWaterQualityDataGrid(String Data_No, String page, String rows , HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		                                                                   
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/GetSiteWaterQualityDataGrid";	
		/*  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();*/
		  List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
			
		    parameters.add(new BasicNameValuePair("DataNo", Data_No));
		    parameters.add(new BasicNameValuePair("page", page));
		    parameters.add(new BasicNameValuePair("rowsCount", rows));
	
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	  //删除站点水质记录:
	  
	  @PostMapping(value = "WaterQualityEvaluate/DeleteSiteWaterQuality.do")
	  @ResponseBody
	 
	  public  String DeleteSiteWaterQuality(String Serial, String Data_No , HttpServletRequest request, HttpServletResponse response1)throws Exception{
		  
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/DeleteSiteWaterQuality";	
		/*  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();
		 */ List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
		  
		  parameters.add(new BasicNameValuePair("Data_No", Data_No));
		  parameters.add(new BasicNameValuePair("Serial", Serial));
		 
		  
		  return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	  

/*10.导出站点水质记录:
http://localhost:7428/WaterQualityEvaluate/DownloadSiteWaterQuality?ST=0971010006&StartDateTime=2017-11-25 16:05:36.283&EndDateTime=2017-12-29 16:05:36.283

--ST:测站编码
--StartDateTime:开始时间
--EndDateTime:截止时间

返回:
文件流
{"retMess":"true"}*/
	  
	  //导出站点水质记录:
	  
	  @PostMapping(value = "WaterQualityEvaluate/DownloadSiteWaterQuality.do")
	  @ResponseBody
	  public  void DownloadSiteWaterQuality(String ST, String StartDateTime , String EndDateTime, HttpServletRequest request, HttpServletResponse response)throws Exception{
		  JSONObject result=new JSONObject();
		  
		  
		  String url=super.ServerXingIPOne(request)+"WaterQualityEvaluate/DownloadSiteWaterQuality";	
		/*  Users attribute = (Users) request.getSession().getAttribute("user");
		  String userNo1 = attribute.getLoginname();
		 */ List<NameValuePair> parameters = new ArrayList<NameValuePair>();
		  
		  
		    //parameters.add(new BasicNameValuePair("ST", ST));		
		/*	parameters.add(new BasicNameValuePair("StartDateTime", (StartDateTime+".000").replace("%20", " ")));
			parameters.add(new BasicNameValuePair("EndDateTime", (EndDateTime+".000").replace("%20", " ")));*/
			/*parameters.add(new BasicNameValuePair("StartDateTime", StartDateTime));
			parameters.add(new BasicNameValuePair("EndDateTime", EndDateTime));*/
			
			result.put("url", url);
			response.setContentType("application/json;charset=UTF-8");
			WriterUtil.write(response, result.toString());
		 // return HttpClienter.doPost1(url, parameters, request, response1);
		  
	  }
	  
	
	

}