|
|
|
@ -25,7 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author xingze |
|
|
|
@ -55,20 +54,34 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
public Object autonomousAuthorization(AutonomousAuthorizationDTO autonomousAuthorization) { |
|
|
|
|
log.info("自主信息授权回调接口,入参:{}", JSONUtil.toJsonStr(autonomousAuthorization)); |
|
|
|
|
// 存流水号
|
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = new InvoiceAllLoginResult(); |
|
|
|
|
BeanUtil.copyProperties(autonomousAuthorization, invoiceAllLoginResult); |
|
|
|
|
invoiceAllLoginResult.setCreateTime(new Date()); |
|
|
|
|
int count = invoiceAllLoginResultMapper.insertInvoiceAllLoginResult(invoiceAllLoginResult); |
|
|
|
|
if (count > 0) { |
|
|
|
|
log.info("全电登录接口,登录返回信息保存成功,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
InvoiceAllLoginResult byQqlsh = invoiceAllLoginResultMapper.findByQqlsh(autonomousAuthorization.getTrace()); |
|
|
|
|
if (byQqlsh != null) { |
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = new InvoiceAllLoginResult(); |
|
|
|
|
BeanUtil.copyProperties(autonomousAuthorization,invoiceAllLoginResult); |
|
|
|
|
invoiceAllLoginResult.setUpdateTime(new Date()); |
|
|
|
|
int count = invoiceAllLoginResultMapper.updateInvoiceResult(invoiceAllLoginResult); |
|
|
|
|
if (count > 0) { |
|
|
|
|
log.info("全电登录接口,登录返回信息更新成功,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
} else { |
|
|
|
|
log.error("全电登录接口,登录返回信息更新失败,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
log.error("全电登录接口,登录返回信息失败,信息为:{}", JSONUtil.toJsonStr(invoiceAllLoginResult)); |
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = new 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)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 功能描述: 获取短信验证结果 |
|
|
|
|
* |
|
|
|
|
* @param invoiceAllSubmitNoteDTO |
|
|
|
|
* @return : java.lang.Object |
|
|
|
|
*/ |
|
|
|
@ -77,17 +90,20 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
log.info("获取短信验证结果入口,入参:{}", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
// 短信提交
|
|
|
|
|
ValidateUtils.validate(invoiceAllSubmitNoteDTO); |
|
|
|
|
List<InvoiceAllLoginResult> invoiceAllLoginResultList = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLoginResultList == null || invoiceAllLoginResultList.size() <= 0) { |
|
|
|
|
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLoginResult == null) { |
|
|
|
|
log.info("获取短信验证结果入口,未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
} |
|
|
|
|
for (InvoiceAllLoginResult invoiceAllLoginResult : invoiceAllLoginResultList) { |
|
|
|
|
if ("S000".equals(invoiceAllLoginResult.getCode())){ |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
|
if ("SMS".equals(invoiceAllLoginResult.getCode())) { |
|
|
|
|
return AjaxResult.error("10010"); |
|
|
|
|
} else if ("F000".equals(invoiceAllLoginResult.getCode())) { |
|
|
|
|
return AjaxResult.error("10011"); |
|
|
|
|
} else if ("SOOO".equals(invoiceAllLoginResult.getCode())) { |
|
|
|
|
return AjaxResult.error("10012"); |
|
|
|
|
} else { |
|
|
|
|
return AjaxResult.error("10013"); |
|
|
|
|
} |
|
|
|
|
return AjaxResult.error(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -168,29 +184,27 @@ public class AutonomousSqServiceImpl implements AutonomousSqService { |
|
|
|
|
// 短信提交
|
|
|
|
|
ValidateUtils.validate(invoiceAllSubmitNoteDTO); |
|
|
|
|
// 根据流水号获取登录结果
|
|
|
|
|
List<InvoiceAllLoginResult> invoiceAllLoginResultList = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLoginResultList == null || invoiceAllLoginResultList.size() <= 0) { |
|
|
|
|
InvoiceAllLoginResult invoiceAllLoginResult = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); |
|
|
|
|
if (invoiceAllLoginResult == null) { |
|
|
|
|
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入"); |
|
|
|
|
} |
|
|
|
|
for (InvoiceAllLoginResult invoiceAllLoginResult : invoiceAllLoginResultList) { |
|
|
|
|
if ("SMS".equals(invoiceAllLoginResult.getCode())) { |
|
|
|
|
try { |
|
|
|
|
// 请求封装
|
|
|
|
|
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", "http://221.222.184.98:8880/login/submitSms", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
Thread requestThread = new Thread(() -> { |
|
|
|
|
HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO); |
|
|
|
|
}); |
|
|
|
|
requestThread.start(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【自主授权提交短信验证码】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.INCOME_ERROR); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}", "登录失败,请重新授权登录"); |
|
|
|
|
return AjaxResult.error("登录失败,请重新授权登录"); |
|
|
|
|
if ("SMS".equals(invoiceAllLoginResult.getCode())) { |
|
|
|
|
try { |
|
|
|
|
// 请求封装
|
|
|
|
|
log.info("自主授权短信提交接口,请求上游地址:{},入参:{}", "http://221.222.184.98:8880/login/submitSms", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO)); |
|
|
|
|
Thread requestThread = new Thread(() -> { |
|
|
|
|
HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO); |
|
|
|
|
}); |
|
|
|
|
requestThread.start(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("【金四服务类】【金财数科】【自主授权提交短信验证码】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); |
|
|
|
|
return AjaxResult.error(ErrorCode.INCOME_ERROR); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}", "登录失败,请重新授权登录"); |
|
|
|
|
return AjaxResult.error("登录失败,请重新授权登录"); |
|
|
|
|
} |
|
|
|
|
return AjaxResult.success(); |
|
|
|
|
} |
|
|
|
|