|
|
|
@ -11,6 +11,7 @@ import com.dxhy.common.enums.FplxEnum; |
|
|
|
|
import com.dxhy.common.enums.SNFplxEnum; |
|
|
|
|
import com.dxhy.common.util.InvoiceUtil; |
|
|
|
|
import com.dxhy.common.util.StringHelper; |
|
|
|
|
import com.dxhy.common.utils.R; |
|
|
|
|
import com.dxhy.common.vo.UserInfo; |
|
|
|
|
import com.dxhy.erp.dao.*; |
|
|
|
|
import com.dxhy.erp.entity.*; |
|
|
|
@ -30,6 +31,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -95,6 +97,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
@Resource |
|
|
|
|
private SysDeptDao sysDeptDao; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SNPushCheckRecordService snPushCheckRecordService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SignSaveInvoiceInfoService signSaveInvoiceInfoService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private TdxPlatformCheckLogService platformCheckLogService; |
|
|
|
|
|
|
|
|
@ -451,8 +459,8 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
jsonObject.put("tonnage", invoiceData.get("dw")); |
|
|
|
|
jsonObject.put("limitPeople", invoiceData.get("xcrs")); |
|
|
|
|
String taxRate = ""; |
|
|
|
|
if (invoiceData.get("sl")==null||StringUtils.isBlank(invoiceData.get("sl").toString())|| |
|
|
|
|
"免税".equals(invoiceData.get("sl").toString())|| "不征税".equals(invoiceData.get("sl").toString()) || "***".equals(invoiceData.get("sl").toString())) { |
|
|
|
|
if (invoiceData.get("sl") == null || StringUtils.isBlank(invoiceData.get("sl").toString()) || |
|
|
|
|
"免税".equals(invoiceData.get("sl").toString()) || "不征税".equals(invoiceData.get("sl").toString()) || "***".equals(invoiceData.get("sl").toString())) { |
|
|
|
|
taxRate = "0"; |
|
|
|
|
jsonObject.put("taxRate", taxRate); |
|
|
|
|
} else { |
|
|
|
@ -616,13 +624,13 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
log.info("进行价税分离的发票信息为:{}", invoiceInfo); |
|
|
|
|
ServiceResult<InvoiceInfo> invoiceResult = new ServiceResult<>(); |
|
|
|
|
//0523晚成伟提出新需求,客运汽车票必须实名才可以进行价税分离
|
|
|
|
|
if(SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm)){ |
|
|
|
|
if(StringUtils.isEmpty(invoice.getRiderName()) || StringUtils.isEmpty(invoice.getIdcardNo())){ |
|
|
|
|
if (SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm)) { |
|
|
|
|
if (StringUtils.isEmpty(invoice.getRiderName()) || StringUtils.isEmpty(invoice.getIdcardNo())) { |
|
|
|
|
log.info("非实名的实名客票 不需要做价税分离"); |
|
|
|
|
} |
|
|
|
|
invoiceResult.setMsg("ok"); |
|
|
|
|
invoiceResult.setResult(true); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
invoiceResult = this.valoremTaxCount(invoiceInfo, "Y"); |
|
|
|
|
InvoiceInfo data = invoiceResult.getData(); |
|
|
|
|
if (data != null) { |
|
|
|
@ -675,6 +683,62 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
if ("01".equals(fplxdm) || "02".equals(fplxdm) || "03".equals(fplxdm) || "04".equals(fplxdm) |
|
|
|
|
|| "08".equals(fplxdm) || "10".equals(fplxdm) || "11".equals(fplxdm) || "14".equals(fplxdm) |
|
|
|
|
|| "15".equals(fplxdm) || "31".equals(fplxdm) || "32".equals(fplxdm)) { |
|
|
|
|
DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); |
|
|
|
|
String fpdm = invoice.getInvoiceCode(); |
|
|
|
|
String fphm = invoice.getInvoiceNumber(); |
|
|
|
|
|
|
|
|
|
QueryWrapper<BaseTDxRecordInvoice> recordWrapper = new QueryWrapper<>(); |
|
|
|
|
if (StringUtils.isEmpty(fpdm)) { |
|
|
|
|
recordWrapper.eq("uuid", fphm); |
|
|
|
|
} else { |
|
|
|
|
recordWrapper.eq("uuid", fpdm + fphm); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BaseTDxRecordInvoice update = baseTDxRecordInvoiceDao.selectOne(recordWrapper); |
|
|
|
|
Map<String, String> pramsMap = new HashMap<>(); |
|
|
|
|
JSONObject checkInvoiceResult = null; |
|
|
|
|
|
|
|
|
|
//如果提交的发票信息在底账库不存在,则重新补充查验,插入数据库中.
|
|
|
|
|
if (update == null) { |
|
|
|
|
try { |
|
|
|
|
//传入的参数为:{billingDate=2023-04-24, totalAmount=9708.74, purchaserTaxNo=91370000MA3RD38A9Q, invoiceNumber=02014197, invoiceType=10100,
|
|
|
|
|
// invoiceCode=3700222130, checkCode=}
|
|
|
|
|
pramsMap.put("invoiceCode", fpdm); |
|
|
|
|
pramsMap.put("invoiceNumber", fphm); |
|
|
|
|
if (StringUtils.isNotEmpty(invoice.getBillingDate())) { |
|
|
|
|
String billingDate = invoice.getBillingDate().replaceAll("-", ""); |
|
|
|
|
pramsMap.put("billingDate", billingDate); |
|
|
|
|
} |
|
|
|
|
if("31".equals(invoice.getInvoiceType()) || "32".equals(invoice.getInvoiceType())){ |
|
|
|
|
pramsMap.put("totalAmount", invoice.getAmountTax()); |
|
|
|
|
}else{ |
|
|
|
|
pramsMap.put("totalAmount", invoice.getTotalAmount()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pramsMap.put("purchaserTaxNo", invoice.getPurchaserTaxNo()); |
|
|
|
|
if("31".equals(invoice.getInvoiceType()) || "32".equals(invoice.getInvoiceType())){ |
|
|
|
|
pramsMap.put("invoiceType", "21"); |
|
|
|
|
}else { |
|
|
|
|
pramsMap.put("invoiceType", invoice.getInvoiceType()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
checkInvoiceResult = snPushCheckRecordService.singleCheckInvoice(pramsMap); |
|
|
|
|
log.info("补充查验结果为:{}", checkInvoiceResult); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
log.error("补充查验失败,errormsg:{}", e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!checkInvoiceResult.containsKey("code")) { |
|
|
|
|
if (!checkInvoiceResult.containsKey("cyjg")) { |
|
|
|
|
checkInvoiceResult.put("invoiceNo", checkInvoiceResult.getString("invoiceNumber")); |
|
|
|
|
log.info("补充查验的结果为:{}", checkInvoiceResult); |
|
|
|
|
signSaveInvoiceInfoService.saveQueryInvoiceResult(checkInvoiceResult, "", "1", "business"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DynamicContextHolder.push(DbConstant.BASICS_WRITE); |
|
|
|
|
|
|
|
|
|
//可查验发票,已入库,更新票池
|
|
|
|
|
Integer integer = this.pushInvoiceToRecordInvoice2(invoice, imageId, compCode); |
|
|
|
|
log.info("可查验发票,更新底账库完成"); |
|
|
|
@ -720,10 +784,10 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { |
|
|
|
|
log.info("uuid={}", uuid); |
|
|
|
|
reimburse.setSelectId(uuid); |
|
|
|
|
|
|
|
|
|
if (StringHelper.isNotBlank(invoice.getTaxRate())){ |
|
|
|
|
if (StringHelper.isNotBlank(invoice.getTaxRate())) { |
|
|
|
|
reimburse.setTaxRate(invoice.getTaxRate()); |
|
|
|
|
reimburse.setTaxCode(getTaxCode(invoice.getTaxRate())); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
reimburse.setTaxRate("0%"); |
|
|
|
|
reimburse.setTaxCode(getTaxCode(reimburse.getTaxRate())); |
|
|
|
|
} |
|
|
|
|