陈士柏 4 éve
szülő
commit
5fb37e2ff8
66 módosított fájl, 5617 hozzáadás és 0 törlés
  1. 72 0
      Admin.java
  2. 25 0
      AdminDao.java
  3. 69 0
      AdminDaoImpl.java
  4. 31 0
      AdminService.java
  5. 35 0
      AdminServiceImpl.java
  6. 41 0
      Car.java
  7. 26 0
      CharacterEncodingFilter.java
  8. 165 0
      CombinatorialQuery.java
  9. 66 0
      CreateSign1.java
  10. 41 0
      Data.java
  11. 122 0
      Data2.java
  12. 194 0
      Data3.java
  13. 32 0
      Extra.java
  14. 28 0
      GetHttpParam.java
  15. 585 0
      HttpsClient.java
  16. 281 0
      IOSchoolAction.java
  17. 26 0
      IOSchoolService.java
  18. 50 0
      IOSchoolServiceImpl.java
  19. 25 0
      IOschoolDao.java
  20. 115 0
      IOschoolDaoImpl.java
  21. 216 0
      IndexAction.java
  22. 235 0
      InfoAction.java
  23. 41 0
      Inschool.java
  24. 58 0
      LoginFilter.java
  25. 2 0
      MANIFEST.MF
  26. 34 0
      Message.java
  27. 23 0
      MyX509TrustManager.java
  28. 73 0
      OneMenu.java
  29. 23 0
      OneMenuDao.java
  30. 40 0
      OneMenuDaoImpl.java
  31. 18 0
      OneMenuService.java
  32. 30 0
      OneMenuServiceImpl.java
  33. 41 0
      OutSchool.java
  34. 53 0
      ResUtil.java
  35. 52 0
      ResponseUtil.java
  36. 42 0
      SHA1.java
  37. 138 0
      TimeExchange.java
  38. 41 0
      Ting.java
  39. 72 0
      TreMenu.java
  40. 26 0
      TreMenuDao.java
  41. 48 0
      TreMenuDaoImpl.java
  42. 22 0
      TreMenuService.java
  43. 28 0
      TreMenuServiceImpl.java
  44. 72 0
      TwoMenu.java
  45. 18 0
      TwoMenuDao.java
  46. 51 0
      TwoMenuDaoImpl.java
  47. 17 0
      TwoMenuService.java
  48. 32 0
      TwoMenuServiceImpl.java
  49. 179 0
      Visitor.java
  50. 484 0
      VisitorAction.java
  51. 22 0
      VisitorDao.java
  52. 119 0
      VisitorDaoImpl.java
  53. 22 0
      VisitorService.java
  54. 46 0
      VisitorServiceImpl.java
  55. 53 0
      WxConfig.java
  56. 53 0
      WxConstants.java
  57. 381 0
      WxUtil.java
  58. 99 0
      applicationContext.xml
  59. 177 0
      loginAction.java
  60. 32 0
      struts.xml
  61. 42 0
      test2.java
  62. 30 0
      userDao.java
  63. 205 0
      userDaoImpl.java
  64. 30 0
      userService.java
  65. 58 0
      userServiceImpl.java
  66. 10 0
      zc.properties

+ 72 - 0
Admin.java

@@ -0,0 +1,72 @@
+package com.happy.Model;
+
+import java.io.Serializable;
+
+/**
+ * 管理员实体类
+ * 
+ * @author lzp
+ * 
+ */
+public class Admin implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 5039859157091460303L;
+
+	private int admin_id;
+	private String admin_name; // 名称
+	private String admin_account; // 帐号
+	private String admin_password; // 密码
+	private int level; // 权限
+	private int fake; // 0删除 1未删除
+
+	public int getAdmin_id() {
+		return admin_id;
+	}
+
+	public void setAdmin_id(int admin_id) {
+		this.admin_id = admin_id;
+	}
+
+	public String getAdmin_name() {
+		return admin_name;
+	}
+
+	public void setAdmin_name(String admin_name) {
+		this.admin_name = admin_name;
+	}
+
+	public String getAdmin_account() {
+		return admin_account;
+	}
+
+	public void setAdmin_account(String admin_account) {
+		this.admin_account = admin_account;
+	}
+
+	public String getAdmin_password() {
+		return admin_password;
+	}
+
+	public void setAdmin_password(String admin_password) {
+		this.admin_password = admin_password;
+	}
+
+	public int getLevel() {
+		return level;
+	}
+
+	public void setLevel(int level) {
+		this.level = level;
+	}
+
+	public int getFake() {
+		return fake;
+	}
+
+	public void setFake(int fake) {
+		this.fake = fake;
+	}
+
+}

+ 25 - 0
AdminDao.java

@@ -0,0 +1,25 @@
+package com.happy.dao;
+
+import com.happy.Model.Admin;
+
+public interface AdminDao {
+	/**
+	 * 根据用户名和密码查询管理员
+	 * 
+	 * @param
+	 * @param password
+	 * @return
+	 */
+	Admin getAdmin(String account, String password);
+
+	/**
+	 * 根据用户名和密码更改密码
+	 * 
+	 * @param
+	 * @param password
+	 * @return
+	 */
+	int updateAdmin(String account, String password);
+
+	int updateAdminInfo(Admin admin);
+}

+ 69 - 0
AdminDaoImpl.java

@@ -0,0 +1,69 @@
+package com.happy.dao.impl;
+
+import com.happy.dao.AdminDao;
+import com.happy.Model.Admin;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("AdminDao")
+public class AdminDaoImpl implements AdminDao {
+	@Autowired
+	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+	public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+		return namedParameterJdbcTemplate;
+	}
+
+	public void setNamedParameterJdbcTemplate(
+			NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+		this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+	}
+
+	// 根据用户名和密码查询管理员
+	public Admin getAdmin(String account, String password) {
+		String sql = "select admin_id,admin_name,admin_account,admin_password,level,fake from admin where admin_account=:account and admin_password=:password and fake=0";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("account", account);
+		sps.addValue("password", password);
+		List<Admin> list = namedParameterJdbcTemplate.query(sql, sps,
+				new BeanPropertyRowMapper<Admin>(Admin.class));
+		if (list != null && list.size() > 0) {
+			return list.get(0);
+		}
+		return null;
+	}
+
+	// 根据用户名和密码修改密码
+	public int updateAdmin(String admin_id, String password) {
+		String sql = "update admin set admin_password=:password  where admin_id=:admin_id  and fake=0";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("admin_id", admin_id);
+		sps.addValue("password", password);
+		int num = namedParameterJdbcTemplate.update(sql, sps);
+		if (num > 0) {
+			return num;
+		}
+		return 0;
+	}
+
+	// 修改用户信息
+	public int updateAdminInfo(Admin admin) {
+		String sql = "update admin set admin_name=:name,admin_account=:account,admin_password=:password where admin_id=:admin_id and fake=0";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("name", admin.getAdmin_name());
+		sps.addValue("account", admin.getAdmin_account());
+		sps.addValue("admin_id", admin.getAdmin_id());
+		sps.addValue("password", admin.getAdmin_password());
+		int num = namedParameterJdbcTemplate.update(sql, sps);
+		if (num > 0) {
+			return num;
+		}
+		return 0;
+	}
+
+}

+ 31 - 0
AdminService.java

@@ -0,0 +1,31 @@
+package com.happy.service;
+
+import com.happy.Model.Admin;
+
+public interface AdminService {
+	/**
+	 * 根据用户名和密码查询管理员
+	 * 
+	 * @param
+	 * @param password
+	 * @return
+	 */
+	public Admin getAdmin(String account, String password);
+
+	/**
+	 * 根据用户名和密码更改密码
+	 * 
+	 * @param
+	 * @param password
+	 * @return
+	 */
+	int updateAdmin(String account, String password);
+
+	/**
+	 * 修改用户
+	 * 
+	 * @param admin
+	 * @return
+	 */
+	int updateAdminInfo(Admin admin);
+}

+ 35 - 0
AdminServiceImpl.java

@@ -0,0 +1,35 @@
+package com.happy.service.Impl;
+
+import com.happy.dao.AdminDao;
+import com.happy.Model.Admin;
+import com.happy.service.AdminService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service("AdminService")
+public class AdminServiceImpl implements AdminService {
+
+	@Resource
+	private AdminDao adminDao;
+
+	public void setAdminDao(AdminDao adminDao) {
+		this.adminDao = adminDao;
+	}
+
+	// 根据用户名和密码查询管理员
+	public Admin getAdmin(String account, String password) {
+		return adminDao.getAdmin(account, password);
+	}
+
+	// 根据用户名和密码修改密码
+	public int updateAdmin(String account, String password) {
+		return adminDao.updateAdmin(account, password);
+	}
+
+	// 修改账号信息
+	public int updateAdminInfo(Admin admin) {
+		return adminDao.updateAdminInfo(admin);
+	}
+
+}

