|
@@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.caimei365.user.components.CommonService;
|
|
|
import com.caimei365.user.components.RedisService;
|
|
|
import com.caimei365.user.components.WeChatService;
|
|
|
-import com.caimei365.user.mapper.*;
|
|
|
+import com.caimei365.user.mapper.LoginMapper;
|
|
|
+import com.caimei365.user.mapper.OperationMapper;
|
|
|
+import com.caimei365.user.mapper.RegisterMapper;
|
|
|
+import com.caimei365.user.mapper.SuperVipMapper;
|
|
|
import com.caimei365.user.model.ResponseJson;
|
|
|
import com.caimei365.user.model.dto.AuthBindDto;
|
|
|
import com.caimei365.user.model.dto.LoginPasswordDto;
|
|
@@ -13,9 +16,7 @@ import com.caimei365.user.model.dto.ScanBindDto;
|
|
|
import com.caimei365.user.model.dto.SuperVipDto;
|
|
|
import com.caimei365.user.model.po.OperationPo;
|
|
|
import com.caimei365.user.model.po.SuperVipPo;
|
|
|
-import com.caimei365.user.model.po.UserBeansHistoryPo;
|
|
|
import com.caimei365.user.model.vo.UserLoginVo;
|
|
|
-import com.caimei365.user.model.vo.UserVo;
|
|
|
import com.caimei365.user.service.LoginService;
|
|
|
import com.caimei365.user.utils.JwtUtil;
|
|
|
import com.caimei365.user.utils.Md5Util;
|
|
@@ -23,7 +24,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -54,9 +54,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
@Resource
|
|
|
private OperationMapper operationMapper;
|
|
|
@Resource
|
|
|
- private ClubMapper clubMapper;
|
|
|
- @Resource
|
|
|
- private BaseMapper baseMapper;
|
|
|
+ private AsyncService asyncService;
|
|
|
|
|
|
/**
|
|
|
* 小程序邀请码过期天数
|
|
@@ -294,6 +292,7 @@ public class LoginServiceImpl implements LoginService {
|
|
|
return ResponseJson.error(-3, "您的企业账号审核未通过", loginUser);
|
|
|
}
|
|
|
}
|
|
|
+ // 超级会员
|
|
|
SuperVipDto end = findEnd(loginUser.getUserId());
|
|
|
loginUser.setVipFlag(end.getVipFlag());
|
|
|
if (1 == end.getVipFlag() && 4 == loginUser.getUserIdentity()) {
|
|
@@ -301,43 +300,12 @@ public class LoginServiceImpl implements LoginService {
|
|
|
loginUser.setUserIdentity(2);
|
|
|
loginUser.setUserPermission(2);
|
|
|
}
|
|
|
- // 登录赠送10采美豆
|
|
|
- loginUpdateBeans(loginUser.getUserId(), loginUser.getUserIdentity());
|
|
|
-
|
|
|
+ // 登录异步赠送10采美豆
|
|
|
+ asyncService.loginUpdateBeans(loginUser.getUserId(), loginUser.getUserIdentity());
|
|
|
+ log.info("【登录】-----登录成功,userId:" + loginUser.getUserId());
|
|
|
return ResponseJson.success("登录成功", loginUser);
|
|
|
}
|
|
|
|
|
|
- @Async
|
|
|
- void loginUpdateBeans(Integer userId, Integer identity) {
|
|
|
- if (null != identity && (2 == identity || 4 == identity)){
|
|
|
- // 查询今天是否有登录送豆
|
|
|
- Integer id = clubMapper.findLoginBeans(userId);
|
|
|
- if (id == null) {
|
|
|
- //登录赠送10采美豆
|
|
|
- UserVo user = baseMapper.getUserByUserId(userId);
|
|
|
- UserBeansHistoryPo beansHistory = new UserBeansHistoryPo();
|
|
|
- beansHistory.setUserId(user.getUserId());
|
|
|
- beansHistory.setBeansType(12);
|
|
|
- beansHistory.setType(1);
|
|
|
- beansHistory.setNum(10);
|
|
|
- beansHistory.setPushStatus(0);
|
|
|
- beansHistory.setAddTime(new Date());
|
|
|
- registerMapper.insertBeansHistory(beansHistory);
|
|
|
- Integer userBeans = user.getUserBeans();
|
|
|
- userBeans = userBeans == null ? 10 : userBeans + 10;
|
|
|
- clubMapper.updateUserBeans(userId, userBeans);
|
|
|
- log.info("【登录成功】-----每天初次登录赠送10采美豆,userId:" + userId);
|
|
|
- }
|
|
|
- }
|
|
|
- //改user表登录时间
|
|
|
- try {
|
|
|
- log.info("【登录成功】-----登陆时间录入,userId:" + userId);
|
|
|
- loginMapper.updateLogin(userId);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("登录时间记录异常" + e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取生成微信二维码的参数(www)
|
|
|
*
|