pwd
This commit is contained in:
parent
7c30de203f
commit
5e72852426
|
|
@ -57,10 +57,10 @@ public class TokenService {
|
|||
|
||||
private final static Long MILLIS_MINUTE_TEN = 120L * MILLIS_MINUTE;
|
||||
|
||||
private static final String CUST_DETAILS_USER_ID = "cust_user_id";
|
||||
private static final String CUST_DETAILS_USERNAME = "cust_username";
|
||||
private static final String CUST_USER_KEY = "cust_user_key";
|
||||
private static final String CUST_LOGIN_USER = "cust_login_user";
|
||||
private static final String DETAILS_USER_ID = "user_id";
|
||||
private static final String DETAILS_USERNAME = "username";
|
||||
private static final String USER_KEY = "user_key";
|
||||
private static final String LOGIN_USER = "login_user";
|
||||
|
||||
/**
|
||||
* 创建令牌
|
||||
|
|
@ -78,9 +78,9 @@ public class TokenService {
|
|||
refreshToken(loginUser);
|
||||
// Jwt存储信息
|
||||
Map<String, Object> claimsMap = new HashMap<String, Object>(16);
|
||||
claimsMap.put(CUST_USER_KEY, token);
|
||||
claimsMap.put(CUST_DETAILS_USER_ID, custId);
|
||||
claimsMap.put(CUST_DETAILS_USERNAME, userName);
|
||||
claimsMap.put(USER_KEY, token);
|
||||
claimsMap.put(DETAILS_USER_ID, custId);
|
||||
claimsMap.put(DETAILS_USERNAME, userName);
|
||||
String accessToken = JwtUtils.createToken(claimsMap);
|
||||
Map<String, Object> rspMap = new HashMap<String, Object>(16);
|
||||
rspMap.put("cust_access_token", accessToken);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.text.CharSequenceUtil;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import net.xnzn.constant.CustLoginTypeEnum;
|
||||
import net.xnzn.constant.DelFlagEnum;
|
||||
import net.xnzn.constant.LeConstants;
|
||||
import net.xnzn.domain.CustCasual;
|
||||
import net.xnzn.domain.CustInfo;
|
||||
import net.xnzn.domain.CustInfoAppIdLoginVO;
|
||||
|
|
@ -31,6 +32,7 @@ import org.springframework.context.annotation.Lazy;
|
|||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -89,7 +91,7 @@ public class TokenController {
|
|||
@PostMapping("cust-login")
|
||||
public R<?> login(@RequestBody LoginBody form) {
|
||||
/**对系统并发数进行判断*/
|
||||
long concurrency = 100;
|
||||
long concurrency = 10000;
|
||||
AjaxResult result = configService.getConfigKey("sys.backend.concurrency");
|
||||
if (result.isSuccess())
|
||||
{
|
||||
|
|
@ -195,8 +197,8 @@ public class TokenController {
|
|||
* @param request HTTP 请求
|
||||
* @return 登出结果
|
||||
*/
|
||||
@PostMapping("logout")
|
||||
public R<?> logout(HttpServletRequest request) {
|
||||
@PostMapping("cust-logout")
|
||||
public R<?> logout(HttpServletRequest request, @RequestHeader Map<String, String> headers) {
|
||||
try {
|
||||
String token = SecurityUtils.getToken(request);
|
||||
if (StringUtils.isNotEmpty(token)) {
|
||||
|
|
@ -207,6 +209,9 @@ public class TokenController {
|
|||
String userId = JwtUtils.getUserId(token);
|
||||
AuthUtil.logoutByToken(token);
|
||||
tokenService.delExistingToken(Long.valueOf(userId));
|
||||
Long custId = Long.parseLong(headers.get("custId"));
|
||||
String openId = (String)headers.get("openid");
|
||||
custCasualMapper.updateByCustIdAndOpenId(custId, LeConstants.COMMON_NO, openId);
|
||||
sysLoginService.logout(username, userId);
|
||||
logService.saveLogout(username, "退出登录", "退出成功", userId, "成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,6 @@ public interface CustCasualMapper {
|
|||
|
||||
int addCustCasual(CustCasual custCasual);
|
||||
|
||||
int updateByCustIdAndOpenId(@Param("custId") Long custId, @Param("isDefault") Integer isDefault, @Param("openid") String openid);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,4 +74,9 @@
|
|||
values (#{casualId}, #{casualName}, #{casualName}, #{custId}, #{mobile}, #{openid}, #{sourceType})
|
||||
</insert>
|
||||
|
||||
<update id="updateByCustIdAndOpenId">
|
||||
update cust_casual_relation
|
||||
set is_default = #{isDefault}
|
||||
where cust_id = #{custId} and openid = #{openid}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dept")
|
||||
@RequestMapping("/custInfo")
|
||||
@Slf4j
|
||||
public class CustInfoController extends BaseController {
|
||||
|
||||
|
|
|
|||
Reference in New Issue