Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

xiao547607 4 yıl önce
ebeveyn
işleme
909daee9b6

+ 23 - 0
common/src/main/java/com/jpsoft/bus/config/WxConfig.java

@@ -0,0 +1,23 @@
+package com.jpsoft.bus.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2020-3-21 13:42
+ */
+@Component
+@ConfigurationProperties(prefix = "wx.pay")
+@Data
+public class WxConfig {
+    private String appId;
+    private String appSecret;
+    private String token;
+    private String tokenUrl;
+    private String createQrCodeUrl;
+    private String showQrCodeUrl;
+    private String contentType;
+    private String portalUrl;
+}

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/base/dao/OrderInfoDAO.java

@@ -15,4 +15,6 @@ public interface OrderInfoDAO {
 	int delete(String id);
 	List<OrderInfo> list();
 	List<OrderInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+
+    List<OrderInfo> findByPassengerIdAndPayStatus(String passengerId,Integer payStatus);
 }

+ 3 - 0
common/src/main/java/com/jpsoft/bus/modules/base/entity/OrderInfo.java

@@ -5,6 +5,7 @@ import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
 
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -63,4 +64,6 @@ public class OrderInfo {
     private String ticketType;
     @ApiModelProperty(value = "货票金额")
     private BigDecimal goodsTicket = BigDecimal.ZERO;
+    @ApiModelProperty(value = "综合账单id")
+    private String mergeOrderId;
 }

+ 2 - 0
common/src/main/java/com/jpsoft/bus/modules/base/service/OrderInfoService.java

@@ -14,4 +14,6 @@ public interface OrderInfoService {
 	int delete(String id);
 	List<OrderInfo> list();
 	Page<OrderInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+
+    List<OrderInfo> findByPassengerIdAndPayStatus(String passengerId,Integer payStatus);
 }

+ 11 - 6
common/src/main/java/com/jpsoft/bus/modules/base/service/impl/OrderInfoServiceImpl.java

@@ -29,14 +29,14 @@ public class OrderInfoServiceImpl implements OrderInfoService {
 	public int insert(OrderInfo model) {
 		// TODO Auto-generated method stub
 		//model.setId(UUID.randomUUID().toString());
-		
+
 		return orderInfoDAO.insert(model);
 	}
 
 	@Override
 	public int update(OrderInfo model) {
 		// TODO Auto-generated method stub
-		return orderInfoDAO.update(model);		
+		return orderInfoDAO.update(model);
 	}
 
 	@Override
@@ -49,22 +49,27 @@ public class OrderInfoServiceImpl implements OrderInfoService {
 	public boolean exist(String id) {
 		// TODO Auto-generated method stub
 		int count = orderInfoDAO.exist(id);
-		
+
 		return count > 0 ? true : false;
 	}
-	
+
 	@Override
 	public List<OrderInfo> list() {
 		// TODO Auto-generated method stub
 		return orderInfoDAO.list();
 	}
-		
+
 	@Override
 	public Page<OrderInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
         Page<OrderInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
             orderInfoDAO.search(searchParams,sortList);
         });
-        
+
         return page;
 	}
+
+	@Override
+	public List<OrderInfo> findByPassengerIdAndPayStatus(String passengerId,Integer payStatus) {
+		return orderInfoDAO.findByPassengerIdAndPayStatus(passengerId,payStatus);
+	}
 }

+ 33 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/dto/PassengerDetailDTO.java

@@ -0,0 +1,33 @@
+package com.jpsoft.bus.modules.bus.dto;
+
+import lombok.Data;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2021-4-8 11:33
+ */
+@Data
+public class PassengerDetailDTO {
+
+    private String id;
+
+    private String imageUrl;
+
+    private String ticketUpStationId;
+
+    private String ticketUpStationName;
+
+    private String ticketDownStationId;
+
+    private String ticketDownStationName;
+
+    private String payStatus;
+
+    private String payStatusName;
+
+
+
+
+
+
+}

+ 6 - 0
common/src/main/java/com/jpsoft/bus/modules/bus/entity/PassengerInfo.java

@@ -60,4 +60,10 @@ public class PassengerInfo {
     @ApiModelProperty(value = "注册用户名")
     private String userName;
 
+    @ApiModelProperty(value = "购票的上车站点")
+    private String ticketUpStationId;
+
+    @ApiModelProperty(value = "购票的下车站点")
+    private String ticketDownStationId;
+
 }

+ 2 - 2
common/src/main/java/com/jpsoft/bus/modules/common/utils/WechatMessageUtil.java

