| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springblade.common.utils.InvestigateUtil; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.excel.SecurityExcel; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springblade.modules.system.service.IUserService; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "查看详情", notes = "传入id") |
| | | @GetMapping("/detail") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<UserVO> detail(User user) { |
| | | User detail = userService.getOne(Condition.getQueryWrapper(user)); |
| | | return R.data(UserWrapper.build().entityVO(detail)); |
| | |
| | | }) |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query, BladeUser bladeUser) { |
| | | QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class); |
| | | IPage<User> pages = userService.page(Condition.getPage(query), (!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(User::getTenantId, bladeUser.getTenantId()) : queryWrapper); |
| | |
| | | }) |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> page(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | user.setAccount("admin"); |
| | | IPage<User> pages = userService.selectUserPage(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义用户列表, |
| | | */ |
| | | @GetMapping("/pages") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "account", value = "账号名", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string") |
| | | }) |
| | | public R<IPage<UserVO>> pages(@ApiIgnore UserVO user, Query query) { |
| | | IPage<User> pages = userService.selectUserPages(Condition.getPage(query), user); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义用户列表(只有保安员) |
| | | */ |
| | | @GetMapping("/page-security") |
| | | public R<IPage<UserVO>> pageSecurity(@ApiIgnore UserVO user, Query query) { |
| | | //user.setAccount("admin"); |
| | | IPage<UserVO> pages = userService.selectUserPageSecurity(Condition.getPage(query), user); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增或修改", notes = "传入User") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R submit(@Valid @RequestBody User user) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | //资格审查 |
| | | String body = InvestigateUtil.httpGetOne(user.getCardid()); |
| | | JSONObject jsonObject = new JSONObject(body); |
| | | String data = jsonObject.get("data").toString(); |
| | | JSONObject jsonData = new JSONObject(data); |
| | | JSONArray res = jsonData.getJSONArray("res"); |
| | | if (res.length()==0){ |
| | | //没有数据正常 |
| | | user.setExaminationType("0"); |
| | | }else { |
| | | user.setExaminationType("1"); |
| | | user.setExaminationMx(res.getJSONObject(0).get("zdrylbjh").toString()); |
| | | } |
| | | return R.status(userService.submit(user)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | */ |
| | | @PostMapping("/updateUser") |
| | | public R updateUser(@Valid @RequestBody User user) { |
| | | user.setUpdateTime(new Date()); |
| | | return R.status(userService.updateById(user)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "删除", notes = "传入id集合") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R remove(@RequestParam String ids) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | return R.status(userService.removeUser(ids)); |
| | |
| | | @PostMapping("/grant") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R grant(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds, |
| | | @ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds) { |
| | | boolean temp = userService.grant(userIds, roleIds); |
| | |
| | | @PostMapping("/reset-password") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "初始化密码", notes = "传入userId集合") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R resetPassword(@ApiParam(value = "userId集合", required = true) @RequestParam String userIds) { |
| | | boolean temp = userService.resetPassword(userIds); |
| | | return R.status(temp); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 导出用户审查明细 |
| | | */ |
| | | @GetMapping("export-security") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出用户", notes = "传入user") |
| | | public void exportSecurity(UserVO user, HttpServletResponse response) { |
| | | List<SecurityExcel> list = userService.exportSecurity(user); |
| | | ExcelUtil.export(response, "保安员审查数据" + DateUtil.time(), "保安员审查数据表", list, SecurityExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 导出模板 |
| | | */ |
| | | @GetMapping("export-template") |
| | |
| | | @ApiOperationSupport(order = 17) |
| | | @ApiOperation(value = "查看平台详情", notes = "传入id") |
| | | @GetMapping("/platform-detail") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<UserVO> platformDetail(User user) { |
| | | return R.data(userService.platformDetail(user)); |
| | | } |
| | |
| | | return R.success("吊销成功"); |
| | | } |
| | | |
| | | /** |
| | | * 查询押运人员 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/selectPeo") |
| | | public R selectPeo(@ApiIgnore UserVO user) { |
| | | List list = userService.selectPeo(user); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |