|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelToPdfTool; | 
|---|
|  |  |  | import com.doumee.core.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.DateUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartHttpServletRequest; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "上传", notes = "上传", httpMethod = "POST", position = 6) | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode(), | 
|---|
|  |  |  | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "上传图片", notes = "上传图片", httpMethod = "POST", position = 6) | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), | 
|---|
|  |  |  | 
|---|
|  |  |  | String tempFileName =  nowDate + "/" + fileName; | 
|---|
|  |  |  | String key = folder + tempFileName;// 文件名 | 
|---|
|  |  |  | ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); | 
|---|
|  |  |  | int type = 2; | 
|---|
|  |  |  | if(StringUtils.endsWith(key,".mp4")){ | 
|---|
|  |  |  | type =1; | 
|---|
|  |  |  | }else if(StringUtils.endsWith(key,".jpg") | 
|---|
|  |  |  | || StringUtils.endsWith(key,".JPG") | 
|---|
|  |  |  | || StringUtils.endsWith(key,".png") | 
|---|
|  |  |  | || StringUtils.endsWith(key,".PNG") | 
|---|
|  |  |  | || StringUtils.endsWith(key,".jpeg") | 
|---|
|  |  |  | || StringUtils.endsWith(key,".JPEG")){ | 
|---|
|  |  |  | type =0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { | 
|---|
|  |  |  | // 移动成功,返回文件名 | 
|---|
|  |  |  | // sendSuccessMessage(response, resourcePath+key); | 
|---|
|  |  |  | 
|---|
|  |  |  | fileJSON.put("url", resourcePath + key); | 
|---|
|  |  |  | fileJSON.put("imgaddr", tempFileName); | 
|---|
|  |  |  | fileJSON.put("imgname", fileName); | 
|---|
|  |  |  | fileJSON.put("type", type); | 
|---|
|  |  |  | fileJSON.put("originname", originname); | 
|---|
|  |  |  | context.put("data",fileJSON); | 
|---|
|  |  |  | context.put("message","请求成功"); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (true) { | 
|---|
|  |  |  | // 关闭FTP流 | 
|---|
|  |  |  | // 移动成功,返回文件名 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /*context.put("error", 0); | 
|---|
|  |  |  | context.put("url", remoteFileName); | 
|---|
|  |  |  | context.put("fullurl", remoteFileName); | 
|---|