修改区域公司

dev-discount
袁野 2 years ago
parent d6981540f1
commit c76936275e
  1. 40
      v1/src/main/java/com/v1/controller/WxMsgController.java

@ -11,9 +11,11 @@ import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.entity.HighUser;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighMerchantStoreService; import com.hai.service.HighMerchantStoreService;
import com.hai.service.HighUserService;
import com.v1.config.SysConst; import com.v1.config.SysConst;
import com.v1.config.WeChatQrcodeUtils; import com.v1.config.WeChatQrcodeUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -53,6 +55,9 @@ public class WxMsgController {
@Resource @Resource
private HighMerchantStoreService merchantStoreService; private HighMerchantStoreService merchantStoreService;
@Resource
private HighUserService highUserService;
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
@ -89,8 +94,6 @@ public class WxMsgController {
try { try {
log.info("进入公众号!!!!!!!"); log.info("进入公众号!!!!!!!");
// 反馈给微信服务器
String resXml = "";
// 微信支付系统发送的数据(<![CDATA[product_001]]>格式) // 微信支付系统发送的数据(<![CDATA[product_001]]>格式)
String notifyXml; String notifyXml;
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
@ -108,22 +111,42 @@ public class WxMsgController {
String msgType = map.get("MsgType"); String msgType = map.get("MsgType");
// 二维码参数 // 二维码参数
String eventKey = map.get("EventKey"); String eventKey = map.get("EventKey");
String linkContent;
// 判断用户是否是新用户
HighUser user = highUserService.findByOpenIdH5(userOpenId);
String linkContent = null;
String newUserContent = null;
String content = null; String content = null;
if (eventKey != null && eventKey.length() != 0) { if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey); JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码 type = 2 // type = 1 推广扫码 type = 2 商户门店 3:查看视频教程
if (Objects.equals(object.getString("qrscene_type"), "1") || Objects.equals(object.getString("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 if (Objects.equals(object.getString("qrscene_type"), "2") || Objects.equals(object.getString("type"), "2")){
// 商户门店 // 商户门店
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code")); HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code"));
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"; 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 if (Objects.equals(object.getString("qrscene_type"), "3") || Objects.equals(object.getString("type"), "3")){
// 商户门店
linkContent = "<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看重庆中石油视频教程</a>" +
"[哇][哇][哇]\n\n<a href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>点击查看贵州中石化视频教程</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";
} }
// 判断是否是新用户
if (user == null) {
newUserContent = "特意为您奉上" +
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
",放在您的"+
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n";
}
log.info("二维码参数:" + eventKey); log.info("二维码参数:" + eventKey);
// 普通消息 // 普通消息
if ("text".equals(msgType)) { if ("text".equals(msgType)) {
@ -145,12 +168,7 @@ public class WxMsgController {
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" + "终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" +
"您好,感谢关注嗨森逛商城!\n\n" + "您好,感谢关注嗨森逛商城!\n\n" +
linkContent + linkContent +
"在线等你来撩~[哇][哇][哇]\n\n" + "在线等你来撩~[哇][哇][哇]\n\n" + newUserContent +
"特意为您奉上" +
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
",放在您的"+
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n" +
"【如遇任何问题请致电客服:400-678-0738】" "【如遇任何问题请致电客服:400-678-0738】"
; ;
// todo 业务处理 // todo 业务处理

Loading…
Cancel
Save