|
|
|
@ -25,6 +25,9 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.ParsePosition; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -327,9 +330,13 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
|
|
|
|
|
private SAPInvoiceInfo convertToSapOnject(SNInvoice snInvoice, String imageId, String compCode) { |
|
|
|
|
|
|
|
|
|
//转换时间格式
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); |
|
|
|
|
String dateString = formatter.format(date); |
|
|
|
|
|
|
|
|
|
SAPInvoiceInfo info = new SAPInvoiceInfo(); |
|
|
|
|
|
|
|
|
|
String snFplx = convertToSapType(snInvoice.getInvoiceType()); |
|
|
|
|
info.setZBAZT("0"); |
|
|
|
|
info.setZXFSH(snInvoice.getSalesTaxNo()); |
|
|
|
@ -340,15 +347,17 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setZJKZM(snInvoice.getImportCertificateNo()); |
|
|
|
|
info.setZDJZH(snInvoice.getCertificateNo()); |
|
|
|
|
info.setZGFMC(snInvoice.getPurchaserName()); |
|
|
|
|
info.setSORT(snInvoice.getSort()); |
|
|
|
|
if (snInvoice.getTotalAmount() != null && snInvoice.getTotalTax() != null) { |
|
|
|
|
BigDecimal total = new BigDecimal(snInvoice.getTotalAmount()); |
|
|
|
|
// BigDecimal tax = new BigDecimal(snInvoice.getTotalTax());
|
|
|
|
|
// BigDecimal subtract = total.subtract(tax);
|
|
|
|
|
info.setZJK(total.toString()); |
|
|
|
|
}else { |
|
|
|
|
info.setZJK("0.00"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
info.setZSCSJ(date); |
|
|
|
|
info.setZCYZT(snInvoice.getCheckStaus()); |
|
|
|
|
info.setZYSHW(snInvoice.getCargoInformation()); |
|
|
|
|
info.setZFPLX(snFplx); |
|
|
|
|
info.setZQYD(snInvoice.getTransportRoute()); |
|
|
|
@ -359,6 +368,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setZSKPH(snInvoice.getMachineCode()); |
|
|
|
|
info.setZGFZH(snInvoice.getPurchaserBank()); |
|
|
|
|
info.setZBZ(snInvoice.getRemarks()); |
|
|
|
|
System.out.println(info.getZGXR()); |
|
|
|
|
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList(); |
|
|
|
|
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>(); |
|
|
|
|
if (invoiceLineList != null && invoiceLineList.size() > 0) { |
|
|
|
@ -390,7 +400,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
sapInvoiceDetail.setZDW(snInvoiceDetail.getUnit()); |
|
|
|
|
sapInvoiceDetail.setZGSJBM(snInvoiceDetail.getCommodityCode()); |
|
|
|
|
sapInvoiceDetail.setZSE(snInvoiceDetail.getTax()); |
|
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getQuantity()); |
|
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getTaxRate()); |
|
|
|
|
sapInvoiceDetail.setZSM(info.getZSM()); |
|
|
|
|
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel()); |
|
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
@ -419,8 +429,13 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setIMG_ID(imageId); |
|
|
|
|
info.setZCPH(snInvoice.getLicensePlate()); |
|
|
|
|
info.setZLSLBZ(snInvoice.getZeroTaxRateSign()); |
|
|
|
|
info.setZCJSJ(date); |
|
|
|
|
info.setFPYXBH(snInvoice.getFileId()); |
|
|
|
|
//转换日期
|
|
|
|
|
info.setZCJSJ(dateString); |
|
|
|
|
info.setZFPZT(snInvoice.getState()); |
|
|
|
|
if (snInvoice.getState() == null) { |
|
|
|
|
info.setZFPZT("0"); |
|
|
|
|
} |
|
|
|
|
// info.setZESCSC("");
|
|
|
|
|
info.setZFDJM(snInvoice.getEngineNo()); |
|
|
|
|
info.setZGXR(""); |
|
|
|
@ -441,7 +456,7 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setZXCRS(snInvoice.getPassengersLimited()); |
|
|
|
|
info.setZWSPZ(snInvoice.getPaymentVoucherNo()); |
|
|
|
|
info.setZCCDW(snInvoice.getTonnage()); |
|
|
|
|
info.setZSWJG(snInvoice.getTaxAuthorityNo()); |
|
|
|
|
info.setZSWJG(snInvoice.getTaxAuthorityName()); |
|
|
|
|
// info.setZYWDJ("");
|
|
|
|
|
info.setZXCCZ(snInvoice.getStationGetOff()); |
|
|
|
|
info.setZCCRZH(snInvoice.getIdcardNo()); |
|
|
|
@ -455,10 +470,23 @@ public class SDNYMainProcessController extends AbstractController { |
|
|
|
|
info.setZJSHJ(snInvoice.getAmountTax()); |
|
|
|
|
info.setZCYRMC(snInvoice.getCarrierName()); |
|
|
|
|
info.setZJGDM(snInvoice.getAdministrativeDivisionNo()); |
|
|
|
|
info.setZGXSJ(date); |
|
|
|
|
// info.setZQM("");
|
|
|
|
|
info.setZPJLY(snInvoice.getSource()); |
|
|
|
|
//时间转换
|
|
|
|
|
info.setZGXSJ(dateString); |
|
|
|
|
info.setZPJZT(snInvoice.getState()); |
|
|
|
|
info.setZZWLX(snInvoice.getSeat()); |
|
|
|
|
info.setZPJLY(snInvoice.getSource()); |
|
|
|
|
if (snInvoice.getSource() == null) { |
|
|
|
|
info.setZPJLY("1"); |
|
|
|
|
} |
|
|
|
|
info.setZCYZT(snInvoice.getCheckStaus()); |
|
|
|
|
if (snInvoice.getCheckStaus()==null){ |
|
|
|
|
info.setZCYZT("1"); |
|
|
|
|
} |
|
|
|
|
info.setZCJR("opentext"); |
|
|
|
|
info.setZGXR("opentext"); |
|
|
|
|
info.setZQM("opentext"); |
|
|
|
|
String checkDate = snInvoice.getCheckDate().replace("-", "/"); |
|
|
|
|
info.setZCYRQ(checkDate); |
|
|
|
|
if (snInvoice.getInvoiceCode() != null) { |
|
|
|
|
info.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx); |
|
|
|
|
} else { |
|
|
|
|