diff --git a/dxhy-base/src/main/resources/mapper/BaseFpZhMapper.xml b/dxhy-base/src/main/resources/mapper/BaseFpZhMapper.xml index 714c6539..18b4e39f 100644 --- a/dxhy-base/src/main/resources/mapper/BaseFpZhMapper.xml +++ b/dxhy-base/src/main/resources/mapper/BaseFpZhMapper.xml @@ -73,7 +73,7 @@ bdk_date,t.rzh_back_msg,t.in_account_status,t.payment_status,date_format(t.payment_date,'%Y-%m-%d')payment_date, voucher_number,t.ele_invoice_no, sn_voucher_number, account_period, posting_time ,image_id from t_dx_record_invoice t - WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq} + WHERE t.invoice_date between #{kpksrq} and #{kpjsrq} and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')) and t.bdk_status in ('1','2') and t.export_mark = '0' @@ -353,7 +353,7 @@ resultMap="RzcxhjResultMap" databaseId="mysql"> select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse from t_dx_record_invoice t - WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq} + WHERE t.invoice_date between #{kpksrq} and #{kpjsrq} and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')) and t.auth_status != '0' and t.bdk_status in ('1','2') diff --git a/dxhy-base/src/main/resources/mapper/BaseSggxcxMapper.xml b/dxhy-base/src/main/resources/mapper/BaseSggxcxMapper.xml index f4ba951e..c64a71af 100644 --- a/dxhy-base/src/main/resources/mapper/BaseSggxcxMapper.xml +++ b/dxhy-base/src/main/resources/mapper/BaseSggxcxMapper.xml @@ -71,7 +71,7 @@ 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 - WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq} + WHERE t.invoice_date between #{kpksrq} and #{kpjsrq} and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')) and t.rzh_yesorno = '0' and t.auth_status in('0','5','6') @@ -81,14 +81,14 @@ and t.invoice_status in ('0','7') and t.invoice_amount>0 and t.tax_amount>=0 - and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date + and t.invoice_date between c.select_start_date and c.select_end_date and d.tj_status in('0','3') and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount <0 or t.tax_amount <0 or - date_format(t.invoice_date,'%Y%m%d') <= c.select_start_date or - date_format(t.invoice_date,'%Y%m%d') >= + t.invoice_date <= c.select_start_date or + t.invoice_date >= c.select_end_date or d.tj_status in ('1','2')) @@ -395,7 +395,7 @@ select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse 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 - WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq} + WHERE t.invoice_date between #{kpksrq} and #{kpjsrq} and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')) and t.rzh_yesorno = '0' and t.auth_status in('0','5','6') @@ -408,14 +408,14 @@ and t.invoice_status in ('0','7') and t.invoice_amount>0 and t.tax_amount>=0 - and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date + and t.invoice_date between c.select_start_date and c.select_end_date and d.tj_status in('0','3') and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount <0 or t.tax_amount <0 or - date_format(t.invoice_date,'%Y%m%d') <= c.select_start_date or - date_format(t.invoice_date,'%Y%m%d') >= + t.invoice_date <= c.select_start_date or + t.invoice_date >= c.select_end_date or d.tj_status in ('1','2')) diff --git a/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtFpzhcxController.java b/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtFpzhcxController.java index d9456436..86b5b841 100644 --- a/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtFpzhcxController.java +++ b/dxhy-extend/src/main/java/com/dxhy/extend/controller/ExtFpzhcxController.java @@ -3,6 +3,7 @@ package com.dxhy.extend.controller; import com.dxhy.common.aspect.SysLog; import com.dxhy.common.constant.CommonConstants; import com.dxhy.common.controller.AbstractController; +import com.dxhy.common.util.StringHelper; import com.dxhy.common.util.UserInfoUtil; import com.dxhy.common.utils.DateUtils; import com.dxhy.common.utils.R; @@ -115,6 +116,25 @@ public class ExtFpzhcxController extends AbstractController { } pramsMap.put("gfsh", gfshList); + boolean flag = checkList(gfshList); + + if (flag){ + pramsMap.put("sign","88"); + }else { + pramsMap.put("sign","99"); + } + + String companyCode = (String) pramsMap.get("companyCode"); + if (org.apache.commons.lang3.StringUtils.isNotBlank(companyCode) && "99".equals(companyCode)){ + pramsMap.put("companyCodes",getUserInfo().getCompanyCodes()); + log.info("组织机构====>{}",pramsMap.get("companyCodes")); + } + if (StringUtils.isNotBlank(companyCode)){ + pramsMap.put("companyCode",companyCode); + }else { + return ResponseEntity.ok(R.error("所属组织不能为空")); + } + if (pramsMap.get("kpksrq") != null && !"".equals(pramsMap.get("kpksrq"))) { pramsMap.put("kpksrq", DateUtils.getMorning(DateUtils.strToDate(pramsMap.get("kpksrq").toString()))); } @@ -199,6 +219,25 @@ public class ExtFpzhcxController extends AbstractController { } + public boolean checkList(List list) { + boolean flag =false; + if (list == null || list.isEmpty()){ + flag = true; + }else { + String s = list.toString().replace("[","").replace("]",""); + if (StringHelper.isBlank(s)){ + flag = true; + } + if (StringHelper.isNotBlank(s) && s.contains(",")){ + String replace = s.replace(",", ""); + if (StringHelper.isBlank(replace)){ + flag = true; + } + } + } + return flag; + } + /** * 报表异常发票查询 * diff --git a/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml index a565392a..7cdc8932 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtBbfpzhMapper.xml @@ -69,11 +69,30 @@ t.settlement_no,t.inaccount_status,t.bzdh, t.settlement_status,t.voucher_number,t.total_amount,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period from t_dx_record_invoice t - WHERE t.company = #{company} and t.invoice_date between #{kpksrq} and #{kpjsrq} - and t.gf_tax_no in - - #{item} - + WHERE t.company = #{company} + and t.invoice_date between #{kpksrq} and #{kpjsrq} + + + and t.gf_tax_no in + + #{item} + + + + + and (t.comp_code in + + #{companyCode} + + or t.comp_code is null or t.comp_code = '' + ) + + + and t.comp_code = #{companyCode} + + + and (t.comp_code = '' or t.comp_code is null) + and t.bzdh = #{bzdh} @@ -331,10 +350,29 @@ select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse 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} - + and t.company = #{company} + + + and t.gf_tax_no in + + #{item} + + + + + and (t.comp_code in + + #{companyCode} + + or t.comp_code is null or t.comp_code = '' + ) + + + and t.comp_code = #{companyCode} + + + and (t.comp_code = '' or t.comp_code is null) + and t.invoice_status = #{invoiceStatus} diff --git a/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml b/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml index 3915015b..60b6c659 100644 --- a/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml +++ b/dxhy-extend/src/main/resources/mapper/ExtBbycfpcxMapper.xml @@ -182,7 +182,7 @@ where t.invoice_status != '0' and t.invoice_type in ('01','03','08','14','31') and t.company = #{company} - and DATE_FORMAT(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq} + and t.invoice_date between #{kpksrq} and #{kpjsrq} and t.gf_tax_no in #{item}