|
|
|
@ -1,29 +1,48 @@ |
|
|
|
|
package com.jianshui.income.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
|
import cn.hutool.core.util.ReUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.core.util.XmlUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.jianshui.common.core.domain.AjaxResult; |
|
|
|
|
import com.jianshui.common.core.domain.entity.Companyservice; |
|
|
|
|
import com.jianshui.common.utils.Base64Util; |
|
|
|
|
import com.jianshui.common.utils.ElephantCommonUtils; |
|
|
|
|
import com.jianshui.common.utils.InvoiceUtils; |
|
|
|
|
import com.jianshui.common.utils.StringUtils; |
|
|
|
|
import com.jianshui.common.exception.jianshui.JianshuiServiceException; |
|
|
|
|
import com.jianshui.common.utils.*; |
|
|
|
|
import com.jianshui.income.constant.elephant.ElephantConstants; |
|
|
|
|
import com.jianshui.income.domain.entity.*; |
|
|
|
|
import com.jianshui.income.domain.vo.render.*; |
|
|
|
|
import com.jianshui.income.enums.InvoiceTypeCheck; |
|
|
|
|
import com.jianshui.income.factory.ICheckServiceFactory; |
|
|
|
|
import com.jianshui.income.mapper.*; |
|
|
|
|
import com.jianshui.income.service.ICheckInvoice; |
|
|
|
|
import com.jianshui.income.utils.elephant.ElephantUtils; |
|
|
|
|
import com.jianshui.queue.utils.RedisQueueUtil; |
|
|
|
|
import com.jianshui.system.domain.CompanyserviceProp; |
|
|
|
|
import com.jianshui.system.service.ICompanyservicePropService; |
|
|
|
|
import com.jianshui.system.service.ICompanyserviceService; |
|
|
|
|
import com.jianshui.system.service.IServiceManageService; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
import org.w3c.dom.Document; |
|
|
|
|
import org.w3c.dom.Element; |
|
|
|
|
import org.w3c.dom.Node; |
|
|
|
|
import org.w3c.dom.NodeList; |
|
|
|
|
import org.xml.sax.InputSource; |
|
|
|
|
|
|
|
|
|
import javax.xml.parsers.DocumentBuilder; |
|
|
|
|
import javax.xml.parsers.DocumentBuilderFactory; |
|
|
|
|
import javax.xml.parsers.ParserConfigurationException; |
|
|
|
|
import java.io.StringReader; |
|
|
|
|
import java.text.DateFormat; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
@ -56,6 +75,19 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
private InvoiceCheckUsedCarMapper invoiceCheckUsedCarMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ICheckServiceFactory incomeServiceFactory; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IServiceManageService serviceManageService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ICompanyserviceService companyserviceService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ICompanyservicePropService companyservicePropService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return |
|
|
|
|
* @Title 单个发票校验 |
|
|
|
@ -116,7 +148,7 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
JSONObject resultContent = resultJson.getJSONObject("data"); |
|
|
|
|
if (resultContent == null) { // 如果这里为null,可能出现查验失败,大象报错有可能在最外层的returnCode里报错,也可能在data里的code报错,巨坑
|
|
|
|
|
String checkResult = resultJson.getString("code"); |
|
|
|
|
if ("0001".equals(checkResult) || "0006".equals(checkResult) || "0009".equals(checkResult) || "1005".equals(checkResult) ) { |
|
|
|
|
if ("0001".equals(checkResult) || "0006".equals(checkResult) || "0009".equals(checkResult) || "1005".equals(checkResult)) { |
|
|
|
|
// 如果需要扣费
|
|
|
|
|
robUserMoney += 1; |
|
|
|
|
} |
|
|
|
@ -129,10 +161,10 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
invoiceCheck = this.handelCheckResult(invoiceCheck, resultContent); // 批量处理一把
|
|
|
|
|
invoiceCheckMapper.updateInoviceById(invoiceCheck); |
|
|
|
|
|
|
|
|
|
List<String> cyjgList = Arrays.asList("9999", "0002", "0005", "1004", "1006", "1007", "1008", "1009","1010", "1011", "1012", "1013", "1014", "1015", "1020", "1021"); |
|
|
|
|
List<String> cyjgList = Arrays.asList("9999", "0002", "0005", "1004", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1015", "1020", "1021"); |
|
|
|
|
if (cyjgList.contains(invoiceCheck.getCyjg())) { |
|
|
|
|
log.info("单个发票校验错误结果:companyId=" + companyId + ",errorCode=" + invoiceCheck.getCyjg() + ",returnMessage=" + invoiceCheck.getCyjgxx()); |
|
|
|
|
return new AjaxResult(5,invoiceCheck.getCyjgxx()); |
|
|
|
|
return new AjaxResult(5, invoiceCheck.getCyjgxx()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// note-gong 2021/6/17 9:20 查询下数据库中是否存在相同发票;存在就判断下状态是否一致,不一致扣款;不存在就直接扣款
|
|
|
|
@ -179,9 +211,9 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
// 开始批量更新数据库 老田加的队列。这里没有。他写的队列也不对,上面已经插入过了这里还插入。SB
|
|
|
|
|
// RedisQueueUtil.build().setData(invoiceCheck).onQueue("income_result_save_consumer").retry(0).dispatch();
|
|
|
|
|
|
|
|
|
|
if (!"0001".equals(invoiceCheck.getCyjg()) ) { |
|
|
|
|
if (!"0001".equals(invoiceCheck.getCyjg())) { |
|
|
|
|
log.info("单个发票校验错误结果:companyId=" + companyId + ",data=" + data + ",errorCode=" + invoiceCheck.getCyjg() + ",returnMessage=" + invoiceCheck.getCyjgxx()); |
|
|
|
|
return new AjaxResult(Integer.parseInt(invoiceCheck.getCyjg()),invoiceCheck.getCyjgxx()); |
|
|
|
|
return new AjaxResult(Integer.parseInt(invoiceCheck.getCyjg()), invoiceCheck.getCyjgxx()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// TODO: 2023/6/7 测试关闭
|
|
|
|
@ -254,7 +286,7 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
} |
|
|
|
|
kprq = (String) tempData.get("kprq"); |
|
|
|
|
fphm = (String) tempData.get("fphm"); |
|
|
|
|
String[] fpzlList = {"01", "02", "03", "04", "10", "11", "14", "15", "08", "21", "22","61","83"}; |
|
|
|
|
String[] fpzlList = {"01", "02", "03", "04", "10", "11", "14", "15", "08", "21", "22", "61", "83"}; |
|
|
|
|
if (!Arrays.asList(fpzlList).contains(fpzl)) { // 如果不存发票种类,则挂掉
|
|
|
|
|
return AjaxResult.error(1025, "发票种类非法!"); |
|
|
|
|
} |
|
|
|
@ -687,7 +719,7 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
jym = jym.substring(jym.length() - 6, jym.length()); |
|
|
|
|
} |
|
|
|
|
fpzl = (String) data.get("fpzl"); |
|
|
|
|
String[] fpzlList = {"01", "02", "03", "04", "10", "11", "14", "15", "08", "21", "22","61","83"}; |
|
|
|
|
String[] fpzlList = {"01", "02", "03", "04", "10", "11", "14", "15", "08", "21", "22", "61", "83"}; |
|
|
|
|
if (!Arrays.asList(fpzlList).contains(fpzl)) { // 如果不存发票种类,则挂掉
|
|
|
|
|
return AjaxResult.error(1025, "发票种类非法!"); |
|
|
|
|
} |
|
|
|
@ -840,10 +872,10 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
invoiceCheckUsedCar.setCpxh(resultContent.getString("cpxh")); |
|
|
|
|
|
|
|
|
|
// 处理电子发票(航空运输电子客票行程单)
|
|
|
|
|
InvoiceCheckHangkong hangkong = BeanUtil.copyProperties(JSONUtil.parse(resultContent),InvoiceCheckHangkong.class); |
|
|
|
|
InvoiceCheckHangkong hangkong = BeanUtil.copyProperties(JSONUtil.parse(resultContent), InvoiceCheckHangkong.class); |
|
|
|
|
|
|
|
|
|
// 处理电子发票(铁路电子客票)
|
|
|
|
|
InvoiceCheckTielu tielu = BeanUtil.copyProperties(JSONUtil.parse(resultContent),InvoiceCheckTielu.class); |
|
|
|
|
InvoiceCheckTielu tielu = BeanUtil.copyProperties(JSONUtil.parse(resultContent), InvoiceCheckTielu.class); |
|
|
|
|
|
|
|
|
|
// 获取详情子类
|
|
|
|
|
int invoiceId = invoiceCheck.getId(); |
|
|
|
@ -874,7 +906,7 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
|
|
|
|
|
// 处理电子发票(航空运输电子客票行程单)
|
|
|
|
|
// 处理电子发票(铁路电子客票)
|
|
|
|
|
BeanUtil.copyProperties(detailData,tempDetail); |
|
|
|
|
BeanUtil.copyProperties(detailData, tempDetail); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detailList.add(tempDetail); |
|
|
|
@ -1103,4 +1135,481 @@ public class EleCheckInvoiceImpl implements ICheckInvoice { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getInvoice(String xmlData) throws Exception { |
|
|
|
|
|
|
|
|
|
log.info("webservice请求报文:xmlData:{}", xmlData); |
|
|
|
|
|
|
|
|
|
String cdataContent = ""; |
|
|
|
|
|
|
|
|
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
|
|
|
DocumentBuilder builder = factory.newDocumentBuilder(); |
|
|
|
|
|
|
|
|
|
// 解析XML字符串
|
|
|
|
|
Document doc = builder.parse(new InputSource(new StringReader(xmlData))); |
|
|
|
|
// 获取<arg0>元素
|
|
|
|
|
NodeList arg0Nodes = doc.getElementsByTagName("arg0"); |
|
|
|
|
|
|
|
|
|
Node arg0Node = arg0Nodes.item(0); |
|
|
|
|
cdataContent = arg0Node.getTextContent(); |
|
|
|
|
doc = builder.parse(new InputSource(new StringReader(cdataContent))); |
|
|
|
|
|
|
|
|
|
String TaxCode = transformationParam(doc, "TaxCode"); |
|
|
|
|
String Password = transformationParam(doc, "Password"); |
|
|
|
|
String InvCode = transformationParam(doc, "InvCode"); |
|
|
|
|
String InvNo = transformationParam(doc, "InvNo"); |
|
|
|
|
String InvTime = transformationParam(doc, "InvTime"); |
|
|
|
|
String InvOther = transformationParam(doc,"InvOther"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DocumentBuilder resultBuilder = XmlUtil.createDocumentBuilder(); |
|
|
|
|
Document result = resultBuilder.newDocument(); |
|
|
|
|
|
|
|
|
|
String Kpje = ""; |
|
|
|
|
String Jym = ""; |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(InvOther)) { |
|
|
|
|
return buildResult(result, "1", "不含税金额/校验码不能为空", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获得value
|
|
|
|
|
if (StringUtils.isEmpty(TaxCode)) { |
|
|
|
|
return buildResult(result, "1", "税号不能为空", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 根据税号获得companyService
|
|
|
|
|
Companyservice companyservice = companyserviceService.selectCompanyserviceByTaxcode(TaxCode); |
|
|
|
|
if (companyservice == null) { |
|
|
|
|
return buildResult(result, "1", "税号不存在", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(Password)) { |
|
|
|
|
return buildResult(result, "036", "查验交互密码为空,不能进行查验", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 全电发票没有发票代码
|
|
|
|
|
if (StringUtils.isEmpty(InvNo)) { |
|
|
|
|
return buildResult(result, "1", "发票号码不能为空", null); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(InvTime)) { |
|
|
|
|
return buildResult(result, "1", "开票日期不能为空", null); |
|
|
|
|
} |
|
|
|
|
boolean isMatch = ReUtil.isMatch("^\\d{4}-\\d{2}-\\d{2}$", InvTime); |
|
|
|
|
if (!isMatch) { |
|
|
|
|
return buildResult(result, "1", "开票日期格式错误 yyyy-MM-dd", null); |
|
|
|
|
} |
|
|
|
|
// 如果Jym这个参数为空,我就去判断InvOther是否为6位且不带小数点,如果确实如此,那就直接将InvOther作为校验码传给大象
|
|
|
|
|
// 2023.03.09 如果InvOtherNode是6位且不到小数点,那么就直接将InvOtherNode作为校验码传给大象
|
|
|
|
|
if (StringUtils.isNotEmpty(InvOther)) { |
|
|
|
|
// 判断InvOther是否为6位且不带小数点
|
|
|
|
|
if (InvOther.length() == 6 && !InvOther.contains(".")) { |
|
|
|
|
Jym = InvOther; |
|
|
|
|
}else{ |
|
|
|
|
Kpje = InvOther; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String Fpzl = ""; |
|
|
|
|
// 如果发票号码位数为20位,则fpzl为21,否则为01,中举在2022-12-06 20:08给巩权林说的解决方案,是大象那边提的,可以用来适配远得
|
|
|
|
|
if (InvNo.length() == 20) { |
|
|
|
|
Fpzl = "21"; |
|
|
|
|
} else { |
|
|
|
|
Fpzl = "01"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CompanyserviceProp keyProp = companyservicePropService.selectPropByKey(companyservice.getCompanyid(), "webservice_password"); |
|
|
|
|
if (keyProp == null || !StringUtils.equals(keyProp.getValue(), Password)) { |
|
|
|
|
return buildResult(result, "035", "交互密码错误,请确认密码是否输入正确!", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 调用发票查询接口
|
|
|
|
|
String serviceKey = ""; |
|
|
|
|
try { |
|
|
|
|
serviceKey = serviceManageService.getCompanyServiceSupplier("income", companyservice.getCompanyid()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return buildResult(result, "1", "发票查询失败", null); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isEmpty(serviceKey)) { |
|
|
|
|
log.error("【发票查询失败】companyid:{},serviceKey为空", companyservice.getCompanyid()); |
|
|
|
|
return buildResult(result, "1", "发票查询失败", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ICheckInvoice incomeService = incomeServiceFactory.getService(serviceKey); |
|
|
|
|
if (incomeService == null) { |
|
|
|
|
log.error("【发票查询失败】companyid:{},serviceKey:{},incomeService为空", companyservice.getCompanyid(), serviceKey); |
|
|
|
|
return buildResult(result, "1", "发票查询失败", null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 调用发票查询接口
|
|
|
|
|
JSONObject request = new JSONObject(); |
|
|
|
|
request.put("fpzl", Fpzl); |
|
|
|
|
request.put("fpje", Kpje); |
|
|
|
|
request.put("fpdm", InvCode); |
|
|
|
|
Date kprqDate = null; |
|
|
|
|
try { |
|
|
|
|
kprqDate = DateUtils.parseDate(InvTime, "yyyy-MM-dd"); |
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
log.error("【发票查询失败】companyid:{},serviceKey:{},kprqDate解析失败", companyservice.getCompanyid(), serviceKey); |
|
|
|
|
} |
|
|
|
|
String kprq = InvTime; |
|
|
|
|
if (kprqDate != null) { |
|
|
|
|
kprq = DateUtils.parseDateToStr("yyyyMMdd", kprqDate); |
|
|
|
|
} |
|
|
|
|
request.put("kprq", kprq); |
|
|
|
|
request.put("fphm", InvNo); |
|
|
|
|
request.put("jym", Jym); |
|
|
|
|
AjaxResult invoiceResult = incomeService.checkInvoiceSingle(companyservice, request); |
|
|
|
|
log.info("【发票查询结果】companyid:{},serviceKey:{},param:{},invoiceResult:{}", companyservice.getCompanyid(), serviceKey, request, JSONObject.toJSONString(invoiceResult)); |
|
|
|
|
|
|
|
|
|
if (invoiceResult.isError()) { |
|
|
|
|
if ("超过该张票当天查验次数".equals(invoiceResult.getMsg())) { |
|
|
|
|
return buildResult(result, "002", "超过该张发票当日查验次数(请于次日再次查验)!", null); |
|
|
|
|
} else if ("查验异常".equals(invoiceResult.getMsg())) { |
|
|
|
|
return buildResult(result, "084", "开票金额或校验码不合法!", null); |
|
|
|
|
} else if ("请求不合法".equals(invoiceResult.getMsg())) { |
|
|
|
|
return buildResult(result, "005", "请求不合法!", null); |
|
|
|
|
} else if ("发票不存在".equals(invoiceResult.getMsg())) { |
|
|
|
|
return buildResult(result, "009", "查无此票!", null); |
|
|
|
|
} else { |
|
|
|
|
return buildResult(result, StrUtil.padPre(String.valueOf(invoiceResult.getCode()), 3, '0'), invoiceResult.getMsg(), null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (invoiceResult.isSuccess()) { |
|
|
|
|
JSONObject resp = invoiceResult.getJsonData(); |
|
|
|
|
Integer robUser = resp.getInteger("robUserMoney"); |
|
|
|
|
if (robUser != null && robUser >= 1) { |
|
|
|
|
serviceManageService.companyConsume("income", companyservice.getCompanyid()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果开票成功
|
|
|
|
|
JSONObject invoiceJsonResult = invoiceResult.getJsonData(); |
|
|
|
|
JSONObject resultContent = invoiceJsonResult.getJSONObject("resultContent"); |
|
|
|
|
InvoiceCheck invoiceCheck = new InvoiceCheck(); |
|
|
|
|
invoiceCheck = EleCheckInvoiceImpl.handelCheckResult(invoiceCheck, resultContent); |
|
|
|
|
GetInvoiceVO getInvoiceVO = new GetInvoiceVO(); |
|
|
|
|
// 远得日期格式化
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
String newKprq = ""; |
|
|
|
|
try { |
|
|
|
|
Date parseKprq = simpleDateFormat.parse(invoiceCheck.getKprq()); |
|
|
|
|
simpleDateFormat.applyPattern("yyyy-MM-dd"); |
|
|
|
|
newKprq = simpleDateFormat.format(parseKprq); |
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
new JianshuiServiceException("日期转换错误"); |
|
|
|
|
} |
|
|
|
|
// 远得结果集
|
|
|
|
|
String zfbz = invoiceCheck.getZfbz(); |
|
|
|
|
if (StringUtils.equals(zfbz, "Y")) { |
|
|
|
|
getInvoiceVO.setZfbz("Y"); |
|
|
|
|
getInvoiceVO.setHcbz("N"); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.equals(zfbz, "H")) { |
|
|
|
|
getInvoiceVO.setZfbz("N"); |
|
|
|
|
getInvoiceVO.setHcbz("Y"); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.equals(zfbz, "N")) { |
|
|
|
|
getInvoiceVO.setZfbz("N"); |
|
|
|
|
getInvoiceVO.setHcbz("N"); |
|
|
|
|
} |
|
|
|
|
// 远得返回信息封装
|
|
|
|
|
LinkedHashMap<String, String> getInvoiceMap = new LinkedHashMap(); |
|
|
|
|
getInvoiceMap.put("fpdm", "<![CDATA[" + invoiceCheck.getFpdm() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("fphm", "<![CDATA[" + invoiceCheck.getFphm() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("kprq", "<![CDATA[" + newKprq + "]]]]>><![CDATA["); |
|
|
|
|
// 远得返回信息封装
|
|
|
|
|
if (!InvoiceTypeCheck.ER_SHOU_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl()) && |
|
|
|
|
!InvoiceTypeCheck.JI_DONG_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
getInvoiceMap.put("gfmc", "<![CDATA[" + invoiceCheck.getGmfmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("gfsh", "<![CDATA[" + invoiceCheck.getGmfsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("gfdzdh", "<![CDATA[" + invoiceCheck.getGmfdzdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Gfyhzh", "<![CDATA[" + invoiceCheck.getGmfyhzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfmc","<![CDATA[" + invoiceCheck.getXhfmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfsh", "<![CDATA[" + invoiceCheck.getXhfsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfdzdh", "<![CDATA[" + invoiceCheck.getXhfdzdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfyhzh", "<![CDATA[" + invoiceCheck.getXhfyhzh() + "]]]]>><![CDATA["); |
|
|
|
|
} |
|
|
|
|
// 远得类型返回信息封装
|
|
|
|
|
if (InvoiceTypeCheck.ER_SHOU_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 二手车相关结果
|
|
|
|
|
getInvoiceMap.put("gfmc", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getMfdwgr() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("gfsh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getMfdwdmsfzh() + "]]]]>><![CDATA["); |
|
|
|
|
String gfdzdh = invoiceCheck.getInvoiceCheckUsedCar().getMfdwgrdz() + " " + |
|
|
|
|
invoiceCheck.getInvoiceCheckUsedCar().getMfdh(); |
|
|
|
|
getInvoiceMap.put("gfdzdh", "<![CDATA[" + gfdzdh + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Gfyhzh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getKhyhjzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfmc", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getSmfdwgr() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfsh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getSmfdwdmsfzh() + "]]]]>><![CDATA["); |
|
|
|
|
String xfdzdh = invoiceCheck.getInvoiceCheckUsedCar().getSmfdwgrzz() + " " + |
|
|
|
|
invoiceCheck.getInvoiceCheckCar().getSmfdh(); |
|
|
|
|
getInvoiceMap.put("Xfdzdh", "<![CDATA[" + xfdzdh + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfyhzh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getKhyhjzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Jqbm","<![CDATA[" + invoiceCheck.getJqbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cpzh","<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getCpzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("djzh","<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getDjzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cllx", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getCllx() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Cjh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getClsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cpxh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getCpxh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Zrdclglsmc", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getZrdcgsmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Cjhj", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getCjhj() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("escsc", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getEscsc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Nsrsbh","<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getEscscsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Escscdz", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getEscscdz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Khyh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getEscsckhyhzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("escscdh", "<![CDATA[" + invoiceCheck.getInvoiceCheckUsedCar().getEscscdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Fplx", "<![CDATA[" + invoiceCheck.getFpzl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("ZFBZ", "<![CDATA[" + invoiceCheck.getZfbz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("bz", "<![CDATA[" + invoiceCheck.getBz() + "]]]]>><![CDATA["); |
|
|
|
|
} else if (InvoiceTypeCheck.JI_DONG_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 机动车相关结果
|
|
|
|
|
getInvoiceMap.put("gfmc", "<![CDATA[" + invoiceCheck.getGmfmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("gfsh", "<![CDATA[" + invoiceCheck.getGmfsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Jqbm", "<![CDATA[" + invoiceCheck.getJqbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cllx", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getCllx() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cpxh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getCpxh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("cd", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getCd() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Hgzh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getHgzs() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Sjdh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getSjdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Fdjhm", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getFdjhm() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Clsbdh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getClsbh() + "]]]]>><![CDATA["); |
|
|
|
|
if (invoiceCheck.getInvoiceCheckCar().getJszmsh() == null) { |
|
|
|
|
getInvoiceMap.put("Jkzmsh", "<![CDATA[" + "" + "]]]]>><![CDATA["); |
|
|
|
|
} else { |
|
|
|
|
getInvoiceMap.put("Jkzmsh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getJszmsh() + "]]]]>><![CDATA["); |
|
|
|
|
} |
|
|
|
|
getInvoiceMap.put("Xfmc", "<![CDATA[" + invoiceCheck.getXhfmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Xfsh", "<![CDATA[" + invoiceCheck.getXhfsbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Dz", "<![CDATA[" + invoiceCheck.getGmfdzdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Dh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getSmfdh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Khyh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getKhyh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Zh", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getKhzh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("zgswjg", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getZgswjgdm() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("zgswjgmc", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getZgswjgmc() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Wspzhm", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getWspzhm() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Dw", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getDw() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("xcrs", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getXcrs() + "]]]]>><![CDATA["); |
|
|
|
|
; |
|
|
|
|
getInvoiceMap.put("Fplx", "<![CDATA[" + invoiceCheck.getFpzl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("ZFBZ", "<![CDATA[" + invoiceCheck.getZfbz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("sl", "<![CDATA[" + invoiceCheck.getInvoiceCheckCar().getSl() + "]]]]>><![CDATA["); |
|
|
|
|
} else if (InvoiceTypeCheck.ZHUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.ZHENG_ZHI_SHUI_PU_TONG_FA_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.DIAN_ZI_ZHUAN_YONG_FA_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.QUAN_DIAN_ZHUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.QUAN_DIAN_PU_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 专票 增值税普通发票 电子专用发票结果
|
|
|
|
|
getInvoiceMap.put("bz", "<![CDATA[" + invoiceCheck.getBz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Jqbm", "<![CDATA[" + invoiceCheck.getJqbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Fplx", "<![CDATA[" + invoiceCheck.getFpzl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("jym", "<![CDATA[" + invoiceCheck.getJym() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("HCBZ", "<![CDATA[" + getInvoiceVO.getHcbz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("ZFBZ", "<![CDATA[" + getInvoiceVO.getZfbz() + "]]]]>><![CDATA["); |
|
|
|
|
} else if (InvoiceTypeCheck.TONG_XING_FEI_FA_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.JUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.DIAN_ZI_PU_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
getInvoiceMap.put("bz", "<![CDATA[" + invoiceCheck.getBz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Jqbm", "<![CDATA[" + invoiceCheck.getJqbh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("Fplx", "<![CDATA[" + invoiceCheck.getFpzl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("jym", "<![CDATA[" + invoiceCheck.getJym() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("ZFBZ", "<![CDATA[" + getInvoiceVO.getZfbz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceMap.put("HCBZ", "<![CDATA[" + getInvoiceVO.getHcbz() + "]]]]>><![CDATA["); |
|
|
|
|
} |
|
|
|
|
Set<Map.Entry<String, String>> entries = getInvoiceMap.entrySet(); |
|
|
|
|
for (Map.Entry<String, String> entry : entries) { |
|
|
|
|
String value = entry.getValue(); |
|
|
|
|
if ("".equals(value)) { |
|
|
|
|
entry.setValue("00"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Element getInvoiceDoc = json2Element(result, "Fp", getInvoiceMap); |
|
|
|
|
// 详情获取
|
|
|
|
|
List<InvoiceCheckDetail> details = invoiceCheck.getInvoiceCheckDetail(); |
|
|
|
|
LinkedHashMap<String, String> getInvoiceSphVOMap = new LinkedHashMap<>(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(details)) { |
|
|
|
|
int count = 1; |
|
|
|
|
for (InvoiceCheckDetail detail : details) { |
|
|
|
|
GetInvoiceSphVO getInvoiceSphVO = new GetInvoiceSphVO(); |
|
|
|
|
getInvoiceSphVO.setId(getInvoiceSphVO.getId() + count); |
|
|
|
|
// 远得详情封装
|
|
|
|
|
if (!InvoiceTypeCheck.JI_DONG_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl()) && |
|
|
|
|
!InvoiceTypeCheck.ER_SHOU_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
getInvoiceSphVOMap.put("xh", "<![CDATA[" + String.valueOf(getInvoiceSphVO.getId()) + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Spmc","<![CDATA[" + detail.getHwmc() + "]]]]>><![CDATA["); |
|
|
|
|
} |
|
|
|
|
// 远得详情封装
|
|
|
|
|
if (InvoiceTypeCheck.JUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.DIAN_ZI_PU_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.ZHENG_ZHI_SHUI_PU_TONG_FA_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 卷票 电普 增值税普通发票 电子专用发票详情
|
|
|
|
|
getInvoiceSphVOMap.put("Ggxh", "<![CDATA[" + detail.getGgxh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Jldw", "<![CDATA[" + detail.getJldw() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Sl", "<![CDATA[" + detail.getSpsl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Dj", "<![CDATA[" + detail.getBhsdj() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Je", "<![CDATA[" + detail.getJe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Se", "<![CDATA[" + detail.getSe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Slv", "<![CDATA[" + detail.getSl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Taxcode", "<![CDATA[" + detail.getSsflbm() + "]]]]>><![CDATA["); |
|
|
|
|
} else if (InvoiceTypeCheck.QUAN_DIAN_ZHUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.QUAN_DIAN_PU_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.ZHUAN_PIAO.getCode().equals(invoiceCheck.getFpzl()) || |
|
|
|
|
InvoiceTypeCheck.DIAN_ZI_ZHUAN_YONG_FA_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 全电专票 全电普票 专票详情
|
|
|
|
|
getInvoiceSphVOMap.put("Ggxh", "<![CDATA[" + detail.getGgxh() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Jldw", "<![CDATA[" + detail.getJldw() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Sl", "<![CDATA[" + detail.getSpsl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Dj", "<![CDATA[" + detail.getBhsdj() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Je","<![CDATA[" + detail.getJe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Slv", "<![CDATA[" + detail.getSl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Se", "<![CDATA[" + detail.getSe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Taxcode", "<![CDATA[" + detail.getSsflbm() + "]]]]>><![CDATA["); |
|
|
|
|
} else if (InvoiceTypeCheck.TONG_XING_FEI_FA_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// 通行发票
|
|
|
|
|
getInvoiceSphVOMap.put("cph", "<![CDATA[" + detail.getCph() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("cllx", "<![CDATA[" + detail.getLx() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("txrqq", "<![CDATA[" + detail.getTxrqq() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("txrqz","<![CDATA[" + detail.getTxrqz() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Je", "<![CDATA[" + detail.getJe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Se","<![CDATA[" + detail.getSe() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Slv", "<![CDATA[" + detail.getSl() + "]]]]>><![CDATA["); |
|
|
|
|
getInvoiceSphVOMap.put("Taxcode", "<![CDATA[" + detail.getSsflbm() + "]]]]>><![CDATA["); |
|
|
|
|
} |
|
|
|
|
if (!InvoiceTypeCheck.JI_DONG_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl()) && |
|
|
|
|
!InvoiceTypeCheck.ER_SHOU_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
Set<Map.Entry<String, String>> entries1 = getInvoiceSphVOMap.entrySet(); |
|
|
|
|
for (Map.Entry<String, String> stringStringEntry : entries1) { |
|
|
|
|
String value = stringStringEntry.getValue(); |
|
|
|
|
if ("".equals(value)) { |
|
|
|
|
stringStringEntry.setValue("00"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Element sphElement = json2Element(result, "Sph", getInvoiceSphVOMap); |
|
|
|
|
getInvoiceDoc.appendChild(sphElement); |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 尾部标签添加
|
|
|
|
|
if (!InvoiceTypeCheck.ER_SHOU_CHE_PIAO.getCode().equals(invoiceCheck.getFpzl())) { |
|
|
|
|
// je标签添加
|
|
|
|
|
LinkedHashMap<String, String> jeLinkedHashMap = new LinkedHashMap<>(); |
|
|
|
|
jeLinkedHashMap.put("je", StringUtils.isEmpty(invoiceCheck.getFpje()) ? "00" : invoiceCheck.getFpje()); |
|
|
|
|
Element je = jsonElement(result, "je", jeLinkedHashMap); |
|
|
|
|
getInvoiceDoc.appendChild(je); |
|
|
|
|
|
|
|
|
|
// se标签添加
|
|
|
|
|
LinkedHashMap<String, String> seLinkedHashMap = new LinkedHashMap<>(); |
|
|
|
|
seLinkedHashMap.put("se", StringUtils.isEmpty(invoiceCheck.getFpse()) ? "00" : invoiceCheck.getFpse()); |
|
|
|
|
Element se = jsonElement(result, "se", seLinkedHashMap); |
|
|
|
|
getInvoiceDoc.appendChild(se); |
|
|
|
|
|
|
|
|
|
// jshj标签添加
|
|
|
|
|
LinkedHashMap<String, String> jshjLinkedHashMap = new LinkedHashMap<>(); |
|
|
|
|
jshjLinkedHashMap.put("jshj", StringUtils.isEmpty(invoiceCheck.getJshj()) ? "00" : invoiceCheck.getJshj()); |
|
|
|
|
Element jshj = jsonElement(result, "jshj", jshjLinkedHashMap); |
|
|
|
|
getInvoiceDoc.appendChild(jshj); |
|
|
|
|
} |
|
|
|
|
return buildResult(result, "1", "查验成功", getInvoiceDoc); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String transformationParam(Document doc, String param) { |
|
|
|
|
log.info("webservice查验:开始转换参数:取参Param={}", param); |
|
|
|
|
NodeList paramNodes = doc.getElementsByTagName(param); |
|
|
|
|
if (paramNodes == null || paramNodes.item(0) == null) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
String content = paramNodes.item(0).getTextContent() != null ? paramNodes.item(0).getTextContent() : ""; |
|
|
|
|
log.info("webservice查验:结束转换参数:取参Param值={}", content); |
|
|
|
|
return content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String buildResult(Document result, String code, String message, Element fp) { |
|
|
|
|
Element Data = result.createElement("Data"); |
|
|
|
|
Element Result = result.createElement("Result"); |
|
|
|
|
Element Code = result.createElement("Code"); |
|
|
|
|
Code.setTextContent(code); // 1:查验成功 其余失败
|
|
|
|
|
Element Message = result.createElement("Message"); |
|
|
|
|
Message.setTextContent(message); |
|
|
|
|
Result.appendChild(Code); |
|
|
|
|
Result.appendChild(Message); |
|
|
|
|
|
|
|
|
|
if (fp == null) { |
|
|
|
|
fp = result.createElement("Fp"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Data.appendChild(Result); |
|
|
|
|
Data.appendChild(fp); |
|
|
|
|
|
|
|
|
|
// 创建 XML 字符串
|
|
|
|
|
StringBuilder xmlStringBuilder = new StringBuilder(); |
|
|
|
|
xmlStringBuilder.append("<responseCheckVO>"); |
|
|
|
|
xmlStringBuilder.append(XmlUtil.toStr(Data)); |
|
|
|
|
xmlStringBuilder.append("</responseCheckVO>"); |
|
|
|
|
|
|
|
|
|
return xmlStringBuilder.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*private String buildResult(Document result, String code, String message, Element fp) { |
|
|
|
|
Element Data = result.createElement("Data"); |
|
|
|
|
Element Result = result.createElement("Result"); |
|
|
|
|
Element Code = result.createElement("Code"); |
|
|
|
|
Code.setTextContent(code); //1:查验成功 其余失败
|
|
|
|
|
Element Message = result.createElement("Message"); |
|
|
|
|
Message.setTextContent(message); |
|
|
|
|
Result.appendChild(Code); |
|
|
|
|
Result.appendChild(Message); |
|
|
|
|
if (fp == null) { |
|
|
|
|
fp = result.createElement("Fp"); |
|
|
|
|
} |
|
|
|
|
Data.appendChild(Result); |
|
|
|
|
Data.appendChild(fp); |
|
|
|
|
|
|
|
|
|
ResponseCheckVO resp = new ResponseCheckVO(); |
|
|
|
|
ResponseCheckDataVO vo = new ResponseCheckDataVO(); |
|
|
|
|
ResponseCheckResultVO responseCheckResultVO = new ResponseCheckResultVO(); |
|
|
|
|
|
|
|
|
|
responseCheckResultVO.setCode(Code.getTextContent()); |
|
|
|
|
responseCheckResultVO.setMessage(Message.getTextContent()); |
|
|
|
|
Object myFp = fp; |
|
|
|
|
vo.setResult(responseCheckResultVO); |
|
|
|
|
vo.setFp(myFp); |
|
|
|
|
resp.setDATA(vo); |
|
|
|
|
|
|
|
|
|
return resp; |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Element json2Element(Document result, String elementName, Map<String, String> jsonObject) { |
|
|
|
|
Element parent = result.createElement(elementName); |
|
|
|
|
jsonObject.keySet().forEach(key -> { |
|
|
|
|
String value = jsonObject.get(key); |
|
|
|
|
// 转为全小写
|
|
|
|
|
String firstKey = key.substring(0, 1); |
|
|
|
|
String upperKey = firstKey.toUpperCase(); |
|
|
|
|
String endKey = key.substring(1, key.length()); |
|
|
|
|
key = upperKey + endKey.toLowerCase(); |
|
|
|
|
Element element = result.createElement(key); |
|
|
|
|
element.setTextContent(value); |
|
|
|
|
parent.appendChild(element); |
|
|
|
|
}); |
|
|
|
|
return parent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 尾部标签添加
|
|
|
|
|
private Element jsonElement(Document result, String key, Map<String, String> map) { |
|
|
|
|
String value = map.get(key); |
|
|
|
|
// 转为全小写
|
|
|
|
|
String firstKey = key.substring(0, 1); |
|
|
|
|
String upperKey = firstKey.toUpperCase(); |
|
|
|
|
String endKey = key.substring(1, key.length()); |
|
|
|
|
key = upperKey + endKey.toLowerCase(); |
|
|
|
|
Element element = result.createElement(key); |
|
|
|
|
element.setTextContent("<![CDATA[" + value + "]]]]>><![CDATA["); |
|
|
|
|
return element; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|