|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.fdkankan.manage.common.OssPath;
|
|
@@ -9,6 +10,7 @@ import com.fdkankan.common.util.DateExtUtil;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.manage.constant.FileTypeEnum;
|
|
|
import com.fdkankan.manage.entity.CommonUpload;
|
|
|
+import com.fdkankan.manage.entity.DictFile;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.service.ICommonService;
|
|
|
import java.io.File;
|
|
@@ -16,9 +18,11 @@ import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.fdkankan.manage.service.ICommonUploadService;
|
|
|
+import com.fdkankan.manage.service.IDictFileService;
|
|
|
import com.fdkankan.manage.util.FileWriterUtil;
|
|
|
import com.fdkankan.manage.util.OBJToGLBUtil;
|
|
|
import com.fdkankan.manage.util.ShellUtil;
|
|
|
+import com.fdkankan.manage.vo.response.DictFileVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -72,9 +76,11 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
|
|
|
@Autowired
|
|
|
ICommonUploadService commonUploadService;
|
|
|
+ @Autowired
|
|
|
+ IDictFileService dictFileService;
|
|
|
|
|
|
@Override
|
|
|
- public ResultData uploadFileNew(MultipartFile file) {
|
|
|
+ public ResultData uploadFileNew(MultipartFile file,Integer dictId) {
|
|
|
if(file.isEmpty() ){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_ERROR);
|
|
|
}
|
|
@@ -103,6 +109,15 @@ public class CommonServiceImpl implements ICommonService {
|
|
|
throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
|
|
|
}
|
|
|
CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum.getMsg(), extName.replace(".", ""),1,null);
|
|
|
+
|
|
|
+ DictFile dictFile = new DictFile();
|
|
|
+ dictFile.setName(commonUpload.getFileName());
|
|
|
+ dictFile.setTypeKey("media-library");
|
|
|
+ dictFile.setUploadId(commonUpload.getId());
|
|
|
+ dictFile.setDictId(dictId);
|
|
|
+ dictFile.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
+ dictFileService.addOrUpdate(dictFile);
|
|
|
+
|
|
|
return ResultData.ok(commonUpload);
|
|
|
}catch (Exception e){
|
|
|
log.info("upload-file-error:{}",e);
|