|
|
|
@ -270,7 +270,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
return queryInvoiceResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JSONObject singleCheckInvoice(Map<String, String> pramsMap) throws Exception { |
|
|
|
|
public JSONObject singleCheckInvoice(Map<String, String> pramsMap, String isInteger) throws Exception { |
|
|
|
|
|
|
|
|
|
//1.封装查验参数
|
|
|
|
|
ApiRequest apiRequest = new ApiRequest(); |
|
|
|
@ -306,7 +306,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
|
if (StringUtils.isNoneBlank(apiResponse.getContent())) { |
|
|
|
|
log.info("查验的结果为:{}", apiResponse.getContent()); |
|
|
|
|
jsonObject = convertToSnObject(apiResponse.getContent(), jsonObject, fplxdm); |
|
|
|
|
jsonObject = convertToSnObject(apiResponse.getContent(), jsonObject, fplxdm, isInteger); |
|
|
|
|
} |
|
|
|
|
// saveCheckRecord(pramsMap, apiResponse);
|
|
|
|
|
|
|
|
|
@ -331,7 +331,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
platformCheckLogService.save(checkLog); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) throws ParseException { |
|
|
|
|
private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType, String isInteger) throws ParseException { |
|
|
|
|
|
|
|
|
|
String con = new String(Base64.decode(content)); |
|
|
|
|
HashMap contentMap = JSONObject.parseObject(con, HashMap.class); |
|
|
|
@ -468,6 +468,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
if (taxRate.contains("%")) { |
|
|
|
|
taxRate = taxRate.replace("%",""); |
|
|
|
|
} |
|
|
|
|
//按照小数处理
|
|
|
|
|
if(StringUtils.isNotBlank(isInteger)){ |
|
|
|
|
BigDecimal bigDecimal = new BigDecimal(taxRate); |
|
|
|
|
taxRate = bigDecimal.divide(new BigDecimal("100")).toPlainString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("11".equals(invoiceType)) { |
|
|
|
|
taxRate = "0"; |
|
|
|
@ -553,25 +558,27 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("免税".equals(detail.getString("sl")) || "不征税".equals(detail.getString("sl")) || "***".equals(detail.getString("sl"))) { |
|
|
|
|
if (StringUtils.isBlank(detail.get("sl").toString()) || "免税".equals(detail.get("sl").toString()) || "不征税".equals(detail.get("sl").toString()) |
|
|
|
|
|| "***".equals(detail.get("sl").toString())) { |
|
|
|
|
taxRateDetail = "0"; |
|
|
|
|
snDetailMap.put("taxRate", taxRateDetail); |
|
|
|
|
} else { |
|
|
|
|
if (StringUtils.isNoneBlank(detail.get("sl").toString())) { |
|
|
|
|
taxRateDetail = detail.get("sl").toString(); |
|
|
|
|
if (!"0".equals(taxRateDetail)) { |
|
|
|
|
if (StringUtils.isNoneBlank(taxRateDetail)) { |
|
|
|
|
if(taxRateDetail.contains("%")){ |
|
|
|
|
taxRateDetail = taxRateDetail.replace("%",""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
taxRate = detail.get("sl").toString(); |
|
|
|
|
taxRate = taxRate.replace("%", ""); |
|
|
|
|
// if (!"0".equals(taxRate)) {
|
|
|
|
|
// taxRate = taxRate.substring(0, taxRate.length() - 1);
|
|
|
|
|
// }
|
|
|
|
|
//按照小数处理
|
|
|
|
|
if(StringUtils.isNotBlank(isInteger)){ |
|
|
|
|
BigDecimal bigDecimal = new BigDecimal(taxRate); |
|
|
|
|
taxRate = bigDecimal.divide(new BigDecimal("100")).toPlainString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("11".equals(invoiceType)) { |
|
|
|
|
taxRateDetail = "0"; |
|
|
|
|
taxRate = "0"; |
|
|
|
|
} |
|
|
|
|
log.info("明细-发票税率为:{}", taxRateDetail); |
|
|
|
|
snDetailMap.put("taxRate", taxRateDetail); |
|
|
|
|
log.info("明细-发票税率为:{}", taxRate); |
|
|
|
|
snDetailMap.put("taxRate", taxRate); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -719,7 +726,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
pramsMap.put("invoiceType", invoice.getInvoiceType()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); |
|
|
|
|
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap,null); |
|
|
|
|
log.info("补充查验结果为:{}", checkInvoiceResult); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|