|
|
|
@ -111,7 +111,6 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
BaseTDxTaxCurrent current = baseTDxTaxCurrentDao.selectOne(currentWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList(); |
|
|
|
|
|
|
|
|
|
if (invoiceInfoList != null && invoiceInfoList.size() > 0) { |
|
|
|
@ -270,8 +269,10 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
|
|
|
|
|
//4.封装返回参数
|
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
if (StringUtils.isNoneBlank(apiResponse.getContent())) |
|
|
|
|
if (StringUtils.isNoneBlank(apiResponse.getContent())) { |
|
|
|
|
log.info("查验的结果为:{}", apiResponse.getContent()); |
|
|
|
|
jsonObject = convertToSnObject(apiResponse.getContent(), jsonObject, fplxdm); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return jsonObject; |
|
|
|
@ -286,6 +287,15 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
HashMap<String, Object> invoiceData = JSONObject.parseObject(contentMap.get("data").toString(), HashMap.class); |
|
|
|
|
if ("0001".equals(invoiceData.get("cyjg"))) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
invoiceType = invoiceData.get("fpzl").toString(); |
|
|
|
|
if ("22".equals(invoiceType)) { |
|
|
|
|
invoiceType = "33"; |
|
|
|
|
} |
|
|
|
|
if ("21".equals(invoiceType)) { |
|
|
|
|
invoiceType = "31"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
jsonObject.put("invoiceType", invoiceType); |
|
|
|
|
jsonObject.put("administrativeDivisionNo", ""); |
|
|
|
|
jsonObject.put("administrativeDivisionName", ""); |
|
|
|
@ -337,6 +347,10 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
jsonObject.put("tonnage", invoiceData.get("ccdw")); |
|
|
|
|
jsonObject.put("taxAuthorityNo", invoiceData.get("zgswjgdm")); |
|
|
|
|
jsonObject.put("taxAuthorityName", invoiceData.get("zgswjgmc")); |
|
|
|
|
if ("03".equals(invoiceData.get("fpzl"))) { |
|
|
|
|
jsonObject.put("administrativeDivisionNo", invoiceData.get("zgswjgdm")); |
|
|
|
|
jsonObject.put("administrativeDivisionName", invoiceData.get("zgswjgmc")); |
|
|
|
|
} |
|
|
|
|
jsonObject.put("remarks", invoiceData.get("bz")); |
|
|
|
|
jsonObject.put("vehicleType", invoiceData.get("cllx")); |
|
|
|
|
jsonObject.put("brandModel", invoiceData.get("cpxh")); |
|
|
|
@ -374,14 +388,26 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
jsonObject.put("taxRecords", invoiceData.get("wspzhm")); |
|
|
|
|
jsonObject.put("tonnage", invoiceData.get("dw")); |
|
|
|
|
jsonObject.put("limitPeople", invoiceData.get("xcrs")); |
|
|
|
|
|
|
|
|
|
String taxRate = ""; |
|
|
|
|
if ("免税".equals(invoiceData.get("sl"))) { |
|
|
|
|
taxRate = "0"; |
|
|
|
|
jsonObject.put("taxRate", taxRate); |
|
|
|
|
} else { |
|
|
|
|
if (invoiceData.get("sl") != null && StringUtils.isNoneBlank(invoiceData.get("sl").toString())) { |
|
|
|
|
String taxRate = invoiceData.get("sl").toString(); |
|
|
|
|
taxRate = invoiceData.get("sl").toString(); |
|
|
|
|
if (!"0".equals(taxRate)) { |
|
|
|
|
taxRate = "0." + taxRate; |
|
|
|
|
taxRate = taxRate.substring(0, taxRate.length() - 1); |
|
|
|
|
log.info("发票税率为:{}",taxRate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("11".equals(invoiceType)) { |
|
|
|
|
taxRate = "0.000"; |
|
|
|
|
} |
|
|
|
|
log.info("明细-发票税率为:{}", taxRate); |
|
|
|
|
jsonObject.put("taxRate", taxRate); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
taxRate = ""; |
|
|
|
|
jsonObject.put("limitPeople", invoiceData.get("xcrs")); |
|
|
|
|
jsonObject.put("machineNo", invoiceData.get("jqbh")); |
|
|
|
|
|
|
|
|
@ -409,34 +435,83 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
|
|
|
|
|
List<Map<String, String>> returnDetailList = new ArrayList<>(); |
|
|
|
|
JSONArray detailList = (JSONArray) invoiceData.get("detailList"); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < detailList.size(); i++) { |
|
|
|
|
String taxRateDetail = ""; |
|
|
|
|
JSONObject detail = (JSONObject) detailList.get(i); |
|
|
|
|
Map<String, String> snDetailMap = new HashMap<String, String>(); |
|
|
|
|
snDetailMap.put("rowNo", ++i + ""); |
|
|
|
|
snDetailMap.put("rowNo", i + 1 + ""); |
|
|
|
|
snDetailMap.put("commodityCode", detail.getString("ssflbm")); |
|
|
|
|
snDetailMap.put("commodityName", detail.getString("hwmc")); |
|
|
|
|
snDetailMap.put("specificationModel", detail.getString("ggxh")); |
|
|
|
|
snDetailMap.put("unit", detail.getString("jldw")); |
|
|
|
|
snDetailMap.put("quantity", detail.getString("spsl")); |
|
|
|
|
snDetailMap.put("unitPrice", detail.getString("bhsdj")); |
|
|
|
|
log.info("明细-unitPrice={}",detail.get("bhsdj")); |
|
|
|
|
String quantity = detail.getString("spsl"); |
|
|
|
|
if (quantity.length() > 3) { |
|
|
|
|
int index = quantity.indexOf("."); |
|
|
|
|
quantity = quantity.substring(0, index + 2); |
|
|
|
|
} |
|
|
|
|
snDetailMap.put("quantity", quantity); |
|
|
|
|
|
|
|
|
|
String unitPrice = detail.getString("bhsdj"); |
|
|
|
|
if (unitPrice.length() > 3) { |
|
|
|
|
int index = unitPrice.indexOf("."); |
|
|
|
|
unitPrice = unitPrice.substring(0, index + 3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
snDetailMap.put("unitPrice", unitPrice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("11".equals(invoiceType)) { |
|
|
|
|
snDetailMap.put("tax", "0"); |
|
|
|
|
|
|
|
|
|
//如果是卷票计算合计金额
|
|
|
|
|
Float hjje = null; |
|
|
|
|
if (detail.getString("se") != null && detail.getString("je") != null) { |
|
|
|
|
Float je = Float.parseFloat(detail.getString("je")); |
|
|
|
|
Float se = Float.parseFloat(detail.getString("se")); |
|
|
|
|
hjje = je + se; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (hjje != null) |
|
|
|
|
snDetailMap.put("amount", hjje.toString()); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
snDetailMap.put("tax", "***".equals(detail.getString("se")) ? "0.00" : detail.getString("se")); |
|
|
|
|
snDetailMap.put("amount", detail.getString("je")); |
|
|
|
|
String taxRate = ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("免税".equals(detail.getString("sl"))) { |
|
|
|
|
taxRateDetail = "0"; |
|
|
|
|
snDetailMap.put("taxRate", taxRateDetail); |
|
|
|
|
} else { |
|
|
|
|
if (detail.get("sl") != null && StringUtils.isNoneBlank(detail.get("sl").toString())) { |
|
|
|
|
taxRate = detail.get("sl").toString(); |
|
|
|
|
if(!"0".equals(taxRate)) { |
|
|
|
|
taxRate = "0." + taxRate; |
|
|
|
|
taxRate = taxRate.substring(0,taxRate.length()-1); |
|
|
|
|
taxRateDetail = detail.get("sl").toString(); |
|
|
|
|
if (!"0".equals(taxRateDetail)) { |
|
|
|
|
if (StringUtils.isNoneBlank(taxRateDetail)) { |
|
|
|
|
int index = taxRateDetail.indexOf("%"); |
|
|
|
|
if (index > 0) { |
|
|
|
|
taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1); |
|
|
|
|
int num = Integer.parseInt(taxRateDetail); |
|
|
|
|
if (num > 9) { |
|
|
|
|
taxRateDetail = "0." + taxRateDetail; |
|
|
|
|
} else { |
|
|
|
|
taxRateDetail = "0.0" + taxRateDetail; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("11".equals(invoiceType)) { |
|
|
|
|
taxRateDetail = "0.000"; |
|
|
|
|
} |
|
|
|
|
log.info("明细-发票税率为:{}", taxRateDetail); |
|
|
|
|
snDetailMap.put("taxRate", taxRateDetail); |
|
|
|
|
} |
|
|
|
|
log.info("明细-发票税率为:{}",taxRate); |
|
|
|
|
jsonObject.put("taxRate", taxRate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
snDetailMap.put("taxRate", "免税".equals(taxRate) ? "0.00" : detail.getString("sl")); |
|
|
|
|
log.info("明细-taxRate={}",taxRate); |
|
|
|
|
log.info("明细-tax={}", detail.get("se")); |
|
|
|
|
log.info("明细-commodityCode={}", detail.get("ssflbm")); |
|
|
|
|
snDetailMap.put("tax", "***".equals(detail.getString("se")) ? "0.00" : detail.getString("se")); |
|
|
|
|
snDetailMap.put("currentDateEnd", detail.getString("txrqz")); |
|
|
|
|
snDetailMap.put("currentDateStart", detail.getString("txrqq")); |
|
|
|
|
snDetailMap.put("licensePlateNum", detail.getString("cph")); |
|
|
|
|