DengBiao преди 1 година
родител
ревизия
eeae82f01d
променени са 1 файла, в които са добавени 3 реда и са изтрити 49 реда
  1. +3
    -49
      app/admin/svc/svc_data_statisstics.go

+ 3
- 49
app/admin/svc/svc_data_statisstics.go Целия файл

@@ -643,22 +643,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}

var filterOrdNo []string
if req.StartDate != "" {
var mm []*model.CentralKitchenForSchoolUserWithDay
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
err := db.Db.Where("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end <= ?", sDate.Format("2006-01-02"), eDate.Format("2006-01-02"))
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -666,10 +654,6 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -851,21 +835,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}
var filterOrdNo []string
if req.StartDate != "" {
var mm []*model.CentralKitchenForSchoolUserWithDay
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
err := db.Db.Where("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end <= ?", sDate.Format("2006-01-02"), eDate.Format("2006-01-02"))
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -873,10 +846,6 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
@@ -1493,21 +1462,10 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if req.EnterpriseId != 0 {
sess.And("central_kitchen_for_school_package_ord_for_reserve.enterprise_id =?", req.EnterpriseId)
}
var filterOrdNo []string
if req.StartDate != "" {
var mm []*model.CentralKitchenForSchoolUserWithDay
sDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local)
eDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local)
err := db.Db.Where("date >= ?", sDate.Format("2006-01-02")).And("date <= ?", eDate.Format("2006-01-02")).GroupBy("ord_no").Find(&mm)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error())
return
}
for _, m := range mm {
filterOrdNo = append(filterOrdNo, m.OrdNo)
}
//sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end >= ?", req.StartDate, req.EndDate)
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start >= ? and central_kitchen_for_school_package_ord_for_reserve.meal_time_end <= ?", sDate.Format("2006-01-02"), eDate.Format("2006-01-02"))
}
//if req.EndDate != "" {
// sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate)
@@ -1515,10 +1473,6 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD
if len(req.MealKindList) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList)
}
if len(filterOrdNo) > 0 {
sess.In("central_kitchen_for_school_package_ord_for_reserve.out_trade_no", filterOrdNo)
}

_, err := sess.
Join("LEFT", "central_kitchen_for_school_package_ord", "central_kitchen_for_school_package_ord_for_reserve.out_trade_no = central_kitchen_for_school_package_ord.out_trade_no").
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").


Зареждане…
Отказ
Запис