...
|
...
|
@@ -103,18 +103,7 @@ func (controller ExcelDataController) ImportDividendsOrder() { |
|
|
}
|
|
|
|
|
|
func importDividendsOrder(controller ExcelDataController) {
|
|
|
// excelFile, fileHeader, err := controller.GetFile("file")
|
|
|
// if err != nil {
|
|
|
// log.Logger.Error("接收文件失败," + err.Error())
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
// }
|
|
|
// if filepath.Ext(fileHeader.Filename) != ".xlsx" {
|
|
|
//TODO 判断文件类型
|
|
|
// log.Logger.Error("获取到的文件:" + fileHeader.Filename)
|
|
|
// controller.Response(nil, errors.New("上传到的文件类型错误"))
|
|
|
// return
|
|
|
// }
|
|
|
|
|
|
fileReader, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
...
|
...
|
@@ -177,18 +166,7 @@ func (controller ExcelDataController) ImportDividendsReturnedOrder() { |
|
|
}
|
|
|
|
|
|
func importDividendsReturnedOrder(controller ExcelDataController) {
|
|
|
// excelFile, fileHeader, err := controller.GetFile("file")
|
|
|
// if err != nil {
|
|
|
// log.Logger.Error("接收文件失败," + err.Error())
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
// }
|
|
|
// if filepath.Ext(fileHeader.Filename) != ".xlsx" {
|
|
|
//TODO 判断文件类型
|
|
|
// log.Logger.Error("获取到的文件:" + filepath.Ext(fileHeader.Filename))
|
|
|
// controller.Response(nil, errors.New("上传的文件类型错误"))
|
|
|
// return
|
|
|
// }
|
|
|
|
|
|
fileReader, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
...
|
...
|
@@ -246,6 +224,9 @@ func importDividendsReturnedOrder(controller ExcelDataController) { |
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) ImportCompanyUser() {
|
|
|
importCompanyUser(controller)
|
|
|
}
|
|
|
func importCompanyUser(controller ExcelDataController) {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
r, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
...
|
...
|
@@ -288,21 +269,25 @@ func (controller ExcelDataController) ImportOrganization() { |
|
|
}
|
|
|
|
|
|
func (controller ExcelDataController) FileImport() {
|
|
|
excelService := service.NewExcelDataService(nil)
|
|
|
r, err := controller.GetExcelFile()
|
|
|
if err != nil {
|
|
|
controller.Response(nil, err)
|
|
|
return
|
|
|
}
|
|
|
cmd := &command.ImportDataCommand{}
|
|
|
// excelService := service.NewExcelDataService(nil)
|
|
|
// r, err := controller.GetExcelFile()
|
|
|
// if err != nil {
|
|
|
// controller.Response(nil, err)
|
|
|
// return
|
|
|
// }
|
|
|
// cmd := &command.ImportDataCommand{}
|
|
|
//controller.Unmarshal(cmd)
|
|
|
controller.ParseForm(cmd)
|
|
|
cmd.Operator = controller.GetOperator()
|
|
|
cmd.Reader = r
|
|
|
var data interface{}
|
|
|
switch cmd.Code {
|
|
|
// controller.ParseForm(cmd)
|
|
|
// cmd.Operator = controller.GetOperator()
|
|
|
// cmd.Reader = r
|
|
|
var (
|
|
|
data interface{}
|
|
|
err error
|
|
|
)
|
|
|
code := controller.GetString("code")
|
|
|
switch code {
|
|
|
case domain.ImportCompanyUser:
|
|
|
data, err = excelService.ImportCompanyUser(cmd)
|
|
|
importCompanyUser(controller)
|
|
|
case domain.ImportCooperationUser:
|
|
|
case domain.ImportDividendsOrders:
|
|
|
importDividendsOrder(controller)
|
...
|
...
|
|