2024年5月28日 修复问题,修改biz地址

This commit is contained in:
bai 2024-05-28 17:03:20 +08:00
parent d1a49ac81f
commit 80611abcc8
3 changed files with 35 additions and 12 deletions

View File

@ -1,5 +1,6 @@
package org.jeecg.modules.kc.ktgl.controller;
import java.io.File;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
@ -22,6 +23,8 @@ import org.jeecg.common.api.CommonAPI;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.SftpConfig;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.detection.entity.KcDetectionMain;
import org.jeecg.modules.kc.detection.service.IKcDetectionMainService;
@ -92,9 +95,14 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
@Autowired
private IZyJxdgService zyJxdgService;
@Autowired
private SftpConfig sftpConfig;
@Value("${jeecg.path.upload}")
private String upLoadPath;
public static String separator = "/";
@Lazy
@Autowired
private CommonAPI commonApi;
@ -244,23 +252,31 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
@GetMapping(value = "/getBizPath")
public Result<?> getBizPath(String rwbh, String xqxn, String wjlx, String kkdw, String kcmc, String skjs) {
Result<String> r = new Result<>();
String uploadpath = sftpConfig.getUploadpath();
if(uploadpath.indexOf(separator) == 0){
uploadpath = uploadpath.substring(1);
if(uploadpath.lastIndexOf(separator) != uploadpath.length()-1){
uploadpath = uploadpath + separator;
}
}
if(StringUtils.isNotBlank(rwbh) && StringUtils.isNotBlank(xqxn) && StringUtils.isNotBlank(wjlx)) {
//根据任务编号查询80%数据
QueryWrapper<KcKetangbiao> qw = new QueryWrapper<>();
qw.last("limit 1");
KcKetangbiao ketangbiao = kcKetangbiaoService.getOne(qw);
String sb = xqxn + "/" +
ketangbiao.getKkdw() + "/" +
ketangbiao.getKcmc() + "/" +
ketangbiao.getSkjs() + "/" +
String sb = uploadpath + xqxn + separator +
ketangbiao.getKkdw() + separator +
ketangbiao.getKcmc() + separator +
ketangbiao.getSkjs() + separator +
wjlx;
r.setResult(sb);
}else{
if(StringUtils.isNotBlank(xqxn) && StringUtils.isNotBlank(wjlx) && StringUtils.isNotBlank(kkdw) && StringUtils.isNotBlank(kcmc) && StringUtils.isNotBlank(skjs)){
String sb = xqxn + "/" +
kkdw + "/" +
kcmc + "/" +
skjs + "/" +
String sb = uploadpath + xqxn + separator +
kkdw + separator +
kcmc + separator +
skjs + separator +
wjlx;
r.setResult(sb);
}else{

View File

@ -25,6 +25,12 @@ public class Global {
@Autowired
public void setEnvironment(Environment environment){this.environment = environment;}
/**
* 本地local miniominio 阿里alioss
*/
@Value(value="${jeecg.uploadType}")
public String uploadType;
/**
* 上传文件地址
*/

View File

@ -377,13 +377,9 @@ public class CommonController {
InputStream is = FileUtil.getInputStream(folderPath + File.separator + sectionFileName);
streams.add(is);
});
Enumeration<InputStream> enumerations = streams.elements();
SequenceInputStream sis = new SequenceInputStream(enumerations);
BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(outFile.toPath()));
byte[] bys = new byte[1024];
int len = 0;
while((len = sis.read(bys)) != -1){
@ -400,6 +396,11 @@ public class CommonController {
if(!CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
String savePath = upload(bizPath, getMultipartFile(outFile));
if(oConvertUtils.isNotEmpty(savePath)){
//删除本地文件
if(!StringUtils.equals(bizPath, "temp")){
//不等于这个的删除
FileUtil.del(outFile);
}
result.setMessage(savePath);
result.setSuccess(true);
}else {