+ 41 - 0
Car.java

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+public class Car {
+
+    public String car_number;
+    public String begin_time;
+    public String end_time;
+    public String mobile;
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getBegin_time() {
+        return begin_time;
+    }
+
+    public void setBegin_time(String begin_time) {
+        this.begin_time = begin_time;
+    }
+
+    public String getEnd_time() {
+        return end_time;
+    }
+
+    public void setEnd_time(String end_time) {
+        this.end_time = end_time;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+}

+ 26 - 0
CharacterEncodingFilter.java

@@ -0,0 +1,26 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.happy.filter;
+
+import javax.servlet.*;
+import java.io.IOException;
+
+public class CharacterEncodingFilter implements Filter {
+	public CharacterEncodingFilter() {
+	}
+
+	public void destroy() {
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+		request.setCharacterEncoding("utf-8");
+		response.setCharacterEncoding("utf-8");
+		chain.doFilter(request, response);
+	}
+
+	public void init(FilterConfig arg0) throws ServletException {
+	}
+}

+ 165 - 0
CombinatorialQuery.java

@@ -0,0 +1,165 @@
+package com.happy.unitil;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ * 前端框架复合查询工具类
+ * 
+ * @author zjs
+ * 
+ */
+public class CombinatorialQuery {
+	// 组合条件查询
+	public static String query(String condition) {
+		String json = condition;
+		String sql = "where 1=1 ";
+		JSONArray jsonArray = JSONArray.fromObject(json);
+		String join = "";
+		for (int j = 0; j < jsonArray.size(); j++) {
+			JSONObject jsonObject = jsonArray.getJSONObject(j);
+
+			String lb = jsonObject.getString("lb");
+			String field = jsonObject.getString("field");
+			String op = jsonObject.getString("op");
+			String value = jsonObject.getString("value");
+			String rb = jsonObject.getString("rb");
+
+			if (!field.equals("")) {
+
+				if (op.equals("contains")) {// 包含
+					sql += join + " " + field + " like '%" + value + "%' ";
+				} else if (op.equals("equal")) {// 等于
+					sql += join + " " + field + "='" + value + "' ";
+				} else if (op.equals("notequal")) {// 不等于
+					sql += join + " " + field + "<>'" + value + "' ";
+				} else if (op.equals("greater")) {// 大于
+					sql += join + " " + field + ">'" + value + "' ";
+				} else if (op.equals("greaterorequal")) {// 大于或等于
+					sql += join + " " + field + ">='" + value + "' ";
+				} else if (op.equals("less")) {// 小于
+					sql += join + " " + field + "<'" + value + "' ";
+				} else if (op.equals("lessorequal")) {// 小于或等于
+					sql += join + " " + field + "<='" + value + "' ";
+				} else if (op.equals("beginwith")) {// 以....开头
+					sql += join + " " + field + " like '" + value + "%' ";
+				} else if (op.equals("endwith")) {// 以....结尾
+					sql += join + " " + field + " like '%" + value + "' ";
+				}
+			}
+		}
+		if (!sql.equals("where ")) {
+			return sql;
+		}
+		return null;
+	}
+
+	/**
+	 * 复合查询工具类
+	 * 
+	 * @param
+	 *            //第page页
+	 * @param
+	 *            //每页行数
+	 * @param advanceFilter
+	 *            //组合查询条件
+	 * @param sort
+	 *            //排序字段名
+	 * @param order
+	 *            //排序方式
+	 * @param filterRules
+	 *            //过滤条件
+	 * @return
+	 */
+	public static String queryOne(String advanceFilter, String sort,
+			String order, String filterRules) {
+		String sql = "where 1=1 ";
+		if (advanceFilter != null && !advanceFilter.equals("[]")) {
+			// System.out.println("advanceFilter有条件");
+
+			String json = advanceFilter;
+			JSONArray jsonArray = JSONArray.fromObject(json);
+			for (int j = 0; j < jsonArray.size(); j++) {
+				JSONObject jsonObject = jsonArray.getJSONObject(j);
+				String join = jsonObject.getString("join");
+				String lb = jsonObject.getString("lb");
+				String field = jsonObject.getString("field");
+				String op = jsonObject.getString("op");
+				String value = jsonObject.getString("value");
+				String rb = jsonObject.getString("rb");
+
+				if (!field.equals("")) {
+
+					if (op.equals("contains")) {// 包含
+						sql += join + " " + field + " like '%" + value + "%' ";
+					} else if (op.equals("equal")) {// 等于
+						sql += join + " " + field + "='" + value + "' ";
+					} else if (op.equals("notequal")) {// 不等于
+						sql += join + " " + field + "<>'" + value + "' ";
+					} else if (op.equals("greater")) {// 大于
+						sql += join + " " + field + ">'" + value + "' ";
+					} else if (op.equals("greaterorequal")) {// 大于或等于
+						sql += join + " " + field + ">='" + value + "' ";
+					} else if (op.equals("less")) {// 小于
+						sql += join + " " + field + "<'" + value + "' ";
+					} else if (op.equals("lessorequal")) {// 小于或等于
+						sql += join + " " + field + "<='" + value + "' ";
+					} else if (op.equals("beginwith")) {// 以....开头
+						sql += join + " " + field + " like '" + value + "%' ";
+					} else if (op.equals("endwith")) {// 以....结尾
+						sql += join + " " + field + " like '%" + value + "' ";
+					}
+				}
+			}
+		}
+		if (filterRules != null && !filterRules.equals("[]")) {
+			// System.out.println("filterRules有条件");
+
+			String json = filterRules;
+			JSONArray jsonArray = JSONArray.fromObject(json);
+			JSONObject jsonObject = jsonArray.getJSONObject(0);
+			String field = jsonObject.getString("field");
+			String value = jsonObject.getString("value");
+			sql += "and " + field + " like '%" + value + "%' ";
+
+		}
+		sql += "order by " ;
+		if (sort != null) {
+			// System.out.println("sort有排序");
+			sql +=  sort + " " + order + " ";
+		} else {
+			sql +=  " id desc ";
+		}
+		return sql;
+	}
+
+	// 组合条件+排序条件查询
+	public static String queryTwo(String string1, String string2, String string3) {
+		System.out.println(string1);
+		System.out.println(string2);
+		System.out.println(string3);
+		return null;
+	}
+
+	public static void main(String[] args) {
+		double aa = -19162431.1254;
+		String a = "19162b431";
+		String b = "-19162431a1254";
+		String c = "中文";
+		System.out.println(isNumericZidai(Double.toString(aa)));
+		System.out.println(isNumericZidai(a));
+		System.out.println(isNumericZidai(b));
+		System.out.println(isNumericZidai(c));
+	}
+
+	public static boolean isNumericZidai(String str) {
+		for (int i = 0; i < str.length(); i++) {
+			// System.out.println(str.charAt(i));
+			if (!Character.isDigit(str.charAt(i))) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+}

+ 66 - 0
CreateSign1.java

@@ -0,0 +1,66 @@
+package com.happy.unitil;
+
+import com.alibaba.fastjson.JSONObject;
+import com.happy.common.http.HttpsClient;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class CreateSign1 {
+    private static final char hexDigits[] = { '0', '1', '2', '3', '4', '5',
+            '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+    public static String MD5(String s) {
+        return MD5(s,"utf-8");
+    }
+
+    public static String MD5(String s, String charset) {
+        try{
+            MessageDigest messagedigest = MessageDigest.getInstance("MD5");
+            messagedigest.reset();
+            byte abyte0[] = messagedigest.digest(s.getBytes(charset));
+            return byteToString(abyte0);
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+
+    private static String byteToString(byte abyte0[]) {
+        int i = abyte0.length;
+        char ac[] = new char[i * 2];
+        int j = 0;
+        for (int k = 0; k < i; k++) {
+            byte byte0 = abyte0[k];
+            ac[j++] = hexDigits[byte0 >>> 4 & 0xf];
+            ac[j++] = hexDigits[byte0 & 0xf];
+        }
+        return new String(ac);
+    }
+
+    public static void main(String[] args) {
+        //密钥由艾停车提供,密钥和车场号一一对应
+        String ukey = "K1DIXZCLWNO0J0WV";
+
+        JSONObject data = new JSONObject(true);
+        data.put("uid","大门入口");
+        data.put("in_time",1611731098);
+        data.put("car_number","赣AE3434");
+        data.put("c_type","临时车");
+        data.put("in_channel_id","大门入口");
+        data.put("order_id","1902");
+        data.put("force_update",1);
+        data.put("empty_plot",879);
+        data.put("car_type","");
+        data.put("source","ist");
+        data.put("pic_addr","http://ist-falcon.oss-cn-shenzhen.aliyuncs.com/order-images/31809/in/1902.jpg?Expires=1611817499&OSSAccessKeyId=LTAIQQrl6GICP0QX&Signature=FnKZNrQ5nkdJlhgVTYp4v7Q3ejY%3D");
+
+        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+        String sign = data.toJSONString()+"key="+ukey;
+        sign = MD5(sign).toUpperCase();
+        System.out.println(sign);//242441AAC1911DB6E47A942A2B6477D5
+    }
+}

+ 41 - 0
Data.java

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+public class Data {
+
+    public String car_number;
+    public String begin_time;
+    public String end_time;
+    public String mobile;
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getBegin_time() {
+        return begin_time;
+    }
+
+    public void setBegin_time(String begin_time) {
+        this.begin_time = begin_time;
+    }
+
+    public String getEnd_time() {
+        return end_time;
+    }
+
+    public void setEnd_time(String end_time) {
+        this.end_time = end_time;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+}

+ 122 - 0
Data2.java

@@ -0,0 +1,122 @@
+package com.happy.Model;
+
+public class Data2 {
+
+    public Integer id;
+    public String car_number;
+    public String in_time;
+    public String car_type;
+    public String c_type;
+    public String uid;
+    public String order_id;
+    public String empty_plot;
+    public String in_channel_id;
+    public String worksite_id;
+    public String remark;
+    public String force_update;
+    public String ts_state;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getIn_time() {
+        return in_time;
+    }
+
+    public void setIn_time(String in_time) {
+        this.in_time = in_time;
+    }
+
+    public String getCar_type() {
+        return car_type;
+    }
+
+    public void setCar_type(String car_type) {
+        this.car_type = car_type;
+    }
+
+    public String getC_type() {
+        return c_type;
+    }
+
+    public void setC_type(String c_type) {
+        this.c_type = c_type;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getOrder_id() {
+        return order_id;
+    }
+
+    public void setOrder_id(String order_id) {
+        this.order_id = order_id;
+    }
+
+    public String getEmpty_plot() {
+        return empty_plot;
+    }
+
+    public void setEmpty_plot(String empty_plot) {
+        this.empty_plot = empty_plot;
+    }
+
+    public String getIn_channel_id() {
+        return in_channel_id;
+    }
+
+    public void setIn_channel_id(String in_channel_id) {
+        this.in_channel_id = in_channel_id;
+    }
+
+    public String getWorksite_id() {
+        return worksite_id;
+    }
+
+    public void setWorksite_id(String worksite_id) {
+        this.worksite_id = worksite_id;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getForce_update() {
+        return force_update;
+    }
+
+    public void setForce_update(String force_update) {
+        this.force_update = force_update;
+    }
+
+    public String getTs_state() {
+        return ts_state;
+    }
+
+    public void setTs_state(String ts_state) {
+        this.ts_state = ts_state;
+    }
+}

+ 194 - 0
Data3.java

@@ -0,0 +1,194 @@
+package com.happy.Model;
+
+public class Data3 {
+
+    public Integer id;
+    public String out_uid;
+    public String uid;
+    public String cash_pay;
+    public String pay_type;
+    public String electronic_pay;
+    public String in_time;
+    public String empty_plot;
+    public String in_channel_id;
+    public String out_channel_id;
+    public String order_id;
+    public String car_number;
+    public String auth_code;
+    public String freereasons;
+    public String c_type;
+    public String duration;
+    public String total;
+    public String out_time;
+    public String car_type;
+    public String amount_receivable;
+    public String ts_state;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOut_uid() {
+        return out_uid;
+    }
+
+    public void setOut_uid(String out_uid) {
+        this.out_uid = out_uid;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getCash_pay() {
+        return cash_pay;
+    }
+
+    public void setCash_pay(String cash_pay) {
+        this.cash_pay = cash_pay;
+    }
+
+    public String getPay_type() {
+        return pay_type;
+    }
+
+    public void setPay_type(String pay_type) {
+        this.pay_type = pay_type;
+    }
+
+    public String getElectronic_pay() {
+        return electronic_pay;
+    }
+
+    public void setElectronic_pay(String electronic_pay) {
+        this.electronic_pay = electronic_pay;
+    }
+
+    public String getIn_time() {
+        return in_time;
+    }
+
+    public void setIn_time(String in_time) {
+        this.in_time = in_time;
+    }
+
+    public String getEmpty_plot() {
+        return empty_plot;
+    }
+
+    public void setEmpty_plot(String empty_plot) {
+        this.empty_plot = empty_plot;
+    }
+
+    public String getIn_channel_id() {
+        return in_channel_id;
+    }
+
+    public void setIn_channel_id(String in_channel_id) {
+        this.in_channel_id = in_channel_id;
+    }
+
+    public String getOut_channel_id() {
+        return out_channel_id;
+    }
+
+    public void setOut_channel_id(String out_channel_id) {
+        this.out_channel_id = out_channel_id;
+    }
+
+    public String getOrder_id() {
+        return order_id;
+    }
+
+    public void setOrder_id(String order_id) {
+        this.order_id = order_id;
+    }
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getAuth_code() {
+        return auth_code;
+    }
+
+    public void setAuth_code(String auth_code) {
+        this.auth_code = auth_code;
+    }
+
+    public String getFreereasons() {
+        return freereasons;
+    }
+
+    public void setFreereasons(String freereasons) {
+        this.freereasons = freereasons;
+    }
+
+    public String getC_type() {
+        return c_type;
+    }
+
+    public void setC_type(String c_type) {
+        this.c_type = c_type;
+    }
+
+    public String getDuration() {
+        return duration;
+    }
+
+    public void setDuration(String duration) {
+        this.duration = duration;
+    }
+
+    public String getTotal() {
+        return total;
+    }
+
+    public void setTotal(String total) {
+        this.total = total;
+    }
+
+    public String getOut_time() {
+        return out_time;
+    }
+
+    public void setOut_time(String out_time) {
+        this.out_time = out_time;
+    }
+
+    public String getCar_type() {
+        return car_type;
+    }
+
+    public void setCar_type(String car_type) {
+        this.car_type = car_type;
+    }
+
+    public String getAmount_receivable() {
+        return amount_receivable;
+    }
+
+    public void setAmount_receivable(String amount_receivable) {
+        this.amount_receivable = amount_receivable;
+    }
+
+    public String getTs_state() {
+        return ts_state;
+    }
+
+    public void setTs_state(String ts_state) {
+        this.ts_state = ts_state;
+    }
+}

+ 32 - 0
Extra.java

@@ -0,0 +1,32 @@
+package com.happy.Model;
+
+public class Extra {
+
+    public String car_number;
+    public String num;   // 随行人数
+    public String bu;   // 部门
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getNum() {
+        return num;
+    }
+
+    public void setNum(String num) {
+        this.num = num;
+    }
+
+    public String getBu() {
+        return bu;
+    }
+
+    public void setBu(String bu) {
+        this.bu = bu;
+    }
+}

+ 28 - 0
GetHttpParam.java

@@ -0,0 +1,28 @@
+package com.happy.unitil;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.parser.Feature;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+public class GetHttpParam {
+
+    public static JSONObject getHttpParam(HttpServletRequest request){
+        //处理业务业务
+        JSONObject jsonObject = new JSONObject();
+        try {
+            BufferedReader streamReader = new BufferedReader( new InputStreamReader(request.getInputStream(), "UTF-8"));
+            StringBuilder responseStrBuilder = new StringBuilder();
+            String inputStr;
+            while ((inputStr = streamReader.readLine()) != null)
+                responseStrBuilder.append(inputStr);
+
+            jsonObject = JSONObject.parseObject(responseStrBuilder.toString(), Feature.OrderedField);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return jsonObject;
+    }
+}

+ 585 - 0
HttpsClient.java

@@ -0,0 +1,585 @@
+package com.happy.common.http;
+
+import com.alibaba.fastjson.JSONObject;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import com.happy.Model.Message;
+import com.happy.Model.Visitor;
+import com.happy.common.wx.WxConfig;
+import com.happy.common.wx.WxConstants;
+import com.happy.common.wx.WxUtil;
+import com.happy.unitil.CreateSign1;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * HttpsClient类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class HttpsClient {
+
+    /**
+     * GET请求方式
+     */
+    public static final String METHOD_GET = "GET";
+    /**
+     * POST请求方式
+     */
+    public static final String METHOD_POST = "POST";
+    /**
+     * 连接超时时间
+     */
+    private static Integer CONNECTION_TIMEOUT = WxConfig.connectionTimeout;
+    /**
+     * 请求超时时间
+     */
+    private static Integer READ_TIMEOUT = WxConfig.readTimeout;
+
+    /**
+     * 发起https请求
+     *
+     * @param requestUrl    请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData      提交数据
+     * @return JSONObject
+     */
+    public static JSONObject httpsRequestReturnJSONObject(String requestUrl, String requestMethod, String postData) throws Exception {
+        JSONObject jsonObject = JSONObject.parseObject(HttpsClient.httpsRequestReturnString(requestUrl, requestMethod, postData));
+        System.out.println("jsonObjectDate:  " + jsonObject);
+        return jsonObject;
+    }
+
+
+    /**
+     * 发起https请求
+     *
+     * @param requestUrl    请求地址
+     * @param requestMethod 请求方式(Get或者post)
+     * @param postData      提交数据
+     * @return String
+     */
+    public static String httpsRequestReturnString(String requestUrl, String requestMethod, String postData) throws Exception {
+        String response;
+        HttpsURLConnection httpsUrlConnection = null;
+        try {
+            //创建https请求证书
+            TrustManager[] tm = {new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf = sslContext.getSocketFactory();
+
+            // 创建URL对象
+            URL url = new URL(requestUrl);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象
+            httpsUrlConnection = (HttpsURLConnection) url.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+
+            //设置header信息
+            httpsUrlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+            //设置User-Agent信息
+            httpsUrlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
+            //设置可接受信息
+            httpsUrlConnection.setDoOutput(true);
+            //设置可输入信息
+            httpsUrlConnection.setDoInput(true);
+            //不使用缓存
+            httpsUrlConnection.setUseCaches(false);
+            //设置请求方式(GET/POST)
+            httpsUrlConnection.setRequestMethod(requestMethod);
+            //设置连接超时时间
+            if (CONNECTION_TIMEOUT > 0) {
+                httpsUrlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setConnectTimeout(10000);
+            }
+            //设置请求超时
+            if (READ_TIMEOUT > 0) {
+                httpsUrlConnection.setReadTimeout(READ_TIMEOUT);
+            } else {
+                //默认10秒超时
+                httpsUrlConnection.setReadTimeout(10000);
+            }
+            //设置编码
+            httpsUrlConnection.setRequestProperty("Charsert", WxConstants.DEFAULT_CHARSET);
+
+            //判断是否需要提交数据
+            if (StringUtils.equals(requestMethod, HttpsClient.METHOD_POST) && StringUtils.isNotBlank(postData)) {
+                //讲参数转换为字节提交
+                byte[] bytes = postData.getBytes(WxConstants.DEFAULT_CHARSET);
+                //设置头信息
+                httpsUrlConnection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
+                //开始连接
+                httpsUrlConnection.connect();
+                //防止中文乱码
+                OutputStream outputStream = httpsUrlConnection.getOutputStream();
+                outputStream.write(postData.getBytes(WxConstants.DEFAULT_CHARSET));
+                outputStream.flush();
+                outputStream.close();
+            } else {
+                //开始连接
+                httpsUrlConnection.connect();
+            }
+            response = WxUtil.getStreamString(httpsUrlConnection.getInputStream());
+        } catch (Exception e) {
+            throw new Exception();
+        } finally {
+            if (httpsUrlConnection != null) {
+                // 关闭连接
+                httpsUrlConnection.disconnect();
+            }
+        }
+        return response;
+    }
+
+
+    public static void get(String url, Map<String, String> params) {
+        CloseableHttpClient httpClient = null;
+        HttpGet httpGet = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            String ps = "";
+            for (String pKey : params.keySet()) {
+                if (!"".equals(ps)) {
+                    ps = ps + "&";
+                }
+                ps = pKey + "=" + params.get(pKey);
+            }
+            if (!"".equals(ps)) {
+                url = url + "?" + ps;
+            }
+            httpGet = new HttpGet(url);
+            httpGet.setConfig(requestConfig);
+            CloseableHttpResponse response = httpClient.execute(httpGet);
+            HttpEntity httpEntity = response.getEntity();
+            System.out.println(EntityUtils.toString(httpEntity, "utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (httpGet != null) {
+                    httpGet.releaseConnection();
+                }
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static String get(String strURL) throws Exception {
+
+        URL url = new URL(strURL);
+        HttpURLConnection httpConn = (HttpURLConnection)
+                url.openConnection();
+        httpConn.setRequestMethod("GET");
+        httpConn.connect();
+        System.out.println("bbb: " + httpConn.getResponseCode());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(
+                httpConn.getInputStream(), "utf-8"));
+        String line;
+        StringBuffer buffer = new StringBuffer();
+        while ((line = reader.readLine()) != null) {
+            buffer.append(line);
+        }
+        reader.close();
+        httpConn.disconnect();
+
+        return buffer.toString();
+    }
+
+    /**
+     * 发送 post请求
+     *
+     * @param
+     * @param
+     */
+    public static void post(String url, Map<String, String> params) {
+        CloseableHttpClient httpClient = null;
+        HttpPost httpPost = null;
+        try {
+            httpClient = HttpClients.createDefault();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(20000).setConnectTimeout(20000).build();
+            httpPost = new HttpPost(url);
+            httpPost.setConfig(requestConfig);
+            List<NameValuePair> ps = new ArrayList<NameValuePair>();
+            for (String pKey : params.keySet()) {
+                ps.add(new BasicNameValuePair(pKey, params.get(pKey)));
+            }
+            httpPost.setEntity(new UrlEncodedFormEntity(ps));
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            HttpEntity httpEntity = response.getEntity();
+            System.out.println(EntityUtils.toString(httpEntity, "utf-8"));
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (httpPost != null) {
+                    httpPost.releaseConnection();
+                }
+                if (httpClient != null) {
+                    httpClient.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8"));
+            // 发送请求参数
+            out.print("&" + param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream(), "utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+
+    //url表示请求链接,param表示json格式的请求参数		//自定义菜单创建访问方式
+    public static String sendPost2(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            HttpsURLConnection httpsUrlConnection = null;
+            //创建https请求证书
+            TrustManager[] tm = {new MyX509TrustManager()};
+            //创建SSLContext管理器对像,使用我们指定的信任管理器初始化
+            SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
+            sslContext.init(null, tm, new java.security.SecureRandom());
+            SSLSocketFactory ssf = sslContext.getSocketFactory();
+            // 创建URL对象
+            URL realUrl = new URL(url);
+            // 创建HttpsURLConnection对象,并设置其SSLSocketFactory对象,
+            // 打开和URL之间的连接
+            httpsUrlConnection = (HttpsURLConnection) realUrl.openConnection();
+            //设置ssl证书
+            httpsUrlConnection.setSSLSocketFactory(ssf);
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            httpsUrlConnection.setRequestMethod("POST");
+            httpsUrlConnection.setDoOutput(true);
+            httpsUrlConnection.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(httpsUrlConnection.getOutputStream(), "utf-8"));
+            // 发送请求参数
+            out.print("&" + param);
+            // flush输出流的缓冲
+            out.flush();
+            if (httpsUrlConnection.getResponseCode() == 200) {
+                // 定义BufferedReader输入流来读取URL的响应
+                in = new BufferedReader(
+                        new InputStreamReader(httpsUrlConnection.getInputStream(), "utf-8"));
+                String line;
+                while ((line = in.readLine()) != null) {
+                    result += line;
+                }
+            } else {
+                result = "获取输入流异常!";
+            }
+        } catch (Exception e) {
+            System.out.println("发送 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String sendPost3(String url, String param) {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性 注意Authorization生成
+            // conn.setRequestProperty("Content-Type",
+            // "application/x-www-form-urlencoded");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8"));
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String sendJson(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            int length = (int) connection.getContentLength();// 获取长度
+            if (length != -1) {
+                byte[] data = new byte[length];
+                byte[] temp = new byte[512];
+                int readLen = 0;
+                int destPos = 0;
+                while ((readLen = is.read(temp)) > 0) {
+                    System.arraycopy(temp, 0, data, destPos, readLen);
+                    destPos += readLen;
+                }
+                result = new String(data, "UTF-8"); // utf-8编码
+                System.out.println("主机返回:" + result);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    public static String sendJson2(String request_url, JSONObject json) {
+        OutputStreamWriter out = null;
+        InputStream is = null;
+        String result = "";
+        try {
+            URL url = new URL(request_url);// 创建连接
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+            connection.setDoOutput(true);
+            connection.setDoInput(true);
+            connection.setUseCaches(false);
+            connection.setInstanceFollowRedirects(true);
+            connection.setRequestMethod("POST"); // 设置请求方式
+            // 设置接收数据的格式
+            connection.setRequestProperty("Accept", "application/json");
+            // 设置发送数据的格式
+            connection.setRequestProperty("Content-Type", "application/json");
+            connection.connect();
+            out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
+            out.append(json.toString());
+            out.flush();
+            out.close();
+            // 读取响应
+            is = connection.getInputStream();
+            BufferedReader in = new BufferedReader(new InputStreamReader(is));
+            result = in.readLine();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                is.close();
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+//    public static void main(String[] args) throws Exception {
+//        JSONObject json = new JSONObject();
+//        String ukey = "6VMZEC5C6HZM7EO8";
+//        JSONObject datas = new JSONObject();
+//        datas.put("car_number", "赣555555");
+//        datas.put("begin_time", 1630800000);
+//        datas.put("end_time", 1630918800);
+//        datas.put("mobile", "15399990000");
+//        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+//        String sign = datas.toJSONString()+"key="+ukey;
+//        sign = CreateSign1.MD5(sign).toUpperCase();
+//        json.put("service_name", "visitor_sync");
+//        json.put("sign", sign);
+//        json.put("park_id", "10033845");
+//        json.put("data", datas);
+//        String msg = sendJson2("http://istparking.sciseetech.com/public/visitor/do", json);
+//        System.out.println(msg);
+//    }
+
+//    public static void main(String[] args) {
+//        JSONObject json = new JSONObject();
+//        String ukey = "6VMZEC5C6HZM7EO8";
+//        JSONObject datas = new JSONObject();
+//        // 1新增 2编辑 3删除
+//        datas.put("operate_type", "1");
+//        // 白名单编号(收费系统唯一编号)
+//        datas.put("card_id", "20210810556");
+//        datas.put("car_number", "冀A111118");
+//        datas.put("mobile", "15399990000");
+//        // 是否长期类型1是,0否,默认0
+//        datas.put("end_type", "0");
+//        datas.put("b_time", 1630800000);
+//        datas.put("e_time", 1630918800);
+//        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+//        String sign = datas.toJSONString()+"key="+ukey;
+//        sign = CreateSign1.MD5(sign).toUpperCase();
+//        json.put("service_name", "white_vip");
+//        json.put("sign", sign);
+//        json.put("park_id", "10033845");
+//        json.put("data", datas);
+//        String msg = sendJson2("http://istparking.sciseetech.com/public/vip/white", json);
+//        Gson gson=new Gson();
+//        HashMap<String, String> userMoney = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+//        System.out.println(msg);
+//    }
+
+//    public static void main(String[] args) throws Exception {
+//        JSONObject data = new JSONObject();
+//        data.put("carNumber", "赣555555");
+//        data.put("parkId", "10033845");
+//        data.put("type", "2");  // 进出类别 1进、2出
+//        data.put("recordTime", "2021-11-10 17:02:25");
+//        String msg = sendJson2("https://chtech.ncjti.edu.cn/bigdata-api/api/intoAndOut/carIntoAndOutRecordUpload", data);
+//        System.out.println(msg);
+//    }
+
+    public static void main(String[] args) {
+        String msg = HttpsClient.sendPost(
+                "https://open.wecard.qq.com/cgi-bin/oauth2/token?app_key="+
+                        "48103AB41FFBC5FE&app_secret=5B7FB4D3CC243695EED3693044D0FC54&grant_type=client_credentials&scope=base&ocode=1015730314", "");
+        Gson gson=new Gson();
+        HashMap<String, String> userMap = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+        String token = userMap.get("access_token");
+        System.out.println(token);
+        JSONObject data = new JSONObject();
+        ArrayList<String> as = new ArrayList<>();
+        as.add("REG4377000007");
+        String json = JSONObject.toJSONString(as);
+        data.put("cards", json);
+        data.put("title", "访客预约结果");
+        data.put("content", "预约成功");  // 进出类别 1进、2出
+        data.put("sender", "保卫处");
+        String msg2 = sendJson2("https://open.wecard.qq.com/cgi-bin/notice/send?access_token="+token, data);
+        System.out.println(msg2);
+    }
+
+}

+ 281 - 0
IOSchoolAction.java

@@ -0,0 +1,281 @@
+package com.happy.action;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.Model.OutSchool;
+import com.happy.Model.Visitor;
+import com.happy.common.http.HttpsClient;
+import com.happy.common.http.TimeExchange;
+import com.happy.service.IOSchoolService;
+import com.happy.unitil.CombinatorialQuery;
+import com.happy.unitil.CreateSign1;
+import com.happy.unitil.ResUtil;
+import com.happy.unitil.ResponseUtil;
+import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+public class IOSchoolAction extends ActionSupport implements ServletRequestAware {
+
+    private HttpServletRequest request;
+    public HttpServletResponse response;
+
+    public Integer id;
+    public String ids;
+    private String sort;// 排序依据字段名
+    private String order;// 排序方式
+    private int rows;// 每页显示的行数rows
+    private int page; // 当前页
+    private String advanceFilter;// 组合查询条件
+    private String filterRules;// 过滤组件条件
+
+    @Resource
+    public IOSchoolService ioSchoolService;
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public void setServletRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(HttpServletResponse response) {
+        this.response = response;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getIds() {
+        return ids;
+    }
+
+    public void setIds(String ids) {
+        this.ids = ids;
+    }
+
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
+    }
+
+    public String getOrder() {
+        return order;
+    }
+
+    public void setOrder(String order) {
+        this.order = order;
+    }
+
+    public int getRows() {
+        return rows;
+    }
+
+    public void setRows(int rows) {
+        this.rows = rows;
+    }
+
+    public int getPage() {
+        return page;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    public String getAdvanceFilter() {
+        return advanceFilter;
+    }
+
+    public void setAdvanceFilter(String advanceFilter) {
+        this.advanceFilter = advanceFilter;
+    }
+
+    public String getFilterRules() {
+        return filterRules;
+    }
+
+    public void setFilterRules(String filterRules) {
+        this.filterRules = filterRules;
+    }
+
+    public String inschoolList() {
+        // 返回前端数据
+        JSONObject resultJson = new JSONObject();
+        // List<User> listAll = null;
+        List<Data2> listPage = null;
+        int total = 0;
+        if (sort != null || advanceFilter != null
+                && !advanceFilter.equals("[]") || filterRules != null
+                && !filterRules.equals("[]")) {
+            String sql = CombinatorialQuery.queryOne(advanceFilter, sort,
+                    order, filterRules);
+            total = ioSchoolService.findCombInschoolTotal(sql);
+            listPage = ioSchoolService.combGetInSchoolList(sql, page, rows);
+        } else {
+            total = ioSchoolService.findCombInschoolTotal(" ");
+            listPage = ioSchoolService.combGetInSchoolList(" ", page, rows);
+        }
+        if (total != 0) {
+            resultJson.put("rows", listPage);
+            resultJson.put("total", total);// 总记录数
+            int totalPage = total % rows == 0 ? (total / rows)
+                    : (total / rows) + 1;// 总页数
+            resultJson.put("totalPage", totalPage);
+            resultJson.put("currentPage", page);// 当前页
+            resultJson.put("numPerPage", rows);// 每页数
+            resultJson.put("nextPage", totalPage - page == 0 ? page : page + 1);// 下一页
+            resultJson.put("previousPage", page - 0 == 1 ? page : page - 1);// 上一页
+            resultJson.put("hasPreviousPage", true);// 有上一页
+            resultJson.put("hasNextPage", true);// 有下一页
+            resultJson.put("firstPage", true);// 首页
+            resultJson.put("lastPage", true);// 尾页
+        } else {
+            resultJson.put("rows", "");
+            resultJson.put("total", 0);
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    public String outschoolList() {
+        // 返回前端数据
+        JSONObject resultJson = new JSONObject();
+        // List<User> listAll = null;
+        List<Data3> listPage = null;
+        int total = 0;
+        if (sort != null || advanceFilter != null
+                && !advanceFilter.equals("[]") || filterRules != null
+                && !filterRules.equals("[]")) {
+            String sql = CombinatorialQuery.queryOne(advanceFilter, sort,
+                    order, filterRules);
+            total = ioSchoolService.findCombOutschoolTotal(sql);
+            listPage = ioSchoolService.combGetOutSchoolList(sql, page, rows);
+        } else {
+            total = ioSchoolService.findCombOutschoolTotal(" ");
+            listPage = ioSchoolService.combGetOutSchoolList(" ", page, rows);
+        }
+        if (total != 0) {
+            resultJson.put("rows", listPage);
+            resultJson.put("total", total);// 总记录数
+            int totalPage = total % rows == 0 ? (total / rows)
+                    : (total / rows) + 1;// 总页数
+            resultJson.put("totalPage", totalPage);
+            resultJson.put("currentPage", page);// 当前页
+            resultJson.put("numPerPage", rows);// 每页数
+            resultJson.put("nextPage", totalPage - page == 0 ? page : page + 1);// 下一页
+            resultJson.put("previousPage", page - 0 == 1 ? page : page - 1);// 上一页
+            resultJson.put("hasPreviousPage", true);// 有上一页
+            resultJson.put("hasNextPage", true);// 有下一页
+            resultJson.put("firstPage", true);// 首页
+            resultJson.put("lastPage", true);// 尾页
+        } else {
+            resultJson.put("rows", "");
+            resultJson.put("total", 0);
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    // 进校记录写到第三方接口
+    public String insertIn(){
+        Gson gson=new Gson();
+        com.alibaba.fastjson.JSONObject js = new com.alibaba.fastjson.JSONObject();
+        List<Data2> ins = ioSchoolService.queryInSchool();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String date = sf.format(new Date());
+        if (ins!=null){
+            for (int i=0; i<ins.size(); i++){
+                com.alibaba.fastjson.JSONObject datas = new com.alibaba.fastjson.JSONObject();
+                datas.put("carNumber", ins.get(i).getCar_number());
+                datas.put("parkId", "10033845");
+                datas.put("type", "1");
+                if (ins.get(i).getIn_time()==null || ins.get(i).getIn_time().equals("")) {
+                    datas.put("recordTime", date);
+                } else {
+                    datas.put("recordTime", TimeExchange.timestampToString(Integer.parseInt(ins.get(i).getIn_time())));
+                }
+                String msg = HttpsClient.sendJson2("https://chtech.ncjti.edu.cn/bigdata-api/api/intoAndOut/carIntoAndOutRecordUpload", datas);
+                System.out.println(msg);
+                HashMap<String, Object> mess = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, Object>>(){}.getType());
+                String message = mess.get("message").toString();
+                if (message.equals("执行成功")){
+                    ioSchoolService.updateInState(ins.get(i).getId());
+                }
+                js.put("msg", msg);
+                ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+            }
+        }else {
+            js.put("msg", "今日没有进入记录");
+            ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+        }
+        return null;
+    }
+
+    // 进校记录写到第三方接口
+    public String insertOut(){
+        Gson gson=new Gson();
+        com.alibaba.fastjson.JSONObject js = new com.alibaba.fastjson.JSONObject();
+        List<Data3> outs = ioSchoolService.queryOutSchool();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String date = sf.format(new Date());
+        if (outs!=null){
+            for (int i=0; i<outs.size(); i++){
+                com.alibaba.fastjson.JSONObject datas = new com.alibaba.fastjson.JSONObject();
+                datas.put("carNumber", outs.get(i).getCar_number());
+                datas.put("parkId", "10033845");
+                datas.put("type", "2");
+                if (outs.get(i).getOut_time() == null || outs.get(i).getOut_time().equals("")) {
+                    datas.put("recordTime", date);
+                } else {
+                    datas.put("recordTime", TimeExchange.timestampToString(Integer.parseInt(outs.get(i).getOut_time())));
+                }
+                String msg = HttpsClient.sendJson2("https://chtech.ncjti.edu.cn/bigdata-api/api/intoAndOut/carIntoAndOutRecordUpload", datas);
+                System.out.println(msg);
+                HashMap<String, Object> mess = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, Object>>(){}.getType());
+                String message = mess.get("message").toString();
+                if (message.equals("执行成功")){
+                    ioSchoolService.updateOutState(outs.get(i).getId());
+                }
+                js.put("msg", msg);
+                ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+            }
+        }else {
+            js.put("msg", "今日没有进入记录");
+            ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+        }
+        return null;
+    }
+
+}

+ 26 - 0
IOSchoolService.java

@@ -0,0 +1,26 @@
+package com.happy.service;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+
+import java.util.List;
+
+public interface IOSchoolService {
+
+    public List<Data2> queryInSchool();
+
+    public List<Data3> queryOutSchool();
+
+    public int updateInState(Integer id);
+
+    public int updateOutState(Integer id);
+
+    public List<Data2> combGetInSchoolList(String sqlx, int page, int rows);
+
+    public int findCombInschoolTotal(String sqlx);
+
+    public List<Data3> combGetOutSchoolList(String sqlx, int page, int rows);
+
+    public int findCombOutschoolTotal(String sqlx);
+
+}

+ 50 - 0
IOSchoolServiceImpl.java

@@ -0,0 +1,50 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.dao.IOschoolDao;
+import com.happy.service.AdminService;
+import com.happy.service.IOSchoolService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("IOSchoolService")
+public class IOSchoolServiceImpl implements IOSchoolService {
+
+    @Resource
+    public IOschoolDao iOschoolDao;
+
+    public List<Data2> queryInSchool(){
+        return iOschoolDao.queryInSchool();
+    };
+
+    public List<Data3> queryOutSchool(){
+        return iOschoolDao.queryOutSchool();
+    };
+
+    public int updateInState(Integer id){
+        return iOschoolDao.updateInState(id);
+    };
+
+    public int updateOutState(Integer id){
+        return iOschoolDao.updateOutState(id);
+    };
+
+    public List<Data2> combGetInSchoolList(String sqlx, int page, int rows){
+        return iOschoolDao.combGetInSchoolList(sqlx,page,rows);
+    }
+
+    public int findCombInschoolTotal(String sqlx){
+        return iOschoolDao.findCombInschoolTotal(sqlx);
+    }
+
+    public List<Data3> combGetOutSchoolList(String sqlx, int page, int rows){
+        return iOschoolDao.combGetOutSchoolList(sqlx,page,rows);
+    }
+
+    public int findCombOutschoolTotal(String sqlx){
+        return iOschoolDao.findCombOutschoolTotal(sqlx);
+    }
+}

+ 25 - 0
IOschoolDao.java

@@ -0,0 +1,25 @@
+package com.happy.dao;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+
+import java.util.List;
+
+public interface IOschoolDao {
+
+    public List<Data2> queryInSchool();
+
+    public List<Data3> queryOutSchool();
+
+    public int updateInState(Integer id);
+
+    public int updateOutState(Integer id);
+
+    public List<Data2> combGetInSchoolList(String sqlx, int page, int rows);
+
+    public int findCombInschoolTotal(String sqlx);
+
+    public List<Data3> combGetOutSchoolList(String sqlx, int page, int rows);
+
+    public int findCombOutschoolTotal(String sqlx);
+}

+ 115 - 0
IOschoolDaoImpl.java

@@ -0,0 +1,115 @@
+package com.happy.dao.impl;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.dao.IOschoolDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("InschoolDao")
+public class IOschoolDaoImpl implements IOschoolDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public List<Data2> queryInSchool(){
+        String sql="select * from inschool where ts_state='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Data2> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data2>(Data2.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public List<Data3> queryOutSchool(){
+        String sql="select * from outschool where ts_state='1' ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Data3> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data3>(Data3.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int updateInState(Integer id){
+        String sql = "update inschool set `ts_state`=2 where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int updateOutState(Integer id){
+        String sql = "update outschool set `ts_state`=2 where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public List<Data2> combGetInSchoolList(String sqlx, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql="select * from inschool " + sqlx + " limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<Data2> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data2>(Data2.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int findCombInschoolTotal(String sqlx) {
+        String sql = "select count(*) from inschool " + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    public List<Data3> combGetOutSchoolList(String sqlx, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql="select * from outschool " + sqlx + " limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<Data3> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data3>(Data3.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int findCombOutschoolTotal(String sqlx) {
+        String sql = "select count(*) from outschool " + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+}

+ 216 - 0
IndexAction.java

@@ -0,0 +1,216 @@
+package com.happy.action;
+
+import com.happy.Model.Admin;
+import com.happy.Model.TreMenu;
+import com.happy.Model.TwoMenu;
+import com.happy.service.OneMenuService;
+import com.happy.service.TreMenuService;
+import com.happy.service.TwoMenuService;
+import com.happy.unitil.ResponseUtil;
+import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.springframework.stereotype.Controller;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 首页action
+ * 
+ * @author zjs
+ * 
+ */
+@Controller
+public class IndexAction extends ActionSupport implements ServletRequestAware {
+
+	private HttpServletRequest request;
+
+	public HttpServletRequest getRequest() {
+		return request;
+	}
+
+	public void setRequest(HttpServletRequest request) {
+		this.request = request;
+	}
+
+	@Resource
+	private OneMenuService oneMenuService;
+	@Resource
+	private TwoMenuService twoMenuService;
+	@Resource
+	private TreMenuService treMenuService;
+
+	public TreMenuService getTreMenuService() {
+		return treMenuService;
+	}
+
+	public void setTreMenuService(TreMenuService treMenuService) {
+		this.treMenuService = treMenuService;
+	}
+
+	public TwoMenuService getTwoMenuService() {
+		return twoMenuService;
+	}
+
+	public void setTwoMenuService(TwoMenuService twoMenuService) {
+		this.twoMenuService = twoMenuService;
+	}
+
+	public OneMenuService getOneMenuService() {
+		return oneMenuService;
+	}
+
+	public void setOneMenuService(OneMenuService oneMenuService) {
+		this.oneMenuService = oneMenuService;
+	}
+
+	public void setServletRequest(HttpServletRequest request) {
+		this.request = request;
+	}
+
+	private Integer pid;
+	private int id;
+	private String uuid;
+	private String[] order_account;
+
+	public String[] getOrder_account() {
+		return order_account;
+	}
+
+	public void setOrder_account(String[] order_account) {
+		this.order_account = order_account;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public Integer getPid() {
+		return pid;
+	}
+
+	public void setPid(Integer pid) {
+		this.pid = pid;
+	}
+
+	/*
+	 * //一级菜单 public String oneMenu() throws Exception{ //从session获取admin_id
+	 * Admin admin=(Admin)
+	 * ServletActionContext.getRequest().getSession().getAttribute("admin");
+	 * String isLogin = (String)
+	 * ServletActionContext.getRequest().getSession().getAttribute("isLogin");
+	 * //System.out.println(isLogin); JSONObject resultJson = new JSONObject();
+	 * List<OneMenu> list = oneMenuService.getOneMenuList();
+	 * resultJson.put("menu",list);
+	 * ResponseUtil.writeJson(ServletActionContext.getResponse
+	 * (),resultJson.toString()); // System.out.println(resultJson); return
+	 * null; }
+	 */
+	// 二级菜单
+	public String twoMenu() throws Exception {
+		Admin admin = (Admin) ServletActionContext.getRequest().getSession()
+				.getAttribute("admin");
+		if (admin != null) {
+			if (admin.getLevel() == 1) { // 超级管理员默认查询当前一级菜单的所有二级菜单
+				JSONObject json = new JSONObject();
+				List<TwoMenu> l = twoMenuService.getTwoMenu1(pid);
+				// List<List<TwoMenu>> list = new ArrayList<List<TwoMenu>>();
+				// list.add(l);
+				/*
+				 * int len=l.size()-1;//最大下标 String twomenu="["; for(int
+				 * i=0;i<l.size();i++){ if(i==len){ twomenu+="{"+l.get(i)+"}";
+				 * }else{ twomenu+="{"+l.get(i)+"},"; } } twomenu+="]";
+				 */
+				JSONArray listArray = JSONArray.fromObject(l);
+				// JSONObject jsonOb = JSONObject.fromObject(listArray);
+				ResponseUtil.write(listArray,
+						ServletActionContext.getResponse());
+			}
+		}
+		return null;
+	}
+
+	// 三级菜单
+	public String treMenu() throws Exception {
+
+		Admin admin = (Admin) ServletActionContext.getRequest().getSession()
+				.getAttribute("admin");
+		if (admin != null) {
+			if (admin.getLevel() == 1) { // 超级管理员默认查询当前二级菜单的所有二级菜单
+				List<TreMenu> l = treMenuService.getTreMenu(pid);
+				JSONArray listArray = JSONArray.fromObject(l);
+				// json.put("level", 10);
+				ResponseUtil.write(listArray,
+						ServletActionContext.getResponse());
+			}
+		}
+		return null;
+	}
+
+	// 树形菜单
+	public String tree() throws Exception {
+		int pid[] = { 1, 2, 3, 4, 5 };// 所有一级
+		// JSONObject json = new JSONObject();
+		List<List<TwoMenu>> list = new ArrayList<List<TwoMenu>>();
+		String msg = "";
+		for (int i = 0; i < pid.length; i++) {
+			List<TwoMenu> l = twoMenuService.getTwoMenu1(pid[i]);
+			for (int j = 0; j < l.size(); j++) {
+				JSONObject js1 = JSONObject.fromObject(l.get(j));
+				String m = js1.toString();
+				m = m.substring(0, m.length() - 1) + ",children:[";
+				List<TreMenu> l1 = treMenuService.getTreMenu(l.get(j).getId());
+				for (int k = 0; k < l1.size(); k++) {
+					JSONObject js2 = JSONObject.fromObject(l1.get(k));
+					m = m + js2.toString() + ",";
+				}
+				m = m.substring(0, m.length() - 1) + "]},";
+				msg = msg + m;
+			}
+
+		}
+		msg = "[" + msg.substring(0, msg.length() - 1) + "]";
+		// JSONObject jss = new JSONObject(msg);
+		// System.out.println(msg);
+		// json.put("success", true);
+		ResponseUtil.write(msg, ServletActionContext.getResponse());
+		return null;
+	}
+	/*
+	 * public String info() throws Exception{ if(uuid!=null){ return "info"; }
+	 * return null; } /*public String select()throws Exception{ if(id!=0){
+	 * System.out.println(id); } JSONObject json = new JSONObject();
+	 * json.put("carton_type", "对口箱"); json.put("model_name", "对口箱1");
+	 * json.put("carton_length", "58"); json.put("carton_width", "54");
+	 * json.put("carton_height", "53"); json.put("spec_type", "制造尺寸");
+	 * json.put("material_science", "B636B"); json.put("pit_type", "BC");
+	 * json.put("carton_color", "灰白"); json.put("pack_num", "50");
+	 * json.put("line_type", "外压"); json.put("fabric_width", "20");
+	 * json.put("isnail", "是"); json.put("isviscose", "否"); //String msg =
+	 * "[{\"iconCls\": \"closed\", \"id\": 201, \"level\": \"1\", \"pid\": 1, \"state\": \"colos\", \"text\": \"物资损耗管理 \", \"url\": \"\"}]"
+	 * ; ResponseUtil.write(json, ServletActionContext.getResponse()); return
+	 * null; } public String test() throws Exception{ JSONObject json = new
+	 * JSONObject(); json.put("msg", 1);
+	 * 
+	 * System.out.println(uuid); ResponseUtil.write(json,
+	 * ServletActionContext.getResponse()); return null; }
+	 */
+
+}

+ 235 - 0
InfoAction.java

@@ -0,0 +1,235 @@
+package com.happy.action;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.domain.InsCertificate;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.*;
+import com.happy.common.http.HttpsClient;
+import com.happy.common.http.TimeExchange;
+import com.happy.service.userService;
+import com.happy.unitil.CreateSign1;
+import com.happy.unitil.GetHttpParam;
+import com.happy.unitil.ResUtil;
+import com.opensymphony.xwork2.ActionSupport;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+public class InfoAction extends ActionSupport implements ServletRequestAware {
+
+    private HttpServletRequest request;
+    public HttpServletResponse response;
+
+    @Resource
+    public userService userService;
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public void setServletRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(HttpServletResponse response) {
+        this.response = response;
+    }
+
+    public String index(){
+        return "list";
+    }
+
+    // 从微卡下载访客
+    public String insertIn(){
+        System.out.println("开始下载");
+        String msg = HttpsClient.sendPost(
+                "https://open.wecard.qq.com/cgi-bin/oauth2/token?app_key="+
+                        "4AE0333C42903337&app_secret=08376122777FF135E9AFE60EF4B5702D&grant_type=client_credentials&scope=base&ocode=1015730314", "");
+        Gson gson=new Gson();
+        HashMap<String, String> userMap = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+        String token = userMap.get("access_token");
+        Calendar cal = Calendar.getInstance();
+        // 往前多少天的访客
+        cal.add(Calendar.DATE,   -1);
+        String time1 = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss").format(cal.getTime());
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
+        String time2 = df.format(new Date());
+        String created_at_min = String.valueOf(TimeExchange.StringToTimestamp(time1));
+        String created_at_max = String.valueOf(TimeExchange.StringToTimestamp(time2));
+        String message = HttpsClient.sendPost("https://open.wecard.qq.com/app-visit/open/get-appt-list?access_token="
+                        +token+"&created_at_min="
+                        +created_at_min+"&created_at_max="
+                        +created_at_max+""
+                , "");
+        System.out.println("访客信息: ");
+        System.out.println(message);
+        Message messMap = gson.fromJson(message.toString(), new TypeToken<Message>(){}.getType());
+        List<Visitor> lv = messMap.getList();
+        for (int i=0; i<lv.size(); i++){
+            List<Visitor> lvi = userService.queryByCard(lv.get(i).getCard_number(), lv.get(i).getCreated_time());
+            if (lvi == null) {
+                Visitor vs = new Visitor();
+                vs.setVisitor_name(lv.get(i).getVisitor_name());
+                vs.setVisitor_phone(lv.get(i).getVisitor_phone().replaceAll("\\(\\+86\\)", ""));
+                vs.setReason(lv.get(i).getExtra_fields().get("访问事由").toString());
+                System.out.println("访问事由");
+                System.out.println(lv.get(i).getExtra_fields().get("访问事由"));
+                vs.setStatus(lv.get(i).getStatus());
+                vs.setStatus_with_time(lv.get(i).getStatus_with_time());
+                vs.setCard_number(lv.get(i).getCard_number());
+                vs.setVisited_at(lv.get(i).getVisited_at());
+                vs.setId_card_img(lv.get(i).getId_card_img());
+                vs.setCreated_time(lv.get(i).getCreated_time());
+                vs.setVisit_start_time(lv.get(i).getVisit_start_time());
+                vs.setVisit_end_time(lv.get(i).getVisit_end_time());
+                vs.setMember_name(lv.get(i).getMember_name());
+                vs.setMember_phone(lv.get(i).getMember_phone().replaceAll("\\(\\+86\\)", ""));
+                vs.setMember_org(lv.get(i).getMember_org());
+                try {
+                    vs.setCar_number(lv.get(i).getExtra_fields().get("车牌号").toString());
+                }catch (Exception e){
+                    vs.setCar_number("不开车");
+                }
+                vs.setTime(TimeExchange.TimestampToDate(Integer.parseInt(lv.get(i).getCreated_time())).toString());
+                userService.insertInfo(vs);
+            }else {
+                System.out.println("重复");
+            }
+        }
+        JSONObject json = new JSONObject();
+        json.put("msg", "下载成功");
+        ResUtil.writeJson(ServletActionContext.getResponse(), json.toString());
+        return null;
+    }
+
+    // 查询访客列表
+    public String queryVisitor(){
+
+        return null;
+    }
+
+    // 写到第三方接口
+    public String insertOut(){
+        JSONObject json = new JSONObject();
+        JSONObject js = new JSONObject();
+        Calendar cal = Calendar.getInstance();
+        // 往前多少天的访客
+        cal.add(Calendar.DATE,   1);
+        String time = new SimpleDateFormat( "yyyy-MM-dd").format(cal.getTime());
+        System.out.println(time);
+        List<Visitor> visitors = userService.queryByTime(time);
+        if (visitors!=null){
+            for (int i=0; i<visitors.size(); i++){
+                if(!visitors.get(i).getCar_number().equals("不开车")) {
+                    System.out.println(visitors.get(i).getCar_number());
+                    String ukey = "6VMZEC5C6HZM7EO8";
+                    JSONObject datas = new JSONObject();
+                    datas.put("car_number", visitors.get(i).getCar_number());
+                    datas.put("begin_time", visitors.get(i).getVisit_start_time());
+                    datas.put("end_time", visitors.get(i).getVisit_end_time());
+                    datas.put("mobile", visitors.get(i).getVisitor_phone());
+                    // 生成带签名的字符串并使用MD5生成签名,然后转大写
+                    String sign = datas.toJSONString() + "key=" + ukey;
+                    sign = CreateSign1.MD5(sign).toUpperCase();
+                    json.put("service_name", "visitor_sync");
+                    json.put("sign", sign);
+                    json.put("park_id", "10033845");
+                    json.put("data", datas);
+                    String msg = HttpsClient.sendJson("http://istparking.sciseetech.com/public/visitor/do", json);
+                    System.out.println(msg);
+                    userService.updateVisiState(visitors.get(i).getCar_number(), visitors.get(i).getVisit_start_time(), visitors.get(i).getVisit_end_time());
+                    js.put("msg", msg);
+                    ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+                }
+            }
+        }else {
+            js.put("msg", "今日没有访客");
+            ResUtil.writeJson(ServletActionContext.getResponse(), js.toString());
+        }
+        return null;
+    }
+
+    // 入停车场
+    public  String InPart(){
+        System.out.println("入场");
+        JSONObject resultjson = new JSONObject();
+        Gson gson=new Gson();
+        JSONObject json = GetHttpParam.getHttpParam(request);
+        System.out.println("json: "+json);
+        if (json == null){
+            resultjson.put("msg", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        Inschool userMap = null;
+        Data2 d2 = null;
+        try{
+            userMap = gson.fromJson(json.toString(), new TypeToken<Inschool>(){}.getType());
+            d2 = userMap.getData();
+            List<Data2> data2 = userService.queryInByCar(d2.getCar_number(), d2.getIn_time());
+            if (data2 != null){
+                resultjson.put("msg", "入场已导入!");
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+                return null;
+            }
+            userService.insertSchool(d2);
+        }catch (Exception e){
+            System.out.println("解析异常");
+            resultjson.put("msg", "参数格式有误!");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        return null;
+    }
+
+    // 出停车场
+    public String OutPart(){
+        System.out.println("出场");
+        JSONObject resultjson = new JSONObject();
+        Gson gson=new Gson();
+        JSONObject json = GetHttpParam.getHttpParam(request);
+        System.out.println("json: "+json);
+        if (json == null){
+            resultjson.put("msg", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        OutSchool userMap = null;
+        Data3 d3 = null;
+        try{
+            userMap = gson.fromJson(json.toString(), new TypeToken<OutSchool>(){}.getType());
+            d3 = userMap.getData();
+            List<Data3> data3 = userService.queryOutByCar(d3.getCar_number(), d3.getOut_time());
+            if (data3 != null){
+                resultjson.put("msg", "出场已导入!");
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+                return null;
+            }
+            userService.insertOutSchool(d3);
+        } catch (Exception e){
+            System.out.println("解析异常");
+            resultjson.put("msg", "参数格式有误!");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        return null;
+    }
+}

+ 41 - 0
Inschool.java

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+public class Inschool {
+
+    public String service_name;
+    public String park_id;
+    public String sign;
+    public Data2 data;
+
+    public String getService_name() {
+        return service_name;
+    }
+
+    public void setService_name(String service_name) {
+        this.service_name = service_name;
+    }
+
+    public String getPark_id() {
+        return park_id;
+    }
+
+    public void setPark_id(String park_id) {
+        this.park_id = park_id;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public Data2 getData() {
+        return data;
+    }
+
+    public void setData(Data2 data) {
+        this.data = data;
+    }
+}

+ 58 - 0
LoginFilter.java

@@ -0,0 +1,58 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.happy.filter;
+
+import javax.servlet.*;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.Enumeration;
+
+public class LoginFilter implements Filter {
+	Enumeration param;
+
+	public LoginFilter() {
+	}
+
+	public void init(FilterConfig filterConfig) throws ServletException {
+		this.param = filterConfig.getInitParameterNames();
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+		HttpServletRequest servletRequest = (HttpServletRequest)request;
+		HttpServletResponse servletResponse = (HttpServletResponse)response;
+		HttpSession session = servletRequest.getSession();
+		String path = servletRequest.getRequestURI();
+		String isLogin = (String)session.getAttribute("isLogin");
+		if (!path.contains("login.jsp") && !path.contains("/weixin/") &&
+				!path.contains("/loginlogin.action") &&
+				!path.contains("/infoinsertIn.action") &&
+				!path.contains("/infoinsertOut.action") &&
+				!path.contains("/infoInPart.action") &&
+				!path.contains("/infoOutPart.action") &&
+				!path.contains("ioschoolinsertIn.action")) {
+			if (isLogin != null && !"".equals(isLogin)) {
+				chain.doFilter(request, response);
+			} else {
+				StringBuffer fileURL = servletRequest.getRequestURL();
+				if (fileURL.indexOf(".css") > 0 || fileURL.indexOf(".png") > 0 || fileURL.indexOf(".jpg") > 0 || fileURL.indexOf(".bmp") > 0 || fileURL.indexOf(".gif") > 0 || fileURL.indexOf(".apk") > 0 || fileURL.indexOf(".ipa") > 0 || fileURL.indexOf(".woff") > 0 || fileURL.indexOf(".ttf") > 0 || fileURL.indexOf("image.jsp") > 0) {
+					chain.doFilter(servletRequest, servletResponse);
+					return;
+				}
+
+				String contextPath = servletRequest.getContextPath();
+				servletResponse.sendRedirect(contextPath + "/jsp/login.jsp");
+			}
+
+		} else {
+			chain.doFilter(servletRequest, servletResponse);
+		}
+	}
+
+	public void destroy() {
+	}
+}

+ 2 - 0
MANIFEST.MF

@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+

+ 34 - 0
Message.java

@@ -0,0 +1,34 @@
+package com.happy.Model;
+
+import java.util.List;
+
+public class Message {
+
+    public String code;
+    public String message;
+    public List<Visitor> list;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public List<Visitor> getList() {
+        return list;
+    }
+
+    public void setList(List<Visitor> list) {
+        this.list = list;
+    }
+}

+ 23 - 0
MyX509TrustManager.java

@@ -0,0 +1,23 @@
+package com.happy.common.http;
+
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * X509TrustManager用于实现SSL证书的安全校验
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class MyX509TrustManager implements X509TrustManager {
+    @Override
+    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {}
+
+    @Override
+    public X509Certificate[] getAcceptedIssuers() {
+        return null;
+    }
+}

+ 73 - 0
OneMenu.java

@@ -0,0 +1,73 @@
+package com.happy.Model;
+
+/**
+ * 一级菜单实体类
+ * 
+ * @author zjs 2017/12/19
+ */
+public class OneMenu {
+	private Integer id;
+	private Integer pid; // 父级菜单
+	private String text; // 菜单名字
+	private String state; // 菜单默认状态 打开/关闭
+	private String iconCls; // 菜单图标名称
+	private String url; // 菜单映射地址
+	private String level; // 菜单显示权限等级
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getPid() {
+		return pid;
+	}
+
+	public void setPid(Integer pid) {
+		this.pid = pid;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getState() {
+		return state;
+	}
+
+	public void setState(String state) {
+		this.state = state;
+	}
+
+	public String getIconCls() {
+		return iconCls;
+	}
+
+	public void setIconCls(String iconCls) {
+		this.iconCls = iconCls;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getLevel() {
+		return level;
+	}
+
+	public void setLevel(String level) {
+		this.level = level;
+	}
+
+}

+ 23 - 0
OneMenuDao.java

@@ -0,0 +1,23 @@
+package com.happy.dao;
+
+/**
+ * 一级菜单dao层接口
+ */
+
+import com.happy.Model.OneMenu;
+
+import java.util.List;
+
+public interface OneMenuDao {
+
+	/**
+	 * 根据用户查询并获得一级菜单
+	 * 
+	 * @return
+	 */
+	public List<OneMenu> getOneMenuList();
+	/**
+	 * 获取所有菜单
+	 */
+
+}

+ 40 - 0
OneMenuDaoImpl.java

@@ -0,0 +1,40 @@
+package com.happy.dao.impl;
+
+import com.happy.dao.OneMenuDao;
+import com.happy.Model.OneMenu;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("OneMenuDao")
+public class OneMenuDaoImpl implements OneMenuDao {
+
+	@Autowired
+	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+	public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+		return namedParameterJdbcTemplate;
+	}
+
+	public void setNamedParameterJdbcTemplate(
+			NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+		this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+	}
+
+	// 查询并获得一级菜单
+	public List<OneMenu> getOneMenuList() {
+		String sql = "select * from onemenu where 1 = 1";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		List<OneMenu> list = namedParameterJdbcTemplate.query(sql, sps,
+				new BeanPropertyRowMapper<OneMenu>(OneMenu.class));
+		if (list != null && list.size() > 0) {
+			return list;
+		}
+		return null;
+	}
+
+}

+ 18 - 0
OneMenuService.java

@@ -0,0 +1,18 @@
+package com.happy.service;
+
+/**
+ * 一级菜单业务接口
+ */
+
+import com.happy.Model.OneMenu;
+
+import java.util.List;
+
+public interface OneMenuService {
+	/**
+	 * 查询并获得一级菜单
+	 * 
+	 * @return
+	 */
+	public List<OneMenu> getOneMenuList();
+}

+ 30 - 0
OneMenuServiceImpl.java

@@ -0,0 +1,30 @@
+package com.happy.service.Impl;
+
+import com.happy.dao.OneMenuDao;
+import com.happy.Model.OneMenu;
+import com.happy.service.OneMenuService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("OneMenuService")
+public class OneMenuServiceImpl implements OneMenuService {
+
+	@Resource
+	private OneMenuDao oneMenuDao;
+
+	public void setOneMenuDao(OneMenuDao oneMenuDao) {
+		this.oneMenuDao = oneMenuDao;
+	}
+
+	public OneMenuDao getOneMenuDao() {
+		return oneMenuDao;
+	}
+
+	// 获取一级菜单
+	public List<OneMenu> getOneMenuList() {
+		return oneMenuDao.getOneMenuList();
+	}
+
+}

+ 41 - 0
OutSchool.java

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+public class OutSchool {
+
+    public String service_name;
+    public String sign;
+    public String park_id;
+    public Data3 data;
+
+    public String getService_name() {
+        return service_name;
+    }
+
+    public void setService_name(String service_name) {
+        this.service_name = service_name;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public String getPark_id() {
+        return park_id;
+    }
+
+    public void setPark_id(String park_id) {
+        this.park_id = park_id;
+    }
+
+    public Data3 getData() {
+        return data;
+    }
+
+    public void setData(Data3 data) {
+        this.data = data;
+    }
+}

+ 53 - 0
ResUtil.java

@@ -0,0 +1,53 @@
+package com.happy.unitil;
+
+import org.apache.poi.ss.usermodel.Workbook;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+public class ResUtil {
+
+	public static void write(Object o, HttpServletResponse response)
+			throws Exception {
+		response.setContentType("text/html;charset=utf-8");
+//		response.setHeader("Access-Control-Allow-Origin", "*");
+		PrintWriter out = response.getWriter();
+		out.println(o.toString());
+		out.flush();
+		out.close();
+	}
+
+	public static void write(String o, HttpServletResponse response)
+			throws Exception {
+		response.setContentType("text/html;charset=utf-8");
+		PrintWriter out = response.getWriter();
+		out.println(o.toString());
+		out.flush();
+		out.close();
+	}
+
+	public static void writeJson(HttpServletResponse respone, String result) {
+		respone.setContentType("application/json;charset=utf-8");
+		PrintWriter out;
+		try {
+			out = respone.getWriter();
+			out.print(result);
+			out.flush();
+			out.close();
+		} catch (Exception e) { 
+			// //System.out.println("Comm_Util_writeJson---->" + e);
+		}
+	}
+
+	public static void export(HttpServletResponse response, Workbook wb,
+			String fileName) throws Exception {
+		response.setHeader("Content-Disposition", "attachment;filename="
+				+ new String(fileName.getBytes("utf-8"), "iso8859-1"));
+		response.setContentType("application/ynd.ms-excel;charset=UTF-8");
+		OutputStream out = response.getOutputStream();
+		wb.write(out);
+		out.flush();
+		out.close();
+	}
+}

+ 52 - 0
ResponseUtil.java

@@ -0,0 +1,52 @@
+package com.happy.unitil;
+
+import org.apache.poi.ss.usermodel.Workbook;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+public class ResponseUtil {
+
+	public static void write(Object o, HttpServletResponse response)
+			throws Exception {
+		response.setContentType("text/html;charset=utf-8");
+		PrintWriter out = response.getWriter();
+		out.println(o.toString());
+		out.flush();
+		out.close();
+	}
+
+	public static void write(String o, HttpServletResponse response)
+			throws Exception {
+		response.setContentType("text/html;charset=utf-8");
+		PrintWriter out = response.getWriter();
+		out.println(o.toString());
+		out.flush();
+		out.close();
+	}
+
+	public static void writeJson(HttpServletResponse respone, String result) {
+		respone.setContentType("application/json;charset=utf-8");
+		PrintWriter out;
+		try {
+			out = respone.getWriter();
+			out.print(result);
+			out.flush();
+			out.close();
+		} catch (Exception e) {
+			// //System.out.println("Comm_Util_writeJson---->" + e);
+		}
+	}
+
+	public static void export(HttpServletResponse response, Workbook wb,
+			String fileName) throws Exception {
+		response.setHeader("Content-Disposition", "attachment;filename="
+				+ new String(fileName.getBytes("utf-8"), "iso8859-1"));
+		response.setContentType("application/ynd.ms-excel;charset=UTF-8");
+		OutputStream out = response.getOutputStream();
+		wb.write(out);
+		out.flush();
+		out.close();
+	}
+}

+ 42 - 0
SHA1.java

@@ -0,0 +1,42 @@
+package com.happy.common.util;
+import java.security.MessageDigest;
+
+/**
+ * 微信SHA1算法
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public final class SHA1 {
+
+    private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+
+    /**
+     *  将字节并格式化
+     * @param bytes 原始字节
+     * @return 格式化字节
+     */
+    private static String getFormattedText(byte[] bytes) {
+        int len = bytes.length;
+        StringBuilder buf = new StringBuilder(len * 2);
+        // 把密文转换成十六进制的字符串形式
+        for (int j = 0; j < len; j++) {
+            buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
+            buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
+        }
+        return buf.toString();
+    }
+
+    public static String encode(String str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
+            messageDigest.update(str.getBytes());
+            return getFormattedText(messageDigest.digest());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

+ 138 - 0
TimeExchange.java

@@ -0,0 +1,138 @@
+package com.happy.common.http;
+
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Car;
+import net.sf.json.JSONObject;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+
+/**
+ * 时间转化工具 date转为时间戳 时间戳转date 互相与String的转换
+ * 所有出现的String time 格式都必须为(yyyy-MM-dd HH:mm:ss),否则出错
+ * @author 赵仁杰
+ *
+ */
+public class TimeExchange {
+
+    /**
+     * String(yyyy-MM-dd HH:mm:ss) 转 Date
+     *
+     * @param time
+     * @return
+     * @throws ParseException
+     */
+    // String date = "2010/05/04 12:34:23";
+    public static Date StringToDate(String time) throws ParseException {
+
+        Date date = new Date();
+        // 注意format的格式要与日期String的格式相匹配
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            date = dateFormat.parse(time);
+            System.out.println(date.toString());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return date;
+    }
+
+    /**
+     * Date转为String(yyyy-MM-dd HH:mm:ss)
+     *
+     * @param time
+     * @return
+     */
+    public static String DateToString(Date time) {
+        String dateStr = "";
+        Date date = new Date();
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH/mm/ss");
+        try {
+            dateStr = dateFormat.format(time);
+            System.out.println(dateStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dateStr;
+    }
+    /**
+     * String(yyyy-MM-dd HH:mm:ss)转10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer StringToTimestamp(String time){
+
+        int times = 0;
+        try {
+            times = (int) ((Timestamp.valueOf(time).getTime())/1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if(times==0){
+            System.out.println("String转10位时间戳失败");
+        }
+        return times;
+
+    }
+    /**
+     * 10位int型的时间戳转换为String(yyyy-MM-dd HH:mm:ss)
+     * @param time
+     * @return
+     */
+    public static String timestampToString(Integer time){
+        //int转long时,先进行转型再进行计算,否则会是计算结束后在转型
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        String tsStr = "";
+        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        try {
+            //方法一
+            tsStr = dateFormat.format(ts);
+            System.out.println(tsStr);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return tsStr;
+    }
+    /**
+     * 10位时间戳转Date
+     * @param time
+     * @return
+     */
+    public static Date TimestampToDate(Integer time){
+        long temp = (long)time*1000;
+        Timestamp ts = new Timestamp(temp);
+        Date date = new Date();
+        try {
+            date = ts;
+            //System.out.println(date);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+    /**
+     * Date类型转换为10位时间戳
+     * @param time
+     * @return
+     */
+    public static Integer DateToTimestamp(Date time){
+        Timestamp ts = new Timestamp(time.getTime());
+
+        return (int) ((ts.getTime())/1000);
+    }
+
+    public static void main(String [] args){
+
+    }
+
+}
+

+ 41 - 0
Ting.java

@@ -0,0 +1,41 @@
+package com.happy.Model;
+
+public class Ting {
+
+    public String service_name;
+    public String sign;
+    public String park_id;
+    public Data data;
+
+    public String getService_name() {
+        return service_name;
+    }
+
+    public void setService_name(String service_name) {
+        this.service_name = service_name;
+    }
+
+    public String getSign() {
+        return sign;
+    }
+
+    public void setSign(String sign) {
+        this.sign = sign;
+    }
+
+    public String getPark_id() {
+        return park_id;
+    }
+
+    public void setPark_id(String park_id) {
+        this.park_id = park_id;
+    }
+
+    public Data getData() {
+        return data;
+    }
+
+    public void setData(Data data) {
+        this.data = data;
+    }
+}

+ 72 - 0
TreMenu.java

@@ -0,0 +1,72 @@
+package com.happy.Model;
+
+/**
+ * 三级菜单实体类
+ * 
+ * @author zjs 2017/12/19
+ */
+public class TreMenu {
+	private int id;
+	private int pid; // 父级菜单
+	private String text; // 菜单名字
+	private String state; // 菜单默认状态 打开/关闭
+	private String iconCls; // 菜单图标名称
+	private String url; // 菜单映射地址
+	private String level; // 菜单显示权限等级
+
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public int getPid() {
+		return pid;
+	}
+
+	public void setPid(int pid) {
+		this.pid = pid;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getState() {
+		return state;
+	}
+
+	public void setState(String state) {
+		this.state = state;
+	}
+
+	public String getIconCls() {
+		return iconCls;
+	}
+
+	public void setIconCls(String iconCls) {
+		this.iconCls = iconCls;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getLevel() {
+		return level;
+	}
+
+	public void setLevel(String level) {
+		this.level = level;
+	}
+}

+ 26 - 0
TreMenuDao.java

@@ -0,0 +1,26 @@
+package com.happy.dao;
+
+import com.happy.Model.TreMenu;
+
+import java.util.List;
+
+public interface TreMenuDao {
+	/**
+	 * 查询并获得三级菜单
+	 * 
+	 * @param pid
+	 * @return
+	 */
+	public List<TreMenu> getTreMenu(int pid);
+	/**
+	 * 超级管理员专用 查询并获得三级菜单
+	 * 
+	 * @param pid
+	 * @return
+	 */
+	// public List<TreMenu> getTreMenu1(int pid);
+	/**
+	 * 查询所有菜单修改权限添加权限专用
+	 */
+
+}

+ 48 - 0
TreMenuDaoImpl.java

@@ -0,0 +1,48 @@
+package com.happy.dao.impl;
+
+import com.happy.dao.TreMenuDao;
+import com.happy.Model.TreMenu;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("TreMenuDao")
+public class TreMenuDaoImpl implements TreMenuDao {
+
+	@Autowired
+	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+	public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+		return namedParameterJdbcTemplate;
+	}
+
+	public void setNamedParameterJdbcTemplate(
+			NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+		this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+	}
+
+	// 根据pid查询菜单列表
+	public List<TreMenu> getTreMenu(int pid) {
+		String sql = "select * from tremenu where pid=:pid ";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("pid", pid);
+		List<TreMenu> list = namedParameterJdbcTemplate.query(sql, sps,
+				new BeanPropertyRowMapper<TreMenu>(TreMenu.class));
+		if (list != null && list.size() > 0) {
+			return list;
+		}
+		return null;
+	}
+	/*
+	 * //根据pid查询菜单列表 public List<TreMenu> getTreMenu(int pid) { String
+	 * sql="select * from tremenu where 1=1"; MapSqlParameterSource sps = new
+	 * MapSqlParameterSource(); sps.addValue("pid", pid); List<TreMenu> list =
+	 * namedParameterJdbcTemplate.query(sql, sps, new
+	 * BeanPropertyRowMapper<TreMenu>(TreMenu.class)); if(list != null &&
+	 * list.size()>0){ return list; } return null; }
+	 */
+}

+ 22 - 0
TreMenuService.java

@@ -0,0 +1,22 @@
+package com.happy.service;
+
+import com.happy.Model.TreMenu;
+
+import java.util.List;
+
+public interface TreMenuService {
+	/**
+	 * 查询并获得三级菜单
+	 * 
+	 * @param pid
+	 * @return
+	 */
+	public List<TreMenu> getTreMenu(int pid);
+	/**
+	 * 超级管理员专用 查询并获得三级菜单
+	 * 
+	 * @param pid
+	 * @return
+	 */
+	// public List<TreMenu> getTreMenu1(int pid);
+}

+ 28 - 0
TreMenuServiceImpl.java

@@ -0,0 +1,28 @@
+package com.happy.service.Impl;
+
+import com.happy.dao.TreMenuDao;
+import com.happy.Model.TreMenu;
+import com.happy.service.TreMenuService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("TreMenuService")
+public class TreMenuServiceImpl implements TreMenuService {
+	@Resource
+	private TreMenuDao treMenuDao;
+
+	public TreMenuDao getTreMenuDao() {
+		return treMenuDao;
+	}
+
+	public void setTreMenuDao(TreMenuDao treMenuDao) {
+		this.treMenuDao = treMenuDao;
+	}
+
+	public List<TreMenu> getTreMenu(int pid) {
+		return treMenuDao.getTreMenu(pid);
+	}
+
+}

+ 72 - 0
TwoMenu.java

@@ -0,0 +1,72 @@
+package com.happy.Model;
+
+/**
+ * 二级菜单实体类
+ * 
+ * @author zjs 2017/12/19
+ */
+public class TwoMenu {
+	private int id;
+	private int pid; // 父级菜单
+	private String text; // 菜单名字
+	private String state; // 菜单默认状态 打开/关闭
+	private String iconCls; // 菜单图标名称
+	private String url; // 菜单映射地址
+	private String level; // 菜单显示权限等级
+
+	public int getId() {
+		return id;
+	}
+
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	public int getPid() {
+		return pid;
+	}
+
+	public void setPid(int pid) {
+		this.pid = pid;
+	}
+
+	public String getText() {
+		return text;
+	}
+
+	public void setText(String text) {
+		this.text = text;
+	}
+
+	public String getState() {
+		return state;
+	}
+
+	public void setState(String state) {
+		this.state = state;
+	}
+
+	public String getIconCls() {
+		return iconCls;
+	}
+
+	public void setIconCls(String iconCls) {
+		this.iconCls = iconCls;
+	}
+
+	public String getUrl() {
+		return url;
+	}
+
+	public void setUrl(String url) {
+		this.url = url;
+	}
+
+	public String getLevel() {
+		return level;
+	}
+
+	public void setLevel(String level) {
+		this.level = level;
+	}
+}

+ 18 - 0
TwoMenuDao.java

@@ -0,0 +1,18 @@
+package com.happy.dao;
+
+import com.happy.Model.TwoMenu;
+
+import java.util.List;
+
+public interface TwoMenuDao {
+	/**
+	 * 查询并获得二级菜单
+	 */
+	public List<TwoMenu> getTwoMenu(int pid);
+
+	/**
+	 * 超级管理员专用 查询并获得二级菜单
+	 */
+	public List<TwoMenu> getTwoMenu1(int pid);
+
+}

+ 51 - 0
TwoMenuDaoImpl.java

@@ -0,0 +1,51 @@
+package com.happy.dao.impl;
+
+import com.happy.dao.TwoMenuDao;
+import com.happy.Model.TwoMenu;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("TwoMenuDao")
+public class TwoMenuDaoImpl implements TwoMenuDao {
+	@Autowired
+	private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+	public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+		return namedParameterJdbcTemplate;
+	}
+
+	public void setNamedParameterJdbcTemplate(
+			NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+		this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+	}
+
+	public List<TwoMenu> getTwoMenu(int pid) {
+		String sql = "select id,pid,text,state,iconCls,url,level from twomenu where id=:pid";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("pid", pid);
+		List<TwoMenu> list = namedParameterJdbcTemplate.query(sql, sps,
+				new BeanPropertyRowMapper<TwoMenu>(TwoMenu.class));
+		if (list != null && list.size() > 0) {
+			return list;
+		}
+		return null;
+	}
+
+	public List<TwoMenu> getTwoMenu1(int pid) {
+		String sql = "select id,pid,text,state,iconCls,url,level from twomenu where pid=:pid";
+		MapSqlParameterSource sps = new MapSqlParameterSource();
+		sps.addValue("pid", pid);
+		List<TwoMenu> list = namedParameterJdbcTemplate.query(sql, sps,
+				new BeanPropertyRowMapper<TwoMenu>(TwoMenu.class));
+		if (list != null && list.size() > 0) {
+			return list;
+		}
+		return null;
+	}
+
+}

+ 17 - 0
TwoMenuService.java

@@ -0,0 +1,17 @@
+package com.happy.service;
+
+import com.happy.Model.TwoMenu;
+
+import java.util.List;
+
+public interface TwoMenuService {
+	/**
+	 * 查询并获得二级菜单
+	 */
+	public List<TwoMenu> getTwoMenu(int pid);
+
+	/**
+	 * 超级管理员专用 查询并获得二级菜单
+	 */
+	public List<TwoMenu> getTwoMenu1(int pid);
+}

+ 32 - 0
TwoMenuServiceImpl.java

@@ -0,0 +1,32 @@
+package com.happy.service.Impl;
+
+import com.happy.dao.TwoMenuDao;
+import com.happy.Model.TwoMenu;
+import com.happy.service.TwoMenuService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("TwoMenuService")
+public class TwoMenuServiceImpl implements TwoMenuService {
+	@Resource
+	private TwoMenuDao twoMenuDao;
+
+	public TwoMenuDao getTwoMenuDao() {
+		return twoMenuDao;
+	}
+
+	public void setTwoMenuDao(TwoMenuDao twoMenuDao) {
+		this.twoMenuDao = twoMenuDao;
+	}
+
+	public List<TwoMenu> getTwoMenu(int pid) {
+		return twoMenuDao.getTwoMenu(pid);
+	}
+
+	public List<TwoMenu> getTwoMenu1(int pid) {
+		return twoMenuDao.getTwoMenu1(pid);
+	}
+
+}

+ 179 - 0
Visitor.java

@@ -0,0 +1,179 @@
+package com.happy.Model;
+
+import java.util.HashMap;
+import java.util.List;
+
+public class Visitor {
+
+    public Integer id;
+    public String visitor_name;
+    public String visitor_phone;
+    public String reason;
+    public String status;
+    public String status_with_time;
+    public String card_number;
+    public String visited_at;
+    public String id_card_img;
+    public String created_time;
+    public HashMap<String, Object> extra_fields;
+    public String visit_start_time;
+    public String visit_end_time;
+    public String member_name;
+    public String member_phone;
+    public String member_org;
+    public String car_number;
+    public String time;
+    public Integer state;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getVisitor_name() {
+        return visitor_name;
+    }
+
+    public void setVisitor_name(String visitor_name) {
+        this.visitor_name = visitor_name;
+    }
+
+    public String getVisitor_phone() {
+        return visitor_phone;
+    }
+
+    public void setVisitor_phone(String visitor_phone) {
+        this.visitor_phone = visitor_phone;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getStatus_with_time() {
+        return status_with_time;
+    }
+
+    public void setStatus_with_time(String status_with_time) {
+        this.status_with_time = status_with_time;
+    }
+
+    public String getCard_number() {
+        return card_number;
+    }
+
+    public void setCard_number(String card_number) {
+        this.card_number = card_number;
+    }
+
+    public String getVisited_at() {
+        return visited_at;
+    }
+
+    public void setVisited_at(String visited_at) {
+        this.visited_at = visited_at;
+    }
+
+    public String getId_card_img() {
+        return id_card_img;
+    }
+
+    public void setId_card_img(String id_card_img) {
+        this.id_card_img = id_card_img;
+    }
+
+    public String getCreated_time() {
+        return created_time;
+    }
+
+    public void setCreated_time(String created_time) {
+        this.created_time = created_time;
+    }
+
+    public HashMap<String, Object> getExtra_fields() {
+        return extra_fields;
+    }
+
+    public void setExtra_fields(HashMap<String, Object> extra_fields) {
+        this.extra_fields = extra_fields;
+    }
+
+    public String getVisit_start_time() {
+        return visit_start_time;
+    }
+
+    public void setVisit_start_time(String visit_start_time) {
+        this.visit_start_time = visit_start_time;
+    }
+
+    public String getVisit_end_time() {
+        return visit_end_time;
+    }
+
+    public void setVisit_end_time(String visit_end_time) {
+        this.visit_end_time = visit_end_time;
+    }
+
+    public String getMember_name() {
+        return member_name;
+    }
+
+    public void setMember_name(String member_name) {
+        this.member_name = member_name;
+    }
+
+    public String getMember_phone() {
+        return member_phone;
+    }
+
+    public void setMember_phone(String member_phone) {
+        this.member_phone = member_phone;
+    }
+
+    public String getMember_org() {
+        return member_org;
+    }
+
+    public void setMember_org(String member_org) {
+        this.member_org = member_org;
+    }
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public Integer getState() {
+        return state;
+    }
+
+    public void setState(Integer state) {
+        this.state = state;
+    }
+}

+ 484 - 0
VisitorAction.java

@@ -0,0 +1,484 @@
+package com.happy.action;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Visitor;
+import com.happy.common.http.HttpsClient;
+import com.happy.common.http.TimeExchange;
+import com.happy.service.VisitorService;
+import com.happy.service.userService;
+import com.happy.unitil.CombinatorialQuery;
+import com.happy.unitil.CreateSign1;
+import com.happy.unitil.ResponseUtil;
+import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+public class VisitorAction extends ActionSupport implements ServletRequestAware {
+
+    private HttpServletRequest request;
+    public HttpServletResponse response;
+
+    @Resource
+    public VisitorService visitorService;
+
+    @Resource
+    public userService userService;
+
+    public Integer id;
+    public String ids;
+    private String sort;// 排序依据字段名
+    private String order;// 排序方式
+    private int rows;// 每页显示的行数rows
+    private int page; // 当前页
+    private String advanceFilter;// 组合查询条件
+    private String filterRules;// 过滤组件条件
+    public String visitor_name;
+    public String visitor_phone;
+    public String car_number;
+    public String reason;
+    public String visit_start_time;
+    public String visit_end_time;
+    public String member_name;
+    public String member_phone;
+    public String member_org;
+    public String state;
+    public String card_number;
+    public String time;
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public void setServletRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(HttpServletResponse response) {
+        this.response = response;
+    }
+
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
+    }
+
+    public String getOrder() {
+        return order;
+    }
+
+    public void setOrder(String order) {
+        this.order = order;
+    }
+
+    public int getRows() {
+        return rows;
+    }
+
+    public void setRows(int rows) {
+        this.rows = rows;
+    }
+
+    public int getPage() {
+        return page;
+    }
+
+    public void setPage(int page) {
+        this.page = page;
+    }
+
+    public String getAdvanceFilter() {
+        return advanceFilter;
+    }
+
+    public void setAdvanceFilter(String advanceFilter) {
+        this.advanceFilter = advanceFilter;
+    }
+
+    public String getFilterRules() {
+        return filterRules;
+    }
+
+    public void setFilterRules(String filterRules) {
+        this.filterRules = filterRules;
+    }
+
+    public String getVisitor_name() {
+        return visitor_name;
+    }
+
+    public void setVisitor_name(String visitor_name) {
+        this.visitor_name = visitor_name;
+    }
+
+    public String getVisitor_phone() {
+        return visitor_phone;
+    }
+
+    public void setVisitor_phone(String visitor_phone) {
+        this.visitor_phone = visitor_phone;
+    }
+
+    public String getCar_number() {
+        return car_number;
+    }
+
+    public void setCar_number(String car_number) {
+        this.car_number = car_number;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getVisit_start_time() {
+        return visit_start_time;
+    }
+
+    public void setVisit_start_time(String visit_start_time) {
+        this.visit_start_time = visit_start_time;
+    }
+
+    public String getVisit_end_time() {
+        return visit_end_time;
+    }
+
+    public void setVisit_end_time(String visit_end_time) {
+        this.visit_end_time = visit_end_time;
+    }
+
+    public String getMember_name() {
+        return member_name;
+    }
+
+    public void setMember_name(String member_name) {
+        this.member_name = member_name;
+    }
+
+    public String getMember_phone() {
+        return member_phone;
+    }
+
+    public void setMember_phone(String member_phone) {
+        this.member_phone = member_phone;
+    }
+
+    public String getMember_org() {
+        return member_org;
+    }
+
+    public void setMember_org(String member_org) {
+        this.member_org = member_org;
+    }
+
+    public String getIds() {
+        return ids;
+    }
+
+    public void setIds(String ids) {
+        this.ids = ids;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getCard_number() {
+        return card_number;
+    }
+
+    public void setCard_number(String card_number) {
+        this.card_number = card_number;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public String list() {
+        // 返回前端数据
+        JSONObject resultJson = new JSONObject();
+        // List<User> listAll = null;
+        List<Visitor> listPage = null;
+        int total = 0;
+        if (sort != null || advanceFilter != null
+                && !advanceFilter.equals("[]") || filterRules != null
+                && !filterRules.equals("[]")) {
+            String sql = CombinatorialQuery.queryOne(advanceFilter, sort,
+                    order, filterRules);
+            total = visitorService.findCombPageTotal(sql);
+            listPage = visitorService.combGetInfoList(sql, page, rows);
+        } else {
+            total = visitorService.findInfoTotal();
+            listPage = visitorService.getlist(page, rows);
+        }
+        if (total != 0) {
+            resultJson.put("rows", listPage);
+            resultJson.put("total", total);// 总记录数
+            int totalPage = total % rows == 0 ? (total / rows)
+                    : (total / rows) + 1;// 总页数
+            resultJson.put("totalPage", totalPage);
+            resultJson.put("currentPage", page);// 当前页
+            resultJson.put("numPerPage", rows);// 每页数
+            resultJson.put("nextPage", totalPage - page == 0 ? page : page + 1);// 下一页
+            resultJson.put("previousPage", page - 0 == 1 ? page : page - 1);// 上一页
+            resultJson.put("hasPreviousPage", true);// 有上一页
+            resultJson.put("hasNextPage", true);// 有下一页
+            resultJson.put("firstPage", true);// 首页
+            resultJson.put("lastPage", true);// 尾页
+        } else {
+            resultJson.put("rows", "");
+            resultJson.put("total", 0);
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    public String add(){
+        JSONObject resultJson = new JSONObject();
+        Visitor vs = new Visitor();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String date = sf.format(new Date());
+        Integer time1 = TimeExchange.StringToTimestamp(visit_start_time);
+        Integer time2 = TimeExchange.StringToTimestamp(visit_end_time);
+        Integer time3 = TimeExchange.StringToTimestamp(date);
+        vs.setVisitor_name(visitor_name);
+        vs.setVisitor_phone(visitor_phone);
+        vs.setReason(reason);
+        vs.setCar_number(car_number);
+        vs.setCreated_time(String.valueOf(time3));
+        vs.setVisit_start_time(String.valueOf(time1));
+        vs.setVisit_end_time(String.valueOf(time2));
+        vs.setMember_name(member_name);
+        vs.setMember_phone(member_phone);
+        vs.setMember_org(member_org);
+        vs.setTime(date);
+        int num = visitorService.insertInfo(vs);
+        if (num >= 0) {
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "操作成功!");
+        } else {
+            resultJson.put("statusCode", "500");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "操作失败!");
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    public String del(){
+        JSONObject resultJson = new JSONObject();
+        String sql = "delete from info where id in ( '" + ids.replaceAll(",", "','") + "' )";
+        System.out.println(sql);
+        int num = visitorService.delInfo(sql);
+        if (num >= 0) {
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "操作成功!");
+        } else {
+            resultJson.put("statusCode", "500");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "操作失败!");
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    public String queryById(){
+        List<Visitor> list = visitorService.queryById(id);
+        JSONObject info = JSONObject.fromObject(list.get(0));
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                info.toString());
+        return null;
+    }
+
+    // 添加到vip白名单
+    public String toWhite(){
+        JSONObject resultJson = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
+        String ukey = "6VMZEC5C6HZM7EO8";
+        com.alibaba.fastjson.JSONObject datas = new com.alibaba.fastjson.JSONObject();
+        SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
+        String date = sf.format(new Date());
+        // 1新增 2编辑 3删除
+        datas.put("operate_type", "1");
+        // 白名单编号(收费系统唯一编号)
+        datas.put("card_id", date);
+        datas.put("car_number", car_number);
+        datas.put("mobile", visitor_phone);
+        datas.put("user_name", visitor_name);
+        // 是否长期类型1是,0否,默认0
+        datas.put("end_type", "0");
+        datas.put("b_time", TimeExchange.StringToTimestamp(visit_start_time));
+        datas.put("e_time", TimeExchange.StringToTimestamp(visit_end_time));
+        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+        String sign = datas.toJSONString()+"key="+ukey;
+        sign = CreateSign1.MD5(sign).toUpperCase();
+        json.put("service_name", "white_vip");
+        json.put("sign", sign);
+        json.put("park_id", "10033845");
+        json.put("data", datas);
+        String msg = HttpsClient.sendJson2("http://istparking.sciseetech.com/public/vip/white", json);
+        Gson gson=new Gson();
+        HashMap<String, String> mess = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+        String errmsg = mess.get("errmsg");
+        if (errmsg.equals("成功")){
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", errmsg);
+        }else {
+            resultJson.put("statusCode", "500");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", errmsg);
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    // 添加到第三方访客列表
+    public String toVisitor(){
+        JSONObject resultJson = new JSONObject();
+        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
+        if (state.equals("2")){
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "此记录已推送");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                    resultJson.toString());
+            return null;
+        }
+        String ukey = "6VMZEC5C6HZM7EO8";
+        com.alibaba.fastjson.JSONObject datas = new com.alibaba.fastjson.JSONObject();
+        System.out.println("车牌号:"+car_number);
+        System.out.println("时间戳:"+visit_end_time);
+        datas.put("car_number", car_number);
+        datas.put("begin_time", visit_start_time);
+        datas.put("end_time", visit_end_time);
+        datas.put("mobile", visitor_phone);
+        // 生成带签名的字符串并使用MD5生成签名,然后转大写
+        String sign = datas.toJSONString() + "key=" + ukey;
+        sign = CreateSign1.MD5(sign).toUpperCase();
+        json.put("service_name", "visitor_sync");
+        json.put("sign", sign);
+        json.put("park_id", "10033845");
+        json.put("data", datas);
+        String msg = HttpsClient.sendJson("http://istparking.sciseetech.com/public/visitor/do", json);
+        userService.updateVisiStateById(id);
+        Gson gson=new Gson();
+        HashMap<String, String> mess = gson.fromJson(msg.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+        String errmsg = mess.get("errmsg");
+        System.out.println(errmsg);
+        if (errmsg.equals("新增成功")){
+            String msg2 = HttpsClient.sendPost(
+                    "https://open.wecard.qq.com/cgi-bin/oauth2/token?app_key="+
+                            "48103AB41FFBC5FE&app_secret=5B7FB4D3CC243695EED3693044D0FC54&grant_type=client_credentials&scope=base&ocode=1015730314", "");
+            HashMap<String, String> userMap = gson.fromJson(msg2.toString(), new TypeToken<HashMap<String, String>>(){}.getType());
+            String token = userMap.get("access_token");
+            ArrayList<String> as = new ArrayList<>();
+            as.add(card_number);
+            String card = com.alibaba.fastjson.JSONObject.toJSONString(as);
+            com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
+            data.put("cards", card);
+            data.put("title", "访客预约结果");
+            data.put("content", "访客:"+visitor_name+"-预约成功,"+"预约时间:"+time);  // 进出类别 1进、2出
+            data.put("sender", "保卫处");
+            String msg3 = HttpsClient.sendJson2("https://open.wecard.qq.com/cgi-bin/notice/send?access_token="+token, data);
+            System.out.println(msg3);
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", errmsg);
+        }
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+
+    public String refuse(){
+        JSONObject resultJson = new JSONObject();
+        if (state.equals("2")){
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "此记录已推送");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                    resultJson.toString());
+            return null;
+        }
+        int m = userService.updateVisiStateNoById(id);
+        if (m>0) {
+            String msg3 = HttpsClient.sendPost(
+                    "https://open.wecard.qq.com/cgi-bin/oauth2/token?app_key="+
+                            "48103AB41FFBC5FE&app_secret=5B7FB4D3CC243695EED3693044D0FC54&grant_type=client_credentials&scope=base&ocode=1015730314", "");
+            Gson gson = new Gson();
+            HashMap<String, String> userMap = gson.fromJson(msg3.toString(), new TypeToken<HashMap<String, String>>() {
+            }.getType());
+            String token = userMap.get("access_token");
+            ArrayList<String> as = new ArrayList<>();
+            as.add(card_number);
+            String json = com.alibaba.fastjson.JSONObject.toJSONString(as);
+            com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
+            data.put("cards", json);
+            data.put("title", "访客预约结果");
+            data.put("content", "访客:"+visitor_name+"-预约失败,"+"预约时间:"+time);  // 进出类别 1进、2出
+            data.put("sender", "保卫处");
+            String msg2 = HttpsClient.sendJson2("https://open.wecard.qq.com/cgi-bin/notice/send?access_token=" + token, data);
+            resultJson.put("statusCode", "200");
+            resultJson.put("title", "操作提示");
+            resultJson.put("message", "已拒绝");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                    resultJson.toString());
+            return null;
+        }
+        resultJson.put("statusCode", "500");
+        resultJson.put("title", "操作提示");
+        resultJson.put("message", "操作失败");
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),
+                resultJson.toString());
+        return null;
+    }
+}

+ 22 - 0
VisitorDao.java

@@ -0,0 +1,22 @@
+package com.happy.dao;
+
+import com.happy.Model.Visitor;
+
+import java.util.List;
+
+public interface VisitorDao {
+
+    public List<Visitor> combGetInfoList(String sqlx, int page, int rows);
+
+    public int findCombPageTotal(String sqlx);
+
+    public int findInfoTotal();
+
+    public List<Visitor> getlist(int page, int rows);
+
+    public int insertInfo(Visitor visitor);
+
+    public int delInfo(String sql);
+
+    public List<Visitor> queryById(Integer id);
+}

+ 119 - 0
VisitorDaoImpl.java

@@ -0,0 +1,119 @@
+package com.happy.dao.impl;
+
+import com.happy.Model.Visitor;
+import com.happy.dao.VisitorDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("Visitor")
+public class VisitorDaoImpl implements VisitorDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public List<Visitor> combGetInfoList(String sqlx, int page, int rows){
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql="select * from info " + sqlx + " limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<Visitor> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Visitor>(Visitor.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int findCombPageTotal(String sqlx) {
+        String sql = "select count(*) from info " + sqlx;
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    public int findInfoTotal() {
+        String sql = "select count(*) from info ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("fake", 0);
+        return namedParameterJdbcTemplate.queryForInt(sql, sps);
+    }
+
+    // 根据当前页和每页条数查询所有员工
+    public List<Visitor> getlist(int page, int rows) {
+        int start = (page - 1) * rows;// 每页的起始下标
+        String sql = "select * from info order by id desc limit :start,:rows ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("start", start);
+        sps.addValue("rows", rows);
+        List<Visitor> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Visitor>(Visitor.class));
+        return list;
+    }
+
+    public int insertInfo(Visitor visitor){
+        String sql = "insert into info(visitor_name, visitor_phone, reason, status, status_with_time, card_number, visited_at, id_card_img, created_time, visit_start_time, visit_end_time, member_name, member_phone, member_org, car_number, time) values(:visitor_name, :visitor_phone, :reason, :status, :status_with_time, :card_number, :visited_at, :id_card_img, :created_time, :visit_start_time, :visit_end_time, :member_name, :member_phone, :member_org, :car_number, :time)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("visitor_name", visitor.getVisitor_name());
+        sps.addValue("visitor_phone", visitor.getVisitor_phone());
+        sps.addValue("reason", visitor.getReason());
+        sps.addValue("status", visitor.getStatus());
+        sps.addValue("status_with_time", visitor.getStatus_with_time());
+        sps.addValue("card_number", visitor.getCard_number());
+        sps.addValue("visited_at", visitor.getVisited_at());
+        sps.addValue("id_card_img", visitor.getId_card_img());
+        sps.addValue("created_time", visitor.getCreated_time());
+        sps.addValue("visit_start_time", visitor.getVisit_start_time());
+        sps.addValue("visit_end_time", visitor.getVisit_end_time());
+        sps.addValue("member_name", visitor.getMember_name());
+        sps.addValue("member_phone", visitor.getMember_phone());
+        sps.addValue("member_org", visitor.getMember_org());
+        sps.addValue("car_number", visitor.getCar_number());
+        sps.addValue("time", visitor.getTime());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int delInfo(String sql){
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public List<Visitor> queryById(Integer id){
+        String sql = "select * from info where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        List<Visitor> list = namedParameterJdbcTemplate.query(sql, sps,
+                new BeanPropertyRowMapper<Visitor>(Visitor.class));
+        if (list != null && list.size() > 0) {
+            return list;
+        }
+        return null;
+    }
+
+}

+ 22 - 0
VisitorService.java

@@ -0,0 +1,22 @@
+package com.happy.service;
+
+import com.happy.Model.Visitor;
+
+import java.util.List;
+
+public interface VisitorService {
+
+    public List<Visitor> combGetInfoList(String sqlx, int page, int rows);
+
+    public int findCombPageTotal(String sqlx);
+
+    public int findInfoTotal();
+
+    public List<Visitor> getlist(int page, int rows);
+
+    public int insertInfo(Visitor visitor);
+
+    public int delInfo(String sql);
+
+    public List<Visitor> queryById(Integer id);
+}

+ 46 - 0
VisitorServiceImpl.java

@@ -0,0 +1,46 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Visitor;
+import com.happy.dao.VisitorDao;
+import com.happy.dao.userDao;
+import com.happy.service.VisitorService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+@Service("VisitorService")
+public class VisitorServiceImpl implements VisitorService {
+
+    @Resource
+    private VisitorDao visitorDao;
+
+    public List<Visitor> combGetInfoList(String sqlx, int page, int rows){
+        return visitorDao.combGetInfoList(sqlx, page, rows);
+    }
+
+    public int findCombPageTotal(String sqlx){
+        return visitorDao.findCombPageTotal(sqlx);
+    }
+
+    public int findInfoTotal(){
+        return visitorDao.findInfoTotal();
+    }
+
+    public List<Visitor> getlist(int page, int rows){
+        return visitorDao.getlist(page, rows);
+    }
+
+    public int insertInfo(Visitor visitor){
+        return visitorDao.insertInfo(visitor);
+    }
+
+    public int delInfo(String sql){
+        return visitorDao.delInfo(sql);
+    }
+
+    public List<Visitor> queryById(Integer id){
+        return visitorDao.queryById(id);
+    }
+}

+ 53 - 0
WxConfig.java

@@ -0,0 +1,53 @@
+package com.happy.common.wx;
+
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+
+/**
+ * 微信公众号开发配置类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+@Component
+public class WxConfig {
+
+    /**
+     * 开发者ID
+     */
+    public static String apicode = "CS0001";
+
+
+    /**
+     * 商户号
+     */
+    public static String apikey  = "XMZnRsZe61hEXyYa7JuAtUupJZ2Q5byc";
+
+
+    /**
+     * 统一下单-通知链接
+     */
+    public static String unifiedorderNotifyUrl = "https://app.dev.9kbs.com/";
+
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer connectionTimeout = 15000;
+
+    /**
+     * 连接超时时间
+     */
+    public static Integer readTimeout = 15000;
+
+    //支付map缓存处理
+    private static HashMap<String,String> payMap = new HashMap<String,String>();
+    public static String getPayMap(String key) {
+        return payMap.get(key);
+    }
+    public static void setPayMap(String key,String value) {
+        payMap.put(key,value);
+    }
+
+
+}

+ 53 - 0
WxConstants.java

@@ -0,0 +1,53 @@
+package com.happy.common.wx;
+
+/**
+ * 微信公众号常量类
+ * @author lujunjie
+ * @date   2018/06/28
+ */
+public class WxConstants {
+
+    /**
+     * 默认编码
+     */
+    public static final String DEFAULT_CHARSET = "UTF-8";
+
+    /**
+     * 统一下单-扫描支付
+     */
+    public static String PAY_UNIFIEDORDER = "https://app.dev.9kbs.com/shopOpenApi/services/deviceAntiScode/getStartCode";
+
+    public static String Test = "http://localhost:8088/HotWaters/userget_stu.action";
+
+    public static String Test2 = "http://localhost:8088/HotWaters/userstu_info.action";
+
+    /**
+     * 请求成功返回码
+     */
+    public final static String ERRCODE_OK_CODE = "0";
+    /**
+     * 错误的返回码的Key
+     */
+    public final static String ERRCODE = "errcode";
+
+    /**
+     * 返回状态码
+     */
+    public final static String RETURN_CODE= "return_code";
+
+    /**
+     * access_token 字符串
+     */
+    public final static String ACCESS_TOKEN = "access_token";
+
+    /**
+     * 签名类型 MD5
+     */
+    public final static String SING_MD5 = "MD5";
+
+    /**
+     * 签名类型 HMAC-SHA256
+     */
+    public final static String SING_HMACSHA256 = "HMAC-SHA256";
+
+}

+ 381 - 0
WxUtil.java

@@ -0,0 +1,381 @@
+package com.happy.common.wx;
+
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import com.happy.common.util.SHA1;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.*;
+import java.security.MessageDigest;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 微信公众号接口工具类
+ * @author lujunjie
+ * @date   2018/03/01
+ */
+public class WxUtil {
+
+	/**
+	 * 加密/校验流程如下:
+	 * 1. 将token、timestamp、nonce三个参数进行字典序排序<br>
+	 * 2. 将三个参数字符串拼接成一个字符串进行sha1加密<br>
+	 * 3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信<br>
+	 *
+	 * @param token Token验证密钥
+	 * @param signature 微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数,nonce参数
+	 * @param timestamp 时间戳
+	 * @param nonce 随机数
+	 * @return 验证成功返回:true,失败返回:false
+	 */
+	public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
+		List<String> params = new ArrayList<String>();
+		params.add(token);
+		params.add(timestamp);
+		params.add(nonce);
+		//1. 将token、timestamp、nonce三个参数进行字典序排序
+		Collections.sort(params, new Comparator<String>() {
+			@Override
+			public int compare(String o1, String o2) {
+				return o1.compareTo(o2);
+			}
+		});
+		//2. 将三个参数字符串拼接成一个字符串进行sha1加密
+		String temp = SHA1.encode(params.get(0) + params.get(1) + params.get(2));
+		//3. 开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
+		return temp.equals(signature);
+	}
+
+	/**
+	 * 输入流转化为字符串
+	 * @param inputStream 流
+	 * @return String 字符串
+	 * @throws Exception
+	 */
+	public static String getStreamString(InputStream inputStream) throws Exception{
+		StringBuffer buffer=new StringBuffer();
+		InputStreamReader inputStreamReader = null;
+		BufferedReader bufferedReader = null;
+		try{
+			inputStreamReader=new InputStreamReader(inputStream, WxConstants.DEFAULT_CHARSET);
+			bufferedReader=new BufferedReader(inputStreamReader);
+			String line;
+			while((line=bufferedReader.readLine())!=null){
+				buffer.append(line);
+			}
+		}catch(Exception e){
+			throw new Exception();
+		}finally {
+			if(bufferedReader != null){
+				bufferedReader.close();
+			}
+			if(inputStreamReader != null){
+				inputStreamReader.close();
+			}
+			if(inputStream != null){
+				inputStream.close();
+			}
+		}
+		return buffer.toString();
+	}
+
+	/**
+	 * 获取随机字符串 Nonce Str
+	 * @return String 随机字符串
+	 */
+	public static String getNonceStr() {
+		return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 32);
+	}
+
+	/**
+	 * 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
+	 * @param data 待签名数据
+	 * @param apikey API密钥
+	 * @return 签名
+	 */
+	public static String getSignature(final Map<String, String> data, String apikey,
+				String signType) throws Exception {
+		Set<String> keySet = data.keySet();
+		String[] keyArray = keySet.toArray(new String[keySet.size()]);
+		Arrays.sort(keyArray);
+		StringBuilder sb = new StringBuilder();
+		sb.append(apikey);
+		sb.append("amount10apicodeCS0001collect_code");
+		sb.append(data.get("collect_code").trim());
+		sb.append("order_no");
+		sb.append(data.get("order_no").trim());
+        sb.append("timestamp");
+        sb.append(data.get("timestamp").trim());
+        sb.append(apikey);
+		System.out.println(sb);
+		if (signType.equals(WxConstants.SING_MD5)) {
+			System.out.println(MD5(sb.toString()).toUpperCase());
+			return MD5(sb.toString()).toLowerCase();
+		}
+		else if (signType.equals(WxConstants.SING_HMACSHA256)) {
+			return HMACSHA256(sb.toString(), apikey);
+		}
+		else {
+			throw new Exception(String.format("Invalid sign_type: %s", signType));
+		}
+	}
+
+	/**
+	 * 生成 MD5
+	 * @param data 待处理数据
+	 * @return MD5结果
+	 */
+	public static String MD5(String data) throws Exception {
+		MessageDigest md = MessageDigest.getInstance("MD5");
+		byte[] array = md.digest(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * 生成 HMACSHA256
+	 * @param data 待处理数据
+	 * @param key 密钥
+	 * @return 加密结果
+	 * @throws Exception
+	 */
+	public static String HMACSHA256(String data, String key) throws Exception {
+		Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
+		SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
+		sha256_HMAC.init(secret_key);
+		byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
+		StringBuilder sb = new StringBuilder();
+		for (byte item : array) {
+			sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
+		}
+		return sb.toString().toUpperCase();
+	}
+
+	/**
+	 * @param data Map类型数据
+	 * @return XML格式的字符串
+	 * @throws Exception
+	 */
+	public static String mapToXml(Map<String, String> data) throws Exception {
+		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+		DocumentBuilder documentBuilder= documentBuilderFactory.newDocumentBuilder();
+		org.w3c.dom.Document document = documentBuilder.newDocument();
+		org.w3c.dom.Element root = document.createElement("xml");
+		document.appendChild(root);
+		for (String key: data.keySet()) {
+			String value = data.get(key);
+			if (value == null) {
+				value = "";
+			}
+			value = value.trim();
+			org.w3c.dom.Element filed = document.createElement(key);
+			filed.appendChild(document.createTextNode(value));
+			root.appendChild(filed);
+		}
+		TransformerFactory tf = TransformerFactory.newInstance();
+		Transformer transformer = tf.newTransformer();
+		DOMSource source = new DOMSource(document);
+		transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+		StringWriter writer = new StringWriter();
+		StreamResult result = new StreamResult(writer);
+		transformer.transform(source, result);
+		String output = writer.getBuffer().toString(); //.replaceAll("\n|\r", "");
+		try {
+			writer.close();
+		}
+		catch (Exception ex) {
+		}
+		return output;
+	}
+
+	/**
+	 * 处理 HTTPS API返回数据,转换成Map对象。return_code为SUCCESS时,验证签名。
+	 * @param xmlStr API返回的XML格式数据
+	 * @return Map类型数据
+	 * @throws Exception
+	 */
+	public static Map<String, String> processResponseXml(String xmlStr,String signType) throws Exception {
+		String RETURN_CODE = WxConstants.RETURN_CODE;
+		String return_code;
+		Map<String, String> respData = xmlToMap(xmlStr);
+		if (respData.containsKey(RETURN_CODE)) {
+			return_code = respData.get(RETURN_CODE);
+		}
+		else {
+			throw new Exception(String.format("No `return_code` in XML: %s", xmlStr));
+		}
+
+		if (return_code.equals("FAIL")) {
+			return respData;
+		}
+		else if (return_code.equals("SUCCESS")) {
+			if (isResponseSignatureValid(respData,signType)) {
+				return respData;
+			}
+			else {
+				throw new Exception(String.format("Invalid sign value in XML: %s", xmlStr));
+			}
+		}
+		else {
+			throw new Exception(String.format("return_code value %s is invalid in XML: %s", return_code, xmlStr));
+		}
+	}
+
+
+	/**
+	 * XML格式字符串转换为Map
+	 * @param strXML XML字符串
+	 * @return XML数据转换后的Map
+	 * @throws Exception
+	 */
+	public static Map<String, String> xmlToMap(String strXML) throws Exception {
+		try {
+			Map<String, String> data = new HashMap<String, String>();
+			DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+
+			String FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
+			documentBuilderFactory.setFeature(FEATURE, true);
+
+			FEATURE = "http://xml.org/sax/features/external-general-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://xml.org/sax/features/external-parameter-entities";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+			documentBuilderFactory.setFeature(FEATURE, false);
+
+			documentBuilderFactory.setXIncludeAware(false);
+			documentBuilderFactory.setExpandEntityReferences(false);
+			DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+			InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
+			org.w3c.dom.Document doc = documentBuilder.parse(stream);
+			doc.getDocumentElement().normalize();
+			NodeList nodeList = doc.getDocumentElement().getChildNodes();
+			for (int idx = 0; idx < nodeList.getLength(); ++idx) {
+				Node node = nodeList.item(idx);
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					org.w3c.dom.Element element = (org.w3c.dom.Element) node;
+					data.put(element.getNodeName(), element.getTextContent());
+				}
+			}
+			try {
+				stream.close();
+			} catch (Exception ex) {
+				// do nothing
+			}
+			return data;
+		} catch (Exception ex) {
+			throw ex;
+		}
+	}
+
+	/**
+	 * 判断xml数据的sign是否有效,必须包含sign字段,否则返回false。
+	 * @param reqData 向wxpay post的请求数据
+	 * @return 签名是否有效
+	 * @throws Exception
+	 */
+	private static boolean isResponseSignatureValid(final Map<String, String> reqData,String signType) throws Exception {
+		// 返回数据的签名方式和请求中给定的签名方式是一致的
+		return isSignatureValid(reqData,WxConfig.apikey,signType);
+	}
+
+	/**
+	 * 判断签名是否正确,必须包含sign字段,否则返回false。
+	 * @param data Map类型数据
+	 * @param key API密钥
+	 * @param signType 签名方式
+	 * @return 签名是否正确
+	 * @throws Exception
+	 */
+	public static boolean isSignatureValid(Map<String, String> data, String key, String signType) throws Exception {
+		if (!data.containsKey("sign")) {
+			return false;
+		}
+		String sign = data.get("sign");
+		return getSignature(data, key, signType).equals(sign);
+	}
+
+	/**
+	 * 生成支付二维码
+	 * @param response 响应
+	 * @param contents url链接
+	 * @throws Exception
+	 */
+	public static void writerPayImage(HttpServletResponse response, String contents) throws Exception{
+		ServletOutputStream out = response.getOutputStream();
+		try {
+			Map<EncodeHintType,Object> hints = new HashMap<EncodeHintType,Object>();
+			hints.put(EncodeHintType.CHARACTER_SET,"UTF-8");
+			hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
+			hints.put(EncodeHintType.MARGIN, 0);
+			BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.QR_CODE,300,300,hints);
+			MatrixToImageWriter.writeToStream(bitMatrix,"jpg",out);
+		}catch (Exception e){
+			throw new Exception("生成二维码失败!");
+		}finally {
+			if(out != null){
+				out.flush();
+				out.close();
+			}
+		}
+	}
+
+	/**
+	 * 生成商户订单号
+	 * @return String
+	 */
+	public static String mchOrderNo(){
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
+		String date = sdf.format(new Date());
+
+		Random random = new Random();
+		String fourRandom = String.valueOf(random.nextInt(10000));
+		int randLength = fourRandom.length();
+		//不足4位继续补充
+		if(randLength<4){
+			for(int remain = 1; remain <= 4 - randLength; remain ++ ){
+				fourRandom += random.nextInt(10)  ;
+			}
+		}
+		return date+fourRandom;
+	}
+
+	/**
+	 * 返回信息给微信
+	 * @param response
+	 * @param content 内容
+	 * @throws Exception
+	 */
+	public static void responsePrint(HttpServletResponse response, String content) throws Exception{
+		response.setCharacterEncoding("UTF-8");
+		response.setContentType("text/xml");
+		response.getWriter().print(content);
+		response.getWriter().flush();
+		response.getWriter().close();
+	}
+
+
+}

+ 99 - 0
applicationContext.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:jee="http://www.springframework.org/schema/jee"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
+        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
+
+    <!-- <context:property-placeholder location="classpath:jdbc.properties" /> -->
+    <!-- 设置需要进行Spring注解扫描的类包 -->
+    <context:component-scan base-package="com.happy" />
+
+    <!-- 自动加载构建bean
+     <context:component-scan base-package="com.happy.service" />
+     <context:component-scan base-package="com.happy.dao" />   -->
+
+    <!-- 配置数据源 -->
+    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
+
+        <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
+        <property name="url" value="jdbc:mysql://6.205.66.5:3306/carstop?useCursorFetch=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"></property>
+        <property name="username" value="root"></property>
+        <property name="password" value="Ro0!ot_369!"></property>
+
+        <!-- 配置获取连接等待超时的时间 -->
+        <property name="maxWait" value="60000" />
+
+        <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
+        <property name="timeBetweenEvictionRunsMillis" value="60000" />
+
+        <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
+        <property name="minEvictableIdleTimeMillis" value="300000" />
+
+        <property name="validationQuery" value="SELECT 'x'" />
+        <property name="testWhileIdle" value="true" />
+        <property name="testOnBorrow" value="false" />
+        <property name="testOnReturn" value="false" />
+
+        <!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用) -->
+        <!-- <property name="poolPreparedStatements" value="true" />
+        <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />   -->
+
+        <!-- 配置监控统计拦截的filters,去掉后监控界面sql无法统计 -->
+        <property name="filters" value="stat" />
+
+    </bean>
+
+
+    <!-- 配置Jdbc模板 -->
+    <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" scope="prototype">
+        <constructor-arg ref="dataSource"></constructor-arg>
+    </bean>
+
+    <!-- 配置事务管理器 -->
+    <bean id="transactionManager" scope="prototype"
+          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+        <property name="dataSource" ref="dataSource" />
+    </bean>
+
+    <!-- 配置事务通知属性 -->
+    <tx:advice id="txAdvice" transaction-manager="transactionManager" >
+        <!-- 定义事务传播属性 -->
+        <tx:attributes>
+            <tx:method name="insert*" propagation="REQUIRED"/>
+            <tx:method name="count*" propagation="REQUIRED"/>
+            <tx:method name="update*" propagation="REQUIRED"/>
+            <tx:method name="edit*" propagation="REQUIRED"/>
+            <tx:method name="save*" propagation="REQUIRED"/>
+            <tx:method name="add*" propagation="REQUIRED"/>
+            <tx:method name="new*" propagation="REQUIRED"/>
+            <tx:method name="set*" propagation="REQUIRED"/>
+            <tx:method name="remove*" propagation="REQUIRED"/>
+            <tx:method name="delete*" propagation="REQUIRED"/>
+            <tx:method name="change*" propagation="REQUIRED"/>
+
+            <tx:method name="get*" read-only="true" />
+            <tx:method name="find*" read-only="true" />
+            <tx:method name="load*" read-only="true" />
+
+            <tx:method name="*" propagation="REQUIRED" />
+        </tx:attributes>
+    </tx:advice>
+
+    <!-- 配置事务切面 -->
+    <aop:config>
+        <!-- 配置切点 -->
+        <aop:pointcut id="serviceOperation"
+                      expression="execution(* com.happy.service.*.*(..))" />
+        <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
+    </aop:config>
+
+</beans>

+ 177 - 0
loginAction.java

@@ -0,0 +1,177 @@
+package com.happy.action;
+
+import com.happy.Model.Admin;
+import com.happy.service.AdminService;
+import com.happy.unitil.ResUtil;
+import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.springframework.stereotype.Controller;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * 登录action
+ * 
+ * @author lzp
+ * 
+ */
+@Controller
+public class loginAction extends ActionSupport implements ServletRequestAware {
+
+	// private final Gson gson = new
+	// GsonBuilder().setDateFormat("yyyyMMddHHmmss").create();
+
+	private HttpServletRequest request;
+	private HttpSession session;
+	private String account;
+	private String password;
+	private Admin admin;
+	private String id;
+	private String admin_name;
+	@Resource
+	private AdminService adminService;
+
+	public HttpSession getSession() {
+		return session;
+	}
+
+	public void setSession(HttpSession session) {
+		this.session = session;
+	}
+
+	public AdminService getAdminService() {
+		return adminService;
+	}
+
+	public void setAdminService(AdminService adminService) {
+		this.adminService = adminService;
+	}
+
+	public HttpServletRequest getRequest() {
+		return request;
+	}
+
+	public void setRequest(HttpServletRequest request) {
+		this.request = request;
+	}
+
+	public Admin getAdmin() {
+		return admin;
+	}
+
+	public void setAdmin(Admin admin) {
+		this.admin = admin;
+	}
+
+	public String getAccount() {
+		return account;
+	}
+
+	public void setAccount(String account) {
+		this.account = account;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getAdmin_name() {
+		return admin_name;
+	}
+
+	public void setAdmin_name(String admin_name) {
+		this.admin_name = admin_name;
+	}
+
+	// 登录的方法
+	public String login() {
+		// 管理员登录
+		Admin admin = adminService.getAdmin(account, password);
+		if (admin != null) {
+			request.getSession().setAttribute("admin", admin);
+			request.getSession().setAttribute("fruit", 2);
+			request.getSession().removeAttribute("erro");
+			request.getSession().setAttribute("isLogin", "123");
+			return "index";
+		}
+		ServletActionContext.getRequest().getSession().setAttribute("erro", 1);
+		return "login";
+	}
+
+	// 得到用户名密码`
+	public String getUser() throws Exception {
+		Admin user = (Admin) ServletActionContext.getRequest().getSession()
+				.getAttribute("admin");
+		JSONObject resultJson = new JSONObject();
+		resultJson.put("name", user.getAdmin_name());
+		resultJson.put("pass", user.getAdmin_password());
+		resultJson.put("id", user.getAdmin_id());
+		resultJson.put("account", user.getAdmin_account());
+		ResUtil.write(resultJson, ServletActionContext.getResponse());
+		return null;
+	}
+
+	// 修改密码
+	public String updatePass() throws Exception {
+		JSONObject resultJson = new JSONObject();
+		int num = adminService.updateAdmin(id, password);
+		if (num > 0) {
+			resultJson.put("success", "修改成功");
+		}
+		ResUtil.write(resultJson, ServletActionContext.getResponse());
+		return null;
+	}
+
+	// 修改密码
+//	public String updateUser() throws Exception {
+//		JSONObject resultJson = new JSONObject();
+//		int num = adminService.updateAdmin(id, password);
+//		if (num > 0) {
+//			resultJson.put("success", "修改成功");
+//		}
+//		ResUtil.write(resultJson, ServletActionContext.getResponse());
+//		return null;
+//	}
+
+	// 退出登录
+	public String loginout() {
+		ServletActionContext.getRequest().getSession().invalidate();
+		return "login";
+	}
+
+	public String updateAdminInfo() throws Exception {
+		JSONObject resultJson = new JSONObject();
+		Admin admin = new Admin();
+		admin.setAdmin_account(account);
+		admin.setAdmin_id(Integer.parseInt(id));
+		admin.setAdmin_name(admin_name);
+		admin.setAdmin_password(password);
+		int num = adminService.updateAdminInfo(admin);
+		if (num > 0) {
+			resultJson.put("success", "修改成功,需要重新登录!");
+		}
+		ResUtil.write(resultJson, ServletActionContext.getResponse());
+		return null;
+	}
+
+	public void setServletRequest(HttpServletRequest request) {
+		this.request = request;
+	}
+
+}

+ 32 - 0
struts.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts PUBLIC
+		"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
+		"http://struts.apache.org/dtds/struts-2.3.dtd">
+
+<struts>
+	<constant name="struts.enable.DynamicMethodInvocation" value="true" />
+	<!-- 修改上传文件的大小 -->
+	<constant name="struts.multipart.maxSize" value="50000000"/>
+	<package name="happy" namespace="/" extends="struts-default">
+
+		<action name="user*" method = "{1}" class="com.happy.action.User">
+			<result name="list">/jsp/list.jsp</result>
+		</action>
+		<action name="info*" method = "{1}" class="com.happy.action.InfoAction">
+		</action>
+		<action name="login*" method = "{1}" class="com.happy.action.loginAction">
+			<result name="index">/jsp/index.jsp</result>
+			<result name="login">/jsp/login.jsp</result>
+			<result name="login2">/jsp/smh/register2.jsp</result>
+		</action>
+		<action name="index*" method = "{1}" class="com.happy.action.IndexAction">
+			<result name="loginout" type="redirectAction">loginloginout.action</result>
+			<result name="info">/jsp/order/order_info.jsp</result>
+		</action>
+		<action name="visitor*" method = "{1}" class="com.happy.action.VisitorAction">
+		</action>
+		<action name="ioschool*" method = "{1}" class="com.happy.action.IOSchoolAction">
+		</action>
+	</package>
+
+</struts>

+ 42 - 0
test2.java

@@ -0,0 +1,42 @@
+
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class test2 {
+
+    public static void main(String[] args) throws JsonProcessingException{
+        // 要解析的json字符串
+        String s = "\\u8bbf\\u95ee\\u4e8b\\u7531";
+        System.out.println(s); // \u67e5\u8be2\u6210\u529f
+
+        System.out.println(convertUnicodeToCh(s)); // 查询成功
+    }
+
+    /**
+     * 将unicode字符串转为正常字符串
+     *
+     * @param str unicode字符串(比如"\u67e5\u8be2\u6210\u529f")
+     * @return 转换后的字符串(比如"查询成功")
+     */
+    private static String convertUnicodeToCh(String str) {
+        Pattern pattern = Pattern.compile("(\\\\u(\\w{4}))");
+        Matcher matcher = pattern.matcher(str);
+
+        // 迭代,将str中的所有unicode转换为正常字符
+        while (matcher.find()) {
+            String unicodeFull = matcher.group(1); // 匹配出的每个字的unicode,比如\u67e5
+            String unicodeNum = matcher.group(2); // 匹配出每个字的数字,比如\u67e5,会匹配出67e5
+
+            // 将匹配出的数字按照16进制转换为10进制,转换为char类型,就是对应的正常字符了
+            char singleChar = (char) Integer.parseInt(unicodeNum, 16);
+
+            // 替换原始字符串中的unicode码
+            str = str.replace(unicodeFull, singleChar + "");
+        }
+        return str;
+    }
+}

+ 30 - 0
userDao.java

@@ -0,0 +1,30 @@
+package com.happy.dao;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.Model.Visitor;
+
+import java.util.List;
+
+public interface userDao {
+
+    public int insertInfo(Visitor visitor);
+
+    public List<Visitor> queryByCard(String card_number, String created_time);
+
+    public List<Visitor> queryByTime(String time);
+
+    public int insertSchool(Data2 data2);
+
+    public int insertOutSchool(Data3 data3);
+
+    public List<Data2> queryInByCar(String car_number, String in_time);
+
+    public List<Data3> queryOutByCar(String car_number, String out_time);
+
+    public int updateVisiState(String car_number, String visit_start_time, String visit_end_time);
+
+    public int updateVisiStateById(Integer id);
+
+    public int updateVisiStateNoById(Integer id);
+}

+ 205 - 0
userDaoImpl.java

@@ -0,0 +1,205 @@
+package com.happy.dao.impl;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.Model.Message;
+import com.happy.Model.Visitor;
+import com.happy.dao.userDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository("userDao")
+public class userDaoImpl implements userDao {
+
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    public int insertInfo(Visitor visitor){
+        String sql = "insert into info(visitor_name, visitor_phone, reason, status, status_with_time, card_number, visited_at, id_card_img, created_time, visit_start_time, visit_end_time, member_name, member_phone, member_org, car_number, time) values(:visitor_name, :visitor_phone, :reason, :status, :status_with_time, :card_number, :visited_at, :id_card_img, :created_time, :visit_start_time, :visit_end_time, :member_name, :member_phone, :member_org, :car_number, :time)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("visitor_name", visitor.getVisitor_name());
+        sps.addValue("visitor_phone", visitor.getVisitor_phone());
+        sps.addValue("reason", visitor.getReason());
+        sps.addValue("status", visitor.getStatus());
+        sps.addValue("status_with_time", visitor.getStatus_with_time());
+        sps.addValue("card_number", visitor.getCard_number());
+        sps.addValue("visited_at", visitor.getVisited_at());
+        sps.addValue("id_card_img", visitor.getId_card_img());
+        sps.addValue("created_time", visitor.getCreated_time());
+        sps.addValue("visit_start_time", visitor.getVisit_start_time());
+        sps.addValue("visit_end_time", visitor.getVisit_end_time());
+        sps.addValue("member_name", visitor.getMember_name());
+        sps.addValue("member_phone", visitor.getMember_phone());
+        sps.addValue("member_org", visitor.getMember_org());
+        sps.addValue("car_number", visitor.getCar_number());
+        sps.addValue("time", visitor.getTime());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public List<Visitor> queryByCard(String card_number, String created_time){
+        String sql="select * from info where card_number=:card_number and created_time=:created_time";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("card_number", card_number);
+        sps.addValue("created_time", created_time);
+        List<Visitor> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Visitor>(Visitor.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public List<Visitor> queryByTime(String time){
+        String sql="select * from info where `state`=1 and `time` < '" + time + "' limit 0, 8 ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        List<Visitor> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Visitor>(Visitor.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int insertSchool(Data2 data2){
+        String sql = "insert into inschool(car_number, in_time, car_type, c_type, uid, order_id, empty_plot, in_channel_id, worksite_id, remark, force_update) values(:car_number, :in_time, :car_type, :c_type, :uid, :order_id, :empty_plot, :in_channel_id, :worksite_id, :remark, :force_update)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("car_number", data2.getCar_number());
+        sps.addValue("in_time", data2.getIn_time());
+        sps.addValue("car_type", data2.getCar_type());
+        sps.addValue("c_type", data2.getC_type());
+        sps.addValue("uid", data2.getUid());
+        sps.addValue("order_id", data2.getOrder_id());
+        sps.addValue("empty_plot", data2.getEmpty_plot());
+        sps.addValue("in_channel_id", data2.getIn_channel_id());
+        sps.addValue("worksite_id", data2.getWorksite_id());
+        sps.addValue("remark", data2.getRemark());
+        sps.addValue("force_update", data2.getForce_update());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public List<Data2> queryInByCar(String car_number, String in_time){
+        String sql="select * from inschool where car_number=:car_number and in_time=:in_time ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("car_number", car_number);
+        sps.addValue("in_time", in_time);
+        List<Data2> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data2>(Data2.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public List<Data3> queryOutByCar(String car_number, String out_time){
+        String sql="select * from outschool where car_number=:car_number and out_time=:out_time ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("car_number", car_number);
+        sps.addValue("out_time", out_time);
+        List<Data3> list=namedParameterJdbcTemplate.query(sql, sps,new BeanPropertyRowMapper<Data3>(Data3.class));
+        if(list != null && list.size() >0){
+            return list;
+        }
+        return null;
+    }
+
+    public int insertOutSchool(Data3 data3){
+        String sql = "insert into outschool(out_uid,uid,cash_pay,pay_type,electronic_pay,in_time,empty_plot,in_channel_id,out_channel_id,order_id,car_number,auth_code,freereasons,c_type,duration,total,out_time,car_type,amount_receivable) values(:out_uid,:uid,:cash_pay,:pay_type,:electronic_pay,:in_time,:empty_plot,:in_channel_id,:out_channel_id,:order_id,:car_number,:auth_code,:freereasons,:c_type,:duration,:total,:out_time,:car_type,:amount_receivable)";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("out_uid", data3.getOut_uid());
+        sps.addValue("uid", data3.getUid());
+        sps.addValue("cash_pay", data3.getCash_pay());
+        sps.addValue("pay_type", data3.getPay_type());
+        sps.addValue("electronic_pay", data3.getElectronic_pay());
+        sps.addValue("in_time", data3.getIn_time());
+        sps.addValue("empty_plot", data3.getEmpty_plot());
+        sps.addValue("in_channel_id", data3.getIn_channel_id());
+        sps.addValue("out_channel_id", data3.getOut_channel_id());
+        sps.addValue("order_id", data3.getOrder_id());
+        sps.addValue("car_number", data3.getCar_number());
+        sps.addValue("auth_code", data3.getAuth_code());
+        sps.addValue("freereasons", data3.getFreereasons());
+        sps.addValue("c_type", data3.getC_type());
+        sps.addValue("duration", data3.getDuration());
+        sps.addValue("total", data3.getTotal());
+        sps.addValue("out_time", data3.getOut_time());
+        sps.addValue("car_type", data3.getCar_type());
+        sps.addValue("amount_receivable", data3.getAmount_receivable());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int updateVisiState(String car_number, String visit_start_time, String visit_end_time){
+        String sql = "update info set `state`=2 where car_number=:car_number and visit_start_time=:visit_start_time and visit_end_time=:visit_end_time";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("car_number", car_number);
+        sps.addValue("visit_start_time", visit_start_time);
+        sps.addValue("visit_end_time", visit_end_time);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int updateVisiStateById(Integer id){
+        String sql = "update info set `state`=2 where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    public int updateVisiStateNoById(Integer id){
+        String sql = "update info set `state`=3 where id=:id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id", id);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+}

+ 30 - 0
userService.java

@@ -0,0 +1,30 @@
+package com.happy.service;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.Model.Visitor;
+
+import java.util.List;
+
+public interface userService {
+
+    public int insertInfo(Visitor visitor);
+
+    public List<Visitor> queryByCard(String card_number, String created_time);
+
+    public List<Visitor> queryByTime(String time);
+
+    public int insertSchool(Data2 data2);
+
+    public int insertOutSchool(Data3 data3);
+
+    public List<Data2> queryInByCar(String car_number, String in_time);
+
+    public List<Data3> queryOutByCar(String car_number, String out_time);
+
+    public int updateVisiState(String car_number, String visit_start_time, String visit_end_time);
+
+    public int updateVisiStateById(Integer id);
+
+    public int updateVisiStateNoById(Integer id);
+}

+ 58 - 0
userServiceImpl.java

@@ -0,0 +1,58 @@
+package com.happy.service.Impl;
+
+import com.happy.Model.Data2;
+import com.happy.Model.Data3;
+import com.happy.Model.Visitor;
+import com.happy.dao.userDao;
+import com.happy.service.userService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("userService")
+public class userServiceImpl implements userService {
+
+    @Resource
+    private userDao udao;
+
+    public int insertInfo(Visitor visitor){
+        return udao.insertInfo(visitor);
+    }
+
+    public List<Visitor> queryByCard(String card_number, String created_time){
+        return udao.queryByCard(card_number, created_time);
+    }
+
+    public List<Visitor> queryByTime(String time){
+        return udao.queryByTime(time);
+    }
+
+    public int insertSchool(Data2 data2){
+        return udao.insertSchool(data2);
+    }
+
+    public int insertOutSchool(Data3 data3){
+        return udao.insertOutSchool(data3);
+    }
+
+    public List<Data2> queryInByCar(String car_number, String in_time){
+        return udao.queryInByCar(car_number, in_time);
+    }
+
+    public List<Data3> queryOutByCar(String car_number, String out_time){
+        return udao.queryOutByCar(car_number, out_time);
+    }
+
+    public int updateVisiState(String car_number, String visit_start_time, String visit_end_time){
+        return udao.updateVisiState(car_number, visit_start_time, visit_end_time);
+    }
+
+    public int updateVisiStateById(Integer id){
+        return udao.updateVisiStateById(id);
+    }
+
+    public int updateVisiStateNoById(Integer id){
+        return udao.updateVisiStateNoById(id);
+    }
+}

+ 10 - 0
zc.properties

@@ -0,0 +1,10 @@
+#conf.global.upload.image.dir=/usr/local/apache-tomcat-7.0.69/webapps/HappysSystem/happy/image
+conf.global.upload.image.dir=/usr/local/apache-tomcat-8.0.28/webapps/HappysSystem/happy/image
+#conf.global.upload.image.dir=D\:/apache-tomcat-8.0.28/webapps/HappysSystemhappy/image
+#conf.global.upload.image.dir=/opt/apache-tomcat-8.0.28/webapps/HappysSystem/happy/image
+#conf.global.upload.image.dir=D\:/tomcat7.0/tomcat7.0/apache-tomcat-7.0.52/webapps/CustomerServiceManager/csm/image
+#conf.global.upload.image.dir=D\:/tomcat7.0/tomcat7.0/apache-tomcat-7.0.52/webapps/HappysSystem/happy/image
+#conf.global.upload.image.dir=C\:/tomcat6/webapps/CustomerServiceManager/csm/image
+#conf.global.upload.image.dir=/home/bae/app/CustomerServiceManager/csm/image
+
+conf.global.decrypt.key=123456789012345678901234567890~!