救援APP

This commit is contained in:
xiao-fajia 2024-08-23 20:41:20 +08:00
parent 77f6d157a5
commit a601ee0246
2 changed files with 66 additions and 56 deletions

View File

@ -12,4 +12,5 @@ public interface CommonErrorCodeConstants extends ErrorCodeConstants {
ErrorCode LOGIN_ACCOUNT_EXIST = new ErrorCode(2_002_000_004, "登录账号已存在"); ErrorCode LOGIN_ACCOUNT_EXIST = new ErrorCode(2_002_000_004, "登录账号已存在");
ErrorCode LOGIN_ACCOUNT_NOT_EXIST = new ErrorCode(2_002_000_005, "登录账号不存在"); ErrorCode LOGIN_ACCOUNT_NOT_EXIST = new ErrorCode(2_002_000_005, "登录账号不存在");
ErrorCode SYSTEM_ERROR = new ErrorCode(2_002_000_005, "系统错误"); ErrorCode SYSTEM_ERROR = new ErrorCode(2_002_000_005, "系统错误");
ErrorCode MISTAKEN_IDENTITY = new ErrorCode(2_002_000_006, "身份有误");
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.rescue.app.controller.admin; package cn.iocoder.yudao.module.rescue.app.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.CommonErrorCodeConstants; import cn.iocoder.yudao.common.CommonErrorCodeConstants;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -24,8 +25,12 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -304,62 +309,66 @@ public class SysLoginController {
// return ajax; // return ajax;
// } // }
// //
// /** /**
// * 获取App用户信息 * 获取App用户信息
// * *
// * @return 用户信息 * @return 用户信息
// */ */
// @GetMapping("/getJcgfInfo") @GetMapping("/getJcgfInfo")
// public AjaxResult getJcgfInfo() throws Exception { public CommonResult getJcgfInfo() throws Exception {
// SysUser user = SecurityUtils.getLoginUser().getUser(); Map<String, Object> map = new HashMap<>();
// SysUser sysUser = userService.selectUserById(user.getUserId()); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// // 角色集合 AdminUserRespDTO user = userService.getUser(loginUser.getId());
// Set<String> roles = permissionService.getRolePermission(user); // 角色集合
// AjaxResult ajax = success(); List<RoleReqDTO> roleList = roleApi.getRoleList();
// ajax.put("user", sysUser); List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
// ajax.put("role", roles); List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(roles)){ map.put("user", user);
// AtomicBoolean flag = new AtomicBoolean(false); map.put("role", roles);
// roles.forEach(it->{ if (CollectionUtil.isNotEmpty(roles)){
// if (it.equals("jcgf")){ AtomicBoolean flag = new AtomicBoolean(false);
// flag.set(true); roles.forEach(it->{
// } if (it.getCode().equals("jcgf")){
// }); flag.set(true);
// if (!flag.get()){ }
// throw new Exception("身份有误"); });
// } if (!flag.get()){
// }else { throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
// throw new Exception("身份有误"); }
// } }else {
// throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
// return ajax; }
// }
// //获取交警的信息 return success(map);
// @GetMapping("/getJjInfo") }
// public AjaxResult getJjInfo() throws Exception { //获取交警的信息
// SysUser user = SecurityUtils.getLoginUser().getUser(); @GetMapping("/getJjInfo")
// SysUser sysUser = userService.selectUserById(user.getUserId()); public CommonResult getJjInfo() throws Exception {
// // 角色集合 Map<String, Object> map = new HashMap<>();
// Set<String> roles = permissionService.getRolePermission(user); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// AjaxResult ajax = success(); AdminUserRespDTO user = userService.getUser(loginUser.getId());
// ajax.put("user", sysUser); // 角色集合
// ajax.put("role", roles); List<RoleReqDTO> roleList = roleApi.getRoleList();
// if (CollectionUtil.isNotEmpty(roles)){ List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(user.getId());
// AtomicBoolean flag = new AtomicBoolean(false); List<RoleReqDTO> roles = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
// roles.forEach(it->{ map.put("user", user);
// if (it.equals("jjdd")){ map.put("role", roles);
// flag.set(true); if (CollectionUtil.isNotEmpty(roles)){
// } AtomicBoolean flag = new AtomicBoolean(false);
// }); roles.forEach(it->{
// if (!flag.get()){ if (it.getCode().equals("jjdd")){
// throw new Exception("身份有误"); flag.set(true);
// } }
// }else { });
// throw new Exception("身份有误"); if (!flag.get()){
// } throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
// }
// return ajax; }else {
// } throw exception(CommonErrorCodeConstants.MISTAKEN_IDENTITY);
}
return success(map);
}
// /** // /**
// * 获取App用户信息 // * 获取App用户信息
// * // *