|
@@ -2,13 +2,23 @@ package com.miaxis.newgzpt.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.miaxis.common.annotation.DataSource;
|
|
|
+import com.miaxis.common.core.domain.Response;
|
|
|
import com.miaxis.common.enums.DataSourceTypeEnum;
|
|
|
+import com.miaxis.common.sms.MD5Utils;
|
|
|
+import com.miaxis.common.utils.StringUtils;
|
|
|
+import com.miaxis.common.utils.sign.Md5Utils;
|
|
|
import com.miaxis.newgzpt.domain.GzptUserInfo;
|
|
|
import com.miaxis.newgzpt.dto.GzptAppleInfoDTO;
|
|
|
+import com.miaxis.newgzpt.dto.GzptUserInfoBindDTO;
|
|
|
import com.miaxis.newgzpt.dto.GzptUserInfoDTO;
|
|
|
+import com.miaxis.newgzpt.dto.GzptUserLoginDTO;
|
|
|
import com.miaxis.newgzpt.mapper.GzptUserInfoMapper;
|
|
|
import com.miaxis.newgzpt.service.IGzptUserInfoService;
|
|
|
import com.miaxis.newgzpt.vo.GzptExamInfoVO;
|
|
|
+import com.miaxis.tms.dto.TmsCoachInfoBindDTO;
|
|
|
+import com.miaxis.tms.dto.TmsCoachInfoDTO;
|
|
|
+import com.miaxis.tms.vo.TmsCoachInfoVo;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -73,4 +83,55 @@ public class GzptUserInfoServiceImpl extends ServiceImpl<GzptUserInfoMapper, Gzp
|
|
|
public Long saveGzptUserInfo(GzptUserInfo userInfo) {
|
|
|
return mapper.saveGzptUserInfo(userInfo);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Response bindGzptUserOpenid(GzptUserInfoBindDTO userInfoBindDTO) {
|
|
|
+
|
|
|
+ GzptUserLoginDTO userLoginDto = new GzptUserLoginDTO();
|
|
|
+ String passMd5 = MD5Utils.MD5Encode(userInfoBindDTO.getPassword());
|
|
|
+ userInfoBindDTO.setPassword(passMd5);
|
|
|
+ BeanUtils.copyProperties(userInfoBindDTO,userLoginDto);
|
|
|
+ GzptUserInfo gzptUserInfo = mapper.getUserByLoginCodeAndPw(userLoginDto); //查询帐号是否绑定过
|
|
|
+ if(gzptUserInfo!=null) {
|
|
|
+ if(!StringUtils.isEmpty(gzptUserInfo.getOpenId())) {
|
|
|
+ Response response = new Response(50002,"该学员账号已绑定微信,请解绑后再次绑定。");
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Response response = new Response(50003,"用户不存在或用户密码错误");
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+ int result = mapper.updateGzptUserOpenid(userInfoBindDTO);
|
|
|
+ if(result>0) {
|
|
|
+ gzptUserInfo.setOpenId(userInfoBindDTO.getOpenid());
|
|
|
+ return Response.success(gzptUserInfo);
|
|
|
+ } else {
|
|
|
+ return Response.success(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Response unBindGzptUserOpenid(GzptUserLoginDTO userLoginDTO) {
|
|
|
+
|
|
|
+ GzptUserInfoBindDTO userInfoBindDTO = new GzptUserInfoBindDTO();
|
|
|
+ String passMd5 = MD5Utils.MD5Encode(userLoginDTO.getPassword());
|
|
|
+ userLoginDTO.setPassword(passMd5);
|
|
|
+ BeanUtils.copyProperties(userLoginDTO,userInfoBindDTO);
|
|
|
+ GzptUserInfo gzptUserInfo = mapper.getUserByLoginCodeAndPw(userLoginDTO); //查询帐号是否绑定过
|
|
|
+ if(gzptUserInfo==null) {
|
|
|
+ Response response = new Response(50002,"用户不存在或用户密码错误");
|
|
|
+ return response;
|
|
|
+ } else {
|
|
|
+ int result = mapper.updateGzptUserOpenid(userInfoBindDTO);
|
|
|
+ return Response.success(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public GzptUserInfo getUserInfoByOpenid(String openid) {
|
|
|
+ return mapper.getUserInfoByOpenid(openid);
|
|
|
+ }
|
|
|
+
|
|
|
}
|