|
|
|
@ -1,13 +1,15 @@ |
|
|
|
|
package com.jianshui.invoice.service.impl.api; |
|
|
|
|
|
|
|
|
|
import ch.qos.logback.core.joran.spi.ElementPath; |
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
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.druid.support.json.JSONUtils; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -29,6 +31,7 @@ import com.jianshui.common.utils.TimeUtil; |
|
|
|
|
import com.jianshui.common.utils.http.HttpHelper; |
|
|
|
|
import com.jianshui.common.utils.uuid.IdUtils; |
|
|
|
|
import com.jianshui.framework.manager.AsyncManager; |
|
|
|
|
import com.jianshui.invoice.constant.elephant.ElephantConstants; |
|
|
|
|
import com.jianshui.invoice.constant.elephant.ElephantConstantsV6; |
|
|
|
|
import com.jianshui.invoice.domain.*; |
|
|
|
|
import com.jianshui.invoice.domain.dto.*; |
|
|
|
@ -38,9 +41,9 @@ import com.jianshui.invoice.domain.dto.api.elephant.sd.GetRpaAuthStatusDTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.elephant.sd.HZQRDMXLIST; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.elephant.sd.RedDownload; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.elephant.sd.RedUpload; |
|
|
|
|
import com.jianshui.invoice.domain.ele.EleNewMessage; |
|
|
|
|
import com.jianshui.invoice.domain.ele.EleOuterMessage; |
|
|
|
|
import com.jianshui.invoice.domain.ele.HZSQDMessage; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.jcsk.CxhzJsonDataTwoDTO; |
|
|
|
|
import com.jianshui.invoice.domain.dto.api.jcsk.CxhzTwoDTO; |
|
|
|
|
import com.jianshui.invoice.domain.ele.*; |
|
|
|
|
import com.jianshui.invoice.domain.vo.InvoiceAllQycodeResultElEVO; |
|
|
|
|
import com.jianshui.invoice.domain.vo.jcsk.*; |
|
|
|
|
import com.jianshui.invoice.mapper.BillInfoMapper; |
|
|
|
@ -64,8 +67,10 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections.CollectionUtils; |
|
|
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
|
|
import org.apache.ibatis.annotations.Lang; |
|
|
|
|
import org.joda.time.format.DateTimeFormat; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -75,6 +80,8 @@ import java.math.BigDecimal; |
|
|
|
|
import java.security.InvalidKeyException; |
|
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -699,6 +706,7 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
* @param companyservice |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public HXResponse scopeQueryInvoices(JSONObject queryJson, Companyservice companyservice) { |
|
|
|
|
// 获取基本参数
|
|
|
|
|
QueryWrapper<Invoice> queryWrapper = new QueryWrapper<>(); |
|
|
|
@ -1247,6 +1255,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 +1465,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 +1501,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 +2003,28 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
return response; |
|
|
|
|
}else if (WebServiceConstant.QRCODE.equals(finalServiceId)) { |
|
|
|
|
// 获取人脸二维码
|
|
|
|
|
//查询状态还是返回二维码数据
|
|
|
|
|
//用不用入库
|
|
|
|
|
|
|
|
|
|
//获取税局用户名称
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put(ElephantConstants.NSRSBH,companyservice.getSellertax()); |
|
|
|
|
HXResponse hxResponse = queryRpaTaxAccount(param, companyservice); |
|
|
|
|
if (!StringUtils.equals("000000",hxResponse.getCode())){ |
|
|
|
|
return hxResponse; |
|
|
|
|
} |
|
|
|
|
JSONObject resp = JSONObject.parseObject(JSON.toJSONString(hxResponse.getData())); |
|
|
|
|
|
|
|
|
|
param.put(ElephantConstants.YHM,resp.getString(ElephantConstants.YHM)); |
|
|
|
|
|
|
|
|
|
HXResponse rpaAuthStatus = qrcode(param, companyservice); |
|
|
|
|
|
|
|
|
|
if (StringUtils.equals("000000",rpaAuthStatus.getCode())){ |
|
|
|
|
rpaAuthStatus.setCode("200"); |
|
|
|
|
rpaAuthStatus.setMessage("处理成功"); |
|
|
|
|
JSONObject data = JSONObject.parseObject(JSON.toJSONString(rpaAuthStatus.getData())); |
|
|
|
|
String ewm = data.getString(ElephantConstants.EWM); |
|
|
|
|
rpaAuthStatus.setData(new HashMap<>().put(ElephantConstants.EWM.toLowerCase(),ewm)); |
|
|
|
|
} |
|
|
|
|
return rpaAuthStatus; |
|
|
|
|
|
|
|
|
|
}else if (WebServiceConstant.SQHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 申请红字信息表
|
|
|
|
@ -2002,7 +2033,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; |
|
|
|
|
|
|
|
|
@ -2031,9 +2062,39 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
}else if (WebServiceConstant.CXHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 查询红字信息表
|
|
|
|
|
|
|
|
|
|
CxhzJsonDataTwoDTO cxhzJsonDataTwoDTO = null; |
|
|
|
|
try { |
|
|
|
|
String sendMsg = allApiLog.getSendMsg(); |
|
|
|
|
cxhzJsonDataTwoDTO= JSONObject.parseObject(sendMsg, CxhzTwoDTO.class).getJsonData(); |
|
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("反序列化失败异常",e); |
|
|
|
|
throw new JianshuiServiceException("起始日期反序列化失败"); |
|
|
|
|
} |
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put(ElephantConstants.YHJSLX,ElephantConstants.STRING_0); |
|
|
|
|
param.put(ElephantConstants.XSFNSRSBH,companyservice.getSellertax()); |
|
|
|
|
param.put(ElephantConstants.XSFMC,companyservice.getSellername()); |
|
|
|
|
param.put(ElephantConstants.LRFSF,ElephantConstants.STRING_0); |
|
|
|
|
param.put(ElephantConstants.LRRQQ,cxhzJsonDataTwoDTO.getKprqq()); |
|
|
|
|
param.put(ElephantConstants.LRRQZ,cxhzJsonDataTwoDTO.getKprqz()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HXResponse hxResponse = queryRedConfirmationList(param, companyservice); |
|
|
|
|
|
|
|
|
|
HZXXLIST hzxxlist = JSONObject.parseObject(JSONObject.toJSONString(hxResponse.getData()), HZXXLIST.class); |
|
|
|
|
|
|
|
|
|
return convertToJcData(hzxxlist); |
|
|
|
|
|
|
|
|
|
} else if (WebServiceConstant.SHHZFPXXQRD.equals(finalServiceId)) { |
|
|
|
|
// 审核红字信息表
|
|
|
|
|
LambdaQueryWrapper<Redinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(Redinfo::getFpqqlsh,requestId); |
|
|
|
|
queryWrapper.orderByDesc(Redinfo::getId).last("limit 1"); |
|
|
|
|
|
|
|
|
|
Redinfo redinfo = redinfoMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
|
|
return auditRedInfoResult(allApiLog.getResultMsg(),redinfo,companyservice); |
|
|
|
|
|
|
|
|
|
} else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) { |
|
|
|
|
// 获取发票下载地址
|
|
|
|
@ -2054,8 +2115,100 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public HXResponse queryRedInfoByElepant(Redinfo redinfo, Companyservice companyservice) { |
|
|
|
|
private HXResponse convertToJcData(HZXXLIST hzxxlist) { |
|
|
|
|
HZQRXXLIST hzqrxxlist = hzxxlist.getHZQRXXLIST(); |
|
|
|
|
List<Redinfo> redinfos = new ArrayList<>(hzqrxxlist.getTOTAL()); |
|
|
|
|
|
|
|
|
|
List<HZXXDATA> list = hzqrxxlist.getLIST(); |
|
|
|
|
|
|
|
|
|
for (HZXXDATA hzxxdata : list) { |
|
|
|
|
LambdaQueryWrapper<Redinfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(Redinfo::getRedInfoNo,hzxxdata.getHZFPXXQRDBH()); |
|
|
|
|
queryWrapper.orderByDesc(Redinfo::getId).last("limit 1"); |
|
|
|
|
//根据红字信息表编号查询红字信息
|
|
|
|
|
Redinfo redinfo = redinfoMapper.selectOne(queryWrapper); |
|
|
|
|
//不存在就创建对象
|
|
|
|
|
if (ObjectUtils.isEmpty(redinfo)){ |
|
|
|
|
redinfo = new Redinfo(); |
|
|
|
|
} |
|
|
|
|
redinfo.setRedInfoNo(hzxxdata.getHZFPXXQRDBH()); |
|
|
|
|
redinfo.setSellerTaxnum(hzxxdata.getXSFNSRSBH()); |
|
|
|
|
redinfo.setSellerName(hzxxdata.getXSFMC()); |
|
|
|
|
redinfo.setBuyerName(hzxxdata.getGMFMC()); |
|
|
|
|
redinfo.setBuyerTaxnum(hzxxdata.getGMFNSRSBH()); |
|
|
|
|
redinfo.setOriginFpdm(hzxxdata.getLZFPDM()); |
|
|
|
|
redinfo.setOriginFphm(hzxxdata.getLZFPHM()); |
|
|
|
|
redinfo.setOriginKprq(hzxxdata.getLZKPRQ()); |
|
|
|
|
redinfo.setReqnsrsbh(hzxxdata.getXSFNSRSBH()); |
|
|
|
|
redinfos.add(redinfo); |
|
|
|
|
//判断是否存在红字信息,存在执行更新
|
|
|
|
|
if (ObjectUtils.isEmpty(redinfo.getId())){ |
|
|
|
|
//处理发票表和红字信息表
|
|
|
|
|
redInfoAndInvoiceUpdate(hzxxdata, redinfo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new HXResponse("200","查询成功",redinfos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
|
public void redInfoAndInvoiceUpdate(HZXXDATA hzxxdata, Redinfo redinfo) { |
|
|
|
|
redinfoMapper.updateRedinfo(redinfo); |
|
|
|
|
QueryWrapper<Invoice> invoiceQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
invoiceQueryWrapper.eq("fphm", redinfo.getOriginFphm()); |
|
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
//更新蓝字发票状态为冲红 99
|
|
|
|
|
invoice.setState(99); |
|
|
|
|
invoiceMapper.updateInvoice(invoice); |
|
|
|
|
invoice.setId(null); |
|
|
|
|
invoice.setOriginFphm(invoice.getFphm()); |
|
|
|
|
invoice.setFphm(hzxxdata.getHZFPHM()); |
|
|
|
|
invoice.setBillInfoId(redinfo.getId()); |
|
|
|
|
invoice.setSystemOrderno(redinfo.getSystemOrderno()); |
|
|
|
|
invoice.setOutTradeOrderno(redinfo.getOutTradeOrderno()); |
|
|
|
|
invoice.setFpqqlsh(redinfo.getFpqqlsh()); |
|
|
|
|
invoice.setKprq(DateUtil.parse(hzxxdata.getHZKPRQ())); |
|
|
|
|
invoice.setState(2); |
|
|
|
|
invoiceMapper.insertInvoice(invoice); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private HXResponse auditRedInfoResult(String uuid,Redinfo redinfo, Companyservice companyservice) { |
|
|
|
|
if (ObjectUtils.isEmpty(companyservice)){ |
|
|
|
|
log.info("请求日志为空或者企业服务为空"); |
|
|
|
|
return new HXResponse("9998","请求日志为空或者企业服务为空"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isEmpty(redinfo)){ |
|
|
|
|
log.info("不存在该红字信息"); |
|
|
|
|
return new HXResponse("9998","不存在该红字信息"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(uuid)){ |
|
|
|
|
log.info("红字确认单UUID不能为空"); |
|
|
|
|
return new HXResponse("9998","红字确认单UUID不能为空"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put(ElephantConstants.NSRSBH,companyservice.getSellertax()); |
|
|
|
|
param.put(ElephantConstants.UUID,uuid); |
|
|
|
|
param.put(ElephantConstants.HZQRDBH,redinfo.getRedInfoNo()); |
|
|
|
|
param.put(ElephantConstants.QRLX,ElephantConstants.QRLX_Y); |
|
|
|
|
|
|
|
|
|
//调用大象接口获取确认日期
|
|
|
|
|
|
|
|
|
|
AjaxResult queryResult = null; |
|
|
|
|
try { |
|
|
|
|
queryResult = ElephantUtils.sendRequestWithoutTokenV6New(ElephantConstantsV6.QUERY_INVOICE_LOCALHOST, ElephantConstantsV6.QUERY_INVOICE_METHOD, JSONUtil.parse(param), companyservice); |
|
|
|
|
} catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) { |
|
|
|
|
log.error("【销项发票】【大象接口】【发票开具】发票请求异常,请求报文{},销方信息{}", param.toJSONString(), JSONObject.toJSONString(companyservice)); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
throw new JianshuiServiceException("系统异常!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new HXResponse(String.valueOf(queryResult.getCode()),queryResult.getMsg(),queryResult.getData()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public HXResponse queryRedInfoByElepant(Redinfo redinfo, Companyservice companyservice,InvoiceAllApiLog apiLog) { |
|
|
|
|
//返回信息
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(redinfo)){ |
|
|
|
@ -2067,10 +2220,9 @@ public class ElephantInvoiceApiV6ServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
//封装请求参数
|
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
|
param.put("NSRSBH",companyservice.getSellertax()); |
|
|
|
|
//TODO 上传红字信息表需要存入uuid
|
|
|
|
|
param.put("UUID",""); |
|
|
|
|
param.put("XSFNSRSBH",companyservice.getSellertax()); |
|
|
|
|
param.put(ElephantConstants.NSRSBH,companyservice.getSellertax()); |
|
|
|
|
param.put(ElephantConstants.UUID,apiLog.getResultMsg()); |
|
|
|
|
param.put(ElephantConstants.XSFNSRSBH,companyservice.getSellertax()); |
|
|
|
|
|
|
|
|
|
debugLog("红字信息表申请查询断点1",uuid,System.currentTimeMillis()); |
|
|
|
|
//调用大象接口查询红字信息表明细
|
|
|
|
@ -2097,6 +2249,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 +2286,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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|