diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 2981019..2eb996f 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -391,7 +391,8 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta } var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2 - sess := db.Db.Desc("self_support_for_school_ord.id").Where("self_support_for_school_ord.order_status =?", enum.SelfSupportForSchoolOrdOrderStatusForSuccess) + eg := db.Db + sess := eg.Desc("self_support_for_school_ord.id").Where("self_support_for_school_ord.order_status =?", enum.SelfSupportForSchoolOrdOrderStatusForSuccess) if req.EnterpriseId != 0 { sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) } @@ -417,7 +418,12 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta var data = map[string]map[string]map[string]map[string]map[string]float64{} for _, vv := range m { device := deviceListMapping[vv.SelfSupportForSchoolOrd.DeviceSn] + ordCreateAt, _ := time.ParseInLocation("2006-01-02 15:04:05", vv.SelfSupportForSchoolOrd.CreateAt, time.Local) + merchantCreateAt, _ := time.ParseInLocation("2006-01-02 15:04:05", merchantListMapping[device.MerchantId].CreateAt, time.Local) shopName := merchantListMapping[device.MerchantId].Name + if ordCreateAt.Before(merchantCreateAt) { + shopName = "设备已更换商户" + } deviceName := device.Name if data[vv.Enterprise.Name] == nil { data[vv.Enterprise.Name] = make(map[string]map[string]map[string]map[string]float64)