Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
# Conflicts: # pkg/port/beego/controllers/web_client/excel_data_controller.go 添加 退货单导入
正在显示
4 个修改的文件
包含
93 行增加
和
0 行删除
| @@ -34,3 +34,23 @@ func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.Compan | @@ -34,3 +34,23 @@ func (srv ExcelDataService) ExportCompanyUser(companyUserListQuery *query.Compan | ||
| 34 | } | 34 | } |
| 35 | return ExportCompanyUserData(result.Users), nil | 35 | return ExportCompanyUserData(result.Users), nil |
| 36 | } | 36 | } |
| 37 | + | ||
| 38 | +// 导出共创用户信息列表 | ||
| 39 | +func (srv ExcelDataService) ExportCooperationUser(companyUserListQuery *query.CompanyUserListQuery) (ExportCooperationUserData, error) { | ||
| 40 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(companyUserListQuery.Operator) | ||
| 41 | + result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{ | ||
| 42 | + Limit: 10000, | ||
| 43 | + CompanyId: companyUserListQuery.Operator.CompanyId, | ||
| 44 | + OrganizationId: 0, | ||
| 45 | + DepartmentId: 0, | ||
| 46 | + UserName: companyUserListQuery.UserName, | ||
| 47 | + DepName: companyUserListQuery.DepartmentName, | ||
| 48 | + Phone: "", | ||
| 49 | + UserType: domain.UserTypeCooperation, | ||
| 50 | + InOrgIds: companyUserListQuery.Operator.OrgIds, | ||
| 51 | + }) | ||
| 52 | + if err != nil { | ||
| 53 | + return ExportCooperationUserData{}, fmt.Errorf("获取企业用户数据失败:%w", err) | ||
| 54 | + } | ||
| 55 | + return ExportCooperationUserData(result.Users), nil | ||
| 56 | +} |
| @@ -68,3 +68,48 @@ func (data ExportCompanyUserData) DataListLen() int { | @@ -68,3 +68,48 @@ func (data ExportCompanyUserData) DataListLen() int { | ||
| 68 | func (data ExportCompanyUserData) TableTitle() []string { | 68 | func (data ExportCompanyUserData) TableTitle() []string { |
| 69 | return nil | 69 | return nil |
| 70 | } | 70 | } |
| 71 | + | ||
| 72 | +//exportCompanyUserData 导出共创用户数据 | ||
| 73 | +type ExportCooperationUserData []allied_creation_user.UserDetail | ||
| 74 | + | ||
| 75 | +var _ excel.ExcelMaker = (*ExportCooperationUserData)(nil) | ||
| 76 | + | ||
| 77 | +func (data ExportCooperationUserData) DataFieldList() []excel.DataField { | ||
| 78 | + return []excel.DataField{ | ||
| 79 | + {EnName: "UserCode", CnName: "用户编码"}, | ||
| 80 | + {EnName: "UserName", CnName: "用户姓名"}, | ||
| 81 | + {EnName: "CooperationCompany", CnName: "合作公司"}, | ||
| 82 | + {EnName: "CooperationDeadline", CnName: "合作到期"}, | ||
| 83 | + {EnName: "Phone", CnName: "手机号"}, | ||
| 84 | + {EnName: "Email", CnName: "邮箱"}, | ||
| 85 | + } | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +func (data ExportCooperationUserData) CellValue(index int, enName string) (value interface{}) { | ||
| 89 | + if index > data.DataListLen() { | ||
| 90 | + return "" | ||
| 91 | + } | ||
| 92 | + switch enName { | ||
| 93 | + case "UserCode": | ||
| 94 | + return data[index].UserCode | ||
| 95 | + case "UserName": | ||
| 96 | + return data[index].UserInfo.UserName | ||
| 97 | + case "CooperationCompany": | ||
| 98 | + return data[index].CooperationInfo.CooperationCompany | ||
| 99 | + case "CooperationDeadline": | ||
| 100 | + return data[index].CooperationInfo.CooperationDeadline.Format("2006-01-02") | ||
| 101 | + case "Phone": | ||
| 102 | + return data[index].UserInfo.Phone | ||
| 103 | + case "Email": | ||
| 104 | + return data[index].UserInfo.Email | ||
| 105 | + } | ||
| 106 | + return nil | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +func (data ExportCooperationUserData) DataListLen() int { | ||
| 110 | + return len(data) | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +func (data ExportCooperationUserData) TableTitle() []string { | ||
| 114 | + return nil | ||
| 115 | +} |
| @@ -55,6 +55,33 @@ func (controller ExcelDataController) ExportCompanyUser() { | @@ -55,6 +55,33 @@ func (controller ExcelDataController) ExportCompanyUser() { | ||
| 55 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户") | 55 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户") |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | +//导出共创用户 | ||
| 59 | +func (controller ExcelDataController) ExportCooperationUser() { | ||
| 60 | + excelService := service.NewExcelDataService(nil) | ||
| 61 | + companyUserListQuery := &query.CompanyUserListQuery{} | ||
| 62 | + err := controller.Unmarshal(companyUserListQuery) | ||
| 63 | + if err != nil { | ||
| 64 | + log.Logger.Debug("json err:" + err.Error()) | ||
| 65 | + controller.Response(nil, err) | ||
| 66 | + return | ||
| 67 | + } | ||
| 68 | + companyUserListQuery.Operator = controller.GetOperator() | ||
| 69 | + data, err := excelService.ExportCooperationUser(companyUserListQuery) | ||
| 70 | + if err != nil { | ||
| 71 | + log.Logger.Debug("excelService.ExportCompanyUser err:" + err.Error()) | ||
| 72 | + controller.Response(nil, err) | ||
| 73 | + return | ||
| 74 | + } | ||
| 75 | + excelTool := excel.NewExcelExport() | ||
| 76 | + err = excelTool.ExportData(data, "") | ||
| 77 | + if err != nil { | ||
| 78 | + log.Logger.Debug("excelTool.ExportData err:" + err.Error()) | ||
| 79 | + controller.Response(nil, err) | ||
| 80 | + return | ||
| 81 | + } | ||
| 82 | + controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户") | ||
| 83 | +} | ||
| 84 | + | ||
| 58 | func (controller ExcelDataController) ImportDividendsReturnedOrder() { | 85 | func (controller ExcelDataController) ImportDividendsReturnedOrder() { |
| 59 | excelFile, fileHeader, err := controller.GetFile("file") | 86 | excelFile, fileHeader, err := controller.GetFile("file") |
| 60 | if err != nil { | 87 | if err != nil { |
| @@ -7,4 +7,5 @@ import ( | @@ -7,4 +7,5 @@ import ( | ||
| 7 | 7 | ||
| 8 | func init() { | 8 | func init() { |
| 9 | web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser") | 9 | web.Router("/v1/web/excel/export/company-user", &web_client.ExcelDataController{}, "Post:ExportCompanyUser") |
| 10 | + web.Router("/v1/web/excel/export/cooperation-user", &web_client.ExcelDataController{}, "Post:ExportCooperationUser") | ||
| 10 | } | 11 | } |
-
请 注册 或 登录 后发表评论