|
@@ -6,6 +6,10 @@ import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
+import com.iamberry.wechat.core.entity.activity.ActivityDate;
|
|
|
|
+import com.iamberry.wechat.core.entity.admin.FullReduction;
|
|
|
|
+import com.iamberry.wechat.service.ActivityUtil;
|
|
|
|
+import com.iamberry.wechat.service.member.dao.MemberDao;
|
|
import com.iamberry.wechat.tools.*;
|
|
import com.iamberry.wechat.tools.*;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
@@ -72,9 +76,12 @@ public class WeChatServiceImpl implements WeChatService {
|
|
private SystemService systemService;
|
|
private SystemService systemService;
|
|
@Autowired
|
|
@Autowired
|
|
private WdRelationDao wdRelationDao;
|
|
private WdRelationDao wdRelationDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private MemberDao memberDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ActivityUtil activityUtil;
|
|
/**
|
|
/**
|
|
* 处理微信发来的请求
|
|
* 处理微信发来的请求
|
|
- * @param request
|
|
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@@ -135,10 +142,12 @@ public class WeChatServiceImpl implements WeChatService {
|
|
return xml;
|
|
return xml;
|
|
}
|
|
}
|
|
|
|
|
|
- if (content.startsWith(NameUtils.getConfig("PLACE_CODE_PREFIX"))) {// 激活码为“CODE”开头 则为代理商绑定
|
|
|
|
- content = StringUtils.trim(content);
|
|
|
|
- respContent = bulidPlace(content, fromUserName);
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (content.startsWith(NameUtils.getConfig("PLACE_CODE_PREFIX"))) {// 激活码为“CODE”开头 则为代理商绑定
|
|
|
|
+ content = StringUtils.trim(content);
|
|
|
|
+ respContent = bulidPlace(content, fromUserName);
|
|
|
|
+ }if (content.startsWith(NameUtils.getConfig("FEMALE_LADY"))) {// 2019-3-8节活动 输入女王节可获得满减满赠优惠
|
|
|
|
+ respContent = addFullReduction(fromUserName);//为该用户添加满减资格记录
|
|
|
|
+ } else {
|
|
// 文本类型的消息处理
|
|
// 文本类型的消息处理
|
|
Status status = messageHandler(content, requestMap, fromUserName, toUserName, createTime+"");
|
|
Status status = messageHandler(content, requestMap, fromUserName, toUserName, createTime+"");
|
|
if (status.isFlag()) {
|
|
if (status.isFlag()) {
|
|
@@ -371,6 +380,36 @@ public class WeChatServiceImpl implements WeChatService {
|
|
return qrcodeResult.getQroceUrl();
|
|
return qrcodeResult.getQroceUrl();
|
|
}*/
|
|
}*/
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加用户满减满赠资格(2019 38女王节活动)
|
|
|
|
+ * @param fromUserName openid
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String addFullReduction(String fromUserName) {
|
|
|
|
+ ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
|
|
+ if(activityDate.isStatus()){
|
|
|
|
+ if (fromUserName == null) {
|
|
|
|
+ return NameUtils.getConfig("FEMALE_LADY_ERROR");
|
|
|
|
+ }
|
|
|
|
+ // 判断此用户是否已有资格
|
|
|
|
+ FullReduction fullReduction = memberDao.getFullReduction(fromUserName);
|
|
|
|
+ if (fullReduction != null) {
|
|
|
|
+ return NameUtils.getConfig("FEMALE_LADY_REPLY");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 绑定关系
|
|
|
|
+ int count = memberDao.addFullReduction(fromUserName);
|
|
|
|
+ if (count < 1) {
|
|
|
|
+ return NameUtils.getConfig("FEMALE_LADY_ERROR");
|
|
|
|
+ }else{
|
|
|
|
+ StringBuffer buffer = new StringBuffer(NameUtils.getConfig("FEMALE_LADY_REPLY"));
|
|
|
|
+ return buffer.toString();
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ return NameUtils.getConfig("FEMALE_LADY_INTRODUCE");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 已关注用户扫描二维码事件
|
|
* 已关注用户扫描二维码事件
|