You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.5 KiB
Go
68 lines
1.5 KiB
Go
package manage
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
request "insure/dto/request/manage"
|
|
"insure/e"
|
|
"insure/service"
|
|
"insure/utils/excel"
|
|
"insure/utils/result"
|
|
)
|
|
|
|
func GetOrders(c *gin.Context) (result.Data, error) {
|
|
var req request.OrderQueryRequest
|
|
err := c.ShouldBindQuery(&req)
|
|
if err != nil {
|
|
return nil, e.NewError("参数错误")
|
|
}
|
|
orders, total := service.OrderService.GetOrders(req)
|
|
data := result.Data{
|
|
"records": orders,
|
|
"total": total,
|
|
}
|
|
return data, nil
|
|
}
|
|
|
|
func GetOrder(c *gin.Context) (result.Data, error) {
|
|
orderNo := c.DefaultQuery("orderNo", "")
|
|
if orderNo == "" {
|
|
return nil, e.NewError("参数错误")
|
|
}
|
|
order, err := service.OrderService.GetOrderByOrderNo(orderNo)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
data := result.Data{
|
|
"order": order,
|
|
}
|
|
return data, nil
|
|
}
|
|
|
|
func DownloadOrders(c *gin.Context) {
|
|
var req request.OrderQueryRequest
|
|
_ = c.ShouldBindQuery(&req)
|
|
f := service.OrderService.GenerateOrdersExcel(req)
|
|
excel.Download(f, "订单列表.xlsx", c)
|
|
}
|
|
|
|
func GetInfos(c *gin.Context) (result.Data, error) {
|
|
var req request.StudentInsureInfoQueryRequest
|
|
err := c.ShouldBindQuery(&req)
|
|
if err != nil {
|
|
return nil, e.NewError("参数错误")
|
|
}
|
|
records, total := service.StudentInsureService.GetInfos(req)
|
|
data := result.Data{
|
|
"records": records,
|
|
"total": total,
|
|
}
|
|
return data, nil
|
|
}
|
|
|
|
func DownloadInfos(c *gin.Context) {
|
|
var req request.StudentInsureInfoQueryRequest
|
|
_ = c.ShouldBindQuery(&req)
|
|
f := service.StudentInsureService.GenerateInfosExcel(req)
|
|
excel.Download(f, "学生投保信息.xlsx", c)
|
|
}
|