增加导出-提现记录

This commit is contained in:
2023-11-13 16:22:24 +08:00
parent b0db2dd29a
commit d05ea66f01
7 changed files with 385 additions and 133 deletions
+6 -30
View File
@@ -1,11 +1,11 @@
package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"hospital-admin-api/api/dao"
"hospital-admin-api/api/requests"
"hospital-admin-api/api/responses"
"hospital-admin-api/api/service"
"hospital-admin-api/global"
"hospital-admin-api/utils"
)
@@ -28,44 +28,20 @@ func (r *Export) DoctorWithdrawal(c *gin.Context) {
return
}
if req.Page == 0 {
req.Page = 1
}
if req.PageSize == 0 {
req.PageSize = 20
}
doctorWithdrawalDao := dao.DoctorWithdrawalDao{}
doctorWithdrawal, total, err := doctorWithdrawalDao.GetDoctorWithdrawalExportListSearch(req, req.Page, req.PageSize)
doctorWithdrawals, err := doctorWithdrawalDao.GetDoctorWithdrawalExportListSearch(req)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
fmt.Println(doctorWithdrawal)
fmt.Println(total)
header := []utils.CellData{
{Value: "医生姓名", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "医生手机号", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "申请提现金额", CellType: "float", NumberFmt: "0.0000", ColWidth: 18},
{Value: "审核日期", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
}
_, err = utils.Export(header)
// 业务处理
exportService := service.ExportService{}
ossAddress, err := exportService.DoctorWithdrawal(doctorWithdrawals)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
// 处理返回值
// res := dto.GetDoctorWithdrawalListDto(doctorWithdrawal)
//
// result := make(map[string]interface{})
// result["page"] = req.Page
// result["page_size"] = req.PageSize
// result["total"] = total
// result["data"] = res
responses.Ok(c)
responses.OkWithData(ossAddress, c)
}