...
|
...
|
@@ -2,6 +2,7 @@ package com.yoho.activity.controller; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Controller;
|
...
|
...
|
@@ -61,7 +62,14 @@ public class OrderShareController { |
|
|
@ResponseBody
|
|
|
public ApiResponse getInfoOfOrderShare(UserShareHistoryVO request) {
|
|
|
logger.info("getActivityInfo param request={}", request);
|
|
|
OrderShareBO data = orderShareActivityService.getShareInfo(request.getOrdercode(), request.getUid());
|
|
|
OrderShareBO data=null;
|
|
|
if(request.getOrdercode()==null||request.getOrdercode().trim().equals("")||request.getUid()==0){
|
|
|
data=new OrderShareBO();
|
|
|
data.setFlag(7);
|
|
|
data.setReturnMsg("参数输入有误");
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(data).message("参数输入有误").build();
|
|
|
}
|
|
|
data = orderShareActivityService.getShareInfo(request.getOrdercode(), request.getUid());
|
|
|
return new ApiResponse(data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -77,7 +85,18 @@ public class OrderShareController { |
|
|
@ResponseBody
|
|
|
public ApiResponse drawOrderShareCoupon(String mobile, String ordercode) {
|
|
|
logger.info("drawOrderShareCoupon enter, mobile: {}, orderCode: {}", mobile, ordercode);
|
|
|
DrawOrderShareCouponRespBO respBO = orderShareActivityService.drawOrderShareCoupon(mobile, ordercode);
|
|
|
DrawOrderShareCouponRespBO respBO=null;
|
|
|
if(mobile==null||!validMobile(mobile)){
|
|
|
respBO=new DrawOrderShareCouponRespBO(mobile,0);
|
|
|
respBO.setReturnCode(1);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("手机号格式不正确").build();
|
|
|
}
|
|
|
if(ordercode==null||ordercode.trim().equals("")){
|
|
|
respBO=new DrawOrderShareCouponRespBO(mobile,0);
|
|
|
respBO.setReturnCode(9);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(null).message("订单号不可为空").build();
|
|
|
}
|
|
|
respBO = orderShareActivityService.drawOrderShareCoupon(mobile, ordercode);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("ok").build();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -94,8 +113,35 @@ public class OrderShareController { |
|
|
@ResponseBody
|
|
|
public ApiResponse registerAndSendCoupon(String mobile, String ordercode, String identifycode) {
|
|
|
logger.info("registerAndSendCoupon enter, mobile: {}, orderCode: {}, identifyCode : {}", mobile, ordercode, identifycode);
|
|
|
|
|
|
DrawOrderShareCouponRespBO respBO = orderShareActivityService.registerAndSendCoupon(mobile, ordercode, identifycode);
|
|
|
DrawOrderShareCouponRespBO respBO=null;
|
|
|
if(mobile==null||!validMobile(mobile)){
|
|
|
respBO=new DrawOrderShareCouponRespBO(mobile,0);
|
|
|
respBO.setReturnCode(1);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("手机号格式不正确").build();
|
|
|
}
|
|
|
if(ordercode==null||ordercode.trim().equals("")){
|
|
|
respBO=new DrawOrderShareCouponRespBO(mobile,0);
|
|
|
respBO.setReturnCode(9);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(null).message("订单号不可为空").build();
|
|
|
}
|
|
|
|
|
|
if(identifycode==null||identifycode.trim().equals("")){
|
|
|
respBO=new DrawOrderShareCouponRespBO(mobile,0);
|
|
|
respBO.setReturnCode(10);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(null).message("验证码不可为空").build();
|
|
|
}
|
|
|
|
|
|
respBO = orderShareActivityService.registerAndSendCoupon(mobile, ordercode, identifycode);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("ok").build();
|
|
|
}
|
|
|
|
|
|
private boolean validMobile(String mobile) {
|
|
|
if (mobile == null)
|
|
|
return false;
|
|
|
|
|
|
if (mobile.length() != 11)
|
|
|
return false;
|
|
|
|
|
|
return StringUtils.isNumeric(mobile);
|
|
|
}
|
|
|
} |
...
|
...
|
|