master
wubin 5 years ago
parent a4d6a44960
commit b37c5331e4

@ -51,7 +51,7 @@ func GetBaseAccessTopByAreaCode(c *gin.Context) {
if directly == "1" {
//获取中省直的学校
schoolArr := make([]string, 0)
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(areaCode, "-1")
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(areaCode, "-1", directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
@ -312,7 +312,7 @@ func GetDistrictBaseInfo(c *gin.Context) {
schoolArr := make([]string, 0)
if directly == "1" {
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1")
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1", directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,

@ -66,14 +66,12 @@ func PageEduAssistInfoByDistrictCode(districtCode string, directly string) ([]Sc
2020-06-30
xxbxlxm -1
*/
func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string) ([]SchoolModel.School, error) {
func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string, directly string) ([]SchoolModel.School, error) {
enableFlagTerm := elastic.NewTermQuery("enable_flag", 1)
delFlagTerm := elastic.NewTermQuery("del_flag", 0)
var districtCodeTerm *elastic.TermQuery
cityFlag := 0
if strings.HasSuffix(districtCode, "00") { //市
districtCodeTerm = elastic.NewTermQuery("city_code", districtCode)
cityFlag = 1
} else { //区
districtCodeTerm = elastic.NewTermQuery("district_code", districtCode)
}
@ -81,7 +79,7 @@ func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string) ([]School
orgTypeTerm := elastic.NewTermQuery("data_content.org_type", "2")
var boolQuery *elastic.BoolQuery
if xxbxlxm == "-1" {
if cityFlag == 1 {
if directly == "1" {
interfaceArr := CommonUtil.ConvertStringArrToInterfaceArr([]string{"360", "811", "821"})
directlyUnderTypeTerms := elastic.NewTermsQuery("data_content.xxjbzm", interfaceArr...)
boolQuery = elastic.NewBoolQuery().Must(enableFlagTerm, delFlagTerm, districtCodeTerm, orgTypeTerm, directlyUnderTypeTerms)
@ -91,7 +89,7 @@ func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string) ([]School
} else {
xxbxlxmTerm := elastic.NewTermQuery("school_type", xxbxlxm)
if cityFlag == 1 {
if directly == "1" {
interfaceArr := CommonUtil.ConvertStringArrToInterfaceArr([]string{"360", "811", "821"})
directlyUnderTypeTerms := elastic.NewTermsQuery("data_content.xxjbzm", interfaceArr...)
boolQuery = elastic.NewBoolQuery().Must(enableFlagTerm, delFlagTerm, districtCodeTerm, orgTypeTerm, xxbxlxmTerm, directlyUnderTypeTerms)

@ -11,13 +11,13 @@ import (
2020-06-30
xxbxlxm -1
*/
func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string) ([]SchoolModel.School, error) {
arr, err := SchoolDao.PageSchoolInfoByDistrictCode(districtCode, xxbxlxm)
func PageSchoolInfoByDistrictCode(districtCode string, xxbxlxm string, directly string) ([]SchoolModel.School, error) {
arr, err := SchoolDao.PageSchoolInfoByDistrictCode(districtCode, xxbxlxm, directly)
return arr, err
}
func PageEduAssistInfoByDistrictCode(districtCode string,directly string) ([]SchoolModel.EduAssist, error) {
arr, err := SchoolDao.PageEduAssistInfoByDistrictCode(districtCode,directly)
func PageEduAssistInfoByDistrictCode(districtCode string, directly string) ([]SchoolModel.EduAssist, error) {
arr, err := SchoolDao.PageEduAssistInfoByDistrictCode(districtCode, directly)
return arr, err
}
@ -57,9 +57,10 @@ func GetOrgTotalCount(areaCode string, orgType string) (int, error) {
count, err := SchoolDao.GetOrgTotalCount(areaCode, orgType)
return count, err
}
/**
*/
*/
func GetDirectlyUnderOrgTotalCount(areaCode string, orgType string) (int, error) {
count, err := SchoolDao.GetDirectlyUnderOrgTotalCount(areaCode, orgType)
return count, err
@ -90,7 +91,7 @@ func GetBaseAccessTop(areaCode string, topNum string) ([]SchoolModel.BaseAccessT
return arr, err
}
func GetBaseDirectlyUnderAccessTop(schoolIds []string, topNum string)([]SchoolModel.BaseAccessTopAggsOrgId, error) {
func GetBaseDirectlyUnderAccessTop(schoolIds []string, topNum string) ([]SchoolModel.BaseAccessTopAggsOrgId, error) {
arr, err := SchoolDao.GetBaseDirectlyUnderAccessTop(schoolIds, topNum)
return arr, err
}
@ -108,4 +109,4 @@ func GetCityDirectlySchoolCount(cityCode string) (int, error) {
func GetCityDirectlyEduAssistCount(cityCode string) (int, error) {
count, err := SchoolDao.GetCityDirectlyEduAssistCount(cityCode)
return count, err
}
}

@ -83,10 +83,14 @@ func GetStudentCountAggsOrgByDistrict(c *gin.Context) {
districtCode := c.Query("districtCode")
//学校办学类型 -1为全部
xxbxlx := c.Query("xxbxlx")
directly := ""
if strings.HasSuffix(districtCode, "00") { //市
directly = "1"
}
//获取学校的数组
schoolArr := make([]string, 0)
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, xxbxlx)
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, xxbxlx, directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
@ -138,42 +142,42 @@ func GetStudentCountAggsOrgByDistrict(c *gin.Context) {
*/
func GetStudentCountAggsXxbxlxByArea(c *gin.Context) {
areaCode := c.Query("areaCode")
directly := c.Query("directly")
cityCode := ""
districtCode := ""
if strings.HasSuffix(areaCode, "00") { //市
if directly == "1" {
districtCode = areaCode
} else {
cityCode = areaCode
}
cityCode = areaCode
} else { //区
districtCode = areaCode
}
//获取区的数组
districtArr := make([]string, 0)
if len(cityCode) > 0 {
//获取区信息
areaInfo, err := AreaService.PageDistrictByCityCode(cityCode, "-1")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
for i := range areaInfo {
districtArr = append(districtArr, areaInfo[i].AreaCode)
//directly=1说明获取的是中省市,不需要根据市编码获取区的数组
if directly == "1" {
if len(cityCode) > 0 {
//获取区信息
areaInfo, err := AreaService.PageDistrictByCityCode(cityCode, "-1")
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
Message: err.Error(),
})
return
}
for i := range areaInfo {
districtArr = append(districtArr, areaInfo[i].AreaCode)
}
districtArr = append(districtArr, areaCode)
}
districtArr = append(districtArr, areaCode)
}
//获取学校的数组
schoolArr := make([]string, 0)
if len(districtCode) > 0 {
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1")
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1", directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,

@ -168,10 +168,14 @@ func GetTeacherCountAggsSchoolByDistrict(c *gin.Context) {
districtCode := c.Query("districtCode")
//学校办学类型 -1为全部
xxbxlx := c.Query("xxbxlx")
directly := ""
if strings.HasSuffix(districtCode, "00") { //市
directly = "1"
}
//获取学校的数组
schoolArr := make([]string, 0)
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, xxbxlx)
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, xxbxlx, directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,
@ -258,7 +262,7 @@ func GetTeacherCountAggsXxbxlxByArea(c *gin.Context) {
//获取学校的数组
schoolArr := make([]string, 0)
if len(districtCode) > 0 {
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1")
schoolInfo, err := SchoolService.PageSchoolInfoByDistrictCode(districtCode, "-1", directly)
if err != nil {
c.JSON(http.StatusOK, Model.Res{
Success: false,

Loading…
Cancel
Save