| | |
| | | import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.SensitiveDataCryptoUtil; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | | import com.xiaopeng.common.log.enums.AdminBusinessType; |
| | | import com.xiaopeng.common.log.enums.AdminOperationType; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.evi.oss.service.AliOssService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | */ |
| | | @PostMapping("/logan/inner/xpOperationsUser/listByIds") |
| | | public R<List<XpOperationsUser>> listByIds(@RequestBody List<Long> ids) { |
| | | return R.ok(xpOperationsUserService.listByIds(ids)); |
| | | List<XpOperationsUser> users = xpOperationsUserService.listByIds(ids); |
| | | users.forEach(user -> user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber()))); |
| | | return R.ok(users); |
| | | } |
| | | |
| | | @PostMapping("/logan/inner/xpOperationsUser/pageListByIds") |
| | |
| | | XpOperationsRole operationsUserId = xpOperationsRoleMapper.selectOne(new QueryWrapper<XpOperationsRole>().eq("operations_user_id", id)); |
| | | SysRole sysRole = sysRoleService.getById(operationsUserId.getRoleId()); |
| | | operationsUser.setRoleName(sysRole.getRoleName()); |
| | | operationsUser.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(operationsUser.getPhoneNumber())); |
| | | return R.ok(operationsUser); |
| | | } |
| | | |
| | |
| | | List<XpOperationsUserWithRoleVO> result = xpOperationsRoleMapper.selectUsersByConditions( |
| | | dto.getNickName(), |
| | | dto.getPhoneNumber(), |
| | | SensitiveDataCryptoUtil.queryValues(dto.getPhoneNumber()), |
| | | dto.getRoleId() |
| | | ); |
| | | result.forEach(user -> user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber()))); |
| | | return R.ok(result); |
| | | } |
| | | |
| | |
| | | @PostMapping("/api/v1/operationsUser/listAll") |
| | | public R<List<XpOperationsUser>> listAll() { |
| | | List<XpOperationsUser> listAll = xpOperationsUserService.list(); |
| | | listAll.forEach(user -> user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber()))); |
| | | for (XpOperationsUser xpOperationsUser : listAll) { |
| | | // todo 需要上传工单id,根据距离进行排序 |
| | | } |
| | |
| | | List<XpOperationsUser> users = xpOperationsUserService.lambdaQuery() |
| | | .eq(XpOperationsUser::getStatus, true) |
| | | .list(); |
| | | users.forEach(user -> user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber()))); |
| | | return R.ok(users); |
| | | } |
| | | |
| | | @ApiOperation(value = "运维人员管理新增", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/add") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.ADD, |
| | | content = "新增运维人员", |
| | | appendRequestData = true |
| | | ) |
| | | public R<String> add(@RequestBody XpOperationsUserAddDTO dto) { |
| | | return xpOperationsUserService.addOperationsUser(dto); |
| | | } |
| | | |
| | | @ApiOperation(value = "运维人员管理编辑", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/edit") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.EDIT, |
| | | content = "编辑运维人员", |
| | | appendRequestData = true |
| | | ) |
| | | public R<String> edit(@RequestBody XpOperationsUserAddDTO dto) { |
| | | return xpOperationsUserService.editOperationsUser(dto); |
| | | } |
| | | |
| | | @ApiOperation(value = "运维人员管理启用禁用", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/enableDisableById") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.SWITCH_STATUS, |
| | | content = "运维人员管理启用禁用", |
| | | appendRequestData = true |
| | | ) |
| | | public R<String> enableDisableById(@RequestBody EnableDisableDTO dto) { |
| | | xpOperationsUserService.enableDisableById(dto); |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "运维人员管理删除", tags = {"管理后台-运维执行"}) |
| | | @DeleteMapping("/api/v1/operationsUser/deleteById") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.DELETE, |
| | | content = "删除运维人员", |
| | | appendRequestData = true |
| | | ) |
| | | public R<String> deleteById(@RequestParam Long id) { |
| | | try { |
| | | R<XpFleet> fleetResult = xpFleetClient.getFleetByOperationsUserId(id); |
| | |
| | | |
| | | @ApiOperation(value = "运维人员管理重置密码", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/rePassword") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.RESET_PASSWORD, |
| | | content = "重置运维人员密码", |
| | | appendRequestData = true |
| | | ) |
| | | public R<String> rePassword(@RequestBody RePasswordDTO dto) { |
| | | xpOperationsUserService.rePassword(dto); |
| | | return R.ok(); |
| | |
| | | |
| | | @ApiOperation(value = "运维人员管理导出列表", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/exportOperationsUser") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.EXPORT, |
| | | content = "导出运维人员列表", |
| | | appendRequestData = true |
| | | ) |
| | | public void exportOperationsUser(@RequestBody XpOperationsUserQuery query, HttpServletResponse response) { |
| | | xpOperationsUserService.exportOperationsUser(query, response); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "运维人员管理导出模板", tags = {"管理后台-运维执行"}) |
| | | @GetMapping("/api/v1/operationsUser/exportTemplate") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.EXPORT, |
| | | content = "导出运维人员模板", |
| | | appendRequestData = false |
| | | ) |
| | | public void exportTemplate(HttpServletResponse response) { |
| | | xpOperationsUserService.exportTemplate(response); |
| | | } |
| | |
| | | |
| | | @ApiOperation(value = "运维人员管理导入数据", tags = {"管理后台-运维执行"}) |
| | | @PostMapping("/api/v1/operationsUser/importOperationsUser") |
| | | @AdminOperationLog( |
| | | businessType = AdminBusinessType.OPERATIONS_USER_MANAGEMENT, |
| | | operationType = AdminOperationType.IMPORT, |
| | | content = "导入运维人员数据", |
| | | appendRequestData = false |
| | | ) |
| | | public R<String> importOperationsUser(@RequestParam("file") MultipartFile file) { |
| | | xpOperationsUserService.importOperationsUser(file); |
| | | return R.ok(); |
| | |
| | | @ApiOperation(value = "根据手机号精确查询运维用户", tags = {"内部接口"}) |
| | | @GetMapping("/logan/inner/xpOperationsUser/getByExactPhone") |
| | | public R<XpOperationsUser> getByExactPhone(@RequestParam("phoneNumber") String phoneNumber) { |
| | | if (com.xiaopeng.common.core.utils.StringUtils.isBlank(phoneNumber)) { |
| | | return R.ok(); |
| | | } |
| | | XpOperationsUser user = xpOperationsUserService.lambdaQuery() |
| | | .eq(XpOperationsUser::getPhoneNumber, phoneNumber) |
| | | .in(XpOperationsUser::getPhoneNumber, SensitiveDataCryptoUtil.queryValues(phoneNumber)) |
| | | .last("LIMIT 1") |
| | | .one(); |
| | | if (user != null) { |
| | | user.setPhoneNumber(SensitiveDataCryptoUtil.decryptIfPossible(user.getPhoneNumber())); |
| | | } |
| | | return R.ok(user); |
| | | } |
| | | } |