dev-discount
袁野 2 years ago
parent d057bd1385
commit a665846035
  1. 5
      v1/src/main/java/com/V1Application.java
  2. 38
      v1/src/main/java/com/v1/controller/WxMsgController.java
  3. 10
      v1/src/main/resources/dev/application.yml
  4. 3
      v1/src/main/resources/prod/config.properties

@ -1,5 +1,7 @@
package com;
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
import com.alicp.jetcache.anno.config.EnableMethodCache;
import com.hai.common.utils.SpringContextUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
@ -14,8 +16,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
//@ComponentScan
@EnableTransactionManagement
@EnableScheduling
@EnableMethodCache(basePackages = "com.hai")
@EnableCreateCacheAnnotation
@ServletComponentScan
@EnableAspectJAutoProxy(proxyTargetClass = true)
@MapperScan("com.hai.dao")
public class V1Application
{

@ -11,9 +11,11 @@ import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst;
import com.hai.entity.HighUser;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.service.HighMerchantStoreService;
import com.hai.service.HighUserService;
import com.v1.config.SysConst;
import com.v1.config.WeChatQrcodeUtils;
import io.swagger.annotations.Api;
@ -53,6 +55,9 @@ public class WxMsgController {
@Resource
private HighMerchantStoreService merchantStoreService;
@Resource
private HighUserService highUserService;
@Resource
private RedisUtil redisUtil;
@ -108,22 +113,42 @@ public class WxMsgController {
String msgType = map.get("MsgType");
// 二维码参数
String eventKey = map.get("EventKey");
String linkContent;
// 判断用户是否是新用户
HighUser user = highUserService.findByOpenIdH5(userOpenId);
String linkContent = null;
String newUserContent = null;
String content = null;
if (eventKey != null && eventKey.length() != 0) {
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")) {
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"));
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 {
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);
// 普通消息
if ("text".equals(msgType)) {
@ -145,12 +170,7 @@ public class WxMsgController {
"终于等到你,还好我没放弃[玫瑰][玫瑰][玫瑰]\n\n" +
"您好,感谢关注嗨森逛商城!\n\n" +
linkContent +
"在线等你来撩~[哇][哇][哇]\n\n" +
"特意为您奉上" +
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
",放在您的"+
"<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+
"里面,记得及时使用哦[爱心][爱心][爱心]\n\n" +
"在线等你来撩~[哇][哇][哇]\n\n" + newUserContent +
"【如遇任何问题请致电客服:400-678-0738】"
;
// todo 业务处理

@ -9,7 +9,7 @@ debug: false
#datasource数据源设置
spring:
datasource:
url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://139.159.177.244:3306/hsg_order?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: HF123456.
type: com.alibaba.druid.pool.DruidDataSource
@ -32,7 +32,7 @@ spring:
host: 139.159.177.244
port: 36379
password: HF123456.Redis
timeout: 36000000
timeout: 1000
jedis:
pool:
max-active: 20
@ -58,6 +58,7 @@ spring:
producer:
#必须指定group
group: default-group
#配置日期返回至前台为时间戳
jackson:
serialization:
@ -67,6 +68,11 @@ mybatis:
- classpath*:sqlmap*/*.xml
type-aliases-package:
org.springboot.sample.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#开启MyBatis的二级缓存
cache-enabled: true
jetcache:
statIntervalMinutes: 15
areaInCacheName: false

@ -1,2 +1,5 @@
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5
wxAppId=wx8d49e2f83025229d
wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df

Loading…
Cancel
Save