作者 Your Name

添加 公司用户导出

@@ -147,6 +147,7 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ @@ -147,6 +147,7 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
147 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 147 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
148 github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 148 github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
149 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 149 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
  150 +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
150 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= 151 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
151 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= 152 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
152 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= 153 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
@@ -194,7 +195,9 @@ github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFB @@ -194,7 +195,9 @@ github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFB
194 github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= 195 github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
195 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= 196 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
196 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= 197 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
  198 +github.com/richardlehane/mscfb v1.0.3 h1:rD8TBkYWkObWO0oLDFCbwMeZ4KoalxQy+QgniCj3nKI=
197 github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk= 199 github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
  200 +github.com/richardlehane/msoleps v1.0.1 h1:RfrALnSNXzmXLbGct/P2b4xkFz4e8Gmj/0Vj9M9xC1o=
198 github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg= 201 github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
199 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 202 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
200 github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= 203 github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
@@ -233,7 +236,9 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV @@ -233,7 +236,9 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV
233 github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= 236 github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
234 github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= 237 github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
235 github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= 238 github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
  239 +github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3 h1:EpI0bqf/eX9SdZDwlMmahKM+CDBgNbsXMhsN28XrM8o=
236 github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= 240 github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
  241 +github.com/xuri/excelize/v2 v2.4.1 h1:veeeFLAJwsNEBPBlDepzPIYS1eLyBVcXNZUW79exZ1E=
237 github.com/xuri/excelize/v2 v2.4.1/go.mod h1:rSu0C3papjzxQA3sdK8cU544TebhrPUoTOaGPIh0Q1A= 242 github.com/xuri/excelize/v2 v2.4.1/go.mod h1:rSu0C3papjzxQA3sdK8cU544TebhrPUoTOaGPIh0Q1A=
238 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 243 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
239 github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= 244 github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
@@ -258,6 +263,7 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm @@ -258,6 +263,7 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
258 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= 263 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
259 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 264 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
260 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 265 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
  266 +golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
