ariesy 解决进项增值税导出问题

release
yefei 2 years ago
parent 1bfdae3bb4
commit ceb844262e
  1. 36
      dxhy-core/src/main/java/com/dxhy/core/thread/PoolAddTaxThread.java

@ -66,16 +66,16 @@ public class PoolAddTaxThread extends BaseThread {
* 导出excel的列名
*/
private final String[] titleColumns = {"序号", "发票类型", "发票代码", "发票号码", "发票状态", "开票日期", "销方名称", "销方税号", "金额", "税额",
"有效税额", "价税合计", "认证状态", "认证类型", "认证日期", "认证方式", "认证人", "采集状态", "底账库采集时间", "采集来源", "签收方式", "签收状态", "签收日期", "签收人",
"有效税额", "价税合计", "认证状态", "认证类型", "认证日期", "认证方式", "认证人", "采集状态", "底账库采集时间", "采集来源", "签收方式", "签收状态", "签收日期", "签收人",
"入账月份", "入账状态", "凭证号", "是否末次摊销", "摊销金额", "剩余金额", "业务单号", "入池时间","凭证号","过账时间","账期","影像id"};
/**
* 导出excel的列名
*/
private final String[] detailTitleColumns =
{"序号", "发票代码", "发票号码", "货物或应税劳务名称", "规格型号", "单位", "数量", "单价", "金额", "税额", "税率", "车牌号", "类型", "通行日期起", "通行日期止"};
{"序号", "发票代码", "发票号码", "货物或应税劳务名称", "规格型号", "单位", "数量", "单价", "金额", "税额", "税率", "车牌号", "类型", "通行日期起", "通行日期止"};
// private Sheet sheet;
// private Sheet sheet;
// private Table table;
private WriteSheet writeSheet;
private WriteTable writeTable;
@ -95,8 +95,8 @@ public class PoolAddTaxThread extends BaseThread {
private final TabulateRedisServiceImpl tabulateRedisService;
public PoolAddTaxThread(IExcelExportlogService exportLogService, List<TDxExcelExportlog> exportLogs,
PoolPaperService poolPaperService, FileService fileService, Sender sender, IFeginWebsocket feginWebsocket,
TabulateRedisServiceImpl tabulateRedisService) {
PoolPaperService poolPaperService, FileService fileService, Sender sender, IFeginWebsocket feginWebsocket,
TabulateRedisServiceImpl tabulateRedisService) {
this.exportLogService = exportLogService;
this.exportLogs = exportLogs;
this.poolPaperService = poolPaperService;
@ -164,7 +164,7 @@ public class PoolAddTaxThread extends BaseThread {
}
if (prams.get("kpksrq") != null && !"".equals(prams.get("kpksrq"))) {
pramsMap.put("kpksrq",
DateUtils.getMorning(DateUtils.strToDate(prams.get("kpksrq").toString())));
DateUtils.getMorning(DateUtils.strToDate(prams.get("kpksrq").toString())));
}
if (prams.get("kpjsrq") != null && !"".equals(prams.get("kpjsrq"))) {
pramsMap.put("kpjsrq", DateUtils.getNight(DateUtils.strToDate(prams.get("kpjsrq").toString())));
@ -180,7 +180,7 @@ public class PoolAddTaxThread extends BaseThread {
pramsMap.put("qsyf", prams.get("qsyf"));
}
if (prams.get("inAccountMonth") == null && "".equals(prams.get("inAccountMonth"))
&& !"1".equals(prams.get("inAccountStatus"))) {
&& !"1".equals(prams.get("inAccountStatus"))) {
pramsMap.put("inAccountMonth", "");
}else {
pramsMap.put("inAccountMonth", inAccountMonth);
@ -197,7 +197,6 @@ public class PoolAddTaxThread extends BaseThread {
pramsMap.put("inAccountStatus", inAccountStatus);
pramsMap.put("company", company);
pramsMap.put("invoiceSource",prams.getString("invoiceSource"));
log.info("传入的参数为:{}",pramsMap);
// 导出文件名
StringBuilder ftpFileName = new StringBuilder();
ftpFileName.append(fileNamePrefix);
@ -225,7 +224,6 @@ public class PoolAddTaxThread extends BaseThread {
StringBuilder excelFile = new StringBuilder();
excelFile.append(fileService.getLocalPathDefault());
excelFile.append(ftpFileName.toString());
log.info("导出的文件名字为:{}",excelFile.toString());
File filePath = new File(getFilePath(excelFile.toString()));
if (!filePath.exists()) {
filePath.mkdirs();
@ -247,12 +245,12 @@ public class PoolAddTaxThread extends BaseThread {
// 递归导出数据到excel 发票信息
this.cicleExport(pramsMap, default_curr, excelFile.toString(), out, writer);
// this.detailCicleExport(pramsMap, default_curr, excelFile.toString(), out, writer);
// writer.finish();
this.detailCicleExport(pramsMap, default_curr, excelFile.toString(), out, writer);
writer.finish();
// FTP文件存储路径
String[] toDay = DateUtil.today().split("-");
String ftpFilePath = fileService.getPathPrefix() + userName + "/" + "excelFile/" + toDay[0] + "/"
+ toDay[1] + "/" + toDay[2] + "/" + ftpFileName.toString();
+ toDay[1] + "/" + toDay[2] + "/" + ftpFileName.toString();
// 文件上传ftp
fileService.uploadFile(ftpFilePath, excelFile.toString());
@ -277,7 +275,6 @@ public class PoolAddTaxThread extends BaseThread {
// 记录导出出错状态
exportLogService.updateFail(id, errmsg, dbName);
} finally {
writer.finish();
// 发送导出消息到mq
String responseResult = JsonResponseUtils.responseResult(msg);
sender.sendToMsg(responseResult);
@ -303,7 +300,7 @@ public class PoolAddTaxThread extends BaseThread {
*/
private boolean cicleExport(Map<String, Object> pramsMap, int curr, String excelFile, OutputStream out,
ExcelWriter writer) throws Exception {
ExcelWriter writer) throws Exception {
// 查询指定页数的数据
JSONObject pageData = poolPaperService.listAddTaxInvoice(pramsMap, curr, default_size);
boolean hasNext = pageData.getBooleanValue("hasNext");
@ -343,7 +340,7 @@ public class PoolAddTaxThread extends BaseThread {
*/
private boolean detailCicleExport(Map<String, Object> pramsMap, int curr, String excelFile, OutputStream out,
ExcelWriter writer) throws Exception {
ExcelWriter writer) throws Exception {
// 查询指定页数的数据
JSONObject pageData = poolPaperService.listAddTaxInvoiceDetail(pramsMap, curr, default_size);
boolean hasNext = pageData.getBooleanValue("hasNext");
@ -358,20 +355,20 @@ public class PoolAddTaxThread extends BaseThread {
int nextPage = pageData.getIntValue("nextPage");
// 写入当前页数据
exportListArrayToExcel(excelFile, title, detailTitleColumns, dataList, firstPage, false, 2, "货物信息", out,
writer);
writer);
// 更新页数
return detailCicleExport(pramsMap, nextPage, excelFile, out, writer);
} else {
// 写入最后一页数据
exportListArrayToExcel(excelFile, title, detailTitleColumns, dataList, firstPage, true, 2, "货物信息", out,
writer);
writer);
return hasNext;
}
}
public void exportListArrayToExcel(String excelFile, String title, String[] titleColumns, List<String[]> dataList,
boolean firstPage, boolean lastPage, int sheetNo, String sheetName, OutputStream out, ExcelWriter writer) {
boolean firstPage, boolean lastPage, int sheetNo, String sheetName, OutputStream out, ExcelWriter writer) {
String[] datas;
if (firstPage) {
@ -388,9 +385,8 @@ public class PoolAddTaxThread extends BaseThread {
String titleColumn = datas[var12];
titles.add(Collections.singletonList(titleColumn));
}
log.info("导出文件的标头为:{}",titles);
writeTable.setHead(titles);
writeTable.setHead(titles);
List<List<String>> list = new ArrayList<>();
for (String[] strings : dataList) {

Loading…
Cancel
Save