| | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.dao.system.dto.LoginH5DTO; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.system.dto.LoginDTO; |
| | | import com.doumee.dao.system.dto.LoginPhoneDTO; |
| | |
| | | import org.springframework.web.server.ServerWebExchange; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * JWT获取令牌和刷新令牌接口 |
| | |
| | | @ApiOperation("H5业务登录") |
| | | @PostMapping("/loginH5") |
| | | @LoginNoRequired |
| | | public ApiResponse<String> loginH5 (@Validated @RequestBody LoginDTO dto, ServerWebExchange serverWebExchange) { |
| | | public ApiResponse<String> loginH5 (@Validated @RequestBody LoginH5DTO dto, ServerWebExchange serverWebExchange) { |
| | | try { |
| | | ServerHttpRequest request = serverWebExchange.getRequest(); |
| | | dto.setCheckCode(false); |
| | | LoginUserInfo user = systemLoginService.loginByPasswordNew(dto,request); |
| | | LoginUserInfo user = systemLoginService.loginH5(dto,request); |
| | | String token = jwtTokenUtil.generateToken(user); |
| | | return ApiResponse.success(token); |
| | | }catch (BusinessException e){ |
| | | return ApiResponse.failed(e.getCode(),e.getMessage()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ApiResponse.failed(ResponseStatus.SERVER_ERROR); |
| | | } |
| | | } |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("H5业务登录(手机号验证码登录)") |
| | | @PostMapping("/loginH5ByPhone") |
| | | @LoginNoRequired |
| | | public ApiResponse<String> loginH5ByPhone (@Validated @RequestBody LoginPhoneDTO dto, ServerWebExchange serverWebExchange) { |
| | | try { |
| | | ServerHttpRequest request = serverWebExchange.getRequest(); |
| | | LoginUserInfo user = systemLoginService.loginH5ByPhone(dto,request); |
| | | String token = jwtTokenUtil.generateToken(user); |
| | | return ApiResponse.success(token); |
| | | }catch (BusinessException e){ |
| | |
| | | } |
| | | |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("司机登录(手机号验证码登录)") |
| | | @PostMapping("/loginDriverByPhone") |
| | | @LoginNoRequired |
| | | public ApiResponse<String> loginDriverByPhone (@Validated @RequestBody LoginPhoneDTO dto, ServerWebExchange serverWebExchange) { |
| | | try { |
| | | ServerHttpRequest request = serverWebExchange.getRequest(); |
| | | LoginUserInfo user = systemLoginService.loginDriverByPhone(dto,request); |
| | | String token = jwtTokenUtil.generateToken(user); |
| | | return ApiResponse.success(token); |
| | | }catch (BusinessException e){ |
| | | return ApiResponse.failed(e.getCode(),e.getMessage()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ApiResponse.failed(ResponseStatus.SERVER_ERROR); |
| | | } |
| | | } |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("司机登录") |
| | | @PostMapping("/loginDriver") |
| | | @LoginNoRequired |
| | | public ApiResponse<String> loginDriver (@Validated @RequestBody LoginDTO dto, ServerWebExchange serverWebExchange) { |
| | | public ApiResponse<String> loginDriver (@Validated @RequestBody LoginH5DTO dto, ServerWebExchange serverWebExchange) { |
| | | try { |
| | | ServerHttpRequest request = serverWebExchange.getRequest(); |
| | | dto.setCheckCode(false); |
| | |
| | | return ApiResponse.failed(ResponseStatus.SERVER_ERROR); |
| | | } |
| | | } |
| | | @ApiOperation("管控人员验证码登录") |
| | | @PostMapping("/loginGkUserWithCode") |
| | | @LoginNoRequired |
| | | public ApiResponse<String> loginGkUserWithCode (@Validated @RequestBody LoginPhoneDTO dto, ServerWebExchange serverWebExchange) { |
| | | try { |
| | | ServerHttpRequest request = serverWebExchange.getRequest(); |
| | | LoginUserInfo user = systemLoginService.loginGkUserWithCode(dto,request); |
| | | String token = jwtTokenUtil.generateToken(user); |
| | | return ApiResponse.success(token); |
| | | }catch (BusinessException e){ |
| | | return ApiResponse.failed(e.getCode(),e.getMessage()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ApiResponse.failed(ResponseStatus.SERVER_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 刷新JWT令牌,用旧的令牌换新的令牌 |