| | |
| | | package com.matrix.system.api.action; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.jcraft.jsch.UserInfo; |
| | | import com.matrix.component.redis.RedisClient; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.UUIDUtil; |
| | | import com.matrix.system.api.dto.LoginDto; |
| | | import com.matrix.system.api.vo.UserInfoVo; |
| | | import com.matrix.system.common.authority.DefaultAuthorityManager; |
| | | import com.matrix.system.common.authority.strategy.AccountPasswordLogin; |
| | | import com.matrix.system.common.authority.strategy.LoginStrategy; |
| | |
| | | import com.matrix.system.hive.service.SysShopInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | private RedisClient redisClient; |
| | | |
| | | @ApiOperation(value = "登陆接口", notes = "手机端登陆接口") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "OK", response = UserInfoVo.class) |
| | | }) |
| | | @PostMapping(value = "/login") |
| | | public AjaxResult login(@RequestBody @Validated LoginDto loginDto) { |
| | | |
| | |
| | | redisClient.saveValue(token, JSONObject.toJSONString(user), 360000); |
| | | redisClient.saveValue(user.getSuId().toString(), token, 3600000); |
| | | |
| | | AjaxResult result = new AjaxResult(); |
| | | result.putInMap("user", user); |
| | | result.setInfo("登陆成功 "); |
| | | UserInfoVo userInfoVo = new UserInfoVo(); |
| | | userInfoVo.setId(user.getSuId()); |
| | | userInfoVo.setName(user.getSuName()); |
| | | userInfoVo.setRoleName(user.getRoleName()); |
| | | userInfoVo.setPhoto(user.getSuPhoto()); |
| | | |
| | | AjaxResult result = AjaxResult.buildSuccessInstance("登陆成功"); |
| | | result.putInMap("user", userInfoVo); |
| | | return result; |
| | | } |
| | | } |