liusheng
2 天以前 35c682a3a8030a8619da0a48fde28df21a883abf
代码提交
已添加1个文件
已修改4个文件
52 ■■■■■ 文件已修改
jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/convert/DateConvert.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-framework/jh-spring-boot-starter-excel/src/main/java/cn/lihu/jh/framework/excel/core/util/ExcelUtils.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/vo/AppointmentRespVO.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/appointment/AppointmentServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/appointment/AppointmentMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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));
    }
}
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()));
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;
}
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("申请单登记applyNo:{},状态status:{},更新结果:{}", applyNo, status, i);
    }
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>