From f5df476cf46970e91748b6f9b9c5bcdbfaad820f Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 23 Jun 2026 17:10:51 +0800 Subject: [PATCH] refactor: deprecated many cmd --- cmd/au_sim.go | 18 ++++++++++++------ cmd/diff_fiber_box.go | 18 ++++++++++++------ cmd/gen_con_order.go | 5 +++-- cmd/gen_con_plan.go | 14 ++++++++++---- cmd/high_opt_loss.go | 9 +++++++-- cmd/law_plat.go | 12 +++++++++--- cmd/supply.go | 5 +++-- .../deprecated/wms}/common/excelkit.go | 2 +- .../deprecated/wms}/cryptokit/crypto.go | 1 + .../wms}/model/get_high_opt_loss_under_list.go | 0 .../wms}/model/get_order_query_list.go | 0 .../deprecated/wms}/model/request_header.go | 3 ++- .../wms}/service/get_high_opt_loss_list.go | 6 +++--- 13 files changed, 63 insertions(+), 30 deletions(-) rename {wms => internal/deprecated/wms}/common/excelkit.go (99%) rename {wms => internal/deprecated/wms}/cryptokit/crypto.go (99%) rename {wms => internal/deprecated/wms}/model/get_high_opt_loss_under_list.go (100%) rename {wms => internal/deprecated/wms}/model/get_order_query_list.go (100%) rename {wms => internal/deprecated/wms}/model/request_header.go (99%) rename {wms => internal/deprecated/wms}/service/get_high_opt_loss_list.go (93%) diff --git a/cmd/au_sim.go b/cmd/au_sim.go index bec4fd9..92f8caa 100644 --- a/cmd/au_sim.go +++ b/cmd/au_sim.go @@ -1,8 +1,20 @@ +//go:build legacy_au_sim + +// Deprecated: This file is no longer used. +// Retained temporarily for rollback. +// Planned removal: 2026-06-23. package cmd import ( "encoding/base64" "fmt" + "io/ioutil" + "os" + "path/filepath" + "regexp" + "strings" + "time" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/init/initkit" @@ -10,12 +22,6 @@ import ( "github.com/spf13/cobra" "github.com/tidwall/gjson" "github.com/xuri/excelize/v2" - "io/ioutil" - "os" - "path/filepath" - "regexp" - "strings" - "time" ) func init() { diff --git a/cmd/diff_fiber_box.go b/cmd/diff_fiber_box.go index a9e73bb..417e2ea 100644 --- a/cmd/diff_fiber_box.go +++ b/cmd/diff_fiber_box.go @@ -1,8 +1,16 @@ +//go:build legacy_dfb + +// Deprecated: This file is no longer used. +// Retained temporarily for rollback. +// Planned removal: 2026-06-23. package cmd import ( - "cu-helper/wms/cryptokit" - "cu-helper/wms/model" + "cu-helper/internal/deprecated/wms/cryptokit" + model2 "cu-helper/internal/deprecated/wms/model" + "strings" + "time" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/init/initkit" @@ -14,8 +22,6 @@ import ( "github.com/tidwall/gjson" "github.com/xuri/excelize/v2" "golang.org/x/net/html" - "strings" - "time" ) func init() { @@ -53,7 +59,7 @@ func handleDfb() { if err != nil { panic(exception.New(err.Error())) } - h := model.NewHeader() + h := model2.NewHeader() header := h.GenReqParam() for rowIndex, row := range rows { if rowIndex <= 1 { @@ -61,7 +67,7 @@ func handleDfb() { } _ = commonkit.RecoverFuncWrapper(func() { no := row[8] //宽带编号 I列 - fo := model.NewGetOrderQueryList(no) + fo := model2.NewGetOrderQueryList(no) form := fo.GenReqParam() logkit.Info("***开始请求*** " + no) resp, err := dfbClient.R(). diff --git a/cmd/gen_con_order.go b/cmd/gen_con_order.go index d4c3587..3ac795a 100644 --- a/cmd/gen_con_order.go +++ b/cmd/gen_con_order.go @@ -42,6 +42,7 @@ func defFlagsGco(cmd *cobra.Command) { func handleGcoLx() { templatePath := configkit.GetString("gco.template", "/Users/leo/Desktop/归档/集客零星/模板.xlsx") filePath := configkit.GetString("gco.file", "/Users/leo/Desktop/归档/集客零星/集客零星资源归档.xlsx") + thisYear := time.Now().Format("2006") //templatePath := configkit.GetString("gco.template", "D:\\backup\\desktop\\lx\\模板.xlsx") //filePath := configkit.GetString("gco.file", "D:\\backup\\desktop\\lx\\集客零星资源归档.xlsx") src, err := excelize.OpenFile(filePath) @@ -50,9 +51,9 @@ func handleGcoLx() { } defer src.Close() - rows, err := src.GetRows("施工单2026年") // todo 每年修改 + rows, err := src.GetRows("施工单" + thisYear + "年") if err != nil { - panic(exception.New("缺少 Sheet:施工单2026年")) // todo 每年修改 + panic(exception.New("缺少 Sheet:" + "施工单" + thisYear + "年")) } // 跳过表头 diff --git a/cmd/gen_con_plan.go b/cmd/gen_con_plan.go index 21167b0..6141303 100644 --- a/cmd/gen_con_plan.go +++ b/cmd/gen_con_plan.go @@ -1,15 +1,21 @@ +//go:build legacy_gco + +// Deprecated: This file is no longer used. +// Retained temporarily for rollback. +// Planned removal: 2026-06-23. package cmd import ( "fmt" - "github.com/mizuki1412/go-core-kit/init/initkit" - "github.com/mizuki1412/go-core-kit/service/configkit" - "github.com/spf13/cobra" - "github.com/xuri/excelize/v2" "regexp" "strconv" "strings" "time" + + "github.com/mizuki1412/go-core-kit/init/initkit" + "github.com/mizuki1412/go-core-kit/service/configkit" + "github.com/spf13/cobra" + "github.com/xuri/excelize/v2" ) func init() { diff --git a/cmd/high_opt_loss.go b/cmd/high_opt_loss.go index fe8f006..bd0f50b 100644 --- a/cmd/high_opt_loss.go +++ b/cmd/high_opt_loss.go @@ -1,8 +1,13 @@ +//go:build legacy_loss + +// Deprecated: This file is no longer used. +// Retained temporarily for rollback. +// Planned removal: 2026-06-23. package cmd import ( - "cu-helper/wms/common" - "cu-helper/wms/service" + "cu-helper/internal/deprecated/wms/common" + "cu-helper/internal/deprecated/wms/service" "github.com/mizuki1412/go-core-kit/init/initkit" "github.com/mizuki1412/go-core-kit/service/logkit" diff --git a/cmd/law_plat.go b/cmd/law_plat.go index 3432991..804021d 100644 --- a/cmd/law_plat.go +++ b/cmd/law_plat.go @@ -1,6 +1,15 @@ +//go:build legacy_law + +// Deprecated: This file is no longer used. +// Retained temporarily for rollback. +// Planned removal: 2026-06-23. package cmd import ( + "net/url" + "strings" + "time" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/init/initkit" @@ -9,9 +18,6 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/tidwall/gjson" - "net/url" - "strings" - "time" ) //法治在沃 diff --git a/cmd/supply.go b/cmd/supply.go index 49df46b..ce51c20 100644 --- a/cmd/supply.go +++ b/cmd/supply.go @@ -1,6 +1,9 @@ package cmd import ( + "strconv" + "time" + "github.com/go-resty/resty/v2" "github.com/mizuki1412/go-core-kit/class/exception" "github.com/mizuki1412/go-core-kit/init/initkit" @@ -11,8 +14,6 @@ import ( "github.com/spf13/cobra" "github.com/tidwall/gjson" "github.com/xuri/excelize/v2" - "strconv" - "time" ) func init() { diff --git a/wms/common/excelkit.go b/internal/deprecated/wms/common/excelkit.go similarity index 99% rename from wms/common/excelkit.go rename to internal/deprecated/wms/common/excelkit.go index bcf5a0b..fff7aff 100644 --- a/wms/common/excelkit.go +++ b/internal/deprecated/wms/common/excelkit.go @@ -1,7 +1,7 @@ package common import ( - "cu-helper/wms/service" + "cu-helper/internal/deprecated/wms/service" "fmt" "path/filepath" "strconv" diff --git a/wms/cryptokit/crypto.go b/internal/deprecated/wms/cryptokit/crypto.go similarity index 99% rename from wms/cryptokit/crypto.go rename to internal/deprecated/wms/cryptokit/crypto.go index ed92597..41a6253 100644 --- a/wms/cryptokit/crypto.go +++ b/internal/deprecated/wms/cryptokit/crypto.go @@ -5,6 +5,7 @@ import ( "crypto/aes" "crypto/cipher" "encoding/base64" + "github.com/mizuki1412/go-core-kit/class/exception" ) diff --git a/wms/model/get_high_opt_loss_under_list.go b/internal/deprecated/wms/model/get_high_opt_loss_under_list.go similarity index 100% rename from wms/model/get_high_opt_loss_under_list.go rename to internal/deprecated/wms/model/get_high_opt_loss_under_list.go diff --git a/wms/model/get_order_query_list.go b/internal/deprecated/wms/model/get_order_query_list.go similarity index 100% rename from wms/model/get_order_query_list.go rename to internal/deprecated/wms/model/get_order_query_list.go diff --git a/wms/model/request_header.go b/internal/deprecated/wms/model/request_header.go similarity index 99% rename from wms/model/request_header.go rename to internal/deprecated/wms/model/request_header.go index b95660c..0001c0f 100644 --- a/wms/model/request_header.go +++ b/internal/deprecated/wms/model/request_header.go @@ -1,8 +1,9 @@ package model import ( - "github.com/mizuki1412/go-core-kit/service/configkit" "reflect" + + "github.com/mizuki1412/go-core-kit/service/configkit" ) // Header WMS-ZJ通用Header diff --git a/wms/service/get_high_opt_loss_list.go b/internal/deprecated/wms/service/get_high_opt_loss_list.go similarity index 93% rename from wms/service/get_high_opt_loss_list.go rename to internal/deprecated/wms/service/get_high_opt_loss_list.go index 6321318..75edb8a 100644 --- a/wms/service/get_high_opt_loss_list.go +++ b/internal/deprecated/wms/service/get_high_opt_loss_list.go @@ -1,7 +1,7 @@ package service import ( - "cu-helper/wms/model" + model2 "cu-helper/internal/deprecated/wms/model" "time" "github.com/go-resty/resty/v2" @@ -23,9 +23,9 @@ type HighOptLossUnder struct { // ReqGetHighOptLossUnderList 查询在途光衰单(包含施工中、人工回访、综合调度等全部未归档状态) func ReqGetHighOptLossUnderList() map[string]*HighOptLossUnder { - h := model.NewHeader() + h := model2.NewHeader() header := h.GenReqParam() - f := model.NewGetHighOptLossUnderList() + f := model2.NewGetHighOptLossUnderList() form := f.GenReqParam() client := resty.New().SetRetryCount(5).SetRetryWaitTime(10 * time.Second) resp, err := client.R().