Browse Source

wip:项目明细列表

fuwencai 1 year ago
parent
commit
e4804c3946

+ 18 - 0
jyBXCore/api/bxcore.api

@@ -185,6 +185,22 @@ type (
 		EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
 		EntUserId    int64  `header:"newUserId,optional"`
 	}
+	ProjectDetailReq {
+		PositionId      int64    `header:"positionId,optional"` //职位id
+		EntId           int64    `header:"entId,optional"`
+		EntUserId       int64    `header:"entUserId,optional"`
+		DeptId          int64    `header:"deptId,optional"`
+		EntUserIdArr    []string `json:"entUserIdArr,optional"`
+		StartTime       int64    `json:"startTime,optional"`
+		EndTime         int64    `json:"endTime,optional"`
+		Source          []int64  `json:"source,optional"`          // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+		BidWay          int64    `json:"bidWay,optional"`          // 投标类型 -1:全部 1:直接投标 2:渠道投标
+		Isparticipate   int64    `json:"isparticipate,optional"`   // 参标状态;-1:全部 0:未参标 1:是
+		UpdateStartTime string   `json:"updateStartTime,optional"` //
+		UpdateEndTime   string   `json:"updateEndTime,optional"`   //
+		PageSize        int64    `json:"pageSize,optional"`        //
+		PageNum         int64    `json:"pageNum,optional"`         //
+	}
 )
 service bxcore-api {
 	@handler searchList
@@ -215,5 +231,7 @@ service bxcore-api {
 	post /jybx/core/statistics/projectStatistics(ptatisticsListReq) returns (commonResp)
 	@handler polymerizeSearch//参标项目统计
 	post /jybx/core/polymerizeSearch(polymerizeSearchReq) returns (commonResp)
+	@handler statisticsProjectDetails//参标项目明细
+	post /jybx/core/statistics/projectDetails(ProjectDetailReq) returns (commonResp)
 	
 }

+ 5 - 0
jyBXCore/api/internal/handler/routes.go

@@ -82,6 +82,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/jybx/core/polymerizeSearch",
 				Handler: polymerizeSearchHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/core/statistics/projectDetails",
+				Handler: statisticsProjectDetailsHandler(serverCtx),
+			},
 		},
 	)
 }