261 golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 267 golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
262 golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 268 golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
263 golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 269 golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 +)
  6 +
  7 +type CompanyUserListQuery struct {
  8 + //用户姓名
  9 + UserName string `json:"userName"`
  10 + //所属部门
  11 + DepartmentName string `json:"departmentName"`
  12 + //操作人
  13 + Operator domain.Operator `json:"-"`
  14 +}
  1 +package query
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  5 +)
  6 +
  7 +type CooperationUserListQuery struct {
  8 + //操作人
  9 + Operator domain.Operator `json:"-"`
  10 + //用户名称
  11 + UserName string `json:"userName"`
  12 + //共创公司
  13 + CooperationCompany string `json:"cooperationCompany"`
  14 +}
  1 +package service
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  9 +)
  10 +
  11 +type ExcelDataService struct {
  12 +}
  13 +
  14 +func NewExcelDataService(param map[string]interface{}) *ExcelDataService {
  15 + return &ExcelDataService{}
  16 +}
  17 +
  18 +// 导出公司用户信息列表
  19 +func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCompanyUserData, error) {
  20 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator)
  21 + result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
  22 + Limit: 10000,
  23 + CompanyId: companyUserListQuery.Operator.CompanyId,
  24 + OrganizationId: 0,
  25 + DepartmentId: 0,
  26 + UserName: companyUserListQuery.UserName,
  27 + DepName: companyUserListQuery.DepartmentName,
  28 + Phone: "",
  29 + UserType: domain.UserTypeEmployee,
  30 + InOrgIds: companyUserListQuery.Operator.OrgIds,
  31 + })
  32 + if err != nil {
  33 + return ExportCompanyUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err)
  34 + }
  35 + return ExportCompanyUserData(result.Users), nil
  36 +}
  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/utils/excel"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  6 +)
  7 +
  8 +//exportCompanyUserData 导出公司用户数据
  9 +type ExportCompanyUserData []allied_creation_user.UserDetail
  10 +
  11 +var _ excel.ExcelMaker = (*ExportCompanyUserData)(nil)
  12 +
  13 +func (data ExportCompanyUserData) DataFieldList() []excel.DataField {
  14 + return []excel.DataField{
  15 + {EnName: "UserCode", CnName: "用户编码"},
  16 + {EnName: "UserName", CnName: "用户姓名"},
  17 + {EnName: "Phone", CnName: "手机号"},
  18 + {EnName: "DepartmentName", CnName: "所属部门"},
  19 + {EnName: "EnableStatus", CnName: "状态"},
  20 + {EnName: "OrgName", CnName: "组织机构"},
  21 + }
  22 +}
  23 +
  24 +func (data ExportCompanyUserData) CellValue(index int, enName string) (value interface{}) {
  25 + if index > data.DataListLen() {
  26 + return ""
  27 + }
  28 + switch enName {
  29 + case "UserCode":
  30 + return data[index].UserCode
  31 + case "UserName":
  32 + return data[index].UserInfo.UserName
  33 + case "Phone":
  34 + return data[index].UserInfo.Phone
  35 + case "DepartmentName":
  36 + if data[index].Department != nil {
  37 + return data[index].Department.DepartmentName
  38 + } else {
  39 + return ""
  40 + }
  41 + case "EnableStatus":
  42 + status := data[index].EnableStatus
  43 + statusName := ""
  44 + // 状态(1:启用 2:禁用 3:注销)
  45 + switch status {
  46 + case 1:
  47 + statusName = "启用"
  48 + case 2:
  49 + statusName = "禁用"
  50 + case 3:
  51 + statusName = "注销"
  52 + }
  53 + return statusName
  54 + case "OrgName":
  55 + if data[index].Org != nil {
  56 + return data[index].Org.OrgName
  57 + } else {
  58 + return ""
  59 + }
  60 + }
  61 + return nil
  62 +}
  63 +
  64 +func (data ExportCompanyUserData) DataListLen() int {
  65 + return len(data)
  66 +}
  67 +
  68 +func (data ExportCompanyUserData) TableTitle() []string {
  69 + return nil
  70 +}
  1 +package allied_creation_cooperation
  2 +
  3 +import (
  4 + "encoding/json"
  5 + "fmt"
  6 + "time"
  7 +
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  10 +)
  11 +
  12 +//ReqImportDividendsReturnedOrder 导入退货数据
  13 +type (
  14 + ImportDividendsReturnedOrderGood struct {
  15 + OrderGoodAmount float64 `json:"orderGoodAmount"` // 订单产品金额
  16 + OrderGoodName string `json:"orderGoodName"` // 订单产品名称
  17 + OrderGoodPrice float64 `json:"orderGoodPrice"` // 订单产品单价
  18 + OrderGoodQuantity int64 `json:"orderGoodQuantity"` // 订单产品数量
  19 + DividendsOrderNumber int64 `json:"dividendsOrderNumber"` // 关联分红订单号
  20 + CooperationContractNumber string `json:"cooperationContractNumber"` // 关联的共创合约编号
  21 + OrderGoodExpense float64 `json:"orderGoodExpense"` // 订单产品费用
  22 + }
  23 + ImportDividendsReturnedOrderData struct {
  24 + DividendsReturnedOrderRefund float64 `json:"dividendsReturnedOrderRefund"` // 退货金额
  25 + DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` //退货客户名称
  26 + OriginalOrderNum string `json:"originalOrderNum"` // 来源单号,源单号,订单号
  27 + DividendsReturnedDate time.Time `json:"dividendsReturnedDate"` //退货日期
  28 + RegionName string `json:"regionName"` // 退货区域名称
  29 + OrderGoods []*ImportDividendsReturnedOrderGood `json:"orderGoods"` // 订单产品列表
  30 + Remarks string `json:"remarks"` // 备注
  31 + }
  32 + //请求参数
  33 + ReqImportDividendsReturnedOrder struct {
  34 + // 分红退货单数据
  35 + DividendsReturnedOrderData []ImportDividendsReturnedOrderData `json:"dividendsReturnedOrderData"` //分红退货单数据列表
  36 + }
  37 + //响应参数
  38 + DataImportDividendsReturnedOrder struct {
  39 + }
  40 +)
  41 +
  42 +// ImportDividendsReturnedOrder 导入退货数据
  43 +func (gateway HttplibAlliedCreationCooperation) ImportDividendsReturnedOrder(param ReqDividendsEstimateSearchDividend) (*DataDividendsEstimateSearchDividend, error) {
  44 + url := gateway.baseUrL + "/dividends-returned-orders/import"
  45 + method := "POST"
  46 + req := gateway.CreateRequest(url, method)
  47 + // oneDemo
  48 + log.Logger.Debug("向业务模块请求数据:导入退货数据。", map[string]interface{}{
  49 + "api": method + ":" + url,
  50 + // "param": param,
  51 + })
  52 + req, err := req.JSONBody(param)
  53 + if err != nil {
  54 + return nil, fmt.Errorf("请求查询业绩分红失败:%w", err)
  55 + }
  56 +
  57 + byteResult, err := req.Bytes()
  58 + if err != nil {
  59 + return nil, fmt.Errorf("获取查询业绩分红失败:%w", err)
  60 + }
  61 + log.Logger.Debug("获取业务模块请求数据:查询业绩分红。", map[string]interface{}{
  62 + "result": string(byteResult),
  63 + })
  64 + var result service_gateway.GatewayResponse
  65 + err = json.Unmarshal(byteResult, &result)
  66 + if err != nil {
  67 + return nil, fmt.Errorf("解析查询业绩分红:%w", err)
  68 + }
  69 + var data DataDividendsEstimateSearchDividend
  70 + err = gateway.GetResponseData(result, &data)
  71 + return &data, err
  72 +}
@@ -28,9 +28,13 @@ func (gateway HttplibAlliedCreationUser) UserSearch(param ReqUserSearch) (*DataU @@ -28,9 +28,13 @@ func (gateway HttplibAlliedCreationUser) UserSearch(param ReqUserSearch) (*DataU
28 if err != nil { 28 if err != nil {
29 return nil, fmt.Errorf("获取搜索用户列表失败:%w", err) 29 return nil, fmt.Errorf("获取搜索用户列表失败:%w", err)
30 } 30 }
31 - log.Logger.Debug("获取用户模块请求数据:搜索用户列表。", map[string]interface{}{  
32 - "result": string(byteResult),  
33 - }) 31 + if param.Limit > 50 {
  32 + //太多就不打印了
  33 + log.Logger.Debug("获取用户模块请求数据:搜索用户列表。", map[string]interface{}{
  34 + "result": string(byteResult),
  35 + })
  36 + }
  37 +
34 var result service_gateway.GatewayResponse 38 var result service_gateway.GatewayResponse
35 err = json.Unmarshal(byteResult, &result) 39 err = json.Unmarshal(byteResult, &result)
36 if err != nil { 40 if err != nil {
  1 +package web_client
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web/context"
  5 +
  6 + "github.com/linmadan/egglib-go/utils/excel"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/query"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/service"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
  10 +)
  11 +
  12 +type ExcelDataController struct {
  13 + baseController
  14 +}
  15 +
  16 +func (controller *ExcelDataController) responseExcelByFile(ctx *context.Context, excelExport *excel.ExcelExport, fileName string) error {
  17 + ctx.Output.Header("Content-Disposition", "attachment; filename="+fileName)
  18 + ctx.Output.Header("Content-Description", "File Transfer")
  19 + ctx.Output.Header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
  20 + ctx.Output.Header("Content-Transfer-Encoding", "binary")
  21 + ctx.Output.Header("Expires", "0")
  22 + ctx.Output.Header("Cache-Control", "must-revalidate")
  23 + ctx.Output.Header("Pragma", "public")
  24 + //跳过保存文件,直接写入ctx.ResponseWriter
  25 + excelExport.ExcelFile.Write(ctx.ResponseWriter)
  26 + return nil
  27 +}
  28 +
  29 +//导出公司用户
  30 +func (controller ExcelDataController) ExportCompanyUser() {
  31 + excelService := service.NewExcelDataService(nil)
  32 + companyUserListQuery := &query.CompanyUserListQuery{}
  33 + err := controller.Unmarshal(companyUserListQuery)
  34 + if err != nil {
  35 + log.Logger.Debug("json err:" + err.Error())
  36 + controller.Response(nil, err)
  37 + return
  38 + }
  39 + companyUserListQuery.Operator = controller.GetOperator()
  40 + data, err := excelService.ExportCompanyUser(companyUserListQuery)
  41 + if err != nil {
  42 + log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error())
  43 + controller.Response(nil, err)
  44 + return
  45 + }
  46 + excelTool := excel.NewExcelExport()
  47 + err = excelTool.ExportData(data, "")
  48 + if err != nil {
  49 + log.Logger.Debug("excelTool.ExportData err:" + err.Error())
  50 + controller.Response(nil, err)
  51 + return
  52 + }
  53 + controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户")
  54 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser")
  10 +}