Procházet zdrojové kódy

上传文件配置和优化返回

shuiqilin
zhangxin před 1 rokem
rodič
revize
1699736b6b

+ 4
- 4
src/main/java/com/qtzl/alterSales/manager/handler/AflWechatSingExportHandler.java Zobrazit soubor

@@ -2,7 +2,6 @@ package com.qtzl.alterSales.manager.handler;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import com.qtzl.alterSales.manager.abstracts.AbstractAfterSalesManager;
import com.qtzl.alterSales.manager.model.protocol.NoAttributeResponse;
import com.qtzl.alterSales.manager.model.protocol.UcServiceError;
import com.qtzl.alterSales.manager.model.protocol.sales.AflWechatSignExportRequest;
import com.qtzl.alterSales.manager.service.AflWechatSingService;
@@ -39,12 +38,13 @@ public class AflWechatSingExportHandler extends AbstractAfterSalesManager<AflWec
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse();
// List<AflWechatSing> aflWechatSingList= aflWechatSingService.findBy(request,logger);
String fileUrl =null;
try {
aflWechatSingService.export(request,null, logger);
fileUrl = aflWechatSingService.export(request, null, logger);
} catch (Exception e) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("签约信息导出失败");
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage());
}
return new NoAttributeResponse().toJson();
return fileUrl;
}



+ 1
- 1
src/main/java/com/qtzl/alterSales/manager/service/AflWechatSingService.java Zobrazit soubor

@@ -15,5 +15,5 @@ public interface AflWechatSingService {
AflWechatSing findById(String id);


void export(AflWechatSignExportRequest request, HttpServletResponse response, Logger logger) throws ServiceHandleException;
String export(AflWechatSignExportRequest request, HttpServletResponse response, Logger logger) throws ServiceHandleException;
}

+ 9
- 2
src/main/java/com/qtzl/alterSales/manager/service/AflWechatSingServiceImpl.java Zobrazit soubor

@@ -64,7 +64,7 @@ public class AflWechatSingServiceImpl implements AflWechatSingService{


@Override
public void export(AflWechatSignExportRequest request, HttpServletResponse response, Logger logger) throws ServiceHandleException{
public String export(AflWechatSignExportRequest request, HttpServletResponse response, Logger logger) throws ServiceHandleException{
String pathFile =null;
try {
AflWechatSingRequest aflWechatSingRequest = new AflWechatSingRequest();
@@ -88,12 +88,19 @@ public class AflWechatSingServiceImpl implements AflWechatSingService{
if (StringUtils.isEmpty(pathFile)){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("签约信息导出失败");
}
String s = fmsService.uploadFile(constantConfig.getUploadFile(),pathFile, 90000);
String s = null;
try {
s = fmsService.uploadFile(constantConfig.getUploadFile(),pathFile, 90000);
} catch (ServiceHandleException e) {
logger.error("选装-签约信息查询失败:{}", e.getMessage());
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage());
}

if (StringUtils.isEmpty(s)){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("签约信息导出失败");
}
System.out.println("我来了========="+s);
return s;
} catch (Exception e) {
if (e instanceof ServiceHandleException) {
throw e;

+ 6
- 2
src/main/java/com/qtzl/alterSales/manager/service/third/FmsAbstract.java Zobrazit soubor

@@ -77,16 +77,20 @@ public abstract class FmsAbstract {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("解析文件服务服务返回数据出现异常");
// return ResultBean.createInterFaceExcept("解析文件服务服务返回数据出现异常");
}
if (!fileBeanVo.getSuccess()){
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(fileBeanVo.getRmsg());
}
FilePathBeanVo filePathBeanVo = null;
if (!StringUtils.isEmpty(fileBeanVo.getData())) {
try {
filePathBeanVo = JSON.toJavaObject(JSON.parseObject(fileBeanVo.getData()), FilePathBeanVo.class);
return filePathBeanVo.getFileUrl();
// return filePathBeanVo.getFileUrl();
return resp;
} catch (Exception e) {
e.printStackTrace();
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("解析文件服务服务返回数据出现异常");
}
}
return null;
return resp;
}
}

+ 3
- 1
src/main/java/com/qtzl/alterSales/manager/service/third/FmsService.java Zobrazit soubor

@@ -1,10 +1,12 @@
package com.qtzl.alterSales.manager.service.third;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;

/**
* @Description: 文件服务
*/
public interface FmsService {


String uploadFile(String uploadFile,String filePath, Integer i);
String uploadFile(String uploadFile,String filePath, Integer i) throws ServiceHandleException;
}

+ 4
- 4
src/main/java/com/qtzl/alterSales/manager/service/third/FmsServiceImpl.java Zobrazit soubor

@@ -1,6 +1,7 @@
package com.qtzl.alterSales.manager.service.third;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import com.qtzl.alterSales.manager.model.protocol.UcServiceError;
import org.springframework.stereotype.Service;

@Service
@@ -8,12 +9,11 @@ public class FmsServiceImpl extends FmsAbstract implements FmsService{


@Override
public String uploadFile(String uploadFile,String filePath, Integer timeout) {
public String uploadFile(String uploadFile,String filePath, Integer timeout) throws ServiceHandleException {
try {
return reqCommon(FmsApiEnum.UPLOADFILE.getApi(),filePath,90000);
} catch (ServiceHandleException e) {
e.printStackTrace();
} catch (Exception e) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(e.getMessage());
}
return null;
}
}

+ 4
- 2
src/main/resources/application-dev.yml Zobrazit soubor

@@ -215,5 +215,7 @@ files:
uploadFile: /v1/file/uploadFile
# 下载文件
downloadFile: /v1/file/downlodFile
fileAccountNum: 测试账号
secretKey: 测试秘钥
fileAccountNum: xzxt
secretKey: 15d217c-9c03-12ec-ca76-0242ac110321
# fileAccountNum: qtzl_txls
# secretKey: da381867-8b88-11eb-ad1a-005056978a07

+ 2
- 2
src/main/resources/application-prod.yml Zobrazit soubor

@@ -180,5 +180,5 @@ files:
uploadFile: /v1/file/uploadFile
# 下载文件
downloadFile: /v1/file/downlodFile
fileAccountNum: 测试账号
secretKey: 测试秘钥
fileAccountNum: xzxt
secretKey: 15d217c-9c03-12ec-ca76-0242ac110321

+ 1
- 1
src/main/resources/application.yml Zobrazit soubor

@@ -1,6 +1,6 @@
spring:
profiles:
active: prod
active: dev
# Redis数据源
# redis:
# # Redis数据库索引(默认为0)

Načítá se…
Zrušit
Uložit