| | |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.log.logger.BladeLogger; |
| | | import org.springblade.core.tool.jackson.JsonUtil; |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.sxkj.common.cache.CacheNames; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.sxkj.common.model.ResponseResult; |
| | | import org.sxkj.system.entity.Dept; |
| | | import org.sxkj.system.entity.User; |
| | | import org.sxkj.system.entity.UserInfo; |
| | | import org.sxkj.system.excel.UserExcel; |
| | | import org.sxkj.system.excel.UserImporter; |
| | | import org.sxkj.system.mapper.DeptMapper; |
| | |
| | | private final BladeLogger bladeLogger; |
| | | @Autowired |
| | | private DeptMapper deptMapper; |
| | | |
| | | /** |
| | | * 查询单条 |
| | | */ |
| | |
| | | @ApiOperation(value = "查看详情", notes = "传入id") |
| | | @GetMapping("/info") |
| | | public R<UserVO> info(BladeUser user) { |
| | | if(Objects.isNull(user)){ |
| | | if (Objects.isNull(user)) { |
| | | return R.fail(401, "token失效了!"); |
| | | } |
| | | User detail = userService.getById(user.getUserId()); |
| | | if(Objects.isNull(detail)){ |
| | | if (Objects.isNull(detail)) { |
| | | return R.data(null); |
| | | } |
| | | return R.data(UserWrapper.build().entityVO(detail)); |
| | |
| | | @ApiLog("用户信息新增或者修改") |
| | | public R submit(@Valid @RequestBody User user) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | Dept dept=deptMapper.selectById(user.getDeptId()); |
| | | Dept dept = deptMapper.selectById(user.getDeptId()); |
| | | user.setAreaCode(dept.getAreaCode()); |
| | | bladeLogger.info("用户信息新增或者修改", user.toString()); |
| | | return R.status(userService.submit(user)); |
| | | } |
| | | |
| | | /** |
| | | * 用户信息新增或者修改-对外 |
| | | */ |
| | | @PostMapping("/submitExternal") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "新增或修改用户", notes = "传入User,新增或修改用户") |
| | | @ApiLog("用户信息新增或者修改-对外") |
| | | public R submitExternal(@Valid @RequestBody User user) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | |
| | | boolean isRet = false; |
| | | |
| | | UserInfo userInfo = userService.userInfo("000000", user.getAccount()); |
| | | if (userInfo != null && userInfo.getUser() != null) { |
| | | bladeLogger.info("用户信息修改", user.toString()); |
| | | user.setId(userInfo.getUser().getId()); |
| | | user.setDeptId(userInfo.getUser().getDeptId()); |
| | | user.setRoleId(userInfo.getUser().getRoleId()); |
| | | isRet = userService.updateUser(user); |
| | | } else { |
| | | Dept dept = deptMapper.selectById(1123598813738675201L); |
| | | user.setAreaCode(dept.getAreaCode()); |
| | | user.setPassword("jadk@2026"); |
| | | user.setDeptId(user.getDeptId() == null ? String.valueOf(dept.getId()) : user.getDeptId()); |
| | | user.setRoleId(user.getRoleId() == null ? "2011678430358691842" : user.getRoleId()); |
| | | isRet = userService.submit(user); |
| | | bladeLogger.info("用户信息新增", user.toString()); |
| | | } |
| | | |
| | | return R.status(isRet); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @PostMapping("/update") |