|
@@ -22,8 +22,8 @@ type SqlData struct { |
|
@@ -22,8 +22,8 @@ type SqlData struct { |
|
22
|
ChanceTypeId int `orm:"column(chance_type_id)"`
|
22
|
ChanceTypeId int `orm:"column(chance_type_id)"`
|
|
23
|
PublishStatus int `orm:"column(publish_status)"`
|
23
|
PublishStatus int `orm:"column(publish_status)"`
|
|
24
|
CreateAt time.Time `orm:"column(create_at);type(timestamp)"`
|
24
|
CreateAt time.Time `orm:"column(create_at);type(timestamp)"`
|
|
25
|
- ReviewStatus int `orm:"column(review_status)"`
|
|
|
|
26
|
- EnableStatus int8 `orm:"column(enable_status)"`
|
25
|
+ ReviewStatus int8 `orm:"column(review_status)"`
|
|
|
|
26
|
+ Status int8 `orm:"column(status)"`
|
|
27
|
DiscoveryScore string `orm:"column(discovery_score)"`
|
27
|
DiscoveryScore string `orm:"column(discovery_score)"`
|
|
28
|
CommentTotal string `orm:"column(comment_total)"`
|
28
|
CommentTotal string `orm:"column(comment_total)"`
|
|
29
|
Code string `orm:"column(code)"`
|
29
|
Code string `orm:"column(code)"`
|
|
@@ -39,22 +39,24 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st |
|
@@ -39,22 +39,24 @@ func buildSqlForAuditList(usercompanyid int64, companyid int64, userid int64) st |
|
39
|
*/
|
39
|
*/
|
|
40
|
var (
|
40
|
var (
|
|
41
|
//自己提交的
|
41
|
//自己提交的
|
|
42
|
- sql1 string = fmt.Sprintf(` SELECT id FROM chance WHERE user_id=%d `, usercompanyid)
|
42
|
+ sql1 string = fmt.Sprintf(` SELECT id FROM chance WHERE AND enable_status=1 AND user_id=%d `, usercompanyid)
|
|
43
|
//自己可审核的
|
43
|
//自己可审核的
|
|
44
|
sql2 string = fmt.Sprintf(` SELECT a.id FROM chance AS a
|
44
|
sql2 string = fmt.Sprintf(` SELECT a.id FROM chance AS a
|
|
45
|
JOIN audit_flow_process AS b ON a.id=b.chance_id
|
45
|
JOIN audit_flow_process AS b ON a.id=b.chance_id
|
|
46
|
- WHERE b.uid=%d `, usercompanyid)
|
46
|
+ WHERE b.uid=%d AND a.enable_status=1 `, usercompanyid)
|
|
47
|
//公开到自己部门的
|
47
|
//公开到自己部门的
|
|
48
|
sql3 string = ` SELECT a.id FROM chance AS a
|
48
|
sql3 string = ` SELECT a.id FROM chance AS a
|
|
49
|
JOIN chance_department AS b ON a.id=b.chance_id
|
49
|
JOIN chance_department AS b ON a.id=b.chance_id
|
|
50
|
- WHERE b.department_id IN (%s) AND a.review_status = 3 AND a.publish_status=` + fmt.Sprint(models.ChancePublishStatus1)
|
50
|
+ WHERE b.department_id IN (%s) AND a.review_status = 3
|
|
|
|
51
|
+ AND a.enable_status=1
|
|
|
|
52
|
+ AND a.publish_status=` + fmt.Sprint(models.ChancePublishStatus1)
|
|
51
|
//指定提交的部门
|
53
|
//指定提交的部门
|
|
52
|
- sql4 string = ` SELECT id FROM chance WHERE department_id IN (%s) and review_status =3 `
|
54
|
+ sql4 string = ` SELECT id FROM chance WHERE department_id IN (%s) and review_status =3 AND enable_status=1 `
|
|
53
|
|
55
|
|
|
54
|
//全公司公开的
|
56
|
//全公司公开的
|
|
55
|
- sql5 string = fmt.Sprintf(` SELECT id FROM chance where publish_status = %d AND review_status = 3 AND company_id=%d `, models.ChancePublishStatus2, companyid)
|
57
|
+ sql5 string = fmt.Sprintf(` SELECT id FROM chance where publish_status = %d AND enable_status=1 AND review_status = 3 AND company_id=%d `, models.ChancePublishStatus2, companyid)
|
|
56
|
//查看所有公开的
|
58
|
//查看所有公开的
|
|
57
|
- sql6 string = fmt.Sprintf(`SELECT id FROM chance WHERE review_status =3 And company_id=%d `, companyid)
|
59
|
+ sql6 string = fmt.Sprintf(`SELECT id FROM chance WHERE review_status =3 AND enable_status=1 And company_id=%d `, companyid)
|
|
58
|
|
60
|
|
|
59
|
allsql string = ` SELECT t.id FROM (%s) as t `
|
61
|
allsql string = ` SELECT t.id FROM (%s) as t `
|
|
60
|
unionsql string = ``
|
62
|
unionsql string = ``
|
|
@@ -174,12 +176,12 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
@@ -174,12 +176,12 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
174
|
JOIN user_company AS c ON c.id = a.user_id
|
176
|
JOIN user_company AS c ON c.id = a.user_id
|
|
175
|
JOIN user AS d ON c.user_id = d.id
|
177
|
JOIN user AS d ON c.user_id = d.id
|
|
176
|
%s
|
178
|
%s
|
|
177
|
- where a.company_id=? `
|
179
|
+ where a.company_id=? AND a.enable_status=1 `
|
|
178
|
s2 := ` SELECT count(*) FROM chance as a
|
180
|
s2 := ` SELECT count(*) FROM chance as a
|
|
179
|
JOIN user_company AS c ON c.id = a.user_id
|
181
|
JOIN user_company AS c ON c.id = a.user_id
|
|
180
|
JOIN user AS d ON c.user_id = d.id
|
182
|
JOIN user AS d ON c.user_id = d.id
|
|
181
|
%s
|
183
|
%s
|
|
182
|
- where a.company_id=? `
|
184
|
+ where a.company_id=? AND a.enable_status=1 `
|
|
183
|
if companyinfo, err := models.GetCompanyById(companyid); err == nil {
|
185
|
if companyinfo, err := models.GetCompanyById(companyid); err == nil {
|
|
184
|
//非主管进行权限过滤
|
186
|
//非主管进行权限过滤
|
|
185
|
if companyinfo.AdminId != userid {
|
187
|
if companyinfo.AdminId != userid {
|
|
@@ -278,8 +280,8 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
@@ -278,8 +280,8 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
278
|
t := v.CreateAt.Unix()
|
280
|
t := v.CreateAt.Unix()
|
|
279
|
item := protocol.RspAuditList{
|
281
|
item := protocol.RspAuditList{
|
|
280
|
Id: fmt.Sprint(v.Id),
|
282
|
Id: fmt.Sprint(v.Id),
|
|
281
|
- EnableStatus: v.EnableStatus,
|
|
|
|
282
|
- EnableStatusName: models.ChanceEnableStatusMap[v.EnableStatus],
|
283
|
+ Status: v.Status,
|
|
|
|
284
|
+ StatusName: models.ChanceStatusMap[v.Status],
|
|
283
|
PublishStatus: v.PublishStatus,
|
285
|
PublishStatus: v.PublishStatus,
|
|
284
|
PublishStatusName: models.ChancePublishStatusMap[v.PublishStatus],
|
286
|
PublishStatusName: models.ChancePublishStatusMap[v.PublishStatus],
|
|
285
|
ReviewStatus: v.ReviewStatus,
|
287
|
ReviewStatus: v.ReviewStatus,
|
|
@@ -439,9 +441,13 @@ func AllowChanceEnableStatus(chanceid int64, companyid int64) error { |
|
@@ -439,9 +441,13 @@ func AllowChanceEnableStatus(chanceid int64, companyid int64) error { |
|
439
|
log.Error("机会的公司不匹配")
|
441
|
log.Error("机会的公司不匹配")
|
|
440
|
return protocol.NewErrWithMessage("1")
|
442
|
return protocol.NewErrWithMessage("1")
|
|
441
|
}
|
443
|
}
|
|
442
|
- chanceinfo.EnableStatus = models.ChanceEnableStatusYes
|
444
|
+ //判定机会状态
|
|
|
|
445
|
+ if chanceinfo.ReviewStatus != models.ChanceReviewStatusYes {
|
|
|
|
446
|
+ return nil
|
|
|
|
447
|
+ }
|
|
|
|
448
|
+ chanceinfo.Status = models.ChanceStatusAllow
|
|
443
|
chanceinfo.UpdateAt = time.Now()
|
449
|
chanceinfo.UpdateAt = time.Now()
|
|
444
|
- err = models.UpdateChanceById(chanceinfo, []string{"EnableStatus", "UpdateAt"})
|
450
|
+ err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"})
|
|
445
|
if err != nil {
|
451
|
if err != nil {
|
|
446
|
log.Error("更新机会数据失败:%s", err)
|
452
|
log.Error("更新机会数据失败:%s", err)
|
|
447
|
return protocol.NewErrWithMessage("1")
|
453
|
return protocol.NewErrWithMessage("1")
|
|
@@ -463,9 +469,9 @@ func ForbidChanceEnableStatus(chanceid int64, companyid int64) error { |
|
@@ -463,9 +469,9 @@ func ForbidChanceEnableStatus(chanceid int64, companyid int64) error { |
|
463
|
log.Error("机会的公司不匹配")
|
469
|
log.Error("机会的公司不匹配")
|
|
464
|
return protocol.NewErrWithMessage("1")
|
470
|
return protocol.NewErrWithMessage("1")
|
|
465
|
}
|
471
|
}
|
|
466
|
- chanceinfo.EnableStatus = models.ChanceEnableStatusNo
|
472
|
+ chanceinfo.Status = models.ChanceStatusForbid
|
|
467
|
chanceinfo.UpdateAt = time.Now()
|
473
|
chanceinfo.UpdateAt = time.Now()
|
|
468
|
- err = models.UpdateChanceById(chanceinfo, []string{"EnableStatus", "UpdateAt"})
|
474
|
+ err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"})
|
|
469
|
if err != nil {
|
475
|
if err != nil {
|
|
470
|
log.Error("更新机会数据失败:%s", err)
|
476
|
log.Error("更新机会数据失败:%s", err)
|
|
471
|
return protocol.NewErrWithMessage("1")
|
477
|
return protocol.NewErrWithMessage("1")
|