@@ -1,21 +1,22 @@ | |||
package cn.com.taiji.ats.manager.anXin; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.model.comm.protocol.ats.anXin.*; | |||
public interface AnXinBusinessManager { | |||
AnXinSignPersonalAccountResponse personalAccount(AnXinSignPersonalAccountRequest request,String txCode) throws Exception; | |||
AnXinSignPersonalAccountResponse personalAccount(AnXinSignPersonalAccountRequest request,String txCode) throws ServiceHandleException;; | |||
AnXinSignEnterpriseAccountResponse companyAccount(AnXinSignEnterpriseAccountRequest request,String txCode) throws Exception; | |||
AnXinSignEnterpriseAccountResponse companyAccount(AnXinSignEnterpriseAccountRequest request,String txCode) throws ServiceHandleException;; | |||
AnXinSignCreateContractResponse createContract(AnXinSignCreateContractRequest request,String txCode) throws Exception; | |||
AnXinSignCreateContractResponse createContract(AnXinSignCreateContractRequest request,String txCode) throws ServiceHandleException;; | |||
AnXinSignSendShortResponse sendShortUrl(AnXinSignSendShortRequest request,String txCode) throws Exception; | |||
AnXinSignSendShortResponse sendShortUrl(AnXinSignSendShortRequest request,String txCode) throws ServiceHandleException; | |||
AnXinSignContractQueryResponse contractQuery(AnXinSignContractQueryRequest request,String txCode) throws Exception; | |||
AnXinSignContractQueryResponse contractQuery(AnXinSignContractQueryRequest request,String txCode) throws ServiceHandleException; | |||
AnXinSignMobileQueryResponse mobileQuery(AnXinSignMobileQueryRequest request,String txCode) throws Exception; | |||
AnXinSignMobileQueryResponse mobileQuery(AnXinSignMobileQueryRequest request,String txCode) throws ServiceHandleException;; | |||
AnXinSignMobileEditResponse mobileEdit(AnXinSignMobileEditRequest request,String txCode) throws Exception; | |||
AnXinSignMobileEditResponse mobileEdit(AnXinSignMobileEditRequest request,String txCode) throws ServiceHandleException; | |||
AnXinSignContractDownloadResponse downloadContract(AnXinSignContractDownloadRequest request) throws Exception; | |||
AnXinSignContractDownloadResponse downloadContract(AnXinSignContractDownloadRequest request); | |||
} |
@@ -3,6 +3,7 @@ package cn.com.taiji.ats.manager.anXin; | |||
import cn.com.taiji.ats.model.anXin.InterfaceRequest; | |||
import cn.com.taiji.ats.model.anXin.InterfaceResponse; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.pub.json.JsonTools; | |||
import cn.com.taiji.core.model.comm.protocol.ats.AbstractAtsRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ats.AbstractAtsResponse; | |||
@@ -24,42 +25,42 @@ public class AnXinBusinessManagerImpl extends AbstractManager implements AnXinBu | |||
@Autowired | |||
private AnXinService anXinService; | |||
@Override | |||
public AnXinSignPersonalAccountResponse personalAccount(AnXinSignPersonalAccountRequest request, String txCode) throws Exception { | |||
public AnXinSignPersonalAccountResponse personalAccount(AnXinSignPersonalAccountRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignPersonalAccountResponse.class); | |||
} | |||
@Override | |||
public AnXinSignEnterpriseAccountResponse companyAccount(AnXinSignEnterpriseAccountRequest request, String txCode) throws Exception { | |||
public AnXinSignEnterpriseAccountResponse companyAccount(AnXinSignEnterpriseAccountRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignEnterpriseAccountResponse.class); | |||
} | |||
@Override | |||
public AnXinSignCreateContractResponse createContract(AnXinSignCreateContractRequest request, String txCode) throws Exception { | |||
public AnXinSignCreateContractResponse createContract(AnXinSignCreateContractRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignCreateContractResponse.class); | |||
} | |||
@Override | |||
public AnXinSignSendShortResponse sendShortUrl(AnXinSignSendShortRequest request, String txCode) throws Exception { | |||
public AnXinSignSendShortResponse sendShortUrl(AnXinSignSendShortRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignSendShortResponse.class); | |||
} | |||
@Override | |||
public AnXinSignContractQueryResponse contractQuery(AnXinSignContractQueryRequest request, String txCode) throws Exception { | |||
public AnXinSignContractQueryResponse contractQuery(AnXinSignContractQueryRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignContractQueryResponse.class); | |||
} | |||
@Override | |||
public AnXinSignMobileQueryResponse mobileQuery(AnXinSignMobileQueryRequest request, String txCode) throws Exception { | |||
public AnXinSignMobileQueryResponse mobileQuery(AnXinSignMobileQueryRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignMobileQueryResponse.class); | |||
} | |||
@Override | |||
public AnXinSignMobileEditResponse mobileEdit(AnXinSignMobileEditRequest request, String txCode) throws Exception { | |||
public AnXinSignMobileEditResponse mobileEdit(AnXinSignMobileEditRequest request, String txCode) throws ServiceHandleException { | |||
return processAnXinRequest(request, txCode, AnXinSignMobileEditResponse.class); | |||
} | |||
@Override | |||
public AnXinSignContractDownloadResponse downloadContract(AnXinSignContractDownloadRequest request) throws Exception { | |||
public AnXinSignContractDownloadResponse downloadContract(AnXinSignContractDownloadRequest request) { | |||
InterfaceResponse response = anXinService.downloadContract(request.getContractNo()); | |||
AnXinSignContractDownloadResponse res = new AnXinSignContractDownloadResponse(); | |||
res.setBizContent(response.getBizContent()); | |||
@@ -69,7 +70,7 @@ public class AnXinBusinessManagerImpl extends AbstractManager implements AnXinBu | |||
/** 统一处理请求*/ | |||
private <T extends AbstractAtsRequest<?>, R extends AbstractAtsResponse> R processAnXinRequest( | |||
T request, String method, Class<R> responseClass) throws Exception { | |||
T request, String method, Class<R> responseClass) throws ServiceHandleException { | |||
logger.info("请求安心签开始,请求参数: {}", request); | |||
@@ -2,9 +2,10 @@ package cn.com.taiji.ats.manager.anXin; | |||
import cn.com.taiji.ats.model.anXin.InterfaceRequest; | |||
import cn.com.taiji.ats.model.anXin.InterfaceResponse; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
public interface AnXinService { | |||
InterfaceResponse post(InterfaceRequest interfaceRequest) throws Exception; | |||
InterfaceResponse post(InterfaceRequest interfaceRequest) throws ServiceHandleException; | |||
InterfaceResponse downloadContract(String request) throws Exception; | |||
InterfaceResponse downloadContract(String request); | |||
} |
@@ -10,7 +10,9 @@ import cn.com.taiji.ats.tools.SecurityUtil; | |||
import cn.com.taiji.ats.tools.TimeUtil; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.pub.StringTools; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
import com.alibaba.fastjson2.JSON; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import org.springframework.stereotype.Service; | |||
@@ -26,7 +28,7 @@ import java.util.Base64; | |||
public class AnXinServiceImpl extends AbstractManager implements AnXinService{ | |||
@Override | |||
public InterfaceResponse post(InterfaceRequest request) throws Exception { | |||
public InterfaceResponse post(InterfaceRequest request) throws ServiceHandleException { | |||
try { | |||
HttpConnector httpConnector = new HttpConnector(); | |||
httpConnector.init(); | |||
@@ -78,13 +80,13 @@ public class AnXinServiceImpl extends AbstractManager implements AnXinService{ | |||
} catch (Exception e) { | |||
logger.error("处理请求失败", e); | |||
throw new ManagerException("处理请求失败", e); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("处理请求失败"+ e); | |||
} | |||
} | |||
// 下载合同文件 | |||
@Override | |||
public InterfaceResponse downloadContract(String contractNo) throws Exception { | |||
public InterfaceResponse downloadContract(String contractNo) { | |||
HttpConnector httpConnector = new HttpConnector(); | |||
httpConnector.init(); | |||
String uri = "platId/" + Request.PLAT_ID + "/contractNo/" + contractNo + "/downloading"; |
@@ -22,7 +22,6 @@ public class AnXinServiceHandler extends AbstractAtsServiceHandler<AnXinServiceC | |||
@Autowired | |||
private AnXinBusinessManager anXinBusinessManager; | |||
@SneakyThrows | |||
@Override | |||
protected <T extends AbstractSignTypeRequest<?>> AbstractSignTypeResponse handleInternal(T request, SignJsonRequest commReq, AbstractHttpRequestInfo reqInfo) throws ServiceHandleException { | |||
AnXinServiceCmd cmd = AnXinServiceCmd.fromIfCode(commReq.getIfCode()); |
@@ -1,20 +1,21 @@ | |||
package cn.com.taiji.ias.manager.bill; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.model.comm.protocol.ias.bill.*; | |||
public interface BillBusinessManager { | |||
BillRaiseInsertResponse billRaiseInsert(BillRaiseInsertRequest req, String txCode) throws Exception; | |||
BillRaiseInsertResponse billRaiseInsert(BillRaiseInsertRequest req, String txCode) throws ServiceHandleException; | |||
BillRaiseDeleteResponse billRaiseDelete(BillRaiseDeleteRequest req, String txCode) throws Exception; | |||
BillRaiseDeleteResponse billRaiseDelete(BillRaiseDeleteRequest req, String txCode) throws ServiceHandleException; | |||
BillRaiseUpdateResponse billRaiseUpdate(BillRaiseUpdateRequest req, String txCode) throws Exception; | |||
BillRaiseUpdateResponse billRaiseUpdate(BillRaiseUpdateRequest req, String txCode) throws ServiceHandleException; | |||
BillRecordResponse billRecord(BillRecordRequest req, String txCode) throws Exception; | |||
BillRecordResponse billRecord(BillRecordRequest req, String txCode) throws ServiceHandleException; | |||
BillReversalResponse billReversal(BillReversalRequest req, String txCode) throws Exception; | |||
BillReversalResponse billReversal(BillReversalRequest req, String txCode) throws ServiceHandleException; | |||
BillMergeInvoicingResponse billMergeInvoicing(BillMergeInvoicingRequest req, String txCode) throws Exception; | |||
BillMergeInvoicingResponse billMergeInvoicing(BillMergeInvoicingRequest req, String txCode) throws ServiceHandleException; | |||
BillOrderPushLogResponse billOrderPush(BillOrderPushLogRequest req) throws Exception; | |||
BillOrderPushLogResponse billOrderPush(BillOrderPushLogRequest req) throws ServiceHandleException; | |||
} |
@@ -1,6 +1,7 @@ | |||
package cn.com.taiji.ias.manager.bill; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.pub.json.JsonTools; | |||
import cn.com.taiji.core.model.comm.protocol.ias.AbstractIasRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.AbstractIasResponse; | |||
@@ -32,45 +33,51 @@ public class BillBusinessManagerImpl extends AbstractManager implements BillBusi | |||
/** 发票抬头添加*/ | |||
@Override | |||
public BillRaiseInsertResponse billRaiseInsert(BillRaiseInsertRequest request, String txCode) throws Exception { | |||
public BillRaiseInsertResponse billRaiseInsert(BillRaiseInsertRequest request, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, request, BillRaiseInsertResponse.class); | |||
} | |||
/** 发票抬头删除*/ | |||
@Override | |||
public BillRaiseDeleteResponse billRaiseDelete(BillRaiseDeleteRequest request, String txCode) throws Exception { | |||
public BillRaiseDeleteResponse billRaiseDelete(BillRaiseDeleteRequest request, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, request, BillRaiseDeleteResponse.class); | |||
} | |||
/** 发票抬头修改*/ | |||
@Override | |||
public BillRaiseUpdateResponse billRaiseUpdate(BillRaiseUpdateRequest req, String txCode) throws Exception { | |||
public BillRaiseUpdateResponse billRaiseUpdate(BillRaiseUpdateRequest req, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, req, BillRaiseUpdateResponse.class); | |||
} | |||
/** 发票开票记录*/ | |||
@Override | |||
public BillRecordResponse billRecord(BillRecordRequest req, String txCode) throws Exception { | |||
public BillRecordResponse billRecord(BillRecordRequest req, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, req, BillRecordResponse.class); | |||
} | |||
/** 发票红冲*/ | |||
@Override | |||
public BillReversalResponse billReversal(BillReversalRequest req, String txCode) throws Exception { | |||
public BillReversalResponse billReversal(BillReversalRequest req, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, req, BillReversalResponse.class); | |||
} | |||
/** ETC产品合并开票*/ | |||
@Override | |||
public BillMergeInvoicingResponse billMergeInvoicing(BillMergeInvoicingRequest req, String txCode) throws Exception { | |||
public BillMergeInvoicingResponse billMergeInvoicing(BillMergeInvoicingRequest req, String txCode) throws ServiceHandleException{ | |||
return processBillRequest(txCode, req, BillMergeInvoicingResponse.class); | |||
} | |||
/** 发票订单补推*/ | |||
@Override | |||
public BillOrderPushLogResponse billOrderPush(BillOrderPushLogRequest req) throws Exception { | |||
public BillOrderPushLogResponse billOrderPush(BillOrderPushLogRequest req) throws ServiceHandleException { | |||
logger.info("请求发票订单请求参数:{}", req); | |||
String response = HttpClientUtil.sendPost(orderNoticeUrl, req.toJson(), null); | |||
String response = null; | |||
try { | |||
response = HttpClientUtil.sendPost(orderNoticeUrl, req.toJson(), null); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("接口错误:发票订单补推响应异常!"); | |||
} | |||
logger.info("请求发票订单响应参数:{}", response); | |||
if (StringUtils.hasText(response)) { | |||
try { | |||
@@ -88,7 +95,7 @@ public class BillBusinessManagerImpl extends AbstractManager implements BillBusi | |||
/** 统一处理请求*/ | |||
private <T extends AbstractIasRequest<?>, R extends AbstractIasResponse> R processBillRequest( | |||
String requestUri, T request, Class<R> responseClass) throws Exception { | |||
String requestUri, T request, Class<R> responseClass) throws ServiceHandleException{ | |||
logger.info("请求汇联通开始,请求参数: {}", request); | |||
@@ -23,7 +23,6 @@ public class BillServiceHandler extends AbstractIasServiceHandler<BillServiceCmd | |||
@Autowired | |||
private BillBusinessManager billBusinessManager; | |||
@SneakyThrows | |||
@Override | |||
protected <T extends AbstractSignTypeRequest<?>> AbstractSignTypeResponse handleInternal(T request, SignJsonRequest jsonReq, AbstractHttpRequestInfo reqInfo) throws ServiceHandleException { | |||
BillServiceCmd cmd = BillServiceCmd.fromIfCode(jsonReq.getIfCode()); |