用户登记:1.后端添加登录校验接口,2.前端验证是否成功登录修改为调用登录校验接口

beta
路明慧 1 year ago
parent 09d9d173ed
commit 6c7fc7e380
  1. 38
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 43
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoiceall/v1/InvoiceAllController.java
  3. 3
      jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java
  4. 2
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/IInvoiceAll.java
  5. 29
      jianshui-invoice-all/src/main/java/com/jianshui/invoiceall/service/impl/InvoiceAllImpl.java
  6. 3
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java
  7. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java
  8. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiZhongQiServiceImpl.java
  9. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  10. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  11. 41
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java
  12. 2
      jianshui-ui/src/api/digital/registered.js
  13. 93
      jianshui-ui/src/views/digital/registered/index.vue

@ -1311,6 +1311,44 @@ public class InvoiceController {
}
/**
* 登陆验证
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice/v1/loginVerificated/{identity}", "/api/invoice/v1/loginVerificated", "/invoice/loginVerificated"})
public Object loginVerificated(HttpServletRequest request, String identity) throws Exception {
// qrcode
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
}
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
if (companyservice == null) {
return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND);
}
// 获得入口报文适配器
String requestAdapterKey = serviceManageService.getRequestAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceRequestService invoiceRequestService = invoiceRequestFactory.getService(requestAdapterKey);
JSONObject decryptResult = invoiceRequestService.decrypt(request, companyservice, "");
// 获得请求实例,并且进行扣费
String serviceKey = serviceManageService.getCompanyServiceSupplier("invoice", companyservice.getCompanyid());
serviceManageService.companyConsume("invoice", companyservice.getCompanyid());
IInvoiceApiService invoiceService = invoiceServiceFactory.getService(serviceKey);
HXResponse result = invoiceService.loginVerificated(decryptResult, companyservice);
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey);
return invoiceResponseService.response(result, companyservice, "");
}
/**
* 发票查询

@ -5,6 +5,10 @@ import com.jianshui.common.core.domain.AjaxResult;
import com.jianshui.common.core.domain.entity.Companyservice;
import com.jianshui.common.enums.ErrorCode;
import com.jianshui.common.utils.StringUtils;
import com.jianshui.invoice.domain.dto.HXResponse;
import com.jianshui.invoice.service.IInvoiceApiService;
import com.jianshui.invoice.service.IInvoiceRequestService;
import com.jianshui.invoice.service.IInvoiceResponseService;
import com.jianshui.invoiceall.domain.dto.*;
import com.jianshui.invoiceall.domain.dto.jcsk.AutonomousAuthorizationDTO;
import com.jianshui.invoiceall.domain.dto.jcsk.InvoiceAllSubmitNoteDTO;
@ -385,6 +389,45 @@ public class InvoiceAllController {
}
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),
@ApiImplicitParam(name = "order", value = "请求体", dataType = "java.lang.Void", required = true)})
@PostMapping({"/api/invoice_all/v1/loginVerificated/{identity}", "/api/invoice_all/v1/loginVerificated", "/invoice_all/loginVerificated"})
public Object loginVerificated(HttpServletRequest request, String identity) throws Exception {
if (StringUtils.isEmpty(identity)) {
return AjaxResult.error(ErrorCode.EMPTY_IDENTITY);
}
Companyservice companyservice = iCompanyserviceService.selectCompanyserviceByIdentity(identity);
if (companyservice == null) {
return AjaxResult.error(ErrorCode.COMPANY_NOT_FOUND);
}
// 获得入口报文适配器
String requestAdapterKey = serviceManageService.getRequestAdapterKey(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAllRequestService incomeRequestService = invoiceAllRequestFactory.getService(requestAdapterKey);
JSONObject requestBody = incomeRequestService.decrypt(request, companyservice);
// 获得请求实例,并且进行扣费
String serviceKey = serviceManageService.getCompanyServiceSupplier(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAll invoiceAllService = iInvoceiAllServiceFactory.getService(serviceKey);
AjaxResult result = invoiceAllService.loginVerificated(companyservice, requestBody);
//返回处理 增加调用次数
if (result.isSuccess()) {
serviceManageService.companyConsume(SERVICE_KEY, companyservice.getCompanyid());
}
//返回报文处理器
String responseAdapterKey = serviceManageService.getResponseAdapterKey(SERVICE_KEY, companyservice.getCompanyid());
IInvoiceAllResponseService incomeResponseService = invoiceAllResponseFactory.getService(responseAdapterKey);
return incomeResponseService.response(result, companyservice, "");
}
@ApiOperation("发票查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),

@ -50,6 +50,9 @@ public class WebServiceConstant {
/** 获取人脸识别结果*/
public final static String HQRLSBJG = "hqrlsbjg";
/**登录校验*/
public final static String DLYZ = "dlyz";
/**
* 单张发票查询
*/

