diff --git a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java index bd3c95ec..706cf642 100644 --- a/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java +++ b/dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java @@ -200,9 +200,10 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl{}",pageList.get(i).getInAccountStatus()); if ("1".equals(pageList.get(i).getInAccountStatus())) { vo.setInAccountStatus("已入账"); - } { + } else { vo.setInAccountStatus("未入账"); } String suspendStatus = pageList.get(i).getSuspendStatus(); @@ -685,6 +686,12 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl @@ -103,9 +104,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.qs_status = #{qszt} @@ -345,6 +349,7 @@ and t.auth_status != '0' and t.bdk_status in ('1','2') and t.export_mark = '0' + and t.rzh_yesorno != '0' and t.company =#{company} and t.gf_tax_no in @@ -380,10 +385,13 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} - + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + + and t.qs_status = #{qszt} and t.bzdh = #{bzdh} - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq} @@ -483,9 +486,12 @@ and t.bzdh = #{bzdh} - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and (t.dept_id is null or t.dept_id='' or t.dept_id='99') @@ -1302,7 +1308,7 @@ ,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period, case date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date when true then 1 - else 2 end authStatus,t.bzdh, + else 2 end authStatus,t.bzdh,t.bzr,t.suspend_status,t.suspend_date, t.inaccount_status,t.payment_status,DATE_FORMAT(t.payment_date,'%Y-%m-%d')payment_date,t.settlement_no,t.ele_invoice_no from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/CustomExportThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/CustomExportThread.java index cf01e457..cd3536dd 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/CustomExportThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/CustomExportThread.java @@ -2,6 +2,7 @@ package com.dxhy.core.thread; import java.util.*; +import com.alibaba.cloud.commons.lang.StringUtils; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.dxhy.common.service.impl.TabulateRedisServiceImpl; @@ -146,6 +147,16 @@ public class CustomExportThread extends BaseThread { String menuId = prams.getString("menuId"); String bzdh = prams.getString("bzdh"); String bzr = prams.getString("bzr"); + String inAccountStatus = prams.getString("inAccountStatus"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String accountPeriod = prams.getString("accountPeriod"); + if (StringUtils.isNotEmpty(accountPeriod) && accountPeriod.length() > 7){ + accountPeriod = accountPeriod.substring(0,7); + } + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); + String companyCode = prams.getString("companyCode"); JSONArray companyCodeArray = prams.getJSONArray("companyCodes"); List companyCodes = companyCodeArray.toJavaList(String.class); @@ -159,6 +170,13 @@ public class CustomExportThread extends BaseThread { pramsMap.put("companyCodes",companyCodes); pramsMap.put("bzdh",bzdh); pramsMap.put("bzr",bzr); + pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("accountPeriod",accountPeriod); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); + List gfshList = new ArrayList<>(); if (!StringHelper.isBlank(gfsh)) { diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/ManualAthensThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/ManualAthensThread.java index 0aa3686b..a45e730a 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/ManualAthensThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/ManualAthensThread.java @@ -22,6 +22,7 @@ import com.dxhy.core.service.singletable.IExcelExportlogService; import com.dxhy.core.util.JsonResponseUtils; import com.dxhy.oss.service.FileService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; import java.io.File; import java.io.FileOutputStream; @@ -154,6 +155,11 @@ public class ManualAthensThread extends BaseThread { String inAccountStatus = prams.getString("inAccountStatus"); String inAccountMonth = prams.getString("inAccountMonth"); JSONArray companyCodeArray = prams.getJSONArray("companyCodes"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); + List companyCodes = companyCodeArray.toJavaList(String.class); // 参数转换为需要的形式 Map pramsMap = new HashMap<>(16); @@ -163,6 +169,11 @@ public class ManualAthensThread extends BaseThread { pramsMap.put("businessCode",businessCode); pramsMap.put("suspendStatus",suspendStatus); pramsMap.put("suspendDate",suspendDate); + pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); List gfshList = new ArrayList<>(); if (!StringHelper.isBlank(gfsh)) { gfshList = StringHelper.stringToList(gfsh); @@ -228,14 +239,25 @@ public class ManualAthensThread extends BaseThread { ftpFileName.append(fileSplit); if ("99".equals(gfTaxNo)) { if (gfshList.size() > 0) { - ftpFileName.append(rzFpxxService.getblocName(gfshList.get(0))); - ftpFileName.append(fileSplit); + if (StringUtils.isNotEmpty(gfshList.get(0))){ + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(rzFpxxService.getblocName(gfshList.get(0))); + } + ftpFileName.append(fileSplit); + log.info("税号名称获取"); + } } } else { if (gfshList.size() > 0) { - for (String s : gfshList) { - ftpFileName.append(rzFpxxService.getGfName(s)); - ftpFileName.append(fileSplit); +// for (String s : gfshList) { +// if (StringUtils.isNotEmpty(s)){ +// ftpFileName.append(rzFpxxService.getGfName(s)); +// ftpFileName.append(fileSplit); +// } +// } + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(rzFpxxService.getGfName(gfshList.get(0))); + ftpFileName.append(fileSplit); } } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java index 8da04937..34456091 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java @@ -31,6 +31,7 @@ import com.dxhy.oss.service.FileService; import cn.hutool.core.date.DateUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; /** * @author user @@ -151,12 +152,28 @@ public class PoolAddTaxThread extends BaseThread { String bzr = prams.getString("bzr"); String companyCode = prams.getString("companyCode"); JSONArray companyCodeArray = prams.getJSONArray("companyCodes"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String accountPeriod = prams.getString("accountPeriod"); + if (StringUtils.isNotEmpty(accountPeriod) && accountPeriod.length() > 7){ + accountPeriod = accountPeriod.substring(0,7); + } + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); + List companyCodes = companyCodeArray.toJavaList(String.class); // 参数转换为需要的形式 Map pramsMap = new HashMap<>(16); pramsMap.put("dbName", dbName); pramsMap.put("bzdh",bzdh); pramsMap.put("bzr",bzr); + pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("accountPeriod",accountPeriod); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); + List gfshList = new ArrayList<>(); if (!StringHelper.isBlank(gfsh)) { gfshList = StringHelper.stringToList(gfsh); @@ -214,13 +231,21 @@ public class PoolAddTaxThread extends BaseThread { ftpFileName.append(fileSplit); if ("99".equals(gfTaxNo)) { if (gfshList.size() > 0) { - ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); - ftpFileName.append(fileSplit); + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); + ftpFileName.append(fileSplit); + } } } else { if (gfshList.size() > 0) { - for (String s : gfshList) { - ftpFileName.append(poolPaperService.getGfName(s)); +// for (String s : gfshList) { +// if (StringUtils.isNotEmpty(s)){ +// ftpFileName.append(poolPaperService.getGfName(s)); +// ftpFileName.append(fileSplit); +// } +// } + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getGfName(gfshList.get(0))); ftpFileName.append(fileSplit); } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolOtherThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolOtherThread.java index 5baa3d53..a08b9f12 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolOtherThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolOtherThread.java @@ -19,6 +19,7 @@ import com.dxhy.oss.service.FileService; import cn.hutool.core.date.DateUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; /** * @author user @@ -123,12 +124,25 @@ public class PoolOtherThread extends BaseThread { String bzr = prams.getString("bzr"); String bzdh = prams.getString("bzdh"); String inAccountStatus = prams.getString("inAccountStatus"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String accountPeriod = prams.getString("accountPeriod"); + if (StringUtils.isNotEmpty(accountPeriod) && accountPeriod.length() > 7){ + accountPeriod = accountPeriod.substring(0,7); + } + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); // 参数转换为需要的形式 Map pramsMap = new HashMap<>(16); pramsMap.put("dbName", dbName); pramsMap.put("bzr",bzr); pramsMap.put("bzdh",bzdh); pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("accountPeriod",accountPeriod); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); List gfshList = new ArrayList<>(); if (!StringHelper.isBlank(gfsh)) { gfshList = StringHelper.stringToList(gfsh); @@ -168,13 +182,21 @@ public class PoolOtherThread extends BaseThread { ftpFileName.append(fileSplit); if ("99".equals(gfTaxNo)) { if (gfshList.size() > 0) { - ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); - ftpFileName.append(fileSplit); + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); + ftpFileName.append(fileSplit); + } } } else { if (gfshList.size() > 0) { - for (String s : gfshList) { - ftpFileName.append(poolPaperService.getGfName(s)); +// for (String s : gfshList) { +// if (StringUtils.isNotEmpty(s)){ +// ftpFileName.append(poolPaperService.getGfName(s)); +// ftpFileName.append(fileSplit); +// } +// } + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getGfName(gfshList.get(0))); ftpFileName.append(fileSplit); } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolSaleThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolSaleThread.java index 0408d461..00bc2ddd 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/PoolSaleThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/PoolSaleThread.java @@ -31,6 +31,7 @@ import com.dxhy.oss.service.FileService; import cn.hutool.core.date.DateUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; /** * 功能描述 @@ -156,12 +157,28 @@ public class PoolSaleThread extends BaseThread { String company = prams.getString("company"); String companyCode = prams.getString("companyCode"); JSONArray companyCodeArray = prams.getJSONArray("companyCodes"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String accountPeriod = prams.getString("accountPeriod"); + if (StringUtils.isNotEmpty(accountPeriod) && accountPeriod.length() > 7){ + accountPeriod = accountPeriod.substring(0,7); + } + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); + List companyCodes = companyCodeArray.toJavaList(String.class); // 参数转换为需要的形式 Map pramsMap = new HashMap<>(16); pramsMap.put("dbName", dbName); pramsMap.put("bzdh",bzdh); pramsMap.put("bzr",bzr); + pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("accountPeriod",accountPeriod); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); + List gfshList = new ArrayList<>(); if (!StringHelper.isBlank(gfsh)) { gfshList = StringHelper.stringToList(gfsh); @@ -213,13 +230,21 @@ public class PoolSaleThread extends BaseThread { ftpFileName.append(fileSplit); if ("99".equals(gfTaxNo)) { if (gfshList.size() > 0) { - ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); - ftpFileName.append(fileSplit); + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getblocName(gfshList.get(0))); + ftpFileName.append(fileSplit); + } } } else { if (gfshList.size() > 0) { - for (String s : gfshList) { - ftpFileName.append(poolPaperService.getGfName(s)); +// for (String s : gfshList) { +// if (StringUtils.isNotEmpty(s)){ +// ftpFileName.append(poolPaperService.getGfName(s)); +// ftpFileName.append(fileSplit); +// } +// } + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(poolPaperService.getGfName(gfshList.get(0))); ftpFileName.append(fileSplit); } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/QypcsmkpExportThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/QypcsmkpExportThread.java index 135feb8d..d67a0789 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/QypcsmkpExportThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/QypcsmkpExportThread.java @@ -22,6 +22,7 @@ import com.dxhy.oss.service.FileService; import cn.hutool.core.date.DateUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; /** * 实名客票 @@ -134,13 +135,21 @@ public class QypcsmkpExportThread extends BaseThread { ftpFileName.append(fileSplit); if ("99".equals(gfTaxNo)) { if (gfshList.size() > 0) { - ftpFileName.append(ticketService.getblocName(gfshList.get(0))); - ftpFileName.append(fileSplit); + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(ticketService.getblocName(gfshList.get(0))); + ftpFileName.append(fileSplit); + } } } else { if (gfshList.size() > 0) { - for (String s : gfshList) { - ftpFileName.append(ticketService.getGfName(s)); +// for (String s : gfshList) { +// if (StringUtils.isNotEmpty(s)){ +// ftpFileName.append(ticketService.getGfName(s)); +// ftpFileName.append(fileSplit); +// } +// } + if (StringUtils.isNotEmpty(gfshList.get(0))){ + ftpFileName.append(ticketService.getGfName(gfshList.get(0))); ftpFileName.append(fileSplit); } } diff --git a/dxhy-core/src/main/java/com/dxhy/core/thread/RzFpxxExportThread.java b/dxhy-core/src/main/java/com/dxhy/core/thread/RzFpxxExportThread.java index e9dfbde5..b386f99c 100644 --- a/dxhy-core/src/main/java/com/dxhy/core/thread/RzFpxxExportThread.java +++ b/dxhy-core/src/main/java/com/dxhy/core/thread/RzFpxxExportThread.java @@ -141,12 +141,22 @@ public class RzFpxxExportThread extends BaseThread { String bzdh = prams.getString("bzdh"); String bzr = prams.getString("bzr"); JSONArray companyCodeArray = prams.getJSONArray("companyCodes"); + String snVoucherNumber = prams.getString("snVoucherNumber"); + String imageNumber = prams.getString("imageNumber"); + String postingTimeEnd = prams.getString("postingTimeEnd"); + String postingTimeStart = prams.getString("postingTimeStart"); + List companyCodes = companyCodeArray.toJavaList(String.class); JSONObject jsonObject = tabulateRedisService.getTabulateExcel(company, menuId); List businesses = (List)prams.get("userBusiness"); // 参数转换为需要的形式 Map pramsMap = new HashMap<>(30); pramsMap.put("dbName", dbName); + pramsMap.put("inAccountStatus",inAccountStatus); + pramsMap.put("snVoucherNumber",snVoucherNumber); + pramsMap.put("imageNumber",imageNumber); + pramsMap.put("postingTimeEnd",postingTimeEnd); + pramsMap.put("postingTimeStart",postingTimeStart); pramsMap.put("business", businesses); pramsMap.put("businessCode",businessCode); pramsMap.put("qsr",qsr); diff --git a/dxhy-core/src/main/resources/mapper/BbfpzhMapper.xml b/dxhy-core/src/main/resources/mapper/BbfpzhMapper.xml index 3a91a151..8bacb515 100644 --- a/dxhy-core/src/main/resources/mapper/BbfpzhMapper.xml +++ b/dxhy-core/src/main/resources/mapper/BbfpzhMapper.xml @@ -66,6 +66,7 @@ t.settlement_status,t.voucher_number,t.total_amount from t_dx_record_invoice t WHERE t.invoice_date between #{kpksrq} and #{kpjsrq} + and t.company = #{company} and t.gf_tax_no in #{item} @@ -76,9 +77,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.invoice_status = #{invoiceStatus} diff --git a/dxhy-core/src/main/resources/mapper/BbycfpcxMapper.xml b/dxhy-core/src/main/resources/mapper/BbycfpcxMapper.xml index e6957fc8..ef6ccf33 100644 --- a/dxhy-core/src/main/resources/mapper/BbycfpcxMapper.xml +++ b/dxhy-core/src/main/resources/mapper/BbycfpcxMapper.xml @@ -61,9 +61,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.sn_voucher_number = #{snVoucherNumber} diff --git a/dxhy-core/src/main/resources/mapper/CustomsMapper.xml b/dxhy-core/src/main/resources/mapper/CustomsMapper.xml index 7177b273..41a72c9a 100644 --- a/dxhy-core/src/main/resources/mapper/CustomsMapper.xml +++ b/dxhy-core/src/main/resources/mapper/CustomsMapper.xml @@ -124,10 +124,10 @@ and t.rzh_type = #{rzhType} - and t.in_account_status = #{inAccountStatus} + and t.inaccount_status = #{inAccountStatus} - and (t.in_account_status = '0' or t.in_account_status = '' or t.in_account_status is null) + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) and t.qs_type = #{qsfs} diff --git a/dxhy-core/src/main/resources/mapper/FpZhMapper.xml b/dxhy-core/src/main/resources/mapper/FpZhMapper.xml index 96c3c747..43c32c20 100644 --- a/dxhy-core/src/main/resources/mapper/FpZhMapper.xml +++ b/dxhy-core/src/main/resources/mapper/FpZhMapper.xml @@ -100,6 +100,7 @@ and t.bdk_status in ('1','2') and t.export_mark = '0' and t.auth_status != '0' + and t.rzh_yesorno != '0' and t.company = #{company} and t.gf_tax_no in @@ -125,9 +126,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.qs_status = #{qszt} @@ -606,9 +610,12 @@ and t.suspend_date = #{suspendDate} - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq} diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java index a3123784..db46ce40 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/SNPushCheckRecordService.java @@ -105,7 +105,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { return post; } - public String pushInvoiceToRecordInvoice(SNInvoice snInvoice, String taxNo, String company,String imageId,String compCode) throws Exception { + public String pushInvoiceToRecordInvoice(SNInvoice snInvoice, String taxNo, String company, String imageId, String compCode) throws Exception { TDxInvoiceReimburse recordInvoice = new TDxInvoiceReimburse(); // DynamicContextHolder.push(DbConstant.BASICS_READ); @@ -160,7 +160,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { recordInvoice.setInvoiceCode(fpdm); recordInvoice.setInvoiceNo(fphm); String selectId = UUID.randomUUID().toString().replace("-", ""); - log.info("selectId={}",selectId); + log.info("selectId={}", selectId); recordInvoice.setSelectId(selectId); if (je != null) { @@ -169,7 +169,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { if (se != null) { recordInvoice.setTaxAmount(new BigDecimal(se)); } - if (amountTax != null){ + if (amountTax != null) { recordInvoice.setTotalAmount(new BigDecimal(amountTax)); } @@ -193,7 +193,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { return ""; } - public Integer pushInvoiceToRecordInvoice2(SNInvoice snInvoice,String imageId,String compCode) { + public Integer pushInvoiceToRecordInvoice2(SNInvoice snInvoice, String imageId, String compCode) { DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); int update = 0; @@ -318,11 +318,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { String returnResult = JSONObject.toJSONString(apiResponse); String returnResultEncode = Base64.encode(returnResult.getBytes()); checkLog.setReturnResult(returnResultEncode); - log.info("封装的查验日志实体为{}",checkLog); + log.info("封装的查验日志实体为{}", checkLog); platformCheckLogService.save(checkLog); } - private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) { + private JSONObject convertToSnObject(String content, JSONObject jsonObject, String invoiceType) throws ParseException { String con = new String(Base64.decode(content)); HashMap contentMap = JSONObject.parseObject(con, HashMap.class); @@ -330,266 +330,262 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { if ("0000".equals(contentMap.get("code"))) { HashMap invoiceData = JSONObject.parseObject(contentMap.get("data").toString(), HashMap.class); if ("0001".equals(invoiceData.get("cyjg"))) { - try { - - invoiceType = invoiceData.get("fpzl").toString(); - if ("22".equals(invoiceType)) { - invoiceType = "32"; - } - if ("21".equals(invoiceType)) { - invoiceType = "31"; - } + invoiceType = invoiceData.get("fpzl").toString(); + if ("22".equals(invoiceType)) { + invoiceType = "32"; + } + if ("21".equals(invoiceType)) { + invoiceType = "31"; + } - jsonObject.put("invoiceType", invoiceType); - jsonObject.put("administrativeDivisionNo", ""); - jsonObject.put("administrativeDivisionName", ""); - - jsonObject.put("invoiceCode", invoiceData.get("fpdm")); - jsonObject.put("invoiceNumber", invoiceData.get("fphm")); - - String kprq = invoiceData.get("kprq").toString(); - Date formatDat = new SimpleDateFormat("yyyyMMdd").parse(kprq); - String str = new SimpleDateFormat("yyyy-MM-dd").format(formatDat); - log.info("开票日期为:{} ", str); - - jsonObject.put("billingDate", str); - jsonObject.put("purchaserName", invoiceData.get("gmfmc")); - jsonObject.put("purchaserTaxNo", invoiceData.get("gmfsbh")); - jsonObject.put("purchaserBank", invoiceData.get("gmfyhzh")); - jsonObject.put("purchaserAddressPhone", invoiceData.get("gmfdzdh")); - jsonObject.put("salesName", invoiceData.get("xhfmc")); - jsonObject.put("salesTaxNo", invoiceData.get("xhfsbh")); - jsonObject.put("salesAddressPhone", invoiceData.get("xhfdzdh")); - if(FplxEnum.JDC.getFplxDm().equals(invoiceType)){ - if(invoiceData.get("khyh") != null && invoiceData.get("khzh") != null) { - jsonObject.put("salesBank", invoiceData.get("khyh").toString() + invoiceData.get("khzh").toString()); - } - }else{ - jsonObject.put("salesBank", invoiceData.get("xhfyhzh")); + jsonObject.put("invoiceType", invoiceType); + jsonObject.put("administrativeDivisionNo", ""); + jsonObject.put("administrativeDivisionName", ""); + + jsonObject.put("invoiceCode", invoiceData.get("fpdm")); + jsonObject.put("invoiceNumber", invoiceData.get("fphm")); + + String kprq = invoiceData.get("kprq").toString(); + Date formatDat = new SimpleDateFormat("yyyyMMdd").parse(kprq); + String str = new SimpleDateFormat("yyyy-MM-dd").format(formatDat); + log.info("开票日期为:{} ", str); + + jsonObject.put("billingDate", str); + jsonObject.put("purchaserName", invoiceData.get("gmfmc")); + jsonObject.put("purchaserTaxNo", invoiceData.get("gmfsbh")); + jsonObject.put("purchaserBank", invoiceData.get("gmfyhzh")); + jsonObject.put("purchaserAddressPhone", invoiceData.get("gmfdzdh")); + jsonObject.put("salesName", invoiceData.get("xhfmc")); + jsonObject.put("salesTaxNo", invoiceData.get("xhfsbh")); + jsonObject.put("salesAddressPhone", invoiceData.get("xhfdzdh")); + if (FplxEnum.JDC.getFplxDm().equals(invoiceType)) { + if (invoiceData.get("khyh") != null && invoiceData.get("khzh") != null) { + jsonObject.put("salesBank", invoiceData.get("khyh").toString() + invoiceData.get("khzh").toString()); } + } else { + jsonObject.put("salesBank", invoiceData.get("xhfyhzh")); + } + jsonObject.put("totalAmount", invoiceData.get("fpje")); + if ("11".equals(invoiceData.get("fpzl"))) { + jsonObject.put("totalTax", "0"); + jsonObject.put("totalAmount", "0"); + } else { + jsonObject.put("totalTax", invoiceData.get("fpse")); jsonObject.put("totalAmount", invoiceData.get("fpje")); - if ("11".equals(invoiceData.get("fpzl"))) { - jsonObject.put("totalTax", "0"); - jsonObject.put("totalAmount", "0"); - } else { - jsonObject.put("totalTax", invoiceData.get("fpse")); - jsonObject.put("totalAmount", invoiceData.get("fpje")); - } - if("15".equals(invoiceData.get("fpzl"))){ - jsonObject.put("amountTax", invoiceData.get("cjhj")); - }else{ - jsonObject.put("amountTax", invoiceData.get("jshj")); - } + } + if ("15".equals(invoiceData.get("fpzl"))) { + jsonObject.put("amountTax", invoiceData.get("cjhj")); + } else { + jsonObject.put("amountTax", invoiceData.get("jshj")); + } - jsonObject.put("amountTaxCN", ""); + jsonObject.put("amountTaxCN", ""); - jsonObject.put("checkCode", invoiceData.get("jym")); - if ("N".equals(invoiceData.get("zfbz"))) { - jsonObject.put("state", "0"); - } else if ("H".equals(invoiceData.get("zfbz"))) { - jsonObject.put("state", "2"); - } else if ("Y".equals(invoiceData.get("zfbz"))) { - jsonObject.put("state", "1"); - } + jsonObject.put("checkCode", invoiceData.get("jym")); + if ("N".equals(invoiceData.get("zfbz"))) { + jsonObject.put("state", "0"); + } else if ("H".equals(invoiceData.get("zfbz"))) { + jsonObject.put("state", "2"); + } else if ("Y".equals(invoiceData.get("zfbz"))) { + jsonObject.put("state", "1"); + } - jsonObject.put("carrierName", invoiceData.get("cyrmc")); - jsonObject.put("carrierTaxNo", invoiceData.get("cyrsbh")); - jsonObject.put("draweeName", invoiceData.get("spfmc")); - jsonObject.put("draweeTaxNo", invoiceData.get("spfsbh")); - jsonObject.put("cargoInformation", invoiceData.get("ysgwxx")); - jsonObject.put("transportRoute", invoiceData.get("qydjyddd")); - jsonObject.put("machineCode", invoiceData.get("skph")); - jsonObject.put("tonnage", invoiceData.get("ccdw")); - jsonObject.put("taxAuthorityNo", invoiceData.get("zgswjgdm")); - jsonObject.put("taxAuthorityName", invoiceData.get("zgswjgmc")); - if ("03".equals(invoiceData.get("fpzl"))) { - jsonObject.put("administrativeDivisionNo", invoiceData.get("zgswjgdm")); - jsonObject.put("administrativeDivisionName", invoiceData.get("zgswjgmc")); - } - jsonObject.put("remarks", invoiceData.get("bz")); - jsonObject.put("vehicleType", invoiceData.get("cllx")); - jsonObject.put("brandModel", invoiceData.get("cpxh")); - jsonObject.put("originPlace", invoiceData.get("cd")); - jsonObject.put("certificateNo", invoiceData.get("hgzs")); - jsonObject.put("inspectionListNo", invoiceData.get("sjdh")); - jsonObject.put("engineNo", invoiceData.get("fdjhm")); - jsonObject.put("vehicleNo", invoiceData.get("clsbh")); - jsonObject.put("importCertificateNo", invoiceData.get("jszmsh")); - jsonObject.put("paymentVoucherNo", invoiceData.get("wspzhm")); - jsonObject.put("passengersLimited", invoiceData.get("xcrs")); - if (invoiceData.get("txfbz") != null && "Y".equals(invoiceData.get("txfbz"))) { - jsonObject.put("tollSign", "06"); - } else { - jsonObject.put("tollSign", "07"); - } + jsonObject.put("carrierName", invoiceData.get("cyrmc")); + jsonObject.put("carrierTaxNo", invoiceData.get("cyrsbh")); + jsonObject.put("draweeName", invoiceData.get("spfmc")); + jsonObject.put("draweeTaxNo", invoiceData.get("spfsbh")); + jsonObject.put("cargoInformation", invoiceData.get("ysgwxx")); + jsonObject.put("transportRoute", invoiceData.get("qydjyddd")); + jsonObject.put("machineCode", invoiceData.get("skph")); + jsonObject.put("tonnage", invoiceData.get("ccdw")); + jsonObject.put("taxAuthorityNo", invoiceData.get("zgswjgdm")); + jsonObject.put("taxAuthorityName", invoiceData.get("zgswjgmc")); + if ("03".equals(invoiceData.get("fpzl"))) { + jsonObject.put("administrativeDivisionNo", invoiceData.get("zgswjgdm")); + jsonObject.put("administrativeDivisionName", invoiceData.get("zgswjgmc")); + } + jsonObject.put("remarks", invoiceData.get("bz")); + jsonObject.put("vehicleType", invoiceData.get("cllx")); + jsonObject.put("brandModel", invoiceData.get("cpxh")); + jsonObject.put("originPlace", invoiceData.get("cd")); + jsonObject.put("certificateNo", invoiceData.get("hgzs")); + jsonObject.put("inspectionListNo", invoiceData.get("sjdh")); + jsonObject.put("engineNo", invoiceData.get("fdjhm")); + jsonObject.put("vehicleNo", invoiceData.get("clsbh")); + jsonObject.put("importCertificateNo", invoiceData.get("jszmsh")); + jsonObject.put("paymentVoucherNo", invoiceData.get("wspzhm")); + jsonObject.put("passengersLimited", invoiceData.get("xcrs")); + if (invoiceData.get("txfbz") != null && "Y".equals(invoiceData.get("txfbz"))) { + jsonObject.put("tollSign", "06"); + } else { + jsonObject.put("tollSign", "07"); + } - jsonObject.put("zeroTaxRateSign", invoiceData.get("lslbs")); - log.info("零税率标识为:{}", invoiceData.get("lslbs")); - jsonObject.put("source", ""); - jsonObject.put("idcardNo", invoiceData.get("sfzh")); + jsonObject.put("zeroTaxRateSign", invoiceData.get("lslbs")); + log.info("零税率标识为:{}", invoiceData.get("lslbs")); + jsonObject.put("source", ""); + jsonObject.put("idcardNo", invoiceData.get("sfzh")); - if("15".equals(invoiceData.get("fpzl"))){ - jsonObject.put("buyerIDNum", invoiceData.get("mfdwdmsfzh")); - }else{ - jsonObject.put("buyerIDNum", invoiceData.get("sfzh")); - } + if ("15".equals(invoiceData.get("fpzl"))) { + jsonObject.put("buyerIDNum", invoiceData.get("mfdwdmsfzh")); + } else { + jsonObject.put("buyerIDNum", invoiceData.get("sfzh")); + } - jsonObject.put("vehicleType", invoiceData.get("cllx")); - jsonObject.put("factoryModel", invoiceData.get("cpxh")); - jsonObject.put("productPlace", invoiceData.get("cd")); - jsonObject.put("certificate", invoiceData.get("hgzs")); - jsonObject.put("certificateImport", invoiceData.get("jszmsh")); - jsonObject.put("inspectionNum", invoiceData.get("sjdh")); - jsonObject.put("engineNo", invoiceData.get("fdjhm")); - jsonObject.put("vehicleNo", invoiceData.get("clsbh")); - jsonObject.put("engineNo", invoiceData.get("fdjhm")); - jsonObject.put("taxBureauCode", invoiceData.get("zgswjgdm")); - jsonObject.put("taxBureauName", invoiceData.get("zgswjgmc")); - jsonObject.put("taxBureauCode", invoiceData.get("zgswjgdm")); - jsonObject.put("taxRecords", invoiceData.get("wspzhm")); - jsonObject.put("tonnage", invoiceData.get("dw")); - jsonObject.put("limitPeople", invoiceData.get("xcrs")); - String taxRate = ""; - if ("免税".equals(invoiceData.get("sl"))) { - taxRate = "0"; - jsonObject.put("taxRate", taxRate); - } else { - if (invoiceData.get("sl") != null && StringUtils.isNoneBlank(invoiceData.get("sl").toString())) { - taxRate = invoiceData.get("sl").toString(); - if (!"0".equals(taxRate)) { - taxRate = "0." + taxRate; - taxRate = taxRate.substring(0, taxRate.length() - 1); - } + jsonObject.put("vehicleType", invoiceData.get("cllx")); + jsonObject.put("factoryModel", invoiceData.get("cpxh")); + jsonObject.put("productPlace", invoiceData.get("cd")); + jsonObject.put("certificate", invoiceData.get("hgzs")); + jsonObject.put("certificateImport", invoiceData.get("jszmsh")); + jsonObject.put("inspectionNum", invoiceData.get("sjdh")); + jsonObject.put("engineNo", invoiceData.get("fdjhm")); + jsonObject.put("vehicleNo", invoiceData.get("clsbh")); + jsonObject.put("engineNo", invoiceData.get("fdjhm")); + jsonObject.put("taxBureauCode", invoiceData.get("zgswjgdm")); + jsonObject.put("taxBureauName", invoiceData.get("zgswjgmc")); + jsonObject.put("taxBureauCode", invoiceData.get("zgswjgdm")); + jsonObject.put("taxRecords", invoiceData.get("wspzhm")); + jsonObject.put("tonnage", invoiceData.get("dw")); + jsonObject.put("limitPeople", invoiceData.get("xcrs")); + String taxRate = ""; + if ("免税".equals(invoiceData.get("sl"))) { + taxRate = "0"; + jsonObject.put("taxRate", taxRate); + } else { + if (invoiceData.get("sl") != null && StringUtils.isNoneBlank(invoiceData.get("sl").toString())) { + taxRate = invoiceData.get("sl").toString(); + if (!"0".equals(taxRate)) { + taxRate = "0." + taxRate; + taxRate = taxRate.substring(0, taxRate.length() - 1); + } - if ("11".equals(invoiceType)) { - taxRate = "0.000"; - } - log.info("明细-发票税率为:{}", taxRate); - jsonObject.put("taxRate", taxRate); + if ("11".equals(invoiceType)) { + taxRate = "0.000"; } + log.info("明细-发票税率为:{}", taxRate); + jsonObject.put("taxRate", taxRate); } - taxRate = ""; - jsonObject.put("limitPeople", invoiceData.get("xcrs")); - jsonObject.put("machineNo", invoiceData.get("jqbh")); - - jsonObject.put("licensePlate", invoiceData.get("cpzh")); - jsonObject.put("registrationNo", invoiceData.get("djzh")); - jsonObject.put("vehicleIdentificationNo", invoiceData.get("clsbh")); - jsonObject.put("vehicleAdminOffice", invoiceData.get("zrdcgsmc")); - jsonObject.put("buyerUnitOrIndividual", invoiceData.get("mfdwgr")); - jsonObject.put("buyerUnitOrIndividualAddress", invoiceData.get("mfdwgrdz")); - jsonObject.put("buyerPhone", invoiceData.get("mfdh")); - jsonObject.put("sellerUnitOrIndividual", invoiceData.get("smfdwgr")); - jsonObject.put("sellerUnitCodeOrIdNo", invoiceData.get("smfdwdmsfzh")); - jsonObject.put("sellerUnitOrIndividualAddress", invoiceData.get("smfdwgrzz")); - jsonObject.put("sellerPhone", invoiceData.get("smfdh")); - jsonObject.put("businessUnit", invoiceData.get("jypmdw")); - jsonObject.put("businessUnitAddress", invoiceData.get("jypmdwdz")); - jsonObject.put("businessUnitTaxNo", invoiceData.get("jypmdwzsbh")); - jsonObject.put("businessUnitBankAndAccount", invoiceData.get("khyhjzh")); - jsonObject.put("businessUnitPhone", invoiceData.get("jypmdwdh")); - jsonObject.put("lemonMarket", invoiceData.get("escsc")); - jsonObject.put("lemonMarketTaxNo", invoiceData.get("escscsbh")); - jsonObject.put("lemonMarketAddress", invoiceData.get("escscdz")); - jsonObject.put("lemonMarketBankAndAccount", invoiceData.get("escsckhyhzh")); - jsonObject.put("lemonMarketPhone", invoiceData.get("escscdh")); - - List> returnDetailList = new ArrayList<>(); - JSONArray detailList = (JSONArray) invoiceData.get("detailList"); - - for (int i = 0; i < detailList.size(); i++) { - String taxRateDetail = ""; - JSONObject detail = (JSONObject) detailList.get(i); - Map snDetailMap = new HashMap(); - snDetailMap.put("rowNo", i + 1 + ""); - snDetailMap.put("commodityCode", detail.getString("ssflbm")); - snDetailMap.put("commodityName", detail.getString("hwmc")); - snDetailMap.put("specificationModel", detail.getString("ggxh")); - snDetailMap.put("unit", detail.getString("jldw")); - snDetailMap.put("detailNo",detail.getString("mxbh")); - String quantity = detail.getString("spsl"); + } + taxRate = ""; + jsonObject.put("limitPeople", invoiceData.get("xcrs")); + jsonObject.put("machineNo", invoiceData.get("jqbh")); + + jsonObject.put("licensePlate", invoiceData.get("cpzh")); + jsonObject.put("registrationNo", invoiceData.get("djzh")); + jsonObject.put("vehicleIdentificationNo", invoiceData.get("clsbh")); + jsonObject.put("vehicleAdminOffice", invoiceData.get("zrdcgsmc")); + jsonObject.put("buyerUnitOrIndividual", invoiceData.get("mfdwgr")); + jsonObject.put("buyerUnitOrIndividualAddress", invoiceData.get("mfdwgrdz")); + jsonObject.put("buyerPhone", invoiceData.get("mfdh")); + jsonObject.put("sellerUnitOrIndividual", invoiceData.get("smfdwgr")); + jsonObject.put("sellerUnitCodeOrIdNo", invoiceData.get("smfdwdmsfzh")); + jsonObject.put("sellerUnitOrIndividualAddress", invoiceData.get("smfdwgrzz")); + jsonObject.put("sellerPhone", invoiceData.get("smfdh")); + jsonObject.put("businessUnit", invoiceData.get("jypmdw")); + jsonObject.put("businessUnitAddress", invoiceData.get("jypmdwdz")); + jsonObject.put("businessUnitTaxNo", invoiceData.get("jypmdwzsbh")); + jsonObject.put("businessUnitBankAndAccount", invoiceData.get("khyhjzh")); + jsonObject.put("businessUnitPhone", invoiceData.get("jypmdwdh")); + jsonObject.put("lemonMarket", invoiceData.get("escsc")); + jsonObject.put("lemonMarketTaxNo", invoiceData.get("escscsbh")); + jsonObject.put("lemonMarketAddress", invoiceData.get("escscdz")); + jsonObject.put("lemonMarketBankAndAccount", invoiceData.get("escsckhyhzh")); + jsonObject.put("lemonMarketPhone", invoiceData.get("escscdh")); + + List> returnDetailList = new ArrayList<>(); + JSONArray detailList = (JSONArray) invoiceData.get("detailList"); + + for (int i = 0; i < detailList.size(); i++) { + String taxRateDetail = ""; + JSONObject detail = (JSONObject) detailList.get(i); + Map snDetailMap = new HashMap(); + snDetailMap.put("rowNo", i + 1 + ""); + snDetailMap.put("commodityCode", detail.getString("ssflbm")); + snDetailMap.put("commodityName", detail.getString("hwmc")); + snDetailMap.put("specificationModel", detail.getString("ggxh")); + snDetailMap.put("unit", detail.getString("jldw")); + snDetailMap.put("detailNo", detail.getString("mxbh")); + String quantity = detail.getString("spsl"); // if (quantity.length() > 3) { // int index = quantity.indexOf("."); // quantity = quantity.substring(0, index + 2); // } - snDetailMap.put("quantity", quantity); + snDetailMap.put("quantity", quantity); - String unitPrice = detail.getString("bhsdj"); + String unitPrice = detail.getString("bhsdj"); // if (unitPrice.length() > 3) { // int index = unitPrice.indexOf("."); // unitPrice = unitPrice.substring(0, index + 3); // } - snDetailMap.put("unitPrice", unitPrice); + snDetailMap.put("unitPrice", unitPrice); - if ("11".equals(invoiceType)) { - snDetailMap.put("tax", "0"); - - //如果是卷票计算合计金额 - Float hjje = null; - if (detail.getString("se") != null && detail.getString("je") != null) { - Float je = Float.parseFloat(detail.getString("je")); - Float se = Float.parseFloat(detail.getString("se")); - hjje = je + se; - } - - if (hjje != null) - snDetailMap.put("amount", hjje.toString()); + if ("11".equals(invoiceType)) { + snDetailMap.put("tax", "0"); - } else { - snDetailMap.put("tax", "***".equals(detail.getString("se")) ? "0.00" : detail.getString("se")); - snDetailMap.put("amount", detail.getString("je")); + //如果是卷票计算合计金额 + Float hjje = null; + if (StringUtils.isNotEmpty(detail.getString("se")) && StringUtils.isNotEmpty(detail.getString("je"))) { + Float je = Float.parseFloat(detail.getString("je")); + Float se = Float.parseFloat(detail.getString("se")); + hjje = je + se; } + if (hjje != null) + snDetailMap.put("amount", hjje.toString()); - if ("免税".equals(detail.getString("sl"))) { - taxRateDetail = "0"; - snDetailMap.put("taxRate", taxRateDetail); - } else { - if (detail.get("sl") != null && StringUtils.isNoneBlank(detail.get("sl").toString())) { - taxRateDetail = detail.get("sl").toString(); - if (!"0".equals(taxRateDetail)) { - if (StringUtils.isNoneBlank(taxRateDetail)) { - int index = taxRateDetail.indexOf("%"); - if (index > 0) { - taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1); - Float num = Float.parseFloat(taxRateDetail); - if (num > 9) { - taxRateDetail = "0." + taxRateDetail; - } else { - if (!taxRateDetail.startsWith("0")) { - taxRateDetail = "0.0" + taxRateDetail; - } + } else { + snDetailMap.put("tax", "***".equals(detail.getString("se")) ? "0.00" : detail.getString("se")); + snDetailMap.put("amount", detail.getString("je")); + } + + + if ("免税".equals(detail.getString("sl"))) { + taxRateDetail = "0"; + snDetailMap.put("taxRate", taxRateDetail); + } else { + if (detail.get("sl") != null && StringUtils.isNoneBlank(detail.get("sl").toString())) { + taxRateDetail = detail.get("sl").toString(); + if (!"0".equals(taxRateDetail)) { + if (StringUtils.isNoneBlank(taxRateDetail)) { + int index = taxRateDetail.indexOf("%"); + if (index > 0) { + taxRateDetail = taxRateDetail.substring(0, taxRateDetail.length() - 1); + Float num = Float.parseFloat(taxRateDetail); + if (num > 9) { + taxRateDetail = "0." + taxRateDetail; + } else { + if (!taxRateDetail.startsWith("0")) { + taxRateDetail = "0.0" + taxRateDetail; } } } } + } - if ("11".equals(invoiceType)) { - taxRateDetail = "0.000"; - } - log.info("明细-发票税率为:{}", taxRateDetail); - snDetailMap.put("taxRate", taxRateDetail); + if ("11".equals(invoiceType)) { + taxRateDetail = "0.000"; } + log.info("明细-发票税率为:{}", taxRateDetail); + snDetailMap.put("taxRate", taxRateDetail); } - - log.info("明细-tax={}", detail.get("se")); - log.info("明细-commodityCode={}", detail.get("ssflbm")); - snDetailMap.put("currentDateEnd", detail.getString("txrqz")); - snDetailMap.put("currentDateStart", detail.getString("txrqq")); - snDetailMap.put("licensePlateNum", detail.getString("cph")); - snDetailMap.put("type", detail.getString("lx")); - - returnDetailList.add(snDetailMap); } - jsonObject.put("invoiceLineList", returnDetailList); - } catch (Exception e) { - e.printStackTrace(); + log.info("明细-tax={}", detail.get("se")); + log.info("明细-commodityCode={}", detail.get("ssflbm")); + snDetailMap.put("currentDateEnd", detail.getString("txrqz")); + snDetailMap.put("currentDateStart", detail.getString("txrqq")); + snDetailMap.put("licensePlateNum", detail.getString("cph")); + snDetailMap.put("type", detail.getString("lx")); + + returnDetailList.add(snDetailMap); } + + jsonObject.put("invoiceLineList", returnDetailList); + } else { jsonObject.put("cyjg", invoiceData.get("cyjg")); jsonObject.put("cyjgxx", invoiceData.get("cyjgxx")); @@ -603,7 +599,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { return jsonObject; } - public String updateInvoicePoll(String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm,String imageId,String compCode) throws Exception { + public String updateInvoicePoll(String company, String taxNo, TDxInvoiceReimburse reimburse, SNInvoice invoice, String fplxdm, String imageId, String compCode) throws Exception { String result = "0000"; //判断发票类型 @@ -613,6 +609,12 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { if (SNFplxEnum.HCP.getFplxDm().equals(fplxdm) || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm) || SNFplxEnum.JPXCD.getFplxDm().equals(fplxdm) || SNFplxEnum.CP.getFplxDm().equals(fplxdm) || SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm)) { + + //0523晚成伟提出新需求,客运汽车票必须实名才可以进行价税分离 + if (SNFplxEnum.KYQCP.getFplxDm().equals(fplxdm) && StringUtils.isEmpty(reimburse.getPassenger()) || StringUtils.isEmpty(reimburse.getPassengerSFZH())) { + return result; + } + InvoiceInfo invoiceInfo = convertToInvoiceInfo(invoice); log.info("进行价税分离的发票信息为:{}", invoiceInfo); @@ -652,7 +654,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { reimburse = convertToReimburse(invoice, reimburse, fplxdm, company); - log.info("插库的发票信息:{}",reimburse); + log.info("插库的发票信息:{}", reimburse); DynamicContextHolder.push("business" + DbConstant.BUSINESS_WRITE); int insert = 0; @@ -661,7 +663,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { TDxInvoiceReimburse reimburse1 = tDxInvoiceReimburseService.getBaseMapper().selectOne(wrapper); if (reimburse1 != null) { // insert = tDxInvoiceReimburseService.getBaseMapper().updateById(reimburse); - insert = tDxInvoiceReimburseService.getBaseMapper().update(reimburse,wrapper); + insert = tDxInvoiceReimburseService.getBaseMapper().update(reimburse, wrapper); } else { insert = tDxInvoiceReimburseService.getBaseMapper().insert(reimburse); } @@ -674,11 +676,11 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { || "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(invoice,imageId,compCode); + Integer integer = this.pushInvoiceToRecordInvoice2(invoice, imageId, compCode); log.info("可查验发票,更新底账库完成"); } else { //不可查验发票,未入库,插入票池 - this.pushInvoiceToRecordInvoice(invoice, taxNo, company,imageId,compCode); + this.pushInvoiceToRecordInvoice(invoice, taxNo, company, imageId, compCode); log.info("不可查验发票,插入底账库成功"); } @@ -715,7 +717,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { reimburse.setXfAddressAndPhone(invoice.getSalesAddressPhone()); reimburse.setXfBankAndNo(invoice.getSalesBank()); String uuid = UUID.randomUUID().toString().replace("-", ""); - log.info("uuid={}",uuid); + log.info("uuid={}", uuid); reimburse.setSelectId(uuid); reimburse.setTaxRate(invoice.getTaxRate()); @@ -805,7 +807,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { InvoiceInfo invoice = new InvoiceInfo(); invoice.setInvoiceTypeCode(snInvoice.getInvoiceType()); - if(snInvoice.getBillingDate() != null) { + if (snInvoice.getBillingDate() != null) { Date date = new Date(); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd"); try { @@ -814,7 +816,7 @@ public class SNPushCheckRecordService extends AbstractServiceAdapter { e.printStackTrace(); } invoice.setInvoiceDate(date); - }else{ + } else { log.error("开票日期为空"); } diff --git a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java index db010c0d..f80d945f 100644 --- a/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java +++ b/dxhy-erp/src/main/java/com/dxhy/erp/service/impl/InvoiceAuthServiceImpl.java @@ -379,7 +379,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl0){ @@ -415,7 +415,7 @@ public class InvoiceAuthServiceImpl extends MpBaseServiceImpl - + @@ -48,7 +48,7 @@ fill_in_date,t.gf_tax_no,t.gf_name,t.tax_amount,t.yx_tax_amount,t.audit_status,t.apply_check,t.check_status,t.qs_status, DATE_FORMAT(t.qs_date,'%Y-%m-%d') qs_date,t.qs_type,t.qs_user,DATE_FORMAT(t.rzh_date,'%Y-%m-%d') rzh_date, t.rzh_yesorno,t.auth_status,t.bdk_status,t.confirm_user,t.rzh_belong_date,t.glzt, - t.customs_scan_id,t.dept_name businessName,t.in_account_status,t.sn_voucher_number,t.document_number,t.in_account_date,rzh_type,rzlx,t.create_date, + t.customs_scan_id,t.dept_name businessName,t.inaccount_status,t.sn_voucher_number,t.document_number,t.in_account_date,rzh_type,rzlx,t.create_date, data_sources,t.image_id,t.posting_time,t.account_period,t.comp_code,t.bzdh from t_dx_customs_record t where export_mark = '0' @@ -126,10 +126,10 @@ and t.rzh_type = #{rzhType} - and t.in_account_status = #{inAccountStatus} + and t.inaccount_status = #{inAccountStatus} - and (t.in_account_status = '0' or t.in_account_status = '' or t.in_account_status is null) + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) and t.qs_type = #{qsfs} @@ -247,8 +247,11 @@ and t.rzh_type = #{rzhType} - - and t.in_account_status = #{inAccountStatus} + + and t.inaccount_status = #{inAccountStatus} + + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) and t.qs_type = #{qsfs} diff --git a/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml index f0f0d302..a565392a 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml @@ -80,9 +80,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.invoice_status = #{invoiceStatus} @@ -342,8 +345,11 @@ and t.bzr like concat('%',#{bzr},'%') - - and t.in_account_status = #{inAccountStatus} + + and t.inaccount_status = #{inAccountStatus} + + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) and t.qs_status = #{qszt} diff --git a/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml index 05efa5e4..3915015b 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml @@ -68,9 +68,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.sn_voucher_number = #{snVoucherNumber} @@ -190,9 +193,12 @@ and t.bzr like concat('%',#{bzr},'%') - + and t.inaccount_status = #{inAccountStatus} + + and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null) + and t.sn_voucher_number = #{snVoucherNumber} diff --git a/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml index 2b5e66c5..a3828245 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtInvoicePoolMapper.xml @@ -536,10 +536,7 @@ and t.list_status = #{listMark} - - and t.payment_status = #{inAccountStatus} - + and DATE_FORMAT(t.payment_date,'%Y-%m') = #{inAccountMonth}