diff --git a/pom.xml b/pom.xml
index 14a5f6d..34197b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.imyeyu.timiserverapi
TimiServerAPI
- 1.0.60
+ 1.0.61
jar
TimiServerAPI
imyeyu.com API
diff --git a/src/main/java/com/imyeyu/api/modules/gao/bean/GaoPermissionCode.java b/src/main/java/com/imyeyu/api/modules/gao/bean/GaoPermissionCode.java
index 8c46da7..4a8bb47 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/bean/GaoPermissionCode.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/bean/GaoPermissionCode.java
@@ -15,8 +15,6 @@ public enum GaoPermissionCode implements BuiltinPermissionCode {
STORE_READ("STORE:READ", "门店读取", true, true),
- STORE_EXPORT("STORE:EXPORT", "门店导出", false, true),
-
STORE_UPDATE("STORE:UPDATE", "门店修改", true, true),
STORE_DELETE("STORE:DELETE", "门店删除", false, true),
@@ -33,8 +31,6 @@ public enum GaoPermissionCode implements BuiltinPermissionCode {
CUSTOMER_READ("CUSTOMER:READ", "客户读取", false, false),
- CUSTOMER_EXPORT("CUSTOMER:EXPORT", "客户导出", true, false),
-
CUSTOMER_UPDATE("CUSTOMER:UPDATE", "客户修改", false, false),
CUSTOMER_DELETE("CUSTOMER:DELETE", "客户删除", false, false),
@@ -63,8 +59,6 @@ public enum GaoPermissionCode implements BuiltinPermissionCode {
EVENT_RECORD_VERIFY("EVENT_RECORD:VERIFY", "登记事件核销", true, false),
- EVENT_RECORD_EXPORT("EVENT_RECORD:EXPORT", "登记事件记录导出", true, false),
-
EVENT_RECORD_UPDATE("EVENT_RECORD:UPDATE", "登记事件记录修改", false, false),
EVENT_RECORD_DELETE("EVENT_RECORD:DELETE", "登记事件记录删除", false, false),
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
index d78990f..2207d2f 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoCustomerController.java
@@ -15,16 +15,10 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerTrendStateReq;
import com.imyeyu.api.modules.user.service.UserService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiException;
-import com.imyeyu.network.Network;
-import com.imyeyu.spring.TimiSpring;
import com.imyeyu.spring.annotation.AOPLog;
-import com.imyeyu.spring.annotation.IgnoreGlobalReturn;
import com.imyeyu.spring.annotation.RequestRateLimit;
-import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.util.ResponseView;
-import com.imyeyu.utils.Time;
-import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -32,7 +26,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -166,25 +159,6 @@ public class GaoCustomerController {
return customer;
}
- @AOPLog
- @RequestRateLimit
- @IgnoreGlobalReturn
- @RequireGaoPermission(GaoPermissionCode.CUSTOMER_EXPORT)
- @PostMapping("/export")
- public void export(@RequestBody Page page) throws IOException {
- TimiException.required(page, "not found page");
- if (!storeScopeService.hasGlobalScope()) {
- GaoCustomer example = TimiJava.defaultIfNull(page.getEqualsExample(), new GaoCustomer());
- example.setStoreId(storeScopeService.resolveStoreId(example.getStoreId()));
- page.setEqualsExample(example);
- }
- HttpServletResponse resp = TimiSpring.getResponse();
- String contentDisposition = Network.getFileDownloadHeader("客户列表-%s.xlsx".formatted(Time.serialize.format(Time.now())));
- resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- resp.setHeader("Content-Disposition", contentDisposition);
- resp.getOutputStream().write(service.export(page));
- }
-
@AOPLog
@RequestRateLimit
@RequireGaoPermission(GaoPermissionCode.CUSTOMER_READ)
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoEventRecordController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoEventRecordController.java
index 4e066da..cc64e50 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoEventRecordController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoEventRecordController.java
@@ -20,15 +20,10 @@ import com.imyeyu.api.modules.gao.vo.GaoEventRecordRankPage;
import com.imyeyu.api.modules.user.service.UserService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiException;
-import com.imyeyu.network.Network;
-import com.imyeyu.spring.TimiSpring;
import com.imyeyu.spring.annotation.AOPLog;
-import com.imyeyu.spring.annotation.IgnoreGlobalReturn;
import com.imyeyu.spring.annotation.RequestRateLimit;
import com.imyeyu.spring.bean.PageResult;
import com.imyeyu.spring.util.ResponseView;
-import com.imyeyu.utils.Time;
-import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -36,7 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -200,21 +194,6 @@ public class GaoEventRecordController {
service.delete(id);
}
- @AOPLog
- @RequestRateLimit
- @IgnoreGlobalReturn
- @RequireGaoPermission(GaoPermissionCode.EVENT_RECORD_EXPORT)
- @PostMapping("/export")
- public void export(@RequestBody GaoEventRecordPage page) throws IOException {
- TimiException.required(page, "not found page");
- page.setStoreId(storeScopeService.resolveStoreId(page.getStoreId()));
- HttpServletResponse resp = TimiSpring.getResponse();
- String contentDisposition = Network.getFileDownloadHeader("登记事件记录-%s.xlsx".formatted(Time.serialize.format(Time.now())));
- resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- resp.setHeader("Content-Disposition", contentDisposition);
- resp.getOutputStream().write(service.export(page));
- }
-
/// 按时间范围查询客户登记排行榜
@AOPLog
@RequestRateLimit
diff --git a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoStoreController.java b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoStoreController.java
index bf1086d..cf691a2 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/controller/GaoStoreController.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/controller/GaoStoreController.java
@@ -9,15 +9,10 @@ import com.imyeyu.api.modules.gao.service.GaoStoreService;
import com.imyeyu.api.modules.user.service.UserLoginService;
import com.imyeyu.java.TimiJava;
import com.imyeyu.java.bean.timi.TimiException;
-import com.imyeyu.network.Network;
-import com.imyeyu.spring.TimiSpring;
import com.imyeyu.spring.annotation.AOPLog;
-import com.imyeyu.spring.annotation.IgnoreGlobalReturn;
import com.imyeyu.spring.annotation.RequestRateLimit;
import com.imyeyu.spring.bean.Page;
import com.imyeyu.spring.bean.PageResult;
-import com.imyeyu.utils.Time;
-import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -25,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import java.io.IOException;
import java.util.List;
/// GAO 门店接口
@@ -116,25 +110,6 @@ public class GaoStoreController {
service.sort(idList);
}
- @AOPLog
- @RequestRateLimit
- @IgnoreGlobalReturn
- @RequireGaoPermission(GaoPermissionCode.STORE_EXPORT)
- @PostMapping("/export")
- public void export(@RequestBody Page page) throws IOException {
- TimiException.required(page, "not found page");
- if (!storeScopeService.hasGlobalScope()) {
- GaoStore example = TimiJava.defaultIfNull(page.getEqualsExample(), new GaoStore());
- example.setId(storeScopeService.resolveStoreId(example.getId()));
- page.setEqualsExample(example);
- }
- HttpServletResponse resp = TimiSpring.getResponse();
- String contentDisposition = Network.getFileDownloadHeader("门店列表-%s.xlsx".formatted(Time.serialize.format(Time.now())));
- resp.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- resp.setHeader("Content-Disposition", contentDisposition);
- resp.getOutputStream().write(service.export(page));
- }
-
@AOPLog
@RequestRateLimit
@PostMapping("/user")
diff --git a/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportColumnName.java b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportColumnName.java
new file mode 100644
index 0000000..1a05894
--- /dev/null
+++ b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportColumnName.java
@@ -0,0 +1,255 @@
+package com.imyeyu.api.modules.gao.export;
+
+import java.util.Map;
+
+///
+/// GAO 数据导出列中文名称
+///
+/// @author Codex
+/// @since 2026-10-25
+public final class GaoDataExportColumnName {
+
+ private static final Map NAME_MAP = Map.ofEntries(
+ Map.entry("id", "ID"),
+ Map.entry("store_id", "门店 ID"),
+ Map.entry("created_at", "创建时间"),
+ Map.entry("updated_at", "修改时间"),
+ Map.entry("deleted_at", "删除时间"),
+ Map.entry("task_id", "任务 ID"),
+ Map.entry("include_attachment", "包含附件"),
+ Map.entry("all_time", "全部时间"),
+ Map.entry("begin_date", "开始日期"),
+ Map.entry("end_date", "结束日期"),
+ Map.entry("module", "导出模块"),
+ Map.entry("record_count", "记录数"),
+ Map.entry("attachment_count", "附件数"),
+ Map.entry("business_estimate_size", "业务数据预估大小"),
+ Map.entry("attachment_size", "附件预估大小"),
+ Map.entry("estimate_size", "预估总大小"),
+ Map.entry("biz_id", "业务 ID"),
+ Map.entry("attachment_id", "附件 ID"),
+ Map.entry("name", "名称"),
+ Map.entry("mime_type", "文件类型"),
+ Map.entry("size", "文件大小"),
+ Map.entry("zip_path", "压缩包路径"),
+ Map.entry("code", "编码"),
+ Map.entry("name_pinyin_full", "姓名全拼"),
+ Map.entry("name_pinyin_initial", "姓名首字母"),
+ Map.entry("name_pinyin_mixed", "姓名拼音"),
+ Map.entry("gender", "性别"),
+ Map.entry("age", "年龄"),
+ Map.entry("birthdate", "出生日期"),
+ Map.entry("birthdate_calendar", "出生历法"),
+ Map.entry("telephone", "电话"),
+ Map.entry("address", "住址"),
+ Map.entry("remark", "备注"),
+ Map.entry("disease", "病症"),
+ Map.entry("conditioning_part", "调理部位"),
+ Map.entry("introducer_customer_id", "介绍人客户 ID"),
+ Map.entry("introducer_customer_name", "介绍人客户名称"),
+ Map.entry("invited_count", "邀请客户数"),
+ Map.entry("creator_user_id", "录入用户 ID"),
+ Map.entry("creator_user_name", "录入用户名称"),
+ Map.entry("customer_id", "客户 ID"),
+ Map.entry("customer_name", "客户名称"),
+ Map.entry("source_type", "来源类型"),
+ Map.entry("source_id", "来源 ID"),
+ Map.entry("sales_order_id", "销售订单 ID"),
+ Map.entry("sales_order_no", "销售订单号"),
+ Map.entry("order_type", "订单类型"),
+ Map.entry("amount", "金额"),
+ Map.entry("effective_at", "生效时间"),
+ Map.entry("status", "状态"),
+ Map.entry("revoked_at", "撤销时间"),
+ Map.entry("revoke_reason", "撤销原因"),
+ Map.entry("source_payload", "来源快照"),
+ Map.entry("responsible_user_id", "负责人用户 ID"),
+ Map.entry("responsible_user_name", "负责人用户名称"),
+ Map.entry("content", "内容"),
+ Map.entry("remind_at", "提醒时间"),
+ Map.entry("internal_notify_enabled", "启用站内通知"),
+ Map.entry("sms_notify_enabled", "启用短信通知"),
+ Map.entry("internal_notify_detail_id", "站内通知详情 ID"),
+ Map.entry("sms_notify_detail_id", "短信通知详情 ID"),
+ Map.entry("completed_by", "完成人用户 ID"),
+ Map.entry("completed_by_name", "完成人用户名称"),
+ Map.entry("completed_at", "完成时间"),
+ Map.entry("created_by", "创建人用户 ID"),
+ Map.entry("created_by_name", "创建人用户名称"),
+ Map.entry("updated_by", "修改人用户 ID"),
+ Map.entry("updated_by_name", "修改人用户名称"),
+ Map.entry("package_config_id", "套餐配置 ID"),
+ Map.entry("package_name_snapshot", "套餐名称快照"),
+ Map.entry("standard_amount_snapshot", "标准金额快照"),
+ Map.entry("event_id", "事件 ID"),
+ Map.entry("event_name", "事件名称"),
+ Map.entry("operator_user_id", "操作用户 ID"),
+ Map.entry("operator_user_name", "操作用户名称"),
+ Map.entry("point_value", "提交积分值"),
+ Map.entry("earned_point_value", "获得积分值"),
+ Map.entry("number_value", "业务数值"),
+ Map.entry("verification_status", "核销状态"),
+ Map.entry("verifier_user_id", "核销用户 ID"),
+ Map.entry("verifier_user_name", "核销用户名称"),
+ Map.entry("verified_at", "核销时间"),
+ Map.entry("registered_at", "登记时间"),
+ Map.entry("registered_date_value", "登记日期"),
+ Map.entry("business_day_no", "营业日序号"),
+ Map.entry("event_record_id", "事件登记 ID"),
+ Map.entry("group_id", "选项组 ID"),
+ Map.entry("option_id", "选项 ID"),
+ Map.entry("group_sort", "选项组排序"),
+ Map.entry("option_sort", "选项排序"),
+ Map.entry("group_name_snapshot", "选项组名称快照"),
+ Map.entry("option_label_snapshot", "选项名称快照"),
+ Map.entry("order_no", "订单号"),
+ Map.entry("payment_status", "付款状态"),
+ Map.entry("refund_status", "退款状态"),
+ Map.entry("sale_amount", "成交金额"),
+ Map.entry("pending_paid_amount", "待核销收款"),
+ Map.entry("paid_amount", "有效收款"),
+ Map.entry("paid_at", "首次全额实收时间"),
+ Map.entry("refunded_amount", "有效退款"),
+ Map.entry("source_event_record_id", "来源事件登记 ID"),
+ Map.entry("request_no", "幂等请求号"),
+ Map.entry("purchased_at", "下单时间"),
+ Map.entry("cancelled_at", "取消时间"),
+ Map.entry("cancel_operator_user_id", "取消操作用户 ID"),
+ Map.entry("cancel_operator_user_name", "取消操作用户名称"),
+ Map.entry("cancel_reason", "取消原因"),
+ Map.entry("sales_order_item_id", "销售订单明细 ID"),
+ Map.entry("item_type", "明细类型"),
+ Map.entry("gifted", "赠送权益"),
+ Map.entry("sku_id", "SKU ID"),
+ Map.entry("sku_name", "SKU 名称"),
+ Map.entry("sku_unit_id", "SKU 单位 ID"),
+ Map.entry("product_name_snapshot", "产品名称快照"),
+ Map.entry("product_id_snapshot", "产品 ID 快照"),
+ Map.entry("sku_code_snapshot", "SKU 编码快照"),
+ Map.entry("sku_name_snapshot", "SKU 名称快照"),
+ Map.entry("spec_summary_snapshot", "规格摘要快照"),
+ Map.entry("sku_spec_snapshot", "SKU 规格快照"),
+ Map.entry("unit_snapshot", "单位快照"),
+ Map.entry("base_quantity_per_unit_snapshot", "单位基础数量快照"),
+ Map.entry("quantity", "业务数量"),
+ Map.entry("base_quantity", "基础数量"),
+ Map.entry("reserved_base_quantity", "待履约基础数量"),
+ Map.entry("fulfilled_base_quantity", "已履约基础数量"),
+ Map.entry("unit_price", "实际单价"),
+ Map.entry("line_amount", "行金额"),
+ Map.entry("sort", "排序值"),
+ Map.entry("fulfillment_id", "履约单 ID"),
+ Map.entry("delivered_at", "履约时间"),
+ Map.entry("source_fulfillment_id", "来源履约单 ID"),
+ Map.entry("reason", "原因"),
+ Map.entry("source_order_item_id", "来源订单明细 ID"),
+ Map.entry("reserved_base_before", "变更前待履约基础数量"),
+ Map.entry("reserved_base_after", "变更后待履约基础数量"),
+ Map.entry("fulfilled_base_before", "变更前已履约基础数量"),
+ Map.entry("fulfilled_base_after", "变更后已履约基础数量"),
+ Map.entry("biz_type", "业务类型"),
+ Map.entry("operation_type", "操作类型"),
+ Map.entry("source_record_id", "来源流水 ID"),
+ Map.entry("occurred_at", "发生时间"),
+ Map.entry("sales_order_unpaid_amount_snapshot", "订单未收金额快照"),
+ Map.entry("account_id", "积分账户 ID"),
+ Map.entry("balance", "可用积分余额"),
+ Map.entry("total_earned", "累计获得积分"),
+ Map.entry("total_consumed", "累计消耗积分"),
+ Map.entry("total_revoked", "累计撤销积分"),
+ Map.entry("total_adjusted", "累计人工调整积分"),
+ Map.entry("version", "版本号"),
+ Map.entry("change_type", "变化类型"),
+ Map.entry("direction", "变化方向"),
+ Map.entry("point_delta", "积分变化值"),
+ Map.entry("balance_before", "变更前积分余额"),
+ Map.entry("balance_after", "变更后积分余额"),
+ Map.entry("rule_id", "积分规则 ID"),
+ Map.entry("trigger_source_type", "触发来源类型"),
+ Map.entry("trigger_source_id", "触发来源 ID"),
+ Map.entry("groovy_script_version_id", "脚本版本 ID"),
+ Map.entry("rule_snapshot", "规则快照"),
+ Map.entry("idempotency_key", "幂等键"),
+ Map.entry("point_ledger_id", "积分流水 ID"),
+ Map.entry("consumption_record_id", "消费记录 ID"),
+ Map.entry("redemption_id", "兑换单 ID"),
+ Map.entry("redeem_sku_id_snapshot", "兑换配置 ID 快照"),
+ Map.entry("product_type_snapshot", "产品类型快照"),
+ Map.entry("sku_id_snapshot", "SKU ID 快照"),
+ Map.entry("sku_unit_id_snapshot", "SKU 单位 ID 快照"),
+ Map.entry("allow_decimal_quantity_snapshot", "允许小数数量快照"),
+ Map.entry("default_point_cost", "默认积分消耗"),
+ Map.entry("actual_point_cost", "实际积分消耗"),
+ Map.entry("returned_quantity", "累计退货数量"),
+ Map.entry("returned_point_cost", "累计返还积分"),
+ Map.entry("redeemed_at", "兑换时间"),
+ Map.entry("stock_record_id", "库存流水 ID"),
+ Map.entry("returned_at", "退货时间"),
+ Map.entry("date_value", "营业日期"),
+ Map.entry("title", "标题"),
+ Map.entry("description", "描述"),
+ Map.entry("content_type", "正文类型"),
+ Map.entry("reads", "阅读数"),
+ Map.entry("likes", "点赞数"),
+ Map.entry("product_id", "产品 ID"),
+ Map.entry("product_name", "产品名称"),
+ Map.entry("on_hand_delta", "实际库存变化"),
+ Map.entry("reserved_delta", "预占库存变化"),
+ Map.entry("on_hand_before", "变更前实际库存"),
+ Map.entry("on_hand_after", "变更后实际库存"),
+ Map.entry("reserved_before", "变更前预占库存"),
+ Map.entry("reserved_after", "变更后预占库存"),
+ Map.entry("提示", "提示")
+ );
+ private static final Map DISPLAY_COLUMN_MAP = Map.ofEntries(
+ Map.entry("customer_id", "customer_name"),
+ Map.entry("introducer_customer_id", "introducer_customer_name"),
+ Map.entry("creator_user_id", "creator_user_name"),
+ Map.entry("responsible_user_id", "responsible_user_name"),
+ Map.entry("operator_user_id", "operator_user_name"),
+ Map.entry("verifier_user_id", "verifier_user_name"),
+ Map.entry("cancel_operator_user_id", "cancel_operator_user_name"),
+ Map.entry("completed_by", "completed_by_name"),
+ Map.entry("created_by", "created_by_name"),
+ Map.entry("updated_by", "updated_by_name"),
+ Map.entry("event_id", "event_name"),
+ Map.entry("sales_order_id", "sales_order_no"),
+ Map.entry("product_id", "product_name"),
+ Map.entry("sku_id", "sku_name")
+ );
+
+ private GaoDataExportColumnName() {
+ }
+
+ /// 获取列中文名称
+ ///
+ /// @param columnName 数据库列名
+ /// @return 中文名称,未定义时保留原列名
+ public static String resolve(String columnName) {
+ return NAME_MAP.getOrDefault(columnName, columnName);
+ }
+
+ /// 判断是否为标识符字段
+ ///
+ /// @param columnName 数据库列名
+ /// @return `true` 为标识符字段
+ public static boolean isIdColumn(String columnName) {
+ return "id".equals(columnName) || columnName.contains("_id") || columnName.endsWith("_by");
+ }
+
+ /// 获取关联记录显示字段
+ ///
+ /// @param idColumn 关联 ID 字段
+ /// @return 显示字段,不需要时返回 `null`
+ public static String getDisplayColumn(String idColumn) {
+ return DISPLAY_COLUMN_MAP.get(idColumn);
+ }
+
+ /// 判断是否为关联记录显示字段
+ ///
+ /// @param columnName 数据库列名
+ /// @return `true` 为关联记录显示字段
+ public static boolean isDisplayColumn(String columnName) {
+ return DISPLAY_COLUMN_MAP.containsValue(columnName);
+ }
+}
diff --git a/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportDefinition.java b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportDefinition.java
index 169abbf..e1e6b78 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportDefinition.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportDefinition.java
@@ -22,7 +22,7 @@ public enum GaoDataExportDefinition {
List.of(), List.of()),
CUSTOMER_FOLLOW_UP_REMINDER(GaoDataExportModule.CUSTOMER_FOLLOW_UP_REMINDER, "gao_customer_follow_up_reminder", "store_id", null, "remind_at", false, true,
List.of(Attachment.BizType.GAO_CUSTOMER_FOLLOW_UP_REMINDER), List.of()),
- CUSTOMER_PACKAGE(GaoDataExportModule.CUSTOMER_PACKAGE, "gao_customer_package", "store_id", null, "purchased_at", false, true,
+ CUSTOMER_PACKAGE (GaoDataExportModule.CUSTOMER_PACKAGE, "gao_customer_package", "store_id", null, "created_at", false, true,
List.of(), List.of()),
EVENT_RECORD(GaoDataExportModule.EVENT_RECORD, "gao_event_record", "store_id", null, "registered_at", false, true,
List.of(Attachment.BizType.GAO_EVENT_RECORD), List.of(new ChildDefinition("事件选项", "gao_event_record_option", "event_record_id", true, List.of()))),
diff --git a/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportXlsxWriter.java b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportXlsxWriter.java
index c0bad51..2fc123b 100644
--- a/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportXlsxWriter.java
+++ b/src/main/java/com/imyeyu/api/modules/gao/export/GaoDataExportXlsxWriter.java
@@ -1,6 +1,10 @@
package com.imyeyu.api.modules.gao.export;
import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
@@ -14,6 +18,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
///
/// GAO 数据导出 xlsx 流式写入器
@@ -24,33 +29,19 @@ public class GaoDataExportXlsxWriter implements AutoCloseable {
private static final ZoneId ZONE_ID = ZoneId.of("Asia/Shanghai");
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZONE_ID);
- private static final Map HEADER_NAME_MAP = Map.ofEntries(
- Map.entry("id", "ID"),
- Map.entry("store_id", "门店 ID"),
- Map.entry("customer_id", "客户 ID"),
- Map.entry("created_at", "创建时间"),
- Map.entry("updated_at", "修改时间"),
- Map.entry("deleted_at", "删除时间"),
- Map.entry("occurred_at", "发生时间"),
- Map.entry("effective_at", "生效时间"),
- Map.entry("registered_at", "登记时间"),
- Map.entry("purchased_at", "购买时间"),
- Map.entry("delivered_at", "履约时间"),
- Map.entry("redeemed_at", "兑换时间"),
- Map.entry("returned_at", "退货时间"),
- Map.entry("remind_at", "提醒时间"),
- Map.entry("completed_at", "完成时间"),
- Map.entry("size", "文件大小"),
- Map.entry("name", "名称"),
- Map.entry("status", "状态"),
- Map.entry("remark", "备注")
- );
private final SXSSFWorkbook workbook = new SXSSFWorkbook(200);
private final Map sheetStateMap = new LinkedHashMap<>();
+ private final CellStyle headerCellStyle;
public GaoDataExportXlsxWriter() {
workbook.setCompressTempFiles(true);
+ Font headerFont = workbook.createFont();
+ headerFont.setBold(true);
+ headerCellStyle = workbook.createCellStyle();
+ headerCellStyle.setFont(headerFont);
+ headerCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+ headerCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
}
/// 追加记录
@@ -58,10 +49,29 @@ public class GaoDataExportXlsxWriter implements AutoCloseable {
/// @param sheetName 工作表名称
/// @param rowList 记录列表
public void append(String sheetName, List