|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.user.SSOLoginHelper;
|
|
import com.fdkankan.common.user.SSOLoginHelper;
|
|
|
|
+import com.fdkankan.common.user.SSOUser;
|
|
import com.fdkankan.common.util.BASE64DecodedMultipartFile;
|
|
import com.fdkankan.common.util.BASE64DecodedMultipartFile;
|
|
import com.fdkankan.common.util.FileUtil;
|
|
import com.fdkankan.common.util.FileUtil;
|
|
import com.fdkankan.fyun.oss.UploadFilePath;
|
|
import com.fdkankan.fyun.oss.UploadFilePath;
|
|
@@ -54,7 +55,13 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
private SSOLoginHelper ssoLoginHelper;
|
|
private SSOLoginHelper ssoLoginHelper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String uploads(String imgData,String fileName,MultipartFile[] files,String sceneCode,Integer type) throws Exception{
|
|
|
|
|
|
+ public String uploads(String imgData,String fileName,MultipartFile[] files,String sceneCode,Integer type,String token) throws Exception{
|
|
|
|
+ SSOUser ssoUser = ssoLoginHelper.loginCheck(token);
|
|
|
|
+// if(ssoUser == null ){
|
|
|
|
+// throw new BusinessException(ErrorCode.USER_NOT_LOGIN);
|
|
|
|
+// }
|
|
|
|
+ Long userId = ssoUser == null ? null :ssoUser.getId();
|
|
|
|
+
|
|
List<MultipartFile> multipartFiles = new ArrayList<>();
|
|
List<MultipartFile> multipartFiles = new ArrayList<>();
|
|
if(StringUtils.isNotBlank(imgData)){
|
|
if(StringUtils.isNotBlank(imgData)){
|
|
MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(imgData);
|
|
MultipartFile file = BASE64DecodedMultipartFile.base64ToMultipart(imgData);
|
|
@@ -63,10 +70,10 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
if(files !=null && files.length >0){
|
|
if(files !=null && files.length >0){
|
|
multipartFiles.addAll(Arrays.asList(files));
|
|
multipartFiles.addAll(Arrays.asList(files));
|
|
}
|
|
}
|
|
- return this.uploadFiles(fileName,multipartFiles,sceneCode,type);
|
|
|
|
|
|
+ return this.uploadFiles(fileName,multipartFiles,sceneCode,type,userId);
|
|
}
|
|
}
|
|
|
|
|
|
- public String uploadFiles(String sendFileName,List<MultipartFile> files, String sceneCode, Integer type) throws Exception{
|
|
|
|
|
|
+ public String uploadFiles(String sendFileName,List<MultipartFile> files, String sceneCode, Integer type,Long userId) throws Exception{
|
|
if (StringUtils.isEmpty(sceneCode) || files == null || files.size() <= 0) {
|
|
if (StringUtils.isEmpty(sceneCode) || files == null || files.size() <= 0) {
|
|
throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ErrorCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
@@ -105,7 +112,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
|
|
|
|
FileUtil.delFile(newFile.getPath());
|
|
FileUtil.delFile(newFile.getPath());
|
|
//添加记录
|
|
//添加记录
|
|
- this.saveData(sceneCode,ossPath,prefix);
|
|
|
|
|
|
+ this.saveData(sceneCode,ossPath,prefix,userId);
|
|
}
|
|
}
|
|
StringBuilder returnString = new StringBuilder();
|
|
StringBuilder returnString = new StringBuilder();
|
|
for (String res : urlList) {
|
|
for (String res : urlList) {
|
|
@@ -141,12 +148,12 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
|
|
this.updateById(sceneUpload);
|
|
this.updateById(sceneUpload);
|
|
}
|
|
}
|
|
|
|
|
|
- private void saveData(String sceneCode, String ossPath, String prefix) {
|
|
|
|
|
|
+ private void saveData(String sceneCode, String ossPath, String prefix,Long userId) {
|
|
SceneUpload sceneUpload = new SceneUpload();
|
|
SceneUpload sceneUpload = new SceneUpload();
|
|
sceneUpload.setSceneCode(sceneCode);
|
|
sceneUpload.setSceneCode(sceneCode);
|
|
sceneUpload.setFileName(ossPath);
|
|
sceneUpload.setFileName(ossPath);
|
|
sceneUpload.setFilePrefix(prefix);
|
|
sceneUpload.setFilePrefix(prefix);
|
|
- sceneUpload.setUploadUser(null);
|
|
|
|
|
|
+ sceneUpload.setUploadUser(userId.toString());
|
|
this.save(sceneUpload);
|
|
this.save(sceneUpload);
|
|
}
|
|
}
|
|
|
|
|