|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.jianshui.invoice.service.impl.api; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
@ -22,6 +23,8 @@ 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.aisino.console.*; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.aisino.console.vehicle.TaxEquipmentInfo; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.aisino.console.vehicle.VehicleInvoiceExpBo; |
|
|
|
|
import com.jianshui.invoice.domain.ele.EleNewMessage; |
|
|
|
|
import com.jianshui.invoice.domain.vo.api.aisino.console.AisinoConsoleInvoiceAddVO; |
|
|
|
|
import com.jianshui.invoice.mapper.BillInfoMapper; |
|
|
|
@ -77,12 +80,12 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
public HXResponse addInvoice(BillInfo billInfo, Companyservice companyservice) throws IllegalAccessException, InstantiationException { |
|
|
|
|
|
|
|
|
|
// 订单号唯一校验 start
|
|
|
|
|
String outNO = billInfo.getOutTradeOrderno() != null ? billInfo.getOutTradeOrderno():""; |
|
|
|
|
if(StrUtil.isEmpty(outNO)){ |
|
|
|
|
String outNO = billInfo.getOutTradeOrderno() != null ? billInfo.getOutTradeOrderno() : ""; |
|
|
|
|
if (StrUtil.isEmpty(outNO)) { |
|
|
|
|
return new HXResponse("订单号为空,请检查报文!"); |
|
|
|
|
} |
|
|
|
|
BillInfo billInfoValidate = billInfoMapper.selectByOutTradeOrderno(companyservice.getCompanyid(),outNO); |
|
|
|
|
if(BeanUtil.isNotEmpty(billInfoValidate)){ |
|
|
|
|
BillInfo billInfoValidate = billInfoMapper.selectByOutTradeOrderno(companyservice.getCompanyid(), outNO); |
|
|
|
|
if (BeanUtil.isNotEmpty(billInfoValidate)) { |
|
|
|
|
return new HXResponse("订单号不允许重复!!!"); |
|
|
|
|
} |
|
|
|
|
// end
|
|
|
|
@ -116,13 +119,13 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setInvoiceType(invoceTypeTemp); |
|
|
|
|
|
|
|
|
|
//购方地址电话
|
|
|
|
|
String buyerAddress = billInfo.getBuyerAddress() != null ? billInfo.getBuyerAddress(): ""; |
|
|
|
|
String buyerTelPhone = billInfo.getBuyerTelephone() !=null ? billInfo.getBuyerTelephone(): ""; |
|
|
|
|
String buyerAddress = billInfo.getBuyerAddress() != null ? billInfo.getBuyerAddress() : ""; |
|
|
|
|
String buyerTelPhone = billInfo.getBuyerTelephone() != null ? billInfo.getBuyerTelephone() : ""; |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setCustomerAddressTel(buyerAddress + buyerTelPhone); |
|
|
|
|
|
|
|
|
|
//购方银行账户
|
|
|
|
|
String buyerBank = billInfo.getBuyerBank() != null ? billInfo.getBuyerBank():""; |
|
|
|
|
String buyerAccount = billInfo.getBuyerAccount() !=null ? billInfo.getBuyerAccount():""; |
|
|
|
|
String buyerBank = billInfo.getBuyerBank() != null ? billInfo.getBuyerBank() : ""; |
|
|
|
|
String buyerAccount = billInfo.getBuyerAccount() != null ? billInfo.getBuyerAccount() : ""; |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setCustomerBankAccountNr(buyerBank + buyerAccount); |
|
|
|
|
|
|
|
|
|
//销方银行账户
|
|
|
|
@ -181,14 +184,14 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//处理备注
|
|
|
|
|
String kpType = billInfo.getKptype() == null ? "":billInfo.getKptype() ; |
|
|
|
|
String redInvoiceCode = billInfo.getRedInvoiceInfoCode() == null ? "":billInfo.getRedInvoiceInfoCode(); |
|
|
|
|
if("2".equals(kpType) && invoceTypeTemp == 0){ |
|
|
|
|
String kpType = billInfo.getKptype() == null ? "" : billInfo.getKptype(); |
|
|
|
|
String redInvoiceCode = billInfo.getRedInvoiceInfoCode() == null ? "" : billInfo.getRedInvoiceInfoCode(); |
|
|
|
|
if ("2".equals(kpType) && invoceTypeTemp == 0) { |
|
|
|
|
//专票:红字信息表编号 开具红字发票:备注中注明“开具红字增值税专用发票信息表编号 XXXXXXXXXXXXXXXX”
|
|
|
|
|
aisinoConsoleInvoiceAddDTO.setMemo("开具红字增值税专用发票信息表编号"+redInvoiceCode); |
|
|
|
|
}else if("2".equals(kpType) && invoceTypeTemp == 2){ |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setMemo("开具红字增值税专用发票信息表编号" + redInvoiceCode); |
|
|
|
|
} else if ("2".equals(kpType) && invoceTypeTemp == 2) { |
|
|
|
|
//普票:开具负数发票(普通发票负数发票):备注中注明“对应正数发票代码 XXXXXXXXXX 号 码 YYYYYYYY”字样,其中“X”为发票左上角 10 或是 12 位代码数字,“Y”为发票右上角 8位号码数字
|
|
|
|
|
aisinoConsoleInvoiceAddDTO.setMemo("对应正数发票代码"+billInfo.getOriginFpdm()+"号码"+billInfo.getOriginFphm()); |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setMemo("对应正数发票代码" + billInfo.getOriginFpdm() + "号码" + billInfo.getOriginFphm()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//明细处理前条件校验
|
|
|
|
@ -196,7 +199,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
//发票明细处理
|
|
|
|
|
List<AisinoConsoleInvoiceAddDetailDTO> invoiceItems = new ArrayList<>(); |
|
|
|
|
List<Map<String,Object>> listMap = new ArrayList<>(); |
|
|
|
|
List<Map<String, Object>> listMap = new ArrayList<>(); |
|
|
|
|
for (BillDetail billDetail : billDetailList) { |
|
|
|
|
AisinoConsoleInvoiceAddDetailDTO addDetailDTO = BeanUtil.copyProperties(billDetail, AisinoConsoleInvoiceAddDetailDTO.class); |
|
|
|
|
|
|
|
|
@ -225,10 +228,10 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
Integer yhzcbs = billDetail.getYhzcbs(); |
|
|
|
|
if (yhzcbs == null) { |
|
|
|
|
return new HXResponse("优惠政策标识不存在!"); |
|
|
|
|
}else if(yhzcbs == 1){ |
|
|
|
|
} else if (yhzcbs == 1) { |
|
|
|
|
//享受优惠政策内容
|
|
|
|
|
String zzstsgl = billDetail.getZzstsgl(); |
|
|
|
|
if(StrUtil.isEmpty(zzstsgl)){ |
|
|
|
|
if (StrUtil.isEmpty(zzstsgl)) { |
|
|
|
|
return new HXResponse("优惠政策内容未填写!"); |
|
|
|
|
} |
|
|
|
|
addDetailDTO.setTaxPreCon(billDetail.getZzstsgl()); |
|
|
|
@ -239,7 +242,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(addDetailDTO, companyservice, null); |
|
|
|
|
invoiceItems.add(addDetailDTO); |
|
|
|
|
Map<String,Object> mapDetail = BeanToMapUtils.fastJsonBean2Map(addDetailDTO); |
|
|
|
|
Map<String, Object> mapDetail = BeanToMapUtils.fastJsonBean2Map(addDetailDTO); |
|
|
|
|
listMap.add(mapDetail); |
|
|
|
|
} |
|
|
|
|
aisinoConsoleInvoiceAddDTO.setInvoiceItems(invoiceItems); |
|
|
|
@ -248,8 +251,8 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
AjaxResult ajaxResult = null; |
|
|
|
|
try { |
|
|
|
|
//hutool的beancopy别名会与JSONUTIl冲突
|
|
|
|
|
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(aisinoConsoleInvoiceAddDTO); |
|
|
|
|
map.put("invoiceItems",listMap); |
|
|
|
|
Map<String, Object> map = BeanToMapUtils.fastJsonBean2Map(aisinoConsoleInvoiceAddDTO); |
|
|
|
|
map.put("invoiceItems", listMap); |
|
|
|
|
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.INVOICE_ADD, JSONUtil.parse(map), companyservice); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票开具】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(aisinoConsoleInvoiceAddDTO).toString(), JSONObject.toJSONString(companyservice)); |
|
|
|
@ -268,11 +271,11 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
|
|
|
|
if ("4011".equals(retcode)) { |
|
|
|
|
//回写发票代码、发票号码信息
|
|
|
|
|
if(StrUtil.isEmpty(retmsg)){ |
|
|
|
|
if (StrUtil.isEmpty(retmsg)) { |
|
|
|
|
return new HXResponse(retcode); |
|
|
|
|
} |
|
|
|
|
AisinoConsoleInvoiceAddVO aisinoConsoleInvoiceAddVO = BeanUtil.copyProperties(resultJSON, AisinoConsoleInvoiceAddVO.class); |
|
|
|
|
if(StrUtil.isEmpty(aisinoConsoleInvoiceAddVO.getInfoNumber())){ |
|
|
|
|
if (StrUtil.isEmpty(aisinoConsoleInvoiceAddVO.getInfoNumber())) { |
|
|
|
|
throw new JianshuiServiceException("开具的发票号码不存在!"); |
|
|
|
|
} |
|
|
|
|
//更新发票状态
|
|
|
|
@ -280,8 +283,8 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
billInfoMapper.updateBillInfo(billInfo); |
|
|
|
|
|
|
|
|
|
//插入invoice
|
|
|
|
|
Invoice invoice = BeanUtil.copyProperties(billInfo,Invoice.class); |
|
|
|
|
List<InvoiceDetail> invoiceDetailList = BeanUtil.copyToList(billInfo.getBillDetailList(),InvoiceDetail.class); |
|
|
|
|
Invoice invoice = BeanUtil.copyProperties(billInfo, Invoice.class); |
|
|
|
|
List<InvoiceDetail> invoiceDetailList = BeanUtil.copyToList(billInfo.getBillDetailList(), InvoiceDetail.class); |
|
|
|
|
invoice.setInvoiceDetailList(invoiceDetailList); |
|
|
|
|
|
|
|
|
|
//发票代码
|
|
|
|
@ -302,15 +305,15 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
long id = 0L; |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("fpdm",invoice.getFpdm()).eq("fphm",invoice.getFphm()); |
|
|
|
|
invoiceQueryWrapper.eq("fpdm", invoice.getFpdm()).eq("fphm", invoice.getFphm()); |
|
|
|
|
List<Invoice> invoices = invoiceMapper.selectList(invoiceQueryWrapper); |
|
|
|
|
if(CollectionUtils.isEmpty(invoices)){ |
|
|
|
|
if (CollectionUtils.isEmpty(invoices)) { |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
invoices = invoiceMapper.selectList(invoiceQueryWrapper); |
|
|
|
|
id = invoices.get(0).getId(); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
Invoice invoiceT = invoices.get(0); |
|
|
|
|
invoiceT = BeanUtil.copyProperties(invoice,Invoice.class); |
|
|
|
|
invoiceT = BeanUtil.copyProperties(invoice, Invoice.class); |
|
|
|
|
invoiceMapper.updateInvoice(invoiceT); |
|
|
|
|
id = invoiceT.getId(); |
|
|
|
|
} |
|
|
|
@ -321,9 +324,9 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
// TODO: 2023/9/26 增加主动回调方式,可配置
|
|
|
|
|
ICompanyservicePropService companyserviceProp = SpringUtils.getBean(ICompanyservicePropService.class); |
|
|
|
|
CompanyserviceProp secretIdProp = companyserviceProp.selectPropByKey(companyservice.getCompanyid(), "aisino_callback_url"); |
|
|
|
|
if(BeanUtil.isNotEmpty(secretIdProp) && secretIdProp.getValue() != null && !"".equals(secretIdProp.getValue())){ |
|
|
|
|
if (BeanUtil.isNotEmpty(secretIdProp) && secretIdProp.getValue() != null && !"".equals(secretIdProp.getValue())) { |
|
|
|
|
String callBackUrl = secretIdProp.getValue(); |
|
|
|
|
callBackAisino(callBackUrl,invoice.getId()); |
|
|
|
|
callBackAisino(callBackUrl, invoice.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功"); |
|
|
|
@ -337,28 +340,29 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
/** |
|
|
|
|
* 开票接口回调-重汽 |
|
|
|
|
* 2023-09-26 |
|
|
|
|
* |
|
|
|
|
* @param callBackUrl |
|
|
|
|
* @param id |
|
|
|
|
*/ |
|
|
|
|
private void callBackAisino(String callBackUrl, Long id) { |
|
|
|
|
|
|
|
|
|
if(id == null){ |
|
|
|
|
if (id == null) { |
|
|
|
|
log.info("【控制台】发票回调,id为空"); |
|
|
|
|
return ; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Invoice invoice = invoiceMapper.selectInvoiceById(id); |
|
|
|
|
if (invoice == null) { |
|
|
|
|
log.info("【控制台】发票信息未查询到,id={}",id); |
|
|
|
|
return ; |
|
|
|
|
log.info("【控制台】发票信息未查询到,id={}", id); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据开始,id={}",id); |
|
|
|
|
String result = HttpUtil.post(callBackUrl,JSONUtil.toJsonStr(invoice)); |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据结束,id={},接口返回信息={}",id,JSONUtil.toJsonStr(invoice)); |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据开始,id={}", id); |
|
|
|
|
String result = HttpUtil.post(callBackUrl, JSONUtil.toJsonStr(invoice)); |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据结束,id={},接口返回信息={}", id, JSONUtil.toJsonStr(invoice)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据异常,id={}",id); |
|
|
|
|
log.info("【控制台】发票回调接口,发送数据异常,id={}", id); |
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -367,11 +371,12 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发票打印 |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/29 13:48 |
|
|
|
|
* |
|
|
|
|
* @param invoice |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return com.jianshui.common.core.domain.AjaxResult |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/29 13:48 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public AjaxResult printInvoice(Invoice invoice, Companyservice companyservice) { |
|
|
|
@ -381,11 +386,12 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发票作废 |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/30 9:43 |
|
|
|
|
* |
|
|
|
|
* @param invoice |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return com.jianshui.invoice.domain.dto.HXResponse |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/30 9:43 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse deprecateInvoice(JSONObject invoice, Companyservice companyservice) { |
|
|
|
@ -411,7 +417,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
throw new JianshuiParamErrorException(ErrorCode.INVOICE_NOT_EXISTS, companyservice, "invoice"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AisinoConsoleInvolidDTO consoleInvolidDTO = BeanUtil.copyProperties(invoiceTemp,AisinoConsoleInvolidDTO.class); |
|
|
|
|
AisinoConsoleInvolidDTO consoleInvolidDTO = BeanUtil.copyProperties(invoiceTemp, AisinoConsoleInvolidDTO.class); |
|
|
|
|
|
|
|
|
|
//发票类型
|
|
|
|
|
Integer invoceTypeTemp = CovertInvoiceType(invoiceTemp.getInvoiceType()); |
|
|
|
@ -420,14 +426,14 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
consoleInvolidDTO.setInfoKind(invoceTypeTemp); |
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(consoleInvolidDTO,companyservice,null); |
|
|
|
|
ValidateUtils.validate(consoleInvolidDTO, companyservice, null); |
|
|
|
|
|
|
|
|
|
//发起请求
|
|
|
|
|
AjaxResult ajaxResult = null; |
|
|
|
|
try{ |
|
|
|
|
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(consoleInvolidDTO); |
|
|
|
|
try { |
|
|
|
|
Map<String, Object> map = BeanToMapUtils.fastJsonBean2Map(consoleInvolidDTO); |
|
|
|
|
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.INVOICE_INVOLID, JSONUtil.parse(map), companyservice); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(consoleInvolidDTO).toString(), JSONObject.toJSONString(companyservice)); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new JianshuiServiceException("系统异常!"); |
|
|
|
@ -441,7 +447,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); |
|
|
|
|
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; |
|
|
|
|
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
|
|
|
|
if("6011".equals(retcode)){ |
|
|
|
|
if ("6011".equals(retcode)) { |
|
|
|
|
// 修改原有发票状态为已作废
|
|
|
|
|
invoiceTemp.setState(3); |
|
|
|
|
invoiceMapper.updateInvoice(invoiceTemp); |
|
|
|
@ -455,7 +461,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
billInfoMapper.updateBillInfo(originBillInfo); |
|
|
|
|
} |
|
|
|
|
return new HXResponse("0000", "作废完成", null, false); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
return new HXResponse(retmsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -469,6 +475,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 单个发票查询 |
|
|
|
|
* |
|
|
|
|
* @param billInfo |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
@ -502,7 +509,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
HXResponse response = new HXResponse("9998", "发票信息不存在", tempInvoice); |
|
|
|
|
return response; |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -512,6 +519,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发票批量查询 |
|
|
|
|
* |
|
|
|
|
* @param billInfo |
|
|
|
|
* @param byWhat |
|
|
|
|
* @param companyservice |
|
|
|
@ -593,7 +601,6 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public HXResponse getRpaAuthStatus(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
return null; |
|
|
|
@ -604,7 +611,9 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 红字信息表上传*/ |
|
|
|
|
/** |
|
|
|
|
* 红字信息表上传 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse uploadRedInfo(Redinfo redinfo, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
@ -650,7 +659,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
// TODO: 2023/3/9 设备号是 jspbh 并非billNO? 申请方税号reqnsrsbh
|
|
|
|
|
//
|
|
|
|
|
redinfo.setJspbh("661024643068230218103524".substring(0,12)); |
|
|
|
|
redinfo.setJspbh("661024643068230218103524".substring(0, 12)); |
|
|
|
|
redinfo.setReqnsrsbh("9113093067851155XY"); |
|
|
|
|
redinfo.setFjh("123"); |
|
|
|
|
redinfo.setMultTaxRate("0"); |
|
|
|
@ -662,7 +671,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
redinfoMapper.batchRedinfodetail(redinfodetailList); |
|
|
|
|
|
|
|
|
|
// 参数校验及参数处理
|
|
|
|
|
AisinoConsoleInvoiceRedUploadDTO redUploadDTO = BeanUtil.copyProperties(redinfo,AisinoConsoleInvoiceRedUploadDTO.class); |
|
|
|
|
AisinoConsoleInvoiceRedUploadDTO redUploadDTO = BeanUtil.copyProperties(redinfo, AisinoConsoleInvoiceRedUploadDTO.class); |
|
|
|
|
// 填开日期
|
|
|
|
|
redUploadDTO.setDate(redinfo.getBillInputTime()); |
|
|
|
|
// 信息表类型
|
|
|
|
@ -677,18 +686,17 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
ValidateUtils.validate(redUploadDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(redinfo.getRedinfodetailList() == null || redinfo.getRedinfodetailList().size() == 0){ |
|
|
|
|
if (redinfo.getRedinfodetailList() == null || redinfo.getRedinfodetailList().size() == 0) { |
|
|
|
|
return new HXResponse("格式校验失败,请上传明细信息!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String paramChild = ""; |
|
|
|
|
List<AisinoConsoleInvoiceRedUploadChildDTO> redUploadChildDTO = BeanUtil.copyToList(redinfo.getRedinfodetailList(),AisinoConsoleInvoiceRedUploadChildDTO.class); |
|
|
|
|
List<AisinoConsoleInvoiceRedUploadChildDTO> redUploadChildDTO = BeanUtil.copyToList(redinfo.getRedinfodetailList(), AisinoConsoleInvoiceRedUploadChildDTO.class); |
|
|
|
|
for (AisinoConsoleInvoiceRedUploadChildDTO childDTO : redUploadChildDTO) { |
|
|
|
|
|
|
|
|
|
// TODO-dxk: 2023/2/27 含税、不含税金额
|
|
|
|
|
childDTO.setHS_BZ(childDTO.getHS_BZ().equals("false")? "N":"Y"); |
|
|
|
|
childDTO.setHS_BZ(childDTO.getHS_BZ().equals("false") ? "N" : "Y"); |
|
|
|
|
|
|
|
|
|
paramChild = "<GoodsMx>" + JSONUtil.toXmlStr(JSONUtil.parse(childDTO)) + " </GoodsMx>"; |
|
|
|
|
|
|
|
|
@ -716,10 +724,10 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
//发起请求
|
|
|
|
|
AjaxResult ajaxResult = null; |
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.RED_UPLOAD, param, companyservice); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}","", JSONObject.toJSONString(companyservice)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}", "", JSONObject.toJSONString(companyservice)); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new JianshuiServiceException("系统异常!"); |
|
|
|
|
} |
|
|
|
@ -755,7 +763,9 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** 红字信息表下载 */ |
|
|
|
|
/** |
|
|
|
|
* 红字信息表下载 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse downloadRedInfo(DownloadRedInfoDTO downloadRedInfoDTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
@ -794,7 +804,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 组装报文
|
|
|
|
|
AisinoConsoleInvoiceRedDownloadDTO downloadDTO = BeanUtil.copyProperties(redInfoResult,AisinoConsoleInvoiceRedDownloadDTO.class); |
|
|
|
|
AisinoConsoleInvoiceRedDownloadDTO downloadDTO = BeanUtil.copyProperties(redInfoResult, AisinoConsoleInvoiceRedDownloadDTO.class); |
|
|
|
|
downloadDTO.setYQZT("N"); |
|
|
|
|
downloadDTO.setXXBFW("0"); |
|
|
|
|
downloadDTO.setPAGENO("1"); |
|
|
|
@ -808,10 +818,10 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
//发起请求
|
|
|
|
|
AjaxResult ajaxResult = null; |
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.RED_DOWLOAD, param, companyservice); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}","", JSONObject.toJSONString(companyservice)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票作废】发票请求异常,请求报文{},销方信息{}", "", JSONObject.toJSONString(companyservice)); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new JianshuiServiceException("系统异常!"); |
|
|
|
|
} |
|
|
|
@ -863,6 +873,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 打印机查询 |
|
|
|
|
* |
|
|
|
|
* @param queryPrinterDTO |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
@ -872,11 +883,11 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
List<SkDyj> skDyjList = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
|
QueryWrapper<SkDyj> skDyjQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
if(StrUtil.isNotEmpty(companyservice.getSellertax())){ |
|
|
|
|
skDyjQueryWrapper.eq("NSRSBH",companyservice.getSellertax()); |
|
|
|
|
if (StrUtil.isNotEmpty(companyservice.getSellertax())) { |
|
|
|
|
skDyjQueryWrapper.eq("NSRSBH", companyservice.getSellertax()); |
|
|
|
|
} |
|
|
|
|
if(StrUtil.isNotEmpty(queryPrinterDTO.getPrinterName())){ |
|
|
|
|
skDyjQueryWrapper.eq("MC",queryPrinterDTO.getPrinterName()); |
|
|
|
|
if (StrUtil.isNotEmpty(queryPrinterDTO.getPrinterName())) { |
|
|
|
|
skDyjQueryWrapper.eq("MC", queryPrinterDTO.getPrinterName()); |
|
|
|
|
} |
|
|
|
|
skDyjList = skDyjMapper.selectList(skDyjQueryWrapper); |
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -885,7 +896,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
throw new JianshuiServiceException("系统异常!"); |
|
|
|
|
} |
|
|
|
|
log.info("【销项发票】【大象发票】打印机查询请求结果{}", skDyjList.toString()); |
|
|
|
|
List<SkDyjVO> skDyjVO = BeanUtil.copyToList(skDyjList,SkDyjVO.class); |
|
|
|
|
List<SkDyjVO> skDyjVO = BeanUtil.copyToList(skDyjList, SkDyjVO.class); |
|
|
|
|
return new HXResponse("0000", "操作完成", skDyjList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -896,6 +907,7 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 发票打印 |
|
|
|
|
* |
|
|
|
|
* @param printDTO |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
@ -903,43 +915,43 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
@Override |
|
|
|
|
public HXResponse batchPrint(PrintDTO printDTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
if(BeanUtil.isEmpty(printDTO) ||CollectionUtils.isEmpty(printDTO.getDetails())){ |
|
|
|
|
if (BeanUtil.isEmpty(printDTO) || CollectionUtils.isEmpty(printDTO.getDetails())) { |
|
|
|
|
throw new JianshuiParamErrorException(ErrorCode.EMPTY_PARAMS, companyservice, "invoice"); |
|
|
|
|
} |
|
|
|
|
if(StrUtil.isEmpty(printDTO.getFpbs())){ |
|
|
|
|
throw new JianshuiParamErrorException(ErrorCode.EMPTY_PARAMS,companyservice,"发票标识不存在!"); |
|
|
|
|
if (StrUtil.isEmpty(printDTO.getFpbs())) { |
|
|
|
|
throw new JianshuiParamErrorException(ErrorCode.EMPTY_PARAMS, companyservice, "发票标识不存在!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<PrintDetailDTO> details = printDTO.getDetails(); |
|
|
|
|
|
|
|
|
|
//返回信息处理
|
|
|
|
|
for (PrintDetailDTO detail : details) { |
|
|
|
|
Map<String,String> result = new HashMap<>(); |
|
|
|
|
Map<String, String> result = new HashMap<>(); |
|
|
|
|
//报文组装
|
|
|
|
|
AisinoConsolePrintInvoiceDTO printInvoiceDTO = BeanUtil.copyProperties(detail,AisinoConsolePrintInvoiceDTO.class); |
|
|
|
|
AisinoConsolePrintInvoiceDTO printInvoiceDTO = BeanUtil.copyProperties(detail, AisinoConsolePrintInvoiceDTO.class); |
|
|
|
|
|
|
|
|
|
if(!detail.getFpqh().equals(detail.getFpzh())){ |
|
|
|
|
result.put("9999","发票打印失败,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()+",原因=发票号码传参错误"); |
|
|
|
|
if (!detail.getFpqh().equals(detail.getFpzh())) { |
|
|
|
|
result.put("9999", "发票打印失败,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode() + ",原因=发票号码传参错误"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//发票类型
|
|
|
|
|
Integer invoceTypeTemp = CovertInvoiceType(detail.getInvoiceType()); |
|
|
|
|
if (invoceTypeTemp == -1) { |
|
|
|
|
result.put("9999","发票打印失败,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()+",原因=发票类型未匹配"); |
|
|
|
|
result.put("9999", "发票打印失败,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode() + ",原因=发票类型未匹配"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
printInvoiceDTO.setInfoKind(invoceTypeTemp); |
|
|
|
|
|
|
|
|
|
//必填参数校验
|
|
|
|
|
ValidateUtils.validate(printInvoiceDTO,companyservice,null); |
|
|
|
|
ValidateUtils.validate(printInvoiceDTO, companyservice, null); |
|
|
|
|
|
|
|
|
|
// 处理打印标识
|
|
|
|
|
String fpbs = printDTO.getFpbs(); |
|
|
|
|
if("0".equals(fpbs)){ |
|
|
|
|
fpbs = "1"; |
|
|
|
|
}else if("1".equals(fpbs)){ |
|
|
|
|
if ("0".equals(fpbs)) { |
|
|
|
|
fpbs = "1"; |
|
|
|
|
} else if ("1".equals(fpbs)) { |
|
|
|
|
fpbs = "0"; |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
fpbs = "0"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -949,25 +961,26 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
//发起请求
|
|
|
|
|
AjaxResult ajaxResult = null; |
|
|
|
|
try { |
|
|
|
|
Map<String,Object> map = BeanToMapUtils.fastJsonBean2Map(printInvoiceDTO); |
|
|
|
|
Map<String, Object> map = BeanToMapUtils.fastJsonBean2Map(printInvoiceDTO); |
|
|
|
|
ajaxResult = AisinoConsoleUtil.sendRequest(AisinoConsoleConstants.INVOICE_PRINT, JSONUtil.parse(map), companyservice); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【销项发票】【总部控制台接口】【发票打印】发票请求异常,请求报文{},销方信息{}", JSONUtil.parse(printInvoiceDTO).toString(), JSONObject.toJSONString(companyservice)); |
|
|
|
|
result.put("9999","发票打印失败,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()+",原因=系统原因"); |
|
|
|
|
result.put("9999", "发票打印失败,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode() + ",原因=系统原因"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//返回报文解析
|
|
|
|
|
if (ajaxResult.isError()) { |
|
|
|
|
result.put("9999","发票打印失败,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()+",原因="+ajaxResult.getMsg());; |
|
|
|
|
result.put("9999", "发票打印失败,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode() + ",原因=" + ajaxResult.getMsg()); |
|
|
|
|
; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject resultJSON = JSONUtil.parseObj(ajaxResult.get("data")); |
|
|
|
|
String retcode = resultJSON.get("retcode") != null ? resultJSON.get("retcode").toString() : ""; |
|
|
|
|
String retmsg = resultJSON.get("retmsg") != null ? resultJSON.get("retmsg").toString() : ""; |
|
|
|
|
if("5011".equals(retcode)){ |
|
|
|
|
return new HXResponse("0000","发票打印成功,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()); |
|
|
|
|
}else{ |
|
|
|
|
return new HXResponse("发票打印失败,发票号码="+printInvoiceDTO.getInfoNumber()+",发票代码="+printInvoiceDTO.getInfoTypeCode()+",原因="+retmsg); |
|
|
|
|
if ("5011".equals(retcode)) { |
|
|
|
|
return new HXResponse("0000", "发票打印成功,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode()); |
|
|
|
|
} else { |
|
|
|
|
return new HXResponse("发票打印失败,发票号码=" + printInvoiceDTO.getInfoNumber() + ",发票代码=" + printInvoiceDTO.getInfoTypeCode() + ",原因=" + retmsg); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1034,16 +1047,17 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 总部控制台转简税发票类型 |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/29 17:12 |
|
|
|
|
* |
|
|
|
|
* @param invoiceType |
|
|
|
|
* @return java.lang.String |
|
|
|
|
* @author dxk |
|
|
|
|
* @date 2022/6/29 17:12 |
|
|
|
|
*/ |
|
|
|
|
public static String CovertInvoiceTypeReverse(String invoiceType){ |
|
|
|
|
public static String CovertInvoiceTypeReverse(String invoiceType) { |
|
|
|
|
|
|
|
|
|
if(invoiceType.equals("2")){ |
|
|
|
|
if (invoiceType.equals("2")) { |
|
|
|
|
return "p"; |
|
|
|
|
}else if(invoiceType.equals("0")){ |
|
|
|
|
} else if (invoiceType.equals("0")) { |
|
|
|
|
return "s"; |
|
|
|
|
} |
|
|
|
|
return ""; |
|
|
|
@ -1120,4 +1134,143 @@ public class AisinoConsoleInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 机动车加密接口(走的大象,重汽用控制台) |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse exportVehicleInvoice(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
// 转换实体参数
|
|
|
|
|
VehicleInvoiceExpBo vehicleInvoiceExpBo = BeanUtil.copyProperties(decryptResult, VehicleInvoiceExpBo.class); |
|
|
|
|
|
|
|
|
|
// TODO: 2023/10/8 迁移大象 迁移税控 找测试数据
|
|
|
|
|
if (Objects.isNull(vehicleInvoiceExpBo)) { |
|
|
|
|
log.info("请求参数为空"); |
|
|
|
|
} |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(vehicleInvoiceExpBo.getNsrsbh())) { |
|
|
|
|
log.info("纳税人识别号为空"); |
|
|
|
|
} |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(vehicleInvoiceExpBo.getFjh())) { |
|
|
|
|
log.info("分机号为空"); |
|
|
|
|
} |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(vehicleInvoiceExpBo.getQqsj())) { |
|
|
|
|
log.info("起始时间为空"); |
|
|
|
|
} |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(vehicleInvoiceExpBo.getZzsj())) { |
|
|
|
|
log.info("终止时间为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String data = exportVehicleInvoice(vehicleInvoiceExpBo); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(data)) { |
|
|
|
|
log.error("{}机动车加密数据导出,加密数据为空", ""); |
|
|
|
|
data = ""; |
|
|
|
|
} |
|
|
|
|
String fileName = "机动车专用发票明细" + "_" + vehicleInvoiceExpBo.getFjh() |
|
|
|
|
+ (vehicleInvoiceExpBo.getQqsj() + "-" + vehicleInvoiceExpBo.getZzsj()) + ".dat"; |
|
|
|
|
|
|
|
|
|
// TODO: 2023/10/8 输出到页面
|
|
|
|
|
// 浏览器处理乱码问题
|
|
|
|
|
/*String userAgent = request.getHeader(HttpHeaders.USER_AGENT); |
|
|
|
|
try { |
|
|
|
|
//IE浏览器
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.contains(userAgent, ConfigureConstant.REQUEST_HEAD_USER_AGENT_TYPE_MSIE) |
|
|
|
|
|| org.apache.commons.lang3.StringUtils.contains(userAgent, ConfigureConstant.REQUEST_HEAD_USER_AGENT_TYPE_TRIDENT)) { |
|
|
|
|
fileName = URLEncoder.encode(fileName, "UTF8"); |
|
|
|
|
log.debug("{}IE浏览器下载", LOGGER_MSG); |
|
|
|
|
|
|
|
|
|
} else if (org.apache.commons.lang3.StringUtils.contains(userAgent, ConfigureConstant.REQUEST_HEAD_USER_AGENT_TYPE_MOZILLA)) { |
|
|
|
|
//google,火狐浏览器
|
|
|
|
|
fileName = new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1"); |
|
|
|
|
} else { |
|
|
|
|
//其他浏览器
|
|
|
|
|
fileName = URLEncoder.encode(fileName, "UTF8"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
|
|
|
|
response.setHeader("fileName", fileName); |
|
|
|
|
response.getOutputStream().write(Base64Encoding.decode(data)); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.error("{}机动车导出加密数据异常:{}", LOGGER_MSG, e); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 1.调用税控获取信息 |
|
|
|
|
* |
|
|
|
|
* @param vehicleInvoiceExpBo |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public String exportVehicleInvoice(VehicleInvoiceExpBo vehicleInvoiceExpBo) { |
|
|
|
|
//1.调用税控获取终端代码
|
|
|
|
|
String terminalCode = getTerminalCode(vehicleInvoiceExpBo.getNsrsbh(), vehicleInvoiceExpBo.getEntId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* String requestUrl = invoiceConfig.configVehicleInvoiceExp(); |
|
|
|
|
VehicleInvoiceExpResponse response = HttpInvoiceRequestUtil.vehicleInvoiceExp(requestUrl, vehicleInvoiceExpBo, terminalCode); |
|
|
|
|
log.info("机动车导出加密数据 税控底层返回结果:" + JSONUtil.toJsonStr(response)); |
|
|
|
|
if (Objects.isNull(response)) { |
|
|
|
|
log.error("机动车加密数据导出税控返回结果为空!"); |
|
|
|
|
} else { |
|
|
|
|
if (!response.getCode().equals(ConfigureConstant.STRING_0000)) { |
|
|
|
|
log.error("机动车加密数据导出错误:" + response.getMsg()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return response.getVEHICLEINVOICEBUFF();*/ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 调用税控获取终端代码 |
|
|
|
|
* |
|
|
|
|
* @param nsrsbh |
|
|
|
|
* @param entId |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public String getTerminalCode(String nsrsbh, String entId) { |
|
|
|
|
TaxEquipmentInfo taxEquipmentInfo = queryTaxEquipment(nsrsbh, entId); |
|
|
|
|
if (ObjectUtil.isNotNull(taxEquipmentInfo)) { |
|
|
|
|
return taxEquipmentInfo.getSksbCode(); |
|
|
|
|
} else { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 调用基础服务获取税控设备 |
|
|
|
|
* @param nsrsbh |
|
|
|
|
* @param entId |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public TaxEquipmentInfo queryTaxEquipment(String nsrsbh, String entId) { |
|
|
|
|
TaxEquipmentInfo taxEquipmentInfo = null; |
|
|
|
|
|
|
|
|
|
/*try { |
|
|
|
|
//调用基础服务获取税控设备,基础服务封装了真实的entId
|
|
|
|
|
String configQueryTaxEquipmentUrl = baseServiceConfig.configQueryTaxEquipmentUrl(); |
|
|
|
|
PageQueryTaxEquipmentReq pageQueryTaxEquipmentReq = new PageQueryTaxEquipmentReq(); |
|
|
|
|
pageQueryTaxEquipmentReq.setNsrsbh(nsrsbh); |
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(entId)) { |
|
|
|
|
pageQueryTaxEquipmentReq.setEntId(entId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PageQueryTaxEquipmentRsp pageQueryTaxEquipmentRsp = HttpInvoiceRequestUtilBase.queryTaxEquipment(configQueryTaxEquipmentUrl, pageQueryTaxEquipmentReq); |
|
|
|
|
if (ObjectUtil.isNotNull(pageQueryTaxEquipmentRsp) && ConfigureConstant.STRING_0000.equals(pageQueryTaxEquipmentRsp.getZTDM())) { |
|
|
|
|
if (ObjectUtil.isNotNull(pageQueryTaxEquipmentRsp.getTaxEquipmentInfo())) { |
|
|
|
|
taxEquipmentInfo = pageQueryTaxEquipmentRsp.getTaxEquipmentInfo(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("{}调用基础服务获取税控设备接口异常:{}", LOGGER_MSG, e); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return taxEquipmentInfo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|