DengBiao пре 1 година
родитељ
комит
f95a8b79af
2 измењених фајлова са 49 додато и 28 уклоњено
  1. +48
    -27
      app/admin/svc/svc_data_statisstics.go
  2. +1
    -1
      go.mod

+ 48
- 27
app/admin/svc/svc_data_statisstics.go Прегледај датотеку

@@ -1722,35 +1722,56 @@ func CentralKitchenForSchoolDataStatisticsContrast(req md.CentralKitchenForSchoo
startDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date1[0], time.Local)
endDate, _ := time.ParseInLocation("2006-01-02 15:04:05", req.Date2[0], time.Local)

for k2, v2 := range v1 {
if k2 == "" {
//若年级为空,则为教师
continue
}

for k3, v3 := range v2 {
xlsx.NewSheet(k3)
titleList = []string{startDate.Format("2006-01") + "~~" + endDate.Format("2006-01") + " [" + k1 + ", " + k3 + "] 订餐数据对比"}
xlsx.SetSheetRow(k3, "A1", &titleList)
titleList = []string{"姓名", "家长联系电话"}
xlsx.SetSheetRow(k3, "A2", &titleList)
xlsx.MergeCell(k3, "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)
//查询当前学校下的班级升序
tmpEnterpriseDb := db.EnterpriseDb{}
tmpEnterpriseDb.Set()
tmpEnterprise, err11 := tmpEnterpriseDb.GetEnterpriseByName(k1)
if err11 != nil {
logx.Error(err11)
println("<<<<CentralKitchenForSchoolDataStatisticsExport4>>>>>Error:::", err11.Error())
panic(err11)
}
tmpClassDb := db.ClassDb{}
tmpClassDb.Set(0)
classList, err := tmpClassDb.FindClassAscByEnterprise(tmpEnterprise.Id)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
for _, class := range *classList {
for k2, v2 := range v1 {
if k2 == "" {
//若年级为空,则为教师
continue
}
xlsx.SetCellStyle(k3, "A1", "B1", style)
xlsx.SetColWidth(k3, "A", "B", 40)
for k3, v3 := range v2 {
if class.Name != k3 {
continue
}
xlsx.NewSheet(k3)
titleList = []string{startDate.Format("2006-01") + "~~" + endDate.Format("2006-01") + " [" + k1 + ", " + k3 + "] 订餐数据对比"}
xlsx.SetSheetRow(k3, "A1", &titleList)
titleList = []string{"姓名", "家长联系电话"}
xlsx.SetSheetRow(k3, "A2", &titleList)
xlsx.MergeCell(k3, "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(k3, "A1", "B1", style)
xlsx.SetColWidth(k3, "A", "B", 40)

j := 2 //表头被第一行用了,只能从第二行开始
for k4, v4 := range v3 {
//TODO::判断当前用户是否在新的月份里面
if list1[k1] == nil || list1[k1][k2] == nil || list1[k1][k2][k3] == nil || list1[k1][k2][k3][k4] == "" {
xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{
k4, v4})
j++
j := 2 //表头被第一行用了,只能从第二行开始
for k4, v4 := range v3 {
//TODO::判断当前用户是否在新的月份里面
if list1[k1] == nil || list1[k1][k2] == nil || list1[k1][k2][k3] == nil || list1[k1][k2][k3][k4] == "" {
xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{
k4, v4})
j++
}
}
}
}


+ 1
- 1
go.mod Прегледај датотеку

@@ -17,6 +17,7 @@ require (
github.com/gomodule/redigo v2.0.0+incompatible
github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831
github.com/mcuadros/go-defaults v1.2.0
github.com/medivhzhan/weapp/v2 v2.5.0
github.com/qiniu/api.v7/v7 v7.8.2
github.com/robfig/cron/v3 v3.0.1
github.com/sony/sonyflake v1.0.0
@@ -45,7 +46,6 @@ require (
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/medivhzhan/weapp/v2 v2.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect


Loading…
Откажи
Сачувај