|
|
|
@ -5,9 +5,9 @@ import cn.hutool.core.codec.Base64; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.ObjUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSON; |
|
|
|
|
import cn.hutool.json.JSONConfig; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -699,6 +699,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse scopeQueryInvoices(JSONObject queryJson, Companyservice companyservice) { |
|
|
|
|
// 获取基本参数
|
|
|
|
|
QueryWrapper<Invoice> queryWrapper = new QueryWrapper<>(); |
|
|
|
@ -1247,6 +1248,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
allApiLog.setUrl(WebServiceConstant.SQHZFPXXQRD); |
|
|
|
|
allApiLog.setSendMsg(""); |
|
|
|
|
// 添加对应uuid
|
|
|
|
|
allApiLog.setResultMsg(""); |
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
@ -1456,6 +1458,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse deprecateQueryInvoice(DeprecateQueryInvoiceDTO deprecateQueryInvoiceDTO, Companyservice companyservice) { |
|
|
|
|
Invoice invoice = new Invoice(); |
|
|
|
|
invoice.setSellerTaxnum(companyservice.getSellertax()); |
|
|
|
@ -1491,6 +1494,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse queryPrinter(QueryPrinterDTO queryPrinterDTO, Companyservice companyservice) { |
|
|
|
|
JSONObject query = new JSONObject(); |
|
|
|
|
query.put("NSRSBH", companyservice.getSellertax()); |
|
|
|
@ -1992,8 +1996,31 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
return response; |
|
|
|
|
}else if (WebServiceConstant.QRCODE.equals(finalServiceId)) { |
|
|
|
|
// 获取人脸二维码
|
|
|
|
|
//查询状态还是返回二维码数据
|
|
|
|
|
//用不用入库
|
|
|
|
|
|
|
|
|
|
//获取税局用户名称
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put("NSRSBH",companyservice.getSellertax()); |
|
|
|
|
HXResponse hxResponse = queryRpaTaxAccount(param, companyservice); |
|
|
|
|
if (!StringUtils.equals("000000",hxResponse.getCode())){ |
|
|
|
|
return hxResponse; |
|
|
|
|
} |
|
|
|
|
JSONObject resp = JSONObject.parseObject(JSON.toJSONString(hxResponse.getData())); |
|
|
|
|
|
|
|
|
|
Map<String,Object> reqParam = new HashMap<>(); |
|
|
|
|
reqParam.put("NSRSBH",companyservice.getSellertax()); |
|
|
|
|
reqParam.put("YHM",resp.getString("YHM")); |
|
|
|
|
reqParam.put("RZID",allApiLog.getResultMsg()); |
|
|
|
|
|
|
|
|
|
HXResponse rpaAuthStatus = getRpaAuthStatus(new JSONObject(reqParam), companyservice); |
|
|
|
|
|
|
|
|
|
if (StringUtils.equals("000000",rpaAuthStatus.getCode())){ |
|
|
|
|
rpaAuthStatus.setCode("200"); |
|
|
|
|
rpaAuthStatus.setMessage("处理成功"); |
|
|
|
|
JSONObject data = JSONObject.parseObject(JSON.toJSONString(rpaAuthStatus.getData())); |
|
|
|
|
String ewm = data.getString("EWM"); |
|
|
|
|
rpaAuthStatus.setData(new HashMap<>().put("ewm",ewm)); |
|
|
|
|
} |
|
|
|
|
return rpaAuthStatus; |
|
|
|
|
|
|
|
|
|
}else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 申请红字信息表
|
|
|
|
@ -2002,7 +2029,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
LambdaQueryWrapper<Redinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(Redinfo::getFpqqlsh,requestId); |
|
|
|
|
Redinfo redinfo = redinfoMapper.selectOne(queryWrapper); |
|
|
|
|
HXResponse hxResponse = queryRedInfoByElepant(redinfo,companyservice); |
|
|
|
|
HXResponse hxResponse = queryRedInfoByElepant(redinfo,companyservice,allApiLog); |
|
|
|
|
|
|
|
|
|
return hxResponse; |
|
|
|
|
|
|
|
|
@ -2054,8 +2081,8 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public HXResponse queryRedInfoByElepant(Redinfo redinfo, Companyservice companyservice) { |
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public HXResponse queryRedInfoByElepant(Redinfo redinfo, Companyservice companyservice,InvoiceAllApiLog apiLog) { |
|
|
|
|
//返回信息
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(redinfo)){ |
|
|
|
@ -2068,8 +2095,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
//封装请求参数
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put("NSRSBH",companyservice.getSellertax()); |
|
|
|
|
//TODO 上传红字信息表需要存入uuid
|
|
|
|
|
param.put("UUID",""); |
|
|
|
|
param.put("UUID",apiLog.getResultMsg()); |
|
|
|
|
param.put("XSFNSRSBH",companyservice.getSellertax()); |
|
|
|
|
|
|
|
|
|
debugLog("红字信息表申请查询断点1",uuid,System.currentTimeMillis()); |
|
|
|
@ -2097,6 +2123,24 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
debugLog("断点8", uuid, System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
|
ElephantRedInfo elephantRedInfo = queryResultDTO.getDATA(); |
|
|
|
|
//原发票处理
|
|
|
|
|
String originFphm = redinfo.getOriginFphm(); |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("fphm", originFphm); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
//更新蓝字发票状态为冲红 99
|
|
|
|
|
invoice.setState(99); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
invoice.setId(null); |
|
|
|
|
invoice.setOriginFphm(invoice.getFphm()); |
|
|
|
|
invoice.setFphm(elephantRedInfo.getHZFPHM()); |
|
|
|
|
invoice.setBillInfoId(redinfo.getId()); |
|
|
|
|
invoice.setSystemOrderno(redinfo.getSystemOrderno()); |
|
|
|
|
invoice.setOutTradeOrderno(apiLog.getRequestId()); |
|
|
|
|
invoice.setFpqqlsh(redinfo.getFpqqlsh()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(elephantRedInfo.getHZKPRQ())); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
//红字信息表主信息封装
|
|
|
|
|
redinfo.setRedInfoNo(elephantRedInfo.getHZFPXXQRDBH()); |
|
|
|
|
redinfo.setSqlb(elephantRedInfo.getLRFSF()); |
|
|
|
@ -2116,52 +2160,73 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
redinfo.setBillInputTime(elephantRedInfo.getHZKPRQ()); |
|
|
|
|
|
|
|
|
|
int i = redinfoMapper.updateRedinfo(redinfo); |
|
|
|
|
debugLog("断点9", uuid, System.currentTimeMillis()); |
|
|
|
|
if (i<1){ |
|
|
|
|
debugLog("红字订单更新主表信息失败",uuid,System.currentTimeMillis()); |
|
|
|
|
throw new JianshuiServiceException("红字订单更新主表信息失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Redinfodetail> redinfodetailList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<Redinfodetail> redinfodetails = redinfoMapper.selectRedinfoDetailList(redinfo.getId()); |
|
|
|
|
|
|
|
|
|
Map<Integer, Redinfodetail> redInfoMapByIndex = redinfodetails.stream().collect(Collectors.toMap(e -> e.getIndex(), e -> e)); |
|
|
|
|
|
|
|
|
|
for (ElephantRedInfoDetail elephantRedInfoDetail : elephantRedInfo.getHZQRXXMXLIST()) { |
|
|
|
|
|
|
|
|
|
Redinfodetail redinfodetail = redInfoMapByIndex.get(elephantRedInfoDetail.getXH().longValue()); |
|
|
|
|
redinfodetail.setBillno(redinfo.getRedInfoNo()); |
|
|
|
|
redinfodetail.setRedinfoId(redinfo.getId()); |
|
|
|
|
redinfodetail.setIndex(elephantRedInfoDetail.getXH()); |
|
|
|
|
redinfodetail.setGoodName(elephantRedInfoDetail.getXMMC()); |
|
|
|
|
redinfodetail.setSpec(elephantRedInfoDetail.getGGXH()); |
|
|
|
|
redinfodetail.setUnit(elephantRedInfoDetail.getDW()); |
|
|
|
|
redinfodetail.setPrice(new BigDecimal(elephantRedInfoDetail.getFPSPDJ())); |
|
|
|
|
// TODO 不确定金额是否为含税金额
|
|
|
|
|
redinfodetail.setTaxamt(new BigDecimal(elephantRedInfoDetail.getJE())); |
|
|
|
|
redinfodetail.setTax(new BigDecimal(elephantRedInfoDetail.getSE())); |
|
|
|
|
redinfodetail.setTaxfreeamt(redinfodetail.getTaxamt().subtract(redinfodetail.getTax())); |
|
|
|
|
|
|
|
|
|
redinfodetail.setTaxrate(new BigDecimal(elephantRedInfoDetail.getSLV())); |
|
|
|
|
redinfodetail.setCreateTime(new Date()); |
|
|
|
|
redinfodetailList.add(redinfodetail); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除红字信息明细
|
|
|
|
|
redinfoMapper.deleteRedinfodetailByRedinfoId(redinfo.getId()); |
|
|
|
|
//批量插入
|
|
|
|
|
int count = redinfoMapper.batchRedinfodetail(redinfodetailList); |
|
|
|
|
if(count <1){ |
|
|
|
|
debugLog("红字订单更新明细信息失败",uuid,System.currentTimeMillis()); |
|
|
|
|
throw new JianshuiServiceException("红字订单更新明细信息失败"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TODO 返回啥看看文档
|
|
|
|
|
|
|
|
|
|
redinfo.setRedinfodetailList(redinfodetailList); |
|
|
|
|
|
|
|
|
|
return new HXResponse("200","查询成功",redinfo); |
|
|
|
|
//返回报文
|
|
|
|
|
AddRedInfoInvoiceTWOVO addRedInfoInvoiceTWO = new AddRedInfoInvoiceTWOVO(); |
|
|
|
|
|
|
|
|
|
addRedInfoInvoiceTWO.setHzfpxxqrdZtdm(elephantRedInfo.getHZFPXXQRDBH()); |
|
|
|
|
addRedInfoInvoiceTWO.setHzfpxxqrdid(elephantRedInfo.getUUID()); |
|
|
|
|
addRedInfoInvoiceTWO.setHzfpxxqrdZtdm(queryResultDTO.getZTDM()); |
|
|
|
|
|
|
|
|
|
AddRedInfoInvoiceJsonDataTWOVO addRedInfoInvoiceJsonDataTWOVO = new AddRedInfoInvoiceJsonDataTWOVO(); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setFpqqlsh(redinfo.getFpqqlsh()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setFphm(elephantRedInfo.getHZFPHM()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setGmfnsrsbh(elephantRedInfo.getGMFNSRSBH()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setGmfmc(elephantRedInfo.getGMFMC()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setKprq(elephantRedInfo.getHZKPRQ()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setXsfmc(elephantRedInfo.getXSFMC()); |
|
|
|
|
addRedInfoInvoiceJsonDataTWOVO.setXsfnsrsbh(elephantRedInfo.getXSFNSRSBH()); |
|
|
|
|
|
|
|
|
|
addRedInfoInvoiceTWO.setHzfpxx(addRedInfoInvoiceJsonDataTWOVO); |
|
|
|
|
|
|
|
|
|
//金财没有处理明细
|
|
|
|
|
|
|
|
|
|
// List<Redinfodetail> redinfodetailList = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
// List<Redinfodetail> redinfodetails = redinfoMapper.selectRedinfoDetailList(redinfo.getId());
|
|
|
|
|
//
|
|
|
|
|
// Map<Integer, Redinfodetail> redInfoMapByIndex = redinfodetails.stream().collect(Collectors.toMap(e -> e.getIndex(), e -> e));
|
|
|
|
|
//
|
|
|
|
|
// for (ElephantRedInfoDetail elephantRedInfoDetail : elephantRedInfo.getHZQRXXMXLIST()) {
|
|
|
|
|
//
|
|
|
|
|
// Redinfodetail redinfodetail = redInfoMapByIndex.get(elephantRedInfoDetail.getXH().longValue());
|
|
|
|
|
// redinfodetail.setBillno(redinfo.getRedInfoNo());
|
|
|
|
|
// redinfodetail.setRedinfoId(redinfo.getId());
|
|
|
|
|
// redinfodetail.setIndex(elephantRedInfoDetail.getXH());
|
|
|
|
|
// redinfodetail.setGoodName(elephantRedInfoDetail.getXMMC());
|
|
|
|
|
// redinfodetail.setSpec(elephantRedInfoDetail.getGGXH());
|
|
|
|
|
// redinfodetail.setUnit(elephantRedInfoDetail.getDW());
|
|
|
|
|
// redinfodetail.setPrice(new BigDecimal(elephantRedInfoDetail.getFPSPDJ()));
|
|
|
|
|
// // TODO 不确定金额是否为含税金额
|
|
|
|
|
// redinfodetail.setTaxamt(new BigDecimal(elephantRedInfoDetail.getJE()));
|
|
|
|
|
// redinfodetail.setTax(new BigDecimal(elephantRedInfoDetail.getSE()));
|
|
|
|
|
// redinfodetail.setTaxfreeamt(redinfodetail.getTaxamt().subtract(redinfodetail.getTax()));
|
|
|
|
|
//
|
|
|
|
|
// redinfodetail.setTaxrate(new BigDecimal(elephantRedInfoDetail.getSLV()));
|
|
|
|
|
// redinfodetail.setCreateTime(new Date());
|
|
|
|
|
// redinfodetailList.add(redinfodetail);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// //删除红字信息明细
|
|
|
|
|
// redinfoMapper.deleteRedinfodetailByRedinfoId(redinfo.getId());
|
|
|
|
|
// debugLog("断点10", uuid, System.currentTimeMillis());
|
|
|
|
|
// //批量插入
|
|
|
|
|
// int count = redinfoMapper.batchRedinfodetail(redinfodetailList);
|
|
|
|
|
// debugLog("断点11", uuid, System.currentTimeMillis());
|
|
|
|
|
// if(count <1){
|
|
|
|
|
// debugLog("红字订单更新明细信息失败",uuid,System.currentTimeMillis());
|
|
|
|
|
// throw new JianshuiServiceException("红字订单更新明细信息失败");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new HXResponse("0000","查询成功",addRedInfoInvoiceTWO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|