...
|
...
|
@@ -341,7 +341,7 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
// TODO 增加导入失败原因返回
|
|
|
// TODO 增加非空校验,导入失败原因返回
|
|
|
var response utils.JsonResponse
|
|
|
dataList := make([]interface{}, 0)
|
|
|
rows, _ := xlsx.GetRows("Sheet1")
|
...
|
...
|
@@ -353,9 +353,9 @@ func (controller *SuMoneyController) ImportExchangeList () { |
|
|
if i > 2 {
|
|
|
for _, _ = range row {
|
|
|
createExchangeCashPersonCommand.ExchangeCashActivityId = activityId
|
|
|
// TODO 非空校验
|
|
|
if row[0] == "" || createExchangeCashPersonCommand.PersonAccount == "" || createExchangeCashPersonCommand.ExchangedSuMoney == 0{
|
|
|
controller.Ctx.WriteString( "空字段" )
|
|
|
r2, _ := strconv.ParseFloat(row[2], 64)
|
|
|
if row[0] == "" || row[1] == "" || r2 == 0 {
|
|
|
controller.Ctx.WriteString("单元格包含空字段")
|
|
|
return
|
|
|
}
|
|
|
createExchangeCashPersonCommand.Operator = operator
|
...
|
...
|
@@ -402,7 +402,6 @@ func (controller *SuMoneyController) ExportExchangeList() { |
|
|
cashPoolService := service.NewCashPoolService(nil)
|
|
|
exportExchangeCashListCommand := &command.ExportExchangeCashListCommand{}
|
|
|
json.Unmarshal(controller.Ctx.Input.GetData("requestBody").([]byte), exportExchangeCashListCommand)
|
|
|
fmt.Print(exportExchangeCashListCommand, "\n")
|
|
|
// 列标题
|
|
|
titles := []string{
|
|
|
"姓名","手机账号","已兑换现金","已兑换素币",
|
...
|
...
|
@@ -423,7 +422,6 @@ func (controller *SuMoneyController) ExportExchangeList() { |
|
|
}
|
|
|
data = append(data, p)
|
|
|
}
|
|
|
fmt.Print(data, "\n")
|
|
|
var response utils.JsonResponse
|
|
|
if err != nil {
|
|
|
response = utils.ResponseError(controller.Ctx, err)
|
...
|
...
|
@@ -457,21 +455,17 @@ func (controller *SuMoneyController) ExportExchangeList() { |
|
|
}
|
|
|
}
|
|
|
f.SetActiveSheet(index)
|
|
|
|
|
|
// 创建下载文件夹
|
|
|
mkErr :=os.Mkdir("download", os.ModePerm)
|
|
|
if err!=nil{
|
|
|
fmt.Println(mkErr)
|
|
|
}
|
|
|
|
|
|
//保存为文件
|
|
|
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 {
|
...
|
...
|
|