data.jsp
4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<%@page import="java.util.Date"%>
<%@page import="com.weaver.formmodel.util.DateHelper"%>
<%@page import="com.weaver.formmodel.util.StringHelper"%>
<%@page import="net.sf.json.JSONArray"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="weaver.general.Util"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/mobilemode/mobile/base.jsp"%>
<%
String action = Util.null2String(request.getParameter("action"));
JSONObject json = new JSONObject();
Date now = new Date();
String d1 = DateHelper.getCurrentDate();
String d2 = DateHelper.getLastDayOfMonthWeek(now);
String d3 = DateHelper.getLastDayOfWeek(now);
if("remark".equals(action)){
//日期标记默认参数
String startDate = Util.null2String(request.getParameter("startDate"));
String endDate = Util.null2String(request.getParameter("endDate"));
JSONArray datas = new JSONArray();
JSONObject obj1 = new JSONObject();
obj1.put("date", d1);
JSONObject obj2 = new JSONObject();
obj2.put("date", d2);
JSONObject obj3 = new JSONObject();
obj3.put("date", d3);
datas.add(obj1);
datas.add(obj2);
datas.add(obj3);
json.put("data", datas);
}else if("getDatas".equals(action)){
int pageNo = Util.getIntValue(request.getParameter("pageNo"), 1);
int pageSize = Util.getIntValue(request.getParameter("pageSize"), 10);
String currdate = Util.null2String(request.getParameter("currdate"));
List<JSONObject> datas = new ArrayList<JSONObject>();
datas.add(JSONObject.fromObject("{'id':'1','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'热烈欢迎朱锟加入EBU技术中心','content':'2015梦想羊帆起航,EBU携手SME共创未来…', 'cat':'人事新闻', 'date':'"+d1+"','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'2','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年6月份泛微销售业绩排行榜','content':'EBU携手SME共创未来…', 'cat':'公司新闻', 'date':'"+d2+"','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'3','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'热烈欢迎靳志远加入SME事业本部','content':'2015梦想羊帆起航,EBU携手SME共创未来…', 'cat':'人事新闻', 'date':'"+d3+"','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'4','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年3月份泛微销售业绩排行榜','content':'', 'cat':'公司新闻', 'date':'"+d2+"','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'5','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'泛微OA签约上海电驱动股份有限公司','content':'梦想羊帆起航,EBU携手SME共创未来…', 'cat':'签约新闻', 'date':'"+d1+"','tel':'18888888888', 'email':'admin@admin.com'}"));
datas.add(JSONObject.fromObject("{'id':'6','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2012年4月份泛微销售业绩排行榜','content':'', 'cat':'公司新闻', 'date':'"+d3+"'}"));
datas.add(JSONObject.fromObject("{'id':'7','avatar':'/mobilemode/mobile/demo/plugin/UserAvatar/avatar.jpg', 'title':'2015年5月产品改进建议奖','content':'最多建议奖:奖金总额500元, 由每个月建议数(未经处理的客户建议不计)最多者获取', 'cat':'产品建议', 'date':'"+d2+"','tel':'18888888888', 'email':'admin@admin.com'}"));
int startIndex = (pageNo - 1) * pageSize;
int endIndex = startIndex + pageSize;
List<JSONObject> result = new ArrayList<JSONObject>();
for(JSONObject obj : datas){
String date = obj.getString("date");
if(StringHelper.isNotEmpty(currdate)){
if(currdate.indexOf(",") != -1){
String startDate = currdate.split(",")[0];
String endDate = currdate.split(",")[1];
if(DateHelper.getDaysBetween(date, startDate) >= 0 && DateHelper.getDaysBetween(endDate, date) >= 0){
result.add(obj);
}
}else if(date.equals(currdate)){
result.add(obj);
}
}else{
result.add(obj);
}
}
int size = result.size();
json.put("totalSize", size);
json.put("datas", JSONArray.fromObject(result.subList(startIndex, endIndex > size ? size : endIndex)));;
}
json.put("status", 1);
out.print(json);
%>