|
|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
@@ -29,6 +30,7 @@ import com.zhongzheng.modules.distribution.vo.SellerWxVo;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.system.service.ISysConfigService;
|
|
|
import com.zhongzheng.modules.user.bo.UserWxFollowAddBo;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
@@ -1271,6 +1273,47 @@ public class WxLoginService implements IWxLoginService {
|
|
|
}
|
|
|
return user;
|
|
|
}
|
|
|
+
|
|
|
+ public Boolean checkBindOpenId(WxIdBody loginBody) {
|
|
|
+ if(Validator.isEmpty(loginBody.getOpenid())||Validator.isEmpty(loginBody.getFromPlat())){
|
|
|
+ throw new CustomException("参数缺失");
|
|
|
+ }
|
|
|
+ User user = iUserService.getOne(new LambdaQueryWrapper<User>().eq(User::getUserId,loginBody.getUserId()));
|
|
|
+ if(loginBody.getFromPlat()==1){
|
|
|
+ if(Validator.isEmpty(user.getGzhOpenId())){
|
|
|
+ LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(User::getUserId, loginBody.getUserId());
|
|
|
+ objectLambdaUpdateWrapper.set(User::getGzhOpenId, loginBody.getOpenid());
|
|
|
+ objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ iUserService.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ if(user.getGzhOpenId().equals(loginBody.getOpenid())){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(loginBody.getFromPlat()==2){
|
|
|
+ if(Validator.isEmpty(user.getOpenId())){
|
|
|
+ LambdaUpdateWrapper<User> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ objectLambdaUpdateWrapper.eq(User::getUserId, loginBody.getUserId());
|
|
|
+ objectLambdaUpdateWrapper.set(User::getOpenId, loginBody.getOpenid());
|
|
|
+ objectLambdaUpdateWrapper.set(User::getUpdateTime, DateUtils.getNowTime());
|
|
|
+ iUserService.update(null, objectLambdaUpdateWrapper);
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ if(user.getOpenId().equals(loginBody.getOpenid())){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public DistributionSeller bindWxGzhOpenIdSeller(WxLoginBody loginBody) {
|
|
|
DistributionSeller seller = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>().eq(DistributionSeller::getSellerId,loginBody.getSellerId()));
|
|
|
if (seller == null) {
|