|
|
@ -8,10 +8,8 @@ import com.dxhy.common.controller.AbstractController; |
|
|
|
import com.dxhy.common.enums.SNFplxEnum; |
|
|
|
import com.dxhy.common.enums.SNFplxEnum; |
|
|
|
import com.dxhy.common.util.InvoiceUtil; |
|
|
|
import com.dxhy.common.util.InvoiceUtil; |
|
|
|
import com.dxhy.common.utils.R; |
|
|
|
import com.dxhy.common.utils.R; |
|
|
|
import com.dxhy.erp.dao.TdxSaleRecordInvoiceDao; |
|
|
|
|
|
|
|
import com.dxhy.erp.entity.TDxInvoiceReimburse; |
|
|
|
import com.dxhy.erp.entity.TDxInvoiceReimburse; |
|
|
|
import com.dxhy.erp.entity.TdxCheckRecordInvoice; |
|
|
|
import com.dxhy.erp.entity.TdxCheckRecordInvoice; |
|
|
|
import com.dxhy.erp.entity.TdxSaleRecordInvoice; |
|
|
|
|
|
|
|
import com.dxhy.erp.entity.sdny.*; |
|
|
|
import com.dxhy.erp.entity.sdny.*; |
|
|
|
import com.dxhy.erp.service.*; |
|
|
|
import com.dxhy.erp.service.*; |
|
|
|
import com.dxhy.erp.utils.HmacSHA1Util; |
|
|
|
import com.dxhy.erp.utils.HmacSHA1Util; |
|
|
@ -61,9 +59,6 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private TDxInvoiceReimburseService tDxInvoiceReimburseService; |
|
|
|
private TDxInvoiceReimburseService tDxInvoiceReimburseService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
TdxSaleRecordInvoiceDao tdxSaleRecordInvoiceDao; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查验发票 |
|
|
|
* 查验发票 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -142,16 +137,6 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
data.put("data", checkInvoice); |
|
|
|
data.put("data", checkInvoice); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
}else{ |
|
|
|
|
|
|
|
TdxSaleRecordInvoice tdxSaleRecordInvoice = tdxSaleRecordInvoiceDao.selectByUuid(uuid); |
|
|
|
|
|
|
|
if(tdxSaleRecordInvoice != null){ |
|
|
|
|
|
|
|
R data = new R(1000, "default success"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String checkInvoice = JSONObject.toJSONString(tdxSaleRecordInvoice); |
|
|
|
|
|
|
|
data.put("data", checkInvoice); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -363,7 +348,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
info.setZDJZH(snInvoice.getCertificateNo()); |
|
|
|
info.setZDJZH(snInvoice.getCertificateNo()); |
|
|
|
info.setZGFMC(snInvoice.getPurchaserName()); |
|
|
|
info.setZGFMC(snInvoice.getPurchaserName()); |
|
|
|
info.setSORT(snInvoice.getSort()); |
|
|
|
info.setSORT(snInvoice.getSort()); |
|
|
|
if (snInvoice.getTotalAmount() != null && snInvoice.getTotalTax() != null) { |
|
|
|
if (snInvoice.getTotalAmount() != null) { |
|
|
|
BigDecimal total = new BigDecimal(snInvoice.getTotalAmount()); |
|
|
|
BigDecimal total = new BigDecimal(snInvoice.getTotalAmount()); |
|
|
|
// BigDecimal tax = new BigDecimal(snInvoice.getTotalTax());
|
|
|
|
// BigDecimal tax = new BigDecimal(snInvoice.getTotalTax());
|
|
|
|
// BigDecimal subtract = total.subtract(tax);
|
|
|
|
// BigDecimal subtract = total.subtract(tax);
|
|
|
@ -371,7 +356,6 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
info.setZJK("0.00"); |
|
|
|
info.setZJK("0.00"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
info.setZSCSJ(date); |
|
|
|
info.setZSCSJ(date); |
|
|
|
info.setZYSHW(snInvoice.getCargoInformation()); |
|
|
|
info.setZYSHW(snInvoice.getCargoInformation()); |
|
|
|
info.setZFPLX(snFplx); |
|
|
|
info.setZFPLX(snFplx); |
|
|
@ -383,14 +367,11 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
info.setZSKPH(snInvoice.getMachineCode()); |
|
|
|
info.setZSKPH(snInvoice.getMachineCode()); |
|
|
|
info.setZGFZH(snInvoice.getPurchaserBank()); |
|
|
|
info.setZGFZH(snInvoice.getPurchaserBank()); |
|
|
|
info.setZBZ(snInvoice.getRemarks()); |
|
|
|
info.setZBZ(snInvoice.getRemarks()); |
|
|
|
|
|
|
|
|
|
|
|
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList(); |
|
|
|
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList(); |
|
|
|
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>(); |
|
|
|
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>(); |
|
|
|
if (invoiceLineList != null && invoiceLineList.size() > 0) { |
|
|
|
if (invoiceLineList != null && invoiceLineList.size() > 0) { |
|
|
|
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0); |
|
|
|
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0); |
|
|
|
String taxRate = snInvoiceDetail.getTaxRate(); |
|
|
|
|
|
|
|
info.setZSM(getZSM(taxRate)); |
|
|
|
|
|
|
|
info.setZTAX(taxRate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAPInvoiceDetail sapInvoiceDetail = new SAPInvoiceDetail(); |
|
|
|
SAPInvoiceDetail sapInvoiceDetail = new SAPInvoiceDetail(); |
|
|
|
// sapInvoiceDetail.setZZWDJ("");
|
|
|
|
// sapInvoiceDetail.setZZWDJ("");
|
|
|
|
sapInvoiceDetail.setIMG_ID(imageId); |
|
|
|
sapInvoiceDetail.setIMG_ID(imageId); |
|
|
@ -401,10 +382,29 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
sapInvoiceDetail.setZCFZ(snInvoice.getStationGetOn()); |
|
|
|
sapInvoiceDetail.setZCFZ(snInvoice.getStationGetOn()); |
|
|
|
sapInvoiceDetail.setZTXZ(snInvoiceDetail.getCurrentDateEnd()); |
|
|
|
sapInvoiceDetail.setZTXZ(snInvoiceDetail.getCurrentDateEnd()); |
|
|
|
sapInvoiceDetail.setZTXQ(snInvoiceDetail.getCurrentDateStart()); |
|
|
|
sapInvoiceDetail.setZTXQ(snInvoiceDetail.getCurrentDateStart()); |
|
|
|
|
|
|
|
|
|
|
|
if (snInvoiceDetail.getAmount() != null) |
|
|
|
if (snInvoiceDetail.getAmount() != null) |
|
|
|
sapInvoiceDetail.setZJK(snInvoiceDetail.getAmount()); |
|
|
|
sapInvoiceDetail.setZJK(snInvoiceDetail.getAmount()); |
|
|
|
sapInvoiceDetail.setZHH(snInvoiceDetail.getRowNo()); |
|
|
|
sapInvoiceDetail.setZHH(snInvoiceDetail.getRowNo()); |
|
|
|
sapInvoiceDetail.setZTAX(snInvoiceDetail.getTaxRate()); |
|
|
|
//将类似于0.03数据格式转化为3.00
|
|
|
|
|
|
|
|
if (snInvoiceDetail.getTaxRate() != null && snInvoiceDetail.getTaxRate() != ""){ |
|
|
|
|
|
|
|
sapInvoiceDetail.setZTAX(snInvoiceDetail.getTaxRate()); |
|
|
|
|
|
|
|
if (snInvoiceDetail.equals("0")){ |
|
|
|
|
|
|
|
sapInvoiceDetail.setZTAX("0.00"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (snInvoiceDetail.getTaxRate().contains(".")){ |
|
|
|
|
|
|
|
String getTaxRate = snInvoiceDetail.getTaxRate(); |
|
|
|
|
|
|
|
if (snInvoiceDetail.getTaxRate().length() > 4){ |
|
|
|
|
|
|
|
getTaxRate = getTaxRate.substring(0,4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BigDecimal tax = new BigDecimal(getTaxRate); |
|
|
|
|
|
|
|
BigDecimal tax1 = tax.multiply(new BigDecimal("100")); |
|
|
|
|
|
|
|
sapInvoiceDetail.setZTAX(tax1.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (invoiceLineList.size() == 1 && snInvoice.getTaxRate() == null){ |
|
|
|
|
|
|
|
info.setZTAX(sapInvoiceDetail.getZTAX()); |
|
|
|
|
|
|
|
} |
|
|
|
// sapInvoiceDetail.setZHBH("");
|
|
|
|
// sapInvoiceDetail.setZHBH("");
|
|
|
|
sapInvoiceDetail.setZDJ(snInvoiceDetail.getUnitPrice()); |
|
|
|
sapInvoiceDetail.setZDJ(snInvoiceDetail.getUnitPrice()); |
|
|
|
// sapInvoiceDetail.setZHID("");
|
|
|
|
// sapInvoiceDetail.setZHID("");
|
|
|
@ -415,7 +415,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
sapInvoiceDetail.setZGSJBM(snInvoiceDetail.getCommodityCode()); |
|
|
|
sapInvoiceDetail.setZGSJBM(snInvoiceDetail.getCommodityCode()); |
|
|
|
sapInvoiceDetail.setZSE(snInvoiceDetail.getTax()); |
|
|
|
sapInvoiceDetail.setZSE(snInvoiceDetail.getTax()); |
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getTaxRate()); |
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getTaxRate()); |
|
|
|
sapInvoiceDetail.setZSM(info.getZSM()); |
|
|
|
sapInvoiceDetail.setZSM(getZSM(snInvoiceDetail.getTaxRate())); |
|
|
|
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel()); |
|
|
|
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel()); |
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx); |
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx); |
|
|
@ -427,6 +427,22 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
|
|
|
|
|
|
|
info.setIT_ITEM(sapInvoiceDetailList); |
|
|
|
info.setIT_ITEM(sapInvoiceDetailList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取税率
|
|
|
|
|
|
|
|
String taxRate = snInvoice.getTaxRate(); |
|
|
|
|
|
|
|
if (taxRate !=null && taxRate.contains("%")){ |
|
|
|
|
|
|
|
String replace = taxRate.replace("%", ""); |
|
|
|
|
|
|
|
BigDecimal bigDecimal = new BigDecimal(replace); |
|
|
|
|
|
|
|
BigDecimal divide = bigDecimal.divide(new BigDecimal(100)); |
|
|
|
|
|
|
|
taxRate = divide.toString(); |
|
|
|
|
|
|
|
info.setZTAX(bigDecimal.multiply(new BigDecimal("0.01")).toString()); |
|
|
|
|
|
|
|
info.setZSM(getZSM(taxRate)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (info.getZTAX() != null){ |
|
|
|
|
|
|
|
info.setZSM(getZSM(info.getZTAX())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (info.getZTAX() == null || info.getZTAX() == ""){ |
|
|
|
|
|
|
|
info.setZTAX("0.00"); |
|
|
|
|
|
|
|
} |
|
|
|
info.setZFPDM(snInvoice.getInvoiceCode()); |
|
|
|
info.setZFPDM(snInvoice.getInvoiceCode()); |
|
|
|
info.setZCD(snInvoice.getOriginPlace()); |
|
|
|
info.setZCD(snInvoice.getOriginPlace()); |
|
|
|
info.setZSCCZ(snInvoice.getStationGetOn()); |
|
|
|
info.setZSCCZ(snInvoice.getStationGetOn()); |
|
|
@ -449,6 +465,8 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
info.setZFPZT(snInvoice.getState()); |
|
|
|
info.setZFPZT(snInvoice.getState()); |
|
|
|
if (snInvoice.getState() == null) { |
|
|
|
if (snInvoice.getState() == null) { |
|
|
|
info.setZFPZT("0"); |
|
|
|
info.setZFPZT("0"); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
info.setZFPZT(snInvoice.getState()); |
|
|
|
} |
|
|
|
} |
|
|
|
// info.setZESCSC("");
|
|
|
|
// info.setZESCSC("");
|
|
|
|
info.setZFDJM(snInvoice.getEngineNo()); |
|
|
|
info.setZFDJM(snInvoice.getEngineNo()); |
|
|
@ -483,10 +501,10 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
// info.setZYGC("");
|
|
|
|
// info.setZYGC("");
|
|
|
|
info.setZJSHJ(snInvoice.getAmountTax()); |
|
|
|
info.setZJSHJ(snInvoice.getAmountTax()); |
|
|
|
info.setZCYRMC(snInvoice.getCarrierName()); |
|
|
|
info.setZCYRMC(snInvoice.getCarrierName()); |
|
|
|
info.setZJGDM(snInvoice.getAdministrativeDivisionNo()); |
|
|
|
info.setZJGDM(snInvoice.getTaxAuthorityNo()); |
|
|
|
//时间转换
|
|
|
|
//时间转换
|
|
|
|
info.setZGXSJ(dateString); |
|
|
|
info.setZGXSJ(dateString); |
|
|
|
info.setZPJZT(snInvoice.getState()); |
|
|
|
info.setZPJZT("1"); |
|
|
|
info.setZZWLX(snInvoice.getSeat()); |
|
|
|
info.setZZWLX(snInvoice.getSeat()); |
|
|
|
info.setZPJLY(snInvoice.getSource()); |
|
|
|
info.setZPJLY(snInvoice.getSource()); |
|
|
|
if (snInvoice.getSource() == null) { |
|
|
|
if (snInvoice.getSource() == null) { |
|
|
@ -499,8 +517,10 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
info.setZCJR("opentext"); |
|
|
|
info.setZCJR("opentext"); |
|
|
|
info.setZGXR("opentext"); |
|
|
|
info.setZGXR("opentext"); |
|
|
|
info.setZQM("opentext"); |
|
|
|
info.setZQM("opentext"); |
|
|
|
String checkDate = snInvoice.getCheckDate().replace("-", "/"); |
|
|
|
if (snInvoice.getCheckDate() != null){ |
|
|
|
info.setZCYRQ(checkDate); |
|
|
|
String checkDate = snInvoice.getCheckDate().replace("-", "/"); |
|
|
|
|
|
|
|
info.setZCYRQ(checkDate); |
|
|
|
|
|
|
|
} |
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
info.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx); |
|
|
|
info.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -588,6 +608,9 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
case "0.00": |
|
|
|
case "0.00": |
|
|
|
sm = "J0"; |
|
|
|
sm = "J0"; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case "0.000": |
|
|
|
|
|
|
|
sm = "J0"; |
|
|
|
|
|
|
|
break; |
|
|
|
case "免税": |
|
|
|
case "免税": |
|
|
|
sm = "J0"; |
|
|
|
sm = "J0"; |
|
|
|
break; |
|
|
|
break; |
|
|
|