自主授权接口开发

beta-enc
kane 2 years ago
parent bfd379cc3a
commit ed41b4fa12
  1. 9
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java
  2. 7
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/AutonomousSqService.java
  3. 64
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/AutonomousSqServiceImpl.java
  4. 2
      jianshui-system/src/main/java/com/jianshui/system/mapper/InvoiceAllLoginResultMapper.java
  5. 190
      jianshui-ui/src/views/freedom/login.vue

@ -91,6 +91,15 @@ public class InvoiceAllController {
return autonomousSqService.submitNote(invoiceAllSubmitNoteDTO); return autonomousSqService.submitNote(invoiceAllSubmitNoteDTO);
} }
@ApiOperation("获取提交短信验证码结果")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "inoviceAllQdLoginDTO", value = "请求体",dataType = "java.lang.Void", required = true)})
@PostMapping("/api/invoice_all/v1/submitNoteResult")
public Object submitNoteResult(@RequestBody InvoiceAllSubmitNoteDTO invoiceAllSubmitNoteDTO) throws Exception{
return autonomousSqService.submitNoteResult(invoiceAllSubmitNoteDTO);
}
@ApiOperation("用户登记接口") @ApiOperation("用户登记接口")

@ -33,4 +33,11 @@ public interface AutonomousSqService {
* @return : java.lang.Object * @return : java.lang.Object
*/ */
Object autonomousAuthorization(AutonomousAuthorizationDTO autonomousAuthorization); Object autonomousAuthorization(AutonomousAuthorizationDTO autonomousAuthorization);
/**
* 功能描述: 获取短信验证结果
* @param invoiceAllSubmitNoteDTO
* @return : java.lang.Object
*/
Object submitNoteResult(InvoiceAllSubmitNoteDTO invoiceAllSubmitNoteDTO);
} }

