Ver a proveniência

update

add_mode
DengBiao há 1 ano
ascendente
cometimento
1f5b78c836
3 ficheiros alterados com 52 adições e 19 eliminações
  1. +2
    -0
      app/admin/md/md_enterprise_manage.go
  2. +45
    -0
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  3. +5
    -19
      app/db/db_central_kitchen_for_school_user_with_day.go

+ 2
- 0
app/admin/md/md_enterprise_manage.go Ver ficheiro

@@ -280,6 +280,8 @@ type CentralKitchenForSchoolReserveListResp struct {
ReserveMonth string `json:"reserve_month"`
TotalPrice string `json:"total_price"`
CreateAt string `json:"create_at"`
State int `json:"state"`
StateZh string `json:"state_zh"`
Phone string `json:"phone" label:"家长联系电话"`
Grade string `json:"grade" label:"年级"`
GradeId int `json:"grade_id" label:"年级id"`


+ 45
- 0
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go Ver ficheiro

@@ -829,6 +829,49 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
// continue
//}

//获取当前预定记录下有多少退款记录
var state = 1
var stateZh = "已支付"

centralKitchenForSchoolUserWithDayDb := db.CentralKitchenForSchoolUserWithDayDb{}
centralKitchenForSchoolUserWithDayDb.Set(0)
count1, err1 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoV2(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum2.CentralKitchenForSchoolUserWithDayStateForCanceling,
v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind)
if err1 != nil {
return nil, 0, err1
}
if count1 > 0 {
state = 2
stateZh = "退款中"
} else {
count2, err2 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoV2(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum2.CentralKitchenForSchoolUserWithDayStateForCancel,
v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind)
if err1 != nil {
return nil, 0, err2
}
if count2 > 0 {
state = 3
stateZh = "部分退款"

count3, err3 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoV2(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum2.CentralKitchenForSchoolUserWithDayStateForWait,
v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind)
if err1 != nil {
return nil, 0, err3
}
if count3 == 0 {
count4, err4 := centralKitchenForSchoolUserWithDayDb.CountCentralKitchenForSchoolUserWithDayByOrdNoV2(v.CentralKitchenForSchoolPackageOrdForReserve.OutTradeNo, enum2.CentralKitchenForSchoolUserWithDayStateForAlready,
v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeStart, v.CentralKitchenForSchoolPackageOrdForReserve.MealTimeEnd, v.CentralKitchenForSchoolPackageOrdForReserve.Kind)
if err1 != nil {
return nil, 0, err4
}
if count4 == 0 {
state = 4
stateZh = "已退款"
}
}
}
}

resp = append(resp, md.CentralKitchenForSchoolReserveListResp{
Id: v.CentralKitchenForSchoolPackageOrdForReserve.Id,
EnterpriseId: v.UserIdentity.EnterpriseId,
@@ -846,6 +889,8 @@ func CentralKitchenForSchoolReserveList(req md.CentralKitchenForSchoolReserveLis
GradeId: v.Grade.Id,
Class: v.Class.Name,
ClassId: v.Class.Id,
State: state,
StateZh: stateZh,
})
}
return


+ 5
- 19
app/db/db_central_kitchen_for_school_user_with_day.go Ver ficheiro

@@ -77,26 +77,12 @@ func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb
return count, nil
}

func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoV2(ordNo string, state int, startDate, endDate string, kindList []int) (count int64, err error) {
func (centralKitchenForSchoolUserWithDayDb *CentralKitchenForSchoolUserWithDayDb) CountCentralKitchenForSchoolUserWithDayByOrdNoV2(ordNo string, state int, startDate, endDate string, kind int) (count int64, err error) {
var m model.CentralKitchenForSchoolUserWithDay

sess := centralKitchenForSchoolUserWithDayDb.Db.NewSession()
sess = sess.Where("1=1")
if ordNo != "" {
sess.And("ord_no =?", ordNo)
}
if state != 0 {
sess.And("state !=?", state)
}
if startDate != "" {
sDate, _ := time.ParseInLocation("2006-01-02", startDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02", endDate, time.Local)
sess.And("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02"))
}
if len(kindList) > 0 {
sess.In("kind", kindList)
}
count, err = sess.Count(&m)
count, err = centralKitchenForSchoolUserWithDayDb.Db.Where("ord_no =?", ordNo).And("state =?", state).
And("date >= ?", startDate).And("date <= ?", endDate).
And("kind = ?", kind).
Count(&m)
return count, nil
}



Carregando…
Cancelar
Guardar