|
@@ -7,6 +7,7 @@ import com.platform.yijia.pojo.AppUserInfo;
|
|
|
import com.platform.yijia.pojo.CustomerManage;
|
|
|
import com.platform.yijia.service.AppUserInfoService;
|
|
|
import com.platform.yijia.service.PayOrderService;
|
|
|
+import com.platform.yijia.service.StationService;
|
|
|
import com.platform.yijia.utils.CodeMsg;
|
|
|
import com.platform.yijia.utils.ResultData;
|
|
|
import com.platform.yijia.utils.weixinapp.AesDecryptUtil;
|
|
@@ -32,17 +33,27 @@ public class AppUserInfoController {
|
|
|
private PayOrderService payOrderService;
|
|
|
@Autowired
|
|
|
private AppUserInfoService appUserInfoService;
|
|
|
+ @Resource
|
|
|
+ private StationService stationService;
|
|
|
String appId = "wxe1135cd390b38a54"; //微信小程序appID
|
|
|
String appSecret = "0532c7d9ae876c4ad636df0b1e3b9ddb"; //微信小程序密钥
|
|
|
|
|
|
/*
|
|
|
* 微信小程序根据code获取用户openId和sessionKey
|
|
|
* @param code
|
|
|
+ * , @RequestParam("stationId") String stationId
|
|
|
* @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "/getSessionKeyAndOpenID")
|
|
|
public Map<String, Object> getSessionKeyAndOpenID(@RequestParam("code") String code){
|
|
|
+// String appId = ""; //微信小程序appID
|
|
|
+// String appSecret = ""; //微信小程序密钥
|
|
|
+// if(stationId !=null && stationId !=""){
|
|
|
+// Map<String, String> map = stationService.getStationAppIdAndAppSecret(stationId);
|
|
|
+// appId = map.get("appId"); //微信小程序appID
|
|
|
+// appSecret = map.get("appSecret"); //微信小程序密钥
|
|
|
+// }
|
|
|
//获取session_key 和 openid
|
|
|
return WeiXinUserUtil.getUserSessionKeyAndOpenID(appId, appSecret, code);
|
|
|
}
|
|
@@ -73,7 +84,6 @@ public class AppUserInfoController {
|
|
|
ResultData resultData=null;
|
|
|
try{
|
|
|
AppUserInfo appUserInfo =new AppUserInfo();
|
|
|
- //CustomerManage customerManage = new CustomerManage();
|
|
|
String openId = ""; //此参数用于查询该用户是否已注册过
|
|
|
//String token =""; //用户token
|
|
|
if(request.getUserType()!=null){
|
|
@@ -84,7 +94,6 @@ public class AppUserInfoController {
|
|
|
appUserInfo.setBlogToken(request.getBlogToken());
|
|
|
openId = request.getBlogOpenid();
|
|
|
appUserInfo.setBlogOpenid(openId);
|
|
|
- //customerManage.setBlogOpenid(openId);
|
|
|
//2-微信小程序
|
|
|
}else if(request.getUserType().equals("2") &&StringUtils.isNotBlank(request.getMinaOpenid())){
|
|
|
appUserInfo.setUserType(request.getUserType());
|
|
@@ -92,16 +101,13 @@ public class AppUserInfoController {
|
|
|
appUserInfo.setMinaToken(request.getMinaToken());
|
|
|
openId = request.getMinaOpenid();
|
|
|
appUserInfo.setMinaOpenid(openId);
|
|
|
- //customerManage.setMinaOpenid(openId);
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getBlogNickName())){
|
|
|
appUserInfo.setBlogNickName(request.getBlogNickName());
|
|
|
- //customerManage.setCustomerName(request.getBlogNickName());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getMobilePhone())){
|
|
|
appUserInfo.setMobilePhone(request.getMobilePhone());
|
|
|
- //customerManage.setPhoneNumber(request.getMobilePhone());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(request.getBlogProfilePhoto())){
|
|
|
appUserInfo.setBlogProfilePhoto(request.getBlogProfilePhoto());
|
|
@@ -109,14 +115,11 @@ public class AppUserInfoController {
|
|
|
|
|
|
appUserInfo.setRegisteDate(new Date());
|
|
|
appUserInfo.setUpdateDate(new Date());
|
|
|
- //customerManage.setRegtime(appUserInfo.getRegisteDate());
|
|
|
|
|
|
if(StringUtils.isNotBlank(request.getSexFlag())){
|
|
|
appUserInfo.setSexFlag(request.getSexFlag());
|
|
|
}
|
|
|
|
|
|
-// customerManage.setLiters(new BigDecimal(0));
|
|
|
-// customerManage.setAmt(new BigDecimal(0));
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("openId", openId); //注册用户openId
|
|
|
//params.put("token", token); //用户登录凭证
|
|
@@ -127,11 +130,6 @@ public class AppUserInfoController {
|
|
|
resultData = ResultData.error(CodeMsg.USER_EXSIST);
|
|
|
}else {
|
|
|
appUserInfoService.AddAppUserInfo(appUserInfo);
|
|
|
- //向客户表中插入数据 判断该客户是否存在
|
|
|
-// CustomerManage existCustomer = payOrderService.isExistCustomer(customerManage);
|
|
|
-// if(existCustomer ==null){
|
|
|
-// payOrderService.insertCustomer(customerManage);
|
|
|
-// }
|
|
|
resultData = ResultData.success(CodeMsg.SUCCESS);
|
|
|
}
|
|
|
}catch (Exception e){
|