|
|
|
@@ -519,7 +519,7 @@ func QueryUserStaticDataForUserDefine(opts *UserBusinessAnalysisQueryOptions, wi |
|
|
|
} |
|
|
|
CommitDatasetSizeMap, CommitDatasetNumMap := queryDatasetSize(start_unix, end_unix) |
|
|
|
SolveIssueCountMap := querySolveIssue(start_unix, end_unix) |
|
|
|
CreateRepoCountMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
CreateRepoCountMap, _, _ := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
LoginCountMap := queryLoginCount(start_unix, end_unix) |
|
|
|
OpenIIndexMap := queryUserRepoOpenIIndex(start_unix, end_unix) |
|
|
|
CloudBrainTaskMap, CloudBrainTaskItemMap := queryCloudBrainTask(start_unix, end_unix) |
|
|
|
@@ -770,7 +770,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS |
|
|
|
//CommitCodeSizeMap := queryCommitCodeSize(StartTimeNextDay.Unix(), EndTimeNextDay.Unix()) |
|
|
|
CommitDatasetSizeMap, CommitDatasetNumMap := queryDatasetSize(start_unix, end_unix) |
|
|
|
SolveIssueCountMap := querySolveIssue(start_unix, end_unix) |
|
|
|
CreateRepoCountMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
CreateRepoCountMap, DetailInfoMap, MostDownloadMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
LoginCountMap := queryLoginCount(start_unix, end_unix) |
|
|
|
|
|
|
|
OpenIIndexMap := queryUserRepoOpenIIndex(startTime.Unix(), end_unix) |
|
|
|
@@ -883,6 +883,11 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS |
|
|
|
userMetrics["TotalHasActivityUser"] = getMapKeyStringValue("TotalHasActivityUser", userMetrics) + 1 |
|
|
|
} |
|
|
|
} |
|
|
|
if tableName == "user_business_analysis_current_year" { |
|
|
|
//年度数据 |
|
|
|
log.Info(fmt.Sprint(len(DetailInfoMap))) |
|
|
|
log.Info(fmt.Sprint(len(MostDownloadMap))) |
|
|
|
} |
|
|
|
} |
|
|
|
if len(dateRecordBatch) > 0 { |
|
|
|
err := insertTable(dateRecordBatch, tableName, statictisSess) |
|
|
|
@@ -1015,7 +1020,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, |
|
|
|
} |
|
|
|
CommitDatasetSizeMap, CommitDatasetNumMap := queryDatasetSize(start_unix, end_unix) |
|
|
|
SolveIssueCountMap := querySolveIssue(start_unix, end_unix) |
|
|
|
CreateRepoCountMap := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
CreateRepoCountMap, _, _ := queryUserCreateRepo(start_unix, end_unix) |
|
|
|
LoginCountMap := queryLoginCount(start_unix, end_unix) |
|
|
|
OpenIIndexMap := queryUserRepoOpenIIndex(start_unix, end_unix) |
|
|
|
CloudBrainTaskMap, CloudBrainTaskItemMap := queryCloudBrainTask(start_unix, end_unix) |
|
|
|
@@ -1494,14 +1499,15 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[i |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
|
|
|
|
cond := "user_id=act_user_id and op_type=" + fmt.Sprint(actionType) + " and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) |
|
|
|
mostActiveMap := make(map[int64]map[string]int) |
|
|
|
cond := "user_id=act_user_id and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) |
|
|
|
|
|
|
|
count, err := sess.Where(cond).Count(new(Action)) |
|
|
|
if err != nil { |
|
|
|
log.Info("query action error. return.") |
|
|
|
return resultMap |
|
|
|
} |
|
|
|
|
|
|
|
var indexTotal int64 |
|
|
|
indexTotal = 0 |
|
|
|
for { |
|
|
|
@@ -1511,13 +1517,22 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[i |
|
|
|
|
|
|
|
log.Info("query action size=" + fmt.Sprint(len(actionList))) |
|
|
|
for _, actionRecord := range actionList { |
|
|
|
if _, ok := resultMap[actionRecord.UserID]; !ok { |
|
|
|
resultMap[actionRecord.UserID] = 1 |
|
|
|
if int64(actionRecord.OpType) == actionType { |
|
|
|
if _, ok := resultMap[actionRecord.UserID]; !ok { |
|
|
|
resultMap[actionRecord.UserID] = 1 |
|
|
|
} else { |
|
|
|
resultMap[actionRecord.UserID] += 1 |
|
|
|
} |
|
|
|
} |
|
|
|
if _, ok := mostActiveMap[actionRecord.UserID]; !ok { |
|
|
|
mostActiveMap[actionRecord.UserID] = 1 |
|
|
|
} else { |
|
|
|
resultMap[actionRecord.UserID] += 1 |
|
|
|
key := getDate(actionRecord.CreatedUnix) |
|
|
|
|
|
|
|
mostActiveMap[actionRecord.UserID][key] = getMapKeyStringValue(key, mostActiveMap[actionRecord.UserID]) + 1 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
indexTotal += PAGE_SIZE |
|
|
|
if indexTotal >= count { |
|
|
|
break |
|
|
|
@@ -1526,6 +1541,9 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[i |
|
|
|
|
|
|
|
return resultMap |
|
|
|
} |
|
|
|
func getDate(createTime timeutil.TimeStamp) string { |
|
|
|
return "" |
|
|
|
} |
|
|
|
|
|
|
|
func queryCreateIssue(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
|
|
|
|
@@ -1961,29 +1979,47 @@ func queryDatasetSize(start_unix int64, end_unix int64) (map[int64]int, map[int6 |
|
|
|
return resultSizeMap, resultNumMap |
|
|
|
} |
|
|
|
|
|
|
|
func queryUserCreateRepo(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
func queryUserCreateRepo(start_unix int64, end_unix int64) (map[int64]int, map[string]int, map[int64]string) { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
resultMap := make(map[int64]int) |
|
|
|
|
|
|
|
detailInfoMap := make(map[string]int) |
|
|
|
mostDownloadMap := make(map[int64]string) |
|
|
|
|
|
|
|
cond := "is_fork=false and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) |
|
|
|
count, err := sess.Where(cond).Count(new(Repository)) |
|
|
|
if err != nil { |
|
|
|
log.Info("query Repository error. return.") |
|
|
|
return resultMap |
|
|
|
return resultMap, detailInfoMap, mostDownloadMap |
|
|
|
} |
|
|
|
var indexTotal int64 |
|
|
|
indexTotal = 0 |
|
|
|
for { |
|
|
|
sess.Select("id,owner_id,name").Table("repository").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) |
|
|
|
sess.Select("id,owner_id,name,is_private,clone_cnt").Table("repository").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) |
|
|
|
repoList := make([]*Repository, 0) |
|
|
|
sess.Find(&repoList) |
|
|
|
log.Info("query Repository size=" + fmt.Sprint(len(repoList))) |
|
|
|
for _, repoRecord := range repoList { |
|
|
|
if _, ok := resultMap[repoRecord.OwnerID]; !ok { |
|
|
|
resultMap[repoRecord.OwnerID] = 1 |
|
|
|
resultMap[repoRecord.OwnerID] = getMapValue(repoRecord.OwnerID, resultMap) + 1 |
|
|
|
|
|
|
|
key := fmt.Sprint(repoRecord.OwnerID) + "_total" |
|
|
|
detailInfoMap[key] = getMapKeyStringValue(key, detailInfoMap) + 1 |
|
|
|
|
|
|
|
if repoRecord.IsPrivate { |
|
|
|
key := fmt.Sprint(repoRecord.OwnerID) + "_is_private" |
|
|
|
detailInfoMap[key] = getMapKeyStringValue(key, detailInfoMap) + 1 |
|
|
|
} else { |
|
|
|
resultMap[repoRecord.OwnerID] += 1 |
|
|
|
key := fmt.Sprint(repoRecord.OwnerID) + "_is_public" |
|
|
|
detailInfoMap[key] = getMapKeyStringValue(key, detailInfoMap) + 1 |
|
|
|
} |
|
|
|
key = fmt.Sprint(repoRecord.OwnerID) + "_total_download" |
|
|
|
detailInfoMap[key] = getMapKeyStringValue(key, detailInfoMap) + int(repoRecord.CloneCnt) |
|
|
|
|
|
|
|
key = fmt.Sprint(repoRecord.OwnerID) + "_most_download" |
|
|
|
if int(repoRecord.CloneCnt) > getMapKeyStringValue(key, detailInfoMap) { |
|
|
|
detailInfoMap[key] = int(repoRecord.CloneCnt) |
|
|
|
mostDownloadMap[repoRecord.OwnerID] = repoRecord.DisplayName() |
|
|
|
} |
|
|
|
} |
|
|
|
indexTotal += PAGE_SIZE |
|
|
|
@@ -1992,7 +2028,7 @@ func queryUserCreateRepo(start_unix int64, end_unix int64) map[int64]int { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return resultMap |
|
|
|
return resultMap, detailInfoMap, mostDownloadMap |
|
|
|
} |
|
|
|
|
|
|
|
func queryUserRepoOpenIIndex(start_unix int64, end_unix int64) map[int64]float64 { |
|
|
|
|