|
@@ -5,7 +5,9 @@ import com.google.gson.Gson;
|
|
|
import com.platform.yijia.param.request.AppUserInfoRequest;
|
|
|
import com.platform.yijia.pojo.AppUserInfo;
|
|
|
import com.platform.yijia.pojo.CustomerManage;
|
|
|
+import com.platform.yijia.pojo.CustomerPoints;
|
|
|
import com.platform.yijia.service.AppUserInfoService;
|
|
|
+import com.platform.yijia.service.CustomerPointsService;
|
|
|
import com.platform.yijia.service.PayOrderService;
|
|
|
import com.platform.yijia.service.StationService;
|
|
|
import com.platform.yijia.utils.CodeMsg;
|
|
@@ -20,7 +22,6 @@ import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -35,6 +36,8 @@ public class AppUserInfoController {
|
|
|
private AppUserInfoService appUserInfoService;
|
|
|
@Resource
|
|
|
private StationService stationService;
|
|
|
+ @Resource
|
|
|
+ private CustomerPointsService customerPointsService;
|
|
|
// String appId = "wxe1135cd390b38a54"; //微信小程序appID
|
|
|
// String appSecret = "0532c7d9ae876c4ad636df0b1e3b9ddb"; //微信小程序密钥
|
|
|
|
|
@@ -85,6 +88,7 @@ public class AppUserInfoController {
|
|
|
ResultData resultData=null;
|
|
|
try{
|
|
|
AppUserInfo appUserInfo =new AppUserInfo();
|
|
|
+ CustomerPoints customerPoints = new CustomerPoints();
|
|
|
String openId = ""; //此参数用于查询该用户是否已注册过
|
|
|
if(request.getUserType()!=null){
|
|
|
//1-微信公众号
|
|
@@ -93,19 +97,23 @@ public class AppUserInfoController {
|
|
|
appUserInfo.setBlogToken(request.getBlogToken());
|
|
|
openId = request.getBlogOpenid();
|
|
|
appUserInfo.setBlogOpenid(openId);
|
|
|
+ customerPoints.setBlogOpenId(openId);
|
|
|
//2-微信小程序
|
|
|
}else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getMinaOpenid())){
|
|
|
appUserInfo.setUserType(request.getUserType());
|
|
|
appUserInfo.setMinaToken(request.getMinaToken());
|
|
|
openId = request.getMinaOpenid();
|
|
|
appUserInfo.setMinaOpenid(openId);
|
|
|
+ customerPoints.setMinaOpenId(openId);
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getBlogNickName())){
|
|
|
appUserInfo.setBlogNickName(request.getBlogNickName());
|
|
|
+ customerPoints.setCustomerName(request.getBlogNickName());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getMobilePhone())){
|
|
|
appUserInfo.setMobilePhone(request.getMobilePhone());
|
|
|
+ customerPoints.setMobilePhone(request.getMobilePhone());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getBlogProfilePhoto())){
|
|
|
appUserInfo.setBlogProfilePhoto(request.getBlogProfilePhoto());
|
|
@@ -113,6 +121,14 @@ public class AppUserInfoController {
|
|
|
|
|
|
appUserInfo.setRegisteDate(new Date());
|
|
|
appUserInfo.setUpdateDate(new Date());
|
|
|
+ appUserInfo.setUnionId(request.getUnionId());
|
|
|
+
|
|
|
+ //customerPoints.setCreateTime(new Date());
|
|
|
+ customerPoints.setUnionId(request.getUnionId());
|
|
|
+ customerPoints.setPoints(0);
|
|
|
+ customerPoints.setConsumptionPoints(0);
|
|
|
+ customerPoints.setAccumulatePoints(0);
|
|
|
+ customerPoints.setInvalidPoints(0);
|
|
|
|
|
|
if(StringUtils.isNotBlank(request.getSexFlag())){
|
|
|
appUserInfo.setSexFlag(request.getSexFlag());
|
|
@@ -124,9 +140,14 @@ public class AppUserInfoController {
|
|
|
//判断该用户是否已存在
|
|
|
int count = appUserInfoService.isExistAppUser(params);
|
|
|
if(count > 0){
|
|
|
+// boolean boo = customerPointsService.isExistCustomerPointsInfo(customerPoints);
|
|
|
+// if(!boo){
|
|
|
+// customerPointsService.insertCustomerPointsInfo(customerPoints);
|
|
|
+// }
|
|
|
resultData = ResultData.error(CodeMsg.USER_EXSIST);
|
|
|
}else {
|
|
|
appUserInfoService.AddAppUserInfo(appUserInfo);
|
|
|
+// customerPointsService.insertCustomerPointsInfo(customerPoints);
|
|
|
resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
|
}
|
|
|
}catch (Exception e){
|