@@ -40,7 +40,7 @@ public class WechatMessageUtil {
     public  boolean sendTemplate(JSONObject sendData, String appId, String appSecret, String templateId, String openId, String url) {
         boolean result = false;
 
-        AccessToken accessToken = weixinUtil.getCommonAccessToken(appId, appSecret);
+        AccessToken accessToken = WeixinUtil.getAccessToken(appId, appSecret);
 
         if (accessToken != null) {
             //发送模版内容
@@ -76,7 +76,7 @@ public class WechatMessageUtil {
         String result = "";
 
         try {
-            AccessToken accessToken = weixinUtil.getCommonAccessToken(appId, appSecret);
+            AccessToken accessToken = WeixinUtil.getAccessToken(appId, appSecret);
 
             if (accessToken == null) {
                 throw new Exception("token无法获取");

+ 269 - 305
common/src/main/java/com/jpsoft/bus/modules/common/utils/WeixinUtil.java

@@ -2,15 +2,11 @@ package com.jpsoft.bus.modules.common.utils;
 
 import cn.hutool.core.date.DateTime;
 import com.jpsoft.bus.modules.wechat.entity.AccessToken;
-import com.jpsoft.bus.modules.wechat.vo.UserInfo;
-import lombok.extern.slf4j.Slf4j;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONException;
 import net.sf.json.JSONObject;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.redis.core.ValueOperations;
-import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -32,321 +28,289 @@ import java.util.stream.Collectors;
  * @author lt
  * @date 2013-08-09
  */
-@Slf4j
-@Component
 public class WeixinUtil {
+	private static Logger log = LoggerFactory.getLogger(WeixinUtil.class);
 
-  /*  @Autowired
-    private RedisServiceImpl redisService;*/
+	// 获取access_token的接口地址(GET) 限200(次/天),可以在配置文件中修改
+	public static String access_token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
 
-    //通用token,不同站点中相互刷新会导致冲突,因此要统一管理
-    @Value("${wx.commonAccessTokenUrl}")
-    private String commonAccessTokenUrl;
-
-    //获取微信的code
-    public String authCodeUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
-
-    //通过code换取网页授权access_token
-    public String webAccessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
-
-    //js访问token
-    public String jsAccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
-
-    // 获取用户信息
-    public String user_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
-
-    public String subscribe_user_info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN ";
-
-    public String getCodeRequest(String appid, String url, String scope) {
+	//获取微信的code
+	public static String code = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
+	public static String getCodeRequest(String appid, String url,String scope){
         String result = null;
         String url_encode = "";
         try {
-            url_encode = java.net.URLEncoder.encode(url, "utf-8");
-        } catch (UnsupportedEncodingException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        result = authCodeUrl.replace("APPID", appid).replace("REDIRECT_URI", url_encode).replace("SCOPE", scope);
+			url_encode = java.net.URLEncoder.encode(url, "utf-8");
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        result  = code.replace("APPID", appid).replace("REDIRECT_URI",url_encode).replace("SCOPE", scope);
         return result;
     }
 
-    public AccessToken getWebAccessToken(String appid, String appsecret, String code) throws Exception {
+	//通过code换取网页授权access_token
+	public static String accessTokenurl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+	public static AccessToken getAccessToken(String appid, String appsecret, String code) throws Exception {
         AccessToken accessToken = null;
-        String formatUrl = webAccessTokenUrl.replace("APPID", appid).replace("SECRET", appsecret).replace("CODE", code);
-        JSONObject json = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
+        String formatUrl = accessTokenurl.replace("APPID", appid).replace("SECRET",appsecret).replace("CODE", code);
+        JSONObject json  = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
         if (!json.isNullObject() && !json.isEmpty()) {
-            try {
-                accessToken = new AccessToken();
-                accessToken.setToken(json.getString("access_token"));
-                accessToken.setExpiresIn(json.getInt("expires_in"));
-                accessToken.setOpenid(json.getString("openid"));
-                accessToken.setScope(json.getString("scope"));
-            } catch (Exception e) {
-
-                // 获取token失败
-                log.error("获取token失败,返回结果result={}", json);
-                if (json.getString("errcode").equals("40163")) {
-                    throw new Exception("请重新扫码");
-
-                }
-
-            }
-        }
+			try {
+				accessToken = new AccessToken();
+				accessToken.setToken(json.getString("access_token"));
+				accessToken.setExpiresIn(json.getInt("expires_in"));
+				accessToken.setOpenid(json.getString("openid"));
+				accessToken.setScope(json.getString("scope"));
+			} catch (Exception e) {
+
+				// 获取token失败
+				log.error("获取token失败,返回结果result={}", json);
+				if (json.getString("errcode").equals("40163")){
+					throw new Exception("请重新扫码");
+
+				}
+
+			}
+		}
         return accessToken;
     }
 
-    public  String getJsAPI(String accessToken) {
-        String formatUrl = jsAccessTokenUrl.replace("ACCESS_TOKEN", accessToken);
-        JSONObject json = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
+	public static String jsAccessTokenUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
+	public static String getJsAPI(String accessToken){
+		String formatUrl = jsAccessTokenUrl.replace("ACCESS_TOKEN", accessToken);
+        JSONObject json  = HttpConnectionUtil.httpRequest(formatUrl, "GET", null);
 
         if (!json.isNullObject() && !json.isEmpty()) {
-            try {
-                return json.getString("ticket");
-            } catch (Exception e) {
-                // 获取token失败
-                if (json.getInt("errcode") == 40001){
-
-                //    valueOperations.get
-                 //   redisService.remove("wxAccessToken","accessToken");
-                }
-                log.error("获取jsAPI失败,返回结果result={}", json);
-            }
-        }
+			try {
+				return json.getString("ticket");
+			} catch (Exception e) {
+				// 获取token失败
+				log.error("获取jsAPI失败,返回结果result={}", json);
+			}
+		}
 
         return null;
-    }
-
-    /**
-     * 获取access_token
-     *
-     * @param appid     凭证
-     * @param appsecret 密钥
-     * @return
-     */
-    public AccessToken getCommonAccessToken(String appid, String appsecret) {
-        AccessToken accessToken = null;
-
-        if (accessToken == null) {
-            String requestUrl = commonAccessTokenUrl
-                              + "?grant_type=client_credential"
-                              + "&appid=" + appid
-                              + "&secret=" + appsecret;
-
-            JSONObject jsonObject = HttpConnectionUtil.httpRequest(requestUrl, "GET", null);
-
-            // 如果请求成功
-            if (null != jsonObject) {
-                try {
-                    accessToken = new AccessToken();
-                    accessToken.setToken(jsonObject.getString("access_token"));
-                    accessToken.setExpiresIn(jsonObject.getInt("expires_in"));
-                } catch (JSONException e) {
-                    accessToken = null;
-                    // 获取token失败
-                    log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
-                }
-            }
-        }
-
-        return accessToken;
-    }
-
-    public UserInfo getUserInfo(String openid, String accessToken) {
-        // 拼装url
-        String url = user_info_url.replace("ACCESS_TOKEN", accessToken).replace("OPENID", openid);
-
-        JSONObject jsonObject = HttpConnectionUtil.httpRequest(url, "GET", null);
-
-        UserInfo userInfo = null;
-        if (null != jsonObject) {
-            try {
-                userInfo = new UserInfo();
-                userInfo.setOpenid(jsonObject.getString("openid").replaceAll("\"", ""));
-
-                userInfo.setNickname(jsonObject.getString("nickname").replaceAll("\"", ""));
-                userInfo.setCity(jsonObject.getString("city").replaceAll("\"", ""));
-                userInfo.setProvince(jsonObject.getString("province").replaceAll("\"", ""));
-                userInfo.setCountry(jsonObject.getString("country").replaceAll("\"", ""));
-                userInfo.setHeadimgurl(jsonObject.getString("headimgurl").replaceAll("\"", ""));
-            } catch (JSONException e) {
-                // 获取token失败
-                log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
-            }
-        }
-        return userInfo;
-    }
-
-    public static boolean checkSignature(String token, String signature, String timestamp, String nonce) {
-        String[] arr = new String[]{token, timestamp, nonce};
-
-        String content = Arrays.stream(arr)
-                .sorted(Comparator.naturalOrder())
-                .collect(Collectors.joining());
-
-        MessageDigest md = null;
-        String tmpStr = null;
-
-        try {
-            md = MessageDigest.getInstance("SHA-1");
-            // 将三个参数字符串拼接成一个字符串进行sha1加密
-            byte[] digest = md.digest(content.getBytes("UTF-8"));
-
-            StringBuffer hexstr = new StringBuffer();
-
-            String shaHex = "";
-
-            for (int i = 0; i < digest.length; i++) {
-                shaHex = Integer.toHexString(digest[i] & 0xFF);
-                if (shaHex.length() < 2) {
-                    hexstr.append(0);
-                }
-                hexstr.append(shaHex);
-            }
-
-            tmpStr = hexstr.toString();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        // 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
-        return signature.equals(tmpStr);
-    }
-
-    public static cn.hutool.json.JSONObject xmlToJson(ServletInputStream inputStream) throws Exception {
-        cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
-
-        // 创建sax解析工厂
-        SAXParserFactory factory = SAXParserFactory.newInstance();
-        // 创建sax转换工具
-        SAXParser saxParser = factory.newSAXParser();
-
-        saxParser.parse(inputStream, new DefaultHandler() {
-            private String tagName;
-
-            @Override
-            public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
-                tagName = qName;
-            }
-
-            @Override
-            public void endElement(String uri, String localName, String qName) throws SAXException {
-                tagName = null;
-            }
-
-            @Override
-            public void characters(char[] ch, int start, int length) throws SAXException {
-                if (tagName != null) {
-                    String content = new String(ch, start, length);
-                    jsonObject.put(tagName, content);
-                }
-            }
-        });
-
-        return jsonObject;
-    }
-
-    public static void replyTextMessage(HttpServletResponse response, String fromUserName, String toUserName, String content) {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append("<xml>");
-        sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
-        sb.append("<FromUserName><![CDATA[" + fromUserName + "]]></FromUserName>");
-        sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
-        sb.append("<MsgType><![CDATA[text]]></MsgType>");
-        sb.append("<Content><![CDATA[" + content + "]]></Content>");
-        sb.append("</xml>");
-
-        try {
-            response.getWriter().print(sb.toString());
-            response.getWriter().close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void replyArticlesMessage(HttpServletResponse response, String fromUserName, String toUserName, String title, String description, String picurl, String url) {
-        StringBuilder sb = new StringBuilder();
-        sb.append("<xml>");
-        sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
-        sb.append("<FromUserName><![CDATA[" + fromUserName + "]]></FromUserName>");
-        sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
-        sb.append("<MsgType><![CDATA[news]]></MsgType>");
-        sb.append("<ArticleCount>" + 1 + "</ArticleCount>");
-        sb.append("<Articles>");
-        sb.append("<item>");
-        sb.append("<Title><![CDATA[" + title + "]]></Title> ");
-        sb.append("<Description><![CDATA[" + description + "]]></Description>");
-        sb.append("<PicUrl><![CDATA[" + picurl + "]]></PicUrl>");
-        sb.append("<Url><![CDATA[" + url + "]]></Url>");
-        sb.append("</item>");
-        sb.append("</Articles>");
-        sb.append("</xml>");
-
-        try {
-            response.getWriter().print(sb.toString());
-            response.getWriter().close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-
-    /**
-     * 创建微信菜单
-     *
-     * @param appid
-     * @param appSecret
-     * @return
-     */
-    public static String createMenu(String appid, String appSecret) {
-     //   AccessToken token = WeixinUtil.getCommonAccessToken(appid, appSecret);
-
-        AccessToken token = new AccessToken();
-        System.out.println(token.getToken());
-
-        JSONObject data = new JSONObject();
-        JSONArray buttonArray = new JSONArray();
-
-        JSONObject button1 = new JSONObject();
-        button1.put("type", "view");
-        button1.put("name", "疫情监管");
-        button1.put("url", "http://wisdomhousewechat.sudaonline.net/prevention/");
-        buttonArray.add(button1);
-
-        JSONObject button2 = new JSONObject();
-        button2.put("type", "view");
-        button2.put("name", "智慧物业");
-        button2.put("url", "http://wisdomhousewechat.sudaonline.net/#/home/?id=1");
-        buttonArray.add(button2);
-
-        JSONObject button3 = new JSONObject();
-        button3.put("type", "click");
-        button3.put("name", "关于系统");
-        button3.put("key", "文章");
-        buttonArray.add(button3);
-
-
-        data.put("button", buttonArray);
-        data.put("action_name", "QR_LIMIT_STR_SCENE");
-
-        JSONObject actionInfo = new JSONObject();
-        JSONObject scene = new JSONObject();
-
-        scene.put("scene_str", "6");
-
-        actionInfo.put("scene", scene);
-
-        data.put("action_info", actionInfo);
-        System.out.println(data.toString());
-        //创建菜单
-        String result = HttpConnectionUtil.getHttpContentByPost(" https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + token.getToken(), "utf-8", data.toString());
-
-
-        return result;
-
-    }
-
-    public static void main(String[] args) {
-        System.out.println("//");
-    }
+	}
+
+	/**
+	 * 获取access_token
+	 *
+	 * @param appid 凭证
+	 * @param appsecret 密钥
+	 * @return
+	 */
+	public static AccessToken getAccessToken(String appid, String appsecret) {
+		AccessToken accessToken = null;
+
+		String requestUrl = access_token_url.replace("APPID", appid).replace("APPSECRET", appsecret);
+		JSONObject jsonObject =HttpConnectionUtil.httpRequest(requestUrl, "GET", null);
+		// 如果请求成功
+		if (null != jsonObject) {
+			try {
+				accessToken = new AccessToken();
+				accessToken.setToken(jsonObject.getString("access_token"));
+				accessToken.setExpiresIn(jsonObject.getInt("expires_in"));
+				//accessToken.setOpenid(jsonObject.getString("openid"));
+			} catch (JSONException e) {
+				accessToken = null;
+				// 获取token失败
+				log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
+			}
+		}
+		return accessToken;
+	}
+
+	/*// 获取用户信息
+	public static String user_info_url = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
+	public static String subscribe_user_info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN ";
+
+	public static UserInfo getUserInfo(String openid, String accessToken) {
+		// 拼装url
+		String url = user_info_url.replace("ACCESS_TOKEN", accessToken).replace("OPENID", openid);;
+
+		JSONObject jsonObject = HttpConnectionUtil.httpRequest(url, "GET", null);
+
+		UserInfo userInfo = null;
+		 if (null != jsonObject) {
+				try {
+					userInfo = new UserInfo();
+					userInfo.setOpenid(jsonObject.getString("openid").replaceAll("\"", ""));
+
+					userInfo.setNickname(jsonObject.getString("nickname").replaceAll("\"", ""));
+					userInfo.setCity(jsonObject.getString("city").replaceAll("\"", ""));
+					userInfo.setProvince(jsonObject.getString("province").replaceAll("\"", ""));
+					userInfo.setCountry(jsonObject.getString("country").replaceAll("\"", ""));
+					userInfo.setHeadimgurl(jsonObject.getString("headimgurl").replaceAll("\"", ""));
+				} catch (JSONException e) {
+					// 获取token失败
+					log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"), jsonObject.getString("errmsg"));
+				}
+			}
+		return userInfo;
+	}*/
+
+	public static boolean checkSignature(String token,String signature, String timestamp, String nonce) {
+		String[] arr = new String[] { token, timestamp, nonce };
+
+		String content = Arrays.stream(arr)
+				.sorted(Comparator.naturalOrder())
+				.collect(Collectors.joining());
+
+		MessageDigest md = null;
+		String tmpStr = null;
+
+		try {
+			md = MessageDigest.getInstance("SHA-1");
+			// 将三个参数字符串拼接成一个字符串进行sha1加密
+			byte[] digest = md.digest(content.getBytes("UTF-8"));
+
+			StringBuffer hexstr = new StringBuffer();
+
+			String shaHex = "";
+
+			for (int i = 0; i < digest.length; i++) {
+				shaHex = Integer.toHexString(digest[i] & 0xFF);
+				if (shaHex.length() < 2) {
+					hexstr.append(0);
+				}
+				hexstr.append(shaHex);
+			}
+
+			tmpStr = hexstr.toString();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		// 将sha1加密后的字符串可与signature对比,标识该请求来源于微信
+		return signature.equals(tmpStr);
+	}
+
+	public static cn.hutool.json.JSONObject xmlToJson(ServletInputStream inputStream) throws Exception {
+		cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
+
+		// 创建sax解析工厂
+		SAXParserFactory factory = SAXParserFactory.newInstance();
+		// 创建sax转换工具
+		SAXParser saxParser = factory.newSAXParser();
+
+		saxParser.parse(inputStream,new DefaultHandler(){
+			private String tagName;
+
+			@Override
+			public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+				tagName = qName;
+			}
+
+			@Override
+			public void endElement(String uri, String localName, String qName) throws SAXException {
+				tagName = null;
+			}
+
+			@Override
+			public void characters(char[] ch, int start, int length) throws SAXException {
+				if(tagName!=null){
+					String content = new String(ch,start,length);
+					jsonObject.put(tagName,content);
+				}
+			}
+		});
+
+		return jsonObject;
+	}
+	public static void replyTextMessage(HttpServletResponse response, String fromUserName, String toUserName, String content){
+		StringBuilder sb = new StringBuilder();
+
+		sb.append("<xml>");
+		sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
+		sb.append("<FromUserName><![CDATA["+ fromUserName + "]]></FromUserName>");
+		sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
+		sb.append("<MsgType><![CDATA[text]]></MsgType>");
+		sb.append("<Content><![CDATA[" + content + "]]></Content>");
+		sb.append("</xml>");
+
+		try {
+			response.getWriter().print(sb.toString());
+			response.getWriter().close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static void replyArticlesMessage(HttpServletResponse response, String fromUserName, String toUserName, String title,String description,String picurl,String url){
+		StringBuilder sb = new StringBuilder();
+		sb.append("<xml>");
+		sb.append("<ToUserName><![CDATA[" + toUserName + "]]></ToUserName>");
+		sb.append("<FromUserName><![CDATA["+ fromUserName + "]]></FromUserName>");
+		sb.append("<CreateTime>" + DateTime.now().getTime() + "</CreateTime>");
+		sb.append("<MsgType><![CDATA[news]]></MsgType>");
+		sb.append("<ArticleCount>" + 1 + "</ArticleCount>");
+		sb.append("<Articles>");
+		sb.append("<item>");
+		sb.append("<Title><![CDATA["+title+"]]></Title> ");
+		sb.append("<Description><![CDATA["+description+"]]></Description>");
+		sb.append("<PicUrl><![CDATA["+picurl+"]]></PicUrl>");
+		sb.append("<Url><![CDATA["+url+"]]></Url>");
+		sb.append("</item>");
+		sb.append("</Articles>");
+		sb.append("</xml>");
+
+		try {
+			response.getWriter().print(sb.toString());
+			response.getWriter().close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+
+	/**
+	 * 创建微信菜单
+	 * @param appid
+	 * @param appSecret
+	 * @return
+	 */
+	public static String createMenu(String appid,String appSecret){
+		AccessToken token = WeixinUtil.getAccessToken(appid, appSecret);
+
+		System.out.println(token.getToken());
+
+		JSONObject data = new JSONObject();
+		JSONArray buttonArray = new JSONArray();
+
+		JSONObject button1 = new JSONObject();
+		button1.put("type", "view");
+		button1.put("name", "疫情监管");
+		button1.put("url", "http://wisdomhousewechat.sudaonline.net/prevention/");
+		buttonArray.add(button1);
+
+		JSONObject button2 = new JSONObject();
+		button2.put("type","view");
+		button2.put("name","智慧物业");
+		button2.put("url","http://wisdomhousewechat.sudaonline.net/#/home/?id=1");
+		buttonArray.add(button2);
+
+		JSONObject button3 = new JSONObject();
+		button3.put("type","click");
+		button3.put("name","关于系统");
+		button3.put("key","文章");
+		buttonArray.add(button3);
+
+		data.put("button", buttonArray);
+		data.put("action_name", "QR_LIMIT_STR_SCENE");
+
+		JSONObject actionInfo = new JSONObject();
+		JSONObject scene = new JSONObject();
+
+		scene.put("scene_str", "6");
+
+		actionInfo.put("scene", scene);
+
+		data.put("action_info", actionInfo);
+		System.out.println(data.toString());
+		//创建菜单
+		String result = HttpConnectionUtil.getHttpContentByPost(" https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + token.getToken(), "utf-8", data.toString());
+
+		return result;
+	}
 }

+ 15 - 1
common/src/main/resources/mapper/base/OrderInfo.xml

@@ -24,6 +24,7 @@
 			<result property="passengerId" column="passenger_id"/>
 			<result property="ticketType" column="ticket_type"/>
 			<result property="goodsTicket" column="goods_ticket"/>
+			<result property="mergeOrderId" column="merge_order_id"/>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.base.entity.OrderInfo">
 	<!--
@@ -33,7 +34,7 @@
 	-->
 	<![CDATA[
 		insert into base_order_info
-	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,refund_fee,pay_time,out_order_no,transaction_id,open_id,payment_id,create_by,create_time,update_by,update_time,del_flag,passenger_id,ticket_type,goods_ticket)
+	    (id_,total_fee,body_,pay_status,pay_name,pay_fee,refund_fee,pay_time,out_order_no,transaction_id,open_id,payment_id,create_by,create_time,update_by,update_time,del_flag,passenger_id,ticket_type,goods_ticket,merge_order_id)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -56,6 +57,7 @@
 ,#{passengerId,jdbcType=VARCHAR}
 ,#{ticketType,jdbcType=VARCHAR}
 ,#{goodsTicket,jdbcType=DECIMAL}
+,#{mergeOrderId,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -122,6 +124,9 @@
 			<if test="goodsTicket != null">
 				goods_ticket = #{goodsTicket,jdbcType=DECIMAL}
 			</if>
+			<if test="mergeOrderId != null">
+				merge_order_id = #{mergeOrderId,jdbcType=VARCHAR}
+			</if>
 		</set>
 	where id_=#{id}
 	</update>
@@ -166,4 +171,13 @@
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+
+	<select id="findByPassengerIdAndPayStatus" resultMap="OrderInfoMap">
+		<![CDATA[
+		select * from base_order_info
+		where del_flag = 0
+		and passenger_id = #{passengerId}
+		and pay_status = #{payStatus}
+		]]>
+	</select>
 </mapper>

+ 12 - 1
common/src/main/resources/mapper/bus/PassengerInfo.xml

@@ -21,6 +21,8 @@
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="userName" column="user_name" />
+			<result property="ticketUpStationId" column="ticket_up_station_id"/>
+			<result property="ticketDownStationId" column="ticket_down_station_id"/>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.bus.modules.bus.entity.PassengerInfo">
 	<!--
@@ -30,7 +32,7 @@
 	-->
 	<![CDATA[
 		insert into bus_passenger_info
-	    (id_,vehicle_shift_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,vehicle_shift_id,vehicle_person_id,user_id,image_url,up_time,down_time,up_station_id,down_station_id,status_,pay_status,create_by,create_time,update_by,update_time,del_flag,ticket_up_station_id,ticket_down_station_id)
 		values
 		(
 #{id,jdbcType=VARCHAR}
@@ -49,6 +51,8 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{ticketUpStationId,jdbcType=VARCHAR}
+,#{ticketDownStationId,jdbcType=VARCHAR}
 		)
 	]]>
 	</insert>
@@ -103,6 +107,13 @@
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
+			<if test="ticketUpStationId!=null">
+				ticket_up_station_id=#{ticketUpStationId,jdbcType=VARCHAR},
+			</if>
+			<if test="ticketDownStationId!=null">
+				ticket_down_station_id=#{ticketDownStationId,jdbcType=VARCHAR},
+			</if>
+
 		</set>
 	where id_=#{id}
 	</update>

+ 21 - 14
web/src/main/java/com/jpsoft/bus/modules/driver/controller/DriverApiController.java

@@ -4,6 +4,8 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.github.pagehelper.Page;
 import com.jpsoft.bus.config.OSSConfig;
+import com.jpsoft.bus.modules.base.entity.OrderInfo;
+import com.jpsoft.bus.modules.base.service.OrderInfoService;
 import com.jpsoft.bus.modules.bus.dto.StationStatusDTO;
 import com.jpsoft.bus.modules.bus.entity.*;
 import com.jpsoft.bus.modules.bus.service.*;
@@ -51,6 +53,9 @@ public class DriverApiController {
     @Autowired
     private BaiduService baiduService;
 
+    @Autowired
+    private OrderInfoService orderInfoService;
+
     @Autowired
     private GpsService gpsService;
 
@@ -119,10 +124,11 @@ public class DriverApiController {
     public MessageResult<DriverInfo> findByPhone(String phone){
 
         MessageResult<DriverInfo> messageResult = new MessageResult<>();
-
         try{
+
             DriverInfo driverInfo = driverInfoService.findByPhone(phone);
 
+
             if (driverInfo == null){
                 throw new Exception("司机不存在");
             }
@@ -186,7 +192,6 @@ public class DriverApiController {
             messageResult.setCode(200);
         } catch (Exception ex) {
             log.error(ex.getMessage(),ex);
-
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -231,34 +236,30 @@ public class DriverApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
-            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
 
+            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
             if (vehicleInfo == null){
                 throw new Exception("当前车辆不存在");
             }
-
             if (StringUtils.isBlank(vehicleInfo.getRouteId())){
                 throw new Exception("当前车辆还未分配线路");
             }
-
             RouteInfo routeInfo = routeInfoService.get(vehicleInfo.getRouteId());
-
             if (routeInfo == null){
                 throw new Exception("线路错误");
             }
-
             //始发站
             List<StationInfo> startStationInfoList = stationInfoService.findByRouteIdAndClassify(routeInfo.getId(),1);
             if (startStationInfoList.size() != 1){
                 throw new Exception("线路的始发站配置错误");
             }
-
             //终点站
             List<StationInfo> endStationInfoList = stationInfoService.findByRouteIdAndClassify(routeInfo.getId(),3);
             if (endStationInfoList.size() != 1){
                 throw new Exception("线路的终点站配置错误");
             }
 
+
             Map<String,Object> map = new HashMap<>();
             map.put("startStationId",startStationInfoList.get(0).getId());
             map.put("startStationName",startStationInfoList.get(0).getName());
@@ -291,14 +292,12 @@ public class DriverApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
-            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
 
+            VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
             if (vehicleInfo == null){
                 throw new Exception("当前车辆不存在");
             }
-
             DriverInfo driverInfo = driverInfoService.get(driverId);
-
             if (driverInfo == null){
                 throw new Exception("司机不存在");
             }
@@ -311,19 +310,17 @@ public class DriverApiController {
 
             //始发站
             StationInfo start = stationInfoService.get(startStationId);
-
             //终点站
             StationInfo end = stationInfoService.get(endStationId);
-
             if (start == null || end == null){
                 throw new Exception("站点错误");
             }
             if (!start.getRouteId().equals(vehicleInfo.getRouteId()) || !end.getRouteId().equals(vehicleInfo.getRouteId())){
                 throw new Exception("站点错误");
             }
-
             shiftInfoService.createShift(vehicleInfo,driverId,startStationId,endStationId);
 
+
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
@@ -345,6 +342,7 @@ public class DriverApiController {
         MessageResult<Map> messageResult = new MessageResult<>();
 
         try {
+
             VehicleInfo vehicleInfo = vehicleInfoService.get(subject);
             if (vehicleInfo == null){
                 throw new Exception("当前车辆不存在");
@@ -424,6 +422,7 @@ public class DriverApiController {
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -481,6 +480,7 @@ public class DriverApiController {
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }
@@ -505,12 +505,19 @@ public class DriverApiController {
             if (vehicleInfo == null){
                 throw new Exception("当前车辆不存在");
             }
+            PassengerInfo passengerInfo = passengerInfoService.get(id);
+            if (passengerInfo == null){
+                throw new Exception("无乘客记录");
+            }
+            List<OrderInfo> orderInfoList = orderInfoService.findByPassengerIdAndPayStatus(id,20);
+
 
 
 
             messageResult.setResult(true);
             messageResult.setCode(200);
         } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
             messageResult.setResult(false);
             messageResult.setMessage(ex.getMessage());
         }

+ 263 - 0
web/src/main/java/com/jpsoft/bus/wechat/controller/WxController.java

@@ -0,0 +1,263 @@
+package com.jpsoft.bus.wechat.controller;
+
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.jpsoft.bus.config.WxConfig;
+import com.jpsoft.bus.modules.common.dto.MessageResult;
+import com.jpsoft.bus.modules.common.utils.Sign;
+import com.jpsoft.bus.modules.common.utils.WeixinUtil;
+import com.jpsoft.bus.modules.wechat.entity.AccessToken;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * @author 墨鱼_mo
+ * @date 2019-12-3 15:08
+ */
+
+@Slf4j
+@RequestMapping("/wechat")
+@RestController
+public class WxController {
+
+
+    @Autowired
+    private WxConfig wxConfig;
+
+
+    @Autowired
+    private ValueOperations<String, Object> valueOperations;
+
+
+
+    @ApiOperation(value = "获取微信配置")
+    @GetMapping(value = "/getConfig")
+    public MessageResult getConfig(String url) {
+
+        int code = 200;
+        String message = "获取成功";
+        Object data = "";
+        boolean result = true;
+
+        try {
+            AccessToken token = WeixinUtil.getAccessToken(wxConfig.getAppId(), wxConfig.getAppSecret());
+
+            Map<String, String> wxMap = Sign.sign(WeixinUtil.getJsAPI(token.getToken()), url);
+
+            wxMap.put("appId", wxConfig.getAppId());
+
+            log.warn(JSONObject.toJSONString(wxMap));
+
+            HashMap<String, Object> dataMap = new HashMap<String, Object>();
+
+            dataMap.put("wxConfig", wxMap);
+
+            data = dataMap;
+        } catch (Exception ex) {
+            log.error(ex.getMessage(),ex);
+
+            code = 500;
+            result = false;
+            message = "系统错误";
+        }
+
+        return new MessageResult(result, message, data, code);
+    }
+
+    @ApiOperation(value = "获取微信code")
+    @PostMapping(value = "findWechatUrl")
+    public MessageResult findWechatUrl(@RequestBody String url) {
+
+        String newpath = WeixinUtil.getCodeRequest(wxConfig.getAppId(), url, "snsapi_userinfo");
+
+        HashMap<String, Object> dataMap = new HashMap<String, Object>();
+
+        dataMap.put("wechatUrl", newpath);
+
+        return new MessageResult(true, "获取成功", dataMap, 200);
+    }
+
+   /* @ApiOperation(value = "获取公众号用户信息")
+    @GetMapping(value = "findUserInfo/{code}")
+    public MessageResult findUserInfo(@PathVariable String code) {
+        try {
+            log.warn("code=" + code);
+            log.warn("appId=" + wxConfig.getAppId());
+            log.warn("appSecret=" + wxConfig.getAppSecret());
+
+            AccessToken at = WeixinUtil.getAccessToken(wxConfig.getAppId(), wxConfig.getAppSecret(), code);
+
+            if (at != null && StringUtils.isNotBlank(at.getOpenid())) {
+                String openId = at.getOpenid();
+                System.out.println("openId:" + openId);
+
+                UserInfo userInfo = WeixinUtil.getUserInfo(openId, at.getToken());
+
+                HashMap<String, Object> dataMap = new HashMap<String, Object>();
+
+                dataMap.put("userInfo", userInfo);
+
+                return new MessageResult(true, "获取微信信息成功", userInfo, 200);
+
+            } else {
+                return new MessageResult(false, "获取微信信息失败", "", 400);
+            }
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return new MessageResult(false, "系统错误", "", 500);
+        }
+    }*/
+
+
+
+
+
+    @ApiOperation(value = "验证服务器地址的有效性")
+    @GetMapping("/get")
+    @ResponseBody
+    public String index(@RequestParam(defaultValue = "") String signature,
+                        @RequestParam(defaultValue = "") String timestamp,
+                        @RequestParam(defaultValue = "") String nonce,
+                        @RequestParam(defaultValue = "") String echostr) {
+        log.warn("signature=" + signature);
+        log.warn("timestamp=" + timestamp);
+        log.warn("nonce=" + nonce);
+        log.warn("echostr=" + echostr);
+
+        if (WeixinUtil.checkSignature(wxConfig.getToken(), signature, timestamp, nonce)) {
+            return echostr;
+        } else {
+            return "index";
+        }
+    }
+
+
+    @ResponseBody
+    @ApiOperation(value = "创建二维码")
+    @PostMapping("/qrcode/create")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "expire_seconds", paramType = "query", required = true, value = "该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒。"),
+            @ApiImplicitParam(name = "action_name", paramType = "query", required = true, value = "二维码类型,QR_SCENE为临时的整型参数值,QR_STR_SCENE为临时的字符串参数值,QR_LIMIT_SCENE为永久的整型参数值,QR_LIMIT_STR_SCENE为永久的字符串参数值"),
+            @ApiImplicitParam(name = "scene_id", paramType = "query", value = "场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)"),
+            @ApiImplicitParam(name = "scene_str", paramType = "query", value = "场景值ID(字符串形式的ID),字符串类型,长度限制为1到64")
+    })
+    public cn.hutool.json.JSONObject createQrcode(@RequestParam(name = "expire_seconds", defaultValue = "300") long expireSeconds,
+                                                  @RequestParam(name = "action_name", defaultValue = "QR_STR_SCENE") String actionName,
+                                                  @RequestParam(name = "scene_id", required = false) String sceneId,
+                                                  @RequestParam(name = "scene_str", required = false) String sceneStr) {
+        cn.hutool.json.JSONObject resultObj = new cn.hutool.json.JSONObject();
+
+        try {
+            StringBuilder urlBuilder = new StringBuilder();
+            AccessToken accessToken = WeixinUtil.getAccessToken(wxConfig.getAppId(), wxConfig.getAppSecret());
+
+            urlBuilder.append(wxConfig.getCreateQrCodeUrl())
+                    .append("?access_token=")
+                    .append(URLEncoder.encode(accessToken.getToken(), "UTF-8"));
+
+            cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject();
+            jsonObject.put("expire_seconds", expireSeconds);
+            jsonObject.put("action_name", actionName);
+
+            cn.hutool.json.JSONObject actionInfo = new cn.hutool.json.JSONObject();
+            cn.hutool.json.JSONObject scene = new cn.hutool.json.JSONObject();
+
+            StringBuilder keyBuilder = new StringBuilder();
+
+            keyBuilder.append(accessToken);
+
+            if (StringUtils.isNotEmpty(sceneId)) {
+                scene.put("scene_id", sceneId);
+                keyBuilder.append(sceneId);
+            }
+
+            if (StringUtils.isNotEmpty(sceneStr)) {
+                scene.put("scene_str", sceneStr);
+                keyBuilder.append(sceneStr);
+            }
+
+            String qrcodeUrl = (String) valueOperations.get("QRCODE_" + keyBuilder.toString());
+
+            if (StringUtils.isNotEmpty(qrcodeUrl)) {
+                resultObj.put("data", qrcodeUrl);
+                resultObj.put("result", true);
+            } else {
+                actionInfo.put("scene", scene);
+
+                jsonObject.put("action_info", actionInfo);
+
+                StringEntity entity = new StringEntity(jsonObject.toString(), "utf-8");
+
+                entity.setContentType("application/json");//发送json数据需要设置contentType
+
+                HttpPost httpPost = new HttpPost(urlBuilder.toString());
+                CloseableHttpClient httpClient = HttpClientBuilder.create().build();
+
+                httpPost.setEntity(entity);
+
+                HttpResponse res = httpClient.execute(httpPost);
+
+                if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+                    String content = EntityUtils.toString(res.getEntity());// 返回json格式:
+                    cn.hutool.json.JSONObject ret = new cn.hutool.json.JSONObject(content);
+
+                    if (ret.containsKey("errcode")) {
+                        resultObj.put("result", false);
+                        resultObj.put("message", ret.getStr("errmsg"));
+                        resultObj.put("code", ret.getInt("errcode"));
+                    } else {
+                        String ticket = ret.getStr("ticket");
+                        long expire_seconds = ret.getLong("expire_seconds");
+
+                        qrcodeUrl = wxConfig.getShowQrCodeUrl() + "?ticket=" + URLEncoder.encode(ticket, "UTF-8");
+
+                        valueOperations.set("QRCODE_" + keyBuilder, qrcodeUrl, expire_seconds - 5, TimeUnit.SECONDS);
+
+                        resultObj.put("data", qrcodeUrl);
+                        resultObj.put("result", true);
+                    }
+                } else {
+                    resultObj.put("result", false);
+                    resultObj.put("message", "weixin服务器未正常返回!");
+                }
+            }
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+
+            resultObj.put("message", ex.getMessage());
+            resultObj.put("result", false);
+        }
+
+        return resultObj;
+    }
+
+
+
+}