|
@@ -15,6 +15,8 @@ import com.iamberry.wechat.face.thanksgiving.ThanksGivingService;
|
|
|
import com.iamberry.wechat.service.ImberryConfig;
|
|
|
import com.iamberry.wechat.tools.NameUtils;
|
|
|
import com.iamberry.wechat.tools.payUtil.RandomUtil;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -38,6 +40,8 @@ import java.util.List;
|
|
|
@RequestMapping("/wechat/tanksgiv")
|
|
|
public class ThanksGivingHandler {
|
|
|
|
|
|
+ private Logger logger = LoggerFactory.getLogger(ThanksGivingHandler.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
private CodeService codeService;
|
|
|
@Autowired
|
|
@@ -116,6 +120,8 @@ public class ThanksGivingHandler {
|
|
|
if(phone.length() != 11){
|
|
|
rm.setMessage(ResultMsg.ERROR);
|
|
|
rm.setMessage("电话号码错误!");
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"==电话号码错误!");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==电话号码错误!");
|
|
|
return rm;
|
|
|
}
|
|
|
|
|
@@ -128,6 +134,8 @@ public class ThanksGivingHandler {
|
|
|
member.setUserStatus(1);
|
|
|
int flag = homeService.insertMemberInfo(member);
|
|
|
if (flag < 1) {
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"==请先关注“Watero水时代”公众号,并联系客服添加用户!");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==请先关注“Watero水时代”公众号,并联系客服添加用户!");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "请先关注“Watero水时代”公众号,并联系客服添加用户!",null);
|
|
|
}
|
|
|
}
|
|
@@ -136,6 +144,8 @@ public class ThanksGivingHandler {
|
|
|
thanksGiving.setThanksGivingPhone(phone);
|
|
|
List<ThanksGiving> thanksGivingList = thanksGivingService.getThanksGivingList(thanksGiving);
|
|
|
if(thanksGivingList == null || thanksGivingList.size() < 1){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员!");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员!");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员!",null);
|
|
|
}
|
|
|
|
|
@@ -176,6 +186,8 @@ public class ThanksGivingHandler {
|
|
|
member.setUserStatus(1);
|
|
|
int flag = homeService.insertMemberInfo(member);
|
|
|
if (flag < 1) {
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=请先关注“Watero水时代”公众号,并联系客服添加用户!");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==请先关注“Watero水时代”公众号,并联系客服添加用户!");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "请先关注“Watero水时代”公众号,并联系客服添加用户!",null);
|
|
|
}
|
|
|
}
|
|
@@ -186,6 +198,8 @@ public class ThanksGivingHandler {
|
|
|
String verificationCode = (String) session.getAttribute("verification_code");
|
|
|
Date verificationDate = (Date) session.getAttribute("verification_date");
|
|
|
if(verificationTel == null || verificationCode == null || verificationDate == null){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=领取出错,请重新获取验证码");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==领取出错,请重新获取验证码");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "领取出错,请重新获取验证码!",null);
|
|
|
}
|
|
|
if(phone.length() != 11 && phone.equals(verificationTel)){
|
|
@@ -201,6 +215,8 @@ public class ThanksGivingHandler {
|
|
|
nowTime.add(Calendar.MINUTE, 5);
|
|
|
Date verData = nowTime.getTime();
|
|
|
if(!verificationCode.equals(code)){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=验证码不正确,请重新输入");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"==验证码不正确,请重新输入");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "验证码不正确,请重新输入!",null);
|
|
|
}
|
|
|
if((verData.getTime() < System.currentTimeMillis())){
|
|
@@ -211,10 +227,14 @@ public class ThanksGivingHandler {
|
|
|
thanksGiving.setThanksGivingPhone(phone);
|
|
|
List<ThanksGiving> thanksGivingList = thanksGivingService.getThanksGivingList(thanksGiving);
|
|
|
if(thanksGivingList == null){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"=您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "您的手机号码未录入到老客户行列,暂时无法领取,详情请联系客服人员!",null);
|
|
|
}
|
|
|
thanksGiving = thanksGivingList.get(0);
|
|
|
if(thanksGiving.getThanksGivingStatus() != 1 ){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=领取失败,该电话号码已领取优惠券!==="+thanksGiving.getThanksGivingStatus());
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"=领取失败,该电话号码已领取优惠券!==="+thanksGiving.getThanksGivingStatus());
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "领取失败,该电话号码已领取优惠券!",null);
|
|
|
}
|
|
|
|
|
@@ -230,6 +250,8 @@ public class ThanksGivingHandler {
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, e.getMessage(),null);
|
|
|
}
|
|
|
if(flag < 1){
|
|
|
+ logger.info("openid="+member.getUserOpenid()+"phone:"+phone+"=领取失败,请重新领取!");
|
|
|
+ System.out.println("openid="+member.getUserOpenid()+"phone:"+phone+"=领取失败,请重新领取!");
|
|
|
return new ResultMsg(false, ResultMsg.ERROR, "领取失败,请重新领取!",null);
|
|
|
}
|
|
|
|