| | |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.excel.PoliceUserExcel; |
| | | import org.springblade.modules.system.excel.PoliceUserImporter; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springblade.modules.system.service.IUserService; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; |
| | | import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE; |
| | | |
| | | /** |
| | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "搜索用户", notes = "传入name") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<List<UserVO>> searchUser(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | public R<List<UserVO>> searchUser(@ApiIgnore User user, Query query, String deptId, BladeUser bladeUser) { |
| | | 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().listVO(pages.getRecords())); |
| | | } |
| | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> page(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | public R<IPage<UserVO>> page(@ApiIgnore User user, Query query, String deptId, BladeUser bladeUser) { |
| | | 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)); |
| | | } |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增或修改", notes = "传入User") |
| | | @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | @PreAuth("hasAnyRole('administrator', 'admin','wygly')") |
| | | public R submit(@Valid @RequestBody User user) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | return R.status(userService.submit(user)); |
| | |
| | | @ApiOperation(value = "修改", notes = "传入User") |
| | | public R update(@Valid @RequestBody User user) { |
| | | CacheUtil.clear(USER_CACHE); |
| | | CacheUtil.clear(SYS_CACHE); |
| | | return R.status(userService.updateUser(user)); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getUserInfo") |
| | | public R getUserInfo(){ |
| | | public R getUserInfo() { |
| | | //根据保安员编码查询保安员信息 |
| | | return R.data(userService.getUserInfo(AuthUtil.getUserId())); |
| | | } |
| | |
| | | * 修改 |
| | | */ |
| | | @GetMapping("/getUserInfoByCode") |
| | | @ApiOperation(value = "查询人员", notes = "houseCode") |
| | | public R getUserInfoByCode(@RequestParam("houseCode") String houseCode, @RequestParam(value = "type",defaultValue = "2") String type) { |
| | | return R.data(userService.getUserInfoByCode(houseCode,type)); |
| | | @ApiOperation(value = "查询物业人员/网格人员", notes = "houseCode") |
| | | public R getUserInfoByCode(@RequestParam("houseCode") String houseCode, @RequestParam(value = "type", defaultValue = "2") String type) { |
| | | return R.data(userService.getUserInfoByCode(houseCode, type)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过小区id查询物业人员/网格人员 |
| | | */ |
| | | @GetMapping("/getUserInfoByDistrictId") |
| | | @ApiOperation(value = "查询物业人员/网格人员", notes = "houseCode") |
| | | public R getUserInfoByDistrictId(@RequestParam("districtId") String districtId, @RequestParam(value = "building", required = false) String building) { |
| | | return R.data(userService.getUserInfoByDistrictId(districtId, building)); |
| | | } |
| | | |
| | | /** |
| | | * 通过小区id查询用户 |
| | | */ |
| | | @GetMapping("/getUserInfoByDistrictIds") |
| | | @ApiOperation(value = "通过小区id查询用户") |
| | | public R<IPage<UserVO>> getUserInfoByDistrictIds(@RequestParam("districtIds") String districtIds |
| | | , @RequestParam(value = "building", required = false) String building |
| | | , @RequestParam(value = "unit", required = false) String unit |
| | | , @RequestParam(value = "name", required = false) String name |
| | | , Query query) { |
| | | IPage<User> pages = userService.getUserInfoByDistrictIds(districtIds, building, unit, name, Condition.getPage(query)); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过机构查询物业公司人员 |
| | | */ |
| | | @GetMapping("/getUserInfoByPropertyCompanyId") |
| | | @ApiOperation(value = "通过机构查询物业公司人员", notes = "propertyCompanyId") |
| | | public R getUserInfoByPropertyId(@RequestParam("propertyCompanyId") String propertyCompanyId, @RequestParam("roleId") String roleId) { |
| | | return R.data(userService.getUserInfoByPropertyId(propertyCompanyId, roleId)); |
| | | } |
| | | |
| | | /** |
| | | * 处理漏绑定的user_dept |
| | | */ |
| | | @GetMapping("/handleUserDept") |
| | | public R handleUserDept() { |
| | | return R.data(userService.handleUserDept()); |
| | | } |
| | | |
| | | /** |
| | | * 处理漏绑定的user_dept |
| | | */ |
| | | @GetMapping("/handleUser") |
| | | public R handleUser() { |
| | | return R.data(userService.handleUser()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 民警数据导入 |
| | | */ |
| | | @PostMapping("/policemanDataHandle") |
| | | public R policemanDataHandle(MultipartFile file) { |
| | | PoliceUserImporter policeUserImporter = new PoliceUserImporter(userService); |
| | | ExcelUtil.save(file, policeUserImporter, PoliceUserExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 通过经纬度查询最近的民警人员 |
| | | * longitude |
| | | * latitude |
| | | */ |
| | | @GetMapping("/getPoliceUser") |
| | | @ApiOperation(value = "通过经纬度查询最近的民警人员") |
| | | public R getPoliceUser(@RequestParam("longitude") String longitude, @RequestParam(value = "latitude") String latitude, @RequestParam(value = "houseCode", required = false) String houseCode) { |
| | | return R.data(userService.getPoliceUser(longitude, latitude, houseCode)); |
| | | } |
| | | |
| | | } |