|
|
@ -5,6 +5,7 @@ import java.util.Date; |
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONNull; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.Query; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.Query; |
|
|
|
import com.jianshui.common.utils.BeanToMapUtils; |
|
|
|
import com.jianshui.common.utils.BeanToMapUtils; |
|
|
|
import com.jianshui.invoice.domain.dto.api.*; |
|
|
|
import com.jianshui.invoice.domain.dto.api.*; |
|
|
@ -236,7 +237,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
addRedInvoiceDTO.setNsrsbh(queryDTO.getNsrsbh()); |
|
|
|
addRedInvoiceDTO.setNsrsbh(queryDTO.getNsrsbh()); |
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<Redinfo> redinfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<Redinfo> redinfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
redinfoQueryWrapper.eq("red_info_no",addRedInvoiceDTO.getHzfpxxqrdid()); |
|
|
|
redinfoQueryWrapper.eq("red_info_no", addRedInvoiceDTO.getHzfpxxqrdid()); |
|
|
|
Redinfo redinfo = redinfoMapper.selectOne(redinfoQueryWrapper); |
|
|
|
Redinfo redinfo = redinfoMapper.selectOne(redinfoQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
@ -723,7 +724,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
|
|
// 查询用户信息组装
|
|
|
|
// 查询用户信息组装
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
if(BeanUtil.isEmpty(yhdj)){ |
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -732,9 +733,9 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
fileAcquisitionDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
fileAcquisitionDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
fileAcquisitionDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
fileAcquisitionDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new JSONObject(); |
|
|
|
Map<String, Object> map = new JSONObject(); |
|
|
|
map.put("fphm",fileAcquisitionDTO.getFphm()); |
|
|
|
map.put("fphm", fileAcquisitionDTO.getFphm()); |
|
|
|
map.put("kprq",fileAcquisitionDTO.getKprq()); |
|
|
|
map.put("kprq", fileAcquisitionDTO.getKprq()); |
|
|
|
fileAcquisitionDTO.setJsonData(map); |
|
|
|
fileAcquisitionDTO.setJsonData(map); |
|
|
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(fileAcquisitionDTO); |
|
|
|
ValidateUtils.validate(fileAcquisitionDTO); |
|
|
@ -781,9 +782,21 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public HXResponse getFileAcquisitionOn(InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionOnTWODTO, Companyservice companyservice) { |
|
|
|
public HXResponse getFileAcquisitionOn(InvoiceAllFileAcquisitionOnTWODTO invoiceAllFileAcquisitionOnTWODTO, Companyservice companyservice) { |
|
|
|
FileAcquisitionOnTwoDTO fileAcquisitionOnDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO, FileAcquisitionOnTwoDTO.class); |
|
|
|
|
|
|
|
FileAcquisitionOnDetailTwoDTO fileAcquisitionOnDetailDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO.getJsonData(), FileAcquisitionOnDetailTwoDTO.class); |
|
|
|
FileAcquisitionOnTwoDTO fileAcquisitionOnDTO = new FileAcquisitionOnTwoDTO(); |
|
|
|
|
|
|
|
FileAcquisitionOnDetailTwoDTO fileAcquisitionOnDetailDTO = BeanUtil.copyProperties(invoiceAllFileAcquisitionOnTWODTO, FileAcquisitionOnDetailTwoDTO.class); |
|
|
|
fileAcquisitionOnDTO.setJsonData(fileAcquisitionOnDetailDTO); |
|
|
|
fileAcquisitionOnDTO.setJsonData(fileAcquisitionOnDetailDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询用户信息组装
|
|
|
|
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
|
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
|
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fileAcquisitionOnDTO.setAsync("true"); |
|
|
|
|
|
|
|
fileAcquisitionOnDTO.setNsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
|
|
|
fileAcquisitionOnDTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
|
|
|
fileAcquisitionOnDTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
|
|
|
|
|
|
|
ValidateUtils.validate(fileAcquisitionOnDTO); |
|
|
|
ValidateUtils.validate(fileAcquisitionOnDTO); |
|
|
|
ValidateUtils.validate(fileAcquisitionOnDetailDTO); |
|
|
|
ValidateUtils.validate(fileAcquisitionOnDetailDTO); |
|
|
|
|
|
|
|
|
|
|
@ -811,6 +824,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", JSONUtil.parse(data)); |
|
|
|
|
|
|
|
return response; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return new HXResponse(msg); |
|
|
|
return new HXResponse(msg); |
|
|
|
} |
|
|
|
} |
|
|
@ -820,9 +835,6 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
return new HXResponse("全电发票文件获取错误!"); |
|
|
|
return new HXResponse("全电发票文件获取错误!"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", result); |
|
|
|
|
|
|
|
return response; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -876,26 +888,65 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public HXResponse query(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
public HXResponse query(InvoiceAllFileQueryTWODTO invoiceAllFileQueryTWODTO, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileQueryTWODTO fileQueryTWODTO = new FileQueryTWODTO(); |
|
|
|
|
|
|
|
FileQueryJsonDataTWODTO fileQueryJsonDataTWODTO = BeanUtil.copyProperties(invoiceAllFileQueryTWODTO, FileQueryJsonDataTWODTO.class); |
|
|
|
|
|
|
|
fileQueryTWODTO.setJsondata(fileQueryJsonDataTWODTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询用户信息组装
|
|
|
|
|
|
|
|
InvoiceAllYhdj yhdj = getUserInfo(companyservice); |
|
|
|
|
|
|
|
if (BeanUtil.isEmpty(yhdj)) { |
|
|
|
|
|
|
|
return new HXResponse("未查询到登记信息!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fileQueryTWODTO.setDqbm(yhdj.getDqbm()); |
|
|
|
|
|
|
|
fileQueryTWODTO.setBsrysfzjhm(yhdj.getBsrysfzjhm()); |
|
|
|
|
|
|
|
fileQueryTWODTO.setNsrsbh(yhdj.getNsrsbh()); |
|
|
|
|
|
|
|
fileQueryTWODTO.setAsync("true"); |
|
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = ApiHttp.request(WebServiceConstant.QUERY, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
result = ApiHttp.request(WebServiceConstant.QUERY, WebServiceConstant.URL, fileQueryTWODTO, companyservice); |
|
|
|
// TODO: 2022/12/11 返回处理 VO整理,数据存储。
|
|
|
|
|
|
|
|
|
|
|
|
String code = result.get("code") != null ? result.get("code").toString() : ""; |
|
|
|
|
|
|
|
String msg = result.get("msg") != null ? result.get("msg").toString() : ""; |
|
|
|
|
|
|
|
String data = result.get("data") != null ? result.get("data").toString() : ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("0000".equals(code) && StrUtil.isNotEmpty(data)) { |
|
|
|
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
|
|
|
|
String requestId = json.getOrDefault("requestId", "").toString(); |
|
|
|
|
|
|
|
if (StrUtil.isEmpty(requestId)) { |
|
|
|
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
InvoiceAllApiLog allApiLog = new InvoiceAllApiLog(); |
|
|
|
|
|
|
|
allApiLog.setUrl(WebServiceConstant.QUERY); |
|
|
|
|
|
|
|
allApiLog.setSendMsg(fileQueryTWODTO.toString()); |
|
|
|
|
|
|
|
allApiLog.setResultMsg(JSONUtil.toJsonStr(result)); |
|
|
|
|
|
|
|
allApiLog.setCompany(companyservice.getSellertax()); |
|
|
|
|
|
|
|
allApiLog.setIdentityId(companyservice.getIdentity()); |
|
|
|
|
|
|
|
allApiLog.setRequestId(requestId); |
|
|
|
|
|
|
|
allApiLog.setCreateTime(new Date()); |
|
|
|
|
|
|
|
allApiLogMapper.insertInvoiceAllApiLog(allApiLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", JSONUtil.parse(data)); |
|
|
|
|
|
|
|
return response; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return new HXResponse(msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("【金四服务类】【金财数科】【获取二维码】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
log.error("【金四服务类】【金财数科】【单张发票查询】API请求异常,外部报文返回code非0000。错误信息:{}", e.getMessage()); |
|
|
|
return new HXResponse("发票查询错误"); |
|
|
|
return new HXResponse("发票查询错误"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO 处理日志
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HXResponse response = new HXResponse("0000", "同步成功", result); |
|
|
|
|
|
|
|
return response; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public HXResponse getPrintXML(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
public HXResponse getPrintXML(JSONObject decryptResult, Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
cn.hutool.json.JSONObject result = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = ApiHttp.request(WebServiceConstant.GET_PRINT_XML, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
|
result = ApiHttp.request(WebServiceConstant.GET_PRINT_XML, WebServiceConstant.URL, decryptResult, companyservice); |
|
|
@ -1248,8 +1299,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) { |
|
|
|
else if (WebServiceConstant.FPEWMXZ.equals(finalServiceId)) { |
|
|
|
|
|
|
|
// 获取发票下载地址
|
|
|
|
// 获取发票下载地址
|
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
cn.hutool.json.JSONObject json = JSONUtil.parseObj(data); |
|
|
|
String ewmUrl = json.getOrDefault("ewmUrl", "").toString(); |
|
|
|
String ewmUrl = json.getOrDefault("ewmUrl", "").toString(); |
|
|
@ -1268,8 +1318,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO: 2023/3/29 返回数据处理
|
|
|
|
// TODO: 2023/3/29 返回数据处理
|
|
|
|
response.put("data", JSONUtil.parse(data)); |
|
|
|
response.put("data", JSONUtil.parse(data)); |
|
|
|
} |
|
|
|
} else if (WebServiceConstant.ADD_RED_INVOICE.equals(finalServiceId)) { |
|
|
|
else if (WebServiceConstant.ADD_RED_INVOICE.equals(finalServiceId)) { |
|
|
|
|
|
|
|
// 查找原发票信息
|
|
|
|
// 查找原发票信息
|
|
|
|
AddRedInvoiceTWOVO addRedInvoiceVO = BeanUtil.copyProperties(data, AddRedInvoiceTWOVO.class); |
|
|
|
AddRedInvoiceTWOVO addRedInvoiceVO = BeanUtil.copyProperties(data, AddRedInvoiceTWOVO.class); |
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<BillInfo> billInfoQueryWrapper = new QueryWrapper<>(); |
|
|
@ -1307,8 +1356,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
|
|
response.put("data", invoice); |
|
|
|
response.put("data", invoice); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (WebServiceConstant.KSHC.equals(finalServiceId)) { |
|
|
|
else if (WebServiceConstant.KSHC.equals(finalServiceId)) { |
|
|
|
|
|
|
|
// 快速冲红
|
|
|
|
// 快速冲红
|
|
|
|
// TODO: 后期存库
|
|
|
|
// TODO: 后期存库
|
|
|
|
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
|
|
|
|
// KschVO kschVO = BeanUtil.copyProperties(data,KschVO.class);
|
|
|
@ -1347,7 +1395,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
Invoice invoice = invoiceMapper.selectOne(invoiceQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
AddRedInfoInvoiceJsonDataTWOVO addRedInfoInvoiceJsonDataTWOVO = addRedInfoInvoiceTWOVO.getHzfpxx(); |
|
|
|
AddRedInfoInvoiceJsonDataTWOVO addRedInfoInvoiceJsonDataTWOVO = addRedInfoInvoiceTWOVO.getHzfpxx(); |
|
|
|
if(BeanUtil.isNotEmpty(addRedInfoInvoiceJsonDataTWOVO)){ |
|
|
|
if (BeanUtil.isNotEmpty(addRedInfoInvoiceJsonDataTWOVO)) { |
|
|
|
|
|
|
|
|
|
|
|
//更新蓝字发票状态为冲红 99
|
|
|
|
//更新蓝字发票状态为冲红 99
|
|
|
|
invoice.setState(99); |
|
|
|
invoice.setState(99); |
|
|
@ -1381,8 +1429,8 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
|
|
|
|
|
|
|
|
response.put("data", addRedInfoInvoiceTWOVO); |
|
|
|
response.put("data", addRedInfoInvoiceTWOVO); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
response.put("data",JSONUtil.parse(data)); |
|
|
|
response.put("data", JSONUtil.parse(data)); |
|
|
|
} |
|
|
|
} |
|
|
|
return response; |
|
|
|
return response; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1460,7 +1508,7 @@ public class JcskInvoiceApiServiceImpl implements IInvoiceApiService { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 用户信息处理 |
|
|
|
* 用户信息处理 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public InvoiceAllYhdj getUserInfo(Companyservice companyservice){ |
|
|
|
public InvoiceAllYhdj getUserInfo(Companyservice companyservice) { |
|
|
|
|
|
|
|
|
|
|
|
// 查询用户登记参数
|
|
|
|
// 查询用户登记参数
|
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<InvoiceAllYhdj> yhdjQueryWrapper = new QueryWrapper<>(); |
|
|
|