Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
4 个修改的文件
包含
46 行增加
和
28 行删除
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-20210826 | 2 | +ENV APP_DIR $GOPATH/src/project-20210908 |
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 |
@@ -14,7 +14,10 @@ type CompanyDividendsService struct { | @@ -14,7 +14,10 @@ type CompanyDividendsService struct { | ||
14 | func (srv CompanyStatisticsService) GetDividendContracts(cmd *command.GetDividendContractsCommand) (interface{}, error) { | 14 | func (srv CompanyStatisticsService) GetDividendContracts(cmd *command.GetDividendContractsCommand) (interface{}, error) { |
15 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | 15 | gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( |
16 | cmd.Operator) | 16 | cmd.Operator) |
17 | - result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, cmd) | 17 | + result, err := gateway.CooperationStatistics(allied_creation_cooperation.GetContractDividends, map[string]interface{}{ |
18 | + "contractId": cmd.ContractId, | ||
19 | + "companyId": cmd.Operator.CompanyId, | ||
20 | + }) | ||
18 | if err != nil { | 21 | if err != nil { |
19 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 22 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
20 | } | 23 | } |
@@ -44,6 +44,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -44,6 +44,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
44 | 44 | ||
45 | // 模式列表 | 45 | // 模式列表 |
46 | var modeStatistics []CooperationModeStatistics | 46 | var modeStatistics []CooperationModeStatistics |
47 | + var responseModeStatistics []CooperationModeStatistics | ||
47 | var modeNumbers []string | 48 | var modeNumbers []string |
48 | err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics) | 49 | err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics) |
49 | if err != nil { | 50 | if err != nil { |
@@ -54,19 +55,35 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -54,19 +55,35 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
54 | } | 55 | } |
55 | 56 | ||
56 | var cooperationModes = make([]interface{}, 0) | 57 | var cooperationModes = make([]interface{}, 0) |
57 | - if len(modeNumbers) > 0 { | ||
58 | - models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{ | ||
59 | - PageSize: domain.NormalQueryRowCount, | ||
60 | - PageNumber: 1, | ||
61 | - CompanyId: cmd.Operator.CompanyId, | ||
62 | - //OrgId: cmd.Operator.OrgId, | ||
63 | - CooperationModeNumbers: modeNumbers, | ||
64 | - }) | ||
65 | - if err != nil { | ||
66 | - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
67 | - } | 58 | + models, err := gateway.CooperationModesSearch(allied_creation_cooperation.ReqCooperationModesSearch{ |
59 | + PageSize: domain.NormalQueryRowCount, | ||
60 | + PageNumber: 1, | ||
61 | + CompanyId: cmd.Operator.CompanyId, | ||
62 | + OrgId: cmd.Operator.OrgId, | ||
63 | + //CooperationModeNumbers: modeNumbers, | ||
64 | + }) | ||
65 | + if err != nil { | ||
66 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
67 | + } | ||
68 | + mapModels := make(map[string]CooperationModeStatistics) | ||
69 | + for i := range responseModeStatistics { | ||
70 | + item := responseModeStatistics[i] | ||
71 | + mapModels[item.CooperationModeNumber] = item | ||
72 | + } | ||
73 | + if len(models.List) > 0 { | ||
68 | for i := range models.List { | 74 | for i := range models.List { |
69 | item := models.List[i] | 75 | item := models.List[i] |
76 | + if value, ok := mapModels[item.CooperationModeNumber]; !ok { | ||
77 | + responseModeStatistics = append(responseModeStatistics, CooperationModeStatistics{ | ||
78 | + CooperationPeople: 0, | ||
79 | + DividendsEstimate: 0, | ||
80 | + OrderAmount: 0, | ||
81 | + CooperationModeNumber: item.CooperationModeNumber, | ||
82 | + SettlementAmount: 0, | ||
83 | + }) | ||
84 | + } else { | ||
85 | + responseModeStatistics = append(responseModeStatistics, value) | ||
86 | + } | ||
70 | cooperationModes = append(cooperationModes, map[string]interface{}{ | 87 | cooperationModes = append(cooperationModes, map[string]interface{}{ |
71 | "cooperationModeId": item.CooperationModeId, | 88 | "cooperationModeId": item.CooperationModeId, |
72 | "cooperationModeName": item.CooperationModeName, | 89 | "cooperationModeName": item.CooperationModeName, |
@@ -90,6 +107,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -90,6 +107,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
90 | PageSize: 1, | 107 | PageSize: 1, |
91 | CompanyId: cmd.Operator.CompanyId, | 108 | CompanyId: cmd.Operator.CompanyId, |
92 | OrgId: cmd.Operator.OrgId, | 109 | OrgId: cmd.Operator.OrgId, |
110 | + Status: 1, | ||
93 | }) | 111 | }) |
94 | if err != nil { | 112 | if err != nil { |
95 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 113 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
@@ -115,7 +133,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -115,7 +133,7 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
115 | return map[string]interface{}{ | 133 | return map[string]interface{}{ |
116 | "projectOverviewStatistics": projectOverviewStatistics, | 134 | "projectOverviewStatistics": projectOverviewStatistics, |
117 | "currentMonthDividendsStatistics": companyDividendsStatistics, | 135 | "currentMonthDividendsStatistics": companyDividendsStatistics, |
118 | - "cooperationModeStatistics": cooperationModeStatistics, | 136 | + "cooperationModeStatistics": responseModeStatistics, |
119 | "cooperationGoodsStatistics": cooperationGoodsStatistics, | 137 | "cooperationGoodsStatistics": cooperationGoodsStatistics, |
120 | "cooperationModes": cooperationModes, | 138 | "cooperationModes": cooperationModes, |
121 | }, nil | 139 | }, nil |
@@ -202,7 +220,7 @@ type CooperationModeStatistics struct { | @@ -202,7 +220,7 @@ type CooperationModeStatistics struct { | ||
202 | // 共创人数 | 220 | // 共创人数 |
203 | CooperationPeople float64 `json:"cooperationPeople"` | 221 | CooperationPeople float64 `json:"cooperationPeople"` |
204 | // 分红预算 | 222 | // 分红预算 |
205 | - DividendsEstimate string `json:"dividendsEstimate"` | 223 | + DividendsEstimate float64 `json:"dividendsEstimate"` |
206 | // 订单金额 | 224 | // 订单金额 |
207 | OrderAmount float64 `json:"orderAmount"` | 225 | OrderAmount float64 `json:"orderAmount"` |
208 | // 共创模式编号 | 226 | // 共创模式编号 |
@@ -180,11 +180,11 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -180,11 +180,11 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
180 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 180 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
181 | } | 181 | } |
182 | excelImport := excel.NewExcelImport() | 182 | excelImport := excel.NewExcelImport() |
183 | - excelImport.RowBegin = 2 //第二行开始读取 | 183 | + excelImport.RowBegin = 3 //第二行开始读取 |
184 | excelImport.DataFields = []excel.DataField{ | 184 | excelImport.DataFields = []excel.DataField{ |
185 | {EnName: "userCode", CnName: "*用户编号"}, | 185 | {EnName: "userCode", CnName: "*用户编号"}, |
186 | {EnName: "userName", CnName: "*用户姓名"}, | 186 | {EnName: "userName", CnName: "*用户姓名"}, |
187 | - {EnName: "organization", CnName: "*组织机构"}, | 187 | + {EnName: "org", CnName: "*组织机构"}, |
188 | {EnName: "department", CnName: "*所属部门"}, | 188 | {EnName: "department", CnName: "*所属部门"}, |
189 | {EnName: "phone", CnName: "*手机号"}, | 189 | {EnName: "phone", CnName: "*手机号"}, |
190 | {EnName: "email", CnName: "邮箱"}, | 190 | {EnName: "email", CnName: "邮箱"}, |
@@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
200 | CompanyId: importDataCommand.Operator.CompanyId, | 200 | CompanyId: importDataCommand.Operator.CompanyId, |
201 | UserType: domain.UserTypeEmployee, | 201 | UserType: domain.UserTypeEmployee, |
202 | UserCode: v["userCode"], | 202 | UserCode: v["userCode"], |
203 | - Org: v["organization"], | 203 | + Org: v["org"], |
204 | Department: v["department"], | 204 | Department: v["department"], |
205 | UserName: v["userName"], | 205 | UserName: v["userName"], |
206 | Phone: v["phone"], | 206 | Phone: v["phone"], |
@@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
222 | if err != nil { | 222 | if err != nil { |
223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
224 | } | 224 | } |
225 | - return srv.importResultWithHeader(map[string]interface{}{ | ||
226 | - "userCode": "*用户编号", | ||
227 | - "userName": "*用户姓名", | ||
228 | - "organization": "*组织机构", | ||
229 | - "department": "*所属部门", | ||
230 | - "phone": "*手机号", | ||
231 | - "email": "邮箱", | ||
232 | - "enableStatus": "状态", | ||
233 | - }, result.FailRows, len(excelData)), nil | 225 | + return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(excelData)), nil |
234 | } | 226 | } |
235 | 227 | ||
236 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 228 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
@@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
266 | } | 258 | } |
267 | 259 | ||
268 | // 导入结果 | 260 | // 导入结果 |
269 | -func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} { | 261 | +func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, failRows []interface{}, totalRow int) interface{} { |
270 | var result = map[string]interface{}{ | 262 | var result = map[string]interface{}{ |
271 | "successCount": 0, | 263 | "successCount": 0, |
272 | "fail": struct{}{}, | 264 | "fail": struct{}{}, |
@@ -278,6 +270,11 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows | @@ -278,6 +270,11 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows | ||
278 | fail := map[string]interface{}{ | 270 | fail := map[string]interface{}{ |
279 | "body": failRows, | 271 | "body": failRows, |
280 | } | 272 | } |
273 | + var header = make(map[string]string) | ||
274 | + for i := 0; i < len(headers); i++ { | ||
275 | + item := headers[i] | ||
276 | + header[item.EnName] = item.CnName | ||
277 | + } | ||
281 | fail["header"] = header | 278 | fail["header"] = header |
282 | result["fail"] = fail | 279 | result["fail"] = fail |
283 | } | 280 | } |
-
请 注册 或 登录 后发表评论