修改文件统一路径

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

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

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

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

Loading…
Cancel
Save