|
@@ -3,7 +3,7 @@ package service
|
|
|
import (
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- elastic "app.yhyue.com/moapp/jybase/esv7"
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
|
"fmt"
|
|
|
IC "jyBXCore/rpc/init"
|
|
|
"jyBXCore/rpc/type/bxcore"
|
|
@@ -46,10 +46,10 @@ func (p *ParticipateBid) GetProjectByInfoId(infoIds []string) *[]map[string]inte
|
|
|
if len(infoIds) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- nowTime := time.Now()
|
|
|
- query := `{"_source":["_id","list.infoid"],"query": {"bool": {"must": [{"terms": {"list.infoid": [` + fmt.Sprint(infoIds) + `]}},
|
|
|
+ nowTime := time.Now().Unix()
|
|
|
+ query := `{"_source":["_id","list.infoid"],"query": {"bool": {"must": [{"terms": {"list.infoid": ["` + strings.Join(infoIds, "\",\"") + `"]}},
|
|
|
{"bool": {"should": [{"range": {"bidopentime": {"gte": ` + fmt.Sprint(nowTime) + `}}},
|
|
|
- {"constant_score": {"filter": {"missing": {"field": "projectset.bidopentime"
|
|
|
+ {"constant_score": {"filter": {"missing": {"field": "bidopentime"
|
|
|
} } } }] }}]}}}`
|
|
|
|
|
|
projectResult := elastic.Get(IndexProjectSet, TypeProjectSet, query)
|
|
@@ -57,6 +57,18 @@ func (p *ParticipateBid) GetProjectByInfoId(infoIds []string) *[]map[string]inte
|
|
|
|
|
|
}
|
|
|
|
|
|
+// GetProject 根据信息id查询项目id
|
|
|
+func (p *ParticipateBid) GetProject(infoIds []string) *[]map[string]interface{} {
|
|
|
+ if len(infoIds) == 0 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ query := `{"_source":["_id","list.infoid","ids","bidopentime"],"query":{"bool":{"must":[{"terms":{"list.infoid":["` + strings.Join(infoIds, "\",\"") + `"]}}]}}}`
|
|
|
+
|
|
|
+ projectResult := elastic.Get(IndexProjectSet, TypeProjectSet, query)
|
|
|
+ return projectResult
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// PersonalExistProject 个人版要展示的参标按钮 查询出已经参标的项目信息 用于后边格式化数据
|
|
|
func (p *ParticipateBid) PersonalExistProject(projectId []string) map[string]struct{} {
|
|
|
// 1. 查询出已经参标的
|
|
@@ -98,20 +110,6 @@ func (p *ParticipateBid) ListPersonalFormat(existProjectSet map[string]struct{},
|
|
|
return formatList
|
|
|
}
|
|
|
|
|
|
-// DetailPersonalFormat 详情页个人版 按钮格式化数据
|
|
|
-func (p *ParticipateBid) DetailPersonalFormat(existProjectSet map[string]struct{}) bxcore.ParticipateDetailInfo {
|
|
|
- // 处理成 要返回的返回数据
|
|
|
- formatData := bxcore.ParticipateDetailInfo{}
|
|
|
- // 存在在说明已经参标 显示终止参标
|
|
|
- if len(existProjectSet) > 0 {
|
|
|
- formatData.ShowStopParticipate = true
|
|
|
- } else {
|
|
|
- // 不存在则说明 未参标 参标按钮展示
|
|
|
- formatData.ShowParticipate = true
|
|
|
- }
|
|
|
- return formatData
|
|
|
-}
|
|
|
-
|
|
|
// EntExistProject 企业版 查出来企业下已经参标的这个项目的以及参标人信息 用于后边格式化数据判断有没有自己
|
|
|
func (p *ParticipateBid) EntExistProject(projectId []string) map[string]string {
|
|
|
var arg []string
|
|
@@ -170,15 +168,16 @@ func (p *ParticipateBid) ListEntFormat(existProjectMap, infoM map[string]string,
|
|
|
|
|
|
// DetailEntFormat 企业版 详情页数据格式化 返回数据 参标按钮 终止参标按钮 转给同事按钮 参标人姓名
|
|
|
// 判断企业下是否有参标人
|
|
|
-// - 无参标人 展示参标按钮 其余按钮不显示
|
|
|
+// - 无参标人&&没有到期 展示参标按钮 其余按钮不显示
|
|
|
// - 有参标人 展示参标人信息
|
|
|
-// - 管理员 展示 转给同事、终止参标
|
|
|
-// - 包含自己 展示终止参标 不包含自己如果允许多人参标 展示参标按钮
|
|
|
+// - 未到开标时间
|
|
|
+// - 管理员 未到开标时间 展示 转给同事、终止参标
|
|
|
+// - 包含自己 展示终止参标 不包含自己如果允许多人参标 展示参标按钮
|
|
|
//
|
|
|
-func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isAllow bool) (formatData bxcore.ParticipateDetailInfo) {
|
|
|
+func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isValid, isAllow bool) (formatData *bxcore.ParticipateDetailInfo) {
|
|
|
// 处理成 要返回的返回数据
|
|
|
- formatData = bxcore.ParticipateDetailInfo{}
|
|
|
- if len(existProjectMap) == 0 {
|
|
|
+ formatData = &bxcore.ParticipateDetailInfo{}
|
|
|
+ if len(existProjectMap) == 0 && isValid {
|
|
|
// 无参标人 展示参标按钮 其余按钮不显示
|
|
|
formatData.ShowParticipate = true
|
|
|
return
|
|
@@ -193,6 +192,9 @@ func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isAl
|
|
|
if nameRs != nil && len(*nameRs) > 0 {
|
|
|
formatData.UserName = common.ObjToString((*nameRs)[0]["name"])
|
|
|
}
|
|
|
+ if !isValid {
|
|
|
+ return
|
|
|
+ }
|
|
|
// 如果是管理员 显示 终止参标按钮 、转给同事按钮
|
|
|
if p.EntRoleId == RoleEntManager || p.EntRoleId == RoleDepartManager {
|
|
|
formatData.ShowStopParticipate = true
|
|
@@ -208,6 +210,23 @@ func (p *ParticipateBid) DetailEntFormat(existProjectMap map[string]string, isAl
|
|
|
|
|
|
}
|
|
|
|
|
|
+// DetailPersonalFormat 详情页个人版 按钮格式化数据
|
|
|
+func (p *ParticipateBid) DetailPersonalFormat(existProjectSet map[string]struct{}, isValid bool) (formatData *bxcore.ParticipateDetailInfo) {
|
|
|
+ // 处理成 要返回的返回数据
|
|
|
+ formatData = &bxcore.ParticipateDetailInfo{}
|
|
|
+ if !isValid {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 存在在说明已经参标 显示终止参标
|
|
|
+ if len(existProjectSet) > 0 {
|
|
|
+ formatData.ShowStopParticipate = true
|
|
|
+ } else {
|
|
|
+ // 不存在则说明 未参标 参标按钮展示
|
|
|
+ formatData.ShowParticipate = true
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// HandlerProjectId 返回信息的映射集合,项目id列表
|
|
|
func HandlerProjectId(projectInfos []map[string]interface{}, infoIds map[string]struct{}) (map[string]string, []string) {
|
|
|
result := map[string]string{}
|