fix
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.starry.admin.modules.clerk.service;
|
package com.starry.admin.modules.clerk.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
import com.starry.admin.modules.clerk.module.entity.PlayClerkLevelInfoEntity;
|
||||||
@@ -210,4 +211,6 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
|
|||||||
int deletePlayClerkUserInfoById(String id);
|
int deletePlayClerkUserInfoById(String id);
|
||||||
|
|
||||||
List<PlayClerkUserInfoEntity> simpleList();
|
List<PlayClerkUserInfoEntity> simpleList();
|
||||||
|
|
||||||
|
JSONObject getPcData(PlayClerkUserInfoEntity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.starry.admin.modules.clerk.service.impl;
|
package com.starry.admin.modules.clerk.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.starry.admin.common.component.JwtToken;
|
||||||
import com.starry.admin.common.domain.LoginUser;
|
import com.starry.admin.common.domain.LoginUser;
|
||||||
import com.starry.admin.common.exception.CustomException;
|
import com.starry.admin.common.exception.CustomException;
|
||||||
import com.starry.admin.modules.balance.service.IPlayBalanceDetailsInfoService;
|
import com.starry.admin.modules.balance.service.IPlayBalanceDetailsInfoService;
|
||||||
@@ -20,14 +22,21 @@ import com.starry.admin.modules.follow.module.entity.PlayCustomFollowInfoEntity;
|
|||||||
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
import com.starry.admin.modules.follow.service.IPlayCustomFollowInfoService;
|
||||||
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
|
||||||
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
import com.starry.admin.modules.order.service.IPlayOrderInfoService;
|
||||||
|
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelAdminInfoEntity;
|
||||||
|
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelGroupInfoEntity;
|
||||||
|
import com.starry.admin.modules.personnel.module.entity.PlayPersonnelWaiterInfoEntity;
|
||||||
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelAdminInfoService;
|
||||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
||||||
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelWaiterInfoService;
|
||||||
import com.starry.admin.modules.statistics.module.vo.PlayClerkPerformanceInfoQueryVo;
|
import com.starry.admin.modules.statistics.module.vo.PlayClerkPerformanceInfoQueryVo;
|
||||||
|
import com.starry.admin.modules.system.service.LoginService;
|
||||||
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
import com.starry.admin.modules.weichat.entity.PlayClerkUserLoginResponseVo;
|
||||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoQueryVo;
|
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoQueryVo;
|
||||||
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoResultVo;
|
import com.starry.admin.modules.weichat.entity.clerk.PlayClerkUserInfoResultVo;
|
||||||
import com.starry.admin.utils.SecurityUtils;
|
import com.starry.admin.utils.SecurityUtils;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import com.starry.common.utils.IdUtils;
|
import com.starry.common.utils.IdUtils;
|
||||||
|
import com.starry.common.utils.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -46,26 +55,28 @@ import java.util.stream.Collectors;
|
|||||||
public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoMapper, PlayClerkUserInfoEntity> implements IPlayClerkUserInfoService {
|
public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoMapper, PlayClerkUserInfoEntity> implements IPlayClerkUserInfoService {
|
||||||
@Resource
|
@Resource
|
||||||
private PlayClerkUserInfoMapper playClerkUserInfoMapper;
|
private PlayClerkUserInfoMapper playClerkUserInfoMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PlayClerkDataReviewInfoServiceImpl playClerkDataReviewInfoService;
|
private PlayClerkDataReviewInfoServiceImpl playClerkDataReviewInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PlayClerkUserReviewInfoServiceImpl playClerkUserReviewInfoService;
|
private PlayClerkUserReviewInfoServiceImpl playClerkUserReviewInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayClerkCommodityService playClerkCommodityService;
|
private IPlayClerkCommodityService playClerkCommodityService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayCustomFollowInfoService customFollowInfoService;
|
private IPlayCustomFollowInfoService customFollowInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayOrderInfoService playOrderInfoService;
|
private IPlayOrderInfoService playOrderInfoService;
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayPersonnelGroupInfoService playClerkGroupInfoService;
|
private IPlayPersonnelGroupInfoService playClerkGroupInfoService;
|
||||||
|
@Resource
|
||||||
|
private IPlayPersonnelAdminInfoService playPersonnelAdminInfoService;
|
||||||
|
@Resource
|
||||||
|
private IPlayPersonnelWaiterInfoService playClerkWaiterInfoService;
|
||||||
|
@Resource
|
||||||
|
private LoginService loginService;
|
||||||
|
@Resource
|
||||||
|
private JwtToken jwtToken;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -464,4 +475,33 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
|
|||||||
lambdaQueryWrapper.orderByDesc(PlayClerkUserInfoEntity::getId);
|
lambdaQueryWrapper.orderByDesc(PlayClerkUserInfoEntity::getId);
|
||||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject getPcData(PlayClerkUserInfoEntity entity) {
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.fluentPut("token", "");
|
||||||
|
data.fluentPut("role", "");
|
||||||
|
if (StringUtils.isEmpty(entity.getSysUserId())) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
LoginUser loginUserInfo = loginService.getLoginUserInfo(entity.getSysUserId());
|
||||||
|
Map<String, Object> tokenMap = jwtToken.createToken(loginUserInfo);
|
||||||
|
data.fluentPut("token", tokenMap.get("token"));
|
||||||
|
PlayPersonnelAdminInfoEntity adminInfoEntity = playPersonnelAdminInfoService.selectByUserId(entity.getSysUserId());
|
||||||
|
if (Objects.nonNull(adminInfoEntity)) {
|
||||||
|
data.fluentPut("role", "operator");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
PlayPersonnelGroupInfoEntity groupInfoEntity = playClerkGroupInfoService.selectByUserId(entity.getSysUserId());
|
||||||
|
if (Objects.nonNull(groupInfoEntity)) {
|
||||||
|
data.fluentPut("role", "leader");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
PlayPersonnelWaiterInfoEntity waiterInfoEntity = playClerkWaiterInfoService.selectByUserId(entity.getSysUserId());
|
||||||
|
if (Objects.nonNull(waiterInfoEntity)) {
|
||||||
|
data.fluentPut("role", "waiter");
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,4 +65,6 @@ public interface LoginService {
|
|||||||
* @return 获取信息
|
* @return 获取信息
|
||||||
*/
|
*/
|
||||||
LoginUser getLoginUserInfo(String userName, String tenantId);
|
LoginUser getLoginUserInfo(String userName, String tenantId);
|
||||||
|
|
||||||
|
LoginUser getLoginUserInfo(String userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,4 +193,23 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoginUser getLoginUserInfo(String userId) {
|
||||||
|
SysUserEntity sysUser = sysUserService.selectUserById(userId);
|
||||||
|
Set<String> roles = this.getRolePermission(sysUser);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = this.getMenuPermission(sysUser);
|
||||||
|
// 查询租户信息
|
||||||
|
SysTenantEntity tenant = SysTenantService.selectSysTenantByTenantId(sysUser.getTenantId());
|
||||||
|
LoginUser sysUserVo = new LoginUser();
|
||||||
|
sysUserVo.setUser(sysUser);
|
||||||
|
sysUserVo.setRoles(roles);
|
||||||
|
sysUserVo.setPermissions(permissions);
|
||||||
|
if (tenant != null) {
|
||||||
|
sysUserVo.setTenantEndDate(tenant.getTenantTime());
|
||||||
|
sysUserVo.setTenantStatus(Integer.valueOf(tenant.getTenantStatus()));
|
||||||
|
}
|
||||||
|
return sysUserVo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,19 +43,14 @@ public class WxOauthController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WxCustomMpService wxCustomMpService;
|
private WxCustomMpService wxCustomMpService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayCustomUserInfoService customUserInfoService;
|
private IPlayCustomUserInfoService customUserInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlayClerkUserInfoService clerkUserInfoService;
|
private IPlayClerkUserInfoService clerkUserInfoService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WxTokenService tokenService;
|
private WxTokenService tokenService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WxOauthService wxOauthService;
|
private WxOauthService wxOauthService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@@ -104,6 +99,32 @@ public class WxOauthController {
|
|||||||
jsonObject.put("tokenValue", TOKEN_PREFIX + tokenValue);
|
jsonObject.put("tokenValue", TOKEN_PREFIX + tokenValue);
|
||||||
jsonObject.put("tokenName", CLERK_USER_LOGIN_TOKEN);
|
jsonObject.put("tokenName", CLERK_USER_LOGIN_TOKEN);
|
||||||
jsonObject.put("loginDate", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
jsonObject.put("loginDate", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
jsonObject.put("pcData", clerkUserInfoService.getPcData(entity));
|
||||||
|
clerkUserInfoService.updateTokenById(entity.getId(), tokenValue);
|
||||||
|
return R.ok(jsonObject);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("顾客登录失败,", e);
|
||||||
|
return R.unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/clerk/login/dev")
|
||||||
|
public R clerkLoginDev(@Validated @RequestBody WxUserLoginVo vo) {
|
||||||
|
try {
|
||||||
|
String userId = "a4471ef596a1";
|
||||||
|
PlayClerkUserInfoEntity entity = clerkUserInfoService.selectById(userId);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new CustomException("用户不存在");
|
||||||
|
}
|
||||||
|
// 缓存租户信息
|
||||||
|
String redisKey = "TENANT_INFO:" + entity.getId();
|
||||||
|
redisCache.setCacheObject(redisKey, entity.getTenantId());
|
||||||
|
String tokenValue = tokenService.createWxUserToken(entity.getId());
|
||||||
|
JSONObject jsonObject = JSONObject.from(clerkUserInfoService.getVo(entity));
|
||||||
|
jsonObject.put("tokenValue", TOKEN_PREFIX + tokenValue);
|
||||||
|
jsonObject.put("tokenName", CLERK_USER_LOGIN_TOKEN);
|
||||||
|
jsonObject.put("loginDate", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
jsonObject.put("pcData", clerkUserInfoService.getPcData(entity));
|
||||||
clerkUserInfoService.updateTokenById(entity.getId(), tokenValue);
|
clerkUserInfoService.updateTokenById(entity.getId(), tokenValue);
|
||||||
return R.ok(jsonObject);
|
return R.ok(jsonObject);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user