From 35c682a3a8030a8619da0a48fde28df21a883abf Mon Sep 17 00:00:00 2001 From: liusheng <337615773@qq.com> Date: 星期五, 01 八月 2025 17:37:41 +0800 Subject: [PATCH] 代码提交 --- jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/convert/DateConvert.java | 39 +++++++++++++++++++++++++++++++++++++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java | 1 + jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java | 2 ++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java | 8 ++++++-- jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml | 2 +- 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/convert/DateConvert.java b/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/convert/DateConvert.java new file mode 100644 index 0000000..288f422 --- /dev/null +++ b/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/convert/DateConvert.java @@ -0,0 +1,39 @@ +package cn.lihu.jh.framework.excel.core.convert; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +import java.sql.Date; +import java.text.SimpleDateFormat; + +/** + * Excel Date 杞崲鍣� + * <p> + * 鏀寔 java.sql.Date 绫诲瀷鐨勮浆鎹� + */ +public class DateConvert implements Converter<Date> { + + @Override + public Class<?> supportJavaTypeKey() { + return Date.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + @Override + public WriteCellData<String> convertToExcelData(Date value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { + if (value == null) { + return new WriteCellData<>(""); + } + + // 浣跨敤榛樿鏍煎紡 yyyy-MM-dd HH:mm:ss + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return new WriteCellData<>(format.format(value)); + } +} diff --git a/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java b/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java index 5e08ffb..90035c1 100644 --- a/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java +++ b/jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java @@ -1,5 +1,6 @@ package cn.lihu.jh.framework.excel.core.util; +import cn.lihu.jh.framework.excel.core.convert.DateConvert; import cn.lihu.jh.framework.excel.core.handler.SelectSheetWriteHandler; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.converters.longconverter.LongStringConverter; @@ -38,6 +39,7 @@ .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // 鍩轰簬 column 闀垮害锛岃嚜鍔ㄩ�傞厤銆傛渶澶� 255 瀹藉害 .registerWriteHandler(new SelectSheetWriteHandler(head)) // 鍩轰簬鍥哄畾 sheet 瀹炵幇涓嬫媺妗� .registerConverter(new LongStringConverter()) // 閬垮厤 Long 绫诲瀷涓㈠け绮惧害 + .registerConverter(new DateConvert()) // 鏀寔 java.sql.Date 绫诲瀷杞崲 .sheet(sheetName).doWrite(data); // 璁剧疆 header 鍜� contentType銆傚啓鍦ㄦ渶鍚庣殑鍘熷洜鏄紝閬垮厤鎶ラ敊鏃讹紝鍝嶅簲 contentType 宸茬粡琚慨鏀逛簡 response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, StandardCharsets.UTF_8.name())); diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java index 8471dcd..c14ace3 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java @@ -166,6 +166,7 @@ /** * 寮�鍗曟椂闂� */ + @ExcelProperty("寮�鍗曟椂闂�") private Date doctorTime; } diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java index 42497c2..c34c8cd 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java @@ -707,9 +707,13 @@ Map<String, Object> processStep = (Map<String, Object>) component1.get("processStep"); Map<String, Object> codeMap = (Map<String, Object>) processStep.get("code"); String status = String.valueOf(codeMap.get("code")); - + Date date = null; + if (status.equals("3")) { + //璁板綍鐧昏鏃堕棿 + date = new Date(); + } //鐘舵�佹洿鏂� - Integer i = appointmentMapper.updateStatusByApplyNo(applyNo, status, null); + Integer i = appointmentMapper.updateStatusByApplyNo(applyNo, status, date); log.info("鐢宠鍗曠櫥璁癮pplyNo:{},鐘舵�乻tatus:{},鏇存柊缁撴灉锛歿}", applyNo, status, i); } diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml index 2c8f90d..69f0e7f 100644 --- a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml @@ -11,7 +11,7 @@ <update id="updateStatusByApplyNo"> update lihu.appointment - set status = #{status} + set status = #{status},update_time=sysdate() <if test="registerDate != null"> , register_date = #{registerDate} </if> -- Gitblit v1.9.3