作者 yangfu

我的审核修改

@@ -28,16 +28,20 @@ @@ -28,16 +28,20 @@
28 |功能|完成状态|时间|接口路径 28 |功能|完成状态|时间|接口路径
29 |---|---|----|----| 29 |---|---|----|----|
30 |我的机会-我提交的| | |/v1/chance/mySubmitChance| 30 |我的机会-我提交的| | |/v1/chance/mySubmitChance|
31 -|机会详情| | |v1/chance/detail|  
32 -|机会更新| | | |  
33 -|机会删除| | |/v1/chance/delete|  
34 -|我的机会-我的审核| | | |  
35 -|机会审核| | | /v1/chance/approve|  
36 -|机会修改评分| | |/v1/chance/changeScore|  
37 -|机会修改公开状态| | |/v1/chance/changePublish|  
38 -|计算发现分| | |/v1/chance/calculateScore|  
39 -|用户机会权限| | | | 31 +|我的机会-我的审核| | |/v1/chance/myApproveChance|
  32 +|机会-详情| | |v1/chance/detail|
  33 +|机会-更新| | | |
  34 +|机会-删除| | |/v1/chance/delete|
  35 +|机会-审核| | | /v1/chance/approve|
  36 +|机会-修改评分| | |/v1/chance/changeScore|
  37 +|机会-修改公开状态| | |/v1/chance/changePublish|
  38 +|机会-计算发现分| | |/v1/chance/calculateScore|
  39 +|配置-用户机会权限| | | |
  40 +|配置-评分| | |v1/config/score|
  41 +|消息-机会审核消息| | | |
40 |机会池| | | | 42 |机会池| | | |
  43 +|我的机会-我的收藏| | |/v1/chance/|
  44 +|我的机会-我的点赞| | |/v1/chance/|
