Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

wangzl 4 mēneši atpakaļ
vecāks
revīzija
e2fb77cf19

+ 1 - 2
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/storage/service/impl/StorageFileServiceImpl.java

@@ -98,8 +98,7 @@ public class StorageFileServiceImpl implements IStorageFileService {
             storageRecordService.updateSysStorageRecordById(record);
             return record;
         }
-        fileClient.upload(content,bizName);
-        String downUrl = fileClient.downUrl(bizName);
+        String downUrl =fileClient.upload(content, bizName);
 
         record = SysStorageRecordDTO.builder()
                 .realName(filename)

+ 2 - 1
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/controller/SysTenantController.java

@@ -79,9 +79,10 @@ public class SysTenantController extends BaseController{
     }
 
     @ApiOperationSupport(author = "lf",order = 7)
-    @ApiOperation(value="查询当前用户的租户信息",notes = "权限: 无")
+    @ApiOperation(value="编辑当前用户的租户信息",notes = "权限: 无")
     @PostMapping("/edit/current")
     public CommonResult<Boolean> editCurrent(@RequestBody@Validated(Update.class) SysCurrentTenantAddDTO source) {
+        source.setId(LoginUserStrategy.tr.getTenantId());
         return CommonResult.success(sysTenantService.updateSysTenantById(SysTenantMapper.INSTANCE.toAddTOPO(source)));
     }
 }

+ 3 - 5
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/tenant/dto/SysCurrentTenantAddDTO.java

@@ -8,7 +8,6 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
 /**
@@ -21,16 +20,15 @@ import java.io.Serializable;
 @ApiModel("医院新增对象")
 public class SysCurrentTenantAddDTO implements Serializable {
     private static final long serialVersionUID = 1841053739406204228L;
-    @ApiModelProperty(value = "id",required = true)
-    @NotBlank(message = "id不能为空",groups = {Update.class})
+    @ApiModelProperty(value = "id",required = true,hidden = true)
     private String id;
 
     @ApiModelProperty(value = "医院名称",required = true)
     @NotBlank(message = "名称不能为空",groups = {Insert.class, Update.class})
     private String name;
 
-    @ApiModelProperty("网络泵的医院编码")
-    private String code;
+    @ApiModelProperty("医院头像")
+    private String tenantAvatar;
 
     @ApiModelProperty("医院备注")
     private String remark;

+ 1 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/FileClient.java

@@ -22,7 +22,7 @@ public interface FileClient {
      * @param bizPath   业务路径
      * @return 返回bizPath
      */
-    void upload(byte[] content,String bizPath) throws Exception;
+    String upload(byte[] content,String bizPath) throws Exception;
 
     /**
      * 根据业务路径删除文件

+ 2 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/ali/AliFileClient.java

@@ -38,7 +38,7 @@ public class AliFileClient extends AbstractFileClient<AliFileClientConfig> {
     }
 
     @Override
-    public void upload(byte[] content, String bizPath) throws IOException {
+    public String upload(byte[] content, String bizPath) throws IOException {
         bizPath=parseBizPath(bizPath);
         boolean exists = ossClient.doesBucketExist(getConfig().getAliBucketName());
         if (!exists) {
@@ -50,6 +50,7 @@ public class AliFileClient extends AbstractFileClient<AliFileClientConfig> {
         PutObjectRequest putObjectRequest = new PutObjectRequest(getConfig().getAliBucketName(), bizPath, IoUtil.toStream(content),objectMetadata);
         ossClient.putObject(putObjectRequest);
         log.info("[{}]:[{}],文件[{}]上传成功",this.getClass().getCanonicalName(),getId(),bizPath);
+        return "https://"+this.getConfig().getAliBucketName()+"."+this.getConfig().getAliEndpoint()+"/"+bizPath;
     }
 
     @Override

+ 2 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/db/DbFileClient.java

@@ -31,10 +31,11 @@ public class DbFileClient extends AbstractFileClient<DbFileClientConfig> {
     }
 
     @Override
-    public void upload(byte[] content, String bizPath) throws IOException {
+    public String upload(byte[] content, String bizPath) throws IOException {
         bizPath=parseBizPath(bizPath);
         clientDAO.upload(getId(),bizPath, MediaTypeUtils.parseContentType(bizPath),content);
         log.info("[{}]:[{}],文件[{}]上传成功",this.getClass().getCanonicalName(),getId(),bizPath);
+        return null;
     }
 
     @Override

+ 2 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/local/LocalFileClient.java

@@ -34,11 +34,12 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> {
     }
 
     @Override
-    public void upload(byte[] content, String bizPath) throws IOException {
+    public String upload(byte[] content, String bizPath) throws IOException {
         bizPath=parseBizPath(bizPath);
         File file = FileUtil.touch(getAbsPath(bizPath));
         IoUtil.write(new FileOutputStream(file),true,content);
         log.info("[{}]:[{}],文件[{}]上传成功",this.getClass().getCanonicalName(),getId(),bizPath);
+        return null;
     }
 
     @Override

+ 2 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/minio/MinIoFileClient.java

@@ -41,7 +41,7 @@ public class MinIoFileClient extends AbstractFileClient<MinIoFileClientConfig> {
     }
 
     @Override
-    public void upload(byte[] content, String bizPath) throws Exception {
+    public String upload(byte[] content, String bizPath) throws Exception {
         bizPath=parseBizPath(bizPath);
         String bucketName = getConfig().getMinioBucketName();
         //先判断桶是否存在
@@ -64,6 +64,7 @@ public class MinIoFileClient extends AbstractFileClient<MinIoFileClientConfig> {
         }finally {
             stream.close();
         }
+        return null;
     }
 
     @Override