|
|
|
@ -53,15 +53,16 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Object autonomousAuthorization(AutonomousAuthorizationDTO autonomousAuthorization) { |
|
|
|
|
log.info("自主信息授权回调接口,入参:{}",JSONUtil.toJsonStr(autonomousAuthorization)); |
|
|
|
|
log.info("自主信息授权回调接口,入参:{}", JSONUtil.toJsonStr(autonomousAuthorization)); |
|
|
|
|
// 存流水号
|
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = new InvoiceAllLoginResult(); |
|
|
|
|
BeanUtil.copyProperties(autonomousAuthorization,invoiceAllLoginResult); |
|
|
|
|
BeanUtil.copyProperties(autonomousAuthorization, invoiceAllLoginResult); |
|
|
|
|
invoiceAllLoginResult.setCreateTime(new Date()); |
|
|
|
|
int count = invoiceAllLoginResultMapper.insertInvoiceAllLoginResult(invoiceAllLoginResult); |
|
|
|
|
if (count > 0){ |
|
|
|
|
log.info("全电登录接口,登录返回信息保存成功,信息为:{}",JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
}else { |
|
|
|
|
log.error("全电登录接口,登录返回信息失败,信息为:{}",JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
if (count > 0) { |
|
|
|
|
log.info("全电登录接口,登录返回信息保存成功,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
} else { |
|
|
|
|
log.error("全电登录接口,登录返回信息失败,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
} |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
@ -75,7 +76,7 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult qdLogin(InoviceAllQdLoginDTO inoviceAllQdLoginDTO) { |
|
|
|
|
// 全电登录
|
|
|
|
|
log.info("全电登录接口,入参:{}",JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); |
|
|
|
|
log.info("全电登录接口,入参:{}", JSONUtil.toJsonStr(inoviceAllQdLoginDTO)); |
|
|
|
|
ValidateUtils.validate(inoviceAllQdLoginDTO); |
|
|
|
|
Companyservice companyservice = companyserviceMapper.selectCompanyserviceByTaxcode(inoviceAllQdLoginDTO.getNsrsbh()); |
|
|
|
|
if (BeanUtil.isEmpty(inoviceAllQdLoginDTO.getNsrInfo())) { |
|
|
|
@ -90,7 +91,7 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
// 回调地址
|
|
|
|
|
inoviceAllQdLoginDTO.setLoginType("1"); |
|
|
|
|
inoviceAllQdLoginDTO.setCallback("http://dev.goldentaxcloud.com:8081/api/invoice_all/v1/autonomousAuthorization"); |
|
|
|
|
log.info("全电登录接口,请求上游,地址:{},参数:{}","http://221.222.184.98:8880/login/getLogin2",JSONUtil.toJsonStr(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); |
|
|
|
|
}); |
|
|
|
@ -140,55 +141,31 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult submitNote(InvoiceAllSubmitNoteDTO invoiceAllSubmitNoteDTO) { |
|
|
|
|
log.info("自主授权短信提交接口,入参:{}",JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
log.info("自主授权短信提交接口,入参:{}", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
// 短信提交
|
|
|
|
|
ValidateUtils.validate(invoiceAllSubmitNoteDTO); |
|
|
|
|
Companyservice companyservice = companyserviceMapper.selectCompanyserviceByTaxcode(invoiceAllSubmitNoteDTO.getNsrsbh()); |
|
|
|
|
// 根据流水号获取登录结果
|
|
|
|
|
InvoiceAllLoginResult invoiceAllLogin = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLogin == null){ |
|
|
|
|
if (invoiceAllLogin == null) { |
|
|
|
|
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
} |
|
|
|
|
if ("S000".equals(invoiceAllLogin.getCode())){ |
|
|
|
|
if ("SMS".equals(invoiceAllLogin.getCode())) { |
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
|
|
try { |
|
|
|
|
// 请求封装
|
|
|
|
|
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}","http://221.222.184.98:8880/login/submitSms",JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
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() : ""; |
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
if ("S000".equals(code)) { |
|
|
|
|
// 调用日志封装
|
|
|
|
|
InvoiceAllApiLog invoiceAllApiLog = new InvoiceAllApiLog(); |
|
|
|
|
invoiceAllApiLog.setCreateTime(new Date()); |
|
|
|
|
invoiceAllApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
invoiceAllApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
invoiceAllApiLog.setUrl("http://221.222.184.98:8880/login/submitSms"); |
|
|
|
|
invoiceAllApiLog.setSendMsg(JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
invoiceAllApiLog.setResultMsg(data); |
|
|
|
|
JSONObject dataObject = JSONUtil.parseObj(data); |
|
|
|
|
String tokenId = dataObject.get("dzfp-ssotoken") != null ? dataObject.get("dzfp-ssotoken").toString() : ""; |
|
|
|
|
invoiceAllApiLog.setRequestId(tokenId); |
|
|
|
|
allApiLogMapper.insert(invoiceAllApiLog); |
|
|
|
|
} else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}",msg); |
|
|
|
|
return AjaxResult.error(msg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
log.info("自主授权短信提交接口,请求上游返回结果:{}", sendFormPost); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【全电登录】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); |
|
|
|
|
log.error("【金四服务类】【金财数科】【自主授权提交短信验证码】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.INCOME_ERROR); |
|
|
|
|
} |
|
|
|
|
log.error("自主授权短信提交接口,提交短信成功,结果:{}",result); |
|
|
|
|
log.error("自主授权短信提交接口,提交短信成功,结果:{}", result); |
|
|
|
|
return AjaxResult.success(result); |
|
|
|
|
}else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}","登录失败,请重新登录"); |
|
|
|
|
} else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}", "登录失败,请重新登录"); |
|
|
|
|
return AjaxResult.error("登录失败,请重新登录"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|