...
|
...
|
@@ -9,6 +9,7 @@ import ( |
|
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/command"
|
|
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/query"
|
|
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/suMoney/service"
|
|
|
"os"
|
|
|
"path"
|
|
|
"strconv"
|
|
|
)
|
...
|
...
|
@@ -341,7 +342,6 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
return
|
|
|
}
|
|
|
// TODO 增加导入失败原因返回
|
|
|
|
|
|
var response utils.JsonResponse
|
|
|
dataList := make([]interface{}, 0)
|
|
|
rows, _ := xlsx.GetRows("Sheet1")
|
...
|
...
|
@@ -354,7 +354,7 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
for _, _ = range row {
|
|
|
createExchangeCashPersonCommand.ExchangeCashActivityId = activityId
|
|
|
// TODO 非空校验
|
|
|
if createExchangeCashPersonCommand.PersonName == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{
|
|
|
if row[0] == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{
|
|
|
controller.Ctx.WriteString( "空字段" )
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -363,7 +363,6 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
createExchangeCashPersonCommand.PersonAccount = row[1]
|
|
|
createExchangeCashPersonCommand.ExchangedSuMoney, _ = strconv.ParseFloat(row[2], 64)
|
|
|
}
|
|
|
|
|
|
data, err := cashPoolService.CreateExchangeCashPerson(createExchangeCashPersonCommand)
|
|
|
if err != nil {
|
|
|
response = utils.ResponseError(controller.Ctx, err)
|
...
|
...
|
@@ -458,12 +457,26 @@ func (controller *SuMoneyController) ExportExchangeList() { |
|
|
}
|
|
|
}
|
|
|
f.SetActiveSheet(index)
|
|
|
|
|
|
// 创建下载文件夹
|
|
|
mkErr :=os.Mkdir("download", os.ModePerm)
|
|
|
if err!=nil{
|
|
|
fmt.Println(mkErr)
|
|
|
}
|
|
|
|
|
|
//保存为文件
|
|
|
f.Path="public/file/素币兑换清单.xlsx"
|
|
|
f.Path="download/素币兑换清单.xlsx"
|
|
|
if err := f.Save(); err != nil {
|
|
|
fmt.Println(err)
|
|
|
}
|
|
|
|
|
|
controller.Ctx.Output.Download(f.Path,"素币兑换清单.xlsx")
|
|
|
|
|
|
// 下载完成删除文件
|
|
|
removeErr := os.Remove(f.Path)
|
|
|
if err != nil {
|
|
|
fmt.Println(removeErr)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|