Merge branch 'master' into dev_yy

* master:
  提交微信小程序多次推送问题
  no message
  提交代码
  提交代码
  提交代码
  1
  1
dev-discount
袁野 2 years ago
commit d17a7b0b57
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  3. 12
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  4. 6
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  5. 13
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  6. 2
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  7. 2
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  8. 1
      v1/src/main/java/com/v1/config/WeChatQrcodeUtils.java
  9. 52
      v1/src/main/java/com/v1/config/WxConfig.java
  10. 54
      v1/src/main/java/com/v1/controller/WxMsgController.java
  11. 2
      v1/src/main/resources/prod/config.properties

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,13 +8,12 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.*; import com.hai.common.security.*;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.ImageUtils; import com.hai.common.utils.ImageUtils;
import com.hai.common.utils.RedisUtil; import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig; import com.hai.config.CommonConfig;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.entity.HighUserCoupon;
import com.hai.entity.HighUserPayPassword; import com.hai.entity.HighUserPayPassword;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
@ -22,7 +21,6 @@ import com.hai.service.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -348,11 +346,13 @@ public class HighUserController {
SessionObject sessionObject = userCenter.getSessionObject(request); SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
String path = ImageUtils.QrCodeImg(SysConst.getSysConfig().getQrCodeUrl() , userInfoModel.getHighUser().getId().intValue()); String sceneId = "type=1&code=" + userInfoModel.getHighUser().getId();
CommonConfig.overlapImage(path , userInfoModel.getHighUser().getId().toString()); Map<String, Object> params = new HashMap<>();
params.put("sceneId", sceneId);
return ResponseMsgUtil.success(HttpsUtils.doGet("https://hsg.dctpay.com/v1/wxMsg/createQrcode", params).getString("return_data"));
return ResponseMsgUtil.success(SysConst.getSysConfig().getImgUrl() + path);
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e); log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -121,6 +121,7 @@ public class CzOrderController {
// 判断是否充值成功 // 判断是否充值成功
if (dataObject.getInteger("status") == 3) { if (dataObject.getInteger("status") == 3) {
if (rechargeOrder.getRechargeStatus() ==201) {
new Thread(() -> { new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedSuccess( WxMsgConfig.rechargedSuccess(
@ -131,6 +132,8 @@ public class CzOrderController {
RechargePayType.getNameByType(rechargeOrder.getPayType()), RechargePayType.getNameByType(rechargeOrder.getPayType()),
highUser.getOpenId()); highUser.getOpenId());
}).start(); }).start();
}
childOrder.setStatus(101); childOrder.setStatus(101);
rechargeOrder.setRechargeStatus(202); rechargeOrder.setRechargeStatus(202);
rechargeOrder.setPayStatus(100); rechargeOrder.setPayStatus(100);
@ -188,6 +191,8 @@ public class CzOrderController {
// 判断是否充值成功 // 判断是否充值成功
if (state == 1) { if (state == 1) {
if (rechargeOrder.getRechargeStatus() ==201) {
new Thread(() -> { new Thread(() -> {
HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId()); HighUser highUser = highUserService.findByUserId(rechargeOrder.getUserId());
WxMsgConfig.rechargedSuccess( WxMsgConfig.rechargedSuccess(
@ -198,6 +203,7 @@ public class CzOrderController {
RechargePayType.getNameByType(rechargeOrder.getPayType()), RechargePayType.getNameByType(rechargeOrder.getPayType()),
highUser.getOpenId()); highUser.getOpenId());
}).start(); }).start();
}
childOrder.setStatus(101); childOrder.setStatus(101);
rechargeOrder.setRechargeStatus(202); rechargeOrder.setRechargeStatus(202);
rechargeOrder.setPayStatus(100); rechargeOrder.setPayStatus(100);

@ -151,25 +151,16 @@ public class HighGasSchedule {
} }
} }
/* @Scheduled(cron = "0 1 0 * * ?") //每日凌晨12点01分执行一次 @Scheduled(cron = "10 0 0 * * ?") // 每日凌晨00:00:10执行一次
public void getJiaHaoYouAllStation() throws Exception { public void getJiaHaoYouAllStation() throws Exception {
gasService.getJiaHaoYouAllStation(); gasService.getJiaHaoYouAllStation();
} }
@Scheduled(cron = "0 1 0 * * ?") //每日凌晨12点01分执行一次 /* @Scheduled(cron = "0 1 0 * * ?") //每日凌晨12点01分执行一次
public void getJinZhuAllStation() throws Exception { public void getJinZhuAllStation() throws Exception {
gasService.getJinZhuAllStation(); gasService.getJinZhuAllStation();
}*/ }*/
@Scheduled(cron = "0 40 7 13 * ?")
public void getJinZhuAllStation() throws Exception {
HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey("11052456");
if (store != null) {
store.setStatus(0);
highMerchantStoreService.updateMerchantStoreDetail(store);
}
}
/* @Scheduled(cron = "0 30 7 * * ?") //每日7点1分执行一次 /* @Scheduled(cron = "0 30 7 * * ?") //每日7点1分执行一次
public void refreshPriceOfficial() throws Exception { public void refreshPriceOfficial() throws Exception {
gasOilPriceOfficialService.refreshPriceOfficial(); gasOilPriceOfficialService.refreshPriceOfficial();

@ -101,7 +101,7 @@ public class HighOrderSchedule {
public void initRechargeOrder() { public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("payStatus", String.valueOf(102)); map.put("payStatus", String.valueOf(102));
map.put("rechargeStatus", String.valueOf(204)); map.put("rechargeStatus", String.valueOf(205));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map); List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
if (orderList.size() > 0) { if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) { for (OutRechargeOrder order : orderList) {

@ -975,7 +975,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
} }
if (childOrder.getStatus() == 103) { if (childOrder.getStatus() == 103) {
outRechargeOrder.setRechargeStatus(204); outRechargeOrder.setRechargeStatus(205);
} }
outRechargeOrderService.updateOrder(outRechargeOrder); outRechargeOrderService.updateOrder(outRechargeOrder);
System.out.println("话费定时任务 -> 需要重新充值:结束"); System.out.println("话费定时任务 -> 需要重新充值:结束");

@ -10,7 +10,6 @@ import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.util.Map; import java.util.Map;

@ -53,5 +53,57 @@ public class WxConfig {
} }
/**
* 处理 subscribe 类型的event
*
* @param map
* @param userOpenId
* @return
*/
private String handleEventSubscribe(Map<String, String> map, String userOpenId) {
String resXmlStr = getReturnMsgSubscribe(map);
return resXmlStr;
}
public String getReturnMsgSubscribe(Map<String, String> decryptMap) {
TextMessage textMessage = new TextMessage();
textMessage.setToUserName(decryptMap.get("FromUserName"));
textMessage.setFromUserName(decryptMap.get("ToUserName"));
textMessage.setCreateTime(System.currentTimeMillis());
textMessage.setMsgType("text");
textMessage.setContent("你好,欢迎关注XXX!\n" +
"\n" +
"关注XXX。立即登录PC端网址 \n" +
" 即可完成注册!\n" +
"\n" +
"或," +
"<a href='https://hsgcs.dctpay.com/hsgH5?accountId=000000&gasKey=11000697&staffCode='>点击这里立即完成注册</a>");
return getXmlString(textMessage);
}
public String getXmlString(TextMessage textMessage) {
String xml = "";
if (textMessage != null) {
xml = "<xml>";
xml += "<ToUserName><![CDATA[";
xml += textMessage.getToUserName();
xml += "]]></ToUserName>";
xml += "<FromUserName><![CDATA[";
xml += textMessage.getFromUserName();
xml += "]]></FromUserName>";
xml += "<CreateTime>";
xml += textMessage.getCreateTime();
xml += "</CreateTime>";
xml += "<MsgType><![CDATA[";
xml += textMessage.getMsgType();
xml += "]]></MsgType>";
xml += "<Content><![CDATA[";
xml += textMessage.getContent();
xml += "]]></Content>";
xml += "</xml>";
}
return xml;
}
} }

