|
@@ -422,6 +422,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
//订单列表 |
|
|
//订单列表 |
|
|
fileName = "订单列表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
fileName = "订单列表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
|
|
|
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) |
|
|
|
|
|
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) |
|
|
|
|
|
|
|
|
//查找订单数据 |
|
|
//查找订单数据 |
|
|
sess := db.Db.Desc("central_kitchen_for_school_package_ord.id") |
|
|
sess := db.Db.Desc("central_kitchen_for_school_package_ord.id") |
|
|
sess.And("central_kitchen_for_school_package_ord.state =?", enum.CentralKitchenForSchoolPackageOrdStateForSuccess) |
|
|
sess.And("central_kitchen_for_school_package_ord.state =?", enum.CentralKitchenForSchoolPackageOrdStateForSuccess) |
|
@@ -473,9 +476,22 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
exportOutTradeNoList = append(exportOutTradeNoList, v.OutTradeNo) |
|
|
exportOutTradeNoList = append(exportOutTradeNoList, v.OutTradeNo) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
titleList = []string{"订单号", "学生姓名", "学校", "年级", "班级", "家长电话", "预定日期", "预定天数", "订单价格", "支付时间", "订单状态"} |
|
|
|
|
|
|
|
|
titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " 退款申请表"} |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
|
|
|
|
|
|
titleList = []string{"订单号", "学生姓名", "学校", "年级", "班级", "家长电话", "预定日期", "预定天数", "订单价格", "支付时间", "订单状态"} |
|
|
|
|
|
xlsx.SetSheetRow("Sheet1", "A2", &titleList) |
|
|
|
|
|
|
|
|
|
|
|
xlsx.MergeCell("Sheet1", "A1", "K1") //合并单元格 |
|
|
|
|
|
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
logx.Error(err) |
|
|
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error()) |
|
|
|
|
|
panic(err) |
|
|
|
|
|
} |
|
|
|
|
|
xlsx.SetCellStyle("Sheet1", "A1", "K1", style) |
|
|
|
|
|
xlsx.SetColWidth("Sheet1", "A", "k", 20) |
|
|
|
|
|
|
|
|
|
|
|
j := 3 //表头前两行用了,只能从第三行开始 |
|
|
for _, v := range m { |
|
|
for _, v := range m { |
|
|
if !utils.InArr(v.OutTradeNo, exportOutTradeNoList) { |
|
|
if !utils.InArr(v.OutTradeNo, exportOutTradeNoList) { |
|
|
continue |
|
|
continue |
|
@@ -530,6 +546,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
//退款申请表 |
|
|
//退款申请表 |
|
|
fileName = "退款申请表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
fileName = "退款申请表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
|
|
|
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) |
|
|
|
|
|
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) |
|
|
|
|
|
|
|
|
//查找退款申请数据 |
|
|
//查找退款申请数据 |
|
|
sess := db.Db.Desc("central_kitchen_for_school_user_refund_day.id") |
|
|
sess := db.Db.Desc("central_kitchen_for_school_user_refund_day.id") |
|
|
if req.EnterpriseId != 0 { |
|
|
if req.EnterpriseId != 0 { |
|
@@ -561,9 +580,23 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport2>>>>>Error:::", err.Error()) |
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport2>>>>>Error:::", err.Error()) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
titleList = []string{"学生姓名", "学校", "年级", "班级", "家长电话", "退款日期", "餐型", "退款金额", "退款状态", "支付时间", "退款操作时间"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " 退款申请表"} |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
|
|
|
|
|
|
titleList = []string{"学生姓名", "学校", "年级", "班级", "家长电话", "退款日期", "餐型", "退款金额", "退款状态", "支付时间", "退款操作时间"} |
|
|
|
|
|
xlsx.SetSheetRow("Sheet1", "A2", &titleList) |
|
|
|
|
|
|
|
|
|
|
|
xlsx.MergeCell("Sheet1", "A1", "K1") //合并单元格 |
|
|
|
|
|
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
logx.Error(err) |
|
|
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error()) |
|
|
|
|
|
panic(err) |
|
|
|
|
|
} |
|
|
|
|
|
xlsx.SetCellStyle("Sheet1", "A1", "K1", style) |
|
|
|
|
|
xlsx.SetColWidth("Sheet1", "A", "k", 20) |
|
|
|
|
|
|
|
|
|
|
|
j := 3 //表头前两行用了,只能从第三行开始 |
|
|
for _, v := range m { |
|
|
for _, v := range m { |
|
|
var kind string //就餐类型(1:早餐 2:午餐 3:晚餐) |
|
|
var kind string //就餐类型(1:早餐 2:午餐 3:晚餐) |
|
|
switch v.CentralKitchenForSchoolUserWithDay.Kind { |
|
|
switch v.CentralKitchenForSchoolUserWithDay.Kind { |
|
@@ -1100,6 +1133,9 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
//收款统计表 |
|
|
//收款统计表 |
|
|
fileName = "收款统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
fileName = "收款统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
|
|
|
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) |
|
|
|
|
|
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) |
|
|
|
|
|
|
|
|
//查找数据 |
|
|
//查找数据 |
|
|
var m []model.Enterprise |
|
|
var m []model.Enterprise |
|
|
sess := db.Db.Desc("id") |
|
|
sess := db.Db.Desc("id") |
|
@@ -1113,9 +1149,22 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
titleList = []string{"学校名称", "预定总费用", "退款总计", "实收费用", "预估费率"} |
|
|
|
|
|
|
|
|
titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " 收款统计表"} |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
|
|
|
|
|
|
titleList = []string{"学校名称", "预定总费用", "退款总计", "实收费用", "预估费率"} |
|
|
|
|
|
xlsx.SetSheetRow("Sheet1", "A2", &titleList) |
|
|
|
|
|
|
|
|
|
|
|
xlsx.MergeCell("Sheet1", "A1", "E1") //合并单元格 |
|
|
|
|
|
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
logx.Error(err) |
|
|
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error()) |
|
|
|
|
|
panic(err) |
|
|
|
|
|
} |
|
|
|
|
|
xlsx.SetCellStyle("Sheet1", "A1", "E1", style) |
|
|
|
|
|
xlsx.SetColWidth("Sheet1", "A", "E", 20) |
|
|
|
|
|
|
|
|
|
|
|
j := 3 //表头前两行用了,只能从第三行开始 |
|
|
for _, v := range m { |
|
|
for _, v := range m { |
|
|
var income, refund string |
|
|
var income, refund string |
|
|
//统计收入 |
|
|
//统计收入 |
|
@@ -1347,6 +1396,8 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
//学校预定数量统计表 |
|
|
//学校预定数量统计表 |
|
|
fileName = "学校预定数量统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
fileName = "学校预定数量统计表_" + utils.Int64ToStr(now.UnixMilli()) + ".xlsx" |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
downloadPath = "/export/central_kitchen_for_school/" + fileName |
|
|
|
|
|
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.StartDate, time.Local) |
|
|
|
|
|
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.EndDate, time.Local) |
|
|
|
|
|
|
|
|
var m []*db.CentralKitchenForSchoolPackageOrdForReserveWithUserIdentity |
|
|
var m []*db.CentralKitchenForSchoolPackageOrdForReserveWithUserIdentity |
|
|
sess := db.Db.Desc("central_kitchen_for_school_package_ord_for_reserve.id") |
|
|
sess := db.Db.Desc("central_kitchen_for_school_package_ord_for_reserve.id") |
|
@@ -1387,9 +1438,22 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD |
|
|
list[v.Enterprise.Name] += count |
|
|
list[v.Enterprise.Name] += count |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
titleList = []string{"学校名称", "预定总数"} |
|
|
|
|
|
|
|
|
titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " 收款统计表"} |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
xlsx.SetSheetRow("Sheet1", "A1", &titleList) |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
|
|
|
|
|
|
titleList = []string{"学校名称", "预定总数"} |
|
|
|
|
|
xlsx.SetSheetRow("Sheet1", "A2", &titleList) |
|
|
|
|
|
|
|
|
|
|
|
xlsx.MergeCell("Sheet1", "A1", "B1") //合并单元格 |
|
|
|
|
|
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
logx.Error(err) |
|
|
|
|
|
println("<<<<CentralKitchenForSchoolDataStatisticsExport3>>>>>Error:::", err.Error()) |
|
|
|
|
|
panic(err) |
|
|
|
|
|
} |
|
|
|
|
|
xlsx.SetCellStyle("Sheet1", "A1", "B1", style) |
|
|
|
|
|
xlsx.SetColWidth("Sheet1", "A", "B", 40) |
|
|
|
|
|
|
|
|
|
|
|
j := 3 //表头前两行用了,只能从第三行开始 |
|
|
for k, v := range list { |
|
|
for k, v := range list { |
|
|
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{k, v}) |
|
|
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{k, v}) |
|
|
j++ |
|
|
j++ |
|
@@ -1529,7 +1593,7 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo |
|
|
panic(err) |
|
|
panic(err) |
|
|
} |
|
|
} |
|
|
xlsx.SetCellStyle(k3, "A1", "B1", style) |
|
|
xlsx.SetCellStyle(k3, "A1", "B1", style) |
|
|
xlsx.SetColWidth(k3, "A", "B", 20) |
|
|
|
|
|
|
|
|
xlsx.SetColWidth(k3, "A", "B", 40) |
|
|
|
|
|
|
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
j := 2 //表头被第一行用了,只能从第二行开始 |
|
|
for k4, v4 := range v3 { |
|
|
for k4, v4 := range v3 { |
|
|