Commit ff7c524f by liuyang

2024-07-24 app文件上传

parent 620eb6c0
package com.baosight.hggp.controller; package com.baosight.hggp.controller;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.utils.QrCodeUtils; import com.baosight.hggp.core.utils.QrCodeUtils;
import com.baosight.hggp.hg.mt.utils.UploadUtils; import com.baosight.hggp.hg.mt.utils.UploadUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
...@@ -39,8 +41,13 @@ public class FileUploadController { ...@@ -39,8 +41,13 @@ public class FileUploadController {
public Map upload(MultipartFile file, HttpServletRequest request) throws IOException { public Map upload(MultipartFile file, HttpServletRequest request) throws IOException {
Map resultMap = new HashMap(); Map resultMap = new HashMap();
try { try {
//JSONObject upload = UploadUtils.upload((CommonsMultipartFile)file); JSONObject upload = new JSONObject();
JSONObject upload = UploadUtils.uploadFile(request); String projectEnv = ProjectInfo.getProjectEnv();
if (CommonConstant.projectEnv.RUN.equalsIgnoreCase(projectEnv)) {
upload = UploadUtils.upload((CommonsMultipartFile)file);
}else {
upload = UploadUtils.uploadFile(request);
}
resultMap.put("id", upload.getString("docId")); resultMap.put("id", upload.getString("docId"));
resultMap.put("status", EiConstant.STATUS_SUCCESS); resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS"); resultMap.put("message", "SUCCESS");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment