Merge remote-tracking branch 'origin/dev0310' into dev0310

release
zhenghaiyang@ele-cloud.com 2 years ago
commit dd0feaaee8
  1. 5
      dxhy-base/src/main/java/com/dxhy/base/service/receipt/BaseReceiptOutServiceImpl.java
  2. 7
      dxhy-customs/src/main/java/com/dxhy/customs/service/impl/CustomsSignServiceImpl.java
  3. 101
      dxhy-erp/src/main/java/com/dxhy/erp/controller/SDNYMainProcessController.java
  4. 75
      dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java
  5. 4
      dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java
  6. 7
      dxhy-extend/src/main/resources/mapper/TicketMapper.xml

@ -656,8 +656,11 @@ public class BaseReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutD
vo.setReason(reason.getOutReason() == null ? "" : reason.getOutReason());
// 认证日期 string类型的长日期转为string类型的短日期
String certDate = record.getCertDate();
Date date = DateUtils.strToDate(certDate);
Date date = new Date();
if (certDate != null) {
date = DateUtils.strToDate(certDate);
vo.setCertDate(DateUtils.dateToStr(date));
}
return vo;
}

@ -567,7 +567,12 @@ public class CustomsSignServiceImpl extends MpBaseServiceImpl<CustomsRecordDao,
}
if (map.get("qsDate") != null) {
map.put("qsDate", sdf.format(map.get("qsDate")));
String qsDate = map.get("qsDate").toString();
log.info("qsDate={}", qsDate);
if (qsDate.length() > 10)
qsDate = qsDate.substring(0, 10);
map.put("qsDate", qsDate);
}
String notes = map.get("notes").toString();
if (notes.contains("需数据采集")) {

@ -233,6 +233,18 @@ public class SDNYMainProcessController extends AbstractController {
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 = "";
@ -241,43 +253,44 @@ public class SDNYMainProcessController extends AbstractController {
String invoiceNo = invoice.getInvoiceNumber();
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));
return ResponseEntity.ok(JSONObject.toJSONString(R.error(result)));
}
SAPInvoiceInfo info = convertToSapOnject(invoice, imageId, compCode);
sapInvoiceInfos.add(info);
}
object.setZDATA(JSONObject.toJSONString(sapInvoiceInfos));
//推送到SAP
SNSAPObject object = convertToSapOnject(invoice, imageId,compCode);
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 e) {
e.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_DEFAULT)));
} catch (Exception exception) {
exception.printStackTrace();
}
return ResponseEntity.ok(JSONObject.toJSONString(R.error(CommonConstants.MSG_ERR_PUSH_SDNY)));
}
/**
@ -307,25 +320,10 @@ public class SDNYMainProcessController extends AbstractController {
return signature;
}
private SNSAPObject convertToSapOnject(SNInvoice snInvoice, String imageId,String compCode) {
private SAPInvoiceInfo convertToSapOnject(SNInvoice snInvoice, String imageId, String compCode) {
Date date = new Date();
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<>();
SAPInvoiceInfo info = new SAPInvoiceInfo();
info.setZBAZT("0");
info.setZXFSH(snInvoice.getSalesTaxNo());
@ -338,9 +336,9 @@ public class SDNYMainProcessController extends AbstractController {
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(subtract.toString());
// BigDecimal tax = new BigDecimal(snInvoice.getTotalTax());
// BigDecimal subtract = total.subtract(tax);
info.setZJK(total.toString());
}
info.setZSCSJ(date);
@ -373,6 +371,7 @@ public class SDNYMainProcessController extends AbstractController {
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());
@ -422,7 +421,7 @@ public class SDNYMainProcessController extends AbstractController {
//认证相关
info.setZRZJG("0");
info.setZRZSSQ("202302");
info.setZRZSSQ("");
// info.setZRZMS("");
// info.setZRZRQ("");
@ -454,12 +453,12 @@ public class SDNYMainProcessController extends AbstractController {
// info.setZQM("");
info.setZPJLY(snInvoice.getSource());
info.setZZWLX(snInvoice.getSeat());
if (snInvoice.getInvoiceCode() != null) {
info.setZTID(snInvoice.getInvoiceCode() + snInvoice.getInvoiceNumber());
sapInvoiceInfos.add(info);
object.setZDATA(JSONObject.toJSONString(sapInvoiceInfos));
return object;
} else {
info.setZTID(snInvoice.getInvoiceNumber());
}
return info;
}
private String convertToSapType(String invoiceType) {
@ -496,7 +495,7 @@ public class SDNYMainProcessController extends AbstractController {
case "92":
invoiceType = "19";
break;
case "94":
case "89":
invoiceType = "20";
break;
case "90":
@ -535,40 +534,40 @@ public class SDNYMainProcessController extends AbstractController {
switch (taxRate) {
// 发票采集
case "0":
case "0.00":
sm = "J0";
break;
case "免税":
sm = "J0";
break;
case "16":
case "0.16":
sm = "J1";
break;
case "13":
case "0.13":
sm = "J2";
break;
case "10":
case "0.10":
sm = "J3";
break;
case "9":
case "0.09":
sm = "J4";
break;
case "6":
case "0.06":
sm = "J5";
break;
case "5":
case "0.05":
sm = "J6";
break;
case "3":
case "0.03":
sm = "J7";
break;
case "2":
case "0.02":
sm = "J8";
break;
case "1":
case "0.01":
sm = "J9";
break;
case "17":
case "0.17":
sm = "JC";
break;
default:

@ -149,10 +149,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
BaseTDxRecordInvoice recordInvoice = new BaseTDxRecordInvoice();
recordInvoice.setUuid(fpdm + fphm);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
if(kprq != null) {
recordInvoice.setInvoiceDate(sdf.parse(kprq));
} catch (ParseException e) {
e.printStackTrace();
}else{
recordInvoice.setInvoiceDate(new Date());
log.error("开票日期为空.请检查发票");
}
recordInvoice.setInvoiceCode(fpdm);
recordInvoice.setInvoiceNo(fphm);
@ -160,6 +161,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
if (se != null) {
recordInvoice.setTaxAmount(new BigDecimal(se));
}
recordInvoice.setXfTaxNo(xfsh);
recordInvoice.setGfTaxNo(gfsbh);
recordInvoice.setGfName(gfmc);
@ -602,17 +604,16 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
}
} else {
//如果是可查验类型,直接更新数据库
InvoiceUtil iu = new InvoiceUtil(invoiceCode, invoiceNo);
fplxdm = iu.getFplxdm();
if (fplxdm != null) {
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)) {
//可查验发票,已入库,更新票池
Integer integer = this.pushInvoiceToRecordInvoice2(snRequestObject);
log.info("可查验发票,更新票池完成");
log.info("可查验发票,更新底账库完成");
} else {
//不可查验发票,未入库,插入票池
this.pushInvoiceToRecordInvoice(snRequestObject, taxNo, company);
log.info("不可查验发票,更新票池完成");
log.info("不可查验发票,插入底账库成功");
}
}
@ -695,7 +696,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
invoice.setPassenger(snInvoice.getRiderName());
invoice.setDepartCity(snInvoice.getStationGetOn());
invoice.setArriveCity(snInvoice.getStationGetOff());
if ("92".equals(invoice.getInvoiceTypeCode())) {
if ("92".equals(invoice.getInvoiceTypeCode()) || "89".equals(invoice.getInvoiceTypeCode())) {
if (snInvoice.getAmountTax() != null)
invoice.setInvoiceAmount(new BigDecimal(snInvoice.getAmountTax()));
}
@ -713,7 +714,54 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
private String getFplx(SNInvoice invoice, String fplxdm) {
String snFplx = invoice.getInvoiceType();
//可查验发票
if (SNFplxEnum.ZP.getSnFplxDm().equals(snFplx)) {
fplxdm = "01";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.HWYSZP.getSnFplxDm().equals(snFplx)) {
fplxdm = "02";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.JDC.getSnFplxDm().equals(snFplx)) {
fplxdm = "03";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.PP.getSnFplxDm().equals(snFplx)) {
fplxdm = "04";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.DZP.getSnFplxDm().equals(snFplx)) {
fplxdm = "10";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.JSP.getSnFplxDm().equals(snFplx)) {
fplxdm = "11";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.TXF.getSnFplxDm().equals(snFplx)) {
fplxdm = "14";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.ESC.getSnFplxDm().equals(snFplx)) {
fplxdm = "15";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.DZZP.getSnFplxDm().equals(snFplx)) {
fplxdm = "08";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.QDZP.getSnFplxDm().equals(snFplx)) {
fplxdm = "31";
invoice.setInvoiceType(fplxdm);
}
if (SNFplxEnum.QDPP.getSnFplxDm().equals(snFplx)) {
fplxdm = "32";
invoice.setInvoiceType(fplxdm);
}
//不可查验发票
if (SNFplxEnum.HCP.getSnFplxDm().equals(snFplx)) {
fplxdm = "92";
invoice.setInvoiceType(fplxdm);
@ -814,7 +862,8 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
BigDecimal fare = new BigDecimal(invoiceInfo.getFare());
// 燃油附加费
BigDecimal fuelSurcharge = new BigDecimal(invoiceInfo.getFuelSurcharge());
invoiceInfo.setInvoiceAmount((fare.add(fuelSurcharge).divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09"))));
invoiceInfo.setInvoiceAmount(fare.add(fuelSurcharge));
invoiceInfo.setTaxAmount((fare.add(fuelSurcharge).divide(new BigDecimal("1.09"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.09"))));
} else {
logger.error("客票价税计算失败:航空客票 票价或燃油附加费为空");
}
@ -827,12 +876,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter {
} else if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_CODE)
&& !invoiceInfo.getInvoiceTypeCode().equals(Constant.VALUE_ADDED_TAX_INVOICE_ELECTRONIC_PASSENGER_CODE)) {
if (invoiceInfo.getInvoiceAmount() != null)
invoiceInfo.setInvoiceAmount(invoiceInfo.getInvoiceAmount()
invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount()
.divide(new BigDecimal("1.03"), 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("0.03")));
}
// 税额保留两位小数(四舍五入)
if (invoiceInfo.getInvoiceAmount() != null) {
invoiceInfo.setTaxAmount(invoiceInfo.getInvoiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
invoiceInfo.setTaxAmount(invoiceInfo.getTaxAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
}
if (!invoiceInfo.getInvoiceTypeCode().equals(Constant.AIR_PASSENGER_ELECTRONIC_TICKET_ITINERARY_CODE)) {
// 不含税金额

@ -359,7 +359,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
QueryWrapper<TDxInvoiceReimburse> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("uuid",uuid);
TDxInvoiceReimburse tDxInvoiceReimburse = tDxInvoiceReimburseService.getBaseMapper().selectOne(queryWrapper);
if(tDxInvoiceReimburseService==null){
if(tDxInvoiceReimburse==null){
errorMsg.append("发票号码"+zdata1.getZFPHM());
}
}
@ -388,6 +388,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
//账期
updateWrapper.set("account_period",zdata1.getBUDAT());
updateWrapper.set("bzdh",zdata1.getZBZDH());
updateWrapper.set("inaccount_status",zdata1.getZYWZT());
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE);
int update = tDxrecordInvoiceDao.update(null, updateWrapper);
if(update>0){
@ -421,6 +422,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl<RecordInvoiceDao,
//账期
updateWrapper.set("account_period",zdata1.getBUDAT());
updateWrapper.set("bzdh",zdata1.getZBZDH());
updateWrapper.set("inaccount_status",zdata1.getZYWZT());
DynamicContextHolder.push("business"+DbConstant.BUSINESS_WRITE);
tDxInvoiceReimburseService.getBaseMapper().update(null,updateWrapper);
}

@ -86,10 +86,6 @@
and CONCAT(IFNULL(t.passenger,''),IFNULL(t.passenger_s_f_z_h,'')) like
CONCAT('%',#{keyWord},'%')
</if>
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="list != null and list != '' and list != 'null' ">
and t.invoice_type in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
@ -123,8 +119,5 @@
<if test="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
and t.image_id = #{imageId}
</if>
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
and t.account_period = #{accountPeriod}
</if>
</select>
</mapper>

Loading…
Cancel
Save