| | |
| | | import com.ruoyi.im.dto.UpdateUserBusinessDto; |
| | | import com.ruoyi.im.service.NeteaseTeamService; |
| | | import com.ruoyi.system.domain.NeteaseTeam; |
| | | import com.ruoyi.system.domain.SystemConfiguration; |
| | | import com.ruoyi.system.domain.UserAccount; |
| | | import com.ruoyi.system.domain.vo.GroupVo; |
| | | import com.ruoyi.system.domain.vo.UserAccountVo; |
| | | import com.ruoyi.system.mapper.SystemConfigurationMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Autowired |
| | | NeteaseTeamService neteaseGroupService; |
| | | |
| | | |
| | | @Autowired |
| | | private SystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Value("${file.upload-prefix}") |
| | | private String prefix; |
| | | |
| | | /** |
| | | * 获取群组列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('im:group:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(@PathVariable(value = "keywords", required = false) String keywords) |
| | | public TableDataInfo list(GroupVo vo) |
| | | { |
| | | // 创建查询条件包装器 |
| | | LambdaQueryWrapper<NeteaseTeam> queryWrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | // 只有当 keyword 不为空时才添加 OR 条件 |
| | | if (ObjectUtil.isNotEmpty(keywords)) { |
| | | if (ObjectUtil.isNotEmpty(vo.getKeywords())) { |
| | | queryWrapper.and(wrapper -> wrapper |
| | | .eq(NeteaseTeam::getTid, keywords) |
| | | .eq(NeteaseTeam::getTid, vo.getKeywords()) |
| | | .or() |
| | | .eq(NeteaseTeam::getOwnerAccountId, keywords) |
| | | .eq(NeteaseTeam::getOwnerAccountId, vo.getKeywords()) |
| | | .or() |
| | | .eq(NeteaseTeam::getName,keywords) |
| | | .eq(NeteaseTeam::getName,vo.getKeywords()) |
| | | ); |
| | | } |
| | | |
| | |
| | | public Result uploadFile(@RequestParam("file") MultipartFile file) { |
| | | try { |
| | | |
| | | SystemConfiguration systemConfiguration = systemConfigurationMapper.selectById(1); |
| | | if(ObjectUtil.isEmpty(systemConfiguration)){ |
| | | return Result.error("文件上传失败!"); |
| | | } |
| | | |
| | | // 1. 验证文件类型 |
| | | String contentType = file.getContentType(); |
| | | if (contentType == null || |
| | |
| | | setPermissions(filePath.toFile(), "rw-r--r--"); |
| | | |
| | | // 5. 调用网易云信API更新头像 |
| | | fileName = prefix+"/"+fileName; |
| | | fileName = systemConfiguration.getImgUrl()+"/"+fileName; |
| | | return Result.success("文件上传成功",fileName); |
| | | } catch (IOException e) { |
| | | return Result.error("文件上传失败"); |