You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
|
|
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
|
<%@ page import="weaver.conn.RecordSet" %>
|
|
<%@ page import="weaver.general.Util" %>
|
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
|
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
|
<%@ page import="com.alibaba.fastjson.JSONArray" %>
|
|
<%@ page import="java.text.SimpleDateFormat" %>
|
|
<%@ page import="java.util.Date" %>
|
|
<%@ page import="java.util.Calendar" %>
|
|
<%@ page import="java.util.ArrayList" %>
|
|
<%@ page import="java.util.List" %>
|
|
<%@ page import="weaver.general.BaseBean" %>
|
|
<jsp:useBean id="bb" class="weaver.general.BaseBean"/>
|
|
<%
|
|
|
|
JSONObject dataJson = new JSONObject();
|
|
RecordSet rs = new RecordSet();
|
|
String xqny = Util.null2String(request.getParameter("xqny"));
|
|
String htmc = Util.null2String(request.getParameter("htmc"));
|
|
bb.writeLog("xqny:"+xqny);
|
|
bb.writeLog("htmc:"+htmc);
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
Calendar c = Calendar.getInstance();//获得一个日历的实例
|
|
List<String> list = new ArrayList<String>();
|
|
if(StringUtils.isNotBlank(xqny) && xqny.length()==7){
|
|
String selectDate = xqny+"-01";
|
|
for(int i=0;i<6;i++)
|
|
try{
|
|
Date date = sdf.parse(selectDate);//初始日期
|
|
c.setTime(date);//设置日历时间
|
|
c.add(Calendar.MONTH,i);//在日历的月份上增加6个月
|
|
String resDate = sdf.format(c.getTime());
|
|
if(StringUtils.isNotBlank(resDate) && resDate.length()==10){
|
|
String resMonth = resDate.substring(0,7);
|
|
bb.writeLog("resMonth:"+resMonth);
|
|
|
|
list.add(resMonth);
|
|
}
|
|
}catch(Exception e){
|
|
|
|
}
|
|
}
|
|
|
|
JSONObject yfObject = new JSONObject();
|
|
String[] field_lisy = new String[]{"yf","yf1","yf2","yf3","yf4","yf5","yf6"};
|
|
for(int i=0;i<list.size();i++){
|
|
String zjjhje = "" ;
|
|
String zjjhyf = list.get(i);
|
|
|
|
bb.writeLog("zjjhyf:"+zjjhyf);
|
|
if(StringUtils.isNotBlank(xqny) && StringUtils.isNotBlank(htmc)){
|
|
String sql =" SELECT zjjhje FROM uf_zjjhzxsj WHERE zjjhx='" +htmc+"' and zjjhyf='"+zjjhyf+"' " ;
|
|
bb.writeLog("sql:"+sql);
|
|
rs.executeQuery(sql);
|
|
if (rs.next()){
|
|
zjjhje = Util.null2String(rs.getString("zjjhje"));
|
|
bb.writeLog("zjjhje:"+zjjhje);
|
|
}
|
|
}
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("zjjhje",zjjhje);
|
|
jsonObject.put("zjjhyf",zjjhyf);
|
|
String field = field_lisy[i];
|
|
jsonObject.put("field",field);
|
|
yfObject.put(field,jsonObject);
|
|
}
|
|
dataJson.put("data",yfObject);
|
|
dataJson.put("code",200);
|
|
%>
|
|
|
|
<%=dataJson.toJSONString() %>
|
|
|
|
|