@ -154,4 +154,6 @@ public interface IInvoiceAll {
/** 获取人脸识别结果*/
AjaxResult qrcodeResult(Companyservice companyservice, JSONObject requestBody);
AjaxResult loginVerificated(Companyservice companyservice, JSONObject requestBody);
}

@ -1296,5 +1296,34 @@ public class InvoiceAllImpl implements IInvoiceAll {
}
@Override
public AjaxResult loginVerificated(Companyservice companyservice, com.alibaba.fastjson.JSONObject requestBody) {
JSONObject result = null;
try {
result = ApiHttp.request(WebServiceConstant.DLYZ, WebServiceConstant.URL, requestBody, companyservice);
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 ("0000".equals(code) && StrUtil.isNotEmpty(data)) {
JSONObject json = JSONUtil.parseObj(data);
String requestId = json.getOrDefault("requestId", "").toString();
if (StrUtil.isEmpty(requestId)) {
return AjaxResult.error(msg);
}
return AjaxResult.success(json);
} else {
return AjaxResult.error(msg);
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【登录校验】API请求异常,外部报文返回code非0000。错误信息:{}", e);
return AjaxResult.error(ErrorCode.INCOME_ERROR);
}
}
}

@ -363,4 +363,7 @@ public interface IInvoiceApiService {
/** 数电获取发票文件接口(数电专用接口) */
HXResponse QuerySdInvoiceFile(JSONObject decryptResult, Companyservice companyservice);
/** 登陆验证 */
HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice);
}