@ -2,7 +2,6 @@ package com.jianshui.invoiceall.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jianshui.common.core.domain.AjaxResult; import com.jianshui.common.core.domain.AjaxResult;
@ -26,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author xingze * @author xingze
@ -67,6 +67,29 @@ public class AutonomousSqServiceImpl implements AutonomousSqService {
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 功能描述: 获取短信验证结果
* @param invoiceAllSubmitNoteDTO
* @return : java.lang.Object
*/
@Override
public Object submitNoteResult(InvoiceAllSubmitNoteDTO invoiceAllSubmitNoteDTO) {
log.info("获取短信验证结果入口,入参:{}", JSONUtil.toJsonStr(invoiceAllSubmitNoteDTO));
// 短信提交
ValidateUtils.validate(invoiceAllSubmitNoteDTO);
List<InvoiceAllLoginResult> invoiceAllLoginResultList = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno());
if (invoiceAllLoginResultList == null || invoiceAllLoginResultList.size() <= 0) {
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入");
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入");
}
for (InvoiceAllLoginResult invoiceAllLoginResult : invoiceAllLoginResultList) {
if ("S000".equals(invoiceAllLoginResult.getCode())){
return AjaxResult.success();
}
}
return AjaxResult.error();
}
/** /**
* 功能描述: 全电登录 * 功能描述: 全电登录
* *
@ -145,29 +168,30 @@ public class AutonomousSqServiceImpl implements AutonomousSqService {
// 短信提交 // 短信提交
ValidateUtils.validate(invoiceAllSubmitNoteDTO); ValidateUtils.validate(invoiceAllSubmitNoteDTO);
// 根据流水号获取登录结果 // 根据流水号获取登录结果
InvoiceAllLoginResult invoiceAllLogin = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno()); List<InvoiceAllLoginResult> invoiceAllLoginResultList = invoiceAllLoginResultMapper.findByQqlsh(invoiceAllSubmitNoteDTO.getTraceno());
if (invoiceAllLogin == null) { if (invoiceAllLoginResultList == null || invoiceAllLoginResultList.size() <= 0) {
log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入"); log.info("自主授权短信提交接口,未查询到该流水号相关信息,请确认后输入");
return AjaxResult.error("未查询到该流水号相关信息,请确认后输入"); return AjaxResult.error("未查询到该流水号相关信息,请确认后输入");
} }
JSONObject result = null; for (InvoiceAllLoginResult invoiceAllLoginResult : invoiceAllLoginResultList) {
if ("SMS".equals(invoiceAllLogin.getCode())) { if ("SMS".equals(invoiceAllLoginResult.getCode())) {
try { 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 sendResult = HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO); Thread requestThread = new Thread(() -> {
result = JSONUtil.parseObj(sendResult); HttpUtils.sendJsonPost("http://221.222.184.98:8880/login/submitSms", invoiceAllSubmitNoteDTO);
log.info("自主授权短信提交接口,请求上游结果:{}",result); });
} catch (Exception e) { requestThread.start();
e.printStackTrace(); } catch (Exception e) {
log.error("【金四服务类】【金财数科】【自主授权提交短信验证码】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage()); e.printStackTrace();
return AjaxResult.error(ErrorCode.INCOME_ERROR); log.error("【金四服务类】【金财数科】【自主授权提交短信验证码】API请求异常,外部报文返回code非S000。错误信息:{}", e.getMessage());
return AjaxResult.error(ErrorCode.INCOME_ERROR);
}
} else {
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}", "登录失败,请重新授权登录");
return AjaxResult.error("登录失败,请重新授权登录");
} }
return AjaxResult.success(result);
} else {
log.error("自主授权短信提交接口,提交短信失败,失败原因:{}", "登录失败,请重新登录");
return AjaxResult.error("登录失败,请重新登录");
} }
return AjaxResult.success();
} }
} }

@ -65,5 +65,5 @@ public interface InvoiceAllLoginResultMapper
* @param qqlsh * @param qqlsh
* @return : com.jianshui.system.domain.InvoiceAllLoginResult * @return : com.jianshui.system.domain.InvoiceAllLoginResult
*/ */
InvoiceAllLoginResult findByQqlsh(@Param("qqlsh") String qqlsh); List<InvoiceAllLoginResult> findByQqlsh(@Param("qqlsh") String qqlsh);
} }

