fix: 第1批 M1、M4~M6 登录密码统一规则与三类导出补列
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
- 七个设置登录密码入口统一 8~12 位、四类字符至少三类(1001/1016),修改密码与建店铺返回字段级提示 - 订单导出末列“操作人”、IoT 卡导出末列“套餐到期时间”、设备导出流量标 MB 并新增“设备合计(GB)” - 历史导出任务按冻结表头识别新旧尾列,行宽不变 - OpenSpec Change fix-august-iteration-export-and-password-hints:10/12,5.3 前端同步与 5.4 测试部署导出验证待完成
This commit is contained in:
@@ -16,6 +16,8 @@ const (
|
||||
orderExportBaseHeaderCount = 11
|
||||
orderExportCardGroupSize = 2
|
||||
orderExportMinCardGroups = 1
|
||||
// orderExportOperatorHeader 操作人列固定追加在最后,历史任务的冻结表头没有该列。
|
||||
orderExportOperatorHeader = "操作人"
|
||||
)
|
||||
|
||||
// OrderDataSource 订单导出数据源。
|
||||
@@ -63,6 +65,7 @@ func (s *OrderDataSource) Fetch(ctx context.Context, params ExportParams, offset
|
||||
}
|
||||
|
||||
cardGroups := orderCardGroupCountFromHeaders(params.ResolvedHeaders)
|
||||
includeOperator := len(params.ResolvedHeaders) == 0 || orderHeadersIncludeOperator(params.ResolvedHeaders)
|
||||
if cardGroups <= 0 {
|
||||
resolved, err := s.resolveCardGroupCount(ctx, params)
|
||||
if err != nil {
|
||||
@@ -107,7 +110,11 @@ func (s *OrderDataSource) Fetch(ctx context.Context, params ExportParams, offset
|
||||
if item.DeviceID != nil {
|
||||
cards = cardMap[*item.DeviceID]
|
||||
}
|
||||
rows = append(rows, buildOrderExportRow(item, itemMap[item.ID], paymentMap[item.ID], cards, cardGroups))
|
||||
row := buildOrderExportRow(item, itemMap[item.ID], paymentMap[item.ID], cards, cardGroups)
|
||||
if includeOperator {
|
||||
row = append(row, item.OperatorAccountName)
|
||||
}
|
||||
rows = append(rows, row)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
@@ -243,6 +250,7 @@ func (s *OrderDataSource) fetchOrders(ctx context.Context, params ExportParams,
|
||||
o.payment_method,
|
||||
o.created_at,
|
||||
o.device_id,
|
||||
o.operator_account_name,
|
||||
COALESCE(sh.shop_name, '') AS shop_name
|
||||
`).
|
||||
Order("o.id DESC").
|
||||
@@ -461,6 +469,8 @@ type orderExportRow struct {
|
||||
PaymentMethod string `gorm:"column:payment_method"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
DeviceID *uint `gorm:"column:device_id"`
|
||||
// OperatorAccountName 订单创建时冻结的操作者名称,缺失时导出为空,不回查当前账号。
|
||||
OperatorAccountName string `gorm:"column:operator_account_name"`
|
||||
}
|
||||
|
||||
type orderExportItemRow struct {
|
||||
@@ -511,7 +521,7 @@ func buildOrderExportHeaders(cardGroups int) []string {
|
||||
fmt.Sprintf("ICCID%d", i),
|
||||
)
|
||||
}
|
||||
return headers
|
||||
return append(headers, orderExportOperatorHeader)
|
||||
}
|
||||
|
||||
func buildOrderExportRow(item orderExportRow, items []orderExportItemRow, payment orderExportPaymentRow, cards []orderExportCardRow, cardGroups int) []string {
|
||||
@@ -543,16 +553,25 @@ func buildOrderExportRow(item orderExportRow, items []orderExportItemRow, paymen
|
||||
}
|
||||
|
||||
func orderCardGroupCountFromHeaders(headers []string) int {
|
||||
if len(headers) < orderExportBaseHeaderCount {
|
||||
fixedCount := orderExportBaseHeaderCount
|
||||
if orderHeadersIncludeOperator(headers) {
|
||||
fixedCount++
|
||||
}
|
||||
if len(headers) < fixedCount {
|
||||
return 0
|
||||
}
|
||||
cardColumnCount := len(headers) - orderExportBaseHeaderCount
|
||||
cardColumnCount := len(headers) - fixedCount
|
||||
if cardColumnCount <= 0 || cardColumnCount%orderExportCardGroupSize != 0 {
|
||||
return 0
|
||||
}
|
||||
return cardColumnCount / orderExportCardGroupSize
|
||||
}
|
||||
|
||||
// orderHeadersIncludeOperator 判断冻结表头是否为带“操作人”末列的新表头。
|
||||
func orderHeadersIncludeOperator(headers []string) bool {
|
||||
return len(headers) > 0 && headers[len(headers)-1] == orderExportOperatorHeader
|
||||
}
|
||||
|
||||
func joinOrderPackageNames(items []orderExportItemRow) string {
|
||||
if len(items) == 0 {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user