合并分支 'test' 到 'master'
Test 查看合并请求 !2
正在显示
17 个修改的文件
包含
244 行增加
和
208 行删除
1 | FROM 192.168.0.243:5000/mmm/allied-creation-gateway:20210809 | 1 | FROM 192.168.0.243:5000/mmm/allied-creation-gateway:20210809 |
2 | -ENV APP_DIR $GOPATH/src/project-20210909 | 2 | +ENV APP_DIR $GOPATH/src/project-20210916 |
3 | RUN mkdir -p $APP_DIR | 3 | RUN mkdir -p $APP_DIR |
4 | WORKDIR $APP_DIR/ | 4 | WORKDIR $APP_DIR/ |
5 | COPY ./pkg pkg | 5 | COPY ./pkg pkg |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | ||
4 | "strconv" | 6 | "strconv" |
5 | 7 | ||
6 | "github.com/linmadan/egglib-go/core/application" | 8 | "github.com/linmadan/egglib-go/core/application" |
@@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm | @@ -103,16 +105,16 @@ func (srv CooperationProjectService) SearchCooperationProject(projectQuery *comm | ||
103 | 105 | ||
104 | // PersonSearchCooperationProject 共创用户获取共创项目列表 | 106 | // PersonSearchCooperationProject 共创用户获取共创项目列表 |
105 | func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { | 107 | func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { |
108 | + extQueries := extQuires(projectQuery.Operator) | ||
106 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 109 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
107 | projectQuery.Operator) | 110 | projectQuery.Operator) |
108 | - //orgidStr := strconv.Itoa(projectQuery.OrgId) | ||
109 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | 111 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ |
110 | PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的 | 112 | PageNumber: projectQuery.PageNumber + 1, //手机序号从0开始的 |
111 | PageSize: projectQuery.PageSize, | 113 | PageSize: projectQuery.PageSize, |
112 | OrgId: projectQuery.OrgId, | 114 | OrgId: projectQuery.OrgId, |
113 | Status: 1, //搜索状态为“招标中”项目 | 115 | Status: 1, //搜索状态为“招标中”项目 |
114 | Keyword: projectQuery.Keyword, | 116 | Keyword: projectQuery.Keyword, |
115 | - //UserBaseId: projectQuery.Operator.UserBaseId, | 117 | + SearchCooperationProjectExtQueries: extQueries, |
116 | }) | 118 | }) |
117 | if err != nil { | 119 | if err != nil { |
118 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 120 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -120,6 +122,40 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery | @@ -120,6 +122,40 @@ func (srv CooperationProjectService) PersonSearchCooperationProject(projectQuery | ||
120 | return int(result.Total), result.List, nil | 122 | return int(result.Total), result.List, nil |
121 | } | 123 | } |
122 | 124 | ||
125 | +func extQuires(operator domain.Operator) []*allied_creation_cooperation.SearchCooperationProjectExtQuery { | ||
126 | + var extQueries = make([]*allied_creation_cooperation.SearchCooperationProjectExtQuery, 0) | ||
127 | + if operator.UserBaseId > 0 { | ||
128 | + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( | ||
129 | + operator) | ||
130 | + users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{ | ||
131 | + Limit: 100, | ||
132 | + Offset: 0, | ||
133 | + UserBaseId: operator.UserBaseId, | ||
134 | + EnableStatus: domain.UserStatusEnable, | ||
135 | + }) | ||
136 | + if err != nil { | ||
137 | + return extQueries | ||
138 | + } | ||
139 | + for i := range users.Users { | ||
140 | + u := users.Users[i] | ||
141 | + q := &allied_creation_cooperation.SearchCooperationProjectExtQuery{ | ||
142 | + ExtCompanyId: int64(u.Company.CompanyId), | ||
143 | + //ExtOrgId: int64(u.Org.OrgId), | ||
144 | + //ExtOrgIds: int64(u.UserOrg), | ||
145 | + ExtUserId: int64(u.UserId), | ||
146 | + ExtUserBaseId: int64(u.UserBaseId), | ||
147 | + ExtCooperationProjectUndertakerTypes: []int32{int32(u.UserType & 3), 3}, | ||
148 | + } | ||
149 | + for j := range u.UserOrg { | ||
150 | + org := u.UserOrg[j] | ||
151 | + q.ExtOrgIds = append(q.ExtOrgIds, int64(org.OrgID)) | ||
152 | + } | ||
153 | + extQueries = append(extQueries, q) | ||
154 | + } | ||
155 | + } | ||
156 | + return extQueries | ||
157 | +} | ||
158 | + | ||
123 | // PersonSearchCooperationProject 共创用户获取共创项目列表 | 159 | // PersonSearchCooperationProject 共创用户获取共创项目列表 |
124 | //func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { | 160 | //func (srv CooperationProjectService) PersonRecommendCooperationProject(projectQuery *command.PersonSearchCooperationProjectQuery) (int, interface{}, error) { |
125 | // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 161 | // creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
@@ -124,8 +124,8 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | @@ -124,8 +124,8 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | ||
124 | PageSize: cmd.PageSize, | 124 | PageSize: cmd.PageSize, |
125 | PaymentStatus: 2, | 125 | PaymentStatus: 2, |
126 | OrgId: cmd.Operator.OrgId, | 126 | OrgId: cmd.Operator.OrgId, |
127 | - BeginTime: beginTime, | ||
128 | - EndTime: endTime, | 127 | + PaymentBeginTime: beginTime, |
128 | + PaymentEndTime: endTime, | ||
129 | CooperationContractNumbers: cooperationContractNumbers, | 129 | CooperationContractNumbers: cooperationContractNumbers, |
130 | } | 130 | } |
131 | resultMenu, err := gateway.CreditAccountsSearch(req) | 131 | resultMenu, err := gateway.CreditAccountsSearch(req) |
@@ -137,10 +137,10 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | @@ -137,10 +137,10 @@ func (srv CompanyCreditAccountService) CreditAccountPaySearch(cmd *command.Credi | ||
137 | "cooperationContractNumbers": cooperationContractNumbers, | 137 | "cooperationContractNumbers": cooperationContractNumbers, |
138 | } | 138 | } |
139 | if cmd.BeginTime > 0 { | 139 | if cmd.BeginTime > 0 { |
140 | - queryOptions["beginTime"] = beginTime | 140 | + queryOptions["paymentBeginTime"] = beginTime |
141 | } | 141 | } |
142 | if cmd.EndTime > 0 { | 142 | if cmd.EndTime > 0 { |
143 | - queryOptions["endTime"] = endTime | 143 | + queryOptions["paymentEndTime"] = endTime |
144 | } | 144 | } |
145 | // 2.分红统计 | 145 | // 2.分红统计 |
146 | dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) | 146 | dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) |
@@ -200,10 +200,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre | @@ -200,10 +200,10 @@ func (srv CompanyCreditAccountService) PaymentHistoryStatistics(cmd *command.Cre | ||
200 | "sortByActuallyPaidAmount": 2, | 200 | "sortByActuallyPaidAmount": 2, |
201 | } | 201 | } |
202 | if cmd.BeginTime > 0 { | 202 | if cmd.BeginTime > 0 { |
203 | - queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0) | 203 | + queryOptions["paymentBeginTime"] = time.Unix(cmd.BeginTime/1000, 0) |
204 | } | 204 | } |
205 | if cmd.EndTime > 0 { | 205 | if cmd.EndTime > 0 { |
206 | - queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0) | 206 | + queryOptions["paymentEndTime"] = time.Unix(cmd.EndTime/1000, 0) |
207 | } | 207 | } |
208 | cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyPaymentHistoryStatistics, queryOptions) | 208 | cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyPaymentHistoryStatistics, queryOptions) |
209 | if err != nil { | 209 | if err != nil { |
@@ -29,8 +29,8 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit | @@ -29,8 +29,8 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit | ||
29 | PageSize: cmd.PageSize, | 29 | PageSize: cmd.PageSize, |
30 | PaymentStatus: 2, | 30 | PaymentStatus: 2, |
31 | UserBaseId: cmd.Operator.UserBaseId, | 31 | UserBaseId: cmd.Operator.UserBaseId, |
32 | - BeginTime: beginTime, | ||
33 | - EndTime: endTime, | 32 | + PaymentBeginTime: beginTime, |
33 | + PaymentEndTime: endTime, | ||
34 | }) | 34 | }) |
35 | if err != nil { | 35 | if err != nil { |
36 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 36 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -39,10 +39,10 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit | @@ -39,10 +39,10 @@ func (srv PersonCreditAccountService) CreditAccountPaySearch(cmd *command.Credit | ||
39 | "userBaseId": cmd.Operator.UserBaseId, | 39 | "userBaseId": cmd.Operator.UserBaseId, |
40 | } | 40 | } |
41 | if cmd.BeginTime > 0 { | 41 | if cmd.BeginTime > 0 { |
42 | - queryOptions["beginTime"] = beginTime | 42 | + queryOptions["paymentBeginTime"] = beginTime |
43 | } | 43 | } |
44 | if cmd.EndTime > 0 { | 44 | if cmd.EndTime > 0 { |
45 | - queryOptions["endTime"] = endTime | 45 | + queryOptions["paymentEndTime"] = endTime |
46 | } | 46 | } |
47 | // 2.分红统计 | 47 | // 2.分红统计 |
48 | dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) | 48 | dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, queryOptions) |
@@ -85,10 +85,10 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred | @@ -85,10 +85,10 @@ func (srv PersonCreditAccountService) PaymentHistoryStatistics(cmd *command.Cred | ||
85 | "sortByActuallyPaidAmount": 2, | 85 | "sortByActuallyPaidAmount": 2, |
86 | } | 86 | } |
87 | if cmd.BeginTime > 0 { | 87 | if cmd.BeginTime > 0 { |
88 | - queryOptions["beginTime"] = time.Unix(cmd.BeginTime/1000, 0) | 88 | + queryOptions["paymentBeginTime"] = time.Unix(cmd.BeginTime/1000, 0) |
89 | } | 89 | } |
90 | if cmd.EndTime > 0 { | 90 | if cmd.EndTime > 0 { |
91 | - queryOptions["endTime"] = time.Unix(cmd.EndTime/1000, 0) | 91 | + queryOptions["paymentEndTime"] = time.Unix(cmd.EndTime/1000, 0) |
92 | } | 92 | } |
93 | cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCompanyPaymentHistoryStatistics, queryOptions) | 93 | cooperationUsersStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.PersonCompanyPaymentHistoryStatistics, queryOptions) |
94 | if err != nil { | 94 | if err != nil { |
@@ -237,8 +237,8 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics | @@ -237,8 +237,8 @@ func (srv CompanyStatisticsService) GoodsStatistics(cmd *command.GoodsStatistics | ||
237 | "companyId": cmd.Operator.CompanyId, | 237 | "companyId": cmd.Operator.CompanyId, |
238 | "orgId": cmd.Operator.OrgId, | 238 | "orgId": cmd.Operator.OrgId, |
239 | "rankType": cmd.RankingType, //当前月 | 239 | "rankType": cmd.RankingType, //当前月 |
240 | - //"offset":cmd.PageNumber*cmd.PageSize, | ||
241 | - "top": 100, | 240 | + "offset": cmd.PageNumber * cmd.PageSize, |
241 | + "limit": cmd.PageSize, | ||
242 | }) | 242 | }) |
243 | if err != nil { | 243 | if err != nil { |
244 | return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 244 | return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | @@ -56,7 +56,7 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | ||
56 | beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local) | 56 | beginTime := time.Date(year, month, 1, 0, 0, 0, 0, time.Local) |
57 | endTime := beginTime.AddDate(0, 1, 0) | 57 | endTime := beginTime.AddDate(0, 1, 0) |
58 | // 2.本月分红统计 - 个人 | 58 | // 2.本月分红统计 - 个人 |
59 | - dividendStatisticsResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ | 59 | + unPaidResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ |
60 | "userBaseId": cmd.Operator.UserBaseId, | 60 | "userBaseId": cmd.Operator.UserBaseId, |
61 | "beginTime": beginTime, | 61 | "beginTime": beginTime, |
62 | "endTime": endTime, | 62 | "endTime": endTime, |
@@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | @@ -71,14 +71,24 @@ func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsC | ||
71 | Paid float64 `json:"paid"` | 71 | Paid float64 `json:"paid"` |
72 | Unpaid float64 `json:"unpaid"` | 72 | Unpaid float64 `json:"unpaid"` |
73 | } | 73 | } |
74 | - var annualDividend = &AnnualDividend{} | ||
75 | - if err := json.UnmarshalFromString(json.MarshalToString(dividendStatisticsResult), annualDividend); err != nil { | 74 | + var annualUnPaidDividend = &AnnualDividend{} |
75 | + if err := json.UnmarshalFromString(json.MarshalToString(unPaidResult), annualUnPaidDividend); err != nil { | ||
76 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
77 | + } | ||
78 | + // 2.本月分红统计 - 个人 | ||
79 | + paymentResult, err := gateway.CooperationStatistics(allied_creation_cooperation.CreditAccountStatistics, map[string]interface{}{ | ||
80 | + "userBaseId": cmd.Operator.UserBaseId, | ||
81 | + "paymentBeginTime": beginTime, | ||
82 | + "paymentEndTime": endTime, | ||
83 | + }) | ||
84 | + var annualPaymentDividend = &AnnualDividend{} | ||
85 | + if err := json.UnmarshalFromString(json.MarshalToString(paymentResult), annualPaymentDividend); err != nil { | ||
76 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 86 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
77 | } | 87 | } |
78 | dividendStatistics := map[string]interface{}{ | 88 | dividendStatistics := map[string]interface{}{ |
79 | - "dividendAmount": annualDividend.Paid + annualDividend.Unpaid, // 分红金额 annualDividend.Total | ||
80 | - "paidAmount": annualDividend.Paid, // 已支付 | ||
81 | - "unPaidAmount": annualDividend.Unpaid, // 未支付 | 89 | + "dividendAmount": annualPaymentDividend.Paid + annualUnPaidDividend.Unpaid, // 分红金额 annualDividend.Total |
90 | + "paidAmount": annualPaymentDividend.Paid, // 已支付 | ||
91 | + "unPaidAmount": annualUnPaidDividend.Unpaid, // 未支付 | ||
82 | } | 92 | } |
83 | 93 | ||
84 | return map[string]interface{}{ | 94 | return map[string]interface{}{ |
@@ -156,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | @@ -156,6 +166,9 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer | ||
156 | 166 | ||
157 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) | 167 | // CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目) |
158 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { | 168 | func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) { |
169 | + if projectQuery.Operator.UserBaseId > 0 { | ||
170 | + | ||
171 | + } | ||
159 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 172 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
160 | projectQuery.Operator) | 173 | projectQuery.Operator) |
161 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | 174 | result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ |
@@ -11,6 +11,7 @@ type ContractChangeLogItem struct { | @@ -11,6 +11,7 @@ type ContractChangeLogItem struct { | ||
11 | OperationType int `json:"operationType"` | 11 | OperationType int `json:"operationType"` |
12 | Undertakers string `json:"undertakers"` | 12 | Undertakers string `json:"undertakers"` |
13 | UpdatedAt string `json:"updatedAt"` | 13 | UpdatedAt string `json:"updatedAt"` |
14 | + OperatorTime string `json:"operationTime"` | ||
14 | } | 15 | } |
15 | 16 | ||
16 | func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem { | 17 | func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem { |
@@ -25,6 +26,7 @@ func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChan | @@ -25,6 +26,7 @@ func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChan | ||
25 | OperationType: int(v.OperationType), | 26 | OperationType: int(v.OperationType), |
26 | Undertakers: v.Undertakers, | 27 | Undertakers: v.Undertakers, |
27 | UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"), | 28 | UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"), |
29 | + OperatorTime: v.OperatorTime.Format("2006-01-02 15:04:05"), | ||
28 | } | 30 | } |
29 | listData = append(listData, item) | 31 | listData = append(listData, item) |
30 | } | 32 | } |
@@ -2,6 +2,8 @@ package service | @@ -2,6 +2,8 @@ package service | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | + "strings" | ||
6 | + | ||
5 | "github.com/linmadan/egglib-go/core/application" | 7 | "github.com/linmadan/egglib-go/core/application" |
6 | "github.com/linmadan/egglib-go/utils/excel" | 8 | "github.com/linmadan/egglib-go/utils/excel" |
7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" | 9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/excelData/command" |
@@ -9,7 +11,6 @@ import ( | @@ -9,7 +11,6 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
10 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService" | 12 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/domainService" |
11 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" | 13 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" |
12 | - "strings" | ||
13 | ) | 14 | ) |
14 | 15 | ||
15 | type ExcelDataService struct { | 16 | type ExcelDataService struct { |
@@ -119,58 +120,60 @@ func (srv ExcelDataService) ImportCompanyUser2(importDataCommand *command.Import | @@ -119,58 +120,60 @@ func (srv ExcelDataService) ImportCompanyUser2(importDataCommand *command.Import | ||
119 | 120 | ||
120 | // ImportCooperationUser 导入共创用户信息 | 121 | // ImportCooperationUser 导入共创用户信息 |
121 | func (srv ExcelDataService) ImportCooperationUser(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 122 | func (srv ExcelDataService) ImportCooperationUser(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
122 | - //initPassword, _, err := domainService.GetInitPassword(importDataCommand.Operator) | ||
123 | - //if err != nil { | ||
124 | - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
125 | - //} | ||
126 | - //excelImport := excel.NewExcelImport() | ||
127 | - //excelImport.RowBegin = 2 //第二行开始读取 | ||
128 | - //excelImport.DataFields = []excel.DataField{ | ||
129 | - // {EnName: "UserCode", CnName: "*用户编号"}, | ||
130 | - // {EnName: "UserName", CnName: "*用户姓名"}, | ||
131 | - // {EnName: "CooperationCompany", CnName: "*合伙公司"}, | ||
132 | - // {EnName: "CooperationDeadline", CnName: "*合伙到期"}, | ||
133 | - // {EnName: "Phone", CnName: "*手机号"}, | ||
134 | - // {EnName: "Email", CnName: "邮箱"}, | ||
135 | - //} | ||
136 | - //excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) | ||
137 | - //if err != nil { | ||
138 | - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
139 | - //} | ||
140 | - //users := make([]allied_creation_user.BatchAddUserItem, 0) | ||
141 | - //var fail int | ||
142 | - //for _, v := range excelData { | ||
143 | - // item := allied_creation_user.BatchAddUserItem{ | ||
144 | - // CompanyID: importDataCommand.Operator.CompanyId, | ||
145 | - // UserType: domain.UserTypeCooperation, | ||
146 | - // UserCode: v["UserCode"], | ||
147 | - // OrganizationID: int(importDataCommand.Operator.OrgId), | ||
148 | - // UserInfo: allied_creation_user.BatchAddUserItemUserInfo{ | ||
149 | - // UserName: v["UserName"], | ||
150 | - // Phone: v["Phone"], | ||
151 | - // Email: v["Email"], | ||
152 | - // }, | ||
153 | - // CooperationInfo: allied_creation_user.BatchAddUserItemCooperationInfo{ | ||
154 | - // CooperationCompany: v["CooperationCompany"], | ||
155 | - // }, | ||
156 | - // } | ||
157 | - // item.CooperationInfo.CooperationDeadline, err = time.Parse("2006-01-02", v["CooperationDeadline"]) | ||
158 | - // if err != nil { | ||
159 | - // fail++ | ||
160 | - // continue | ||
161 | - // } | ||
162 | - // users = append(users, item) | ||
163 | - //} | ||
164 | - //userGateway := allied_creation_user.NewHttplibAlliedCreationUser(importDataCommand.Operator) | ||
165 | - //result, err := userGateway.UserBatchAdd(allied_creation_user.ReqBatchAddUser{ | ||
166 | - // Users: users, | ||
167 | - // Password: initPassword, | ||
168 | - //}) | ||
169 | - //if err != nil { | ||
170 | - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
171 | - //} | ||
172 | - //return result, nil | ||
173 | - return nil, nil | 123 | + initPassword, _, err := domainService.GetInitPassword(importDataCommand.Operator) |
124 | + if err != nil { | ||
125 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
126 | + } | ||
127 | + userGateway := allied_creation_user.NewHttplibAlliedCreationUser(importDataCommand.Operator) | ||
128 | + orgResult, err := userGateway.OrgGet(allied_creation_user.ReqOrgGet{ | ||
129 | + OrgId: int(importDataCommand.Operator.OrgId), | ||
130 | + }) | ||
131 | + if err != nil { | ||
132 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
133 | + } | ||
134 | + excelImport := excel.NewExcelImport() | ||
135 | + excelImport.RowBegin = 3 //第二行开始读取 | ||
136 | + excelImport.DataFields = []excel.DataField{ | ||
137 | + {EnName: "userCode", CnName: "*用户编码"}, | ||
138 | + {EnName: "userName", CnName: "*用户姓名"}, | ||
139 | + {EnName: "cooperationCompany", CnName: "*合伙公司"}, | ||
140 | + {EnName: "cooperationDeadline", CnName: "*合伙到期"}, | ||
141 | + {EnName: "enableStatus", CnName: "*用户状态"}, | ||
142 | + {EnName: "phone", CnName: "*手机号"}, | ||
143 | + {EnName: "email", CnName: "邮箱"}, | ||
144 | + } | ||
145 | + excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) | ||
146 | + if err != nil { | ||
147 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
148 | + } | ||
149 | + users := make([]allied_creation_user.BatchAddUserItem, 0) | ||
150 | + for _, v := range excelData { | ||
151 | + if srv.fieldValueAllEmpty(v) { | ||
152 | + continue | ||
153 | + } | ||
154 | + item := allied_creation_user.BatchAddUserItem{ | ||
155 | + CompanyId: importDataCommand.Operator.CompanyId, | ||
156 | + UserType: domain.UserTypeCooperation, | ||
157 | + UserCode: v["userCode"], | ||
158 | + Org: orgResult.OrgCode, | ||
159 | + UserName: strings.TrimSpace(v["userName"]), | ||
160 | + Phone: strings.TrimSpace(v["phone"]), | ||
161 | + Email: strings.TrimSpace(v["email"]), | ||
162 | + EnableStatus: strings.TrimSpace(v["enableStatus"]), | ||
163 | + CooperationCompany: v["cooperationCompany"], | ||
164 | + CooperationDeadline: v["cooperationDeadline"], | ||
165 | + } | ||
166 | + users = append(users, item) | ||
167 | + } | ||
168 | + | ||
169 | + result, err := userGateway.UserBatchAdd(allied_creation_user.ReqBatchAddUser{ | ||
170 | + Users: users, | ||
171 | + Password: initPassword, | ||
172 | + }) | ||
173 | + if err != nil { | ||
174 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
175 | + } | ||
176 | + return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(users)), nil | ||
174 | } | 177 | } |
175 | 178 | ||
176 | // ImportCompanyUser 导入公司用户信息 | 179 | // ImportCompanyUser 导入公司用户信息 |
@@ -182,13 +185,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -182,13 +185,13 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
182 | excelImport := excel.NewExcelImport() | 185 | excelImport := excel.NewExcelImport() |
183 | excelImport.RowBegin = 3 //第二行开始读取 | 186 | excelImport.RowBegin = 3 //第二行开始读取 |
184 | excelImport.DataFields = []excel.DataField{ | 187 | excelImport.DataFields = []excel.DataField{ |
185 | - {EnName: "userCode", CnName: "*用户编号"}, | 188 | + {EnName: "userCode", CnName: "*用户编码"}, |
186 | {EnName: "userName", CnName: "*用户姓名"}, | 189 | {EnName: "userName", CnName: "*用户姓名"}, |
187 | {EnName: "org", CnName: "*组织机构"}, | 190 | {EnName: "org", CnName: "*组织机构"}, |
188 | {EnName: "department", CnName: "*所属部门"}, | 191 | {EnName: "department", CnName: "*所属部门"}, |
192 | + {EnName: "enableStatus", CnName: "*用户状态"}, | ||
189 | {EnName: "phone", CnName: "*手机号"}, | 193 | {EnName: "phone", CnName: "*手机号"}, |
190 | {EnName: "email", CnName: "邮箱"}, | 194 | {EnName: "email", CnName: "邮箱"}, |
191 | - {EnName: "enableStatus", CnName: "状态"}, | ||
192 | } | 195 | } |
193 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) | 196 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) |
194 | if err != nil { | 197 | if err != nil { |
@@ -196,21 +199,19 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -196,21 +199,19 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
196 | } | 199 | } |
197 | users := make([]allied_creation_user.BatchAddUserItem, 0) | 200 | users := make([]allied_creation_user.BatchAddUserItem, 0) |
198 | for _, v := range excelData { | 201 | for _, v := range excelData { |
202 | + if srv.fieldValueAllEmpty(v) { | ||
203 | + continue | ||
204 | + } | ||
199 | item := allied_creation_user.BatchAddUserItem{ | 205 | item := allied_creation_user.BatchAddUserItem{ |
200 | CompanyId: importDataCommand.Operator.CompanyId, | 206 | CompanyId: importDataCommand.Operator.CompanyId, |
201 | UserType: domain.UserTypeEmployee, | 207 | UserType: domain.UserTypeEmployee, |
202 | - UserCode: v["userCode"], | ||
203 | - Org: v["org"], | ||
204 | - Department: v["department"], | ||
205 | - UserName: v["userName"], | ||
206 | - Phone: v["phone"], | ||
207 | - Email: v["email"], | ||
208 | - EnableStatus: domain.UserStatusEnable, | ||
209 | - } | ||
210 | - if status, ok := v["status"]; ok { | ||
211 | - if strings.TrimSpace(status) != "启用" { | ||
212 | - item.EnableStatus = domain.UserStatusDisable | ||
213 | - } | 208 | + UserCode: strings.TrimSpace(v["userCode"]), |
209 | + Org: strings.TrimSpace(v["org"]), | ||
210 | + Department: strings.TrimSpace(v["department"]), | ||
211 | + UserName: strings.TrimSpace(v["userName"]), | ||
212 | + Phone: strings.TrimSpace(v["phone"]), | ||
213 | + Email: strings.TrimSpace(v["email"]), | ||
214 | + EnableStatus: strings.TrimSpace(v["enableStatus"]), | ||
214 | } | 215 | } |
215 | users = append(users, item) | 216 | users = append(users, item) |
216 | } | 217 | } |
@@ -222,16 +223,16 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -222,16 +223,16 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
222 | if err != nil { | 223 | if err != nil { |
223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 224 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
224 | } | 225 | } |
225 | - return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(excelData)), nil | 226 | + return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(users)), nil |
226 | } | 227 | } |
227 | 228 | ||
228 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 229 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
229 | excelImport := excel.NewExcelImport() | 230 | excelImport := excel.NewExcelImport() |
230 | - excelImport.RowBegin = 2 //第二行开始读取 | 231 | + excelImport.RowBegin = 3 //第二行开始读取 |
231 | excelImport.DataFields = []excel.DataField{ | 232 | excelImport.DataFields = []excel.DataField{ |
232 | - {EnName: "OrgCode", CnName: "*部门编码"}, | ||
233 | - {EnName: "OrgName", CnName: "*部门名称"}, | ||
234 | - {EnName: "ParentOrgCode", CnName: "*上级部门编码"}, | 233 | + {EnName: "orgCode", CnName: "*部门编码"}, |
234 | + {EnName: "orgName", CnName: "*部门名称"}, | ||
235 | + {EnName: "parentOrgCode", CnName: "*上级部门编码"}, | ||
235 | } | 236 | } |
236 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) | 237 | excelData, err := excelImport.OpenExcelFromIoReader(importDataCommand.Reader) |
237 | if err != nil { | 238 | if err != nil { |
@@ -239,11 +240,14 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -239,11 +240,14 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
239 | } | 240 | } |
240 | items := make([]allied_creation_user.BatchAddOrgItem, 0) | 241 | items := make([]allied_creation_user.BatchAddOrgItem, 0) |
241 | for _, v := range excelData { | 242 | for _, v := range excelData { |
243 | + if srv.fieldValueAllEmpty(v) { | ||
244 | + continue | ||
245 | + } | ||
242 | item := allied_creation_user.BatchAddOrgItem{ | 246 | item := allied_creation_user.BatchAddOrgItem{ |
243 | CompanyId: importDataCommand.Operator.CompanyId, | 247 | CompanyId: importDataCommand.Operator.CompanyId, |
244 | - OrgCode: v["OrgCode"], | ||
245 | - OrgName: v["OrgName"], | ||
246 | - ParentOrgCode: v["ParentOrgCode"], | 248 | + OrgCode: v["orgCode"], |
249 | + OrgName: v["orgName"], | ||
250 | + ParentOrgCode: v["parentOrgCode"], | ||
247 | } | 251 | } |
248 | items = append(items, item) | 252 | items = append(items, item) |
249 | } | 253 | } |
@@ -254,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -254,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
254 | if err != nil { | 258 | if err != nil { |
255 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 259 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
256 | } | 260 | } |
257 | - return result, nil | 261 | + return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(items)), nil |
258 | } | 262 | } |
259 | 263 | ||
260 | // 导入结果 | 264 | // 导入结果 |
@@ -281,14 +285,25 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | @@ -281,14 +285,25 @@ func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, fa | ||
281 | return result | 285 | return result |
282 | } | 286 | } |
283 | 287 | ||
288 | +func (srv ExcelDataService) fieldValueAllEmpty(param map[string]string) bool { | ||
289 | + isAllEmpty := true | ||
290 | + for _, v := range param { | ||
291 | + value := strings.TrimSpace(v) | ||
292 | + if len(value) > 0 { | ||
293 | + isAllEmpty = false | ||
294 | + } | ||
295 | + } | ||
296 | + return isAllEmpty | ||
297 | +} | ||
298 | + | ||
284 | // ImportCompanyUser 导入公司用户信息 | 299 | // ImportCompanyUser 导入公司用户信息 |
285 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 300 | func (srv ExcelDataService) FileImportTemplate(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
286 | var mapTemplate = map[string]string{ | 301 | var mapTemplate = map[string]string{ |
287 | - domain.TemplateCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
288 | - // 模板待更新 | ||
289 | - domain.TemplateOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
290 | - domain.TemplateCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | ||
291 | - domain.TemplateDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210909/object/1631171021_baB6y5zdpwC2WnsHFQhKC3dkQEaAYMNZ.xlsx", | 302 | + domain.ImportCompanyUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807485_EaxECeRz23WpzrMZmbwdEPRJ3Pdxpx5X.xlsx", |
303 | + domain.ImportOrganization: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210916/object/1631807490_r2XWhGmbWWmpbeePBkZ3EJQFKcZEMpEm.xlsx", | ||
304 | + domain.ImportDividendsOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210917/object/1631843469_DykNwexeYYtzxzbwsER5RrzCS7QRwGmd.xlsx", | ||
305 | + domain.ImportCooperationUser: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631932960_fen6RZS7ZesyDPMzXactKKCenhRMkfRb.xlsx", | ||
306 | + domain.ImportDividendsReturnOrders: "https://timeless-world.oss-cn-shenzhen.aliyuncs.com/open-api/dev_online/20210918/object/1631933214_MbTxsQtnEEMprHADFR6MedfZBkxYWBYA.xlsx", | ||
292 | } | 307 | } |
293 | var url string | 308 | var url string |
294 | var ok bool | 309 | var ok bool |
@@ -139,7 +139,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu | @@ -139,7 +139,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu | ||
139 | roleMenuBeforeEditQuery.Operator) | 139 | roleMenuBeforeEditQuery.Operator) |
140 | roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId) | 140 | roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId) |
141 | roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ | 141 | roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{ |
142 | - OrgId: roleMenuBeforeEditQuery.Operator.OrgId, | 142 | + CompanyId: roleMenuBeforeEditQuery.Operator.CompanyId, |
143 | Limit: 999, | 143 | Limit: 999, |
144 | RoleType: 1, | 144 | RoleType: 1, |
145 | }) | 145 | }) |
@@ -51,25 +51,14 @@ const ( | @@ -51,25 +51,14 @@ const ( | ||
51 | 51 | ||
52 | const ( | 52 | const ( |
53 | // 导入公司用户 | 53 | // 导入公司用户 |
54 | - ImportCompanyUser = "ImportCompanyUser" | 54 | + ImportCompanyUser = "ADMIN_SYSTEM-MANAGE_BASE_USER" |
55 | // 导入公司组织 | 55 | // 导入公司组织 |
56 | - ImportOrganization = "ImportOrganization" | 56 | + ImportOrganization = "ADMIN_SYSTEM-MANAGE_BASE_DEPARTMENT" |
57 | // 导入共创用户 | 57 | // 导入共创用户 |
58 | - ImportCooperationUser = "ImportCooperationUser" | 58 | + ImportCooperationUser = "ADMIN_SYSTEM-MANAGE_BASE_ALLIED-USER" |
59 | 59 | ||
60 | // 导入分红订单 | 60 | // 导入分红订单 |
61 | - ImportDividendsOrders = "ImportDividendsOrders" | ||
62 | -) | ||
63 | - | ||
64 | -//excel 导入模板 | ||
65 | -const ( | ||
66 | - // 导入公司用户 | ||
67 | - TemplateCompanyUser = "TemplateCompanyUser" | ||
68 | - // 导入公司组织 | ||
69 | - TemplateOrganization = "TemplateOrganization" | ||
70 | - // 导入共创用户 | ||
71 | - TemplateCooperationUser = "TemplateCooperationUser" | ||
72 | - | ||
73 | - // 分红订单模板 | ||
74 | - TemplateDividendsOrders = "TemplateDividendsOrders" | 61 | + ImportDividendsOrders = "BUSINESS_ALLIED-CREATION_BONUS_ORDER" |
62 | + // 导入退货订单 | ||
63 | + ImportDividendsReturnOrders = "BUSINESS_ALLIED-CREATION_BONUS_RETURN" | ||
75 | ) | 64 | ) |
@@ -171,6 +171,20 @@ type ( | @@ -171,6 +171,20 @@ type ( | ||
171 | 171 | ||
172 | //查询共创项目 | 172 | //查询共创项目 |
173 | type ( | 173 | type ( |
174 | + SearchCooperationProjectExtQuery struct { | ||
175 | + // 公司ID,通过集成REST上下文获取 | ||
176 | + ExtCompanyId int64 `cname:"公司ID" json:"extCompanyId,omitempty"` | ||
177 | + // 组织机构ID | ||
178 | + ExtOrgId int64 `cname:"组织机构ID" json:"extOrgId,omitempty"` | ||
179 | + // 关联的组织机构ID列表 | ||
180 | + ExtOrgIds []int64 `cname:"关联的组织机构ID列表" json:"extOrgIds,omitempty"` | ||
181 | + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
182 | + ExtUserId int64 `cname:"用户ID" json:"extUserId,omitempty"` | ||
183 | + // 用户基础数据id | ||
184 | + ExtUserBaseId int64 `cname:"用户基础数据ID" json:"extUserBaseId,omitempty"` | ||
185 | + // 共创项目承接对象,1员工,2共创用户,3公开,可多选 | ||
186 | + ExtCooperationProjectUndertakerTypes []int32 `json:"extCooperationProjectUndertakerTypes"` | ||
187 | + } | ||
174 | ReqCooperationProjectSearch struct { | 188 | ReqCooperationProjectSearch struct { |
175 | PageNumber int `json:"pageNumber"` | 189 | PageNumber int `json:"pageNumber"` |
176 | PageSize int `json:"pageSize"` | 190 | PageSize int `json:"pageSize"` |
@@ -192,6 +206,8 @@ type ( | @@ -192,6 +206,8 @@ type ( | ||
192 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | 206 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
193 | // 共创项目承接对象,1员工,2共创用户,4公开,可以多选 | 207 | // 共创项目承接对象,1员工,2共创用户,4公开,可以多选 |
194 | CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"` | 208 | CooperationProjectUndertakerType int32 `json:"cooperationProjectUndertakerType"` |
209 | + // 额外的查询条件 | ||
210 | + SearchCooperationProjectExtQueries []*SearchCooperationProjectExtQuery `cname:"额外的查询条件" json:"searchCooperationProjectExtQueries"` | ||
195 | } | 211 | } |
196 | DataCooperationProjectSearchItem struct { | 212 | DataCooperationProjectSearchItem struct { |
197 | CooperationProjectID string `json:"cooperationProjectId"` | 213 | CooperationProjectID string `json:"cooperationProjectId"` |
@@ -90,6 +90,10 @@ type ( | @@ -90,6 +90,10 @@ type ( | ||
90 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | 90 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
91 | BeginTime time.Time `json:"beginTime"` | 91 | BeginTime time.Time `json:"beginTime"` |
92 | EndTime time.Time `json:"endTime"` | 92 | EndTime time.Time `json:"endTime"` |
93 | + // 支付开始时间 | ||
94 | + PaymentBeginTime time.Time `json:"paymentBeginTime"` | ||
95 | + // 支付结束时间 | ||
96 | + PaymentEndTime time.Time `json:"paymentEndTime"` | ||
93 | // 合约编号列表 | 97 | // 合约编号列表 |
94 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` | 98 | CooperationContractNumbers []string `json:"cooperationContractNumbers"` |
95 | } | 99 | } |
@@ -226,7 +226,7 @@ func (gateway HttplibAlliedCreationUser) OrgSearch(param ReqOrgSearch) (*DataOrg | @@ -226,7 +226,7 @@ func (gateway HttplibAlliedCreationUser) OrgSearch(param ReqOrgSearch) (*DataOrg | ||
226 | return &data, err | 226 | return &data, err |
227 | } | 227 | } |
228 | 228 | ||
229 | -func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*DataBatchAddOrg, error) { | 229 | +func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*DataImportResponse, error) { |
230 | url := fmt.Sprintf("%s%s", gateway.baseUrL, "/org/batch-add") | 230 | url := fmt.Sprintf("%s%s", gateway.baseUrL, "/org/batch-add") |
231 | method := "post" | 231 | method := "post" |
232 | req := gateway.CreateRequest(url, method) | 232 | req := gateway.CreateRequest(url, method) |
@@ -252,7 +252,7 @@ func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*Dat | @@ -252,7 +252,7 @@ func (gateway HttplibAlliedCreationUser) OrgBatchAdd(param ReqBatchAddOrg) (*Dat | ||
252 | if err != nil { | 252 | if err != nil { |
253 | return nil, fmt.Errorf("解析批量添加用户:%w", err) | 253 | return nil, fmt.Errorf("解析批量添加用户:%w", err) |
254 | } | 254 | } |
255 | - var data DataBatchAddOrg | 255 | + var data DataImportResponse |
256 | err = gateway.GetResponseData(result, &data) | 256 | err = gateway.GetResponseData(result, &data) |
257 | return &data, err | 257 | return &data, err |
258 | } | 258 | } |
@@ -33,6 +33,8 @@ type ( | @@ -33,6 +33,8 @@ type ( | ||
33 | RoleName string `json:"roleName"` | 33 | RoleName string `json:"roleName"` |
34 | // 组织ID | 34 | // 组织ID |
35 | OrgId int64 `json:"orgId"` | 35 | OrgId int64 `json:"orgId"` |
36 | + // 企业id | ||
37 | + CompanyId int64 `cname:"企业id" json:"companyId"` | ||
36 | // 匹配多个组织 | 38 | // 匹配多个组织 |
37 | InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` | 39 | InOrgIds []int64 `cname:"匹配多个组织" json:"inOrgIds,omitempty"` |
38 | // 角色名称 | 40 | // 角色名称 |
@@ -393,11 +393,11 @@ type ( | @@ -393,11 +393,11 @@ type ( | ||
393 | // 部门编码 | 393 | // 部门编码 |
394 | Department string `json:"department,omitempty"` | 394 | Department string `json:"department,omitempty"` |
395 | // 状态(1:启用 2:禁用 3:注销) | 395 | // 状态(1:启用 2:禁用 3:注销) |
396 | - EnableStatus int `json:"enableStatus,omitempty"` | 396 | + EnableStatus string `json:"enableStatus,omitempty"` |
397 | // 共创公司 cooperationCompany | 397 | // 共创公司 cooperationCompany |
398 | CooperationCompany string `json:"cooperationCompany"` | 398 | CooperationCompany string `json:"cooperationCompany"` |
399 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline | 399 | // 共创到期时间 (yyyy-MM-dd) cooperationDeadline |
400 | - CooperationDeadline time.Time `json:"cooperationDeadline"` | 400 | + CooperationDeadline string `json:"cooperationDeadline"` |
401 | // 失败理由 | 401 | // 失败理由 |
402 | FailReason string `json:"failReason"` | 402 | FailReason string `json:"failReason"` |
403 | } | 403 | } |
1 | package web_client | 1 | package web_client |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "fmt" | ||
5 | + "io" | ||
4 | "strings" | 6 | "strings" |
5 | 7 | ||
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" |
@@ -43,8 +45,8 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin | @@ -43,8 +45,8 @@ func (controller *ExcelDataController) fieldValueAllEmpty(param map[string]strin | ||
43 | return isAllEmpty | 45 | return isAllEmpty |
44 | } | 46 | } |
45 | 47 | ||
46 | -//导出公司用户 | ||
47 | -func (controller *ExcelDataController) ExportCompanyUser() { | 48 | +// ExportCompanyUser 导出公司用户 |
49 | +func (controller ExcelDataController) ExportCompanyUser() { | ||
48 | excelService := service.NewExcelDataService(nil) | 50 | excelService := service.NewExcelDataService(nil) |
49 | companyUserListQuery := &query.CompanyUserListQuery{} | 51 | companyUserListQuery := &query.CompanyUserListQuery{} |
50 | err := controller.Unmarshal(companyUserListQuery) | 52 | err := controller.Unmarshal(companyUserListQuery) |
@@ -70,8 +72,8 @@ func (controller *ExcelDataController) ExportCompanyUser() { | @@ -70,8 +72,8 @@ func (controller *ExcelDataController) ExportCompanyUser() { | ||
70 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户") | 72 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出公司用户") |
71 | } | 73 | } |
72 | 74 | ||
73 | -//导出共创用户 | ||
74 | -func (controller *ExcelDataController) ExportCooperationUser() { | 75 | +// ExportCooperationUser 导出共创用户 |
76 | +func (controller ExcelDataController) ExportCooperationUser() { | ||
75 | excelService := service.NewExcelDataService(nil) | 77 | excelService := service.NewExcelDataService(nil) |
76 | companyUserListQuery := &query.CompanyUserListQuery{} | 78 | companyUserListQuery := &query.CompanyUserListQuery{} |
77 | err := controller.Unmarshal(companyUserListQuery) | 79 | err := controller.Unmarshal(companyUserListQuery) |
@@ -97,12 +99,12 @@ func (controller *ExcelDataController) ExportCooperationUser() { | @@ -97,12 +99,12 @@ func (controller *ExcelDataController) ExportCooperationUser() { | ||
97 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户") | 99 | controller.responseExcelByFile(controller.Ctx, excelTool, "导出共创用户") |
98 | } | 100 | } |
99 | 101 | ||
100 | -// ImportDividendsOrder TODO 导入分红订单 | ||
101 | -func (controller *ExcelDataController) ImportDividendsOrder() { | 102 | +// ImportDividendsOrder 导入分红订单 |
103 | +func (controller ExcelDataController) ImportDividendsOrder() { | ||
102 | importDividendsOrder(controller) | 104 | importDividendsOrder(controller) |
103 | } | 105 | } |
104 | 106 | ||
105 | -func importDividendsOrder(controller *ExcelDataController) { | 107 | +func importDividendsOrder(controller ExcelDataController) { |
106 | 108 | ||
107 | fileReader, err := controller.GetExcelFile() | 109 | fileReader, err := controller.GetExcelFile() |
108 | if err != nil { | 110 | if err != nil { |
@@ -110,7 +112,7 @@ func importDividendsOrder(controller *ExcelDataController) { | @@ -110,7 +112,7 @@ func importDividendsOrder(controller *ExcelDataController) { | ||
110 | return | 112 | return |
111 | } | 113 | } |
112 | excelImport := excel.NewExcelImport() | 114 | excelImport := excel.NewExcelImport() |
113 | - excelImport.RowBegin = 2 //第2行开始读取 | 115 | + excelImport.RowBegin = 3 //第3行开始读取 |
114 | excelImport.DataFields = []excel.DataField{ | 116 | excelImport.DataFields = []excel.DataField{ |
115 | {EnName: "OriginalOrderNum", CnName: "*来源单号"}, | 117 | {EnName: "OriginalOrderNum", CnName: "*来源单号"}, |
116 | {EnName: "DividendsCustomerName", CnName: "*客户名称"}, | 118 | {EnName: "DividendsCustomerName", CnName: "*客户名称"}, |
@@ -120,7 +122,7 @@ func importDividendsOrder(controller *ExcelDataController) { | @@ -120,7 +122,7 @@ func importDividendsOrder(controller *ExcelDataController) { | ||
120 | {EnName: "OrderGoodQuantity", CnName: "*产品数量"}, | 122 | {EnName: "OrderGoodQuantity", CnName: "*产品数量"}, |
121 | {EnName: "OrderGoodPrice", CnName: "*产品价格"}, | 123 | {EnName: "OrderGoodPrice", CnName: "*产品价格"}, |
122 | {EnName: "Expense", CnName: "费用"}, | 124 | {EnName: "Expense", CnName: "费用"}, |
123 | - {EnName: "CooperationContractNumber", CnName: "项目合约编号"}, | 125 | + {EnName: "CooperationContractNumber", CnName: "*项目合约编号"}, |
124 | } | 126 | } |
125 | excelData, err := excelImport.OpenExcelFromIoReader(fileReader) | 127 | excelData, err := excelImport.OpenExcelFromIoReader(fileReader) |
126 | if err != nil { | 128 | if err != nil { |
@@ -161,11 +163,11 @@ func importDividendsOrder(controller *ExcelDataController) { | @@ -161,11 +163,11 @@ func importDividendsOrder(controller *ExcelDataController) { | ||
161 | } | 163 | } |
162 | 164 | ||
163 | // ImportDividendsReturnedOrder 导入分红退货单 | 165 | // ImportDividendsReturnedOrder 导入分红退货单 |
164 | -func (controller *ExcelDataController) ImportDividendsReturnedOrder() { | 166 | +func (controller ExcelDataController) ImportDividendsReturnedOrder() { |
165 | importDividendsReturnedOrder(controller) | 167 | importDividendsReturnedOrder(controller) |
166 | } | 168 | } |
167 | 169 | ||
168 | -func importDividendsReturnedOrder(controller *ExcelDataController) { | 170 | +func importDividendsReturnedOrder(controller ExcelDataController) { |
169 | 171 | ||
170 | fileReader, err := controller.GetExcelFile() | 172 | fileReader, err := controller.GetExcelFile() |
171 | if err != nil { | 173 | if err != nil { |
@@ -173,7 +175,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | @@ -173,7 +175,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | ||
173 | return | 175 | return |
174 | } | 176 | } |
175 | excelImport := excel.NewExcelImport() | 177 | excelImport := excel.NewExcelImport() |
176 | - excelImport.RowBegin = 2 //第2行表头开始读取 | 178 | + excelImport.RowBegin = 3 //第2行表头开始读取 |
177 | excelImport.DataFields = []excel.DataField{ | 179 | excelImport.DataFields = []excel.DataField{ |
178 | {EnName: "OriginalOrderNum", CnName: "*来源单号"}, | 180 | {EnName: "OriginalOrderNum", CnName: "*来源单号"}, |
179 | {EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"}, | 181 | {EnName: "DividendsReturnedCustomerName", CnName: "*客户名称"}, |
@@ -183,7 +185,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | @@ -183,7 +185,7 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | ||
183 | {EnName: "RegionName", CnName: "退货区域"}, | 185 | {EnName: "RegionName", CnName: "退货区域"}, |
184 | {EnName: "OrderGoodQuantity", CnName: "*退货数量"}, | 186 | {EnName: "OrderGoodQuantity", CnName: "*退货数量"}, |
185 | {EnName: "OrderGoodPrice", CnName: "*退货价格"}, | 187 | {EnName: "OrderGoodPrice", CnName: "*退货价格"}, |
186 | - {EnName: "CooperationContractNumber", CnName: "项目合约编号"}, | 188 | + {EnName: "CooperationContractNumber", CnName: "*项目合约编号"}, |
187 | } | 189 | } |
188 | excelData, err := excelImport.OpenExcelFromIoReader(fileReader) | 190 | excelData, err := excelImport.OpenExcelFromIoReader(fileReader) |
189 | if err != nil { | 191 | if err != nil { |
@@ -223,89 +225,51 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | @@ -223,89 +225,51 @@ func importDividendsReturnedOrder(controller *ExcelDataController) { | ||
223 | controller.Response(result, nil) | 225 | controller.Response(result, nil) |
224 | } | 226 | } |
225 | 227 | ||
226 | -func (controller *ExcelDataController) ImportCompanyUser() { | ||
227 | - importCompanyUser(controller) | ||
228 | -} | ||
229 | -func importCompanyUser(controller *ExcelDataController) { | ||
230 | - excelService := service.NewExcelDataService(nil) | ||
231 | - r, err := controller.GetExcelFile() | ||
232 | - if err != nil { | ||
233 | - controller.Response(nil, err) | ||
234 | - return | ||
235 | - } | ||
236 | - cmd := &command.ImportDataCommand{} | ||
237 | - cmd.Operator = controller.GetOperator() | ||
238 | - cmd.Reader = r | ||
239 | - data, err := excelService.ImportCompanyUser(cmd) | ||
240 | - controller.Response(data, err) | ||
241 | -} | ||
242 | - | ||
243 | -func (controller *ExcelDataController) ImportCooperationUser() { | ||
244 | - importCooperationUser(controller) | ||
245 | -} | ||
246 | -func importCooperationUser(controller *ExcelDataController) { | ||
247 | - excelService := service.NewExcelDataService(nil) | ||
248 | - r, err := controller.GetExcelFile() | ||
249 | - if err != nil { | ||
250 | - controller.Response(nil, err) | ||
251 | - return | 228 | +// FileImport 文件导入 |
229 | +func (controller ExcelDataController) FileImport() { | ||
230 | + code := controller.GetString("code") | ||
231 | + switch code { | ||
232 | + case domain.ImportDividendsOrders: | ||
233 | + importDividendsOrder(controller) | ||
234 | + case domain.ImportDividendsReturnOrders: | ||
235 | + importDividendsReturnedOrder(controller) | ||
236 | + default: | ||
237 | + defaultImport(controller) | ||
252 | } | 238 | } |
253 | - cmd := &command.ImportDataCommand{} | ||
254 | - cmd.Operator = controller.GetOperator() | ||
255 | - cmd.Reader = r | ||
256 | - data, err := excelService.ImportCooperationUser(cmd) | ||
257 | - controller.Response(data, err) | ||
258 | } | 239 | } |
259 | 240 | ||
260 | -func (controller *ExcelDataController) ImportOrganization() { | 241 | +func defaultImport(controller ExcelDataController) { |
242 | + var ( | ||
243 | + data interface{} | ||
244 | + err error | ||
245 | + r io.Reader | ||
246 | + ) | ||
261 | excelService := service.NewExcelDataService(nil) | 247 | excelService := service.NewExcelDataService(nil) |
262 | - r, err := controller.GetExcelFile() | 248 | + r, err = controller.GetExcelFile() |
263 | if err != nil { | 249 | if err != nil { |
264 | controller.Response(nil, err) | 250 | controller.Response(nil, err) |
265 | return | 251 | return |
266 | } | 252 | } |
267 | cmd := &command.ImportDataCommand{} | 253 | cmd := &command.ImportDataCommand{} |
254 | + controller.ParseForm(cmd) | ||
268 | cmd.Operator = controller.GetOperator() | 255 | cmd.Operator = controller.GetOperator() |
269 | cmd.Reader = r | 256 | cmd.Reader = r |
270 | - data, err := excelService.ImportOrganization(cmd) | ||
271 | - controller.Response(data, err) | ||
272 | -} | ||
273 | - | ||
274 | -func (controller *ExcelDataController) FileImport() { | ||
275 | - // excelService := service.NewExcelDataService(nil) | ||
276 | - // r, err := controller.GetExcelFile() | ||
277 | - // if err != nil { | ||
278 | - // controller.Response(nil, err) | ||
279 | - // return | ||
280 | - // } | ||
281 | - // cmd := &command.ImportDataCommand{} | ||
282 | - //controller.Unmarshal(cmd) | ||
283 | - // controller.ParseForm(cmd) | ||
284 | - // cmd.Operator = controller.GetOperator() | ||
285 | - // cmd.Reader = r | ||
286 | - // var ( | ||
287 | - // data interface{} | ||
288 | - // err error | ||
289 | - // ) | ||
290 | - code := controller.GetString("code") | ||
291 | - switch code { | 257 | + switch cmd.Code { |
292 | case domain.ImportCompanyUser: | 258 | case domain.ImportCompanyUser: |
293 | - importCompanyUser(controller) | 259 | + data, err = excelService.ImportCompanyUser(cmd) |
294 | case domain.ImportCooperationUser: | 260 | case domain.ImportCooperationUser: |
295 | - importCooperationUser(controller) | ||
296 | - case domain.ImportDividendsOrders: | ||
297 | - importDividendsOrder(controller) | 261 | + data, err = excelService.ImportCooperationUser(cmd) |
298 | case domain.ImportOrganization: | 262 | case domain.ImportOrganization: |
299 | - importDividendsReturnedOrder(controller) | 263 | + data, err = excelService.ImportOrganization(cmd) |
264 | + default: | ||
265 | + err = fmt.Errorf("导入不存在 Code:%v", cmd.Code) | ||
300 | } | 266 | } |
301 | - // controller.Response(data, err) | 267 | + controller.Response(data, err) |
302 | } | 268 | } |
303 | 269 | ||
304 | -func (controller *ExcelDataController) FileImportTemplate() { | ||
305 | - | 270 | +func (controller ExcelDataController) FileImportTemplate() { |
306 | excelService := service.NewExcelDataService(nil) | 271 | excelService := service.NewExcelDataService(nil) |
307 | cmd := &command.ImportDataCommand{} | 272 | cmd := &command.ImportDataCommand{} |
308 | - //controller.Unmarshal(cmd) | ||
309 | code := controller.GetString(":code") | 273 | code := controller.GetString(":code") |
310 | cmd.Code = code | 274 | cmd.Code = code |
311 | var data interface{} | 275 | var data interface{} |
@@ -9,14 +9,9 @@ func init() { | @@ -9,14 +9,9 @@ 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 | web.Router("/v1/web/excel/export/cooperation-user", &web_client.ExcelDataController{}, "Post:ExportCooperationUser") |
11 | 11 | ||
12 | - web.Router("/v1/web/excel/import/company-user", &web_client.ExcelDataController{}, "Post:ImportCompanyUser") | ||
13 | - web.Router("/v1/web/excel/import/cooperation-user", &web_client.ExcelDataController{}, "Post:ImportCooperationUser") | ||
14 | - | ||
15 | web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder") | 12 | web.Router("/v1/web/excel/import/dividends-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsOrder") |
16 | web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder") | 13 | web.Router("/v1/web/excel/import/dividends-returned-orders", &web_client.ExcelDataController{}, "Post:ImportDividendsReturnedOrder") |
17 | 14 | ||
18 | - web.Router("/v1/web/excel/import/organization", &web_client.ExcelDataController{}, "Post:ImportOrganization") | ||
19 | - | ||
20 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") | 15 | web.Router("/v1/web/file-import", &web_client.ExcelDataController{}, "Post:FileImport") |
21 | web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate") | 16 | web.Router("/v1/web/file-import-template/:code", &web_client.ExcelDataController{}, "Get:FileImportTemplate") |
22 | } | 17 | } |
-
请 注册 或 登录 后发表评论