Showing
4 changed files
with
24 additions
and
1 deletions
| ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.controller; | ... | @@ -2,6 +2,7 @@ package com.infoloop.tianting.controller; |
| 2 | 2 | ||
| 3 | import cn.dev33.satoken.annotation.SaIgnore; | 3 | import cn.dev33.satoken.annotation.SaIgnore; |
| 4 | import cn.dev33.satoken.stp.SaTokenInfo; | 4 | import cn.dev33.satoken.stp.SaTokenInfo; |
| 5 | +import cn.dev33.satoken.stp.StpUtil; | ||
| 5 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; | 6 | import com.github.xiaoymin.knife4j.annotations.ApiSupport; |
| 6 | import com.infoloop.tianting.mealorderservice.SingleMpAccountRpcResponse; | 7 | import com.infoloop.tianting.mealorderservice.SingleMpAccountRpcResponse; |
| 7 | import com.infoloop.tianting.model.dto.MpAccountDTO; | 8 | import com.infoloop.tianting.model.dto.MpAccountDTO; |
| ... | @@ -61,4 +62,12 @@ public class LoginController { | ... | @@ -61,4 +62,12 @@ public class LoginController { |
| 61 | @RequestBody @Valid MpAccountDTO.ModifyMpAccountDTO modifyMpAccountDTO) { | 62 | @RequestBody @Valid MpAccountDTO.ModifyMpAccountDTO modifyMpAccountDTO) { |
| 62 | loginService.updateMpAccount(mpAccount, modifyMpAccountDTO); | 63 | loginService.updateMpAccount(mpAccount, modifyMpAccountDTO); |
| 63 | } | 64 | } |
| 65 | + | ||
| 66 | + @SaIgnore | ||
| 67 | + @ApiOperation(value = "踢人下线") | ||
| 68 | + @PostMapping("/kickout") | ||
| 69 | + @ResponseStatus(HttpStatus.OK) | ||
| 70 | + public void kickout(@Valid @RequestBody PermissionDTO.KickOutDTO kickOutDTO) { | ||
| 71 | + StpUtil.kickout(kickOutDTO.getId()); | ||
| 72 | + } | ||
| 64 | } | 73 | } | ... | ... |
| ... | @@ -62,7 +62,9 @@ public enum ErrorCodeEnum implements BaseEnum { | ... | @@ -62,7 +62,9 @@ public enum ErrorCodeEnum implements BaseEnum { |
| 62 | 62 | ||
| 63 | MEAL_ORDER_TIME_NOT_IN_RANGE(406000022, "当前时间不在选餐时间内"), | 63 | MEAL_ORDER_TIME_NOT_IN_RANGE(406000022, "当前时间不在选餐时间内"), |
| 64 | 64 | ||
| 65 | - DINER_NAME_STUDENT_NO_NOT_MISMATCH(406000023, "该就餐人学号和名称不匹配") | 65 | + DINER_NAME_STUDENT_NO_NOT_MISMATCH(406000023, "该就餐人学号和名称不匹配"), |
| 66 | + | ||
| 67 | + MP_ACCOUNT_ALREADY_DISABLED(406000024, "账号已禁用"), | ||
| 66 | 68 | ||
| 67 | 69 | ||
| 68 | ; | 70 | ; | ... | ... |
| ... | @@ -40,4 +40,13 @@ public class PermissionDTO { | ... | @@ -40,4 +40,13 @@ public class PermissionDTO { |
| 40 | private Integer enterpriseId = 0; | 40 | private Integer enterpriseId = 0; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | + @Data | ||
| 44 | + @Builder | ||
| 45 | + @ApiModel(description = "kickOut DTO") | ||
| 46 | + public static class KickOutDTO { | ||
| 47 | + | ||
| 48 | + private String id; | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 43 | } | 52 | } | ... | ... |
| ... | @@ -64,6 +64,9 @@ public class LoginServiceImpl implements LoginService { | ... | @@ -64,6 +64,9 @@ public class LoginServiceImpl implements LoginService { |
| 64 | .setPhoneNumber(loginDto.getOperatorPhone() != null ? loginDto.getOperatorPhone() : "") | 64 | .setPhoneNumber(loginDto.getOperatorPhone() != null ? loginDto.getOperatorPhone() : "") |
| 65 | .build()).getId(); | 65 | .build()).getId(); |
| 66 | } else { | 66 | } else { |
| 67 | + if (mpAccountByOpenId.getStatus() != MpAccountStatusEnum.MP_ACCOUNT_STATUS_ENABLE) { | ||
| 68 | + throw ClientEndExceptions.IncorrectRequestValue.build(ErrorCodeEnum.MP_ACCOUNT_ALREADY_DISABLED); | ||
| 69 | + } | ||
| 67 | mpAccountId = mpAccountByOpenId.getId(); | 70 | mpAccountId = mpAccountByOpenId.getId(); |
| 68 | } | 71 | } |
| 69 | Assert.isTrue(mpAccountId != 0, "创建小程序账号失败"); | 72 | Assert.isTrue(mpAccountId != 0, "创建小程序账号失败"); | ... | ... |
-
Please register or login to post a comment