@ -1,6 +1,5 @@
package com.v1.controller; package com.v1.controller;
import com.alibaba.druid.sql.visitor.functions.If;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
@ -9,11 +8,9 @@ import com.hai.common.pay.util.IOUtil;
import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.XmlUtil;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.TextMessage;
import com.hai.service.HighMerchantStoreService; import com.hai.service.HighMerchantStoreService;
import com.v1.config.SysConst; import com.v1.config.SysConst;
import com.v1.config.WeChatQrcodeUtils; import com.v1.config.WeChatQrcodeUtils;
@ -30,18 +27,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.BufferedOutputStream;
import java.io.StringReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -64,7 +54,32 @@ public class WxMsgController {
@Resource @Resource
private HighMerchantStoreService merchantStoreService; private HighMerchantStoreService merchantStoreService;
// @RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET)
// @ResponseBody
// @ApiOperation(value = "验证servlet")
// public String verifyWxToken(
// @RequestParam(name = "signature", required = false) String signature,
// @RequestParam(name = "timestamp", required = false) String timestamp,
// @RequestParam(name = "nonce", required = false) String nonce,
// @RequestParam(name = "echostr", required = false) String echostr
// ) {
//
// try {
//
// String signatureStr = WxUtils.getSHA1("RgAWdnR5oEOLBdyEjfr4" , timestamp , nonce);
// log.info("signatureStr!!!!!" + signatureStr);
// log.info("signature!!!!!" + signature);
// if (signature.equals(signatureStr)) {
// log.info("验证通过!!!!!");
// return echostr;
// }
// log.info("验证失败!!!!!");
// return null;
// } catch (Exception e) {
// return null;
// }
//
// }
@RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST) @RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "验证servlet") @ApiOperation(value = "验证servlet")
@ -93,18 +108,18 @@ public class WxMsgController {
String eventKey = map.get("EventKey"); String eventKey = map.get("EventKey");
String linkContent; String linkContent;
String content = null; String content = null;
if (eventKey != null) { if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey); JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码 type = 2 // type = 1 推广扫码 type = 2
if (Objects.equals(object.getString("qrscene_type"), "1")) { if (Objects.equals(object.getString("qrscene_type"), "1") || Objects.equals(object.getString("type"), "1")) {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000010&key=&code=" + object.getString("code") + "'>点击注册</a>\n\n"; linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000010&key=&code=" + object.getString("code") + "'>点击查看更多优惠</a>\n\n";
} else { } else {
// 商户门店 // 商户门店
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code"));
linkContent = "欢迎来到" + store.getStoreName() + "[哇][哇][哇]\n\n<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>点击这里一键加油</a>\n\n"; linkContent = "<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>" + "[哇][哇][哇]\n\n<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey=" + object.getString("code") + "&staffCode='>点击这里一键加油</a>\n\n";
} }
} else { } else {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击注册</a>\n\n"; linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n";
} }
log.info("二维码参数:" + eventKey); log.info("二维码参数:" + eventKey);
@ -132,7 +147,7 @@ public class WxMsgController {
"特意为您奉上" + "特意为您奉上" +
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" + "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
",放在您的"+ ",放在您的"+
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>卡包</a>"+ "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>我的优惠券</a>"+
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n" + "里面,记得及时使用哦[爱心][爱心][爱心]\n\n" +
"【如遇任何问题请致电客服:400-678-0738】" "【如遇任何问题请致电客服:400-678-0738】"
; ;
@ -204,7 +219,10 @@ public class WxMsgController {
@ApiOperation(value = "创建生成二维码") @ApiOperation(value = "创建生成二维码")
public ResponseData createQrcode(@RequestParam(name = "sceneId", required = false) String sceneId) { public ResponseData createQrcode(@RequestParam(name = "sceneId", required = false) String sceneId) {
try { try {
return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId));
String ticket = weChatQrcodeUtils.qrCodeCreateLastTicket(sceneId).getTicket();
return ResponseMsgUtil.success(weChatQrcodeUtils.qrCodePictureUrl(ticket));
} catch (WxErrorException e) { } catch (WxErrorException e) {
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);
} }

@ -0,0 +1,2 @@
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5
Loading…
Cancel
Save