修改文件统一路径

pro
anthonywj 2 years ago
parent 59a0078a84
commit 38f2e7b1a6

@ -0,0 +1,13 @@
package com.glxp.api.constant;
public class FileConstant {
public static String CERT_FILE_PATH = "";
public static String INVOICE_FILE_PATH = "";
public static String PDF_FILE_PATH = "";
public static String COMMON_FILE_PATH = "register/image2/";
}

@ -12,6 +12,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.constant.ConstantStatus;
import com.glxp.api.constant.FileConstant;
import com.glxp.api.entity.auth.AuthAdmin;
import com.glxp.api.entity.purchase.*;
import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity;
@ -306,7 +307,7 @@ public class SupCertController {
@PostMapping("/sup/info/deleteCompanyCert")
public BaseResponse deleteCompanyCert(@RequestBody DeleteCompanyFileRequest deleteCompanyFileRequest, BindingResult bindingResult) {
boolean b = supCertService.deleteById(deleteCompanyFileRequest.getId());
String URL = filePath + "/register/file/image2/" + deleteCompanyFileRequest.getFilePath();
String URL = filePath + FileConstant.COMMON_FILE_PATH + deleteCompanyFileRequest.getFilePath();
File file = new File(URL);
if (file.exists() && file.isFile()) {
file.delete();
@ -396,7 +397,7 @@ public class SupCertController {
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
supData.put("filePath", filePath + FileConstant.COMMON_FILE_PATH + url);
list.add(supData);
i++;
}
@ -512,7 +513,7 @@ public class SupCertController {
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark2", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
supData.put("filePath", filePath + FileConstant.COMMON_FILE_PATH + url);
list.add(supData);
i++;
}
@ -578,7 +579,7 @@ public class SupCertController {
supData.put("status", obj.getStatus() == 0 ? "有效" : "失效");
supData.put("auditStatus", getAuditStatus(obj.getAuditStatus()));
supData.put("remark2", obj.getRemark() == null ? ' ' : obj.getRemark());
supData.put("filePath", filePath + "register/image2/" + url);
supData.put("filePath", filePath + FileConstant.COMMON_FILE_PATH + url);
list.add(supData);
i++;
}

@ -12,6 +12,7 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.glxp.api.constant.FileConstant;
import org.apache.commons.lang3.StringUtils;
import org.apache.tools.ant.util.DateUtils;
import org.slf4j.Logger;
@ -53,7 +54,7 @@ public class FileServiceImpl implements FileService {
private DbDao dbDao;
@Resource
private IdcService idcService;
private String imagePath = "register/image2/";
private String imagePath = FileConstant.COMMON_FILE_PATH;
String pdfPath = "pdf/template/";
@Override

@ -17,6 +17,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.glxp.api.constant.FileConstant;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.WordUtils;
import org.apache.tools.ant.util.DateUtils;
@ -85,7 +86,7 @@ public class IdcServiceImpl implements IdcService {
@Resource
private ScheduledDao scheduledDao;
private String imagePath = "register/image2/";
private String imagePath = FileConstant.COMMON_FILE_PATH;
/*获取拉取任务列表*/
@Override
public BaseResponse taskList(HttpServletRequest request, Map<String, Object> params) {

@ -1,5 +1,6 @@
package com.glxp.api.upload;
import com.glxp.api.constant.FileConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -27,7 +28,7 @@ public class DownloadController {
if (name.endsWith("pdf") || name.endsWith("doc")) {
OutputStream os = null;
try {
FileInputStream input = new FileInputStream(new File(filePath + "/register/file/" + type + "/" + name));
FileInputStream input = new FileInputStream(new File(filePath + FileConstant.COMMON_FILE_PATH + name));
OutputStream out = response.getOutputStream();
byte[] b = new byte[2048];
int len;

Loading…
Cancel
Save