Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ce95d607c9
|
|
@ -121,6 +121,7 @@ public class AppBackApplyController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "退料删除", businessType = BusinessType.QUERY)
|
@Log(title = "退料删除", businessType = BusinessType.QUERY)
|
||||||
@PostMapping("del")
|
@PostMapping("del")
|
||||||
|
@RequiresPermissions("return:apply:del")
|
||||||
public AjaxResult del(@RequestBody BackApplyInfo record) {
|
public AjaxResult del(@RequestBody BackApplyInfo record) {
|
||||||
try {
|
try {
|
||||||
int re = backApplyService.del(record);
|
int re = backApplyService.del(record);
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class SysFileController {
|
||||||
return AjaxResult.error("上传文件字数超出限制字数!");
|
return AjaxResult.error("上传文件字数超出限制字数!");
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
if (file != null && file.getId() != 0){
|
if (file != null && file.getId() != 0){
|
||||||
return AjaxResult.success(file);
|
return AjaxResult.success(file);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.system.service.impl;
|
package com.bonus.sgzb.system.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.bonus.sgzb.common.core.constant.HttpStatus;
|
||||||
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
import com.bonus.sgzb.common.core.utils.DateTimeHelper;
|
||||||
import com.bonus.sgzb.common.core.utils.GlobalConstants;
|
import com.bonus.sgzb.common.core.utils.GlobalConstants;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -16,6 +17,7 @@ import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||||
|
|
@ -43,6 +45,9 @@ public class SysFileServiceImpl implements SysFileService {
|
||||||
@Value("${file.path}")
|
@Value("${file.path}")
|
||||||
private String localFilePath;
|
private String localFilePath;
|
||||||
|
|
||||||
|
// 允许的文件格式
|
||||||
|
private static final List<String> ALLOWED_EXTENSIONS = Arrays.asList("jpg", "jpeg", "txt", "png", "pdf", "docx", "doc", "xlsx", "xls");
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FileClient fileClient;
|
private FileClient fileClient;
|
||||||
|
|
||||||
|
|
@ -62,6 +67,11 @@ public class SysFileServiceImpl implements SysFileService {
|
||||||
HashMap<String, Object> map = getFile(req);
|
HashMap<String, Object> map = getFile(req);
|
||||||
List<MultipartFile> items = (List<MultipartFile>) map.get("filePath");
|
List<MultipartFile> items = (List<MultipartFile>) map.get("filePath");
|
||||||
MultipartFile item = items.get(0);
|
MultipartFile item = items.get(0);
|
||||||
|
// 获取文件后缀名
|
||||||
|
String fileExtension = item.getOriginalFilename().substring(item.getOriginalFilename().lastIndexOf(".") + 1);
|
||||||
|
if (!ALLOWED_EXTENSIONS.contains(fileExtension.toLowerCase())) {
|
||||||
|
throw new Exception("不支持该文件格式");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String url = saveFile(request, item, photoType);
|
String url = saveFile(request, item, photoType);
|
||||||
//AjaxResult res = fileClient.uploadFile(item);
|
//AjaxResult res = fileClient.uploadFile(item);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue