|
@@ -13,6 +13,7 @@ import com.ozs.base.vo.BaseNoticePageReqVo;
|
|
|
import com.ozs.base.vo.BaseNoticeVo;
|
|
|
import com.ozs.base.vo.BasePolicyPageReqVo;
|
|
|
import com.ozs.common.annotation.Log;
|
|
|
+import com.ozs.common.config.PurchaseConfig;
|
|
|
import com.ozs.common.constant.ModularConstans;
|
|
|
import com.ozs.common.core.controller.BaseController;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
@@ -21,6 +22,7 @@ import com.ozs.common.utils.file.FileUploadUtils;
|
|
|
import com.ozs.common.utils.file.FileUtils;
|
|
|
import com.ozs.common.utils.uuid.UUID;
|
|
|
import com.ozs.common.vo.EsMessage;
|
|
|
+import com.ozs.framework.config.ServerConfig;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -48,6 +50,9 @@ public class BasePolicyController extends BaseController {
|
|
|
@Autowired
|
|
|
private BasePolicyService basePolicyService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ServerConfig serverConfig;
|
|
|
+
|
|
|
@ApiOperation(value = "分页查询政策法规")
|
|
|
@PostMapping("/page")
|
|
|
@PreAuthorize("@ss.hasPermi('base:policy:list')")
|
|
@@ -85,12 +90,16 @@ public class BasePolicyController extends BaseController {
|
|
|
try {
|
|
|
// 上传到服务器,返回一个服务器硬盘地址
|
|
|
String esId = UUID.randomUUID().toString();
|
|
|
- String upload = FileUploadUtils.uploadPdfToEs(file,esId );
|
|
|
+ // 上传文件路径
|
|
|
+ String filePath = PurchaseConfig.getUploadPath();
|
|
|
+ // 上传并返回新文件名称
|
|
|
+ String upload = FileUploadUtils.upload(filePath, file);
|
|
|
+ FileUtils.uploadESFile(upload,esId);
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
- ajax.put("url", upload);
|
|
|
- ajax.put("fileName", file.getName());
|
|
|
+ String url = serverConfig.getUrl() + upload;
|
|
|
+ ajax.put("url", url);
|
|
|
+ ajax.put("fileName", file.getOriginalFilename());
|
|
|
ajax.put("esId", esId);
|
|
|
- ajax.put("originalFilename", file.getOriginalFilename());
|
|
|
return ajax;
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|