+ 28 - 0
jyBXCore/api/internal/handler/statisticsProjectDetailsHandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"jyBXCore/api/internal/logic"
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+)
+
+func statisticsProjectDetailsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ProjectDetailReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewStatisticsProjectDetailsLogic(r.Context(), svcCtx)
+		resp, err := l.StatisticsProjectDetails(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

+ 1 - 0
jyBXCore/api/internal/logic/projectStatisticsLogic.go

@@ -38,6 +38,7 @@ func (l *ProjectStatisticsLogic) ProjectStatistics(req *types.PtatisticsListReq)
 		DeptId:       req.DeptId,
 		StartTime:    req.StartTime,
 		EndTime:      req.EndTime,
+		BidWay:       req.BidWay,
 	})
 	if err != nil {
 		return nil, err

+ 56 - 0
jyBXCore/api/internal/logic/statisticsProjectDetailsLogic.go

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"context"
+	"jyBXCore/rpc/type/bxcore"
+
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type StatisticsProjectDetailsLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewStatisticsProjectDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatisticsProjectDetailsLogic {
+	return &StatisticsProjectDetailsLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *StatisticsProjectDetailsLogic) StatisticsProjectDetails(req *types.ProjectDetailReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+	for k, v := range req.EntUserIdArr {
+		req.EntUserIdArr[k] = encrypt.SE.Decode4Hex(v)
+	}
+	res, err := l.svcCtx.BxCore.ProjectDetails(l.ctx, &bxcore.ProjectDetailsReq{
+		EntId:              req.EntId,
+		EntUserId:          req.EntUserId,
+		PositionId:         req.PositionId,
+		EntUserIdArr:       req.EntUserIdArr,
+		DeptId:             req.DeptId,
+		StartTime:          req.StartTime,
+		EndTime:            req.EndTime,
+		BidWay:             req.BidWay,
+		Source:             req.Source,
+		IsParticipate:      req.Isparticipate,
+		BidUpdateEndTime:   req.UpdateEndTime,
+		BidUpdateStartTime: req.UpdateStartTime,
+		PageNum:            req.PageNum,
+		PageSize:           req.PageSize,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonResp{
+		Data: res.Data,
+	}, nil
+	return
+}

+ 17 - 0
jyBXCore/api/internal/types/types.go

@@ -180,3 +180,20 @@ type PolymerizeSearchReq struct {
 	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
 	EntUserId    int64  `header:"newUserId,optional"`
 }
+
+type ProjectDetailReq struct {
+	PositionId      int64    `header:"positionId,optional"` //职位id
+	EntId           int64    `header:"entId,optional"`
+	EntUserId       int64    `header:"entUserId,optional"`
+	DeptId          int64    `header:"deptId,optional"`
+	EntUserIdArr    []string `json:"entUserIdArr,optional"`
+	StartTime       int64    `json:"startTime,optional"`
+	EndTime         int64    `json:"endTime,optional"`
+	Source          []int64  `json:"source,optional"`          // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+	BidWay          int64    `json:"bidWay,optional"`          // 投标类型 -1:全部 1:直接投标 2:渠道投标
+	Isparticipate   int64    `json:"isparticipate,optional"`   // 参标状态;-1:全部 0:未参标 1:是
+	UpdateStartTime string   `json:"updateStartTime,optional"` //
+	UpdateEndTime   string   `json:"updateEndTime,optional"`   //
+	PageSize        int64    `json:"pageSize,optional"`        //
+	PageNum         int64    `json:"pageNum,optional"`         //
+}

+ 43 - 0
jyBXCore/rpc/bxcore.proto

@@ -454,6 +454,23 @@ message StatisticsListReq{
   int64 bidWay = 9; //   -1:全部 1:直接投标 2:渠道投标
 
 }
+// 企业项目参标明细
+message ProjectDetailsReq{
+  int64  entId = 1; //企业id
+  int64  entUserId = 2; // 企业下用户id
+  int64  positionId = 3; // 职位id
+  repeated string  entUserIdArr = 4; //人员选择
+  int64  deptId = 5; //部门id
+  int64 startTime = 6;
+  int64 endTime = 7;
+  repeated int64 source = 8; // source  0:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+  int64 bidWay = 9; //   -1:全部 1:直接投标 2:渠道投标
+  string bidUpdateStartTime =10;// 参标状态跟新时间开始
+  string bidUpdateEndTime =11;// 参标状态跟新时间结束
+  int64 isParticipate = 12;// -1全部 1-已参标是 0-未参标否
+  int64 PageNum = 13;// 页码 从1开始
+  int64 PageSize =14;// 每页条数 默认50
+}
 // 筛选项
 message sourceItem{
  string Name =1;
@@ -480,6 +497,30 @@ message ProjectStatisticsDataRes{
   string err_msg = 2;
   repeated ProjectStatisticsData data = 3;
 }
+message ProjectDetailData {
+  string  ProjectName =1;// 项目名称
+  string  Source = 2; // 标讯/项目来源 '来源;1:个人订阅 2:企业自动分发 3:企业手动分发
+  int64   IsDistribute = 3;// 手动分发状态  1已分发
+  string  DisDate =4; // 分发时间
+  string  ViewDate = 5;//最早浏览时间
+  int64   IsBid = 6;// 投标状态
+  int64   BidDate = 7;// 投标时间
+  int64   IsParticipate = 8;//参标状态
+  string  ParticipateDate = 9;//参标时间
+  string  StopParticipateDate = 12;//参标时间
+  int64   BidWay = 10;//投标类型
+  map<string, string> stage =11;// 阶段相关信息  <阶段名称,勾选时间>
+}
+message DetailData{
+  repeated ProjectDetailData list = 1;
+  int64    total  = 2;
+}
+message DetailDataRes{
+  int64 err_code = 1;
+  string err_msg = 2;
+  DetailData data =3;
+  }
+
 message ProjectStatisticsData{
   string  personName = 1;
   string  departmentName = 2;
@@ -580,4 +621,6 @@ service BxCore {
   rpc ProjectStatistics(StatisticsListReq) returns (ProjectStatisticsDataRes);
   //聚合搜索
   rpc PolymerizeSearch(PolymerizeSearchReq) returns (PolymerizeSearchResp);
+  rpc ProjectDetails(ProjectDetailsReq) returns (DetailDataRes);
+
 }

+ 10 - 0
jyBXCore/rpc/bxcore/bxcore.go

@@ -14,6 +14,8 @@ import (
 
 type (
 	BidTypeReq               = bxcore.BidTypeReq
+	DetailData               = bxcore.DetailData
+	DetailDataRes            = bxcore.DetailDataRes
 	MenuList                 = bxcore.MenuList
 	PInfo                    = bxcore.PInfo
 	ParticipateActionReq     = bxcore.ParticipateActionReq
@@ -42,6 +44,8 @@ type (
 	ParticipateShowRes       = bxcore.ParticipateShowRes
 	PolymerizeSearchReq      = bxcore.PolymerizeSearchReq
 	PolymerizeSearchResp     = bxcore.PolymerizeSearchResp
+	ProjectDetailData        = bxcore.ProjectDetailData
+	ProjectDetailsReq        = bxcore.ProjectDetailsReq
 	ProjectStatisticsData    = bxcore.ProjectStatisticsData
 	ProjectStatisticsDataRes = bxcore.ProjectStatisticsDataRes
 	PushStatisticsData       = bxcore.PushStatisticsData
@@ -93,6 +97,7 @@ type (
 		ProjectStatistics(ctx context.Context, in *StatisticsListReq, opts ...grpc.CallOption) (*ProjectStatisticsDataRes, error)
 		// 聚合搜索
 		PolymerizeSearch(ctx context.Context, in *PolymerizeSearchReq, opts ...grpc.CallOption) (*PolymerizeSearchResp, error)
+		ProjectDetails(ctx context.Context, in *ProjectDetailsReq, opts ...grpc.CallOption) (*DetailDataRes, error)
 	}
 
 	defaultBxCore struct {
@@ -189,3 +194,8 @@ func (m *defaultBxCore) PolymerizeSearch(ctx context.Context, in *PolymerizeSear
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.PolymerizeSearch(ctx, in, opts...)
 }
+
+func (m *defaultBxCore) ProjectDetails(ctx context.Context, in *ProjectDetailsReq, opts ...grpc.CallOption) (*DetailDataRes, error) {
+	client := bxcore.NewBxCoreClient(m.cli.Conn())
+	return client.ProjectDetails(ctx, in, opts...)
+}

+ 38 - 0
jyBXCore/rpc/internal/logic/projectdetailslogic.go

@@ -0,0 +1,38 @@
+package logic
+
+import (
+	"context"
+	"jyBXCore/rpc/internal/svc"
+	"jyBXCore/rpc/service"
+	"jyBXCore/rpc/type/bxcore"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ProjectDetailsLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewProjectDetailsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProjectDetailsLogic {
+	return &ProjectDetailsLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *ProjectDetailsLogic) ProjectDetails(in *bxcore.ProjectDetailsReq) (*bxcore.DetailDataRes, error) {
+	participateService := service.ParticipateStatistics{
+		PositionId: in.PositionId,
+		EntId:      in.EntId,
+		DeptId:     in.EntId,
+		EntUserId:  in.EntUserId,
+	}
+
+	data := participateService.ProjectDetails(in.EntUserIdArr, in)
+	return &bxcore.DetailDataRes{
+		Data: &data,
+	}, nil
+}

+ 5 - 0
jyBXCore/rpc/internal/server/bxcoreserver.go

@@ -105,3 +105,8 @@ func (s *BxCoreServer) PolymerizeSearch(ctx context.Context, in *bxcore.Polymeri
 	l := logic.NewPolymerizeSearchLogic(ctx, s.svcCtx)
 	return l.PolymerizeSearch(in)
 }
+
+func (s *BxCoreServer) ProjectDetails(ctx context.Context, in *bxcore.ProjectDetailsReq) (*bxcore.DetailDataRes, error) {
+	l := logic.NewProjectDetailsLogic(ctx, s.svcCtx)
+	return l.ProjectDetails(in)
+}

+ 25 - 0
jyBXCore/rpc/model/es/project.go

@@ -100,3 +100,28 @@ func GetBidInfoByPId(infoId string) *[]map[string]interface{} {
 	return projectResult
 
 }
+
+func GetProjectNameByProjectId(projectId []string) *[]map[string]interface{} {
+	projectQuery := `{
+  "query": {
+    "bool": {
+      "must": [
+        {
+          "terms": {
+            "_id": [
+              "` + strings.Join(projectId, "\",\"") + `"
+            ]
+          }
+        }
+      ]
+    }
+  },
+  "_source": [
+    "_id",
+    "projectname"
+  ]
+}`
+	projectResult := elastic.Get(IndexProjectSet, TypeProjectSet, projectQuery)
+	return projectResult
+
+}

+ 216 - 7
jyBXCore/rpc/service/participateStatistics.go

@@ -8,7 +8,9 @@ import (
 	"fmt"
 	"jyBXCore/rpc/bxcore"
 	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/model/es"
 	"log"
+	"strconv"
 	"strings"
 	"time"
 )
@@ -89,12 +91,23 @@ func (in *ParticipateStatistics) GetSourceItem(entId, positionId int) (result []
 		return
 	}
 	for i := 0; i < len(*rs); i++ {
-		value := common.IntAll((*rs)[i][""])
-		if name, ok := SelectItemMap[value]; ok {
-			result = append(result, &bxcore.SourceItem{
-				Name:  name,
-				Value: int64(value),
-			})
+		value := common.ObjToString((*rs)[i]["source"])
+		if value == "" {
+			continue
+		}
+		splitSource := strings.Split(value, ",")
+		for j := 0; j < len(splitSource); j++ {
+			sourceValue, err := strconv.Atoi(splitSource[j])
+			if err != nil {
+				log.Println("类型转换错误:", err, splitSource[j])
+				continue
+			}
+			if name, ok := SelectItemMap[sourceValue]; ok {
+				result = append(result, &bxcore.SourceItem{
+					Name:  name,
+					Value: int64(sourceValue),
+				})
+			}
 		}
 	}
 	if len(result) > 0 {
@@ -504,10 +517,206 @@ func QueryHandle(isAdmin bool, startTime, endTime int64, personArrStr string, so
 			sourceValue += fmt.Sprint(source[i]) + ","
 		}
 		sourceValue = sourceValue[:len(sourceValue)-1]
-		query = append(query, fmt.Sprintf("source in ( %s )", sourceValue))
+		query = append(query, fmt.Sprintf(" FIND_IN_SET('%s', a.source)", sourceValue))
 	}
 	if bidWay != 0 {
 		query = append(query, fmt.Sprintf("bid_way = %d", bidWay))
 	}
 	return query
 }
+func (in *ParticipateStatistics) ProjectDetails(entUserIdArr []string, detailReq *bxcore.ProjectDetailsReq) (result bxcore.DetailData) {
+	//判断是企业、部门还是个人
+	isAdmin, personArrStr, _ := in.PersonHandle(entUserIdArr)
+	queryType := GetQueryType(detailReq)
+	query, countQuery := GetDetailQuery(isAdmin, personArrStr, detailReq, queryType)
+	totalCount := IC.BaseMysql.CountBySql(countQuery)
+	if totalCount == 0 {
+		return
+	}
+	// 处理数据  这里只是筛选出项目id和阶段信息
+	dataList := IC.BaseMysql.SelectBySql(query)
+	if dataList == nil && len(*dataList) == 0 {
+		return
+	}
+	// 处理数据 补充项目名称、推送表字段 格式化数据
+	rs := ProjectDetailHandle(*dataList, in.EntId)
+	result = bxcore.DetailData{
+		List:  rs,
+		Total: totalCount,
+	}
+	// 处理数据
+	return
+}
+
+// todo 查询条件待重新处理  现在不对
+func GetDetailQuery(isAdmin bool, personArrStr string, req *bxcore.ProjectDetailsReq, queryType int) (string, string) {
+	joinStr := ""
+	switch queryType {
+	case 0:
+		joinStr = " union "
+	case 1:
+		joinStr = " left join "
+	case 2:
+		joinStr = " right join "
+	case 3:
+		joinStr = " inner join "
+
+	}
+
+	query := []string{}
+	if isAdmin {
+		//是管理员
+		query = append(query, fmt.Sprintf(" a.ent_user_id in (%s) ", personArrStr))
+	} else {
+		//不是管理员
+		query = append(query, fmt.Sprintf(" a.position_id = %s ", personArrStr))
+	}
+	//// 标讯推送时间
+	if req.StartTime == 0 && req.EndTime == 0 && req.BidUpdateStartTime == "" && req.BidUpdateEndTime == "" {
+		//没有传时间,默认时间处理
+		var start = time.Now().AddDate(0, 0, -30)
+		query = append(query, fmt.Sprintf(" a.ymd >= %s ", start.Format("20060102")))
+	}
+	if req.StartTime != 0 {
+		query = append(query, fmt.Sprintf(" a.ymd >= %d ", req.StartTime))
+	}
+	if req.EndTime != 0 {
+		query = append(query, fmt.Sprintf(" a.ymd <= %d ", req.EndTime))
+	}
+	// 标讯/项目来源
+	if len(req.Source) > 0 {
+		sourceValue := ""
+		for i := 0; i < len(req.Source); i++ {
+			sourceValue += fmt.Sprint(req.Source[i]) + ","
+		}
+		sourceValue = sourceValue[:len(sourceValue)-1]
+		query = append(query, fmt.Sprintf(" FIND_IN_SET('%s', a.source)", sourceValue))
+	}
+	// 投标类型 投标方式;1:直接投标 2:渠道投标',
+	if req.BidWay != 0 {
+		query = append(query, fmt.Sprintf("a.bid_way = %d", req.BidWay))
+	}
+	//参标状态:-1全部,0未参标、1已参标
+	if req.IsParticipate != -1 {
+		query = append(query, fmt.Sprintf("a.isparticipate = %d", req.IsParticipate))
+	}
+	// 参标状态更新时间
+	if req.BidUpdateStartTime != "" {
+		query = append(query, fmt.Sprintf("b.update_date > %s", req.BidUpdateStartTime))
+	}
+	if req.BidUpdateEndTime != "" {
+		query = append(query, fmt.Sprintf("b.update_date > %s", req.BidUpdateStartTime))
+	}
+
+	q := "select distinct(a.project_id),b.stage   from participate_push_statistics a ," + joinStr + " participate_stage_statistics b on(b.project_id=a.project_id and b.ent_id=a.ent_id) %s"
+	q2 := "select count(distinct(a.project_id),b.stage)   from participate_push_statistics a ," + joinStr + " participate_stage_statistics b on(b.project_id=a.project_id and b.ent_id=a.ent_id) %s"
+	if len(query) > 0 {
+		q += " where "
+		q2 += " where "
+		q = fmt.Sprintf(q, strings.Join(query, " and "))
+		q2 = fmt.Sprintf(q2, strings.Join(query, " and "))
+
+	}
+
+	// 处理分页
+	if req.PageNum == 0 && req.PageSize == 0 {
+		req.PageNum = 1
+		req.PageNum = 50
+	}
+	q = fmt.Sprintf("%s limit %d,%d", q, (req.PageNum-1)*req.PageSize, req.PageSize)
+	return q, q2
+}
+
+type PushInfoStruct struct {
+	Source       string
+	VisitDate    string
+	DisDate      string
+	IsDistribute int
+}
+
+func ProjectDetailHandle(dataList []map[string]interface{}, entId int64) []*bxcore.ProjectDetailData {
+	//dataList 里面包含 项目id、各阶段勾选时间、
+	// 处理项目名称
+	projectIdList := []string{}
+	for i := 0; i < len(dataList); i++ {
+		projectIdList = append(projectIdList, common.ObjToString(dataList[i]["project_id"]))
+
+	}
+	// 项目名称处理成map用于后续使用
+	projectNameMap := map[string]string{}
+	projectNameRs := es.GetProjectNameByProjectId(projectIdList)
+	if projectNameRs != nil && len(*projectNameRs) > 0 {
+		for i := 0; i < len(*projectNameRs); i++ {
+			projectId_ := common.ObjToString((*projectNameRs)[i]["_id"])
+			projectName_ := (*projectNameRs)[i]["projectname"]
+			projectNameMap[projectId_] = common.ObjToString(projectName_)
+		}
+	}
+	// 获取推送最新状态
+	newPushInfo := getNewPushInfo(projectIdList, int(entId))
+
+	newPushInfoMap := map[string]PushInfoStruct{}
+	// 处理推送最新状态
+	if newPushInfo != nil && len(*newPushInfo) > 0 {
+		for i := 0; i < len(*newPushInfo); i++ {
+			project_ := common.ObjToString((*newPushInfo)[i]["project_id"])
+			info := PushInfoStruct{
+				Source:       common.ObjToString((*newPushInfo)[i]["source"]),
+				VisitDate:    common.ObjToString((*newPushInfo)[i]["visit_date"]),
+				DisDate:      common.ObjToString((*newPushInfo)[i]["dis_date"]),
+				IsDistribute: common.IntAll((*newPushInfo)[i]["is_distribute"]),
+			}
+			newPushInfoMap[project_] = info
+		}
+	}
+	results := []*bxcore.ProjectDetailData{}
+	// 处理成最后的数据
+	for i := 0; i < len(dataList); i++ {
+		projectId := common.ObjToString(dataList[i]["project_id"])
+		tmp := bxcore.ProjectDetailData{
+			ProjectName: projectNameMap[projectId],
+		}
+		// 处理推送表相关字段
+		if pushInfo_, ok := newPushInfoMap[projectId]; ok {
+			tmp.Source = pushInfo_.Source // todo 处理成中文
+			tmp.ViewDate = pushInfo_.VisitDate
+			tmp.IsDistribute = int64(pushInfo_.IsDistribute)
+			tmp.DisDate = pushInfo_.DisDate
+		}
+		// todo 投标状态和投标类型需要加字段
+		// 处理阶段勾选信息和参标、终止参标信息  todo 参标和终止参标不放在stage
+		stageInfo := map[string]string{}
+		err := json.Unmarshal(dataList[i]["stage"].([]byte), &stageInfo)
+		if err != nil {
+			tmp.ParticipateDate = common.ObjToString(stageInfo["参标"])
+			tmp.StopParticipateDate = stageInfo["终止参标"]
+			delete(stageInfo, "参标")
+			delete(stageInfo, "终止参标")
+			tmp.Stage = stageInfo
+		}
+		results = append(results, &tmp)
+	}
+	return results
+}
+
+// 获取项目的最新推送状态信息
+func getNewPushInfo(projectIds []string, entId int) *[]map[string]interface{} {
+	sql := `select project_id,source,visit_date,dis_date,is_distribute from participate_push_statistics where id in (SELECT max(id) from participate_push_statistics where ent_id=%d and project_id in ( "` + strings.Join(projectIds, "\",\"") + `" ) group by project_id);  `
+	query := fmt.Sprintf(sql, entId)
+	return IC.BaseMysql.SelectBySql(query)
+}
+
+// GetQueryType 查询类型  0空搜索 1左连接 2右连接 3内连接
+func GetQueryType(in *bxcore.ProjectDetailsReq) int {
+	// TODO 调整
+	if in.BidUpdateStartTime == "" && in.BidUpdateEndTime == "" && in.StartTime == 0 && in.EndTime == 0 && in.IsParticipate == -1 && in.BidWay == 0 && len(in.Source) == 0 {
+		return 0
+	}
+	if (in.BidUpdateStartTime != "" || in.BidUpdateEndTime != "") && (in.StartTime != 0 || in.EndTime != 0 || in.IsParticipate != -1 || in.BidWay != 0 || len(in.Source) != 0) {
+		return 3
+	}
+	if (in.BidUpdateStartTime != "" || in.BidUpdateEndTime != "") && (in.StartTime == 0 && in.EndTime == 0 && in.IsParticipate == -1 && in.BidWay == 0 && len(in.Source) == 0) {
+		return 2
+	}
+	return 1
+}

File diff suppressed because it is too large
+ 629 - 138
jyBXCore/rpc/type/bxcore/bxcore.pb.go


+ 36 - 0
jyBXCore/rpc/type/bxcore/bxcore_grpc.pb.go

@@ -50,6 +50,7 @@ type BxCoreClient interface {
 	ProjectStatistics(ctx context.Context, in *StatisticsListReq, opts ...grpc.CallOption) (*ProjectStatisticsDataRes, error)
 	//聚合搜索
 	PolymerizeSearch(ctx context.Context, in *PolymerizeSearchReq, opts ...grpc.CallOption) (*PolymerizeSearchResp, error)
+	ProjectDetails(ctx context.Context, in *ProjectDetailsReq, opts ...grpc.CallOption) (*DetailDataRes, error)
 }
 
 type bxCoreClient struct {
@@ -186,6 +187,15 @@ func (c *bxCoreClient) PolymerizeSearch(ctx context.Context, in *PolymerizeSearc
 	return out, nil
 }
 
+func (c *bxCoreClient) ProjectDetails(ctx context.Context, in *ProjectDetailsReq, opts ...grpc.CallOption) (*DetailDataRes, error) {
+	out := new(DetailDataRes)
+	err := c.cc.Invoke(ctx, "/bxcore.BxCore/ProjectDetails", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // BxCoreServer is the server API for BxCore service.
 // All implementations must embed UnimplementedBxCoreServer
 // for forward compatibility
@@ -218,6 +228,7 @@ type BxCoreServer interface {
 	ProjectStatistics(context.Context, *StatisticsListReq) (*ProjectStatisticsDataRes, error)
 	//聚合搜索
 	PolymerizeSearch(context.Context, *PolymerizeSearchReq) (*PolymerizeSearchResp, error)
+	ProjectDetails(context.Context, *ProjectDetailsReq) (*DetailDataRes, error)
 	mustEmbedUnimplementedBxCoreServer()
 }
 
@@ -267,6 +278,9 @@ func (UnimplementedBxCoreServer) ProjectStatistics(context.Context, *StatisticsL
 func (UnimplementedBxCoreServer) PolymerizeSearch(context.Context, *PolymerizeSearchReq) (*PolymerizeSearchResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method PolymerizeSearch not implemented")
 }
+func (UnimplementedBxCoreServer) ProjectDetails(context.Context, *ProjectDetailsReq) (*DetailDataRes, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ProjectDetails not implemented")
+}
 func (UnimplementedBxCoreServer) mustEmbedUnimplementedBxCoreServer() {}
 
 // UnsafeBxCoreServer may be embedded to opt out of forward compatibility for this service.
@@ -532,6 +546,24 @@ func _BxCore_PolymerizeSearch_Handler(srv interface{}, ctx context.Context, dec
 	return interceptor(ctx, in, info, handler)
 }
 
+func _BxCore_ProjectDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ProjectDetailsReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BxCoreServer).ProjectDetails(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/bxcore.BxCore/ProjectDetails",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BxCoreServer).ProjectDetails(ctx, req.(*ProjectDetailsReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // BxCore_ServiceDesc is the grpc.ServiceDesc for BxCore service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -595,6 +627,10 @@ var BxCore_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "PolymerizeSearch",
 			Handler:    _BxCore_PolymerizeSearch_Handler,
 		},
+		{
+			MethodName: "ProjectDetails",
+			Handler:    _BxCore_ProjectDetails_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "bxcore.proto",

Some files were not shown because too many files changed in this diff