...
|
...
|
@@ -214,8 +214,9 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques |
|
|
}
|
|
|
for i := range templates {
|
|
|
item := templates[i]
|
|
|
//TODO:检查模板可见
|
|
|
//
|
|
|
if !checkVisible(header, item.VisibleObject) {
|
|
|
continue
|
|
|
}
|
|
|
//查询表单
|
|
|
if forms, err = models.GetAuditForms(header.CompanyId, item.Id); err != nil {
|
|
|
log.Error(err)
|
...
|
...
|
@@ -227,7 +228,9 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques |
|
|
Icon: item.Icon,
|
|
|
Doc: item.Doc,
|
|
|
FormList: make([]*protocol.Form, len(forms)),
|
|
|
Link: fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id),
|
|
|
}
|
|
|
if len(item.Example) > 0 {
|
|
|
template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id)
|
|
|
}
|
|
|
for j := range forms {
|
|
|
form := forms[j]
|
...
|
...
|
@@ -270,7 +273,9 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) |
|
|
Icon: item.Icon,
|
|
|
Doc: item.Doc,
|
|
|
FormList: make([]*protocol.Form, len(forms)),
|
|
|
Link: fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id),
|
|
|
}
|
|
|
if len(item.Example) > 0 {
|
|
|
template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id)
|
|
|
}
|
|
|
for j := range forms {
|
|
|
form := forms[j]
|
...
|
...
|
@@ -287,6 +292,27 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) |
|
|
return
|
|
|
}
|
|
|
|
|
|
func checkVisible(header *protocol.RequestHeader, vb string) (result bool) {
|
|
|
var (
|
|
|
vObject []*protocol.VisibleObject
|
|
|
)
|
|
|
result = true
|
|
|
if len(vb) == 0 {
|
|
|
return
|
|
|
}
|
|
|
utils.JsonUnmarshal(vb, &vObject)
|
|
|
if len(vObject) == 0 {
|
|
|
return
|
|
|
}
|
|
|
for i := range vObject {
|
|
|
if vObject[i].Id == header.UserId {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
result = false
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.AuditTemplate) (result bool, err error) {
|
|
|
//if template.VisibleType ==
|
|
|
return
|
...
|
...
|
@@ -843,7 +869,7 @@ func ChanceCalculateScore(header *protocol.RequestHeader, request *protocol.Chan |
|
|
}
|
|
|
sum += scoreConfig.ValueScore.Max * scoreConfig.DiscoveryScore.ValueFactor
|
|
|
}
|
|
|
rsp.DiscoveryScore = request.Score.BasicScore*scoreConfig.DiscoveryScore.BasicFactor + request.Score.ExtraScore*scoreConfig.DiscoveryScore.ExtraFactor + request.Score.ValueScore*scoreConfig.DiscoveryScore.ValueFactor
|
|
|
rsp.DiscoveryScore = utils.Decimal(request.Score.BasicScore*scoreConfig.DiscoveryScore.BasicFactor + request.Score.ExtraScore*scoreConfig.DiscoveryScore.ExtraFactor + request.Score.ValueScore*scoreConfig.DiscoveryScore.ValueFactor)
|
|
|
rsp.DiscoveryScorePercent = int((rsp.DiscoveryScore / sum) * 100)
|
|
|
log.Debug(fmt.Sprintf("计算发现-> score_config:%v score:%v 总分:%v 发现分:%v 发现分百分比:%v", common.AssertJson(scoreConfig), common.AssertJson(request.Score), sum, rsp.DiscoveryScore, rsp.DiscoveryScorePercent))
|
|
|
//发现分不为0
|
...
|
...
|
|