ariesy 增加非空税号

release
yefei 2 years ago
parent da9738c17a
commit ccb2314755
  1. 168
      dxhy-base/src/main/java/com/dxhy/base/service/invoicecheck/BaseInvoiceManualCheckServiceImpl.java

@ -43,14 +43,14 @@ import com.github.pagehelper.PageInfo;
* 手动勾选查询service实现类
*
* @author kangzq
* @date 2019年5月11日
* @version 1.0
* @date 2019年5月11日
*/
@SuppressWarnings({"AlibabaLowerCamelCaseVariableNaming", "AlibabaUndefineMagicConstant", "AlibabaMethodTooLong"})
@Slf4j
@Service("baseInvoiceManualCheckService")
public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDxRecordInvoiceDao, BaseTDxRecordInvoice>
implements BaseInvoiceManualCheckService {
implements BaseInvoiceManualCheckService {
@Resource
private BaseTDxTaxCurrentDao baseTDxTaxCurrentDao;
@Resource
@ -65,18 +65,18 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
@Override
public String selectByManualCheck(Map<String, Object> pramsMap, int curr, int size) {
long enter = System.currentTimeMillis();
log.info("入参是:{}",pramsMap);
log.info("入参是:{}", pramsMap);
JSONObject json;
DynamicContextHolder.push(pramsMap.get("dbName") + DbConstant.BUSINESS_READ);
try {
String company = (String)pramsMap.get("company");
String menuId = (String)pramsMap.get("menuId");
String company = (String) pramsMap.get("company");
String menuId = (String) pramsMap.get("menuId");
json = tabulateRedisService.getTabulateMenu(company, menuId);
List<BaseSggxCxRespVO> voList = new ArrayList<>();
List<String> gfshList = (List<String>)pramsMap.get("gfsh");
log.info("购方税号{}",gfshList);
String qsflag = (String)pramsMap.get("qsflag");
List<String> gfshList = (List<String>) pramsMap.get("gfsh");
log.info("购方税号{}", gfshList);
String qsflag = (String) pramsMap.get("qsflag");
List<String> gfshList1 = new ArrayList<>();
if (gfshList.size() > 0) {
List<BaseTDxDkCount> curList = super.baseMapper.selectDksh(pramsMap);
@ -88,7 +88,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
LocalDate localDate1 = localDate.plusMonths(1);
LocalDate localDate2 = LocalDate.now();
if ("0".equals(cur.getTjStatus()) || "3".equals(cur.getTjStatus())
|| localDate2.isBefore(localDate1)) {
|| localDate2.isBefore(localDate1)) {
gfshList1.add(cur.getTaxno());
}
}
@ -108,7 +108,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
String hjse = "0";
long start = System.currentTimeMillis();
List<BaseTDxRecordInvoice> hjList = super.baseMapper.selectHj(pramsMap);
log.info("手工认证 查询统计信息耗时:{}",System.currentTimeMillis()-start);
log.info("手工认证 查询统计信息耗时:{}", System.currentTimeMillis() - start);
BaseTDxRecordInvoice hjxx = hjList.get(0);
hjsl = hjxx.getSfygx();
if (!"0".equals(hjsl)) {
@ -125,20 +125,20 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
}
}
log.info("查询合计耗时:{}",System.currentTimeMillis()-enter);
log.info("查询合计耗时:{}", System.currentTimeMillis() - enter);
PageHelper.startPage(curr, size);
long start1 = System.currentTimeMillis();
List<BaseTDxRecordInvoice> pageList = super.baseMapper.selectSggxcx(pramsMap);
log.info("手工认证 查询列表信息耗时:{}",System.currentTimeMillis()-start1);
log.info("手工认证 查询列表信息耗时:{}", System.currentTimeMillis() - start1);
PageInfo<BaseTDxRecordInvoice> pageInfo = new PageInfo<>(pageList);
log.info("返回的列表为:{}",pageList);
log.info("查询耗时:{}",System.currentTimeMillis()-enter);
log.info("返回的列表为:{}", pageList);
log.info("查询耗时:{}", System.currentTimeMillis() - enter);
// 转化为页面展示对象
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (pageList.size() > 0) {
List<Tax> taxList = (List<Tax>)pramsMap.get("taxList");
List<Tax> taxList = (List<Tax>) pramsMap.get("taxList");
List<String> taxnoList = new ArrayList<>();
if (taxList != null && taxList.size() > 0) {
for (Tax tax : taxList) {
@ -148,7 +148,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
}
}
}
List<Business> businessList = (List<Business>)pramsMap.get("business");
List<Business> businessList = (List<Business>) pramsMap.get("business");
int start = new Long(pageInfo.getStartRow()).intValue();
for (int i = 0; i < pageList.size(); i++) {
BaseSggxCxRespVO vo = new BaseSggxCxRespVO();
@ -163,17 +163,17 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setUpgradeStatus("0");
if (pageList.get(i).getDkTaxAmount() != null) {
vo.setDkse(AmountFormatUtil
.fmtMicrometer(MathUtil.round(pageList.get(i).getDkTaxAmount().toString())));
.fmtMicrometer(MathUtil.round(pageList.get(i).getDkTaxAmount().toString())));
} else {
vo.setDkse(AmountFormatUtil
.fmtMicrometer(MathUtil.round(pageList.get(i).getTaxAmount().toString())));
.fmtMicrometer(MathUtil.round(pageList.get(i).getTaxAmount().toString())));
}
}
String businessCode = pageList.get(i).getDeptId();
String businessName = this.getBusinessName(businessCode, businessList);
log.info("businessName={}",businessName);
log.info("businessName={}", businessName);
vo.setVoucherNumber(pageList.get(i).getVoucherNumber());
vo.setSnVoucherNumber(pageList.get(i).getSnVoucherNumber());
vo.setImageNumber(pageList.get(i).getImageNumber());
@ -182,14 +182,14 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setId(String.valueOf(pageList.get(i).getId()));
vo.setXh(String.valueOf(start + i));
vo.setInvoiceAmount(
AmountFormatUtil.fmtMicrometer(MathUtil.round(pageList.get(i).getInvoiceAmount().toString())));
AmountFormatUtil.fmtMicrometer(MathUtil.round(pageList.get(i).getInvoiceAmount().toString())));
vo.setInvoiceCode(pageList.get(i).getInvoiceCode());
vo.setInvoiceDate(sdf.format(pageList.get(i).getInvoiceDate()));
vo.setInvoiceNo(pageList.get(i).getInvoiceNo());
vo.setSettlementNo(pageList.get(i).getSettlementNo());
vo.setTaxAmount(
AmountFormatUtil.fmtMicrometer(MathUtil.round(pageList.get(i).getTaxAmount().toString())));
vo.setInvoiceStatus(dictdetaServcice.queryDictName(DictConstant.INVOICE_STATUS,pageList.get(i).getInvoiceStatus()));
AmountFormatUtil.fmtMicrometer(MathUtil.round(pageList.get(i).getTaxAmount().toString())));
vo.setInvoiceStatus(dictdetaServcice.queryDictName(DictConstant.INVOICE_STATUS, pageList.get(i).getInvoiceStatus()));
vo.setInvoiceType(pageList.get(i).getInvoiceType());
//报账单号和入账状态
// vo.setInAccountStatus(pageList.get(i).getInvoiceStatus());
@ -201,28 +201,28 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setQsrq(sdf.format(pageList.get(i).getQsDate()));
}
if (pageList.get(i).getQsType() != null) {
vo.setQsfs(dictdetaServcice.queryDictName(DictConstant.QS_TYPE,pageList.get(i).getQsType()));
vo.setQsfs(dictdetaServcice.queryDictName(DictConstant.QS_TYPE, pageList.get(i).getQsType()));
}
vo.setQsr(pageList.get(i).getQsName());
}
if (pageList.get(i).getQsStatus() != null) {
vo.setQszt(dictdetaServcice.queryDictName(DictConstant.QS_STATUS,pageList.get(i).getQsStatus()));
vo.setQszt(dictdetaServcice.queryDictName(DictConstant.QS_STATUS, pageList.get(i).getQsStatus()));
}
log.info("inaccountStatus==>{}",pageList.get(i).getInAccountStatus());
log.info("inaccountStatus==>{}", pageList.get(i).getInAccountStatus());
if ("1".equals(pageList.get(i).getInAccountStatus())) {
vo.setInAccountStatus("已入账");
} else {
vo.setInAccountStatus("未入账");
}
String suspendStatus = pageList.get(i).getSuspendStatus();
if ("1".equals(suspendStatus)){
if ("1".equals(suspendStatus)) {
vo.setSuspendStatus("是");
}else {
} else {
vo.setSuspendStatus("否");
}
vo.setSuspendDate(pageList.get(i).getSuspendDate());
vo.setBzr(pageList.get(i).getBzr());
vo.setPaymentStatus(dictdetaServcice.queryDictName(DictConstant.FK_STATUS,pageList.get(i).getPaymentStatus()));
vo.setPaymentStatus(dictdetaServcice.queryDictName(DictConstant.FK_STATUS, pageList.get(i).getPaymentStatus()));
vo.setPaymentDate(pageList.get(i).getPaymentDate());
vo.setGfmc(pageList.get(i).getGfName());
vo.setXfmc(pageList.get(i).getXfName());
@ -237,18 +237,18 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setSelect(true);
}
log.info("手工勾选查询返回对象VO {}",vo);
log.info("手工勾选查询返回对象VO {}", vo);
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) {
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) {
vo.setSelect(false);
vo.setUpgradeStatus("0");
}
String sign = (String) pramsMap.get("sign");
if (!"88".equals(sign)){
if (!"88".equals(sign)) {
if (!gfshList1.contains(pageList.get(i).getGfTaxNo())) {
vo.setSelect(false);
vo.setBkgxts("该发票税号已申请抵扣统计");
@ -271,7 +271,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
json.put("datalist", voList);
} catch (Exception e) {
// 统一设置操作异常标识
log.info("错误信息为:{}",e.getMessage());
log.info("错误信息为:{}", e.getMessage());
json = super.errorResult(e);
}
@ -281,19 +281,16 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
/**
* 根据businessCode获取对应名称用于页面显示
*
* @param businessCode
* 业务单元
* @param businessList
* 业务单元list
* @param businessCode 业务单元
* @param businessList 业务单元list
* @return 返回
*
*/
private String getBusinessName(String businessCode, List<Business> businessList) {
String businessName = "";
if (!StringHelper.isBlank(businessCode) && businessList != null && businessList.size() > 0) {
for (Business business : businessList) {
if (!StringHelper.isBlank(business.getBusinessCode())
&& business.getBusinessCode().equals(businessCode)) {
&& business.getBusinessCode().equals(businessCode)) {
businessName = StringHelper.trim(business.getBusinessName(), "");
break;
}
@ -421,7 +418,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
tsflag = true;
} else {
LocalDate tjsj = LocalDate.of(Integer.parseInt(tjDate.substring(0, 4)),
Integer.parseInt(tjDate.substring(4, 6)), Integer.parseInt(tjDate.substring(6, 8)));
Integer.parseInt(tjDate.substring(4, 6)), Integer.parseInt(tjDate.substring(6, 8)));
if (tjsj.isBefore(localDate1)) {
if (!taxList1.contains(cur.getTaxno())) {
tsxx1.append(cur.getTaxno()).append(" \n ");
@ -449,21 +446,21 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
@Override
public String inTellingCheck(Map<String, Object> pramsMap) {
log.info("入参是:{}",pramsMap);
log.info("入参是:{}", pramsMap);
JSONObject json = new JSONObject();
DynamicContextHolder.push(pramsMap.get("dbName") + DbConstant.BUSINESS_READ);
try {
String company = (String)pramsMap.get("company");
String menuId = (String)pramsMap.get("menuId");
if (StringUtils.isNotBlank(menuId)){
String company = (String) pramsMap.get("company");
String menuId = (String) pramsMap.get("menuId");
if (StringUtils.isNotBlank(menuId)) {
json = tabulateRedisService.getTabulateMenu(company, menuId);
}
List<String> gfshList = (List<String>)pramsMap.get("gfsh");
List<String> gfshList = (List<String>) pramsMap.get("gfsh");
String sign = (String) pramsMap.get("sign");
//如果有自己的税号则选择出在未申请抵扣的税号
if (!"88".equals(sign)){
if (!"88".equals(sign)) {
List<String> gfshList1 = new ArrayList<>();
if (gfshList.size() > 0) {
List<BaseTDxDkCount> curList = super.baseMapper.selectDksh(pramsMap);
@ -479,12 +476,12 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
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 {
pramsMap.put("gfsh", gfshList1);
}
} else {
json.put("code", "501");
@ -494,7 +491,6 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
}
String hjsl = "0";
String hjje = "0";
String hjse = "0";
@ -516,43 +512,43 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
String isChooseAll = (String) pramsMap.get("isChooseAll");
if ("N".equals(isChooseAll)){
if ("N".equals(isChooseAll)) {
int total = Integer.parseInt(hjsl);
int curr = (int) pramsMap.get("curr");
int size = (int) pramsMap.get("size");
int totalPage = total % size == 0?total/size:total/size+1;
int totalPage = total % size == 0 ? total / size : total / size + 1;
if (curr<1){
curr =1;
if (curr < 1) {
curr = 1;
}
if (curr>totalPage){
if (curr > totalPage) {
curr = totalPage;
}
curr = (curr -1)*size;
pramsMap.put("curr",curr);
curr = (curr - 1) * size;
pramsMap.put("curr", curr);
}
List<BaseTDxRecordInvoice> pageList = super.baseMapper.selectInTellingCheck(pramsMap);
if (pageList == null || pageList.size() == 0){
json.put("message","无可操作的数据");
json.put("code","501");
if (pageList == null || pageList.size() == 0) {
json.put("message", "无可操作的数据");
json.put("code", "501");
return super.responseResult(json);
}
PageInfo<BaseTDxRecordInvoice> pageInfo = new PageInfo<>(pageList);
log.info("返回的列表为:{}",pageList);
log.info("返回的列表为:{}", pageList);
// 转化为页面展示对象
List<BaseSggxCxRespVO> returnList = new ArrayList<>();
//记录数量
int count = 1;
//税额上限
List<Business> businessList = (List<Business>)pramsMap.get("business");
List<Business> businessList = (List<Business>) pramsMap.get("business");
if (pageList.size() > 0) {
List<Tax> taxList = (List<Tax>)pramsMap.get("taxList");
List<Tax> taxList = (List<Tax>) pramsMap.get("taxList");
List<String> taxnoList = new ArrayList<>();
if (taxList != null && taxList.size() > 0) {
for (Tax tax : taxList) {
@ -576,7 +572,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
} catch (Exception e) {
// 统一设置操作异常标识
log.info("错误信息为:{}",e.getMessage());
log.info("错误信息为:{}", e.getMessage());
json = super.errorResult(e);
}
@ -592,32 +588,34 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
Map<String, String> taxnoMap = taxnoList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, SysDeptEntity::getTaxno));
Map<String, String> parentIdMap = parentIdList.stream().collect(Collectors.toMap(SysDeptEntity::getDeptId, e -> e.getParentId() == null ? "" : e.getParentId()));
log.info("taxnoMap={},parentIdMap={}",taxnoMap,parentIdMap);
log.info("taxnoMap={},parentIdMap={}", taxnoMap, parentIdMap);
String gfsh = "";
for(String companyCode : companyCodes){
for (String companyCode : companyCodes) {
QueryWrapper<SysDeptEntity> wrapper = new QueryWrapper<>();
wrapper.eq("org_code",companyCode);
SysDeptEntity sysDeptEntity = sysDeptAuthDao.selectOne(wrapper);
if(sysDeptEntity != null) {
wrapper.eq("org_code", companyCode);
List<SysDeptEntity> sysDeptEntityList = sysDeptAuthDao.selectList(wrapper);
SysDeptEntity sysDeptEntity = sysDeptEntityList.get(0);
if (sysDeptEntity != null) {
String dId = sysDeptEntity.getDeptId();
log.info("获取deptId为:{}",dId);
if(StringUtils.isNotEmpty(dId)) {
log.info("获取deptId为:{}", dId);
if (StringUtils.isNotEmpty(dId)) {
gfsh = getGfsh(dId, taxnoMap, parentIdMap);
gfshList.add(gfsh);
if (StringUtils.isNotEmpty(gfsh))
gfshList.add(gfsh);
log.info("获取的税号为:{}", gfsh);
}
}
}
log.info("购方税号list为:{}",gfshList);
log.info("购方税号list为:{}", gfshList);
return gfshList;
}
private String getGfsh(String deptId,Map<String, String> taxnoMap,Map<String, String> parentIdMap) {
private String getGfsh(String deptId, Map<String, String> taxnoMap, Map<String, String> parentIdMap) {
String taxno = "";
if(StringUtils.isNotEmpty(deptId)) {
if (StringUtils.isNotEmpty(deptId)) {
log.info("deptId={}", deptId);
taxno = taxnoMap.get(deptId);
@ -671,7 +669,7 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setSettlementNo(baseTDxRecordInvoice.getSettlementNo());
vo.setTaxAmount(
AmountFormatUtil.fmtMicrometer(MathUtil.round(baseTDxRecordInvoice.getTaxAmount().toString())));
vo.setInvoiceStatus(dictdetaServcice.queryDictName(DictConstant.INVOICE_STATUS,baseTDxRecordInvoice.getInvoiceStatus()));
vo.setInvoiceStatus(dictdetaServcice.queryDictName(DictConstant.INVOICE_STATUS, baseTDxRecordInvoice.getInvoiceStatus()));
vo.setInvoiceType(baseTDxRecordInvoice.getInvoiceType());
//报账单号和入账状态
// vo.setInAccountStatus(pageList.get(i).getInvoiceStatus());
@ -683,25 +681,25 @@ public class BaseInvoiceManualCheckServiceImpl extends MpBaseServiceImpl<BaseTDx
vo.setQsrq(sdf.format(baseTDxRecordInvoice.getQsDate()));
}
if (baseTDxRecordInvoice.getQsType() != null) {
vo.setQsfs(dictdetaServcice.queryDictName(DictConstant.QS_TYPE,baseTDxRecordInvoice.getQsType()));
vo.setQsfs(dictdetaServcice.queryDictName(DictConstant.QS_TYPE, baseTDxRecordInvoice.getQsType()));
}
vo.setQsr(baseTDxRecordInvoice.getQsName());
}
if (baseTDxRecordInvoice.getQsStatus() != null) {
vo.setQszt(dictdetaServcice.queryDictName(DictConstant.QS_STATUS,baseTDxRecordInvoice.getQsStatus()));
vo.setQszt(dictdetaServcice.queryDictName(DictConstant.QS_STATUS, baseTDxRecordInvoice.getQsStatus()));
}
if ("1".equals(baseTDxRecordInvoice.getInAccountStatus())) {
vo.setInAccountStatus("已入账");
} else {
vo.setInAccountStatus("未入账");
}
if ("1".equals(vo.getSuspendStatus())){
if ("1".equals(vo.getSuspendStatus())) {
vo.setSuspendStatus("是");
}else {
} else {
vo.setSuspendStatus("否");
vo.setSuspendDate("");
}
vo.setPaymentStatus(dictdetaServcice.queryDictName(DictConstant.FK_STATUS,baseTDxRecordInvoice.getPaymentStatus()));
vo.setPaymentStatus(dictdetaServcice.queryDictName(DictConstant.FK_STATUS, baseTDxRecordInvoice.getPaymentStatus()));
vo.setPaymentDate(baseTDxRecordInvoice.getPaymentDate());
vo.setGfmc(baseTDxRecordInvoice.getGfName());
vo.setXfmc(baseTDxRecordInvoice.getXfName());

Loading…
Cancel
Save