DengBiao 1 anno fa
parent
commit
0129c9df6c
7 ha cambiato i file con 77 aggiunte e 14 eliminazioni
  1. +23
    -0
      app/admin/hdl/hdl_data_statistics.go
  2. +5
    -2
      app/admin/md/md_central_kitchen_for_school_export_records.go
  3. +8
    -2
      app/customer/hdl/hdl_central_kitchen_for_school_order.go
  4. +8
    -5
      app/customer/md/md_order.go
  5. +19
    -1
      app/customer/svc/order/svc_central_kitchen_for_school_order.go
  6. +11
    -2
      app/db/db_central_kitchen_for_school_export_records.go
  7. +3
    -2
      app/router/admin_router.go

+ 23
- 0
app/admin/hdl/hdl_data_statistics.go Vedi File

@@ -5,6 +5,7 @@ import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/e"
"applet/app/utils"
"github.com/gin-gonic/gin"
)

@@ -72,6 +73,28 @@ func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
return
}

func CentralKitchenForSchoolDataStatisticsDelete(c *gin.Context) {
id := c.Param("id")
centralKitchenForSchoolExportRecordsDb := db.CentralKitchenForSchoolExportRecordsDb{}
centralKitchenForSchoolExportRecordsDb.Set()
centralKitchenForSchoolExportRecords, err := centralKitchenForSchoolExportRecordsDb.GetCentralKitchenForSchoolExportRecords(utils.StrToInt(id))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if centralKitchenForSchoolExportRecords == nil {
e.OutErr(c, e.ERR_NO_DATA, "未查询到相关记录")
return
}
_, err = centralKitchenForSchoolExportRecordsDb.CentralKitchenForSchoolExportRecordsDelete(id)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, "success", nil)
return
}

