@@ -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; | |||
} | |||
@@ -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; | |||
} |
@@ -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; |
@@ -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; | |||
} | |||
} |
@@ -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; | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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 |
@@ -180,5 +180,5 @@ files: | |||
uploadFile: /v1/file/uploadFile | |||
# 下载文件 | |||
downloadFile: /v1/file/downlodFile | |||
fileAccountNum: 测试账号 | |||
secretKey: 测试秘钥 | |||
fileAccountNum: xzxt | |||
secretKey: 15d217c-9c03-12ec-ca76-0242ac110321 |
@@ -1,6 +1,6 @@ | |||
spring: | |||
profiles: | |||
active: prod | |||
active: dev | |||
# Redis数据源 | |||
# redis: | |||
# # Redis数据库索引(默认为0) |