|
@@ -30,9 +30,9 @@ func (in *ParticipateStatistics) PushStatistics(entUserIdArr []string, startTime
|
|
|
//时间处理
|
|
|
query := QueryHandle(isAdmin, startTime, endTime, personArrStr)
|
|
|
//推送数据查询
|
|
|
- dataList := IC.BaseMysql.SelectBySql(fmt.Sprintf("select * from participate_push_statistics where %s", strings.Join(query, " and ")))
|
|
|
- if dataList != nil && len(*dataList) > 0 && users != nil && len(*users) > 0 {
|
|
|
- result = PushHandle(dataList, users)
|
|
|
+ dataList := IC.BaseMysql.SelectBySql(fmt.Sprintf("select * from participate_push_statistics where %s order by ymd", strings.Join(query, " and ")))
|
|
|
+ if users != nil && len(*users) > 0 {
|
|
|
+ result = PushHandle(dataList, users, isAdmin)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -43,9 +43,9 @@ func (in *ParticipateStatistics) ProjectStatistics(entUserIdArr []string, startT
|
|
|
query := QueryHandle(isAdmin, startTime, endTime, personArrStr)
|
|
|
//订阅推送数处理
|
|
|
//推送数据查询
|
|
|
- dataList := IC.BaseMysql.SelectBySql(fmt.Sprintf("select * from participate_project_statistics where %s", strings.Join(query, "and ")))
|
|
|
- if dataList != nil && len(*dataList) > 0 && users != nil && len(*users) > 0 {
|
|
|
- result = ProjectHandle(dataList, users)
|
|
|
+ dataList := IC.BaseMysql.SelectBySql(fmt.Sprintf("select * from participate_project_statistics where %s order by ymd", strings.Join(query, "and ")))
|
|
|
+ if users != nil && len(*users) > 0 {
|
|
|
+ result = ProjectHandle(dataList, users, isAdmin)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -71,8 +71,23 @@ func (in *ParticipateStatistics) PersonHandle(entUserIdArr []string) (isAdmin bo
|
|
|
isAdmin = true
|
|
|
idStr = strings.Join(staffs, ",")
|
|
|
} else {
|
|
|
- isAdmin = false
|
|
|
- idStr = common.InterfaceToStr(in.PositionId)
|
|
|
+ if userEnt.Dept.Id != 0 {
|
|
|
+ entUserIdArr = append(entUserIdArr, common.InterfaceToStr(in.EntUserId))
|
|
|
+ users = GetUser(entUserIdArr)
|
|
|
+ //返回所选人的信息
|
|
|
+ isAdmin = true
|
|
|
+ idStr = strings.Join(entUserIdArr, ",")
|
|
|
+ } else {
|
|
|
+ isAdmin = false
|
|
|
+ idStr = common.InterfaceToStr(in.PositionId)
|
|
|
+ users = &[]map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "id": in.PositionId,
|
|
|
+ "name": "个人",
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return
|
|
@@ -102,7 +117,7 @@ type ProjectData struct {
|
|
|
EndNumb map[string]interface{} //终止数量
|
|
|
}
|
|
|
|
|
|
-func PushHandle(data *[]map[string]interface{}, users *[]map[string]interface{}) []*bxcore.PushStatisticsData {
|
|
|
+func PushHandle(data *[]map[string]interface{}, users *[]map[string]interface{}, isAdmin bool) []*bxcore.PushStatisticsData {
|
|
|
result := &map[int64]*PushData{}
|
|
|
for k, v := range *users {
|
|
|
(*result)[common.Int64All(v["id"])] = &PushData{
|
|
@@ -111,35 +126,40 @@ func PushHandle(data *[]map[string]interface{}, users *[]map[string]interface{})
|
|
|
entUserId: common.InterfaceToStr(v["id"]),
|
|
|
}
|
|
|
}
|
|
|
- for _, v := range *data {
|
|
|
- if (*result)[common.Int64All(v["ent_user_id"])] != nil {
|
|
|
- //浏览总数处理处理
|
|
|
- project_id := common.InterfaceToStr(common.InterfaceToStr(v["project_id"]))
|
|
|
- if common.Int64All(v["isvisit"]) > 0 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].BrowseNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].BrowseNumb, project_id)
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ userId := int64(0)
|
|
|
+ if isAdmin {
|
|
|
+ userId = common.Int64All(v["ent_user_id"])
|
|
|
+ } else {
|
|
|
+ userId = common.Int64All(v["position_id"])
|
|
|
}
|
|
|
- if common.IntAll(v["ispush"]) > 0 {
|
|
|
+ if (*result)[userId] != nil {
|
|
|
+ //浏览总数处理处理
|
|
|
+ project_id := common.InterfaceToStr(common.InterfaceToStr(v["project_id"]))
|
|
|
+ if common.Int64All(v["isvisit"]) > 0 {
|
|
|
+ (*result)[userId].BrowseNumb = DataHanle((*result)[userId].BrowseNumb, project_id)
|
|
|
+ }
|
|
|
//推送总数处理
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].PushNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].PushNumb, project_id)
|
|
|
+ (*result)[userId].PushNumb = DataHanle((*result)[userId].PushNumb, project_id)
|
|
|
//参标总数处理
|
|
|
if common.Int64All(v["isparticipate"]) > 0 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].ParticipateNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].ParticipateNumb, project_id)
|
|
|
+ (*result)[userId].ParticipateNumb = DataHanle((*result)[userId].ParticipateNumb, project_id)
|
|
|
}
|
|
|
//投标总数处理
|
|
|
if common.Int64All(v["isbid"]) > 0 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].BidNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].BidNumb, project_id)
|
|
|
+ (*result)[userId].BidNumb = DataHanle((*result)[userId].BidNumb, project_id)
|
|
|
}
|
|
|
//中标总数处理
|
|
|
if common.Int64All(v["win_status"]) != 0 {
|
|
|
win_status := common.Int64All(v["win_status"])
|
|
|
if win_status > 1 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].WinNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].WinNumb, project_id)
|
|
|
+ (*result)[userId].WinNumb = DataHanle((*result)[userId].WinNumb, project_id)
|
|
|
} else {
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].WinNumb, project_id)
|
|
|
+ delete((*result)[userId].WinNumb, project_id)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
pushStatisticsList := make([]*bxcore.PushStatisticsData, len(*result))
|
|
@@ -159,7 +179,7 @@ func PushHandle(data *[]map[string]interface{}, users *[]map[string]interface{})
|
|
|
}
|
|
|
return pushStatisticsList
|
|
|
}
|
|
|
-func ProjectHandle(data *[]map[string]interface{}, users *[]map[string]interface{}) []*bxcore.ProjectStatisticsData {
|
|
|
+func ProjectHandle(data *[]map[string]interface{}, users *[]map[string]interface{}, isAdmin bool) []*bxcore.ProjectStatisticsData {
|
|
|
result := &map[int64]*ProjectData{}
|
|
|
for k, v := range *users {
|
|
|
(*result)[common.Int64All(v["id"])] = &ProjectData{
|
|
@@ -168,50 +188,58 @@ func ProjectHandle(data *[]map[string]interface{}, users *[]map[string]interface
|
|
|
entUserId: common.InterfaceToStr(v["id"]),
|
|
|
}
|
|
|
}
|
|
|
- for _, v := range *data {
|
|
|
- project_id := common.InterfaceToStr(common.InterfaceToStr(v["project_id"]))
|
|
|
- if (*result)[common.Int64All(v["ent_user_id"])] != nil {
|
|
|
- //投标数量
|
|
|
- if common.Int64All(v["isbid"]) > 0 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].BidNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].BidNumb, project_id)
|
|
|
-
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ userId := int64(0)
|
|
|
+ if isAdmin {
|
|
|
+ userId = common.Int64All(v["ent_user_id"])
|
|
|
+ } else {
|
|
|
+ userId = common.Int64All(v["position_id"])
|
|
|
}
|
|
|
- //直接投标数
|
|
|
- if common.Int64All(v["bid_way"]) > 0 {
|
|
|
- if common.Int64All(v["bid_way"]) == 2 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].ChannelBidNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].ChannelBidNumb, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].DirectBidNumb, project_id)
|
|
|
- } else {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].DirectBidNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].DirectBidNumb, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].ChannelBidNumb, project_id)
|
|
|
+ project_id := common.InterfaceToStr(common.InterfaceToStr(v["project_id"]))
|
|
|
+ if (*result)[userId] != nil {
|
|
|
+ //投标数量
|
|
|
+ if common.Int64All(v["isbid"]) > 0 {
|
|
|
+ (*result)[userId].BidNumb = DataHanle((*result)[userId].BidNumb, project_id)
|
|
|
}
|
|
|
- }
|
|
|
- //中标总数处理
|
|
|
- if common.Int64All(v["win_status"]) != 0 {
|
|
|
- if common.Int64All(v["win_status"]) > 0 {
|
|
|
- //中标数量
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].WinNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].WinNumb, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].NotBidNumber, project_id)
|
|
|
- } else {
|
|
|
- //未中标数量
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].NotBidNumber = DataHanle((*result)[common.Int64All(v["ent_user_id"])].NotBidNumber, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].WinNumb, project_id)
|
|
|
+ //直接投标数
|
|
|
+ if common.Int64All(v["bid_way"]) > 0 {
|
|
|
+ if common.Int64All(v["bid_way"]) == 2 {
|
|
|
+ (*result)[userId].ChannelBidNumb = DataHanle((*result)[userId].ChannelBidNumb, project_id)
|
|
|
+ delete((*result)[userId].DirectBidNumb, project_id)
|
|
|
+ } else {
|
|
|
+ (*result)[userId].DirectBidNumb = DataHanle((*result)[userId].DirectBidNumb, project_id)
|
|
|
+ delete((*result)[userId].ChannelBidNumb, project_id)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- //中标方式处理
|
|
|
- if common.Int64All(v["win_bidway"]) != 0 {
|
|
|
- if common.Int64All(v["win_bidway"]) == 1 {
|
|
|
- //直接投标数量
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].DirectWinNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].DirectWinNumb, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].ChannelWinNumb, project_id)
|
|
|
- } else {
|
|
|
- //渠道投标数量
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].ChannelWinNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].ChannelWinNumb, project_id)
|
|
|
- delete((*result)[common.Int64All(v["ent_user_id"])].DirectWinNumb, project_id)
|
|
|
+ //中标总数处理
|
|
|
+ if common.Int64All(v["win_status"]) != 0 {
|
|
|
+ if common.Int64All(v["win_status"]) > 0 {
|
|
|
+ //中标数量
|
|
|
+ (*result)[userId].WinNumb = DataHanle((*result)[userId].WinNumb, project_id)
|
|
|
+ delete((*result)[userId].NotBidNumber, project_id)
|
|
|
+ } else {
|
|
|
+ //未中标数量
|
|
|
+ (*result)[userId].NotBidNumber = DataHanle((*result)[userId].NotBidNumber, project_id)
|
|
|
+ delete((*result)[userId].WinNumb, project_id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //中标方式处理
|
|
|
+ if common.Int64All(v["win_bidway"]) != 0 {
|
|
|
+ if common.Int64All(v["win_bidway"]) == 1 {
|
|
|
+ //直接投标数量
|
|
|
+ (*result)[userId].DirectWinNumb = DataHanle((*result)[userId].DirectWinNumb, project_id)
|
|
|
+ delete((*result)[userId].ChannelWinNumb, project_id)
|
|
|
+ } else {
|
|
|
+ //渠道投标数量
|
|
|
+ (*result)[userId].ChannelWinNumb = DataHanle((*result)[userId].ChannelWinNumb, project_id)
|
|
|
+ delete((*result)[userId].DirectWinNumb, project_id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //终止参保统计
|
|
|
+ if common.Int64All(v["isend"]) != 0 {
|
|
|
+ (*result)[userId].EndNumb = DataHanle((*result)[userId].EndNumb, project_id)
|
|
|
}
|
|
|
- }
|
|
|
- if common.Int64All(v["win_bidway"]) != 0 {
|
|
|
- (*result)[common.Int64All(v["ent_user_id"])].EndNumb = DataHanle((*result)[common.Int64All(v["ent_user_id"])].EndNumb, project_id)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -301,12 +329,13 @@ func GetDisUsers(entId, deptId int) *[]map[string]interface{} {
|
|
|
return r
|
|
|
}
|
|
|
func GetUser(entUserIdArr []string) *[]map[string]interface{} {
|
|
|
- r := IC.MainMysql.SelectBySql("SELECT DISTINCT a.id, a.name, a.phone, d.id AS dept_id, d.NAME AS dept_name "+
|
|
|
- "FROM entniche_user a "+
|
|
|
- " INNER JOIN entniche_department_user b ON a.id in (?) and b.user_id = a.id "+
|
|
|
- " INNER JOIN entniche_department d ON d.id = b.dept_id "+
|
|
|
+ r := IC.MainMysql.SelectBySql("SELECT DISTINCT a.id, a.name, a.phone, d.id AS dept_id, d.NAME AS dept_name " +
|
|
|
+ "FROM entniche_user a " +
|
|
|
+ " INNER JOIN entniche_department_user b ON FIND_IN_SET(a.id,'" + strings.Join(entUserIdArr, ",") +
|
|
|
+ "') and b.user_id = a.id " +
|
|
|
+ " INNER JOIN entniche_department d ON d.id = b.dept_id " +
|
|
|
" ORDER BY d.id, CONVERT ( a.NAME USING gbk ) COLLATE gbk_chinese_ci ASC",
|
|
|
- strings.Join(entUserIdArr, ","))
|
|
|
+ )
|
|
|
return r
|
|
|
}
|
|
|
|
|
@@ -364,7 +393,7 @@ func QueryHandle(isAdmin bool, startTime, endTime int64, personArrStr string) []
|
|
|
query = append(query, fmt.Sprintf(" ent_user_id in (%s) ", personArrStr))
|
|
|
} else {
|
|
|
//不是管理员
|
|
|
- query = append(query, fmt.Sprintf(" position_id = %d ", personArrStr))
|
|
|
+ query = append(query, fmt.Sprintf(" position_id = %s ", personArrStr))
|
|
|
}
|
|
|
if startTime == 0 && endTime == 0 {
|
|
|
//没有传时间,默认时间处理
|