diff --git a/dxhy-common/src/main/java/com/dxhy/common/util/InvoiceUtil.java b/dxhy-common/src/main/java/com/dxhy/common/util/InvoiceUtil.java index ab89a4b3..9fb04509 100644 --- a/dxhy-common/src/main/java/com/dxhy/common/util/InvoiceUtil.java +++ b/dxhy-common/src/main/java/com/dxhy/common/util/InvoiceUtil.java @@ -108,10 +108,8 @@ public class InvoiceUtil { } public InvoiceUtil(String fpdm,String fphm) { - if (fpdm != null && fpdm.length() >= 10) { - this.fpdm = fpdm; - this.getFplx(fpdm,fphm); - } + this.fpdm = fpdm; + this.getFplx(fpdm,fphm); } /** @@ -195,54 +193,58 @@ public class InvoiceUtil { private void getFplx(String fpdm,String fphm) { String invoiceTypeCode; - - invoiceTypeCode = fpdm.substring(7, 8); - - if (fpdm.length() == 12) { - if (HD.contains(fpdm)) { - fplxdm = FplxEnum.DZP.getFplxDm(); - fplxmc = FplxEnum.DZP.getFplxMc(FplxEnum.DZP.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) && "11".equals(fpdm.substring(10, 12))) { - fplxdm = FplxEnum.DZP.getFplxDm(); - fplxmc = FplxEnum.DZP.getFplxMc(FplxEnum.DZP.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) && "12".equals(fpdm.substring(10, 12))) { - fplxdm = FplxEnum.TXF.getFplxDm(); - fplxmc = FplxEnum.TXF.getFplxMc(FplxEnum.TXF.getIndex()); - } else if (!"0".equals(fpdm.substring(0, 1)) && "2".equals(invoiceTypeCode)) { - fplxdm = FplxEnum.JDC.getFplxDm(); - fplxmc = FplxEnum.JDC.getFplxMc(FplxEnum.JDC.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) - && ("06".equals(fpdm.substring(10, 12)) || "07".equals(fpdm.substring(10, 12)))) { - fplxdm = FplxEnum.JSP.getFplxDm(); - fplxmc = FplxEnum.JSP.getFplxMc(FplxEnum.JSP.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) - && ("04".equals(fpdm.substring(10, 12)) || "05".equals(fpdm.substring(10, 12)))) { - fplxdm = FplxEnum.PP.getFplxDm(); - fplxmc = FplxEnum.PP.getFplxMc(FplxEnum.PP.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) && "17".equals(fpdm.substring(10, 12))) { - fplxdm = FplxEnum.ESC.getFplxDm(); - fplxmc = FplxEnum.ESC.getFplxMc(FplxEnum.ESC.getIndex()); - } else if ("0".equals(fpdm.substring(0, 1)) && "13".equals(fpdm.substring(10, 12))) { - fplxdm = FplxEnum.DZZP.getFplxDm(); - fplxmc = FplxEnum.DZZP.getFplxMc(FplxEnum.DZZP.getIndex()); + if(fpdm != null && StringUtils.isNoneBlank(fpdm) && fphm.length()>10) { + invoiceTypeCode = fpdm.substring(7, 8); + + if (fpdm.length() == 12) { + if (HD.contains(fpdm)) { + fplxdm = FplxEnum.DZP.getFplxDm(); + fplxmc = FplxEnum.DZP.getFplxMc(FplxEnum.DZP.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) && "11".equals(fpdm.substring(10, 12))) { + fplxdm = FplxEnum.DZP.getFplxDm(); + fplxmc = FplxEnum.DZP.getFplxMc(FplxEnum.DZP.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) && "12".equals(fpdm.substring(10, 12))) { + fplxdm = FplxEnum.TXF.getFplxDm(); + fplxmc = FplxEnum.TXF.getFplxMc(FplxEnum.TXF.getIndex()); + } else if (!"0".equals(fpdm.substring(0, 1)) && "2".equals(invoiceTypeCode)) { + fplxdm = FplxEnum.JDC.getFplxDm(); + fplxmc = FplxEnum.JDC.getFplxMc(FplxEnum.JDC.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) + && ("06".equals(fpdm.substring(10, 12)) || "07".equals(fpdm.substring(10, 12)))) { + fplxdm = FplxEnum.JSP.getFplxDm(); + fplxmc = FplxEnum.JSP.getFplxMc(FplxEnum.JSP.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) + && ("04".equals(fpdm.substring(10, 12)) || "05".equals(fpdm.substring(10, 12)))) { + fplxdm = FplxEnum.PP.getFplxDm(); + fplxmc = FplxEnum.PP.getFplxMc(FplxEnum.PP.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) && "17".equals(fpdm.substring(10, 12))) { + fplxdm = FplxEnum.ESC.getFplxDm(); + fplxmc = FplxEnum.ESC.getFplxMc(FplxEnum.ESC.getIndex()); + } else if ("0".equals(fpdm.substring(0, 1)) && "13".equals(fpdm.substring(10, 12))) { + fplxdm = FplxEnum.DZZP.getFplxDm(); + fplxmc = FplxEnum.DZZP.getFplxMc(FplxEnum.DZZP.getIndex()); + } else { + fplxdm = null; + } + } else if (fpdm.length() == 10) { + if ("1".equals(invoiceTypeCode) || "5".equals(invoiceTypeCode)) { + fplxdm = FplxEnum.ZP.getFplxDm(); + fplxmc = FplxEnum.ZP.getFplxMc(FplxEnum.ZP.getIndex()); + } else if ("6".equals(invoiceTypeCode) || "3".equals(invoiceTypeCode)) { + fplxdm = FplxEnum.PP.getFplxDm(); + fplxmc = FplxEnum.PP.getFplxMc(FplxEnum.PP.getIndex()); + } else { + fplxdm = null; + } + } else if (StringUtils.isBlank(fpdm) && fphm.length() == 20) { + fplxdm = FplxEnum.QDZZP.getFplxDm(); + fplxmc = FplxEnum.QDZZP.getFplxMc(FplxEnum.QDPP.getIndex()); } else { fplxdm = null; } - } else if (fpdm.length() == 10) { - if ("1".equals(invoiceTypeCode) || "5".equals(invoiceTypeCode)) { - fplxdm = FplxEnum.ZP.getFplxDm(); - fplxmc = FplxEnum.ZP.getFplxMc(FplxEnum.ZP.getIndex()); - } else if ("6".equals(invoiceTypeCode) || "3".equals(invoiceTypeCode)) { - fplxdm = FplxEnum.PP.getFplxDm(); - fplxmc = FplxEnum.PP.getFplxMc(FplxEnum.PP.getIndex()); - } else { - fplxdm = null; - } - } else if (StringUtils.isBlank(fpdm) && fphm.length() == 20) { + }else if (StringUtils.isBlank(fpdm) && fphm.length() == 20) { fplxdm = FplxEnum.QDZZP.getFplxDm(); fplxmc = FplxEnum.QDZZP.getFplxMc(FplxEnum.QDPP.getIndex()); - } else { - fplxdm = null; } } diff --git a/dxhy-customs/src/main/java/com/dxhy/customs/service/impl/CustomsSignServiceImpl.java b/dxhy-customs/src/main/java/com/dxhy/customs/service/impl/CustomsSignServiceImpl.java index 7e9a6da1..6680fda6 100644 --- a/dxhy-customs/src/main/java/com/dxhy/customs/service/impl/CustomsSignServiceImpl.java +++ b/dxhy-customs/src/main/java/com/dxhy/customs/service/impl/CustomsSignServiceImpl.java @@ -563,7 +563,7 @@ public class CustomsSignServiceImpl extends MpBaseServiceImpl> singleInvoiceCheck(@RequestBody Map pramsMap) { + public ResponseEntity singleInvoiceCheck(@RequestBody Map pramsMap) { log.info("传入的参数为:{}",pramsMap); String userid = "101833"; String dbName = "business"; @@ -89,12 +89,12 @@ public class SDNYMainProcessController extends AbstractController { JSONObject checkInvoiceResult = null; InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode")); String fplxdm = iu.getFplxdm(); - if(fplxdm != null) { + if(fplxdm != null || "10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) { //查验类发票,执行查验操作后入库 log.info("查验类发票,执行查验操作后入库"); //权限校验 if (pramsMap.get("invoiceNumber").isEmpty()) { - return ResponseEntity.ok(R.error("发票号码不能为空!")); + return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!"))); } pramsMap.put("invoiceNo", pramsMap.get("invoiceNumber")); @@ -105,11 +105,11 @@ public class SDNYMainProcessController extends AbstractController { pramsMap.put("invoiceDate", billingDate); pramsMap.put("billingDate", billingDate); } else { - return ResponseEntity.ok(R.error("开票日期不能为空!")); + return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!"))); } if (pramsMap.get("invoiceType").isEmpty()) { - return ResponseEntity.ok(R.error("开票日期不能为空!")); + return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!"))); } if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) @@ -119,11 +119,11 @@ public class SDNYMainProcessController extends AbstractController { || SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType")) || SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) { if (pramsMap.get("totalAmount").isEmpty()) { - return ResponseEntity.ok(R.error("金额不能为空!")); + return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!"))); } } else { if (pramsMap.get("checkCode").isEmpty()) { - return ResponseEntity.ok(R.error("校验码不能为空!")); + return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!"))); } } @@ -136,7 +136,7 @@ public class SDNYMainProcessController extends AbstractController { String uuid = (StringUtils.isBlank(pramsMap.get("invoiceCode")) ? "" : pramsMap.get("invoiceCode")) + pramsMap.get("invoiceNo"); String notes = invoiceQueryService.checkingInvoiceInfo("business", uuid, getUserInfo()); if (notes != null) { - return ResponseEntity.ok(R.error(notes)); + return ResponseEntity.ok(JSONObject.toJSONString(R.error(notes))); } //查询底账库是否有对应发票,有则直接返回 @@ -147,7 +147,7 @@ public class SDNYMainProcessController extends AbstractController { String checkInvoice = JSONObject.toJSONString(checkInvoiceByUuid); data.put("data", checkInvoice); - return ResponseEntity.ok(data); + return ResponseEntity.ok(JSONObject.toJSONString(data)); } @@ -170,7 +170,7 @@ public class SDNYMainProcessController extends AbstractController { signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, userid, "1", dbName); } - return ResponseEntity.ok(data); + return ResponseEntity.ok(JSONObject.toJSONString(data)); } }else{ //其他类发票,直接入库 @@ -189,10 +189,10 @@ public class SDNYMainProcessController extends AbstractController { } data.put("data", checkInvoiceResult); - return ResponseEntity.ok(data); + return ResponseEntity.ok(JSONObject.toJSONString(data)); } - return ResponseEntity.ok(R.error().put("data", checkInvoiceResult)); + return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult))); } /** @@ -201,7 +201,7 @@ public class SDNYMainProcessController extends AbstractController { @PostMapping("/sn/syncInvoiceInfo") @ResponseBody @SysLog("同步发票信息") - public ResponseEntity> syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) { + public ResponseEntity syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) { log.info("影像系统同步数据:{}",JSONObject.toJSONString(snRequestObject)); @@ -239,7 +239,13 @@ public class SDNYMainProcessController extends AbstractController { String snFplx = ""; String invoiceCode = invoice.getInvoiceCode(); String invoiceNo = invoice.getInvoiceNumber(); - reimburse = snPushCheckRecordService.updateInvoicePoll(snRequestObject, company, taxNo, reimburse, invoice, fplxdm, invoiceCode, invoiceNo); + result = snPushCheckRecordService.updateInvoicePoll(snRequestObject, company, taxNo, reimburse, invoice, fplxdm, invoiceCode, invoiceNo); + + if(!"ok".equals(result) && !"0000".equals(result)){ + R data = new R(1000, "default success"); + data.put("data", result); + return ResponseEntity.ok(JSONObject.toJSONString(data)); + } //推送到SAP SNSAPObject object = convertToSapOnject(invoice, imageId,compCode); @@ -254,18 +260,18 @@ public class SDNYMainProcessController extends AbstractController { } catch (Exception e) { e.printStackTrace(); log.error("", e); - return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)); + return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY))); } } } R data = new R(1000, "default success"); data.put("data", result); - return ResponseEntity.ok(data); + return ResponseEntity.ok(JSONObject.toJSONString(data)); } catch (Exception e) { e.printStackTrace(); } - return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT)); + return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT))); } @@ -289,16 +295,14 @@ public class SDNYMainProcessController extends AbstractController { String dataExchangeId = paramMap.get("dataExchangeId"); TreeMap sortMap = new TreeMap<>(); - sortMap.put(ConfigurerInfo.SECRETID, secretId); - sortMap.put(ConfigurerInfo.DATA_EXCHANGE_ID, dataExchangeId); - sortMap.put(ConfigurerInfo.ENCRYPTCODE, "0"); - sortMap.put(ConfigurerInfo.ZIPCODE, "0"); - sortMap.put(ConfigurerInfo.CONTENT, content); + sortMap.put("SecretId", secretId); + sortMap.put("dataExchangeId", dataExchangeId); + sortMap.put("encryptCode", "0"); + sortMap.put("zipCode", "0"); + sortMap.put("content", content); String url = "POST"+ ip +"/invoice/jxpt/api/v5/"+ apiCode +"?"; - String data = "POST"+ ip +"/invoice/jxpt/api/v5/"+ apiCode +"?SecretId="+ secretId + "&content="+ content +"&dataExchangeId="+ dataExchangeId +"&encryptCode=0&zipCode=0"; - String signature = HmacSHA1Util.genSign(url, sortMap,secretKey); return signature; } @@ -332,7 +336,7 @@ public class SDNYMainProcessController extends AbstractController { info.setZJKZM(snInvoice.getImportCertificateNo()); info.setZDJZH(snInvoice.getCertificateNo()); info.setZGFMC(snInvoice.getPurchaserName()); - if(snInvoice.getTotalAmount() != null && snInvoice.getTotalAmount() != null) { + if(snInvoice.getTotalAmount() != null && snInvoice.getTotalTax() != null) { BigDecimal total = new BigDecimal(snInvoice.getTotalAmount()); BigDecimal tax = new BigDecimal(snInvoice.getTotalTax()); BigDecimal subtract = total.subtract(tax); @@ -384,7 +388,11 @@ public class SDNYMainProcessController extends AbstractController { sapInvoiceDetail.setZSL(snInvoiceDetail.getQuantity()); sapInvoiceDetail.setZSM(info.getZSM()); sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel()); - sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber()); + if(snInvoice.getInvoiceCode() != null) { + sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber()); + }else{ + sapInvoiceDetail.setZTID(snInvoice.getInvoiceNumber()); + } sapInvoiceDetailList.add(sapInvoiceDetail); } diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java index adae0939..efbc4223 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java @@ -128,9 +128,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { QueryWrapper recordWrapper = new QueryWrapper<>(); String uuid = ""; - if(StringUtils.isNoneBlank(fpdm)){ + if (StringUtils.isNoneBlank(fpdm)) { uuid = fpdm + fphm; - }else{ + } else { uuid = fpdm; } recordWrapper.eq("uuid", uuid); @@ -157,7 +157,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { recordInvoice.setInvoiceCode(fpdm); recordInvoice.setInvoiceNo(fphm); recordInvoice.setInvoiceAmount(new BigDecimal(je)); - recordInvoice.setTaxAmount(new BigDecimal(se)); + if(se != null) { + recordInvoice.setTaxAmount(new BigDecimal(se)); + } recordInvoice.setXfTaxNo(xfsh); recordInvoice.setGfTaxNo(gfsbh); recordInvoice.setGfName(gfmc); @@ -504,11 +506,13 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { int index = taxRateDetail.indexOf("%"); if (index > 0) { taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1); - int num = Integer.parseInt(taxRateDetail); + Float num = Float.parseFloat(taxRateDetail); if (num > 9) { taxRateDetail = "0." + taxRateDetail; } else { - taxRateDetail = "0.0" + taxRateDetail; + if(!taxRateDetail.startsWith("0")){ + taxRateDetail = "0.0" + taxRateDetail; + } } } } @@ -549,74 +553,88 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { return jsonObject; } - public TDxInvoiceReimburse updateInvoicePoll(@RequestBody SNRequestObject snRequestObject, String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm, String invoiceCode, String invoiceNo) throws Exception { + public String updateInvoicePoll(@RequestBody SNRequestObject snRequestObject, String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm, String invoiceCode, String invoiceNo) throws Exception { + String result = "0000"; //判断发票类型 fplxdm = getFplx(invoice, fplxdm); //如果是可价税分离的票种,直接入报销库 - if(SNFplxEnum.HCP.getFplxDm().equals(fplxdm) || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm) + if (SNFplxEnum.HCP.getFplxDm().equals(fplxdm) || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm) || SNFplxEnum.JPXCD.getFplxDm().equals(fplxdm) || SNFplxEnum.CP.getFplxDm().equals(fplxdm) - || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm)){ + || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm)) { InvoiceInfo invoiceInfo = convertToInvoiceInfo(invoice); + log.info("进行价税分离的发票信息为:{}", invoiceInfo); + ServiceResult invoiceResult = this.valoremTaxCount(invoiceInfo, "Y"); InvoiceInfo data = invoiceResult.getData(); + if (data != null) { + invoice.setIsDeductible(data.getIsDeductible()); + invoice.setTaxRate(data.getTaxRate()); + if(data.getInvoiceAmount() != null) { + invoice.setTotalAmount(data.getInvoiceAmount().toString()); + } + if(data.getTaxAmount() != null) { + invoice.setTotalTax(data.getTaxAmount().toString()); + } + } + + if (!"ok".equals(invoiceResult.getMsg()) && !"0000".equals(invoiceResult.getMsg())) { + log.info("价税分离失败:{}",invoiceResult.getMsg()); + return invoiceResult.getMsg(); + } - invoice.setIsDeductible(data.getIsDeductible()); - invoice.setTaxRate(data.getTaxRate()); - invoice.setTotalAmount(data.getInvoiceAmount().toString()); - invoice.setTotalTax(data.getTaxAmount().toString()); - reimburse = convertToReimburse(invoice,reimburse,fplxdm,company); + reimburse = convertToReimburse(invoice, reimburse, fplxdm, company); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); int insert = 0; QueryWrapper wrapper = new QueryWrapper(); - wrapper.eq("uuid",reimburse.getUuid()); + wrapper.eq("uuid", reimburse.getUuid()); TDxInvoiceReimburse reimburse1 = tDxInvoiceReimburseService.getBaseMapper().selectOne(wrapper); - if(reimburse1 != null){ + if (reimburse1 != null) { insert = tDxInvoiceReimburseService.getBaseMapper().updateById(reimburse1); - }else{ + } else { insert = tDxInvoiceReimburseService.getBaseMapper().insert(reimburse); } - if(insert > 0){ + if (insert > 0) { log.info("实名客票插入报销库成功"); } - }else{ + } else { //如果是可查验类型,直接更新数据库 - InvoiceUtil iu = new InvoiceUtil(invoiceCode,invoiceNo); + InvoiceUtil iu = new InvoiceUtil(invoiceCode, invoiceNo); fplxdm = iu.getFplxdm(); - if(fplxdm != null) { + if (fplxdm != null) { //可查验发票,已入库,更新票池 Integer integer = this.pushInvoiceToRecordInvoice2(snRequestObject); log.info("可查验发票,更新票池完成"); - }else{ + } else { //不可查验发票,未入库,插入票池 - this.pushInvoiceToRecordInvoice(snRequestObject,taxNo,company); + this.pushInvoiceToRecordInvoice(snRequestObject, taxNo, company); log.info("不可查验发票,更新票池完成"); } } - return reimburse; + return result; } - private TDxInvoiceReimburse convertToReimburse(SNInvoice invoice, TDxInvoiceReimburse reimburse,String fplxdm,String company) { + private TDxInvoiceReimburse convertToReimburse(SNInvoice invoice, TDxInvoiceReimburse reimburse, String fplxdm, String company) { reimburse.setInvoiceType(fplxdm); reimburse.setInvoiceCode(invoice.getInvoiceCode()); reimburse.setInvoiceNo(invoice.getInvoiceNumber()); reimburse.setInvoiceDate(invoice.getBillingDate()); reimburse.setPassenger(invoice.getRiderName()); - if(invoice.getTotalAmount() != null) { + if (invoice.getTotalAmount() != null) { reimburse.setInvoiceAmount(new BigDecimal(invoice.getTotalAmount())); } - if(invoice.getAmountTax() != null) { + if (invoice.getAmountTax() != null) { reimburse.setTotalAmount(new BigDecimal(invoice.getAmountTax())); } - if(invoice.getTotalTax() != null) { + if (invoice.getTotalTax() != null) { reimburse.setTaxAmount(new BigDecimal(invoice.getTotalTax())); } @@ -638,9 +656,9 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { reimburse.setTaxRate(invoice.getTaxRate()); reimburse.setIsDeduction(invoice.getIsDeductible()); - if(StringUtils.isNoneBlank(reimburse.getInvoiceCode())){ + if (StringUtils.isNoneBlank(reimburse.getInvoiceCode())) { reimburse.setUuid(reimburse.getInvoiceCode() + reimburse.getInvoiceNo()); - }else{ + } else { reimburse.setUuid(reimburse.getInvoiceNo()); } Date date = new Date(); @@ -677,15 +695,15 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { invoice.setPassenger(snInvoice.getRiderName()); invoice.setDepartCity(snInvoice.getStationGetOn()); invoice.setArriveCity(snInvoice.getStationGetOff()); - if("92".equals(invoice.getInvoiceTypeCode())){ - if(snInvoice.getAmountTax() != null) + if ("92".equals(invoice.getInvoiceTypeCode())) { + if (snInvoice.getAmountTax() != null) invoice.setInvoiceAmount(new BigDecimal(snInvoice.getAmountTax())); } - if("90".equals(invoice.getInvoiceTypeCode())) { + if ("90".equals(invoice.getInvoiceTypeCode())) { invoice.setFare(snInvoice.getNoTaxAmount()); invoice.setFuelSurcharge(snInvoice.getFuelSurcharge()); } - if(snInvoice.getNoTaxAmount() != null){ + if (snInvoice.getNoTaxAmount() != null) { BigDecimal amount = new BigDecimal(snInvoice.getNoTaxAmount()); invoice.setInvoiceAmount(amount); } @@ -696,47 +714,47 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { private String getFplx(SNInvoice invoice, String fplxdm) { String snFplx = invoice.getInvoiceType(); - if(SNFplxEnum.HCP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.HCP.getSnFplxDm().equals(snFplx)) { fplxdm = "92"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.KYQCP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.KYQCP.getSnFplxDm().equals(snFplx)) { fplxdm = "94"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.JPXCD.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.JPXCD.getSnFplxDm().equals(snFplx)) { fplxdm = "90"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.DEFP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.DEFP.getSnFplxDm().equals(snFplx)) { fplxdm = "95"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.JDFP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.JDFP.getSnFplxDm().equals(snFplx)) { fplxdm = "97"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.CZCFP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.CZCFP.getSnFplxDm().equals(snFplx)) { fplxdm = "91"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.KYQCP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.KYQCP.getSnFplxDm().equals(snFplx)) { fplxdm = "89"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.GLF.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.GLF.getSnFplxDm().equals(snFplx)) { fplxdm = "101"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.CP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.CP.getSnFplxDm().equals(snFplx)) { fplxdm = "88"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.GJXP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.GJXP.getSnFplxDm().equals(snFplx)) { fplxdm = "99"; invoice.setInvoiceType(fplxdm); } - if(SNFplxEnum.QTFP.getSnFplxDm().equals(snFplx)){ + if (SNFplxEnum.QTFP.getSnFplxDm().equals(snFplx)) { fplxdm = "00"; invoice.setInvoiceType(fplxdm); } @@ -768,11 +786,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { } // 校验客票可抵扣条件 - ServiceResult result = checkIsDeduction(invoiceInfo); - if (!result.getResult()) { - logger.error("客票价税计算失败:" + result.getMsg()); - return fail(result.getMsg()); - } +// ServiceResult result = checkIsDeduction(invoiceInfo); +// if (!result.getResult()) { +// logger.error("客票价税计算失败:" + result.getMsg()); +// return fail(result.getMsg()); +// } // 设置可抵扣标识 invoiceInfo.setIsDeductible(isDeductible); // 设置税率 @@ -802,13 +820,15 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { } // 铁路客票:税额=票面金额÷(1+9%)×9% } else if (invoiceInfo.getInvoiceTypeCode().equals(Constant.RAILWAY_TICKET_CODE)) { - invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount() - .divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09"))); + if (invoiceInfo.getInvoiceAmount() != null) + invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount() + .divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09"))); // 公路、水路、其他客票:税额=票面金额÷(1+3%)×3% } else if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE) && !invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) { - invoiceInfo.setInvoiceAmount(invoiceInfo.getInvoiceAmount() - .divide(new BigDecimal("1.03"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.03"))); + if (invoiceInfo.getInvoiceAmount() != null) + invoiceInfo.setInvoiceAmount(invoiceInfo.getInvoiceAmount() + .divide(new BigDecimal("1.03"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.03"))); } // 税额保留两位小数(四舍五入) if (invoiceInfo.getInvoiceAmount() != null) { diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/GatherServiceImpl.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/GatherServiceImpl.java index 3cc46bdf..17a59034 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/GatherServiceImpl.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/GatherServiceImpl.java @@ -749,10 +749,8 @@ public class GatherServiceImpl extends MpBaseServiceImpl param = JSONObject.parseObject(map.get("data").getBytes(),Map.class); - ResponseEntity responseEntity = mainService.singleInvoiceCheck(param); - String body = responseEntity.getBody().toString(); - - body = body.replaceAll("=",":"); + ResponseEntity responseEntity = mainService.singleInvoiceCheck(param); + String body = responseEntity.getBody(); // Map resultMap = Arrays.asList(body.split("=")).stream() // .map(elem -> elem.split(":"))