func CentralKitchenForSchoolDataStatisticsExport(c *gin.Context) {
var req md.CentralKitchenForSchoolDataStatisticsExportReq
err := c.ShouldBindJSON(&req)


+ 5
- 2
app/admin/md/md_central_kitchen_for_school_export_records.go Vedi File

@@ -1,8 +1,11 @@
package md

type CentralKitchenForSchoolExportRecordsListReq struct {
Page int `json:"page" label:"页码"`
Limit int `json:"limit" label:"每页数量"`
Page int `json:"page" label:"页码"`
Kind int `json:"kind" label:"导出类型"`
Limit int `json:"limit" label:"每页数量"`
StartDate string `json:"start_date" label:"起始时间"`
EndDate string `json:"end_date" label:"截止时间"`
}

type CentralKitchenForSchoolDataStatisticsExportReq struct {


+ 8
- 2
app/customer/hdl/hdl_central_kitchen_for_school_order.go Vedi File

@@ -28,9 +28,15 @@ func CentralKitchenForSchoolOrderList(c *gin.Context) {
e.OutErr(c, e.ERR, err.Error())
return
}
sumTotal, err := svc.OrderStatistic(req)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, map[string]interface{}{
"list": list,
"total": total,
"list": list,
"sum_total": sumTotal,
"total": total,
"ord_state_list": []map[string]interface{}{
{
"name": enum.CentralKitchenForSchoolPackageOrdOrdState.String(enum.CentralKitchenForSchoolPackageOrdOrdStateForWait),


+ 8
- 5
app/customer/md/md_order.go Vedi File

@@ -1,10 +1,12 @@
package md

type CentralKitchenForSchoolOrderListReq struct {
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
Limit int `json:"limit"`
Page int `json:"page" `
OrdState int `json:"ord_state" `
UserIdentityId int `json:"user_identity_id" label:"用户身份id"`
Limit int `json:"limit"`
Page int `json:"page" `
OrdState int `json:"ord_state" `
StartDate string `json:"start_date" `
EndDate string `json:"end_date" `
}

type CentralKitchenForSchoolOrderRefundReq struct {
@@ -23,7 +25,8 @@ type CentralKitchenForSchoolOrderRefundListResp struct {
OutTradeNo string `json:"out_trade_no" label:"订单号"`
OutRequestNo string `json:"out_request_no" label:"退款请求号"`
Kind int `json:"kind" label:"预定类型"`
CreateAt string `json:"create_at" label:"退款时间"`
CreateAt string `json:"create_at" label:"申请时间"`
RefundDate string `json:"refund_date" label:"退款时间"`
Date string `json:"date" label:"预定时间"`
State int `json:"state" label:"退款状态"`
Memo string `json:"memo" label:"备注"`


+ 19
- 1
app/customer/svc/order/svc_central_kitchen_for_school_order.go Vedi File

@@ -8,11 +8,13 @@ import (
"applet/app/enum"
"applet/app/utils"
"errors"
"fmt"
"time"
)

func OrderList(req md.CentralKitchenForSchoolOrderListReq) (m []model.CentralKitchenForSchoolPackageOrd, total int64, err error) {
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).Limit(req.Limit, (req.Page-1)*req.Limit)
sess := db.Db.Desc("id").Where("user_identity_id =?", req.UserIdentityId).
And("create_at >= ? And create_at <= ?", req.StartDate, req.EndDate).Limit(req.Limit, (req.Page-1)*req.Limit)
sess.And("ord_state = ?", req.OrdState)
total, err = sess.FindAndCount(&m)
if err != nil {
@@ -21,6 +23,21 @@ func OrderList(req md.CentralKitchenForSchoolOrderListReq) (m []model.CentralKit
return
}

func OrderStatistic(req md.CentralKitchenForSchoolOrderListReq) (total float64, err error) {
var sql = fmt.Sprintf("SELECT SUM(total_price) AS sum_total FROM central_kitchen_for_school_package_ord where "+
"user_identity_id = '%d' and create_at >= '%s' And create_at <= '%s' and ord_state = '%d'", req.UserIdentityId, req.StartDate, req.EndDate, req.OrdState)
mapArr1, err := db.QueryNativeString(db.Db, sql)
if err != nil {
return
}
if mapArr1 == nil {
total = 0
} else {
total = utils.StrToFloat64(mapArr1[0]["sum_total"])
}
return
}

func CentralKitchenForSchoolOrderRefund(req md.CentralKitchenForSchoolOrderRefundReq) (err error) {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
@@ -110,6 +127,7 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR
OutRequestNo: v.CentralKitchenForSchoolUserRefundDay.OutRequestNo,
Kind: v.CentralKitchenForSchoolUserWithDay.Kind,
CreateAt: v.CentralKitchenForSchoolUserRefundDay.CreateAt,
RefundDate: v.CentralKitchenForSchoolUserRefundDay.RefundDate,
Date: v.CentralKitchenForSchoolUserWithDay.Date,
State: v.CentralKitchenForSchoolUserRefundDay.State,
Memo: v.CentralKitchenForSchoolUserRefundDay.Memo,


+ 11
- 2
app/db/db_central_kitchen_for_school_export_records.go Vedi File

@@ -89,8 +89,17 @@ func (centralKitchenForSchoolExportRecordsDb *CentralKitchenForSchoolExportRecor
}

func (centralKitchenForSchoolExportRecordsDb *CentralKitchenForSchoolExportRecordsDb) CentralKitchenForSchoolExportRecordsList(req md.CentralKitchenForSchoolExportRecordsListReq) (m []model.CentralKitchenForSchoolExportRecords, total int64, err error) {
sess := centralKitchenForSchoolExportRecordsDb.Db.Desc("id").Limit(req.Limit, (req.Page-1)*req.Limit)
total, err = sess.FindAndCount(&m)
sess := centralKitchenForSchoolExportRecordsDb.Db.Desc("id")
if req.Kind != 0 {
sess.And("kind =?", req.Kind)
}
if req.StartDate != "" {
sess.And("create_at >=?", req.StartDate)
}
if req.EndDate != "" {
sess.And("create_at <=?", req.EndDate)
}
total, err = sess.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
return
}


+ 3
- 2
app/router/admin_router.go Vedi File

@@ -88,8 +88,9 @@ func rFinanceManage(r *gin.RouterGroup) {
}

func rDataStatistics(r *gin.RouterGroup) {
r.POST("/centralKitchenForSchool/export", hdl2.CentralKitchenForSchoolDataStatisticsExport) //数据统计-(央厨-学校)-导出
r.POST("/centralKitchenForSchool/list", hdl2.CentralKitchenForSchoolDataStatisticsList) //数据统计-(央厨-学校)-列表
r.POST("/centralKitchenForSchool/export", hdl2.CentralKitchenForSchoolDataStatisticsExport) //数据统计-(央厨-学校)-导出
r.POST("/centralKitchenForSchool/list", hdl2.CentralKitchenForSchoolDataStatisticsList) //数据统计-(央厨-学校)-列表
r.DELETE("/centralKitchenForSchool/delete/:id", hdl2.CentralKitchenForSchoolDataStatisticsDelete) //数据统计-(央厨-学校)-列表

}



Caricamento…
Annulla
Salva