|
|
|
package com.dxhy.erp.controller;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.dxhy.common.aspect.SysLog;
|
|
|
|
import com.dxhy.common.constant.CommonConstants;
|
|
|
|
import com.dxhy.common.constant.ConfigureConstant;
|
|
|
|
import com.dxhy.common.controller.AbstractController;
|
|
|
|
import com.dxhy.common.enums.SNFplxEnum;
|
|
|
|
import com.dxhy.common.util.InvoiceUtil;
|
|
|
|
import com.dxhy.common.utils.R;
|
|
|
|
import com.dxhy.erp.entity.TDxInvoiceReimburse;
|
|
|
|
import com.dxhy.erp.entity.TdxCheckRecordInvoice;
|
|
|
|
import com.dxhy.erp.entity.sdny.*;
|
|
|
|
import com.dxhy.erp.service.*;
|
|
|
|
import com.dxhy.erp.utils.HmacSHA1Util;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 山东能源查验主流程控制器
|
|
|
|
*
|
|
|
|
* @author ariesy
|
|
|
|
* @date 2023-03-15
|
|
|
|
*/
|
|
|
|
@SuppressWarnings({"AlibabaUndefineMagicConstant", "AlibabaMethodTooLong"})
|
|
|
|
@RestController
|
|
|
|
@Slf4j
|
|
|
|
public class SDNYMainProcessController extends AbstractController {
|
|
|
|
|
|
|
|
@Value("${sdny.environment}")
|
|
|
|
private String environment;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private InvoiceQueryService invoiceQueryService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private SNPushCheckRecordService snPushCheckRecordService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private SignSaveInvoiceInfoService signSaveInvoiceInfoService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private SignCheckRecordService signCheckRecordService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
private TDxInvoiceReimburseService tDxInvoiceReimburseService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查验发票
|
|
|
|
*/
|
|
|
|
@PostMapping("/sn/singleInvoiceCheck")
|
|
|
|
@ResponseBody
|
|
|
|
@SysLog("发票查验")
|
|
|
|
public ResponseEntity<String> singleInvoiceCheck(@RequestBody Map<String, String> pramsMap) {
|
|
|
|
log.info("传入的参数为:{}", pramsMap);
|
|
|
|
String userid = "101833";
|
|
|
|
String dbName = "business";
|
|
|
|
String company = "BIGB";
|
|
|
|
|
|
|
|
// 入参统一在入口处理
|
|
|
|
// String userid = getLoginName();
|
|
|
|
// String dbName = getUserInfo().getDbName();
|
|
|
|
// String company = getUserInfo().getCompany();
|
|
|
|
JSONObject checkInvoiceResult = null;
|
|
|
|
InvoiceUtil iu = new InvoiceUtil(pramsMap.get("invoiceCode"));
|
|
|
|
String fplxdm = iu.getFplxdm();
|
|
|
|
if (fplxdm != null || "10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) {
|
|
|
|
//查验类发票,执行查验操作后入库
|
|
|
|
log.info("查验类发票,执行查验操作后入库");
|
|
|
|
//权限校验
|
|
|
|
if (pramsMap.get("invoiceNumber").isEmpty()) {
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("发票号码不能为空!")));
|
|
|
|
}
|
|
|
|
|
|
|
|
pramsMap.put("invoiceNo", pramsMap.get("invoiceNumber"));
|
|
|
|
|
|
|
|
if (!pramsMap.get("billingDate").isEmpty()) {
|
|
|
|
String billingDate = pramsMap.get("billingDate").replaceAll("-", "");
|
|
|
|
iu.setKprq(pramsMap.get("billingDate"));
|
|
|
|
pramsMap.put("invoiceDate", billingDate);
|
|
|
|
pramsMap.put("billingDate", billingDate);
|
|
|
|
} else {
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pramsMap.get("invoiceType").isEmpty()) {
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("开票日期不能为空!")));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SNFplxEnum.ZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|
|
|
|
|| SNFplxEnum.JDC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|
|
|
|
|| SNFplxEnum.DZZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|
|
|
|
|| SNFplxEnum.ESC.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|
|
|
|
|| SNFplxEnum.QDZP.getSnFplxDm().equals(pramsMap.get("invoiceType"))
|
|
|
|
|| SNFplxEnum.QDPP.getSnFplxDm().equals(pramsMap.get("invoiceType"))) {
|
|
|
|
if (pramsMap.get("totalAmount").isEmpty()) {
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("金额不能为空!")));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (pramsMap.get("checkCode").isEmpty()) {
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error("校验码不能为空!")));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("10107".equals(pramsMap.get("invoiceType")) || "10108".equals(pramsMap.get("invoiceType"))) {
|
|
|
|
pramsMap.put("invoiceType", "21");
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info("发票类型为:{}", pramsMap.get("invoiceType"));
|
|
|
|
|
|
|
|
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(JSONObject.toJSONString(R.error(notes)));
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询底账库是否有对应发票,有则直接返回
|
|
|
|
TdxCheckRecordInvoice checkInvoiceByUuid = signCheckRecordService.getCheckInvoiceByUuid(uuid);
|
|
|
|
if (checkInvoiceByUuid != null) {
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
|
|
|
|
String checkInvoice = JSONObject.toJSONString(checkInvoiceByUuid);
|
|
|
|
data.put("data", checkInvoice);
|
|
|
|
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!checkInvoiceResult.containsKey("code")) {
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
data.put("message", "success");
|
|
|
|
data.put("data", checkInvoiceResult);
|
|
|
|
|
|
|
|
if (!checkInvoiceResult.containsKey("cyjg")) {
|
|
|
|
|
|
|
|
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
|
|
|
|
checkInvoiceResult.put("company", company);
|
|
|
|
log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
|
|
|
|
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, userid, "1", dbName);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//其他类发票,直接入库
|
|
|
|
log.info("其他类发票,不做查验,直接入库");
|
|
|
|
TDxInvoiceReimburse reimburse = new TDxInvoiceReimburse();
|
|
|
|
int insert = tDxInvoiceReimburseService.getBaseMapper().insert(reimburse);
|
|
|
|
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
data.put("message", "success");
|
|
|
|
|
|
|
|
if (insert > 0) {
|
|
|
|
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber"));
|
|
|
|
checkInvoiceResult.put("company", company);
|
|
|
|
checkInvoiceResult.put("message", "入库成功");
|
|
|
|
log.info("返回给影像系统的结果为:{}", checkInvoiceResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
data.put("data", checkInvoiceResult);
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data));
|
|
|
|
|
|
|
|
}
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error().put("data", checkInvoiceResult)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查验发票
|
|
|
|
*/
|
|
|
|
@PostMapping("/sn/syncInvoiceInfo")
|
|
|
|
@ResponseBody
|
|
|
|
@SysLog("同步发票信息")
|
|
|
|
public ResponseEntity<String> syncInvoiceInfo(@RequestBody SNRequestObject snRequestObject) {
|
|
|
|
|
|
|
|
log.info("影像系统同步数据:{}", JSONObject.toJSONString(snRequestObject));
|
|
|
|
|
|
|
|
String userid = "101833";
|
|
|
|
String dbName = "business";
|
|
|
|
String company = "BIGB";
|
|
|
|
String taxNo = "9111112222333344DD";
|
|
|
|
|
|
|
|
// // 入参统一在入口处理
|
|
|
|
// String userid = getLoginName();
|
|
|
|
// String dbName = getUserInfo().getDbName();
|
|
|
|
// String company = getUserInfo().getCompany();
|
|
|
|
// List<String> gfshAll = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
|
|
|
|
// String gfsh = "";
|
|
|
|
// if (gfshAll.size() > 0) {
|
|
|
|
// gfsh = gfshAll.get(0);
|
|
|
|
// }
|
|
|
|
|
|
|
|
String result = "";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<SNInvoice> invoiceInfoList = snRequestObject.getInvoiceInfoList();
|
|
|
|
|
|
|
|
String imageId = snRequestObject.getImageId();
|
|
|
|
String compCode = snRequestObject.getCompCode();
|
|
|
|
|
|
|
|
TDxInvoiceReimburse reimburse = new TDxInvoiceReimburse();
|
|
|
|
reimburse.setImageId(imageId);
|
|
|
|
reimburse.setCompCode(compCode);
|
|
|
|
|
|
|
|
SNSAPObject object = new SNSAPObject();
|
|
|
|
object.setSYSID("FPXT");
|
|
|
|
object.setIFYWID("FI845");
|
|
|
|
object.setBSKEY(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
object.setSAPKEY("");
|
|
|
|
object.setZORG(compCode);
|
|
|
|
object.setZFILED1("");
|
|
|
|
object.setZFILED2("");
|
|
|
|
object.setZFILED3("");
|
|
|
|
object.setZFILED4("");
|
|
|
|
object.setZFILED5(environment);
|
|
|
|
List<SAPInvoiceInfo> sapInvoiceInfos = new ArrayList<>();
|
|
|
|
if (invoiceInfoList != null && invoiceInfoList.size() > 0) {
|
|
|
|
for (SNInvoice invoice : invoiceInfoList) {
|
|
|
|
String fplxdm = "";
|
|
|
|
String snFplx = "";
|
|
|
|
result = snPushCheckRecordService.updateInvoicePoll(company, taxNo, reimburse, invoice, fplxdm,imageId,compCode);
|
|
|
|
|
|
|
|
//价税分离判断
|
|
|
|
if (!"ok".equals(result) && !"0000".equals(result)) {
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
data.put("data", result);
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(result)));
|
|
|
|
}
|
|
|
|
SAPInvoiceInfo info = convertToSapOnject(invoice, imageId, compCode);
|
|
|
|
sapInvoiceInfos.add(info);
|
|
|
|
}
|
|
|
|
object.setZDATA(JSONObject.toJSONString(sapInvoiceInfos));
|
|
|
|
|
|
|
|
//推送到SAP
|
|
|
|
log.info("推送山能数据:{}", JSONObject.toJSONString(object));
|
|
|
|
JSONObject request = new JSONObject();
|
|
|
|
request.put("IS_INPUT", object);
|
|
|
|
|
|
|
|
try {
|
|
|
|
//将信息推送到影像系统
|
|
|
|
result = snPushCheckRecordService.pushCheckResultToSAP(request.toJSONString());
|
|
|
|
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
data.put("data", result);
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data));
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
log.error("", e);
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
R data = new R(1000, "default success");
|
|
|
|
data.put("data", result);
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(data));
|
|
|
|
}
|
|
|
|
} catch (Exception exception) {
|
|
|
|
exception.printStackTrace();
|
|
|
|
}
|
|
|
|
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查验发票
|
|
|
|
*/
|
|
|
|
@PostMapping("/sn/signature")
|
|
|
|
@ResponseBody
|
|
|
|
@SysLog("获取接口签名值")
|
|
|
|
public String signature(HttpServletRequest request, @RequestBody Map<String, String> paramMap) {
|
|
|
|
String ip = paramMap.get("ip");
|
|
|
|
String apiCode = paramMap.get("apiCode");
|
|
|
|
String secretId = paramMap.get("secretId");
|
|
|
|
String secretKey = paramMap.get("secretKey");
|
|
|
|
String content = paramMap.get("content");
|
|
|
|
String dataExchangeId = paramMap.get("dataExchangeId");
|
|
|
|
|
|
|
|
TreeMap<String, String> sortMap = new TreeMap<>();
|
|
|
|
sortMap.put("SecretId", secretId);
|
|
|
|
sortMap.put("dataExchangeId", dataExchangeId);
|
|
|
|
sortMap.put("encryptCode", "0");
|
|
|
|
sortMap.put("zipCode", "0");
|
|
|
|
sortMap.put("content", content);
|
|
|
|
|
|
|
|
String reqUrl = request.getRequestURL().toString();
|
|
|
|
if (reqUrl.contains(ConfigureConstant.STRING_WH)) {
|
|
|
|
reqUrl = reqUrl.substring(ConfigureConstant.INT_0, reqUrl.indexOf(ConfigureConstant.STRING_WH));
|
|
|
|
}
|
|
|
|
//获取鉴权URL
|
|
|
|
String signUrl = getAuthUrl(reqUrl, request.getMethod());
|
|
|
|
String signature = HmacSHA1Util.genSign(signUrl, sortMap, secretKey);
|
|
|
|
return signature;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static String getAuthUrl(String reqUrl, String method) {
|
|
|
|
if (reqUrl.split(ConfigureConstant.STRING_COLON).length > ConfigureConstant.INT_2) {
|
|
|
|
String one = reqUrl.split(ConfigureConstant.STRING_COLON)[1];
|
|
|
|
String two = reqUrl.split(ConfigureConstant.STRING_COLON)[2];
|
|
|
|
//支持带端口数据的返回
|
|
|
|
if (two.indexOf(ConfigureConstant.STRING_SLASH_LINE) > 0) {
|
|
|
|
reqUrl = one.replaceAll("//", "") + ConfigureConstant.STRING_COLON + two;
|
|
|
|
} else {
|
|
|
|
reqUrl = one.replaceAll("//", "") + two.substring(two.indexOf(ConfigureConstant.STRING_SLASH_LINE));
|
|
|
|
}
|
|
|
|
} else if (reqUrl.split(ConfigureConstant.STRING_COLON).length == ConfigureConstant.INT_2) {
|
|
|
|
String one = reqUrl.split(ConfigureConstant.STRING_COLON)[1];
|
|
|
|
reqUrl = one.contains("//") ? one.replaceAll("//", "") : reqUrl;
|
|
|
|
}
|
|
|
|
return method + reqUrl + "?";
|
|
|
|
}
|
|
|
|
|
|
|
|
private SAPInvoiceInfo convertToSapOnject(SNInvoice snInvoice, String imageId, String compCode) {
|
|
|
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
|
|
|
SAPInvoiceInfo info = new SAPInvoiceInfo();
|
|
|
|
String snFplx = convertToSapType(snInvoice.getInvoiceType());
|
|
|
|
info.setZBAZT("0");
|
|
|
|
info.setZXFSH(snInvoice.getSalesTaxNo());
|
|
|
|
info.setZFPSZD(snInvoice.getPlace());
|
|
|
|
info.setZSPMC(snInvoice.getDraweeName());
|
|
|
|
info.setZSPSBH(snInvoice.getDraweeTaxNo());
|
|
|
|
info.setZCYJG(snInvoice.getCheckResultMessage());
|
|
|
|
info.setZJKZM(snInvoice.getImportCertificateNo());
|
|
|
|
info.setZDJZH(snInvoice.getCertificateNo());
|
|
|
|
info.setZGFMC(snInvoice.getPurchaserName());
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
|
|
|
info.setZSCSJ(date);
|
|
|
|
info.setZCYZT(snInvoice.getCheckStaus());
|
|
|
|
info.setZYSHW(snInvoice.getCargoInformation());
|
|
|
|
info.setZFPLX(snFplx);
|
|
|
|
info.setZQYD(snInvoice.getTransportRoute());
|
|
|
|
info.setZCCRXM(snInvoice.getRiderName());
|
|
|
|
info.setZKPRQ(snInvoice.getBillingDate());
|
|
|
|
info.setZSE(snInvoice.getTotalTax());
|
|
|
|
info.setZTXBZ(snInvoice.getTollSign());
|
|
|
|
info.setZSKPH(snInvoice.getMachineCode());
|
|
|
|
info.setZGFZH(snInvoice.getPurchaserBank());
|
|
|
|
info.setZBZ(snInvoice.getRemarks());
|
|
|
|
List<SNInvoiceDetail> invoiceLineList = snInvoice.getInvoiceLineList();
|
|
|
|
List<SAPInvoiceDetail> sapInvoiceDetailList = new ArrayList<>();
|
|
|
|
if (invoiceLineList != null && invoiceLineList.size() > 0) {
|
|
|
|
SNInvoiceDetail snInvoiceDetail = invoiceLineList.get(0);
|
|
|
|
String taxRate = snInvoiceDetail.getTaxRate();
|
|
|
|
info.setZSM(getZSM(taxRate));
|
|
|
|
info.setZTAX(taxRate);
|
|
|
|
|
|
|
|
SAPInvoiceDetail sapInvoiceDetail = new SAPInvoiceDetail();
|
|
|
|
// sapInvoiceDetail.setZZWDJ("");
|
|
|
|
sapInvoiceDetail.setIMG_ID(imageId);
|
|
|
|
sapInvoiceDetail.setZCPH(snInvoiceDetail.getLicensePlateNum());
|
|
|
|
// sapInvoiceDetail.setZCJSJ("");
|
|
|
|
// sapInvoiceDetail.setZCJRQ("");
|
|
|
|
sapInvoiceDetail.setFPYXBH(snInvoice.getFileId());
|
|
|
|
sapInvoiceDetail.setZCFZ(snInvoice.getStationGetOn());
|
|
|
|
sapInvoiceDetail.setZTXZ(snInvoiceDetail.getCurrentDateEnd());
|
|
|
|
sapInvoiceDetail.setZTXQ(snInvoiceDetail.getCurrentDateStart());
|
|
|
|
if (snInvoiceDetail.getAmount() != null)
|
|
|
|
sapInvoiceDetail.setZJK(snInvoiceDetail.getAmount());
|
|
|
|
sapInvoiceDetail.setZHH(snInvoiceDetail.getRowNo());
|
|
|
|
sapInvoiceDetail.setZTAX(snInvoiceDetail.getTaxRate());
|
|
|
|
// sapInvoiceDetail.setZHBH("");
|
|
|
|
sapInvoiceDetail.setZDJ(snInvoiceDetail.getUnitPrice());
|
|
|
|
// sapInvoiceDetail.setZHID("");
|
|
|
|
sapInvoiceDetail.setZDDZ(snInvoice.getStationGetOff());
|
|
|
|
sapInvoiceDetail.setZHWMC(snInvoiceDetail.getCommodityName());
|
|
|
|
sapInvoiceDetail.setZCYR(info.getZCYRMC());
|
|
|
|
sapInvoiceDetail.setZDW(snInvoiceDetail.getUnit());
|
|
|
|
sapInvoiceDetail.setZGSJBM(snInvoiceDetail.getCommodityCode());
|
|
|
|
sapInvoiceDetail.setZSE(snInvoiceDetail.getTax());
|
|
|
|
sapInvoiceDetail.setZSL(snInvoiceDetail.getQuantity());
|
|
|
|
sapInvoiceDetail.setZSM(info.getZSM());
|
|
|
|
sapInvoiceDetail.setZGGXH(snInvoiceDetail.getSpecificationModel());
|
|
|
|
if (snInvoice.getInvoiceCode() != null) {
|
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx);
|
|
|
|
} else {
|
|
|
|
sapInvoiceDetail.setZTID(snInvoice.getInvoiceNumber() + snFplx);
|
|
|
|
}
|
|
|
|
sapInvoiceDetailList.add(sapInvoiceDetail);
|
|
|
|
}
|
|
|
|
|
|
|
|
info.setIT_ITEM(sapInvoiceDetailList);
|
|
|
|
|
|
|
|
info.setZFPDM(snInvoice.getInvoiceCode());
|
|
|
|
info.setZCD(snInvoice.getOriginPlace());
|
|
|
|
info.setZSCCZ(snInvoice.getStationGetOn());
|
|
|
|
info.setZCC(snInvoice.getTrainNumber());
|
|
|
|
info.setZFPHM(snInvoice.getInvoiceNumber());
|
|
|
|
info.setZBXF(snInvoice.getInsurance());
|
|
|
|
info.setZRYFJ(snInvoice.getFuelSurcharge());
|
|
|
|
info.setZCLSB(snInvoice.getVehicleNo());
|
|
|
|
info.setZKPSJ(snInvoice.getBillingDate());
|
|
|
|
info.setZXCSJ(date);
|
|
|
|
info.setZXFMC(snInvoice.getSalesName());
|
|
|
|
info.setZCYRSBH(snInvoice.getCarrierName());
|
|
|
|
|
|
|
|
info.setIMG_ID(imageId);
|
|
|
|
info.setZCPH(snInvoice.getLicensePlate());
|
|
|
|
info.setZLSLBZ(snInvoice.getZeroTaxRateSign());
|
|
|
|
info.setZCJSJ(date);
|
|
|
|
info.setZFPZT(snInvoice.getState());
|
|
|
|
// info.setZESCSC("");
|
|
|
|
info.setZFDJM(snInvoice.getEngineNo());
|
|
|
|
info.setZGXR("");
|
|
|
|
|
|
|
|
//认证相关
|
|
|
|
info.setZRZJG("0");
|
|
|
|
info.setZRZSSQ("");
|
|
|
|
// info.setZRZMS("");
|
|
|
|
// info.setZRZRQ("");
|
|
|
|
|
|
|
|
info.setZLC(snInvoice.getMileage());
|
|
|
|
info.setZHGZH(snInvoice.getCertificateNo());
|
|
|
|
info.setZXFDH(snInvoice.getSalesAddressPhone());
|
|
|
|
|
|
|
|
// info.setZESCSH("");
|
|
|
|
info.setZGSDM(compCode);
|
|
|
|
info.setZGFSH(snInvoice.getPurchaserTaxNo());
|
|
|
|
info.setZXCRS(snInvoice.getPassengersLimited());
|
|
|
|
info.setZWSPZ(snInvoice.getPaymentVoucherNo());
|
|
|
|
info.setZCCDW(snInvoice.getTonnage());
|
|
|
|
info.setZSWJG(snInvoice.getTaxAuthorityNo());
|
|
|
|
// info.setZYWDJ("");
|
|
|
|
info.setZXCCZ(snInvoice.getStationGetOff());
|
|
|
|
info.setZCCRZH(snInvoice.getIdcardNo());
|
|
|
|
info.setZCPXH(snInvoice.getBrandModel());
|
|
|
|
info.setZMHFZJJ(snInvoice.getCaacDevelopmentFund());
|
|
|
|
info.setZGFDH(snInvoice.getPurchaserAddressPhone());
|
|
|
|
info.setZXFZH(snInvoice.getSalesBank());
|
|
|
|
info.setZJYM(snInvoice.getCheckCode());
|
|
|
|
info.setZSJDH(snInvoice.getInspectionListNo());
|
|
|
|
// info.setZYGC("");
|
|
|
|
info.setZJSHJ(snInvoice.getAmountTax());
|
|
|
|
info.setZCYRMC(snInvoice.getCarrierName());
|
|
|
|
info.setZJGDM(snInvoice.getAdministrativeDivisionNo());
|
|
|
|
info.setZGXSJ(date);
|
|
|
|
// info.setZQM("");
|
|
|
|
info.setZPJLY(snInvoice.getSource());
|
|
|
|
info.setZZWLX(snInvoice.getSeat());
|
|
|
|
if (snInvoice.getInvoiceCode() != null) {
|
|
|
|
info.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber() + snFplx);
|
|
|
|
} else {
|
|
|
|
info.setZTID(snInvoice.getInvoiceNumber() + snFplx);
|
|
|
|
}
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
private String convertToSapType(String invoiceType) {
|
|
|
|
|
|
|
|
switch (invoiceType) {
|
|
|
|
|
|
|
|
case "01":// 增值税专用发票
|
|
|
|
invoiceType = "10";
|
|
|
|
break;
|
|
|
|
case "04":
|
|
|
|
invoiceType = "11";
|
|
|
|
break;
|
|
|
|
case "10":
|
|
|
|
invoiceType = "12";
|
|
|
|
break;
|
|
|
|
case "11":
|
|
|
|
invoiceType = "13";
|
|
|
|
break;
|
|
|
|
case "03":
|
|
|
|
invoiceType = "14";
|
|
|
|
break;
|
|
|
|
case "15":
|
|
|
|
invoiceType = "15";
|
|
|
|
break;
|
|
|
|
case "95":
|
|
|
|
invoiceType = "16";
|
|
|
|
break;
|
|
|
|
case "97":
|
|
|
|
invoiceType = "17";
|
|
|
|
break;
|
|
|
|
case "91":
|
|
|
|
invoiceType = "18";
|
|
|
|
break;
|
|
|
|
case "92":
|
|
|
|
invoiceType = "19";
|
|
|
|
break;
|
|
|
|
case "89":
|
|
|
|
invoiceType = "20";
|
|
|
|
break;
|
|
|
|
case "90":
|
|
|
|
invoiceType = "21";
|
|
|
|
break;
|
|
|
|
case "101":
|
|
|
|
invoiceType = "22";
|
|
|
|
break;
|
|
|
|
case "14":
|
|
|
|
invoiceType = "24";
|
|
|
|
break;
|
|
|
|
case "08":
|
|
|
|
invoiceType = "25";
|
|
|
|
break;
|
|
|
|
case "31":
|
|
|
|
invoiceType = "26";
|
|
|
|
break;
|
|
|
|
case "32":
|
|
|
|
invoiceType = "27";
|
|
|
|
break;
|
|
|
|
case "88":
|
|
|
|
invoiceType = "28";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
invoiceType = "";
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return invoiceType;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getZSM(String taxRate) {
|
|
|
|
|
|
|
|
String sm = "";
|
|
|
|
|
|
|
|
switch (taxRate) {
|
|
|
|
// 发票采集
|
|
|
|
case "0":
|
|
|
|
sm = "J0";
|
|
|
|
break;
|
|
|
|
case "0.00":
|
|
|
|
sm = "J0";
|
|
|
|
break;
|
|
|
|
case "免税":
|
|
|
|
sm = "J0";
|
|
|
|
break;
|
|
|
|
case "0.16":
|
|
|
|
sm = "J1";
|
|
|
|
break;
|
|
|
|
case "0.13":
|
|
|
|
sm = "J2";
|
|
|
|
break;
|
|
|
|
case "0.10":
|
|
|
|
sm = "J3";
|
|
|
|
break;
|
|
|
|
case "0.09":
|
|
|
|
sm = "J4";
|
|
|
|
break;
|
|
|
|
case "0.06":
|
|
|
|
sm = "J5";
|
|
|
|
break;
|
|
|
|
case "0.05":
|
|
|
|
sm = "J6";
|
|
|
|
break;
|
|
|
|
case "0.03":
|
|
|
|
sm = "J7";
|
|
|
|
break;
|
|
|
|
case "0.02":
|
|
|
|
sm = "J8";
|
|
|
|
break;
|
|
|
|
case "0.01":
|
|
|
|
sm = "J9";
|
|
|
|
break;
|
|
|
|
case "0.17":
|
|
|
|
sm = "JC";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sm = "";
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return sm;
|
|
|
|
}
|
|
|
|
}
|