【文件属性】:
文件名称:安防门禁SDK控制器Demo
文件大小:1.95MB
文件格式:RAR
更新时间:2021-05-07 02:51:05
门禁
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
JSONObject info = new JSONObject();
JSONArray ja = new JSONArray();
String ret = "ok";
try{
String type = request.getParameter("type");
type = null == type ? "" : type;
if(type.equals("0"))//新增或编辑
{
Enumeration enu = request.getParameterNames();
String id = request.getParameter("id");
Map map = new HashMap();
while(enu.hasMoreElements())
{
String key = enu.nextElement();
if(!key.equals("id"))
{
map.put(key, request.getParameter(key));
}
Db.timeMap.put(id, map);
}
}
else if(type.equals("1"))//查询
{
Map> times = Db.timeMap;
Set ids = times.keySet();
int i=0;
for(String id : ids)
{
if(i!=0) break;//该项目demo只返回一个时间段做为展示
Map time = times.get(id);
Set keys = time.keySet();
time.put("id", id);
JSONObject t = new JSONObject();
for(String key : keys)
{
t.put(key, time.get(key));
}
ja.add(t);
i++;
}
}
}