Commit e7a1ca94 by yao.xiao

测试-富文本

parent 001bb210
...@@ -19,6 +19,7 @@ import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO; ...@@ -19,6 +19,7 @@ import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO; import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsResponseVO; import com.yd.api.agms.vo.statistics.LeadsStatisticsResponseVO;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
import com.yd.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -297,7 +298,7 @@ public class AgmsController { ...@@ -297,7 +298,7 @@ public class AgmsController {
@RequestMapping(value="/controller") @RequestMapping(value="/controller")
public Object controller(@RequestParam String action, @RequestParam(required = false) String callback, @RequestParam(value = "upfile",required = false) MultipartFile upfile) { public Object controller(@RequestParam String action, @RequestParam(required = false) String callback, @RequestParam(value = "upfile",required = false) MultipartFile upfile) {
ControllerResponseVO responseVO = agmsSharingService.controller(action, upfile); ControllerResponseVO responseVO = agmsSharingService.controller(action, upfile);
if ("config".equals(action)) { if (!CommonUtil.isNullOrBlank(callback)) {
return callback +"(" + JSON.toJSONString(responseVO) + ")"; return callback +"(" + JSON.toJSONString(responseVO) + ")";
} }
return responseVO; return responseVO;
......
...@@ -97,7 +97,7 @@ public class AgmsSharingServiceImpl implements AgmsSharingService { ...@@ -97,7 +97,7 @@ public class AgmsSharingServiceImpl implements AgmsSharingService {
responseVO.setFileManagerAllowFiles(Arrays.asList(fileAllowFiles)); responseVO.setFileManagerAllowFiles(Arrays.asList(fileAllowFiles));
} else if ("uploadimage".equals(action)){ } else if ("uploadimage".equals(action)){
try { try {
String type = upfile.getOriginalFilename().substring(upfile.getOriginalFilename().indexOf(".") + 1); String type = upfile.getOriginalFilename().substring(upfile.getOriginalFilename().indexOf(".") );
byte[] bytes = upfile.getBytes(); byte[] bytes = upfile.getBytes();
InputStream in = new ByteArrayInputStream(bytes); InputStream in = new ByteArrayInputStream(bytes);
StringBuilder key = new StringBuilder("sharing/"); StringBuilder key = new StringBuilder("sharing/");
...@@ -105,17 +105,17 @@ public class AgmsSharingServiceImpl implements AgmsSharingService { ...@@ -105,17 +105,17 @@ public class AgmsSharingServiceImpl implements AgmsSharingService {
Date date = new Date(); Date date = new Date();
SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddHHmmssSSS"); SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String nowTime = sd.format(date); String nowTime = sd.format(date);
if (Arrays.asList(imageAllowFiles).contains("." + type)){ if (Arrays.asList(imageAllowFiles).contains(type)){
title = nowTime + (int)(Math.random()*1000000); title = nowTime + (int)(Math.random()*1000000);
key.append("image/").append(title); key.append("image/").append(title);
}else if (Arrays.asList(videoAllowFiles).contains("." + type)){ }else if (Arrays.asList(videoAllowFiles).contains(type)){
title = nowTime + (int)(Math.random()*1000000); title = nowTime + (int)(Math.random()*1000000);
key.append("video/").append(title); key.append("video/").append(title);
}else { }else {
title = nowTime + (int)(Math.random()*1000000); title = nowTime + (int)(Math.random()*1000000);
key.append("file/").append(title); key.append("file/").append(title);
} }
String putFileToOss = ossService.putFileToOss(null, key.toString() + "." + type, in); String putFileToOss = ossService.putFileToOss(null, key.toString() + type, in);
responseVO.setState("SUCCESS"); responseVO.setState("SUCCESS");
responseVO.setUrl(putFileToOss); responseVO.setUrl(putFileToOss);
responseVO.setTitle(title); responseVO.setTitle(title);
......
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