|
|
|
@ -2,6 +2,7 @@ package com.jianshui.invoice.service.impl.api; |
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
|
import com.jianshui.common.utils.BeanToMapUtils; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.*; |
|
|
|
@ -392,48 +393,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse uploadRedInfo(Redinfo redinfo, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
// 前置处理 redinfo.setCompanyId(companyservice.getCompanyid());
|
|
|
|
|
redinfo.setSystemOrderno(IdUtils.randomSystemOrderno()); |
|
|
|
|
if (StringUtils.isEmpty(redinfo.getOutTradeOrderno())) { |
|
|
|
|
// 把 outTradeOrderno作为用户的申请单号
|
|
|
|
|
throw new JianshuiParamErrorException(ErrorCode.EMPTY_REDINFO_NO, companyservice, "invoice"); |
|
|
|
|
} |
|
|
|
|
redinfo.setOutTradeOrderno(redinfo.getOutTradeOrderno()); |
|
|
|
|
redinfo.setFpqqlsh(redinfo.getSystemOrderno()); |
|
|
|
|
redinfo.setRedInfoStatus("0"); |
|
|
|
|
redinfo.setSellerName(companyservice.getSellername()); |
|
|
|
|
redinfo.setSellerTaxnum(companyservice.getSellertax()); |
|
|
|
|
redinfo.setBillInputTime(TimeUtil.dateFormat(new Date(), "yyyyMMddHHmmss")); |
|
|
|
|
List<Redinfodetail> redinfodetailList = redinfo.getRedinfodetailList(); |
|
|
|
|
BigDecimal taxfreeamt = new BigDecimal(0); // 不含税金额
|
|
|
|
|
BigDecimal tax = new BigDecimal(0); // 税额
|
|
|
|
|
for (Redinfodetail detail : redinfodetailList) { |
|
|
|
|
taxfreeamt = taxfreeamt.add(detail.getTaxfreeamt()); |
|
|
|
|
tax = tax.add(detail.getTax()); |
|
|
|
|
} |
|
|
|
|
redinfo.setTax(tax); |
|
|
|
|
redinfo.setTaxfreeamt(taxfreeamt); |
|
|
|
|
redinfo.setTaxamt(tax.add(taxfreeamt)); |
|
|
|
|
redinfoMapper.insertRedinfo(redinfo); |
|
|
|
|
int index = 0; |
|
|
|
|
|
|
|
|
|
String spbm = ""; |
|
|
|
|
for (Redinfodetail detail : redinfodetailList) { |
|
|
|
|
detail.setBillno(redinfo.getRedInfoNo()); |
|
|
|
|
detail.setRedinfoId(redinfo.getId()); |
|
|
|
|
detail.setIndex(++index); |
|
|
|
|
detail.setBillno(redinfo.getRedInfoNo()); |
|
|
|
|
taxfreeamt = taxfreeamt.add(detail.getTaxfreeamt()); |
|
|
|
|
tax = tax.add(detail.getTax()); |
|
|
|
|
|
|
|
|
|
// 商品编码
|
|
|
|
|
spbm = detail.getSpbm(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redinfoMapper.batchRedinfodetail(redinfodetailList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 金财数科数据处理 start
|
|
|
|
|
// 查询用户登记参数
|
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
@ -455,11 +414,34 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
SqhzJsonDataTwoDTO sqhzJsonDataTwoDTO = BeanUtil.copyProperties(redinfo,SqhzJsonDataTwoDTO.class); |
|
|
|
|
ValidateUtils.validate(sqhzJsonDataTwoDTO); |
|
|
|
|
|
|
|
|
|
// redInfo 前置处理 start
|
|
|
|
|
redinfo.setCompanyId(companyservice.getCompanyid()); |
|
|
|
|
String id = IdUtils.randomSystemOrderno(); |
|
|
|
|
redinfo.setSystemOrderno(id); |
|
|
|
|
redinfo.setOutTradeOrderno(id); |
|
|
|
|
redinfo.setFpqqlsh(id); |
|
|
|
|
redinfo.setRedInfoStatus("0"); |
|
|
|
|
redinfo.setSellerName(companyservice.getSellername()); |
|
|
|
|
redinfo.setSellerTaxnum(companyservice.getSellertax()); |
|
|
|
|
redinfo.setBillInputTime(TimeUtil.dateFormat(new Date(), "yyyyMMddHHmmss")); |
|
|
|
|
// 纸票为必填
|
|
|
|
|
redinfo.setBuyerName("全电"); |
|
|
|
|
redinfo.setBuyerTaxnum("全电"); |
|
|
|
|
redinfo.setSellerName("全电"); |
|
|
|
|
redinfo.setSellerTaxnum("全电"); |
|
|
|
|
redinfoMapper.insertRedinfo(redinfo); |
|
|
|
|
int index = 0; |
|
|
|
|
List<Redinfodetail> redinfodetailList = redinfo.getRedinfodetailList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(redinfodetailList)){ |
|
|
|
|
redinfoMapper.batchRedinfodetail(redinfodetailList); |
|
|
|
|
} |
|
|
|
|
// end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SqhzJsonDataDetailTwoDTO> sqhzJsonDataDetailTwoDTOS = BeanUtil.copyToList(redinfo.getRedinfodetailList(),SqhzJsonDataDetailTwoDTO.class); |
|
|
|
|
for (SqhzJsonDataDetailTwoDTO sqhzJsonDataDetailTwoDTO : sqhzJsonDataDetailTwoDTOS) { |
|
|
|
|
ValidateUtils.validate(sqhzJsonDataDetailTwoDTO); |
|
|
|
|
if(CollectionUtil.isNotEmpty(sqhzJsonDataDetailTwoDTOS)){ |
|
|
|
|
sqhzJsonDataTwoDTO.setHzqrxxmxlist(sqhzJsonDataDetailTwoDTOS); |
|
|
|
|
} |
|
|
|
|
sqhzJsonDataTwoDTO.setHzqrxxmxlist(sqhzJsonDataDetailTwoDTOS); |
|
|
|
|
sqhzDTO.setJsonData(sqhzJsonDataTwoDTO); |
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
@ -500,18 +482,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
return new HXResponse("通用查询接口异常"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*if (!StringUtils.equals("0000", retcode)) { |
|
|
|
|
redinfo.setRedInfoStatus("2"); |
|
|
|
|
redinfo.setRedInfoMessage(retmsg); |
|
|
|
|
redinfoMapper.updateRedinfo(redinfo); |
|
|
|
|
return new HXResponse(retmsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
redinfo.setRedInfoStatus("1"); |
|
|
|
|
redinfo.setRedInfoMessage(retmsg); |
|
|
|
|
redinfoMapper.updateRedinfo(redinfo); |
|
|
|
|
return new HXResponse(retmsg);*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|