| | |
| | | import com.ruoyi.system.domain.out.UserOut; |
| | | import com.ruoyi.system.domain.out.UserTeamAndPositionOut; |
| | | import com.ruoyi.system.domain.vo.UserAccountUpdateVo; |
| | | import com.ruoyi.system.mapper.SystemConfigurationMapper; |
| | | import com.ruoyi.system.service.GroupWelcomeConfigService; |
| | | import com.ruoyi.system.service.IpBlacklistService; |
| | | import com.ruoyi.system.service.PaymentRecordService; |
| | |
| | | @Autowired |
| | | InsuranceFeatureService insuranceFeatureService; |
| | | |
| | | |
| | | @Autowired |
| | | private SystemConfigurationMapper systemConfigurationMapper; |
| | | |
| | | @Value("${file.upload-dir}") |
| | | private String uploadDir; |
| | | |
| | | @Value("${file.upload-prefix}") |
| | | private String prefix; |
| | | |
| | | |
| | | |
| | |
| | | public Result uploadFile(@RequestParam("file") MultipartFile file,@RequestParam("accountId") String accountId) { |
| | | 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; |
| | | UpdateUserBusinessDto dto = new UpdateUserBusinessDto(); |
| | | dto.setAvatar(fileName); |
| | | Map<String, Object> result = imApiServcie.updateUserAvatar(accountId,dto); |