|
@@ -37,6 +37,7 @@ import com.qunzhixinxi.hnqz.admin.service.SysUserAreaService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.SysUserService;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.WmPlatformQuizTestResultService;
|
|
|
import com.qunzhixinxi.hnqz.common.core.constant.CommonConstants;
|
|
|
+import com.qunzhixinxi.hnqz.common.core.constant.SecurityConstants;
|
|
|
import com.qunzhixinxi.hnqz.common.core.entity.BaseEntity;
|
|
|
import com.qunzhixinxi.hnqz.common.core.util.R;
|
|
|
import com.qunzhixinxi.hnqz.common.log.annotation.SysLog;
|
|
@@ -56,6 +57,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestHeader;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -198,6 +200,71 @@ public class SysUserController {
|
|
|
return R.failed(null, String.format("用户信息为空 %s", username));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取指定用户全部信息
|
|
|
+ *
|
|
|
+ * @return 用户信息
|
|
|
+ */
|
|
|
+ @Inner
|
|
|
+ @GetMapping("/info/inner")
|
|
|
+ R<UserInfo> info1(@RequestParam("username") String username,
|
|
|
+ @RequestParam("appLogin") Boolean isApp) {
|
|
|
+
|
|
|
+ // 根据用户名查询用户时,过滤掉已删除和已禁用的用户
|
|
|
+ List<SysUser> users = userService.list(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username)
|
|
|
+ .eq(SysUser::getDelFlag, 0).eq(SysUser::getLockFlag, 0));
|
|
|
+
|
|
|
+ if (CollUtil.isEmpty(users)) {
|
|
|
+ return R.failed(null, String.format("用户信息为空 %s", username));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 移动端登录
|
|
|
+ if (isApp) {
|
|
|
+ return appUserInfo(users);
|
|
|
+ }
|
|
|
+ // pc端登录
|
|
|
+ else {
|
|
|
+ return webUserInfo(username, users);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // pc端登录
|
|
|
+ private R<UserInfo> webUserInfo(String username, List<SysUser> users) {
|
|
|
+ // 单一账号情况
|
|
|
+ if (users.size() == 1) {
|
|
|
+ SysUser sysUser = users.get(0);
|
|
|
+ UserInfo userInfo = userService.findUserInfo(sysUser);
|
|
|
+ // 校验用户角色是否包含众包用户和医药代表用户, 兼职和全职不能登录pc
|
|
|
+ return isZbOrDbUsers(userInfo.getRoles()) ? R.ok(userInfo) : R.failed(null, String.format("用户信息错误 %s", username));
|
|
|
+ }
|
|
|
+ // 多账号情况
|
|
|
+ else {
|
|
|
+ String password = (String) redisTemplate.opsForValue().get(username);
|
|
|
+ if (StrUtil.isNotBlank(password)) {
|
|
|
+ for (SysUser sysUser : users) {
|
|
|
+ UserInfo userInfo = userService.findUserInfo(sysUser);
|
|
|
+ if (Md5Utils.getMD5(password.getBytes()).equals(sysUser.getW1())) {
|
|
|
+ if (isZbOrDbUsers(userInfo.getRoles())) {
|
|
|
+ redisTemplate.delete(username);
|
|
|
+ return R.ok(userInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.failed(null, String.format("用户信息为空 %s", username));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 移动端登录:管理员和业务员均可登录
|
|
|
+ private R<UserInfo> appUserInfo(List<SysUser> users) {
|
|
|
+
|
|
|
+ SysUser sysUser = users.get(0);
|
|
|
+ UserInfo userInfo = userService.findUserInfo(sysUser);
|
|
|
+ return R.ok(userInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过ID查询用户信息
|
|
|
*
|
|
@@ -1157,7 +1224,7 @@ public class SysUserController {
|
|
|
userAreaTree = areaEntityService.selectTree(new SysAreaEntity());
|
|
|
}
|
|
|
// 药企管理员(事业部) || 区域管理员(一级cso管理员) || etc,.
|
|
|
- else if (roles.contains(3) || roles.contains(4) || roles.contains(39)|| roles.contains(40)|| roles.contains(41)|| roles.contains(42) || roles.contains(43)) {
|
|
|
+ else if (roles.contains(3) || roles.contains(4) || roles.contains(39) || roles.contains(40) || roles.contains(41) || roles.contains(42) || roles.contains(43)) {
|
|
|
userAreaTree = userService.getUserAreaTree(Long.valueOf(user.getId()));
|
|
|
}
|
|
|
// 服务商管理员(二级cso管理员)
|