From 36499b42c0fb8a3d0b768c8f60ff17aeaa886788 Mon Sep 17 00:00:00 2001 From: ieaii <1069385070@qq.com> Date: Fri, 10 Jan 2025 00:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=80=E4=B8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ClockinLogController.java | 92 ++++++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java index 53562fa..16a698a 100644 --- a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java @@ -1,12 +1,11 @@ package org.jeecg.modules.clockinlog.controller; +import java.io.*; import java.time.DayOfWeek; import java.time.LocalDateTime; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -16,19 +15,16 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; +import org.apache.http.HttpHeaders; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.DateUtils2; -import org.jeecg.common.util.ExcelStyleUtil; -import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.clockInproject.entity.ClockInProject; import org.jeecg.modules.clockInproject.service.IClockInProjectService; import org.jeecg.modules.clockinauth.entity.ClockinAuth; @@ -52,6 +48,7 @@ import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.entity.TemplateExportParams; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; @@ -59,6 +56,8 @@ import org.jeecg.common.system.base.controller.JeecgController; import org.jeecgframework.poi.excel.view.JeecgMapExcelView; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @@ -200,7 +199,7 @@ public class ClockinLogController extends JeecgController clazz, String title) { + protected Object exportXls3(HttpServletRequest request, Class clazz, String title) throws IOException { + // Step.1 组装查询条件 Map parameterMap = request.getParameterMap(); String[] clockStartTimes = parameterMap.get("clockStartTime"); @@ -390,10 +390,25 @@ public class ClockinLogController extends JeecgController> maps = new ArrayList<>(); Map map = new HashMap<>(); +// XSSFWorkbook workbook = new XSSFWorkbook(); +// XSSFSheet sheet = workbook.createSheet("打卡数据"); +// XSSFRow headRow = sheet.createRow(0); +// headRow.createCell(0).setCellValue("姓名"); +// headRow.createCell(1).setCellValue("性别"); +// headRow.createCell(2).setCellValue("数据"); List entity = new ArrayList(); ExcelExportEntity excelExportEntity = new ExcelExportEntity("姓名", "name"); excelExportEntity.setNeedMerge(true); @@ -465,7 +480,8 @@ public class ClockinLogController extends JeecgController clockInLogExpeort = clockinLogMapper.getClockInLogExpeort(yearMonthDay, clockInProject.getId(), clockinTeamLog.getUserId(),type); String clockInTime = ""; for (ClockInLogResp clockInLogResp:clockInLogExpeort) { @@ -476,6 +492,12 @@ public class ClockinLogController extends JeecgController map1 = new HashMap<>(); map1.put(n+"",clockInTime); maps1.add(map1); @@ -489,6 +511,24 @@ public class ClockinLogController extends JeecgController