2024年5月28日 修复问题,修改biz地址
This commit is contained in:
parent
d1a49ac81f
commit
80611abcc8
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.kc.ktgl.controller;
|
package org.jeecg.modules.kc.ktgl.controller;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -22,6 +23,8 @@ import org.jeecg.common.api.CommonAPI;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
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.common.util.oConvertUtils;
|
||||||
import org.jeecg.modules.kc.detection.entity.KcDetectionMain;
|
import org.jeecg.modules.kc.detection.entity.KcDetectionMain;
|
||||||
import org.jeecg.modules.kc.detection.service.IKcDetectionMainService;
|
import org.jeecg.modules.kc.detection.service.IKcDetectionMainService;
|
||||||
|
@ -92,9 +95,14 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
|
||||||
@Autowired
|
@Autowired
|
||||||
private IZyJxdgService zyJxdgService;
|
private IZyJxdgService zyJxdgService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SftpConfig sftpConfig;
|
||||||
|
|
||||||
@Value("${jeecg.path.upload}")
|
@Value("${jeecg.path.upload}")
|
||||||
private String upLoadPath;
|
private String upLoadPath;
|
||||||
|
|
||||||
|
public static String separator = "/";
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonAPI commonApi;
|
private CommonAPI commonApi;
|
||||||
|
@ -244,23 +252,31 @@ public class KcKetangbiaoController extends JeecgController<KcKetangbiao, IKcKet
|
||||||
@GetMapping(value = "/getBizPath")
|
@GetMapping(value = "/getBizPath")
|
||||||
public Result<?> getBizPath(String rwbh, String xqxn, String wjlx, String kkdw, String kcmc, String skjs) {
|
public Result<?> getBizPath(String rwbh, String xqxn, String wjlx, String kkdw, String kcmc, String skjs) {
|
||||||
Result<String> r = new Result<>();
|
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)) {
|
if(StringUtils.isNotBlank(rwbh) && StringUtils.isNotBlank(xqxn) && StringUtils.isNotBlank(wjlx)) {
|
||||||
//根据任务编号查询80%数据
|
//根据任务编号查询80%数据
|
||||||
QueryWrapper<KcKetangbiao> qw = new QueryWrapper<>();
|
QueryWrapper<KcKetangbiao> qw = new QueryWrapper<>();
|
||||||
qw.last("limit 1");
|
qw.last("limit 1");
|
||||||
KcKetangbiao ketangbiao = kcKetangbiaoService.getOne(qw);
|
KcKetangbiao ketangbiao = kcKetangbiaoService.getOne(qw);
|
||||||
String sb = xqxn + "/" +
|
String sb = uploadpath + xqxn + separator +
|
||||||
ketangbiao.getKkdw() + "/" +
|
ketangbiao.getKkdw() + separator +
|
||||||
ketangbiao.getKcmc() + "/" +
|
ketangbiao.getKcmc() + separator +
|
||||||
ketangbiao.getSkjs() + "/" +
|
ketangbiao.getSkjs() + separator +
|
||||||
wjlx;
|
wjlx;
|
||||||
r.setResult(sb);
|
r.setResult(sb);
|
||||||
}else{
|
}else{
|
||||||
if(StringUtils.isNotBlank(xqxn) && StringUtils.isNotBlank(wjlx) && StringUtils.isNotBlank(kkdw) && StringUtils.isNotBlank(kcmc) && StringUtils.isNotBlank(skjs)){
|
if(StringUtils.isNotBlank(xqxn) && StringUtils.isNotBlank(wjlx) && StringUtils.isNotBlank(kkdw) && StringUtils.isNotBlank(kcmc) && StringUtils.isNotBlank(skjs)){
|
||||||
String sb = xqxn + "/" +
|
String sb = uploadpath + xqxn + separator +
|
||||||
kkdw + "/" +
|
kkdw + separator +
|
||||||
kcmc + "/" +
|
kcmc + separator +
|
||||||
skjs + "/" +
|
skjs + separator +
|
||||||
wjlx;
|
wjlx;
|
||||||
r.setResult(sb);
|
r.setResult(sb);
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -25,6 +25,12 @@ public class Global {
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setEnvironment(Environment environment){this.environment = environment;}
|
public void setEnvironment(Environment environment){this.environment = environment;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地:local minio:minio 阿里:alioss
|
||||||
|
*/
|
||||||
|
@Value(value="${jeecg.uploadType}")
|
||||||
|
public String uploadType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件地址
|
* 上传文件地址
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -377,13 +377,9 @@ public class CommonController {
|
||||||
InputStream is = FileUtil.getInputStream(folderPath + File.separator + sectionFileName);
|
InputStream is = FileUtil.getInputStream(folderPath + File.separator + sectionFileName);
|
||||||
streams.add(is);
|
streams.add(is);
|
||||||
});
|
});
|
||||||
|
|
||||||
Enumeration<InputStream> enumerations = streams.elements();
|
Enumeration<InputStream> enumerations = streams.elements();
|
||||||
|
|
||||||
SequenceInputStream sis = new SequenceInputStream(enumerations);
|
SequenceInputStream sis = new SequenceInputStream(enumerations);
|
||||||
|
|
||||||
BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(outFile.toPath()));
|
BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(outFile.toPath()));
|
||||||
|
|
||||||
byte[] bys = new byte[1024];
|
byte[] bys = new byte[1024];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
while((len = sis.read(bys)) != -1){
|
while((len = sis.read(bys)) != -1){
|
||||||
|
@ -400,6 +396,11 @@ public class CommonController {
|
||||||
if(!CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
|
if(!CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){
|
||||||
String savePath = upload(bizPath, getMultipartFile(outFile));
|
String savePath = upload(bizPath, getMultipartFile(outFile));
|
||||||
if(oConvertUtils.isNotEmpty(savePath)){
|
if(oConvertUtils.isNotEmpty(savePath)){
|
||||||
|
//删除本地文件
|
||||||
|
if(!StringUtils.equals(bizPath, "temp")){
|
||||||
|
//不等于这个的删除
|
||||||
|
FileUtil.del(outFile);
|
||||||
|
}
|
||||||
result.setMessage(savePath);
|
result.setMessage(savePath);
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
}else {
|
}else {
|
||||||
|
|
Loading…
Reference in New Issue