智能勾选

release
yishiqihuasheng 2 years ago
parent 7e55595765
commit 20c9f1c251
  1. 305
      dxhy-base/src/main/java/com/dxhy/base/controller/BaseInvoiceController.java
  2. 2
      dxhy-base/src/main/java/com/dxhy/base/dao/BaseTDxRecordInvoiceDao.java
  3. 22
      dxhy-base/src/main/java/com/dxhy/base/entity/BaseReturnEntity.java
  4. 187
      dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java
  5. 218
      dxhy-base/src/main/resources/mapper/BaseSggxcxMapper.xml

@ -1,8 +1,11 @@
package com.dxhy.base.controller;
import cn.hutool.core.codec.Base64;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dxhy.base.entity.BaseReturnEntity;
import com.dxhy.base.entity.BaseTDxRecordInvoice;
import com.dxhy.base.model.BaseDrgxReqVO;
import com.dxhy.base.service.fpxxrz.BaseCxrzfpService;
@ -22,8 +25,7 @@ import com.dxhy.common.utils.R;
import com.dxhy.common.vo.Tax;
import com.dxhy.common.vo.TaxOrgCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -31,6 +33,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.xml.ws.Response;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
@ -816,50 +819,41 @@ public class BaseInvoiceController extends AbstractController {
@SysLog("调用智能勾选查询接口")
@ResponseBody
public Object sgrzzngxcx(@RequestBody Map<String, Object> map) {
// String gfsh = (String)map.get("gfsh");
// String invoiceType = (String)map.get("invoiceType");
// String invoiceSource = (String)map.get("invoiceSource");
// String kpksrq = (String)map.get("kpksrq");
// String kpjsrq = (String)map.get("kpjsrq");
// String qszt = (String)map.get("qszt");
// String qsfs = (String)map.get("qsfs");
// String businessCode = (String)map.get("businessCode");
// String invoiceNo = (String)map.get("invoiceNo");
// String qsksrq = (String)map.get("qsksrq");
// String qsjsrq = (String)map.get("qsjsrq");
// String xfmc = (String)map.get("xfmc");
// String position = (String)map.get("position");
// String fpzt = (String)map.get("invoiceStatus");
// String sfkrz = (String)map.get("sfkrz");
// String qsr = (String)map.get("qsr");
// String bzdh = (String) map.get("bzdh");
String inAccountStatus = (String) map.get("inAccountStatus");
String companyCode = (String) map.get("companyCode");
String gfsh = (String)map.get("gfsh");
String maxTax = (String) map.get("maxTax");
String menuId = (String)map.get("menuId");
String company = (String)map.get("company");
String isChooseAll = (String) map.get("isChooseAll");
int curr = 0;
if (map.get("curr") != null){
curr = (int) map.get("curr");
}else {
ResponseEntity.ok(R.error("分页数据不能为空"));
if (org.apache.commons.lang3.StringUtils.isBlank(isChooseAll)){
return ResponseEntity.ok(R.error("是否全选标识不能为空"));
}
int curr = 0;
int size = 0;
if (map.get("size")!= null){
size = (int) map.get("size");
}else {
ResponseEntity.ok(R.error("分页大小不能为空"));
}
if ("N".equalsIgnoreCase(isChooseAll)){
if (map.get("curr") != null){
curr = (int) map.get("curr");
}else {
ResponseEntity.ok(R.error("分页数据不能为空"));
}
if (map.get("size")!= null){
size = (int) map.get("size");
}else {
ResponseEntity.ok(R.error("分页大小不能为空"));
}
}
if (StringUtils.isNotBlank(inAccountStatus)){
if (StringUtils.isBlank(inAccountStatus)){
return ResponseEntity.ok(R.error("入账状态不能为空"));
}
if (StringUtils.isNotBlank(maxTax)){
if (StringUtils.isBlank(maxTax)){
return ResponseEntity.ok(R.error("税额上限不能为空"));
}
@ -869,51 +863,16 @@ public class BaseInvoiceController extends AbstractController {
return ResponseEntity.ok(R.error("输入税额上限格式不对,请重新输入"));
}
String allIn = "88";
if (map.get("sign") != null && "99".equals((String)map.get("sign"))){
allIn = "99";
}
Map<String, Object> pramsMap = new HashMap<>(16);
// pramsMap.put("bzdh", bzdh);
// pramsMap.put("payment", map.get("payment"));
// pramsMap.put("paymentStatus", map.get("paymentStatus"));
// pramsMap.put("paymentDateStart", map.get("paymentDateStart"));
// pramsMap.put("paymentDateEnd", map.get("paymentDateEnd"));
// pramsMap.put("settlementNo", map.get("settlementNo"));
// pramsMap.put("voucherNumber", map.get("voucherNumber"));
// pramsMap.put("snVoucherNumber", map.get("snVoucherNumber"));
// pramsMap.put("postingTimeEnd", map.get("postingTimeEnd"));
// pramsMap.put("postingTimeStart", map.get("postingTimeStart"));
// pramsMap.put("imageNumber", map.get("imageNumber"));
// if (map.get("accountPeriod") != null && !"".equals(map.get("accountPeriod"))) {
// String accountPeriod = map.get("accountPeriod").toString().substring(0,7);
// pramsMap.put("accountPeriod", accountPeriod);
// log.info("accountPeriod:{}",accountPeriod);
// }
//
// if (sfkrz != null) {
// if (!"99".equals(sfkrz)) {
// pramsMap.put("sfkrz", sfkrz);
// }
// }
// if (invoiceSource != null) {
// if (!"99".equals(invoiceSource)) {
// pramsMap.put("invoiceSource", invoiceSource);
// }
// }
pramsMap.put("inAccountStatus", inAccountStatus);
pramsMap.put("company", company);
pramsMap.put("company", "BIGB");
pramsMap.put("menuId", menuId);
pramsMap.put("menuId", "118061");
pramsMap.put("maxTax",maxTax);
pramsMap.put("sign",allIn);
pramsMap.put("curr",curr);
pramsMap.put("size",size);
pramsMap.put("isChooseAll",isChooseAll);
pramsMap.put("business", getUserInfo().getBusiness());
pramsMap.put("dbName", getUserInfo().getDbName());
List<Tax> taxList = getUserInfo().getOrg();
@ -926,12 +885,11 @@ public class BaseInvoiceController extends AbstractController {
gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
}
//todo合并分支后把checkList加上可以让用户不使用上级权限就可以进行认证
if (ObjectUtils.isNotEmpty(gfshList)){
pramsMap.put("gfsh", gfshList);
}else {
return ResponseEntity.ok(R.error("购方税号不能为空"));
}
pramsMap.put("gfsh",gfshList);
pramsMap.put("sign","88");
if (StringUtils.isNotBlank(companyCode)){
@ -940,88 +898,141 @@ public class BaseInvoiceController extends AbstractController {
// if (!StringUtils.isBlank(invoiceType)) {
// if (!"99".equals(invoiceType)) {
// pramsMap.put("invoiceType", invoiceType);
// }
// } else {
// return ResponseEntity.ok(R.error("发票类型不能为空!"));
// }
// if (StringUtils.isNotBlank(fpzt)) {
// pramsMap.put("fpzt", fpzt);
// } else {
// return ResponseEntity.ok(R.error("发票状态不能为空"));
// }
// pramsMap.put("businessCode", "99");
// if (!StringUtils.isBlank(qszt)) {
// if (!"99".equals(qszt)) {
// pramsMap.put("qszt", qszt);
// if ("1".equals(qszt)) {
// if (!StringUtils.isBlank(qsksrq)) {
// pramsMap.put("qsksrq", qsksrq);
// } else {
// return ResponseEntity.ok(R.error("签收开始日期不能为空!"));
// }
// if (!StringUtils.isBlank(qsjsrq)) {
// pramsMap.put("qsjsrq", qsjsrq);
// } else {
// return ResponseEntity.ok(R.error("签收结束日期不能为空!"));
// }
// if (!StringUtils.isBlank(qsfs)) {
// // 表示全部
// if (!"99".equals(qsfs)) {
// pramsMap.put("qsfs", qsfs);
// }
// } else {
// return ResponseEntity.ok(R.error("签收方式不能为空!"));
// }
// pramsMap.put("businessCode", businessCode);
// }
try {
return ResponseEntity
.ok(R.ok().put("data", baseInvoiceManualCheckService.inTellingCheck(pramsMap)));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
return ResponseEntity.ok(R.error(CommonConstants.MSG_ERR_DEFAULT));
}
}
@PostMapping("/sggx/afterInTellingCheck")
@SysLog("智能勾选后认证")
@ResponseBody
public Object afterInTellingCheck(@RequestBody Map<String, Object> map) {
String isChooseAll = (String) map.get("isChooseAll");
if (StringUtils.isBlank(isChooseAll)){
return ResponseEntity.ok(R.error("是否全选标识不能为空"));
}
int curr = 1;
int size = 10;
int count = 0;
Map<String, Object> pramsMap = new HashMap<>(16);
if ("N".equalsIgnoreCase(isChooseAll)){
String uuids = (String) map.get("uuids");
if (StringUtils.isBlank(uuids)){
return ResponseEntity.ok(R.error("所选发票不能为空"));
}
String dkses = (String) map.get("dkses");
if (StringUtils.isBlank(dkses)){
return ResponseEntity.ok(R.error("所选发票抵扣税额不能为空"));
}
String gxType = (String) map.get("gxType");
if (StringUtils.isBlank(gxType)){
return ResponseEntity.ok(R.error("所选发票勾选类型不能为空"));
}
pramsMap.put("name", getUserName());
pramsMap.put("dbName", getUserInfo().getDbName());
pramsMap.put("loginName", getLoginName());
pramsMap.put("userName", getUserName());
pramsMap.put("uuids", uuids);
pramsMap.put("dkses",dkses);
pramsMap.put("gxType", gxType);
List<String> gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
if (!gfshList.isEmpty()) {
pramsMap.put("gfsh", gfshList);
} else {
return ResponseEntity.ok(R.error("购方信息不能为空!"));
}
}else {
String companyCode = (String) map.get("companyCode");
String gfsh = (String)map.get("gfsh");
String gxType = (String) map.get("gxType");
if (StringUtils.isBlank(gxType)){
return ResponseEntity.ok(R.error("所选发票勾选类型不能为空"));
}
map.put("business", getUserInfo().getBusiness());
map.put("dbName", getUserInfo().getDbName());
List<Tax> taxList = getUserInfo().getOrg();
map.put("taxList", taxList);
map.put("qsflag", getUserInfo().getQsStatus());
// List<String> gfshList = new ArrayList<>();
// if (!"99".equals(gfsh) && StringUtils.isNotBlank(gfsh)) {
// gfshList.add(gfsh);
// } else {
// gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
// }
// } else {
// return ResponseEntity.ok(R.error("签收状态不能为空!"));
// }
// String qsflag = getUserInfo().getQsStatus();
// if ("1".equals(qsflag)) {
// pramsMap.put("qszt", "1");
// }
// if (!StringUtils.isBlank(kpksrq)) {
// pramsMap.put("kpksrq", kpksrq);
// } else {
// return ResponseEntity.ok(R.error("开票开始日期不能为空!"));
// }
// if (!StringUtils.isBlank(kpjsrq)) {
// pramsMap.put("kpjsrq", kpjsrq);
// } else {
// return ResponseEntity.ok(R.error("开票结束日期不能为空!"));
// }
//
// if (!StringUtils.isBlank(position)) {
// pramsMap.put("username", getUserName());
// pramsMap.put("position", position);
// }
//
// //发票号码
// if (!StringUtils.isBlank(invoiceNo)) {
// if(invoiceNo.length()==8){
// pramsMap.put("invoiceNo", invoiceNo);
// }else {
// pramsMap.put("eleInvoiceNo", invoiceNo);
// }
// }
// //todo合并分支后把checkList加上可以让用户不使用上级权限就可以进行认证
//
// map.put("gfsh",gfshList);
//
// if (!StringUtils.isBlank(xfmc)) {
// pramsMap.put("xfmc", xfmc);
// }
// if (!StringUtils.isBlank(qsr)) {
// pramsMap.put("qsr", qsr);
// }
// map.put("sign","88");
if (StringUtils.isNotBlank(companyCode)){
pramsMap.put("companyCode",companyCode);
}
String sgrzzngxcx = baseInvoiceManualCheckService.inTellingCheck(map);
String encode = Base64.decodeStr(sgrzzngxcx);
BaseReturnEntity baseReturnEntity = JSON.parseObject(encode, BaseReturnEntity.class);
List<BaseTDxRecordInvoice> dataList = baseReturnEntity.getDataList();
StringBuilder uuids = new StringBuilder();
StringBuilder dkses = new StringBuilder();
if (dataList != null && dataList.size() > 0){
for (int i = 0; i < dataList.size(); i++) {
uuids.append(dataList.get(i).getUuid());
dkses.append(dataList.get(i).getTaxAmount());
if (i<dataList.size()-1){
uuids.append(",");
dkses.append(",");
}
}
}else {
return ResponseEntity.ok(R.error("没有可操作的数据"));
}
pramsMap.put("uuids",uuids);
pramsMap.put("dkses",dkses);
pramsMap.put("name", getUserName());
pramsMap.put("dbName", getUserInfo().getDbName());
pramsMap.put("loginName", getLoginName());
pramsMap.put("userName", getUserName());
pramsMap.put("gxType", gxType);
List<String> gfshList = UserInfoUtil.getGfshAll(getUserInfo().getOrg());
if (!gfshList.isEmpty()) {
pramsMap.put("gfsh", gfshList);
} else {
return ResponseEntity.ok(R.error("购方信息不能为空!"));
}
}
try {
return ResponseEntity
.ok(R.ok().put("data", baseInvoiceManualCheckService.inTellingCheck(pramsMap)));
.ok(R.ok().put("data", baseIRzTDxRecordInvoiceService.identifiByIds(pramsMap, curr, size, count)));
} catch (Exception e) {
e.printStackTrace();
log.error("", e);

@ -218,4 +218,6 @@ public interface BaseTDxRecordInvoiceDao extends BaseMapper<BaseTDxRecordInvoice
void updateSuspendType(Map<String,Object> pramsMap);
List<String> findSuspendStatus(@Param("uuids") List<String> uuids);
List<BaseTDxRecordInvoice> selectChooseHj(Map<String,Object> pramsMap);
}

@ -0,0 +1,22 @@
package com.dxhy.base.entity;
import lombok.Data;
import java.util.List;
@Data
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
public class BaseReturnEntity {
private static final long serialVersionUID = -2166713217995969349L;
private String hjse;
private List<BaseTDxRecordInvoice> dataList;
private String hjsl;
private String hjje;
private String total;
}

@ -451,37 +451,73 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
json = tabulateRedisService.getTabulateMenu(company, menuId);
List<String> gfshList = (List<String>)pramsMap.get("gfsh");
List<String> gfshList1 = new ArrayList<>();
if (gfshList.size() > 0) {
List<BaseTDxDkCount> curList = super.baseMapper.selectDksh(pramsMap);
for (BaseTDxDkCount cur : curList) {
String skssq = cur.getSkssq();
String year = skssq.substring(0, 4);
String mon = skssq.substring(4);
LocalDate localDate = LocalDate.of(Integer.parseInt(year), Integer.parseInt(mon), 1);
LocalDate localDate1 = localDate.plusMonths(1);
LocalDate localDate2 = LocalDate.now();
if ("0".equals(cur.getTjStatus()) || "3".equals(cur.getTjStatus())
|| localDate2.isBefore(localDate1)) {
gfshList1.add(cur.getTaxno());
String sign = (String) pramsMap.get("sign");
//如果有自己的税号则选择出在未申请抵扣的税号
if (!"88".equals(sign)){
List<String> gfshList1 = new ArrayList<>();
if (gfshList.size() > 0) {
List<BaseTDxDkCount> curList = super.baseMapper.selectDksh(pramsMap);
for (BaseTDxDkCount cur : curList) {
String skssq = cur.getSkssq();
String year = skssq.substring(0, 4);
String mon = skssq.substring(4);
LocalDate localDate = LocalDate.of(Integer.parseInt(year), Integer.parseInt(mon), 1);
LocalDate localDate1 = localDate.plusMonths(1);
LocalDate localDate2 = LocalDate.now();
if ("0".equals(cur.getTjStatus()) || "3".equals(cur.getTjStatus())
|| localDate2.isBefore(localDate1)) {
gfshList1.add(cur.getTaxno());
}
}
}
if(ObjectUtils.isEmpty(gfshList1)|| gfshList1.size()==0){
json.put("code","501");
json.put("message","税号已经申请抵扣");
if(ObjectUtils.isEmpty(gfshList1)|| gfshList1.size()==0){
json.put("code","501");
json.put("message","税号已经申请抵扣");
return super.responseResult(json);
}else {
pramsMap.put("gfsh",gfshList1);
}
} else {
json.put("code", "501");
json.put("message", "账号下无可用税号");
return super.responseResult(json);
}else {
pramsMap.put("gfsh",gfshList1);
}
} else {
json.put("code", "501");
json.put("message", "账号下无可用税号");
return super.responseResult(json);
}
PageHelper.startPage(1, 200);
String isChooseAll = (String) pramsMap.get("isChooseAll");
//如果不是勾选所有进行统计和分页
if ("N".equalsIgnoreCase(isChooseAll)){
int curr = (int) pramsMap.get("curr");
int size = (int) pramsMap.get("size");
// 合计信息,仅第一页时需要统计,减少数据库压力
if (curr == 1) {
String hjsl = "0";
String hjje = "0";
String hjse = "0";
List<BaseTDxRecordInvoice> hjList = super.baseMapper.selectChooseHj(pramsMap);
BaseTDxRecordInvoice hjxx = hjList.get(0);
hjsl = hjxx.getSfygx();
if (!"0".equals(hjsl)) {
hjje = AmountFormatUtil.fmtMicrometer(MathUtil.round(hjxx.getInvoiceAmount().toPlainString()));
hjse = AmountFormatUtil.fmtMicrometer(MathUtil.round(hjxx.getTaxAmount().toPlainString()));
}
json.put("hjsl", AmountFormatUtil.fmtMicrometer(hjsl));
json.put("hjje", hjje);
json.put("hjse", hjse);
if ("0".equals(hjsl)) {
json.put("message", "无可操作的数据");
json.put("code", "501");
return super.responseResult(json);
}
}
PageHelper.startPage(curr, size);
}
List<BaseTDxRecordInvoice> pageList = super.baseMapper.selectInTellingCheck(pramsMap);
if (pageList == null || pageList.size() == 0){
@ -498,12 +534,6 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
//记录数量
int count = 0;
//税额上限
BigDecimal maxTax = new BigDecimal((String)pramsMap.get("maxTax"));
//统计税额
BigDecimal currentTax = new BigDecimal("0");
//统计金额
BigDecimal hjje = new BigDecimal("0");
List<Business> businessList = (List<Business>)pramsMap.get("business");
if (pageList.size() > 0) {
@ -517,97 +547,18 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
}
}
}
for (int i = 0; i < pageList.size(); i++) {
if(pageList.get(i).getTaxAmount().compareTo(new BigDecimal("0"))<1){
continue;
}
currentTax = currentTax.add(pageList.get(i).getTaxAmount());
hjje = hjje.add(pageList.get(i).getInvoiceAmount());
log.info("maxTax====>"+maxTax+",currentTax====>"+currentTax+",taxAmount===>"+pageList.get(i).getTaxAmount());
if (maxTax.compareTo(currentTax) >0){
count++;
log.info("count++{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje);
//发票状态不能认证
// String invoiceStatus="07";
// if ( pageList.get(i).getInvoiceStatus() != null && !invoiceStatus.contains(pageList.get(i).getInvoiceStatus())
// || pageList.get(i).getInvoiceAmount() != null && pageList.get(i).getInvoiceAmount().compareTo(new BigDecimal(0)) < 0
// || pageList.get(i).getTaxAmount() != null && pageList.get(i).getTaxAmount().compareTo(new BigDecimal(0)) < 0) {
//
// currentTax = currentTax.subtract(pageList.get(i).getTaxAmount());
// hjje = hjje.subtract(pageList.get(i).getInvoiceAmount());
// count--;
// log.info("count--{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje);
// continue;
// }
//发票税号一申请抵扣统计
// if (!gfshList1.contains(pageList.get(i).getGfTaxNo())) {
// //该发票税号已申请抵扣统计
// log.info("申请统计的购方税号为{}",pageList.get(i).getGfTaxNo());
// currentTax = currentTax.subtract(pageList.get(i).getTaxAmount());
// hjje = hjje.subtract(pageList.get(i).getInvoiceAmount());
// count--;
// log.info("已申请抵扣统计 count-- ==={}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje);
//
// continue;
// }
BaseSggxCxRespVO vo = getBaseSggxCxRespVO(pageList.get(i), count, taxnoList, businessList);
// log.info("智能勾选查询返回对象VO {}",vo);
log.info("returnList添加vo");
returnList.add(vo);
}else {
log.info("统计税额超出税额上限减去最后一个,并结束循环遍历");
currentTax = currentTax.subtract(pageList.get(i).getTaxAmount());
hjje = hjje.subtract(pageList.get(i).getInvoiceAmount());
if (i<pageList.size()-1){
List<BaseTDxRecordInvoice> collect = pageList.stream().skip(i + 1).sorted(Comparator.comparing(BaseTDxRecordInvoice::getTaxAmount)).collect(Collectors.toList());
log.info("collect====>{}",collect.stream().map(BaseTDxRecordInvoice::getTaxAmount).collect(Collectors.toList()));
if (collect != null && collect.size() > 0){
log.info("从小到大排序在进行添加");
for (int j = 0; j < collect.size(); j++) {
if (collect.get(j).getTaxAmount().compareTo(new BigDecimal("0"))<1){
continue;
}
currentTax = currentTax.add(collect.get(j).getTaxAmount());
hjje = hjje.add(collect.get(j).getInvoiceAmount());
log.info("maxTax====>"+maxTax+",currentTax====>"+currentTax);
if (maxTax.compareTo(currentTax)>0){
count++;
log.info("最小排序count++{}"+count+",currentTax==》"+currentTax+",hjje===>"+hjje);
BaseSggxCxRespVO vo = getBaseSggxCxRespVO(collect.get(j), count, taxnoList, businessList);
log.info("returnList添加vo");
returnList.add(vo);
}else {
log.info("最小排序统计税额超出税额上限减去最后一个,并结束循环遍历");
currentTax = currentTax.subtract(collect.get(j).getTaxAmount());
hjje = hjje.subtract(collect.get(j).getInvoiceAmount());
break;
}
}
}
}
BaseSggxCxRespVO vo = getBaseSggxCxRespVO(pageList.get(i), count, taxnoList, businessList);
count++;
log.info("returnList添加vo");
returnList.add(vo);
}
break;
}
}
json.put("total", pageInfo.getTotal());
json.put("datalist", returnList);
}
}
if(returnList == null || returnList.size() == 0){
json.put("message","无可操作的数据");
json.put("code","501");
return super.responseResult(json);
}else {
json.put("hjje", hjje);
json.put("hjse", currentTax);
json.put("total", count);
json.put("datalist", returnList);
}
} catch (Exception e) {
// 统一设置操作异常标识
log.info("错误信息为:{}",e.getMessage());

@ -1337,28 +1337,117 @@
<select id="selectInTellingCheck" parameterType="java.util.Map"
resultMap="SggxcxResultMap" databaseId="mysql">
select t.invoice_type,t.dept_id,t.dept_name,t.comp_code
,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
DATE_FORMAT(t.invoice_date,'%Y-%m-%d')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,DATE_FORMAT(t.qs_date,'%Y-%m-%d')qs_date
,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,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
WHERE (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')
and t.export_mark = '0'
and t.company = #{company}
and t.invoice_status = '0'
and t.tax_amount > 0
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
SELECT *
FROM (
SELECT tax_amount,
(@total := @total + tax_amount) AS max_tax,
invoice_type,
comp_code,
invoice_code,
invoice_no,
gf_name,
gf_tax_no,
xf_name,
DATE_FORMAT(invoice_date,'%Y-%m-%d')invoice_date,
invoice_amount,
invoice_status,
DATE_FORMAT(qs_date,'%Y-%m-%d')qs_date,
qs_type,
qs_status,
dk_tax_amount,
qs_name,
sn_voucher_number,
posting_time,
image_id,
account_period,
bzdh,
bzr,
suspend_status,
suspend_date,
inaccount_status,
payment_status,
DATE_FORMAT(payment_date,'%Y-%m-%d')payment_date,
settlement_no,
ele_invoice_no
FROM t_dx_record_invoice, (SELECT @total := 0) AS t
WHERE tax_amount != ''
and tax_amount > 0
and (invoice_type in('01','03','08','14','31','283','161','183','185') or (invoice_type ='32' and lq_tdyslxDm='08'))
and rzh_yesorno = '0'
and auth_status in('0','5','6')
and export_mark = '0'
and invoice_status = '0'
<if test="sign !='88'">
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
and (t.comp_code in
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
#{companyCode}
</foreach>
or t.comp_code is null or t.comp_code = ''
)
</if>
<if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
and t.comp_code = #{companyCode}
</if>
<if test="companyCode != null and companyCode != '' and companyCode == '88'">
and (t.comp_code = '' or t.comp_code is null)
</if>
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
and t.inaccount_status = '1'
</if>
<if test="qsflag != null and qsflag != '' and qsflag != 'null' and qsflag == '1'.toString()">
and t.qs_status = '1'
</if>
ORDER BY tax_amount
) AS subquery
WHERE <![CDATA[ max_tax <= #{max_tax} ]]>
</select>
<resultMap id="chooseResultMap"
type="com.dxhy.base.entity.BaseTDxRecordInvoice">
<result column="hjsl" property="sfygx"/>
<result column="hjje" property="invoiceAmount"/>
<result column="hjse" property="taxAmount"/>
</resultMap>
<select id="selectChooseHj" parameterType="java.util.Map" databaseId="mysql" resultMap="chooseResultMap">
SELECT count(1) hjsl,sum(subquery.invoice_amount)hjje,sum(subquery.tax_amount)hjse
FROM (
SELECT tax_amount,
(@total := @total + tax_amount) AS max_tax,
invoice_amount
FROM t_dx_record_invoice, (SELECT @total := 0) AS t
WHERE tax_amount != ''
and tax_amount > 0
and (invoice_type in('01','03','08','14','31','283','161','183','185') or (invoice_type ='32' and lq_tdyslxDm='08'))
and rzh_yesorno = '0'
and auth_status in('0','5','6')
and export_mark = '0'
and invoice_status = '0'
<if test="sign !='88'">
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
and (t.comp_code in
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
#{companyCode}
</foreach>
or t.comp_code is null or t.comp_code = ''
)
</if>
<if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
and t.comp_code = #{companyCode}
</if>
@ -1366,92 +1455,17 @@
and (t.comp_code = '' or t.comp_code is null)
</if>
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus == '0'.toString()">
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
and t.inaccount_status = '1'
</if>
<if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
</if>
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') <= #{paymentDateEnd} ]]>
</if>
<if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
and t.payment_status = #{paymentStatus}
</if>
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
</if>
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
and t.invoice_type = #{invoiceType}
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="fpzt != null and fpzt != '' and fpzt != 'null'">
and t.invoice_status = #{fpzt}
</if>
<if test="qsfs != null and qsfs != '' and qsfs != 'null' ">
and t.qs_type = #{qsfs}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</if>
<if test="settlementNo != null and settlementNo != ''">
and t.settlement_no like concat(#{settlementNo},'%')
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<!-- 按签收人查询 -->
<if test="position != null and position != '' and position != 'null' and position == '1'.toString()">
and t.qs_name = #{username}
</if>
<if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
and t.dept_id = #{businessCode}
</if>
<if test="businessCode==''">
and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
</if>
<if test='businessCode == "99" and business != null and business.size()>0'>
and (t.dept_id in
<foreach collection="business" index="index" item="item" open="(" separator="," close="">
#{item.businessCode}
</foreach>
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
</if>
<if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
and t.ele_invoice_no = #{eleInvoiceNo}
</if>
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
</if>
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
and t.image_id = #{imageNumber}
</if>
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
and t.account_period = #{accountPeriod}
</if>
<if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
order by t.qs_date desc,t.invoice_date desc
</if>
<if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
order by t.invoice_date desc
<if test="qsflag != null and qsflag != '' and qsflag != 'null' and qsflag == '1'.toString()">
and t.qs_status = '1'
</if>
ORDER BY tax_amount
) AS subquery
WHERE <![CDATA[ max_tax <= #{max_tax} ]]>
</select>
<update id="updateSuspendType" parameterType="java.util.Map" databaseId="mysql">

Loading…
Cancel
Save