正在显示
1 个修改的文件
包含
22 行增加
和
37 行删除
@@ -103,18 +103,7 @@ func (controller ExcelDataController) ImportDividendsOrder() { | @@ -103,18 +103,7 @@ func (controller ExcelDataController) ImportDividendsOrder() { | ||
103 | } | 103 | } |
104 | 104 | ||
105 | func importDividendsOrder(controller ExcelDataController) { | 105 | func importDividendsOrder(controller ExcelDataController) { |
106 | - // excelFile, fileHeader, err := controller.GetFile("file") | ||
107 | - // if err != nil { | ||
108 | - // log.Logger.Error("接收文件失败," + err.Error()) | ||
109 | - // controller.Response(nil, err) | ||
110 | - // return | ||
111 | - // } | ||
112 | - // if filepath.Ext(fileHeader.Filename) != ".xlsx" { | ||
113 | - //TODO 判断文件类型 | ||
114 | - // log.Logger.Error("获取到的文件:" + fileHeader.Filename) | ||
115 | - // controller.Response(nil, errors.New("上传到的文件类型错误")) | ||
116 | - // return | ||
117 | - // } | 106 | + |
118 | fileReader, err := controller.GetExcelFile() | 107 | fileReader, err := controller.GetExcelFile() |
119 | if err != nil { | 108 | if err != nil { |
120 | controller.Response(nil, err) | 109 | controller.Response(nil, err) |
@@ -177,18 +166,7 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { | @@ -177,18 +166,7 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { | ||
177 | } | 166 | } |
178 | 167 | ||
179 | func importDividendsReturnedOrder(controller ExcelDataController) { | 168 | func importDividendsReturnedOrder(controller ExcelDataController) { |
180 | - // excelFile, fileHeader, err := controller.GetFile("file") | ||
181 | - // if err != nil { | ||
182 | - // log.Logger.Error("接收文件失败," + err.Error()) | ||
183 | - // controller.Response(nil, err) | ||
184 | - // return | ||
185 | - // } | ||
186 | - // if filepath.Ext(fileHeader.Filename) != ".xlsx" { | ||
187 | - //TODO 判断文件类型 | ||
188 | - // log.Logger.Error("获取到的文件:" + filepath.Ext(fileHeader.Filename)) | ||
189 | - // controller.Response(nil, errors.New("上传的文件类型错误")) | ||
190 | - // return | ||
191 | - // } | 169 | + |
192 | fileReader, err := controller.GetExcelFile() | 170 | fileReader, err := controller.GetExcelFile() |
193 | if err != nil { | 171 | if err != nil { |
194 | controller.Response(nil, err) | 172 | controller.Response(nil, err) |
@@ -246,6 +224,9 @@ func importDividendsReturnedOrder(controller ExcelDataController) { | @@ -246,6 +224,9 @@ func importDividendsReturnedOrder(controller ExcelDataController) { | ||
246 | } | 224 | } |
247 | 225 | ||
248 | func (controller ExcelDataController) ImportCompanyUser() { | 226 | func (controller ExcelDataController) ImportCompanyUser() { |
227 | + importCompanyUser(controller) | ||
228 | +} | ||
229 | +func importCompanyUser(controller ExcelDataController) { | ||
249 | excelService := service.NewExcelDataService(nil) | 230 | excelService := service.NewExcelDataService(nil) |
250 | r, err := controller.GetExcelFile() | 231 | r, err := controller.GetExcelFile() |
251 | if err != nil { | 232 | if err != nil { |
@@ -288,21 +269,25 @@ func (controller ExcelDataController) ImportOrganization() { | @@ -288,21 +269,25 @@ func (controller ExcelDataController) ImportOrganization() { | ||
288 | } | 269 | } |
289 | 270 | ||
290 | func (controller ExcelDataController) FileImport() { | 271 | func (controller ExcelDataController) FileImport() { |
291 | - excelService := service.NewExcelDataService(nil) | ||
292 | - r, err := controller.GetExcelFile() | ||
293 | - if err != nil { | ||
294 | - controller.Response(nil, err) | ||
295 | - return | ||
296 | - } | ||
297 | - cmd := &command.ImportDataCommand{} | 272 | + // excelService := service.NewExcelDataService(nil) |
273 | + // r, err := controller.GetExcelFile() | ||
274 | + // if err != nil { | ||
275 | + // controller.Response(nil, err) | ||
276 | + // return | ||
277 | + // } | ||
278 | + // cmd := &command.ImportDataCommand{} | ||
298 | //controller.Unmarshal(cmd) | 279 | //controller.Unmarshal(cmd) |
299 | - controller.ParseForm(cmd) | ||
300 | - cmd.Operator = controller.GetOperator() | ||
301 | - cmd.Reader = r | ||
302 | - var data interface{} | ||
303 | - switch cmd.Code { | 280 | + // controller.ParseForm(cmd) |
281 | + // cmd.Operator = controller.GetOperator() | ||
282 | + // cmd.Reader = r | ||
283 | + var ( | ||
284 | + data interface{} | ||
285 | + err error | ||
286 | + ) | ||
287 | + code := controller.GetString("code") | ||
288 | + switch code { | ||
304 | case domain.ImportCompanyUser: | 289 | case domain.ImportCompanyUser: |
305 | - data, err = excelService.ImportCompanyUser(cmd) | 290 | + importCompanyUser(controller) |
306 | case domain.ImportCooperationUser: | 291 | case domain.ImportCooperationUser: |
307 | case domain.ImportDividendsOrders: | 292 | case domain.ImportDividendsOrders: |
308 | importDividendsOrder(controller) | 293 | importDividendsOrder(controller) |
-
请 注册 或 登录 后发表评论