package logic import ( "context" "errors" "fmt" "github.com/fonchain_enterprise/fonchain-main/pkg/es" "github.com/fonchain_enterprise/fonchain-main/pkg/service/es_service/approval/common" "github.com/fonchain_enterprise/fonchain-main/pkg/service/es_service/approval/model" "github.com/olivere/elastic/v7" "go.uber.org/zap" "reflect" ) func Search(index string, value interface{}, filter *elastic.BoolQuery, page, pageSize int) (total int64, ret []*model.EsApproval, err error) { searchResult, err := es.ElasticClient.Search(). Index(index). Query(buildAllQuery(value, filter)). From((page-1)*pageSize). Size(pageSize). Sort("ID", false). Do(context.TODO()) if err != nil { zap.L().Error("es_search error", zap.Error(err)) fmt.Println("================================= es_search error ================================") fmt.Println("err : ", err.Error()) fmt.Println("================================= es_search error ================================") return 0, nil, errors.New(common.ErrorQueryApproval) } var typ model.EsApproval ret = make([]*model.EsApproval, 0) for _, item := range searchResult.Each(reflect.TypeOf(typ)) { fmt.Println("================================= range item ================================") fmt.Printf("item %+v\n\n", item.(model.EsApproval)) fmt.Println("================================= range item 1 ================================") t := item.(model.EsApproval) //tt := approval.CreateRequest{} //_ = copier.CopyWithOption(&tt, t, copier.Option{DeepCopy: true}) t.Object = RenderHTML(t) ret = append(ret, &t) } return searchResult.TotalHits(), ret, nil } // buildAllQuery 构建包含嵌套查询的布尔查询 func buildAllQuery(value interface{}, filter *elastic.BoolQuery) *elastic.BoolQuery { query := filter fmt.Println("================================= buildAllQuery valueQuery ================================") if value != nil { fmt.Println("================================= buildAllQuery valueQuery in ================================") //valueQuery := elastic.NewBoolQuery().MinimumShouldMatch("1") valueQuery := elastic.NewBoolQuery() //valueQuery.Should(ContentQuery(value)) valueQuery.Should(GroupNameQuery(value)) valueQuery.Should(NowUserNameQuery(value)) valueQuery.Should(TypeQuery(value)) valueQuery.Should(TypeNameQuery(value)) valueQuery.Should(ReplyQuery(value)) valueQuery.Should(SubmitterNameQuery(value)) valueQuery.Should(workFlowsQuery(value)) valueQuery.Should(approvalOAObjectRevokeReasonQuery(value)) valueQuery.Should(approvalOABusinessTripObjectReasonQuery(value)) valueQuery.Should(approvalOABusinessTripObjectItineraryListNestedQuery(value)) valueQuery.Should(approvalOAGoOutObjectReasonQuery(value)) valueQuery.Should(approvalOAGoOutObjectVerifyFileQuery(value)) valueQuery.Should(approvalOAGoOutObjectApplyTimesNestedQuery(value)) valueQuery.Should(approvalOALeaveObjectReasonQuery(value)) valueQuery.Should(approvalOALeaveObjectVerifyFileQuery(value)) valueQuery.Should(approvalOALeaveObjectApplyTimesNestedQuery(value)) valueQuery.Should(approvalOALeaveApplyObjectReasonQuery(value)) valueQuery.Should(approvalOALeaveApplyObjectVerifyFileQuery(value)) valueQuery.Should(approvalOAMakeUpObjectReasonQuery(value)) valueQuery.Should(approvalOAMakeUpObjectApplyTimesNestedQuery(value)) valueQuery.Should(approvalOAOutWorkObjectReasonQuery(value)) valueQuery.Should(approvalOAOutWorkObjectOutWorkAddressQuery(value)) valueQuery.Should(approvalOAOutWorkObjectApplyTimesNestedQuery(value)) valueQuery.Should(approvalOAOverTimeObjectReasonQuery(value)) valueQuery.Should(approvalOAOverTimeObjectApplyTimesNestedQuery(value)) valueQuery.Should(approvalOATurnoverObjectReasonQuery(value)) valueQuery.Should(approvalOATurnoverObjectHandoverNameQuery(value)) valueQuery.Should(approvalOATurnoverObjectHandoverNumQuery(value)) valueQuery.Should(approvalOATurnoverObjectJoinTimeQuery(value)) valueQuery.Should(approvalOATurnoverObjectLeftTimeQuery(value)) valueQuery.Should(approvalOATurnoverObjectStaffNameQuery(value)) valueQuery.Should(approvalOATurnoverObjectStaffNumQuery(value)) valueQuery.Should(approvalOATurnoverObjectSuperviseNameQuery(value)) valueQuery.Should(approvalOATurnoverObjectSuperviseNumQuery(value)) valueQuery.Should(approvalOATurnoverObjectWorkItemsQuery(value)) valueQuery.Should(approvalOATurnoverObjectContactInfoQuery(value)) valueQuery.Should(approvalOATurnoverObjectItineraryListNestedQuery(value)) valueQuery.Should(bundlePayPriceObjectArtistNameQuery(value)) valueQuery.Should(bundlePayPriceObjectShowAddressQuery(value)) valueQuery.Should(bundlePayPriceObjectShowLowPriceQuery(value)) valueQuery.Should(bundlePayPriceObjectArtworkSizeQuery(value)) valueQuery.Should(bundlePayPriceObjectShowNameQuery(value)) valueQuery.Should(checkInObjectDetailAddressQuery(value)) valueQuery.Should(checkInObjectSaleAddressQuery(value)) valueQuery.Should(customizeInfoNestedQuery(value)) valueQuery.Should(employNestedQuery(value)) valueQuery.Should(exhibitionObjectAddressQuery(value)) valueQuery.Should(exhibitionObjectPackageNameQuery(value)) valueQuery.Should(exhibitionObjectNestedQuery(value)) valueQuery.Should(exhibitionHisObjectAddressQuery(value)) valueQuery.Should(exhibitionHisObjectPackageNameQuery(value)) valueQuery.Should(exhibitionHisObjectNestedQuery(value)) valueQuery.Should(financialFormNestedQuery(value)) valueQuery.Should(promotionNestedQuery(value)) //query.Should(returnArtworkInfoNestedQuery(value)) valueQuery.Should(showNestedQuery(value)) valueQuery.Should(staffSupplyNestedQuery(value)) valueQuery.Should(workNestedQuery(value)) valueQuery.Should(copyUsersQuery(value)) query.Must(valueQuery) fmt.Println("================================= buildAllQuery valueQuery out ================================") } fmt.Println("================================= buildAllQuery query ================================") source, err := query.Source() fmt.Printf("query %+v\n", source) if err != nil { fmt.Printf("query err %+v\n", err) } fmt.Println("================================= buildAllQuery query 1 ================================") return query } // 类型 func MenuTypeQuery(menuType int) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("MenuType", menuType) } // 已提交审批 func BuildSubmitFilterQuery(userID uint64) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("SubmitterID", userID) } // 待办审批 func BuildWorkFilterQuery(userID uint64) *elastic.ScriptQuery { return elastic.NewScriptQuery(elastic.NewScript(` if (params.doc['NowLevel'].value() == 0 || params.doc['WorkFlows'].size() == 0) return false; long nowLevel = params.doc['NowLevel'].value; for (def workFlow : params.doc['WorkFlows']) { if (workFlow.Level == nowLevel && workFlow.UserID == params.userID) { return true; } } return false; `).Param("userID", userID).Lang("painless")) } // BuildWorkFunctionScoreQuery 待办审批 // 需要 处理 或签时 只有一个人审批 其他审批人 在 待你审批列表中不显示 /* long status = doc['Status'].value; if (params.status == status) { return 0; } .Param("status", status) */ func BuildWorkFunctionScoreQuery(userID uint64, status uint64) *elastic.FunctionScoreQuery { return elastic.NewFunctionScoreQuery().Query(elastic.NewMatchAllQuery()).AddScoreFunc(elastic.NewScriptFunction(elastic.NewScript(` if (!doc.containsKey('NowLevel') || doc['NowLevel'].empty) { return 0; } long nowLevel = doc['NowLevel'].value; if (!params._source.containsKey('WorkFlows')) { return 0; } def workflows = params._source.get('WorkFlows'); if (workflows == null) { return 0; } for (def workflow : workflows) { if (workflow.Level == nowLevel && workflow.UserID == params.userID && workflow.Status == 1) { return 1; } } return 0; `).Lang("painless").Param("userID", userID))). MinScore(1) } // 已办审批 func BuildHadWorkFilterQuery(userID uint64) *elastic.ScriptQuery { return elastic.NewScriptQuery(elastic.NewScript(` if (params.doc['NowLevel'].value() == 0 || params.doc['WorkFlows'].size() == 0) return false; long nowLevel = params.doc['NowLevel'].value; for (def workFlow : params.doc['WorkFlows']) { if (workFlow.Level > nowLevel && workFlow.UserID == params.userID) { return true; } } return false; `).Param("userID", userID).Lang("painless")) } func BuildHadWorkFunctionScoreQuery(userID uint64) *elastic.FunctionScoreQuery { return elastic.NewFunctionScoreQuery().Query(elastic.NewMatchAllQuery()).AddScoreFunc(elastic.NewScriptFunction(elastic.NewScript(` if (!doc.containsKey('NowLevel') || doc['NowLevel'].empty) { return 0; } long nowLevel = doc['NowLevel'].value; if (!params._source.containsKey('WorkFlows')) { return 0; } def workflows = params._source.get('WorkFlows'); if (workflows == null) { return 0; } for (def workflow : workflows) { if ( workflow.UserID == params.userID && workflow.Status != 1 ) { return 1; } } return 0; `).Lang("painless").Param("userID", userID))). MinScore(1) } // 抄送审批 func BuildViewFilterQuery(userID uint64, allStatus uint64) *elastic.ScriptQuery { return elastic.NewScriptQuery(elastic.NewScript(` if (params.doc['NowLevel'].value() == 0 || params.doc['CopyUsers'].size() == 0 || params.doc['AllStatus'].value == 0) return false; long nowLevel = params.doc['NowLevel'].value; long allStatus = params.doc['AllStatus'].value; for (def copyUser : params.doc['CopyUsers']) { if (copyUser.ID == params.userID && allStatus == params.allStatus) { return true; } } return false; `).Param("userID", userID).Param("allStatus", allStatus).Lang("painless")) } /* if (!doc.containsKey('NowLevel') || doc['NowLevel'].empty) { return 0; } long allStatus = doc['AllStatus'].value; if (allStatus != params.allStatus) { return 0; } long nowLevel = doc['NowLevel'].value; if (!doc.containsKey('CopyUsers') || doc['CopyUsers'].empty) { return 0; } def copyUsers = params._source.get('CopyUsers'); if (copyUsers == null) { return 0; } for (def copyUser : copyUsers) { if (copyUser.UserID == params.userID) { return 1; } } return 0; */ func BuildViewFunctionScoreQuery(userID uint64, allStatus uint64) *elastic.FunctionScoreQuery { return elastic.NewFunctionScoreQuery(). Query(elastic.NewMatchAllQuery()). AddScoreFunc(elastic.NewScriptFunction(elastic.NewScript(` long status = doc['AllStatus'].value; if (status == 3) { return 0; } long allStatus = doc['AllStatus'].value; if (params.allStatus > allStatus ) { return 0; } def copyUsers = params._source.get('CopyUsers'); if (copyUsers == null) { return 0; } for (def copyUser : copyUsers) { if (copyUser.ID == params.userID) { return 1; } } return 0; `).Lang("painless"). Param("userID", userID). Param("allStatus", allStatus))). MinScore(1) } // 全部审批 func BuildAllFilterQuery(userID uint64) *elastic.ScriptQuery { return elastic.NewScriptQuery(elastic.NewScript(` if (params.doc['NowLevel'].value() == 0 || params.doc['WorkFlows'].size() == 0) return false; long nowLevel = params.doc['NowLevel'].value; for (def workFlow : params.doc['WorkFlows']) { if (workFlow.Level == nowLevel && workFlow.UserID == params.userID) { return true; } } return false; `).Param("userID", userID).Lang("painless")) } // 正确版本 2024-11-18 后期 优化 使用此版本 func _BuildAllFunctionScoreQuery(userID uint64, allStatus uint64) *elastic.FunctionScoreQuery { return elastic.NewFunctionScoreQuery(). Query(elastic.NewMatchAllQuery()). AddScoreFunc(elastic.NewScriptFunction(elastic.NewScript(` long submitterID = doc['SubmitterID'].value; if (submitterID == params.userID) { return 1; } if (!doc.containsKey('NowLevel') || doc['NowLevel'].empty) { return 0; } long allStatus = doc['AllStatus'].value; long nowLevel = doc['NowLevel'].value; if (!params._source.containsKey('WorkFlows')) { return 0; } def workflows = params._source.get('WorkFlows'); if (workflows == null) { return 0; } for (def workflow : workflows) { if (nowLevel >= workflow.Level && workflow.UserID == params.userID) { return 1; } } def copyUsers = params._source.get('CopyUsers'); if (copyUsers == null) { return 0; } for (def copyUser : copyUsers) { if (copyUser.ID == params.userID && allStatus >= params.allStatus) { return 1; } } return 0; `).Lang("painless"). Param("userID", userID). Param("allStatus", allStatus))). MinScore(1) } func BuildAllFunctionScoreQuery(userID uint64, allStatus uint64) *elastic.FunctionScoreQuery { return elastic.NewFunctionScoreQuery(). Query(elastic.NewMatchAllQuery()). AddScoreFunc(elastic.NewScriptFunction(elastic.NewScript(` long submitterID = doc['SubmitterID'].value; if (submitterID == params.userID) { return 1; } if (!doc.containsKey('NowLevel') || doc['NowLevel'].empty) { return 0; } long allStatus = doc['AllStatus'].value; long nowLevel = doc['NowLevel'].value; if (!params._source.containsKey('WorkFlows')) { return 0; } def workflows = params._source.get('WorkFlows'); if (workflows == null) { return 0; } for (def workflow : workflows) { if ((nowLevel == workflow.Level && workflow.UserID == params.userID ) || (nowLevel >= workflow.Level && workflow.UserID == params.userID && allStatus == params.allStatus) ) { return 1; } } def copyUsers = params._source.get('CopyUsers'); if (copyUsers == null) { return 0; } for (def copyUser : copyUsers) { if (copyUser.ID == params.userID && allStatus >= params.allStatus) { return 1; } } return 0; `).Lang("painless"). Param("userID", userID). Param("allStatus", allStatus))). MinScore(1) } func ExistNowLevelQuery() *elastic.ExistsQuery { return elastic.NewExistsQuery("NowLevel") } func ExistWorkFlowsQuery() *elastic.ExistsQuery { return elastic.NewExistsQuery("WorkFlows") } func ExistCopyUserQuery() *elastic.ExistsQuery { return elastic.NewExistsQuery("CopyUsers") } func ContentQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("Content", value) } func GroupNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("GroupName", value) } func NowUserNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("NowUserName", value) } func TypeQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("Type", value) } func TypeNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("TypeName", value) } func ReplyQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("Reply", value) } func SubmitterNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("SubmitterName", value) } // workFlowsObjectQuery 构建审批对象查询 func workFlowsQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("WorkFlows", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("WorkFlows.Name", value), ), ) } // approvalOAObjectQuery 构建审批对象查询 func approvalOAObjectRevokeReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.RevokeReason", value) } // approvalOAObjectQuery BusinessTrip 构建审批对象查询 func approvalOABusinessTripObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.Reason", value) } func approvalOABusinessTripObjectItineraryListNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.BusinessTrip.ItineraryList", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.EndAddress", value), elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.StartAddress", value), elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.Vehicle", value), elastic.NewNestedQuery("ApprovalOA.BusinessTrip.ItineraryList.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.BusinessTrip.ItineraryList.ApplyTimes.M", value), ), ), ), ) } // approvalOAObjectQuery GoOut 构建审批对象查询 func approvalOAGoOutObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.GoOut.Reason", value) } func approvalOAGoOutObjectVerifyFileQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.GoOut.VerifyFile", value) } func approvalOAGoOutObjectApplyTimesNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.GoOut.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.GoOut.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.GoOut.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.GoOut.ApplyTimes.M", value), ), ) } // approvalOAObjectQuery Leave 构建审批对象查询 func approvalOALeaveObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Leave.Reason", value) } func approvalOALeaveObjectVerifyFileQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Leave.VerifyFile", value) } func approvalOALeaveObjectApplyTimesNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.Leave.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.Leave.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.Leave.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.Leave.ApplyTimes.M", value), ), ) } // approvalOAObjectQuery LeaveApply 构建审批对象查询 func approvalOALeaveApplyObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.LeaveApply.Reason", value) } func approvalOALeaveApplyObjectVerifyFileQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.LeaveApply.VerifyFile", value) } // approvalOAObjectQuery MakeUp 构建审批对象查询 func approvalOAMakeUpObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.MakeUp.Reason", value) } // approvalOAObjectQuery MakeUp 构建审批对象查询 func approvalOAMakeUpObjectApplyTimesNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.MakeUp.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.MakeUp.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.MakeUp.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.MakeUp.ApplyTimes.M", value), ), ) } // approvalOAObjectQuery OutWork 构建审批对象查询 func approvalOAOutWorkObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.OutWork.Reason", value) } func approvalOAOutWorkObjectOutWorkAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.OutWork.OutWorkAddress", value) } // approvalOAObjectQuery OverTime 构建审批对象查询 func approvalOAOutWorkObjectApplyTimesNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.OutWork.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.OutWork.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.OutWork.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.OutWork.ApplyTimes.M", value), ), ) } // approvalOAObjectQuery OverTime 构建审批对象查询 func approvalOAOverTimeObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.OverTime.Reason", value) } // approvalOAObjectQuery ApplyTimes 构建审批对象查询 func approvalOAOverTimeObjectApplyTimesNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.OverTime.ApplyTimes", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.OverTime.ApplyTimes.Date", value), elastic.NewMatchPhraseQuery("ApprovalOA.OverTime.ApplyTimes.Hour", value), elastic.NewMatchPhraseQuery("ApprovalOA.OverTime.ApplyTimes.M", value), ), ) } // approvalOAObjectQuery Turnover 构建审批对象查询 func approvalOATurnoverObjectReasonQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.Reason", value) } func approvalOATurnoverObjectHandoverNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.HandoverName", value) } func approvalOATurnoverObjectHandoverNumQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.HandoverNum", value) } func approvalOATurnoverObjectJoinTimeQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.JoinTime", value) } func approvalOATurnoverObjectLeftTimeQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.LeftTime", value) } func approvalOATurnoverObjectStaffNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.StaffName", value) } func approvalOATurnoverObjectStaffNumQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.StaffNum", value) } func approvalOATurnoverObjectSuperviseNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.SuperviseName", value) } func approvalOATurnoverObjectSuperviseNumQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.SuperviseNum", value) } func approvalOATurnoverObjectWorkItemsQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.WorkItems", value) } func approvalOATurnoverObjectContactInfoQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.ContactInfo", value) } func approvalOATurnoverObjectItineraryListNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ApprovalOA.Turnover.Positions", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.Positions.DepartmentName", value), elastic.NewMatchPhraseQuery("ApprovalOA.Turnover.Positions.PositionName", value), ), ) } // bundlePayPriceObjectQuery ArtistName ShowAddress 构建审批对象查询 func bundlePayPriceObjectArtistNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ArtistName", value) } func bundlePayPriceObjectShowAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ShowAddress", value) } func bundlePayPriceObjectShowLowPriceQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ShowLowPrice", value) } func bundlePayPriceObjectArtworkSizeQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ArtworkSize", value) } func bundlePayPriceObjectArtworkNumQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ArtworkNum", value) } func bundlePayPriceObjectShowNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("BundlePayPrice.ShowName", value) } // checkInObjectQuery DetailAddress SaleAddress 构建审批对象查询 func checkInObjectDetailAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("CheckIn.DetailAddress", value) } func checkInObjectSaleAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("CheckIn.SaleAddress", value) } // customizeInfoNestedQuery 构建审批对象查询 func customizeInfoNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("CustomizeInfo", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("CustomizeInfo.ApprovalKey", value), elastic.NewMatchPhraseQuery("CustomizeInfo.ApprovalName", value), elastic.NewMatchPhraseQuery("CustomizeInfo.ApprovalType", value), elastic.NewMatchPhraseQuery("CustomizeInfo.ApprovalValue", value), elastic.NewMatchPhraseQuery("CustomizeInfo.SelectList", value), ), ) } // employNestedQuery 构建审批对象查询 func employNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("Employ", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Employ.BelongDepartment", value), elastic.NewMatchPhraseQuery("Employ.CloseReason", value), elastic.NewMatchPhraseQuery("Employ.InterviewFile", value), elastic.NewMatchPhraseQuery("Employ.ConfirmDate", value), elastic.NewMatchPhraseQuery("Employ.Mobile", value), elastic.NewMatchPhraseQuery("Employ.Name", value), elastic.NewMatchPhraseQuery("Employ.Post", value), elastic.NewMatchPhraseQuery("Employ.Remark", value), elastic.NewMatchPhraseQuery("Employ.ResumeFile", value), ), ) } // exhibitionObjectQuery 构建审批对象查询 func exhibitionObjectAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("Exhibition.Address", value) } func exhibitionObjectPackageNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("Exhibition.PackageName", value) } func exhibitionObjectNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("Exhibition.ApprovalExhibitions", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.Address", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.PackageName", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ShowDate", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ArtExhibitionDetail.Address", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ArtExhibitionDetail.Agent", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ArtExhibitionDetail.ArtistName", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ArtExhibitionDetail.ShowName", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.ArtExhibitionDetail.ShowSeq", value), elastic.NewNestedQuery("Exhibition.ApprovalExhibitions.Artworks", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.Artworks.ArtworkName", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.Artworks.SaleAddress", value), elastic.NewMatchPhraseQuery("Exhibition.ApprovalExhibitions.Artworks.Tfnum", value), ), ), ), ) } // exhibitionHisObjectQuery 构建审批对象查询 func exhibitionHisObjectAddressQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ExhibitionHis.Address", value) } func exhibitionHisObjectPackageNameQuery(value interface{}) *elastic.MatchPhraseQuery { return elastic.NewMatchPhraseQuery("ExhibitionHis.PackageName", value) } func exhibitionHisObjectNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ExhibitionHis.ApprovalExhibitionHiss", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.Address", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.PackageName", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ShowDate", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ArtExhibitionDetail.Address", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ArtExhibitionDetail.Agent", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ArtExhibitionDetail.ArtistName", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ArtExhibitionDetail.ShowName", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.ArtExhibitionDetail.ShowSeq", value), elastic.NewNestedQuery("ExhibitionHis.ApprovalExhibitionHiss.Artworks", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.Artworks.ArtworkName", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.Artworks.SaleAddress", value), elastic.NewMatchPhraseQuery("ExhibitionHis.ApprovalExhibitionHiss.Artworks.Tfnum", value), ), ), ), ) } // financialFormNestedQuery 构建审批对象查询 func financialFormNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("FinancialForm", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("FinancialForm.BankNo", value), elastic.NewMatchPhraseQuery("FinancialForm.BeneficiaryBank", value), elastic.NewMatchPhraseQuery("FinancialForm.Payee", value), elastic.NewMatchPhraseQuery("FinancialForm.PaymentCompany", value), elastic.NewMatchPhraseQuery("FinancialForm.PaymentMethod", value), elastic.NewMatchPhraseQuery("FinancialForm.TransactionDepartment", value), elastic.NewNestedQuery("FinancialForm.CostInfo", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("FinancialForm.CostInfo.Description", value), elastic.NewMatchPhraseQuery("FinancialForm.CostInfo.UsedDepartment", value), elastic.NewMatchPhraseQuery("FinancialForm.CostInfo.CostUnit", value), elastic.NewMatchPhraseQuery("FinancialForm.CostInfo.TotalPrice", value), ), ), elastic.NewNestedQuery("FinancialForm.InvoiceInfo", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.InvoiceDate", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.InvoiceNo", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.InvoiceProvider", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.Amount", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.UseTo", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.Applicant", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.PaymentMethod", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.PaymentObj", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.InvoiceType", value), elastic.NewMatchPhraseQuery("FinancialForm.InvoiceInfo.Notes", value), ), ), ), ) } // promotionNestedQuery 构建审批对象查询 func promotionNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("Promotion", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Promotion.BaiduCertUrl", value), elastic.NewMatchPhraseQuery("Promotion.BlockId", value), elastic.NewMatchPhraseQuery("Promotion.FileName", value), elastic.NewMatchPhraseQuery("Promotion.FileUrl", value), elastic.NewMatchPhraseQuery("Promotion.NewJob", value), elastic.NewMatchPhraseQuery("Promotion.OldJob", value), elastic.NewMatchPhraseQuery("Promotion.StaffName", value), elastic.NewMatchPhraseQuery("Promotion.StaffNum", value), elastic.NewMatchPhraseQuery("Promotion.TxId", value), ), ) } // returnArtworkInfoNestedQuery 构建审批对象查询 func returnArtworkInfoNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("ReturnArtworkInfo.ReturnInfos", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.PackageName", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.PostNum", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.ReturnReason", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.ReturnType", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.ReturnTime", value), elastic.NewNestedQuery("ReturnArtworkInfo.ReturnInfos.Artworks", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.Artworks.ArtistName", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.Artworks.ArtworkName", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.Artworks.SmallPic", value), elastic.NewMatchPhraseQuery("ReturnArtworkInfo.ReturnInfos.Artworks.Tfnum", value), ), ), ), ) } // showNestedQuery 构建审批对象查询// showNestedQuery 构建审批对象查询 func showNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("Show", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Show.PackageName", value), elastic.NewMatchPhraseQuery("Show.ShowAt", value), elastic.NewNestedQuery("Show.ShowDetail", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Show.ShowDetail.PackageName", value), elastic.NewMatchPhraseQuery("Show.ShowDetail.ShowAt", value), ), ), ), ) } // staffSupplyNestedQuery 构建审批对象查询 func staffSupplyNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("StaffSupply", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("StaffSupply.DepartmentName", value), elastic.NewMatchPhraseQuery("StaffSupply.JobAsk", value), elastic.NewMatchPhraseQuery("StaffSupply.JoinInTime", value), elastic.NewMatchPhraseQuery("StaffSupply.PositionName", value), ), ) } // workNestedQuery 构建审批对象查询 func workNestedQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("Work.ApprovalWorks", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("Work.ApprovalWorks.ArtistName", value), elastic.NewMatchPhraseQuery("Work.ApprovalWorks.ArtworkCover", value), elastic.NewMatchPhraseQuery("Work.ApprovalWorks.ArtworkName", value), elastic.NewMatchPhraseQuery("Work.ApprovalWorks.ShowSeq", value), ), ) } // copyUsersQuery 构建审批对象查询 func copyUsersQuery(value interface{}) *elastic.NestedQuery { return elastic.NewNestedQuery("CopyUsers", elastic.NewBoolQuery().Should( elastic.NewMatchPhraseQuery("CopyUsers.Name", value), ), ) }