|
|
@@ -33,13 +33,8 @@ import com.ruoyi.system.mapper.InfoUserMapper;
|
|
|
import com.ruoyi.system.mapper.PosOrderMapper;
|
|
|
import com.ruoyi.system.mapper.PosStoreMapper;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
-import com.ruoyi.system.service.IInfoUserService;
|
|
|
-import com.ruoyi.system.service.ISysDictDataService;
|
|
|
+import com.ruoyi.system.service.*;
|
|
|
|
|
|
-import com.ruoyi.system.service.IPosOrderService;
|
|
|
-import com.ruoyi.system.service.IUserWalletService;
|
|
|
-import com.ruoyi.system.service.IVipUserService;
|
|
|
-import com.ruoyi.system.service.MerchantStoreAccessService;
|
|
|
import com.ruoyi.system.utils.Auth;
|
|
|
import com.ruoyi.system.utils.AuthContext;
|
|
|
import com.ruoyi.system.utils.JwtUtil;
|
|
|
@@ -113,6 +108,8 @@ public class InfoUserController extends BaseController {
|
|
|
private MerchantTokenSessionService merchantTokenSessionService;
|
|
|
@Autowired
|
|
|
private ISysDictDataService dictDataService;
|
|
|
+ @Autowired
|
|
|
+ private IRiderPositionService riderPositionService;
|
|
|
/** 三方登录首登临时凭证 Redis 前缀 */
|
|
|
private static final String OAUTH_TEMP_PREFIX = "oauth:bind:";
|
|
|
|
|
|
@@ -603,6 +600,35 @@ public class InfoUserController extends BaseController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 退出登录
|
|
|
+ *
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Anonymous
|
|
|
+ @Auth
|
|
|
+ @GetMapping("/logout")
|
|
|
+ public AjaxResult logout(@RequestHeader String token) {
|
|
|
+ JwtUtil jwtUtil = new JwtUtil();
|
|
|
+ String id = jwtUtil.getusid(token);
|
|
|
+ InfoUser user = infoUserService.getOne(new LambdaQueryWrapper<InfoUser>().eq(InfoUser::getUserId, Long.valueOf(id)));
|
|
|
+ if (user == null) {
|
|
|
+ throw new ServiceException("未查询到用户信息");
|
|
|
+ }
|
|
|
+ LambdaUpdateWrapper<InfoUser> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.eq(InfoUser::getUserId, user.getUserId())
|
|
|
+ .set(InfoUser::getOffline, "1")
|
|
|
+ .set(InfoUser::getCid, null)
|
|
|
+ .set(InfoUser::getCidType, null);
|
|
|
+ infoUserService.update(updateWrapper);
|
|
|
+ //骑手删除定位信息
|
|
|
+ if ("2".equals(user.getUserType())) {
|
|
|
+ riderPositionService.remove(new LambdaQueryWrapper<RiderPosition>().eq(RiderPosition::getRiderId, user.getUserId()));
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 骑手切换离线状态(0:在线,1:离线)
|
|
|
*
|