|
|
@ -8,10 +8,10 @@ import com.bsd.say.entities.Record;
|
|
|
|
import com.bsd.say.entities.Users;
|
|
|
|
import com.bsd.say.entities.Users;
|
|
|
|
import com.bsd.say.mapper.RecordMapper;
|
|
|
|
import com.bsd.say.mapper.RecordMapper;
|
|
|
|
import com.bsd.say.mapper.UsersMapper;
|
|
|
|
import com.bsd.say.mapper.UsersMapper;
|
|
|
|
import com.bsd.say.service.RedisService;
|
|
|
|
|
|
|
|
import com.bsd.say.service.UsersService;
|
|
|
|
import com.bsd.say.service.UsersService;
|
|
|
|
import com.bsd.say.util.HttpRequestUtils;
|
|
|
|
import com.bsd.say.util.HttpRequestUtils;
|
|
|
|
import com.bsd.say.util.MD5Utils;
|
|
|
|
import com.bsd.say.util.MD5Utils;
|
|
|
|
|
|
|
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
@ -28,8 +28,6 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
@Service("usersService")
|
|
|
|
@Service("usersService")
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public class UsersServiceImpl extends BaseServiceImpl<UsersMapper,Users> implements UsersService {
|
|
|
|
public class UsersServiceImpl extends BaseServiceImpl<UsersMapper,Users> implements UsersService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
@Value("${bsd.tokenkey}")
|
|
|
|
@Value("${bsd.tokenkey}")
|
|
|
@ -46,10 +44,6 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
private WeixinService weixinService;
|
|
|
|
private WeixinService weixinService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private RecordMapper recordMapper;
|
|
|
|
private RecordMapper recordMapper;
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private RedisService redisService;
|
|
|
|
|
|
|
|
static final String RECORD_PREFIX = "BSD_RECORD_";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public UsersMapper getBaseMapper() {
|
|
|
|
public UsersMapper getBaseMapper() {
|
|
|
@ -58,7 +52,6 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 发送验证码
|
|
|
|
* 发送验证码
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param ajaxRequest
|
|
|
|
* @param ajaxRequest
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -134,13 +127,11 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 通过openId获取record中的name 和 phone
|
|
|
|
* 通过openId获取record中的name 和 phone
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param ajaxRequest
|
|
|
|
* @param ajaxRequest
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public AjaxResult getUserInfoByOpenId(AjaxRequest ajaxRequest) {
|
|
|
|
public AjaxResult getUserInfoByOpenId(AjaxRequest ajaxRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
JSONObject data = ajaxRequest.getData();
|
|
|
|
JSONObject data = ajaxRequest.getData();
|
|
|
|
if (data == null){
|
|
|
|
if (data == null){
|
|
|
@ -149,13 +140,6 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
return ajaxResult;
|
|
|
|
return ajaxResult;
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
String openId = data.getString("openId");
|
|
|
|
String openId = data.getString("openId");
|
|
|
|
if (redisService.exists(RECORD_PREFIX + openId)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String userInfoStr = redisService.get(RECORD_PREFIX + openId).toString();
|
|
|
|
|
|
|
|
ajaxResult.setData(JSONObject.parseObject(userInfoStr));
|
|
|
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(openId)){
|
|
|
|
if (StringUtils.isBlank(openId)){
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
ajaxResult.setRetmsg("openId missing");
|
|
|
|
ajaxResult.setRetmsg("openId missing");
|
|
|
@ -168,12 +152,10 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
userInfo.put("name",record.getName());
|
|
|
|
userInfo.put("name",record.getName());
|
|
|
|
userInfo.put("phone",record.getPhone());
|
|
|
|
userInfo.put("phone",record.getPhone());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
redisService.set(RECORD_PREFIX + openId, userInfo.toJSONString());
|
|
|
|
|
|
|
|
ajaxResult.setData(userInfo);
|
|
|
|
ajaxResult.setData(userInfo);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
ajaxResult.setRetcode(AjaxResult.SUCCESS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ajaxResult;
|
|
|
|
return ajaxResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|