41 |消息-点赞| | |v1/message/msgInteractive| 45 |消息-点赞| | |v1/message/msgInteractive|
42 |消息-评论| | |v1/message/msgInteractive| 46 |消息-评论| | |v1/message/msgInteractive|
43 |机会评论列表| | |/v1/chance/comments| 47 |机会评论列表| | |/v1/chance/comments|
@@ -51,10 +55,5 @@ @@ -51,10 +55,5 @@
51 |机会审核消息| | |v1/message/msgInteractive| 55 |机会审核消息| | |v1/message/msgInteractive|
52 |我提交的机会| | | v1/chance/chances| 56 |我提交的机会| | | v1/chance/chances|
53 |我审核的机会| | | v1/chance/chances| 57 |我审核的机会| | | v1/chance/chances|
54 -|机会详情| | | |  
55 -|待抓住机会列表| | |v1/chance/chances|  
56 -|配置-评分| | |v1/config/score|  
57 -|机会审核| | |v1/chance/audit|  
58 -|机会修改评分| | |v1/chance/editScore|  
59 -|机会修改公开状态| | |v1/chance/editStatus| 58 +
60 59
@@ -231,7 +231,7 @@ func (this *ChanceController) ChanceSubmit() { @@ -231,7 +231,7 @@ func (this *ChanceController) ChanceSubmit() {
231 msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request)) 231 msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request))
232 } 232 }
233 233
234 -//ChanceStatistics 234 +//ChanceStatistics 机会统计
235 //@router /statistics [post] 235 //@router /statistics [post]
236 func (this *ChanceController) ChanceStatistics() { 236 func (this *ChanceController) ChanceStatistics() {
237 var msg *protocol.ResponseMessage 237 var msg *protocol.ResponseMessage
@@ -150,7 +150,7 @@ func ExecuteQueryOneWithOrmer(o orm.Ormer, result interface{}, sqlstr string, pa @@ -150,7 +150,7 @@ func ExecuteQueryOneWithOrmer(o orm.Ormer, result interface{}, sqlstr string, pa
150 150
151 //ExecuteQuerySql 执行原生sql查询多条记录 151 //ExecuteQuerySql 执行原生sql查询多条记录
152 func ExecuteQueryAll(result interface{}, sqlstr string, param ...interface{}) error { 152 func ExecuteQueryAll(result interface{}, sqlstr string, param ...interface{}) error {
153 - PrintLogSql(sqlstr, param...) 153 + //PrintLogSql(sqlstr, param...)
154 var err error 154 var err error
155 o := orm.NewOrm() 155 o := orm.NewOrm()
156 err = ExecuteQueryAllWithOrmer(o, result, sqlstr, param) 156 err = ExecuteQueryAllWithOrmer(o, result, sqlstr, param)
@@ -109,12 +109,12 @@ order by create_at desc @@ -109,12 +109,12 @@ order by create_at desc
109 limit ? 109 limit ?
110 ) a left JOIN chance_data b on a.id =b.chance_id` 110 ) a left JOIN chance_data b on a.id =b.chance_id`
111 111
112 - sqlCount := `select count(0) from ( 112 + sqlCount := fmt.Sprintf(`select count(0) from (
113 select id,user_id,create_at,source_content from chance 113 select id,user_id,create_at,source_content from chance
114 -where user_id=? and company_id=? and review_status in (?) 114 +where user_id=? and company_id=? and review_status in (%v)
115 order by create_at desc 115 order by create_at desc
116 -) a left JOIN chance_data b on a.id =b.chance_id`  
117 - if err = utils.ExecuteQueryOne(&total, sqlCount, uid, cid, utils.JoinInt8s(reviewStatus, ",")); err != nil { 116 +) a left JOIN chance_data b on a.id =b.chance_id`, utils.JoinInt8s(reviewStatus, ","))
  117 + if err = utils.ExecuteQueryOne(&total, sqlCount, uid, cid); err != nil {
118 return 118 return
119 } 119 }
120 if v != nil { 120 if v != nil {
@@ -126,22 +126,22 @@ order by create_at desc @@ -126,22 +126,22 @@ order by create_at desc
126 } 126 }
127 127
128 func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) { 128 func GetChanceMyApproveChance(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) {
129 - sql := `select a.*,b.images,b.speechs,b.videos from ( 129 + sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from (
130 select a.*,b.user_id,b.source_content,b.enable_status from ( 130 select a.*,b.user_id,b.source_content,b.enable_status from (
131 select id,approve_time,approve_data,uid,chance_id,approve_message,create_at process_create_time 131 select id,approve_time,approve_data,uid,chance_id,approve_message,create_at process_create_time
132 -from audit_flow_process where uid=? and enable_status =1 and review_status in (?) and (?=0 or id>?) 132 +from audit_flow_process where uid=? and enable_status =1 and review_status in (%v) and (?=0 or id>?)
133 )a left outer join chance b on a.chance_id = b.id 133 )a left outer join chance b on a.chance_id = b.id
134 )a left outer join chance_data b on a.chance_id =b.chance_id 134 )a left outer join chance_data b on a.chance_id =b.chance_id
135 order by a.approve_time desc 135 order by a.approve_time desc
136 -LIMIT ?` 136 +LIMIT ?`, utils.JoinInt8s(reviewStatus, ","))
137 137
138 - sqlCount := `select count(0)  
139 -from audit_flow_process where uid=? and enable_status =1 and review_status in (?) `  
140 - if err = utils.ExecuteQueryOne(&total, sqlCount, uid, utils.JoinInt8s(reviewStatus, ",")); err != nil { 138 + sqlCount := fmt.Sprintf(`select count(0)
  139 +from audit_flow_process where uid=? and enable_status =1 and review_status in (%v) `, utils.JoinInt8s(reviewStatus, ","))
  140 + if err = utils.ExecuteQueryOne(&total, sqlCount, uid); err != nil {
141 return 141 return
142 } 142 }
143 if v != nil { 143 if v != nil {
144 - if err = utils.ExecuteQueryAll(v, sql, uid, utils.JoinInt8s(reviewStatus, ","), lastId, lastId, pageSize); err != nil { 144 + if err = utils.ExecuteQueryAll(v, sql, uid, lastId, lastId, pageSize); err != nil {
145 return 145 return
146 } 146 }
147 } 147 }
@@ -53,7 +53,7 @@ const ( @@ -53,7 +53,7 @@ const (
53 ChanceStatusClose = 2 //关闭 53 ChanceStatusClose = 2 //关闭
54 ) 54 )
55 55
56 -/*Favorite */ 56 +/*Favorite 我的收藏/点赞*/
57 type FavoriteRequest struct { 57 type FavoriteRequest struct {
58 ObjectType int `json:"object_type" valid:"Required"` //收藏 点赞 58 ObjectType int `json:"object_type" valid:"Required"` //收藏 点赞
59 ChanceType int `json:"chance_type" valid:"Required"` 59 ChanceType int `json:"chance_type" valid:"Required"`
@@ -66,29 +66,7 @@ type FavoriteResponse struct { @@ -66,29 +66,7 @@ type FavoriteResponse struct {
66 Lists []*ChanceFavorite `json:"lists"` 66 Lists []*ChanceFavorite `json:"lists"`
67 } 67 }
68 68
69 -type ChanceFavorite struct {  
70 - Id int64 `json:"id"`  
71 - Favorite interface{} `json:"favorite"`  
72 -}  
73 -  
74 -type ChanceDetail struct {  
75 - Id int64 `json:"id"`  
76 - Provider *BaseUserInfo `json:"provider"`  
77 - IsCollect bool `json:"is_collect"`  
78 - IsZan bool `json:"is_zan"`  
79 - Content string `json:"content"`  
80 - ChanceType int `json:"chance_type"`  
81 -  
82 - //图片  
83 - //视频  
84 - //语音  
85 -  
86 - ViewTotal int `json:"view_total"`  
87 - CommentTotal int `json:"comment_total"`  
88 - ZanTotal int `json:"zan_total"`  
89 -}  
90 -  
91 -/*SympathyAction */ 69 +/*SympathyAction 点赞,收藏*/
92 type SympathyActionRequest struct { 70 type SympathyActionRequest struct {
93 MarkType int `json:"mark_type" valid:"Required"` // 1.赞 2.收藏 71 MarkType int `json:"mark_type" valid:"Required"` // 1.赞 2.收藏
94 SourceType int `json:"source_type" valid:"Required"` //protocol.SourceType //机会 评论 72 SourceType int `json:"source_type" valid:"Required"` //protocol.SourceType //机会 评论
@@ -113,27 +91,7 @@ type TemplatesResponse struct { @@ -113,27 +91,7 @@ type TemplatesResponse struct {
113 Templates []*Template `json:"list"` 91 Templates []*Template `json:"list"`
114 } 92 }
115 93
116 -//模板  
117 -type Template struct {  
118 - Id int64 `json:"id"`  
119 - Name string `json:"name"`  
120 - Doc string `json:"doc"`  
121 - Icon string `json:"icon"`  
122 - FormList []*Form `json:"formList"`  
123 - Link string `json:"link"` //示例  
124 -}  
125 -  
126 -//表单  
127 -type Form struct {  
128 - Id int `json:"id"`  
129 - Label string `json:"label"`  
130 - InputType string `json:"inputType"`  
131 - SectionType int8 `json:"sectionType"`  
132 - Value string `json:"value"`  
133 - Required int8 `json:"required"`  
134 -}  
135 -  
136 -/*ChanceExample*/ 94 +/*ChanceExample 机会示例*/
137 type ChanceExampleRequest struct { 95 type ChanceExampleRequest struct {
138 TemplateId int `json:"templateId" valid:"Required"` 96 TemplateId int `json:"templateId" valid:"Required"`
139 } 97 }
@@ -141,6 +99,7 @@ type ChanceExampleResponse struct { @@ -141,6 +99,7 @@ type ChanceExampleResponse struct {
141 Content string `json:"content"` 99 Content string `json:"content"`
142 } 100 }
143 101
  102 +/*提交机会*/
144 type ChanceSubmitRequest struct { 103 type ChanceSubmitRequest struct {
145 Id int64 `json:"id"` // = 0添加 >0 编辑 104 Id int64 `json:"id"` // = 0添加 >0 编辑
146 AuditTemplateId int64 `json:"auditTemplateId" valid:"Required"` 105 AuditTemplateId int64 `json:"auditTemplateId" valid:"Required"`
@@ -151,29 +110,9 @@ type ChanceSubmitRequest struct { @@ -151,29 +110,9 @@ type ChanceSubmitRequest struct {
151 Videos []Video `json:"videos"` 110 Videos []Video `json:"videos"`
152 RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"` 111 RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"`
153 } 112 }
154 -  
155 type ChanceSubmitResponse struct { 113 type ChanceSubmitResponse struct {
156 } 114 }
157 115
158 -type Speech struct {  
159 - Path string `json:"path"`  
160 - Duration int `json:"duration"`  
161 -}  
162 -type Picture struct {  
163 - Path string `json:"path"`  
164 - W int `json:"w"`  
165 - H int `json:"h"`  
166 -}  
167 -type Video struct {  
168 - Path string `json:"path"`  
169 - Cover Cover `json:"cover"` //封面  
170 - Duration int `json:"duration"`  
171 -}  
172 -  
173 -type AuditConfig struct {  
174 - NoApprover int8 `json:"no_approver"` //审核人空时:【1:自动通过】【2:转交给管理员】  
175 -}  
176 -  
177 /*ChanceStatistics 首页-机会池统计*/ 116 /*ChanceStatistics 首页-机会池统计*/
178 type ChanceStatisticsRequest struct { 117 type ChanceStatisticsRequest struct {
179 } 118 }
@@ -182,12 +121,6 @@ type ChanceStatisticsResponse struct { @@ -182,12 +121,6 @@ type ChanceStatisticsResponse struct {
182 List []ChanceTotalItem `json:"list"` 121 List []ChanceTotalItem `json:"list"`
183 } 122 }
184 123
185 -type ChanceTotalItem struct {  
186 - Id int `json:"id"` //类型  
187 - Name string `json:"name"` //总数  
188 - Total int `json:"total"`  
189 -}  
190 -  
191 /*MyChance 我的机会*/ 124 /*MyChance 我的机会*/
192 type MySubmitChanceRequest struct { 125 type MySubmitChanceRequest struct {
193 LastId int64 `json:"lastId"` 126 LastId int64 `json:"lastId"`
@@ -199,31 +132,6 @@ type MySubmitChanceResponse struct { @@ -199,31 +132,6 @@ type MySubmitChanceResponse struct {
199 Total int `json:"total"` 132 Total int `json:"total"`
200 } 133 }
201 134
202 -/*MyApproveChance 我审核的机会*/  
203 -type MyApproveChanceRequest struct {  
204 - LastId int64 `json:"lastId"`  
205 - PageSize int `json:"pageSize" valid:"Required"`  
206 - ReviewStatus int8 `json:"reviewStatus"` //审核状态  
207 -}  
208 -type MyApproveChanceResponse struct {  
209 - List []CommonListItem `json:"list"`  
210 - Total int `json:"total"`  
211 -}  
212 -  
213 -//机会列表 通用项  
214 -type CommonListItem struct {  
215 - Chance ChanceItem `json:"chance,omitempty"` //机会详情  
216 - ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData  
217 - Approve interface{} `json:"approve,omitempty"` //审核人 审核信息(时间) Approve  
218 - ApproveData interface{} `json:"approveData,omitempty"` //审核数据(公开状态 评分) ApproveData  
219 - Message interface{} `json:"message,omitempty"`  
220 - Comment interface{} `json:"comment,omitempty"`  
221 - ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭  
222 -}  
223 -  
224 -type ChanceData struct {  
225 -}  
226 -  
227 //我的机会列表 135 //我的机会列表
228 type ChanceItemOrm struct { 136 type ChanceItemOrm struct {
229 Id int64 `orm:"column(id)"` 137 Id int64 `orm:"column(id)"`
@@ -236,14 +144,16 @@ type ChanceItemOrm struct { @@ -236,14 +144,16 @@ type ChanceItemOrm struct {
236 144
237 ApproveData string `json:"approveData"` //审核数据 145 ApproveData string `json:"approveData"` //审核数据
238 } 146 }
239 -type ChanceItem struct {  
240 - Id int64 `json:"id"`  
241 - CreateTime int64 `json:"createTime"`  
242 - Provider *BaseUserInfo `json:"provider"`  
243 - FormList []*Form `json:"formList" valid:"Required"`  
244 - Speechs []Speech `json:"speechs"`  
245 - Pictures []Picture `json:"pictures"`  
246 - Videos []Video `json:"videos"` 147 +
  148 +/*MyApproveChance 我审核的机会*/
  149 +type MyApproveChanceRequest struct {
  150 + LastId int64 `json:"lastId"`
  151 + PageSize int `json:"pageSize" valid:"Required"`
  152 + ReviewStatus int8 `json:"reviewStatus"` //审核状态
  153 +}
  154 +type MyApproveChanceResponse struct {
  155 + List []CommonListItem `json:"list"`
  156 + Total int `json:"total"`
247 } 157 }
248 158
249 //我的审核机会列表 159 //我的审核机会列表
@@ -270,18 +180,12 @@ type ChanceDetailRequest struct { @@ -270,18 +180,12 @@ type ChanceDetailRequest struct {
270 } 180 }
271 type ChanceDetailResponse struct { 181 type ChanceDetailResponse struct {
272 ChanceDetail ChanceItem `json:"chance"` 182 ChanceDetail ChanceItem `json:"chance"`
273 - ApproveData *ApproveData `json:"publicData"` 183 + ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
  184 + ApproveData *ApproveData `json:"approveData"`
274 ApproveProcess []*ProcessItem `json:"approveProcess"` 185 ApproveProcess []*ProcessItem `json:"approveProcess"`
275 ApproveAccess *ApproveAccess `json:"approveAccess"` // 186 ApproveAccess *ApproveAccess `json:"approveAccess"` //
276 } 187 }
277 188
278 -/*ChanceDelete 机会删除*/  
279 -type ChanceDeleteRequest struct {  
280 - Id int64 `json:"id"` //机会编号  
281 -}  
282 -type ChanceDeleteResponse struct {  
283 -}  
284 -  
285 /*ChanceChangePublish 修改公开状态*/ 189 /*ChanceChangePublish 修改公开状态*/
286 type ChanceChangePublishRequest struct { 190 type ChanceChangePublishRequest struct {
287 ChanceId int64 `json:"chanceId"` //机会编号 191 ChanceId int64 `json:"chanceId"` //机会编号
@@ -305,3 +209,113 @@ type ChanceCalculateScoreRequest struct { @@ -305,3 +209,113 @@ type ChanceCalculateScoreRequest struct {
305 type ChanceCalculateScoreResponse struct { 209 type ChanceCalculateScoreResponse struct {
306 DiscoveryScore float64 `json:"discoveryScore"` //发现分 210 DiscoveryScore float64 `json:"discoveryScore"` //发现分
307 } 211 }
  212 +
  213 +/*ChanceDelete 机会删除*/
  214 +type ChanceDeleteRequest struct {
  215 + Id int64 `json:"id"` //机会编号
  216 +}
  217 +type ChanceDeleteResponse struct {
  218 +}
  219 +
  220 +type ChanceFavorite struct {
  221 + Id int64 `json:"id"`
  222 + Favorite interface{} `json:"favorite"`
  223 +}
  224 +
  225 +//机会详情
  226 +type ChanceDetail struct {
  227 + Id int64 `json:"id"`
  228 + Provider *BaseUserInfo `json:"provider"`
  229 + IsCollect bool `json:"is_collect"`
  230 + IsZan bool `json:"is_zan"`
  231 + Content string `json:"content"`
  232 + ChanceType int `json:"chance_type"`
  233 +
  234 + //图片
  235 + //视频
  236 + //语音
  237 +
  238 + ViewTotal int `json:"view_total"`
  239 + CommentTotal int `json:"comment_total"`
  240 + ZanTotal int `json:"zan_total"`
  241 +}
  242 +
  243 +//模板
  244 +type Template struct {
  245 + Id int64 `json:"id"`
  246 + Name string `json:"name"`
  247 + Doc string `json:"doc"`
  248 + Icon string `json:"icon"`
  249 + FormList []*Form `json:"formList"`
  250 + Link string `json:"link"` //示例
  251 +}
  252 +
  253 +//表单
  254 +type Form struct {
  255 + Id int `json:"id"`
  256 + Label string `json:"label"`
  257 + InputType string `json:"inputType"`
  258 + SectionType int8 `json:"sectionType"`
  259 + Value string `json:"value"`
  260 + Required int8 `json:"required"`
  261 +}
  262 +
  263 +//语音
  264 +type Speech struct {
  265 + Path string `json:"path"`
  266 + Duration int `json:"duration"`
  267 +}
  268 +
  269 +//图片
  270 +type Picture struct {
  271 + Path string `json:"path"`
  272 + W int `json:"w"`
  273 + H int `json:"h"`
  274 +}
  275 +
  276 +//视频
  277 +type Video struct {
  278 + Path string `json:"path"`
  279 + Cover Cover `json:"cover"` //封面
  280 + Duration int `json:"duration"`
  281 +}
  282 +
  283 +//审批配置
  284 +type AuditConfig struct {
  285 + NoApprover int8 `json:"no_approver"` //审核人空时:【1:自动通过】【2:转交给管理员】
  286 +}
  287 +
  288 +//机会池 - 统计
  289 +type ChanceTotalItem struct {
  290 + Id int `json:"id"` //类型
  291 + Name string `json:"name"` //总数
  292 + Total int `json:"total"`
  293 +}
  294 +
  295 +//机会列表 通用项
  296 +type CommonListItem struct {
  297 + Chance ChanceItem `json:"chance,omitempty"` //机会详情
  298 + ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
  299 + Approve interface{} `json:"approve,omitempty"` //审核人 审核信息(时间) Approve
  300 + ApproveData interface{} `json:"approveData,omitempty"` //审核数据(公开状态 评分) ApproveData
  301 + Message interface{} `json:"message,omitempty"` //消息
  302 + Comment interface{} `json:"comment,omitempty"` //评论
  303 + ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭
  304 +}
  305 +type ChanceItem struct {
  306 + Id int64 `json:"id"`
  307 + CreateTime int64 `json:"createTime"`
  308 + Provider *BaseUserInfo `json:"provider"`
  309 + FormList []*Form `json:"formList" valid:"Required"`
  310 + Speechs []Speech `json:"speechs"`
  311 + Pictures []Picture `json:"pictures"`
  312 + Videos []Video `json:"videos"`
  313 +}
  314 +type ChanceData struct {
  315 + ThumbsUpTotal int `json:"thumbsUpTotal"` //点赞总数
  316 + CommentTotal int `json:"commentTotal"` //评论总数
  317 + PageViewTotal int `json:"pageViewTotal"` //评论总数
  318 +
  319 + IsThumbsUp int `json:"isThumbsUp"` //是否点赞 1 点赞, 0 没有点赞
  320 + IsCollect int `json:"isCollect"` //是否收藏 1 是 0 否
  321 +}
@@ -37,6 +37,27 @@ type ChanceApproveProcessResponse struct { @@ -37,6 +37,27 @@ type ChanceApproveProcessResponse struct {
37 ApproveAccess *ApproveAccess `json:"approveOperate"` 37 ApproveAccess *ApproveAccess `json:"approveOperate"`
38 } 38 }
39 39
  40 +//审批数据
  41 +type Approve struct {
  42 + //Provider *BaseUserInfo `json:"provider"`
  43 + ProcessId int64 `json:"processId"`
  44 + CreateTime int64 `json:"createTime"`
  45 + ApproveTime int64 `json:"approveTime"`
  46 +}
  47 +
  48 +//审核操作权限
  49 +type ApproveAccess struct {
  50 + ProcessId int64 `json:"processId"`
  51 + AllowApprove int `json:"allowApprove"`
  52 + AllowReject int `json:"allowReject"`
  53 +}
  54 +
  55 +//审核数据 审核通过
  56 +type ApproveData struct {
  57 + PublicData PublicData `json:"publicData"` // 公开数据
  58 + Score Score `json:"score"`
  59 +}
  60 +
40 //进程项 61 //进程项
41 type ProcessItem struct { 62 type ProcessItem struct {
42 Id int64 `json:"id"` 63 Id int64 `json:"id"`
@@ -49,36 +70,11 @@ type ProcessItem struct { @@ -49,36 +70,11 @@ type ProcessItem struct {
49 Name string `json:"name"` 70 Name string `json:"name"`
50 RoleName string `json:"roleName"` 71 RoleName string `json:"roleName"`
51 Role int `json:"-"` 72 Role int `json:"-"`
52 - ApproveData ApproveData `json:"ApproveData"` //审核数据 73 + ApproveData *ApproveData `json:"approveData"` //审核数据
53 //ApproveUser UserItem `json:"approveUser"` //审核人 //状态不是审核中 74 //ApproveUser UserItem `json:"approveUser"` //审核人 //状态不是审核中
54 ApproveUsers []UserItem `json:"approveUsers"` //审核人员 //1 会签 2 或签 //审核中 1.部门长 2.角色 75 ApproveUsers []UserItem `json:"approveUsers"` //审核人员 //1 会签 2 或签 //审核中 1.部门长 2.角色
55 } 76 }
56 77
57 -//用户项  
58 -type UserItem struct {  
59 - Uid int64 `json:"uid"`  
60 - Name string `json:"name"`  
61 -}  
62 -  
63 -//角色项  
64 -type Role struct {  
65 - Id int `json:"id"`  
66 - Name string `json:"name"`  
67 -}  
68 -  
69 -type Approve struct {  
70 - //Provider *BaseUserInfo `json:"provider"`  
71 - ProcessId int64 `json:"processId"`  
72 - CreateTime int64 `json:"createTime"`  
73 - ApproveTime int64 `json:"approveTime"`  
74 -}  
75 -  
76 -//审核数据 审核通过  
77 -type ApproveData struct {  
78 - PublicData PublicData `json:"publicData"` // 公开数据  
79 - Score Score `json:"score"`  
80 -}  
81 -  
82 //公开数据 78 //公开数据
83 type PublicData struct { 79 type PublicData struct {
84 PublishStatus int `json:"publishStatus"` //公开状态 0未公开、1部门公开、2公司公开 80 PublishStatus int `json:"publishStatus"` //公开状态 0未公开、1部门公开、2公司公开
@@ -99,10 +95,3 @@ type Score struct { @@ -99,10 +95,3 @@ type Score struct {
99 ValueScore float64 `json:"valueScore"` //价值分 95 ValueScore float64 `json:"valueScore"` //价值分
100 DiscoveryScore float64 `json:"discoveryScore"` //发现分 96 DiscoveryScore float64 `json:"discoveryScore"` //发现分
101 } 97 }
102 -  
103 -//审核操作权限  
104 -type ApproveAccess struct {  
105 - ProcessId int64 `json:"processId"`  
106 - AllowApprove int `json:"allowApprove"`  
107 - AllowReject int `json:"allowReject"`  
108 -}  
@@ -36,3 +36,32 @@ const ( @@ -36,3 +36,32 @@ const (
36 MyAuditChancePass //我审核的机会-已通过 36 MyAuditChancePass //我审核的机会-已通过
37 MyAuditChanceReturn //我审核的机会-已退回 37 MyAuditChanceReturn //我审核的机会-已退回
38 ) 38 )
  39 +
  40 +var MapStaticName map[int64]string
  41 +
  42 +func init() {
  43 + MapStaticName = make(map[int64]string)
  44 + MapStaticName[CollectStatic] = "收藏"
  45 + MapStaticName[ZanStatic] = "点赞"
  46 + MapStaticName[CommentStatic] = "评论"
  47 + MapStaticName[MyCommitChance] = "我提交的机会"
  48 + MapStaticName[MyCommitChanceWait] = "我提交的机会-待审批"
  49 + MapStaticName[MyCommitChanceReturn] = "我提交的机会-退回"
  50 + MapStaticName[MyCommitChancePass] = "我提交的机会-已通过"
  51 + MapStaticName[MyAuditChance] = "我审核的机会"
  52 + MapStaticName[MyAuditChanceWait] = "我审核的机会-待我审批"
  53 + MapStaticName[MyAuditChancePass] = "我审核的机会-已通过"
  54 + MapStaticName[MyAuditChanceReturn] = "我审核的机会-已退回"
  55 +}
  56 +
  57 +//用户项
  58 +type UserItem struct {
  59 + Uid int64 `json:"uid"`
  60 + Name string `json:"name"`
  61 +}
  62 +
  63 +//角色项
  64 +type Role struct {
  65 + Id int `json:"id"`
  66 + Name string `json:"name"`
  67 +}
@@ -54,6 +54,15 @@ type UserInfoResponse struct { @@ -54,6 +54,15 @@ type UserInfoResponse struct {
54 User User `json:"user"` 54 User User `json:"user"`
55 } 55 }
56 56
  57 +//用户统计信息
  58 +/*UserStatistics */
  59 +type UserStatisticsRequest struct {
  60 + TypeTotal int64 `json:"typeTotal" valid:"Required"`
  61 +}
  62 +type UserStatisticsResponse struct {
  63 + Totals []TypeTotalItem `json:"totals"`
  64 +}
  65 +
57 type User struct { 66 type User struct {
58 UserId int64 `json:"uid"` 67 UserId int64 `json:"uid"`
59 Name string `json:"uname"` 68 Name string `json:"uname"`
@@ -89,14 +98,6 @@ type Job struct { @@ -89,14 +98,6 @@ type Job struct {
89 Level int `json:"level"` 98 Level int `json:"level"`
90 } 99 }
91 100
92 -//用户统计信息  
93 -/*UserStatistics */  
94 -type UserStatisticsRequest struct {  
95 - TypeTotal int64 `json:"typeTotal" valid:"Required"`  
96 -}  
97 -type UserStatisticsResponse struct {  
98 - Totals []TypeTotalItem `json:"totals"`  
99 -}  
100 type TypeTotalItem struct { 101 type TypeTotalItem struct {
101 Type int64 `json:"type"` //类型 102 Type int64 `json:"type"` //类型
102 Total int `json:"total"` //总数 103 Total int `json:"total"` //总数
@@ -20,3 +20,16 @@ func MyChanceStatic(header *protocol.RequestHeader, reviewStatus ...int8) (total @@ -20,3 +20,16 @@ func MyChanceStatic(header *protocol.RequestHeader, reviewStatus ...int8) (total
20 } 20 }
21 return 21 return
22 } 22 }
  23 +
  24 +func MyApproveStatic(header *protocol.RequestHeader, reviewStatus ...int8) (total int, err error) {
  25 + var ()
  26 + if total, err = models.GetChanceMyApproveChance(header.UserId, header.CompanyId, reviewStatus, 0, 0, nil); err != nil {
  27 + if err == orm.ErrNoRows {
  28 + err = nil
  29 + return
  30 + }
  31 + log.Error(err)
  32 + return
  33 + }
  34 + return
  35 +}
@@ -291,6 +291,11 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro @@ -291,6 +291,11 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro
291 err = protocol.NewErrWithMessage(5101) 291 err = protocol.NewErrWithMessage(5101)
292 return 292 return
293 } 293 }
  294 + if chance.EnableStatus == 0 {
  295 + log.Error(fmt.Sprintf("chance_id:%v enable_status:%v", chance.Id, chance.EnableStatus))
  296 + err = protocol.NewErrWithMessage(5101)
  297 + return
  298 + }
294 if process, err = models.GetAuditFlowProcessBy(request.ProcessId, header.UserId); err != nil { 299 if process, err = models.GetAuditFlowProcessBy(request.ProcessId, header.UserId); err != nil {
295 log.Error(request.ProcessId, header.UserId, err) 300 log.Error(request.ProcessId, header.UserId, err)
296 err = protocol.NewErrWithMessage(5202) 301 err = protocol.NewErrWithMessage(5202)
@@ -507,8 +512,10 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) @@ -507,8 +512,10 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance)
507 checkApprovePermission(p) 512 checkApprovePermission(p)
508 //机会已经审核通过的直接添加到审核人列表 513 //机会已经审核通过的直接添加到审核人列表
509 if chance.ReviewStatus == protocol.ReviewStatusPass { 514 if chance.ReviewStatus == protocol.ReviewStatusPass {
  515 + if len(p.ApproveData) > 0 {
510 if e := json.Unmarshal([]byte(p.ApproveData), &item.ApproveData); e != nil { 516 if e := json.Unmarshal([]byte(p.ApproveData), &item.ApproveData); e != nil {
511 - log.Error(e) 517 + log.Error("data", p.ApproveData, e)
  518 + }
512 } 519 }
513 rsp.ApproveProcess = append(rsp.ApproveProcess, item) 520 rsp.ApproveProcess = append(rsp.ApproveProcess, item)
514 continue 521 continue
@@ -368,40 +368,67 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis @@ -368,40 +368,67 @@ func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatis
368 total int 368 total int
369 ) 369 )
370 rsp = &protocol.UserStatisticsResponse{} 370 rsp = &protocol.UserStatisticsResponse{}
371 - isMark := func(v int64) bool {  
372 - if flag != v {  
373 - return false  
374 - }  
375 - return (request.TypeTotal & v) > 0  
376 - }  
377 - for flag = 1; flag < (1 << 20); flag = flag << 1 { 371 + //buf :=bytes.NewBuffer(nil)
  372 + //buf.WriteString(fmt.Sprintf("用户中心-统计信息 user:%v type_total:%v \n",header.UserId,request.TypeTotal))
  373 + for flag = 1; flag <= (protocol.MyAuditChanceReturn); flag = flag << 1 {
378 total = 0 374 total = 0
379 - if isMark(protocol.MyCommitChance) { 375 + switch flag {
  376 + case protocol.MyCommitChance:
380 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil { 377 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
381 log.Error(err) 378 log.Error(err)
382 } 379 }
383 - }  
384 - if isMark(protocol.MyCommitChanceWait) { 380 + break
  381 + case protocol.MyCommitChanceWait:
385 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil { 382 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusAuditging); err != nil {
386 log.Error(err) 383 log.Error(err)
387 } 384 }
  385 + break
  386 + case protocol.MyCommitChancePass:
  387 + if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil {
  388 + log.Error(err)
388 } 389 }
389 - if isMark(protocol.MyAuditChanceReturn) { 390 + break
  391 + case protocol.MyCommitChanceReturn:
390 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil { 392 if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusReturn); err != nil {
391 log.Error(err) 393 log.Error(err)
392 } 394 }
  395 + break
  396 + case protocol.MyAuditChance:
  397 + if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging, protocol.ReviewStatusReturn, protocol.ReviewStatusPass); err != nil {
  398 + log.Error(err)
393 } 399 }
394 - if isMark(protocol.MyCommitChancePass) {  
395 - if total, err = agg.MyChanceStatic(header, protocol.ReviewStatusPass); err != nil { 400 + break
  401 + case protocol.MyAuditChanceWait:
  402 + if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusAuditging); err != nil {
  403 + log.Error(err)
  404 + }
  405 + break
  406 + case protocol.MyAuditChancePass:
  407 + if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusPass); err != nil {
  408 + log.Error(err)
  409 + }
  410 + break
  411 + case protocol.MyAuditChanceReturn:
  412 + if total, err = agg.MyApproveStatic(header, protocol.ReviewStatusReturn); err != nil {
396 log.Error(err) 413 log.Error(err)
397 } 414 }
  415 + break
  416 +
398 } 417 }
399 if flag&request.TypeTotal > 0 { 418 if flag&request.TypeTotal > 0 {
400 rsp.Totals = append(rsp.Totals, protocol.TypeTotalItem{ 419 rsp.Totals = append(rsp.Totals, protocol.TypeTotalItem{
401 Type: flag, 420 Type: flag,
402 Total: total, 421 Total: total,
403 }) 422 })
  423 + log.Debug(fmt.Sprintf("用户中心-统计信息 user:%v name:%v type:%v total:%v ", header.UserId, protocol.MapStaticName[flag], flag, total))
  424 + //buf.WriteString(fmt.Sprintf("user:%v name:%v type:%v total:%v ",header.UserId,protocol.MapStaticName[flag],flag,total))
  425 + //if err!=nil{
  426 + // buf.WriteString("err:%v \n")
  427 + //}else{
  428 + // buf.WriteString("\n")
  429 + //}
404 } 430 }
405 } 431 }
  432 + //log.Debug(buf.String())
406 return 433 return
407 } 434 }