@ -107,94 +107,94 @@
</template> </template>
<script> <script>
import {login,submitNote} from "@/api/freedom/login"; import {login,submitNote} from "@/api/freedom/login";
export default { export default {
name: "Login", name: "Login",
data() { data() {
let checkedFn = (rule, value, callback) => { let checkedFn = (rule, value, callback) => {
if (!value) { if (!value) {
callback(new Error("请勾选同意协议")); callback(new Error("请勾选同意协议"));
} else { } else {
callback(); callback();
}
};
return {
ruleForm: {
smsCode : "",
showone : true,
showtwo : false,
showthree : false,
nsrsbh: '',
nsrdq: '',
loginType: '1',
checked : false,
traceno : "",
nsrInfo:{
dlsf :"",
dlsfmm : "",
gsnsmm : "",
sfzjhm : "",
zjh : "",
gsnsyhm : "",
bsryxz : "",
} }
}; },
return { rules: {
ruleForm: { nsrsbh: [
smsCode : "", { required: true, message: '请输入纳税人识别号', trigger: 'blur' }
showone : true, ],
showtwo : false, nsrdq: [
showthree : false, { required: true, message: '请选择地区', trigger: 'change' }
nsrsbh: '', ],
nsrdq: '', loginType: [
loginType: '1', { required: true, message: '请选择登陆方式', trigger: 'change' }
checked : false, ],
traceno : "", "nsrInfo.bsryxz": [
nsrInfo:{ { required: true, message: '请输入用户名', trigger: 'blur' }
dlsf :"", ],
dlsfmm : "", "nsrInfo.sfzjhm": [
gsnsmm : "", { required: true, message: '请输入身份证号', trigger: 'blur' }
sfzjhm : "", ],
zjh : "", "nsrInfo.zjh": [
gsnsyhm : "", { required: true, message: '请输入手机号', trigger: 'blur' }
bsryxz : "", ],
} "nsrInfo.gsnsmm": [
}, { required: true, message: '请输入个人密码', trigger: 'blur' }
rules: { ],
nsrsbh: [ checked: [
{ required: true, message: '请输入纳税人识别号', trigger: 'blur' } { validator: checkedFn, trigger: "change" }
], // { type: 'array', required: true, message: '', trigger: 'change' }
nsrdq: [ ]
{ required: true, message: '请选择地区', trigger: 'change' } }
], };
loginType: [ },
{ required: true, message: '请选择登陆方式', trigger: 'change' } methods: {
], submitForm(formName) {
"nsrInfo.bsryxz": [ this.$refs[formName].validate((valid) => {
{ required: true, message: '请输入用户名', trigger: 'blur' } if (valid) {
], // alert('submit!');
"nsrInfo.sfzjhm": [ this.ruleForm.nsrInfo.dlsfmm = this.ruleForm.nsrInfo.gsnsmm;
{ required: true, message: '请输入身份证号', trigger: 'blur' } this.ruleForm.nsrInfo.bsryxz = this.ruleForm.nsrInfo.zjh;
], this.ruleForm.nsrInfo.gsnsyhm = this.ruleForm.nsrInfo.zjh;
"nsrInfo.zjh": [ login(this.ruleForm).then(res=>{
{ required: true, message: '请输入手机号', trigger: 'blur' } if (res.code == 200){
], this.ruleForm.traceno = res.msg;
"nsrInfo.gsnsmm": [ this.ruleForm.showone = false;
{ required: true, message: '请输入个人密码', trigger: 'blur' } this.ruleForm.showtwo = true;
], this.ruleForm.showthree = false;
checked: [ }else {
{ validator: checkedFn, trigger: "change" } this.$alert("<font color='red'>登陆失败,失败原因"+res.msg+"</font>")
// { type: 'array', required: true, message: '', trigger: 'change' } }
]
});
} else {
console.log('error submit!!');
return false;
} }
}; });
}, },
methods: { submitFormWithMsgCode(){
submitForm(formName) { submitNote(this.ruleForm.traceno,this.ruleForm.nsrsbh,this.ruleForm.smsCode,this.ruleForm.nsrInfo.zjh)
this.$refs[formName].validate((valid) => {
if (valid) {
// alert('submit!');
this.ruleForm.nsrInfo.dlsfmm = this.ruleForm.nsrInfo.gsnsmm;
this.ruleForm.nsrInfo.bsryxz = this.ruleForm.nsrInfo.zjh;
this.ruleForm.nsrInfo.gsnsyhm = this.ruleForm.nsrInfo.zjh;
login(this.ruleForm).then(res=>{
if (res.code == 200){
this.ruleForm.traceno = res.msg;
this.ruleForm.showone = false;
this.ruleForm.showtwo = true;
this.ruleForm.showthree = false;
}else {
this.$alert("<font color='red'>登陆失败,失败原因"+res.msg+"</font>")
}
});
} else {
console.log('error submit!!');
return false;
}
});
},
submitFormWithMsgCode(){
submitNote(this.ruleForm.traceno,this.ruleForm.nsrsbh,this.ruleForm.smsCode,this.ruleForm.nsrInfo.zjh)
.then(res=>{ .then(res=>{
if (res.code == "200"){ if (res.code == "200"){
this.ruleForm.showone = false; this.ruleForm.showone = false;
@ -205,18 +205,18 @@
alter("请求失败请重试") alter("请求失败请重试")
} }
}); });
}, },
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
}, },
changeShow(){ changeShow(){
this.ruleForm.showone = true; this.ruleForm.showone = true;
this.ruleForm.showtwo = false; this.ruleForm.showtwo = false;
this.ruleForm.showthree = false; this.ruleForm.showthree = false;
}
} }
} }
}
</script> </script>
<style scoped> <style scoped>

Loading…
Cancel
Save