人脸识别结果获取接口

beta
kk 2 years ago
parent bc6979abf6
commit 88138d36dd
  1. 39
      jianshui-admin/src/main/java/com/jianshui/api/controller/http/invoice/v1/InvoiceController.java
  2. 3
      jianshui-common/src/main/java/com/jianshui/common/constant/WebServiceConstant.java
  3. 34
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/InvoiceAllQycodeResultDTO.java
  4. 25
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/elephant/sd/GetRpaAuthStatusDTO.java
  5. 24
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/jcsk/QycodeResultJsonDataTWODTO.java
  6. 35
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/dto/api/jcsk/QycodeResultTWODTO.java
  7. 24
      jianshui-invoice/src/main/java/com/jianshui/invoice/domain/vo/jcsk/InvoiceAllQycodeResultVO.java
  8. 11
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/IInvoiceApiService.java
  9. 2
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/adapter/request/AisinoInvoiceRequestAdapterImpl.java
  10. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiServiceImpl.java
  11. 7
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/AisinoConsoleInvoiceApiZhongQiServiceImpl.java
  12. 5
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiServiceImpl.java
  13. 29
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/ElephantInvoiceApiV6ServiceImpl.java
  14. 87
      jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/api/JcskInvoiceApiServiceImpl.java

@ -1156,6 +1156,45 @@ 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/qrcodeResult/{identity}", "/api/invoice/v1/qrcodeResult"})
public Object qrcodeResult(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.qrcodeResult(decryptResult, companyservice);
String responseAdapterKey = serviceManageService.getResponseAdapterKey("invoice", companyservice.getCompanyid());
IInvoiceResponseService invoiceResponseService = invoiceResponseFactory.getService(responseAdapterKey);
return invoiceResponseService.response(result, companyservice, "");
}
/** 发票查询*/
@ApiImplicitParams({
@ApiImplicitParam(name = "identity", value = "身份认证", dataType = "java.lang.Void", example = "1130", required = true),

@ -47,6 +47,9 @@ public class WebServiceConstant {
*/
public final static String QRCODE = "hqrlsbewm";
/** 获取人脸识别结果*/
public final static String HQRLSBJG = "hqrlsbjg";
/**
* 单张发票查询
*/

@ -0,0 +1,34 @@
package com.jianshui.invoice.domain.dto.api;
import lombok.Data;
/**
* @author kk
* @date 2023年10月30日 19:05
* 获取人脸识别结果
*/
@Data
public class InvoiceAllQycodeResultDTO {
/**
* 人脸识别类型
*/
private String rlsblx;
/**
* 认证id
*/
private String rzid;
/**
* 电局登录用户名
*/
private String yhm;
/**
* 纳税人识别号
*/
private String nsrsbh;
}

@ -0,0 +1,25 @@
package com.jianshui.invoice.domain.dto.api.elephant.sd;
import com.jianshui.invoice.domain.dto.api.jcsk.QycodeResultJsonDataTWODTO;
import lombok.Data;
/**
* @author kk
* @date 2023年10月30日 19:05
* 获取人脸识别结果
*/
@Data
public class GetRpaAuthStatusDTO {
/** *地区编码(参考码表)*/
private String nsrsbh;
/** 认证id*/
private String rzid;
/** 电局登录用户名*/
private String yhm;
}

@ -0,0 +1,24 @@
package com.jianshui.invoice.domain.dto.api.jcsk;
import lombok.Data;
/**
* @author kk
* @date 2023年10月30日 19:05
* 获取人脸识别结果
*/
@Data
public class QycodeResultJsonDataTWODTO {
/** 人脸识别类型*/
private String rlsblx;
/** 认证id*/
private String rzid;
/** 电局登录用户名*/
private String yhm;
}

@ -0,0 +1,35 @@
package com.jianshui.invoice.domain.dto.api.jcsk;
import lombok.Data;
/**
* @author kk
* @date 2023年10月30日 19:05
* 获取人脸识别结果
*/
@Data
public class QycodeResultTWODTO {
/** 渠道标识*/
// private String appkey;
private String async;
/** 办税人身份证号*/
private String bsrysfzjhm;
/** *地区编码(参考码表)*/
private String dqbm;
/** *地区编码(参考码表)*/
private String nsrsbh;
/** jsonData*/
private QycodeResultJsonDataTWODTO jsonData;
}

@ -0,0 +1,24 @@
package com.jianshui.invoice.domain.vo.jcsk;
import lombok.Data;
/**
* @author kk
* @date 2023年10月30日 19:05
* 获取人脸识别结果
*/
@Data
public class InvoiceAllQycodeResultVO {
/** 扫脸状态*/
private String slzt;
/** 认证id*/
private String rzid;
/** 电局登录用户名*/
private String yhm;
}

@ -347,13 +347,6 @@ public interface IInvoiceApiService {
HXResponse exportVehicleInvoice(JSONObject decryptResult, Companyservice companyservice);
/** 获取人脸识别结果*/
HXResponse qrcodeResult(JSONObject decryptResult, Companyservice companyservice);
}

@ -103,7 +103,7 @@ public class AisinoInvoiceRequestAdapterImpl implements IInvoiceRequestService {
// 平台解密
try {
// TODO: 2023/9/20
order = AisinoInvoiceDecryptUtil.decrypt(order, JKey);
// order = AisinoInvoiceDecryptUtil.decrypt(order, JKey);
} catch (Exception e) {
e.printStackTrace();
throw new JianshuiParamErrorException(ErrorCode.DECRYPT_ERROR, companyservice, "invoice");

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

@ -1244,7 +1244,12 @@ public class AisinoConsoleInvoiceApiZhongQiServiceImpl implements IInvoiceApiSer
}
/**
@Override
public HXResponse qrcodeResult(JSONObject decryptResult, Companyservice companyservice) {
return null;
}
/**
* @author kk
* @date 17:42
* @param: [in]

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

@ -30,6 +30,7 @@ import com.jianshui.invoice.domain.*;
import com.jianshui.invoice.domain.dto.*;
import com.jianshui.invoice.domain.dto.api.*;
import com.jianshui.invoice.domain.dto.api.elephant.*;
import com.jianshui.invoice.domain.dto.api.elephant.sd.GetRpaAuthStatusDTO;
import com.jianshui.invoice.domain.dto.api.elephant.sd.HZQRDMXLIST;
import com.jianshui.invoice.domain.dto.api.elephant.sd.RedDownload;
import com.jianshui.invoice.domain.dto.api.elephant.sd.RedUpload;
@ -826,6 +827,34 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService {
return null;
}
/** 获取人脸识别结果*/
@Override
public HXResponse qrcodeResult(JSONObject decryptResult, Companyservice companyservice) {
InvoiceAllQycodeResultDTO qycodeResultDTO = BeanUtil.copyProperties(decryptResult,InvoiceAllQycodeResultDTO.class);
if(BeanUtil.isEmpty(qycodeResultDTO)){
return new HXResponse("参数为空!");
}
// 报文组装
GetRpaAuthStatusDTO getRpaAuthStatusDTO = new GetRpaAuthStatusDTO();
getRpaAuthStatusDTO.setYhm(qycodeResultDTO.getYhm());
getRpaAuthStatusDTO.setRzid(qycodeResultDTO.getRzid());
getRpaAuthStatusDTO.setNsrsbh(qycodeResultDTO.getNsrsbh());
DxhyInterfaceResponse dxhyInterfaceResponse = null;
try {
dxhyInterfaceResponse = ElephantUtils.sendRequestWithoutTokenV6
(ElephantConstantsV6.GET_RPA_AUTH_STATUS_LOCALHOST, ElephantConstantsV6.GET_RPA_AUTH_STATUS_METHOD, JSONUtil.parse(getRpaAuthStatusDTO), companyservice);
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
log.error("【销项发票】【大象接口】【数电】【获取人脸识别结果】发票请求异常,请求报文{},销方信息{}", decryptResult, JSONObject.toJSONString(companyservice));
e.printStackTrace();
return new HXResponse("009999", "系统异常!");
}
return parseResult(dxhyInterfaceResponse);
}
/**
* 红字确认单列表查询数电专用
*/

@ -41,6 +41,7 @@ import com.jianshui.system.mapper.InvoiceAllApiLogMapper;
import com.jianshui.system.mapper.InvoiceAllYhdjMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@ -150,7 +151,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
if (resBillInfo > 0) {
billInfoID = billInfo.getId();
if (BeanUtil.isEmpty(billInfo.getId())) {
log.error("【金四服务类】【金财数科】【蓝字发票开具】API请求异常,billInfoId返回存储错误。");
log.error("【金四服务类】【数科】【蓝字发票开具】API请求异常,billInfoId返回存储错误。");
return new HXResponse("蓝字发票开具内部错误!");
}
//数据库存储
@ -164,7 +165,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【蓝字发票开具】API请求异常,billInfo存储错误。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【蓝字发票开具】API请求异常,billInfo存储错误。错误信息:{}", e.getMessage());
return new HXResponse("蓝字发票开具内部错误!");
}
@ -211,7 +212,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return new HXResponse(msg);
}
} catch (Exception e) {
log.error("【金四服务类】【金财数科】【蓝字发票开具】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【蓝字发票开具】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("蓝字发票开具异常");
}
@ -233,13 +234,13 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
result = ApiHttp.request(WebServiceConstant.ADD_RED_INVOICE, WebServiceConstant.URL, addRedInvoiceDTO, companyservice);
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse(ErrorCode.INCOME_ERROR.toString());
}
// 处理请求
if (!StringUtils.equals("0000", result.getStr("code"))) {
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。返回信息:{}", result);
log.error("【金四服务类】【数科】【获取二维码】API请求异常,外部报文返回code非0000。返回信息:{}", result);
return new HXResponse(result.getStr("message"));
}
@ -488,7 +489,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【申请红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【申请红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("通用查询接口异常");
}
@ -596,7 +597,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【查询红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【查询红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("查询红字信息表接口异常");
}
@ -787,7 +788,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【获取发票下载地址】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【获取发票下载地址】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("获取发票下载地址错误!");
}
@ -846,7 +847,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【全电安排文件获取】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【全电安排文件获取】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("全电发票文件获取错误!");
}
@ -889,13 +890,13 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("获取二维码错误!");
}
// TODO 处理日志
// log.info("【金四服务类】【金财数科】【获取二维码】API请求成功,外部报文返回code。返回信息:{}", result);
// log.info("【金四服务类】【数科】【获取二维码】API请求成功,外部报文返回code。返回信息:{}", result);
// return AjaxResult.success(result);
}
@ -950,7 +951,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【单张发票查询】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【单张发票查询】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("发票查询错误");
}
@ -1008,7 +1009,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【获取发票打印XML】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【获取发票打印XML】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("获取发票打印XML错误!");
}
@ -1093,7 +1094,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【快速红冲】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【快速红冲】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("快速红冲错误!");
}
@ -1152,7 +1153,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【蓝字统计】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【蓝字统计】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("发票统计错误!");
}
}
@ -1211,7 +1212,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【审核红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【审核红字信息表】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("审核红字信息表错误!");
}
@ -1262,7 +1263,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【查询红字申请表明细】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【查询红字申请表明细】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("查询红字申请表明细错误!");
}
@ -1388,7 +1389,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
// 返回数据
response.put("data", invoice);
} else {
log.error("【金四服务类】【金财数科】【通用查询接口】API请求异常,billInfo未查询到,requestId={}。", requestId);
log.error("【金四服务类】【数科】【通用查询接口】API请求异常,billInfo未查询到,requestId={}。", requestId);
return new HXResponse("查询错误!");
}
}
@ -1577,7 +1578,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【金财数科】【通用查询接口】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
log.error("【金四服务类】【数科】【通用查询接口】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("通用查询接口异常");
}
}
@ -1597,6 +1598,54 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService {
return null;
}
/** 获取人脸识别结果 */
@Override
public HXResponse qrcodeResult(JSONObject decryptResult, Companyservice companyservice) {
cn.hutool.json.JSONObject result = null;
try {
InvoiceAllQycodeResultDTO qycodeResultDTO = BeanUtil.copyProperties(decryptResult,InvoiceAllQycodeResultDTO.class);
if(BeanUtil.isEmpty(qycodeResultDTO)){
return new HXResponse("参数为空!");
}
// 查询用户登记参数
InvoiceAllYhdj yhdj = getUserInfo(companyservice);
if (BeanUtil.isEmpty(yhdj)) {
return new HXResponse("未查询到登记信息!");
}
// 组装报文
QycodeResultTWODTO qycodeResultTWODTO = new QycodeResultTWODTO();
qycodeResultTWODTO.setAsync("true");
qycodeResultTWODTO.setBsrysfzjhm(yhdj.getBsrysfzjhm());
qycodeResultTWODTO.setDqbm(yhdj.getDqbm());
qycodeResultTWODTO.setNsrsbh(yhdj.getNsrsbh());
QycodeResultJsonDataTWODTO qycodeResultJsonDataTWODTO = BeanUtil.copyProperties(qycodeResultDTO,QycodeResultJsonDataTWODTO.class);
qycodeResultTWODTO.setJsonData(qycodeResultJsonDataTWODTO);
result = ApiHttp.request(WebServiceConstant.HQRLSBJG, WebServiceConstant.URL, qycodeResultDTO, 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)) {
InvoiceAllQycodeResultVO qycodeResultVO = BeanUtil.copyProperties(data,InvoiceAllQycodeResultVO.class);
HXResponse response = new HXResponse("0000", "请求成功", qycodeResultVO);
return response;
} else {
return new HXResponse(msg);
}
} catch (Exception e) {
e.printStackTrace();
log.error("【金四服务类】【数科】【获取人脸识别结果】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage());
return new HXResponse("获取二维码错误!");
}
}
/**
* 简税和金财数科 发票类型互换
*

Loading…
Cancel
Save