Browse Source

文件上传,推送验证

develop
wangsixiang 5 months ago
parent
commit
c7181cd5ec
  1. 4
      zc-business/pom.xml
  2. 33
      zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java
  3. 5
      zc-business/src/main/java/com/zc/business/controller/MsmController.java

4
zc-business/pom.xml

@ -94,6 +94,10 @@
<artifactId>jsoup</artifactId>
<version>1.15.3</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
</dependencies>
<groupId>com.zc</groupId>

33
zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java

@ -3,6 +3,9 @@ package com.zc.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -21,6 +24,8 @@ import com.zc.business.domain.DcFileDownload;
import com.zc.business.service.IDcFileDownloadService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.framework.config.ServerConfig;
import org.springframework.web.multipart.MultipartFile;
/**
* 文件管理Controller
@ -33,7 +38,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class DcFileDownloadController extends BaseController {
@Autowired
private IDcFileDownloadService dcFileDownloadService;
@Autowired
private ServerConfig serverConfig;
/**
* 查询文件管理列表
*/
@ -95,4 +101,29 @@ public class DcFileDownloadController extends BaseController {
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(dcFileDownloadService.deleteDcFileDownloadByIds(ids));
}
/**
* 文件管理-文件上传请求
*/
@PostMapping("/uploadFileManagement")
public AjaxResult uploadFileManagement(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getFileManagementPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
}

5
zc-business/src/main/java/com/zc/business/controller/MsmController.java

@ -59,6 +59,9 @@ public class MsmController extends BaseController {
if (!map.containsKey("eventId")|| StringUtils.isBlank(map.get("eventId").toString())) {
return AjaxResult.error("事件id为空");
}
if (map.get("content").toString().length()>=200){
return AjaxResult.error("内容长度超长");
}
return msmService.putAll(map);
}
//整合推送(弃用)
@ -116,4 +119,4 @@ public class MsmController extends BaseController {
}
}
}
}

Loading…
Cancel
Save