Sfoglia il codice sorgente

Merge branch 'dev/v1.1.36_fuwencai' of https://jygit.jydev.jianyu360.cn/BaseService/jyMicroservices into dev/v1.1.36_fuwencai

wangshan 1 anno fa
parent
commit
0115a8fc24

+ 1 - 1
jyBXCore/api/bxcore.api

@@ -170,7 +170,7 @@ type (
 		EntUserIdArr []string `json:"entUserIdArr,optional"`
 		StartTime    int64    `json:"startTime,optional"`
 		EndTime      int64    `json:"endTime,optional"`
-		Source       int64    `json:"source,optional"` // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+		Source       []int64  `json:"source,optional"` // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
 		BidWay       int64    `json:"bidWay,optional"` // 投标类型 -1:全部 1:直接投标 2:渠道投标
 	}
 	polymerizeSearchReq {

+ 1 - 1
jyBXCore/api/internal/types/types.go

@@ -164,7 +164,7 @@ type PtatisticsListReq struct {
 	EntUserIdArr []string `json:"entUserIdArr,optional"`
 	StartTime    int64    `json:"startTime,optional"`
 	EndTime      int64    `json:"endTime,optional"`
-	Source       int64    `json:"source,optional"` // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+	Source       []int64  `json:"source,optional"` // 标讯项目来源 -1:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
 	BidWay       int64    `json:"bidWay,optional"` // 投标类型 -1:全部 1:直接投标 2:渠道投标
 }
 

+ 3 - 9
jyBXCore/rpc/bxcore.proto

@@ -1,5 +1,5 @@
 syntax = "proto3";
-
+import    "google/protobuf/any.proto";
 package bxcore;
 option go_package = "./bxcore";
 
@@ -450,7 +450,7 @@ message StatisticsListReq{
   int64  deptId = 5; //部门id
   int64 startTime = 6;
   int64 endTime = 7;
-  int64 source = 8; // source  0:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
+  repeated int64 source = 8; // source  0:全部  1:个人订阅 2:企业自动分发 3:企业手动分发
   int64 bidWay = 9; //   -1:全部 1:直接投标 2:渠道投标
 
 }
@@ -493,13 +493,7 @@ message ProjectStatisticsData{
   int64   endNumb = 10; //终止数量
   string  entUserId = 11;
   int64   participateProjectNumb = 12;// 参标数量
-  int64   registeredNumb = 13;// 已报名数量
-  int64   decisionMakingNumb = 14;// 投标决策阶段
-  int64   compileDocsNumb = 15;// 编织投标文件阶段
-  int64   submitDocsNumb = 16;// 递交投标文件
-  int64   bidPublicityNumb = 17;// 中标公示
-  int64   signContractNumb = 18;// 签合同
-  int64   endedNumb = 19;// 已结束
+  google.protobuf.Any stage = 13;// 各个阶段的数量
 }
 message  PolymerizeSearchReq{
   int64  entId = 1; //企业id

+ 1 - 1
jyBXCore/rpc/internal/logic/projectstatisticslogic.go

@@ -34,7 +34,7 @@ func (l *ProjectStatisticsLogic) ProjectStatistics(in *bxcore.StatisticsListReq)
 		DeptId:     in.EntId,
 		EntUserId:  in.EntUserId,
 	}
-	data := participateService.ProjectStatistics(in.EntUserIdArr, in.StartTime, in.EndTime)
+	data := participateService.ProjectStatistics(in.EntUserIdArr, in.StartTime, in.EndTime, in.BidWay)
 	return &bxcore.ProjectStatisticsDataRes{
 		ErrCode: 0,
 		ErrMsg:  "",

+ 1 - 0
jyBXCore/rpc/internal/logic/pushstatisticslogic.go

@@ -33,6 +33,7 @@ func (l *PushStatisticsLogic) PushStatistics(in *bxcore.StatisticsListReq) (*bxc
 		DeptId:     in.EntId,
 		EntUserId:  in.EntUserId,
 	}
+	// 推送参标数据统计
 	data := participateService.PushStatistics(in.EntUserIdArr, in.StartTime, in.EndTime, in.Source)
 	return &bxcore.PushStatisticsDataRes{
 		ErrCode: 0,

+ 68 - 6
jyBXCore/rpc/service/participateStatistics.go

@@ -3,10 +3,13 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
+	"app.yhyue.com/moapp/jybase/redis"
 	"encoding/json"
 	"fmt"
+	"google.golang.org/protobuf/types/known/anypb"
 	"jyBXCore/rpc/bxcore"
 	IC "jyBXCore/rpc/init"
+	"log"
 	"strings"
 	"time"
 )
@@ -24,7 +27,7 @@ type ParticipateStatistics struct {
 	EntUserId  int64
 }
 
-func (in *ParticipateStatistics) PushStatistics(entUserIdArr []string, startTime, endTime int64, source int64) (result []*bxcore.PushStatisticsData) {
+func (in *ParticipateStatistics) PushStatistics(entUserIdArr []string, startTime, endTime int64, source []int64) (result []*bxcore.PushStatisticsData) {
 	//判断是企业、部门还是个人
 	isAdmin, personArrStr, users := in.PersonHandle(entUserIdArr)
 	//时间处理
@@ -40,7 +43,7 @@ func (in *ParticipateStatistics) PushStatistics(entUserIdArr []string, startTime
 func (in *ParticipateStatistics) ProjectStatistics(entUserIdArr []string, startTime, endTime, bidWay int64) (result []*bxcore.ProjectStatisticsData) {
 	//判断是企业、部门还是个人
 	isAdmin, personArrStr, users := in.PersonHandle(entUserIdArr)
-	query := QueryHandle(isAdmin, startTime, endTime, personArrStr, -1, bidWay)
+	query := QueryHandle(isAdmin, startTime, endTime, personArrStr, []int64{}, bidWay)
 	//订阅推送数处理
 	//推送数据查询
 	dataList := IC.BaseMysql.SelectBySql(fmt.Sprintf("select  * from  participate_project_statistics where %s order  by ymd", strings.Join(query, "and ")))
@@ -50,6 +53,58 @@ func (in *ParticipateStatistics) ProjectStatistics(entUserIdArr []string, startT
 	return
 }
 
+var (
+	SelectItemMap = map[int]string{
+		1: "个人订阅",
+		2: "企业自动分发",
+		3: "企业手动分发",
+	}
+)
+
+// GetSourceItem 获取标讯项目来源筛选项
+func (in *ParticipateStatistics) GetSourceItem(entId, positionId int) (result []*bxcore.SourceItem) {
+	redisKey := "sourceItem%s_%s"
+	query := "select distinct `source` from participate_push_statistics where "
+	// 个人用户
+	if entId == 0 {
+		// 查职位id
+		query += fmt.Sprintf(" position_id =%d", positionId)
+		redisKey = fmt.Sprintf(redisKey, "personal", positionId)
+	} else {
+		// 企业用户 用企业id查
+		query += fmt.Sprintf(" end =%d", entId)
+		redisKey = fmt.Sprintf(redisKey, "ent", entId)
+	}
+	if data, err := redis.GetBytes("other", redisKey); err == nil && data != nil {
+		err := json.Unmarshal(*data, &result)
+		if err == nil {
+			return result
+		} else {
+			log.Println("序列化失败", redisKey, err)
+		}
+	}
+	//
+	rs := IC.BaseMysql.SelectBySql(query)
+	if rs == nil || len(*rs) == 0 {
+		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),
+			})
+		}
+	}
+	if len(result) > 0 {
+		// todo 存缓存
+		rsByte, _ := json.Marshal(result)
+		redis.PutBytes("other", redisKey, &rsByte, 60*60*2)
+	}
+	return
+}
+
 func (in *ParticipateStatistics) PersonHandle(entUserIdArr []string) (isAdmin bool, idStr string, users *[]map[string]interface{}) {
 	userEnt := EntInfo(common.IntAll(in.EntId), common.IntAll(in.EntUserId))
 	if len(entUserIdArr) > 0 {
@@ -247,6 +302,7 @@ func ProjectHandle(data *[]map[string]interface{}, users *[]map[string]interface
 	for _, v := range *result {
 		personName := strings.Split(v.PersonName, "_")[0]
 		k := common.Int64All(strings.Split(v.PersonName, "_")[1])
+		a, _ := json.Marshal("balll")
 		projectStatisticsList[k] = &bxcore.ProjectStatisticsData{
 			PersonName:     personName,
 			DepartmentName: v.DepartmentName,
@@ -259,6 +315,7 @@ func ProjectHandle(data *[]map[string]interface{}, users *[]map[string]interface
 			ChannelWinNumb: common.Int64All(len(v.ChannelWinNumb)),
 			NotBidNumber:   common.Int64All(len(v.NotBidNumber)),
 			EndNumb:        common.Int64All(len(v.EndNumb)),
+			Stage:          &anypb.Any{Value: a},
 		}
 	}
 	return projectStatisticsList
@@ -385,7 +442,7 @@ func DataHanle(data map[string]interface{}, project_id string) map[string]interf
 	}
 	return data
 }
-func QueryHandle(isAdmin bool, startTime, endTime int64, personArrStr string, source int64, bidWay int64) []string {
+func QueryHandle(isAdmin bool, startTime, endTime int64, personArrStr string, source []int64, bidWay int64) []string {
 	//时间处理
 	query := []string{}
 	if isAdmin {
@@ -406,10 +463,15 @@ func QueryHandle(isAdmin bool, startTime, endTime int64, personArrStr string, so
 	if endTime != 0 {
 		query = append(query, fmt.Sprintf(" ymd <= %d ", endTime))
 	}
-	if source != -1 {
-		query = append(query, fmt.Sprintf("source = %d", source))
+	if len(source) > 0 {
+		sourceValue := ""
+		for i := 0; i < len(source); i++ {
+			sourceValue += fmt.Sprint(source[i]) + ","
+		}
+		sourceValue = sourceValue[:len(sourceValue)-1]
+		query = append(query, fmt.Sprintf("source in ( %s )", sourceValue))
 	}
-	if bidWay != -1 {
+	if bidWay != 0 {
 		query = append(query, fmt.Sprintf("bid_way = %d", bidWay))
 	}
 	return query

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


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