From 1cb05e7a2065189b5de59934d89b6eb0a9b33e0d Mon Sep 17 00:00:00 2001 From: lzh Date: Mon, 16 Jan 2023 22:12:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=9C=A8=E9=80=94=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gdinstorage/GdInstorageCountService.java | 155 +++++++++++------- 1 file changed, 94 insertions(+), 61 deletions(-) diff --git a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java index e72df149..9462f8aa 100644 --- a/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java +++ b/yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinstorage/GdInstorageCountService.java @@ -28,6 +28,7 @@ package com.yxt.supervise.portal.biz.gdinstorage; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -110,37 +111,6 @@ public class GdInstorageCountService extends ServiceImpl> list1 = baseMapper.gysdhhzb(); - if (list1 == null || list1.isEmpty()) - return rb.setMsg("供应商到货汇总表 数据为空!"); - int size = list1.size(); - int countRow = size + 3; - double cbilltotalprice = 0, cprodvalue = 0, cwdhjz = 0, ccchjz = 0; - for (int y = 3; y < countRow; y++) { - Map map = list1.get(y - 3); - writer.writeCellValue(0, y, map.get("name")); - writer.writeCellValue(1, y, ""); - writer.writeCellValue(2, y, map.get("billtotalprice")); - cbilltotalprice = cbilltotalprice + ExcelTool.toDouble(map.get("billtotalprice")); - writer.writeCellValue(3, y, map.get("prodvalue")); - cprodvalue = cprodvalue + ExcelTool.toDouble(map.get("prodvalue")); - writer.writeCellValue(4, y, map.get("wdhjz")); - cwdhjz = cwdhjz + ExcelTool.toDouble(map.get("wdhjz")); - writer.writeCellValue(5, y, map.get("cchjz")); - ccchjz = ccchjz + ExcelTool.toDouble(map.get("cchjz")); - writer.writeCellValue(6, y, map.get("arrivaldate")); - writer.writeCellValue(7, y, map.get("sfyq")); - } - writer.writeCellValue(0, countRow, "合计"); - writer.writeCellValue(2, countRow, cbilltotalprice); - writer.writeCellValue(3, countRow, cprodvalue); - writer.writeCellValue(4, countRow, cwdhjz); - writer.writeCellValue(5, countRow, ccchjz); - // 商品到货明细表 writer.setSheet(1); writer.writeCellValue(0, 1, "编号:spdhmxb" + dfmt1); @@ -172,7 +142,7 @@ public class GdInstorageCountService extends ServiceImpl map = list4.get(y - 3); writer.writeCellValue(0, y, "市烟草"); @@ -230,7 +203,8 @@ public class GdInstorageCountService extends ServiceImpl> list5 = baseMapper.ycddmxb(); - if (list5 != null && !list5.isEmpty()) { - int size5 = list5.size(); - int countRow5 = size5 + 3; - xh = 0; - double cPrice = 0,cghje=0,cztje=0; - for (int y = 3; y < countRow5; y++) { - Map map = list5.get(y - 3); - xh++; - writer.writeCellValue(0, y, xh); - writer.writeCellValue(1, y, "市烟草"); - writer.writeCellValue(2, y, map.get("code")); - writer.writeCellValue(3, y, map.get("ddje")); - writer.writeCellValue(4, y, map.get("ddje")); - cPrice = cPrice + ExcelTool.toDouble(map.get("ddje")); - writer.writeCellValue(5, y, map.get("purchasedate")); - writer.writeCellValue(6, y, map.get("arrivaldate")); - writer.writeCellValue(7, y, map.get("dddhjz")); - cghje = cghje + ExcelTool.toDouble(map.get("dddhjz")); - writer.writeCellValue(8, y, map.get("zthjz")); - cztje = cztje + ExcelTool.toDouble(map.get("zthjz")); + // if (list5 != null && !list5.isEmpty()) { + int size5 = list5.size(); + int countRow5 = size5 + 3; + String maxDate = ""; + xh = 0; + double cPrice = 0, cghje = 0, cztje = 0; + for (int y = 3; y < countRow5; y++) { + Map map = list5.get(y - 3); + xh++; + writer.writeCellValue(0, y, xh); + writer.writeCellValue(1, y, "市烟草"); + writer.writeCellValue(2, y, map.get("code")); + writer.writeCellValue(3, y, map.get("ddje")); + writer.writeCellValue(4, y, map.get("ddje")); + cPrice = cPrice + ExcelTool.toDouble(map.get("ddje")); + writer.writeCellValue(5, y, map.get("purchasedate")); + writer.writeCellValue(6, y, map.get("arrivaldate")); + if (StrUtil.isBlank(maxDate)) { + maxDate = "" + map.get("arrivaldate"); + } else { + String ccDate = "" + map.get("arrivaldate"); + if (maxDate.compareTo(ccDate) < 0) { + maxDate = ccDate; + } } - writer.writeCellValue(1, countRow5, "合计金额"); - writer.writeCellValue(4, countRow5, cPrice); - writer.writeCellValue(7, countRow5, cghje); - writer.writeCellValue(8, countRow5, cztje); + writer.writeCellValue(7, y, map.get("dddhjz")); + cghje = cghje + ExcelTool.toDouble(map.get("dddhjz")); + writer.writeCellValue(8, y, map.get("zthjz")); + cztje = cztje + ExcelTool.toDouble(map.get("zthjz")); + } + // writer.writeCellValue(1, countRow5, "合计金额"); + writer.merge(countRow5, countRow5, 0, 2, "合计金额", false); + writer.writeCellValue(3, countRow5, ""); + writer.writeCellValue(4, countRow5, cPrice); + writer.writeCellValue(5, countRow5, ""); + writer.writeCellValue(6, countRow5, ""); + writer.writeCellValue(7, countRow5, cghje); + writer.writeCellValue(8, countRow5, cztje); + // } + + // 供应商到货汇总表 + writer.setSheet(0); + writer.writeCellValue(0, 1, "编号:gysdhhzb" + dfmt1); + writer.writeCellValue(2, 1, "上报时间:" + dfmt + " 11:00"); + List> list1 = baseMapper.gysdhhzb(); + if (list1 == null || list1.isEmpty()) + return rb.setMsg("供应商到货汇总表 数据为空!"); + int size = list1.size(); + int countRow = size + 3; + double cbilltotalprice = 0, cprodvalue = 0, cwdhjz = 0, ccchjz = 0; + for (int y = 3; y < countRow; y++) { + Map map = list1.get(y - 3); + writer.writeCellValue(0, y, map.get("name")); + writer.writeCellValue(1, y, ""); + writer.writeCellValue(2, y, map.get("billtotalprice")); + cbilltotalprice = cbilltotalprice + ExcelTool.toDouble(map.get("billtotalprice")); + writer.writeCellValue(3, y, map.get("prodvalue")); + cprodvalue = cprodvalue + ExcelTool.toDouble(map.get("prodvalue")); + writer.writeCellValue(4, y, map.get("wdhjz")); + cwdhjz = cwdhjz + ExcelTool.toDouble(map.get("wdhjz")); + writer.writeCellValue(5, y, map.get("cchjz")); + ccchjz = ccchjz + ExcelTool.toDouble(map.get("cchjz")); + writer.writeCellValue(6, y, map.get("arrivaldate")); + writer.writeCellValue(7, y, map.get("sfyq")); } + writer.writeCellValue(0, countRow, "市烟草"); + writer.writeCellValue(1, countRow, ""); + writer.writeCellValue(2, countRow, cPrice); + cbilltotalprice = cbilltotalprice + cPrice; + writer.writeCellValue(3, countRow, cghje); + cprodvalue = cprodvalue + cghje; + writer.writeCellValue(4, countRow, cwdhjz); + cwdhjz = cwdhjz + cztje; + writer.writeCellValue(5, countRow, "0.0"); + writer.writeCellValue(6, countRow, maxDate); + writer.writeCellValue(7, countRow, "否"); + + writer.writeCellValue(0, countRow + 1, "合计"); + writer.writeCellValue(1, countRow + 1, ""); + writer.writeCellValue(2, countRow + 1, cbilltotalprice); + writer.writeCellValue(3, countRow + 1, cprodvalue); + writer.writeCellValue(4, countRow + 1, cwdhjz); + writer.writeCellValue(5, countRow + 1, ccchjz); + writer.writeCellValue(6, countRow + 1, ""); + writer.writeCellValue(7, countRow + 1, ""); writer.flush(); writer.close(); @@ -288,9 +321,9 @@ public class GdInstorageCountService extends ServiceImpl> list = baseMapper.ycspdhmxb(); + List> list = baseMapper.ycddmxb(); for (Map map : list) { - wdhjz = wdhjz + ExcelTool.toDouble(map.get("ztprodValue1")); + wdhjz = wdhjz + ExcelTool.toDouble(map.get("zthjz")); } return wdhjz; }