Commit 62089f10 authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents c0d7284f 5bf3327d
......@@ -29,7 +29,7 @@ public interface IUserService {
AppUserInfo AppValidate(@RequestBody JwtAuthenticationRequest authenticationRequest);
@RequestMapping(value = "/api/app/user/sendsms", method = RequestMethod.POST)
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="pointList")String pointList);
public JSONObject sendsms(@RequestParam(value="username",defaultValue="")String username, @RequestParam(value="type",defaultValue="0")Integer type, @RequestParam(value="pointList",defaultValue = "")String pointList);
@RequestMapping(value = "/api/app/user/register", method = RequestMethod.POST)
public JSONObject register( @RequestParam(value="username",defaultValue="")String username,
@RequestParam(value="mobilecode",defaultValue="")String mobilecode,
......
......@@ -7,10 +7,14 @@ public class RedisKey {
*/
public static final String CONSTANT_CODE_PREFIX ="cache:mobilecode:";
/**
* 图片验证码
*/
public static final String CAPTCHA_PHONE_PREFIX = "captcha:phone:";
public static final String CONSTANT_ERROR_PREFIX ="cache:mobileerror:";
}
......@@ -105,10 +105,8 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
userPositionTemp.setCompanyName(companyName);
//编辑
if (id == null || id == 0) {
int ids = addUserFindId(userPositionTemp).getId();
appUserPositionTempDTO.setId(ids);
insertSelective(userPositionTemp);
//记录表插入
// appUserPositionTempDTO.setId();
appUserPositionChangeRecordBiz.addJoinJobRecord(appUserPositionTempDTO, updUserId);
} else {
updateSelectiveById(userPositionTemp);
......@@ -196,7 +194,7 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
return dataVO;
}
public Map<String, Object> importUserPostion(List<String[]> userPostionData, Integer operatorId) {
public Map<String, Object> importUserPostion(List<String[]> userPostionData,Integer operatorId) {
Map<String, Object> result = new HashMap<>(2);
List<Map<String, Object>> errorResult = Lists.newArrayList();
Map<String, Object> errorResultMap;
......@@ -277,14 +275,13 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
appUserPositionTemp.setId(id);
updateSelectiveById(appUserPositionTemp);
} else {
// insertSelective(appUserPositionTemp);
// insertSelective(appUserPositionTemp);
AppUserPositionTemp appUserPositionTempNew = new AppUserPositionTemp();
BeanUtils.copyProperties(appUserPositionTemp, appUserPositionTempNew);
appUserPositionTempNew = addUserFindId(appUserPositionTemp);
//记录表插入
appUserPositionChangeRecordBiz.addJoinJobRecord(appUserPositionTempNew, operatorId);
}
} catch (BaseException ex) {
errorResultMap = new HashMap<>(1);
errorResultMap.put("num", i);
......@@ -442,12 +439,12 @@ public class AppUserPositionTempBiz extends BaseBiz<AppUserPositionTempMapper, A
}
//身份变更
if (StaffChangeStatusEnum.IDENTITY_CHANE.getCode() == changeStatus) {
//不是离职状态下
if (Objects.nonNull(userPositionTemp.getIsQuit()) && userPositionTemp.getIsQuit() != 1) {
postionId = Objects.nonNull(postionId) ? postionId : appUserPositionTempDTO.getPositionId();
//更改为股东身份
loginBiz.updateUserPosition(appUserDetail.getUserid(), postionId);
}
//不是离职状态下
if(Objects.nonNull(userPositionTemp.getIsQuit()) && userPositionTemp.getIsQuit()!=1){
postionId = Objects.nonNull(postionId) ? postionId : appUserPositionTempDTO.getPositionId();
//更改为股东身份
loginBiz.updateUserPosition(appUserDetail.getUserid(), postionId);
}
}
}
}
......
......@@ -118,6 +118,9 @@ public class AppPermissionService {
private AppUserAlipayBiz alipayBiz;
private static final Integer maxNumber=5;
public AppUserInfo validate(String username, String password) {
AppUserInfo info = new AppUserInfo();
AppUserLogin user = appUserLoginBiz.checkeUserLogin(username);
......@@ -259,13 +262,16 @@ public class AppPermissionService {
if (StringUtils.isNotBlank(code)){
//判断处理活动关键字
String[] codes = code.split("_");
if(codes.length > 1) {
if(codes.length > 0) {
String userCode = codes[0];
if(appUserDetailBiz.getUserByCode(userCode)==0) {
return JsonResultUtil.createFailedResult(ResultCode.NOTEXIST_CODE, "邀请人不存在");
}
}
}
/*if (checkErrorNum(username)){
return JsonResultUtil.createFailedResult(ResultCode.FAILED_CODE, "验证码超过错误次数");
}*/
String redisLockKey = RedisKey.CONSTANT_CODE_PREFIX + username + mobilecode;
String mobilecodeRedis = userRedisTemplate.opsForValue().get(redisLockKey) == null ? "" : userRedisTemplate.opsForValue().get(redisLockKey).toString();
log.info("注册接口,获取redis中的验证码:" + mobilecodeRedis+"---time===="+System.currentTimeMillis()/1000L);
......@@ -591,6 +597,7 @@ public class AppPermissionService {
// 获取到缓存的验证码后要先清空缓存对应键的值
userRedisTemplate.delete(redisLockKey);
if (StringUtils.isBlank(mobilecodeRedis)) {
return JsonResultUtil.createFailedResult(ResultCode.NOTEXIST_CODE, "验证码错误");
}
Long now = System.currentTimeMillis() / 1000;
......@@ -675,6 +682,34 @@ public class AppPermissionService {
}
public void setErrorNum(String username){
String redisLockKey = RedisKey.CONSTANT_ERROR_PREFIX + username;
Integer number=getErrorNum(username,redisLockKey);
userRedisTemplate.delete(redisLockKey);
Boolean suc = userRedisTemplate.opsForValue().setIfAbsent(redisLockKey, number+1);
if (suc) {
userRedisTemplate.expire(redisLockKey, 5, TimeUnit.MINUTES);//5分钟内过期
}
}
public boolean checkErrorNum(String username){
String redisLockKey = RedisKey.CONSTANT_ERROR_PREFIX + username;
Integer number=getErrorNum(username,redisLockKey);
if (number>=maxNumber){
return true;
}
return false;
}
public Integer getErrorNum(String username,String redisLockKey){
String errorNum = userRedisTemplate.opsForValue().get(redisLockKey) == null ?"0": userRedisTemplate.opsForValue().get(redisLockKey).toString();
Integer number=0;
if (StringUtils.isNotBlank(errorNum)){
number=Integer.parseInt(errorNum);
}
return number;
}
/**
* 校验手机号码是否已绑定微信
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment