|
@@ -437,10 +437,38 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport1>>>>>Error:::", err.Error()) |
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport1>>>>>Error:::", err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查找预定数据 |
|
|
|
|
|
var outTradeNoList []string |
|
|
|
|
|
for _, v := range m { |
|
|
|
|
|
outTradeNoList = append(outTradeNoList, v.OutTradeNo) |
|
|
|
|
|
} |
|
|
|
|
|
var mm []model.CentralKitchenForSchoolPackageOrdForReserve |
|
|
|
|
|
sess1 := db.Db.Desc("id") |
|
|
|
|
|
if req.EnterpriseId != 0 { |
|
|
|
|
|
sess1.And("enterprise_id = ?", req.EnterpriseId) |
|
|
|
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess1.In("kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
|
|
|
err = sess1.In("out_trade_no", outTradeNoList).Find(&mm) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
logx.Error(err) |
|
|
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport1>>>>>Error:::", err.Error()) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
var exportOutTradeNoList []string |
|
|
|
|
|
for _, v := range mm { |
|
|
|
|
|
exportOutTradeNoList = append(exportOutTradeNoList, v.OutTradeNo) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
titleList = []string{"订单号", "学生姓名", "学校", "年级", "班级", "家长电话", "预定日期", "预定天数", "订单价格", "支付时间", "订单状态"} |
|
|
titleList = []string{"订单号", "学生姓名", "学校", "年级", "班级", "家长电话", "预定日期", "预定天数", "订单价格", "支付时间", "订单状态"} |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
for _, v := range m { |
|
|
for _, v := range m { |
|
|
|
|
|
if !utils.InArr(v.OutTradeNo, exportOutTradeNoList) { |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
var ordState string //订单状态(0:待支付 1:预约成功 2:退款中 3:部分退款 4:已退款 5:已完成) |
|
|
var ordState string //订单状态(0:待支付 1:预约成功 2:退款中 3:部分退款 4:已退款 5:已完成) |
|
|
switch v.CentralKitchenForSchoolPackageOrd.OrdState { |
|
|
switch v.CentralKitchenForSchoolPackageOrd.OrdState { |
|
|
case enum.CentralKitchenForSchoolPackageOrdOrdStateForWait: |
|
|
case enum.CentralKitchenForSchoolPackageOrdOrdStateForWait: |
|
@@ -502,6 +530,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EndDate != "" { |
|
|
if req.EndDate != "" { |
|
|
sess.And("central_kitchen_for_school_user_refund_day.create_at <= ?", req.EndDate) |
|
|
sess.And("central_kitchen_for_school_user_refund_day.create_at <= ?", req.EndDate) |
|
|
} |
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
var m []*db.CentralKitchenForSchoolUserRefundDayWithData |
|
|
var m []*db.CentralKitchenForSchoolUserRefundDayWithData |
|
|
_, err := sess. |
|
|
_, err := sess. |
|
|
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). |
|
|
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). |
|
@@ -574,6 +605,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EndDate != "" { |
|
|
if req.EndDate != "" { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
} |
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
_, err := sess. |
|
|
_, 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", "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"). |
|
|
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). |
|
@@ -715,6 +749,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EndDate != "" { |
|
|
if req.EndDate != "" { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
} |
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
_, err := sess. |
|
|
_, 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", "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"). |
|
|
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). |
|
@@ -858,6 +895,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EndDate != "" { |
|
|
if req.EndDate != "" { |
|
|
sess.And("central_kitchen_for_school_user_refund_day.create_at <= ?", req.EndDate) |
|
|
sess.And("central_kitchen_for_school_user_refund_day.create_at <= ?", req.EndDate) |
|
|
} |
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess.In("central_kitchen_for_school_user_with_day.kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
var m []*db.CentralKitchenForSchoolUserRefundDayWithData |
|
|
var m []*db.CentralKitchenForSchoolUserRefundDayWithData |
|
|
_, err := sess. |
|
|
_, err := sess. |
|
|
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). |
|
|
Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). |
|
@@ -1220,6 +1260,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
if req.EndDate != "" { |
|
|
if req.EndDate != "" { |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
sess.And("central_kitchen_for_school_package_ord_for_reserve.meal_time_start <= ?", req.EndDate) |
|
|
} |
|
|
} |
|
|
|
|
|
if len(req.MealKindList) > 0 { |
|
|
|
|
|
sess.In("central_kitchen_for_school_package_ord_for_reserve.kind", req.MealKindList) |
|
|
|
|
|
} |
|
|
_, err := sess. |
|
|
_, 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", "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"). |
|
|
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). |
|
|