|
|
|
@ -53,6 +53,7 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Object autonomousAuthorization(AutonomousAuthorizationDTO autonomousAuthorization) { |
|
|
|
|
log.info("自主信息授权回调接口,入参:{}",JSONUtil.toJsonStr(autonomousAuthorization)); |
|
|
|
|
// 存流水号
|
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = new InvoiceAllLoginResult(); |
|
|
|
|
BeanUtil.copyProperties(autonomousAuthorization,invoiceAllLoginResult); |
|
|
|
@ -74,9 +75,11 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult qdLogin(InoviceAllQdLoginDTO inoviceAllQdLoginDTO) { |
|
|
|
|
// 全电登录
|
|
|
|
|
log.info("全电登录接口,入参:{}",JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); |
|
|
|
|
ValidateUtils.validate(inoviceAllQdLoginDTO); |
|
|
|
|
Companyservice companyservice = companyserviceMapper.selectCompanyserviceByTaxcode(inoviceAllQdLoginDTO.getNsrsbh()); |
|
|
|
|
if (BeanUtil.isEmpty(inoviceAllQdLoginDTO.getNsrInfo())) { |
|
|
|
|
log.error("全电登录接口,传入报文错误,请检查,纳税人信息为空!"); |
|
|
|
|
return AjaxResult.error("传入报文错误,请检查,纳税人信息为空!"); |
|
|
|
|
} |
|
|
|
|
ValidateUtils.validate(inoviceAllQdLoginDTO.getNsrInfo()); |
|
|
|
@ -85,8 +88,13 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
inoviceAllQdLoginDTO.setTraceno(qqlsh); |
|
|
|
|
try { |
|
|
|
|
// 回调地址
|
|
|
|
|
inoviceAllQdLoginDTO.setLoginType("1"); |
|
|
|
|
inoviceAllQdLoginDTO.setCallback("http://dev.goldentaxcloud.com:8081/api/invoice_all/v1/autonomousAuthorization"); |
|
|
|
|
String result = HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/getLogin2", inoviceAllQdLoginDTO); |
|
|
|
|
log.info("全电登录接口,请求上游,地址:{},参数:{}","http://221.222.184.98:8880/login/getLogin2",JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); |
|
|
|
|
Thread requestThread = new Thread(() -> { |
|
|
|
|
HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/getLogin2", inoviceAllQdLoginDTO); |
|
|
|
|
}); |
|
|
|
|
requestThread.start(); |
|
|
|
|
// 用户信息封装
|
|
|
|
|
InvoiceAllYhdj yhdj = BeanUtil.copyProperties(inoviceAllQdLoginDTO, InvoiceAllYhdj.class); |
|
|
|
|
yhdj.setDlsfmm(inoviceAllQdLoginDTO.getNsrInfo().getGsnsmm()); |
|
|
|
@ -132,19 +140,23 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult submitNote(InvoiceAllSubmitNoteDTO invoiceAllSubmitNoteDTO) { |
|
|
|
|
// 全电登录
|
|
|
|
|
log.info("自主授权短信提交接口,入参:{}",JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
// 短信提交
|
|
|
|
|
ValidateUtils.validate(invoiceAllSubmitNoteDTO); |
|
|
|
|
Companyservice companyservice = companyserviceMapper.selectCompanyserviceByTaxcode(invoiceAllSubmitNoteDTO.getNsrsbh()); |
|
|
|
|
// 根据流水号获取登录结果
|
|
|
|
|
InvoiceAllLoginResult invoiceAllLogin = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLogin == null){ |
|
|
|
|
return AjaxResult.error("未查询到相关信息,请确认后输入"); |
|
|
|
|
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
} |
|
|
|
|
if ("S000".equals(invoiceAllLogin.getCode())){ |
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
try { |
|
|
|
|
// 请求封装
|
|
|
|
|
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}","http://221.222.184.98:8880/login/submitSms",JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
String sendFormPost = HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO); |
|
|
|
|
log.info("自主授权短信提交接口,请求上游返回结果:{}",sendFormPost); |
|
|
|
|
result = JSONUtil.parseObj(sendFormPost); |
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
@ -164,6 +176,7 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
invoiceAllApiLog.setRequestId(tokenId); |
|
|
|
|
allApiLogMapper.insert(invoiceAllApiLog); |
|
|
|
|
} else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}",msg); |
|
|
|
|
return AjaxResult.error(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -172,8 +185,10 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
log.error("【金四服务类】【金财数科】【全电登录】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.INCOME_ERROR); |
|
|
|
|
} |
|
|
|
|
log.error("自主授权短信提交接口,提交短信成功,结果:{}",result); |
|
|
|
|
return AjaxResult.success(result); |
|
|
|
|
}else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}","登录失败,请重新登录"); |
|
|
|
|
return AjaxResult.error("登录失败,请重新登录"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|