@ -1072,6 +1072,11 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
@Override
public HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice) {
return null;
}
@Override
public AjaxResult syncStockInfo(Companyservice companyservice) {

@ -552,6 +552,11 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
return null;
}
@Override
public HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice) {
return null;
}
/**
* 发票打印

@ -891,6 +891,11 @@ public class ElephantInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
@Override
public HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice) {
return null;
}
/**
* 申请/上传 红字发票

@ -1154,6 +1154,11 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
return parseResult(dxhyInterfaceResponse);
}
@Override
public HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice) {
return null;
}
/**
* 红字确认单列表查询数电专用

@ -1674,6 +1674,47 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
@Override
public HXResponse loginVerificated(JSONObject decryptResult, Companyservice companyservice) {
cn.hutool.json.JSONObject result = null;
try {
result = ApiHttp.request(WebServiceConstant.DLYZ, WebServiceConstant.URL, decryptResult, companyservice);
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 ("0000".equals(code)) {
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data);
String requestId = json.getOrDefault("requestId", "").toString();
if (StrUtil.isEmpty(requestId)) {
return new HXResponse(msg);
}
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog();
allApiLog.setUrl(WebServiceConstant.DLYZ);
allApiLog.setSendMsg(JSONUtil.toJsonStr(decryptResult));
allApiLog.setResultMsg(JSONUtil.toJsonStr(result));
allApiLog.setCompany(companyservice.getSellertax());
allApiLog.setIdentityId(companyservice.getIdentity());
allApiLog.setRequestId(requestId);
allApiLog.setCreateTime(new Date());
allApiLogMapper.insertInvoiceAllApiLog(allApiLog);
HXResponse response = new HXResponse("0000", "请求成功", json);
return response;
} else {
return new HXResponse(msg);
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【数科】【登陆验证】API请求异常,外部报文返回code非0000。错误信息:{}", e);
return new HXResponse("登陆验证!");
}
}
/**
* 简税和金财数科 发票类型互换
*

@ -28,7 +28,7 @@ export function registeredMethod(registeredParams,identity) {
//人脸识别
export function qrcodeMethod(qrcodeParams,identity) {
return request({
url: '/api/invoice_all/v1/qrcode?identity=' + identity+"&order="+qrcodeParams,
url: '/api/invoice_all/v1/loginVerificated?identity=' + identity+"&order="+qrcodeParams,
method: 'post',
})
}

@ -175,43 +175,19 @@
<el-button
size="mini"
type="text"
icon="el-icon-edit"
icon="el-icon-s-promotion"
@click="registered(scope.row)"
v-hasPermi="['invoiceall:invoiceallyhdj:edit']"
v-if="scope.row.dqbm != null
&& scope.row.dqbm != ''
&& scope.row.dlfs != null
&& scope.row.dlfs != ''
&& scope.row.dlsfmm != null
&& scope.row.dlsfmm != ''
&& scope.row.dlmm != null
&& scope.row.dlmm != ''
&& scope.row.dlzh != null
&& scope.row.dlzh != ''
&& scope.row.nsrmc != null
&& scope.row.nsrmc != ''
&& scope.row.nsrsbh != null
&& scope.row.nsrsbh != ''
&& scope.row.bsrysfzjhm != null
&& scope.row.bsrysfzjhm != ''
&& scope.row.identity != null
&& scope.row.identity != ''"
v-if="isShowRegistered(scope.row)"
>登记</el-button>
<el-button
size="small"
type="text"
icon="el-icon-edit"
@click="qrcode(scope.row)"
icon="el-icon-s-check"
@click="loginVerificated(scope.row)"
v-hasPermi="['invoiceall:invoiceallyhdj:remove']"
v-show="scope.row.dqbm != null
&& scope.row.dqbm != ''
&& scope.row.nsrsbh != null
&& scope.row.nsrsbh != ''
&& scope.row.bsrysfzjhm != null
&& scope.row.bsrysfzjhm != ''
&& scope.row.identity != null
&& scope.row.identity != ''"
>人脸识别</el-button>
v-show="isShowLoginVerificated(scope.row)"
>登录校验</el-button>
</template>
</el-table-column>
</el-table>
@ -405,17 +381,14 @@ export default {
},
//
qrcodeParams : {
//
loginVerificatedParams : {
appkey: "935248bf224f6c8431cdc1969f029519",
async: true,
bsrysfzjhm:"",
dqbm: "",
nsrsbh: "",
jsonData: {
rlsblx: ""
},
serviceId: "hqrlsbewm"
serviceId: "dlyz"
},
};
},
@ -528,8 +501,8 @@ export default {
})
},
/** 人脸识别 */
qrcode(row){
/** 登陆验证 */
loginVerificated(row){
this.reset();
getCompanyservice(row.identity).then(resp=>{
//
@ -537,7 +510,7 @@ export default {
this.convertRegistedParam(row,false)
const requestBody = {
key: resp.data.secret,
order: JSON.stringify(this.qrcodeParams),
order: JSON.stringify(this.loginVerificatedParams),
}
encrypt(requestBody).then(res => {
if (res.code == 200 && res.data != null && res.data != "") {
@ -550,7 +523,11 @@ export default {
this.$message.error('登记失败')
}
}else {
this.$message.error(response.msg)
if(response.msg){
this.$message.error(response.msg)
}else {
this.$message.error(response.message)
}
}
});
}else if (res.data == null || res.data == ""){
@ -580,9 +557,9 @@ export default {
this.registeredParams.jsonData.zjh = row.zjh;
this.registeredParams.jsonData.bsrysfzjhm = row.bsrysfzjhm;
}else {
this.qrcodeParams.bsrysfzjhm = row.bsrysfzjhm;
this.qrcodeParams.dqbm = row.dqbm;
this.qrcodeParams.nsrsbh = row.nsrsbh;
this.loginVerificatedParams.bsrysfzjhm = row.bsrysfzjhm;
this.loginVerificatedParams.dqbm = row.dqbm;
this.loginVerificatedParams.nsrsbh = row.nsrsbh;
}
},
/** 提交按钮 */
@ -620,6 +597,36 @@ export default {
this.download('invoiceall/invoiceallyhdj/export', {
...this.queryParams
}, `invoiceallyhdj_${new Date().getTime()}.xlsx`)
},
isShowRegistered(row){
return row.dqbm != null
&& row.dqbm != ''
&& row.dlfs != null
&& row.dlfs != ''
&& row.dlsfmm != null
&& row.dlsfmm != ''
&& row.dlmm != null
&& row.dlmm != ''
&& row.dlzh != null
&& row.dlzh != ''
&& row.nsrmc != null
&& row.nsrmc != ''
&& row.nsrsbh != null
&& row.nsrsbh != ''
&& row.bsrysfzjhm != null
&& row.bsrysfzjhm != ''
&& row.identity != null
&& row.identity != ''
},
isShowLoginVerificated(row){
return row.dqbm != null
&& row.dqbm != ''
&& row.nsrsbh != null
&& row.nsrsbh != ''
&& row.bsrysfzjhm != null
&& row.bsrysfzjhm != ''
&& row.identity != null
&& row.identity != ''
}
}
};

Loading…
Cancel
Save