正在显示
7 个修改的文件
包含
264 行增加
和
16 行删除
| @@ -248,6 +248,27 @@ func (this *ChanceController) Templates() { | @@ -248,6 +248,27 @@ func (this *ChanceController) Templates() { | ||
| 248 | msg = protocol.NewReturnResponse(chance.Templates(header, request)) | 248 | msg = protocol.NewReturnResponse(chance.Templates(header, request)) |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | +//Template 模板详情 | ||
| 252 | +//@router /template [post] | ||
| 253 | +func (this *ChanceController) Template() { | ||
| 254 | + var msg *protocol.ResponseMessage | ||
| 255 | + defer func() { | ||
| 256 | + this.Resp(msg) | ||
| 257 | + }() | ||
| 258 | + var request *protocol.TemplateRequest | ||
| 259 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 260 | + log.Error(err) | ||
| 261 | + msg = protocol.BadRequestParam(1) | ||
| 262 | + return | ||
| 263 | + } | ||
| 264 | + if b, m := this.Valid(request); !b { | ||
| 265 | + msg = m | ||
| 266 | + return | ||
| 267 | + } | ||
| 268 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 269 | + msg = protocol.NewReturnResponse(chance.Template(header, request)) | ||
| 270 | +} | ||
| 271 | + | ||
| 251 | //ChanceSubmit 提交机会 | 272 | //ChanceSubmit 提交机会 |
| 252 | //@router /submit [post] | 273 | //@router /submit [post] |
| 253 | func (this *ChanceController) ChanceSubmit() { | 274 | func (this *ChanceController) ChanceSubmit() { |
| @@ -266,11 +287,32 @@ func (this *ChanceController) ChanceSubmit() { | @@ -266,11 +287,32 @@ func (this *ChanceController) ChanceSubmit() { | ||
| 266 | return | 287 | return |
| 267 | } | 288 | } |
| 268 | header := controllers.GetRequestHeader(this.Ctx) | 289 | header := controllers.GetRequestHeader(this.Ctx) |
| 269 | - if request.Id > 0 { | ||
| 270 | - msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) | 290 | + //if request.Id > 0 { |
| 291 | + // msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) | ||
| 292 | + // return | ||
| 293 | + //} | ||
| 294 | + msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request)) | ||
| 295 | +} | ||
| 296 | + | ||
| 297 | +//ChanceUpdate 机会更新 | ||
| 298 | +//@router /update [post] | ||
| 299 | +func (this *ChanceController) ChanceUpdate() { | ||
| 300 | + var msg *protocol.ResponseMessage | ||
| 301 | + defer func() { | ||
| 302 | + this.Resp(msg) | ||
| 303 | + }() | ||
| 304 | + var request *protocol.ChanceUpdateRequest | ||
| 305 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 306 | + log.Error(err) | ||
| 307 | + msg = protocol.BadRequestParam(1) | ||
| 271 | return | 308 | return |
| 272 | } | 309 | } |
| 273 | - msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request)) | 310 | + if b, m := this.Valid(request); !b { |
| 311 | + msg = m | ||
| 312 | + return | ||
| 313 | + } | ||
| 314 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 315 | + msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) | ||
| 274 | } | 316 | } |
| 275 | 317 | ||
| 276 | //ChanceStatistics 机会统计 | 318 | //ChanceStatistics 机会统计 |
| @@ -139,3 +139,32 @@ func CloseAuditFlowProcess(chanceId int64) (err error) { | @@ -139,3 +139,32 @@ func CloseAuditFlowProcess(chanceId int64) (err error) { | ||
| 139 | } | 139 | } |
| 140 | return | 140 | return |
| 141 | } | 141 | } |
| 142 | + | ||
| 143 | +//获取当前审批节点 是否已经有人审核通过的 | ||
| 144 | +func GetAuditFlowProcessApproved(chanceId int64, level int) (v *AuditFlowProcess, err error) { | ||
| 145 | + o := orm.NewOrm() | ||
| 146 | + sql := "select id from audit_flow_process where chance_id=? and level=? and is_active=1 and review_status<>1 and enable_status=1" | ||
| 147 | + if err = o.Raw(sql, chanceId, level).QueryRow(&v); err != nil { | ||
| 148 | + return | ||
| 149 | + } | ||
| 150 | + return | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +//按审核状态获取审核流程 | ||
| 154 | +func GetAuditFlowProcessByReview(chanceId int64, level int, reviewStatus int) (v *AuditFlowProcess, err error) { | ||
| 155 | + o := orm.NewOrm() | ||
| 156 | + sql := "select * from audit_flow_process where chance_id=? and level=? and is_active=1 and review_status=? and enable_status=1" | ||
| 157 | + if err = o.Raw(sql, chanceId, level, reviewStatus).QueryRow(&v); err != nil { | ||
| 158 | + return | ||
| 159 | + } | ||
| 160 | + return | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +//更新提交 | ||
| 164 | +func UpdatetAuditFlowProcessToSubmit(o orm.Ormer, chanceId int64, level int, reviewStatus int, userId int64) (err error) { | ||
| 165 | + sql := "update audit_flow_process set enable_status =1,is_active=1,update_at=now(),review_status=? where chance_id=? and uid=? and level=? and and review_status=0 and enable_status=1" | ||
| 166 | + if err = utils.ExecuteSQLWithOrmer(o, sql, reviewStatus, chanceId, userId, level); err != nil { | ||
| 167 | + return | ||
| 168 | + } | ||
| 169 | + return | ||
| 170 | +} |
| @@ -100,3 +100,14 @@ func GetAuditTemplateExample(id int64) (v string, err error) { | @@ -100,3 +100,14 @@ func GetAuditTemplateExample(id int64) (v string, err error) { | ||
| 100 | } | 100 | } |
| 101 | return | 101 | return |
| 102 | } | 102 | } |
| 103 | + | ||
| 104 | +//按 1.公司编号 2.机会类型编号 3.模板编号 | ||
| 105 | +//获取审核模板列表 | ||
| 106 | +func GetAuditTemplate(companyId int64, chanceTypeId, templateId int) (v *AuditTemplate, err error) { | ||
| 107 | + o := orm.NewOrm() | ||
| 108 | + sql := "select * from audit_template where id=? and company_id=? and chance_type_id=? and enable_status=1" | ||
| 109 | + if err = o.Raw(sql, templateId, companyId, chanceTypeId).QueryRow(&v); err == nil { | ||
| 110 | + return | ||
| 111 | + } | ||
| 112 | + return | ||
| 113 | +} |
| @@ -92,6 +92,15 @@ type TemplatesResponse struct { | @@ -92,6 +92,15 @@ type TemplatesResponse struct { | ||
| 92 | Templates []*Template `json:"list"` | 92 | Templates []*Template `json:"list"` |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | +/*Template 模板详情*/ | ||
| 96 | +type TemplateRequest struct { | ||
| 97 | + ChanceTypeId int `json:"chanceTypeId" valid:"Required"` | ||
| 98 | + TemplateId int `json:"templateId" valid:"Required"` | ||
| 99 | +} | ||
| 100 | +type TemplateResponse struct { | ||
| 101 | + Template *Template `json:"template"` | ||
| 102 | +} | ||
| 103 | + | ||
| 95 | /*ChanceExample 机会示例*/ | 104 | /*ChanceExample 机会示例*/ |
| 96 | type ChanceExampleRequest struct { | 105 | type ChanceExampleRequest struct { |
| 97 | TemplateId int `json:"templateId" valid:"Required"` | 106 | TemplateId int `json:"templateId" valid:"Required"` |
| @@ -114,6 +123,22 @@ type ChanceSubmitRequest struct { | @@ -114,6 +123,22 @@ type ChanceSubmitRequest struct { | ||
| 114 | type ChanceSubmitResponse struct { | 123 | type ChanceSubmitResponse struct { |
| 115 | } | 124 | } |
| 116 | 125 | ||
| 126 | +/*ChanceUpdate 机会更新*/ | ||
| 127 | +type ChanceUpdateRequest struct { | ||
| 128 | + Id int64 `json:"id"` // = 0添加 >0 编辑 | ||
| 129 | + //AuditTemplateId int64 `json:"auditTemplateId" valid:"Required"` | ||
| 130 | + Content string `json:"content"` | ||
| 131 | + FormList []*Form `json:"formList" valid:"Required"` | ||
| 132 | + Speechs []Speech `json:"speechs"` | ||
| 133 | + Pictures []Picture `json:"pictures"` | ||
| 134 | + Videos []Video `json:"videos"` | ||
| 135 | + RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"` | ||
| 136 | + | ||
| 137 | + IsPublish bool `json:"isPublish"` //是否重新发布 | ||
| 138 | +} | ||
| 139 | +type ChanceUpdateResponse struct { | ||
| 140 | +} | ||
| 141 | + | ||
| 117 | /*ChanceStatistics 首页-机会池统计*/ | 142 | /*ChanceStatistics 首页-机会池统计*/ |
| 118 | type ChanceStatisticsRequest struct { | 143 | type ChanceStatisticsRequest struct { |
| 119 | } | 144 | } |
| @@ -361,6 +386,8 @@ type ChanceChangeScoreRequest struct { | @@ -361,6 +386,8 @@ type ChanceChangeScoreRequest struct { | ||
| 361 | Score Score `json:"score"` | 386 | Score Score `json:"score"` |
| 362 | } | 387 | } |
| 363 | type ChanceChangeScoreResponse struct { | 388 | type ChanceChangeScoreResponse struct { |
| 389 | + DiscoveryScore float64 `json:"discoveryScore"` //发现分 | ||
| 390 | + DiscoveryScorePercent int `json:"discoveryScorePercent"` //发现分-百分比 | ||
| 364 | } | 391 | } |
| 365 | 392 | ||
| 366 | /*ChanceCalculateScore 计算发现分*/ | 393 | /*ChanceCalculateScore 计算发现分*/ |
| @@ -54,6 +54,18 @@ func init() { | @@ -54,6 +54,18 @@ func init() { | ||
| 54 | MapStaticName[MyAuditChanceReturn] = "我审核的机会-已退回" | 54 | MapStaticName[MyAuditChanceReturn] = "我审核的机会-已退回" |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | +var ApproveLog = map[int]string{ | ||
| 58 | + 1: "提交了机会", //提交人提交机会 | ||
| 59 | + 2: "删除了机会", //提交人删除机会 | ||
| 60 | + 3: "退回了机会", //审批人退回机会 | ||
| 61 | + 4: "通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:公司公开", //审批人通过机会(公司公开) | ||
| 62 | + 5: "通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:%v", //审批人通过机会(部门公开) 测试部、销售部 | ||
| 63 | + 6: "系统 自动通过了机会;基础评分:0,附加评分:0,价值评分:0,公开状态:公司公开", //审批人通过了机会(系统自动通过) | ||
| 64 | + 7: "修改了公开状态:公司公开", //审批通过后修改公开状态(公司公开) | ||
| 65 | + 8: "修改了公开状态:%v", //审批通过后修改公开状态(部门公开) | ||
| 66 | + 9: "修改了基础评分:“修改后的基础评分%v分,修改后的附加评分%v分,修改后的价值评分%v分“", //审批通过后修改评分 | ||
| 67 | +} | ||
| 68 | + | ||
| 57 | //用户项 | 69 | //用户项 |
| 58 | type UserItem struct { | 70 | type UserItem struct { |
| 59 | Uid int64 `json:"uid"` | 71 | Uid int64 `json:"uid"` |
| @@ -241,6 +241,14 @@ func init() { | @@ -241,6 +241,14 @@ func init() { | ||
| 241 | 241 | ||
| 242 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | 242 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], |
| 243 | beego.ControllerComments{ | 243 | beego.ControllerComments{ |
| 244 | + Method: "Template", | ||
| 245 | + Router: `/template`, | ||
| 246 | + AllowHTTPMethods: []string{"post"}, | ||
| 247 | + MethodParams: param.Make(), | ||
| 248 | + Params: nil}) | ||
| 249 | + | ||
| 250 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 251 | + beego.ControllerComments{ | ||
| 244 | Method: "Templates", | 252 | Method: "Templates", |
| 245 | Router: `/templates`, | 253 | Router: `/templates`, |
| 246 | AllowHTTPMethods: []string{"post"}, | 254 | AllowHTTPMethods: []string{"post"}, |
| @@ -255,6 +263,14 @@ func init() { | @@ -255,6 +263,14 @@ func init() { | ||
| 255 | MethodParams: param.Make(), | 263 | MethodParams: param.Make(), |
| 256 | Params: nil}) | 264 | Params: nil}) |
| 257 | 265 | ||
| 266 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
| 267 | + beego.ControllerComments{ | ||
| 268 | + Method: "ChanceUpdate", | ||
| 269 | + Router: `/update`, | ||
| 270 | + AllowHTTPMethods: []string{"post"}, | ||
| 271 | + MethodParams: param.Make(), | ||
| 272 | + Params: nil}) | ||
| 273 | + | ||
| 258 | beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"], | 274 | beego.GlobalControllerRouter["opp/controllers/v1:CommendController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:CommendController"], |
| 259 | beego.ControllerComments{ | 275 | beego.ControllerComments{ |
| 260 | Method: "Company", | 276 | Method: "Company", |
| @@ -235,6 +235,48 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques | @@ -235,6 +235,48 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques | ||
| 235 | return | 235 | return |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | +//模板详情 | ||
| 239 | +func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) (rsp *protocol.TemplateResponse, err error) { | ||
| 240 | + var ( | ||
| 241 | + templates *models.AuditTemplate | ||
| 242 | + forms []*models.AuditForm | ||
| 243 | + ) | ||
| 244 | + rsp = &protocol.TemplateResponse{} | ||
| 245 | + if templates, err = models.GetAuditTemplate(header.CompanyId, request.ChanceTypeId, request.TemplateId); err != nil { | ||
| 246 | + log.Error(fmt.Sprintf("公司:%v chance_type_id:%v id:%v无模板 ", header.CompanyId, request.ChanceTypeId, request.TemplateId), err) | ||
| 247 | + return | ||
| 248 | + } | ||
| 249 | + item := templates | ||
| 250 | + //TODO:检查模板可见 | ||
| 251 | + // | ||
| 252 | + //查询表单 | ||
| 253 | + if forms, err = models.GetAuditForms(header.CompanyId, item.Id); err != nil { | ||
| 254 | + log.Error(err) | ||
| 255 | + return | ||
| 256 | + } | ||
| 257 | + template := &protocol.Template{ | ||
| 258 | + Id: item.Id, | ||
| 259 | + Name: item.Name, | ||
| 260 | + Icon: item.Icon, | ||
| 261 | + Doc: item.Doc, | ||
| 262 | + FormList: make([]*protocol.Form, len(forms)), | ||
| 263 | + Link: fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id), | ||
| 264 | + } | ||
| 265 | + for j := range forms { | ||
| 266 | + form := forms[j] | ||
| 267 | + template.FormList[j] = &protocol.Form{ | ||
| 268 | + Id: form.Id, | ||
| 269 | + Label: form.Label, | ||
| 270 | + Value: "", | ||
| 271 | + InputType: form.InputType, | ||
| 272 | + SectionType: form.Section, | ||
| 273 | + Required: form.Required, | ||
| 274 | + } | ||
| 275 | + } | ||
| 276 | + rsp.Template = template | ||
| 277 | + return | ||
| 278 | +} | ||
| 279 | + | ||
| 238 | func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.AuditTemplate) (result bool, err error) { | 280 | func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.AuditTemplate) (result bool, err error) { |
| 239 | //if template.VisibleType == | 281 | //if template.VisibleType == |
| 240 | return | 282 | return |
| @@ -368,35 +410,57 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -368,35 +410,57 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
| 368 | } | 410 | } |
| 369 | 411 | ||
| 370 | //机会编辑 | 412 | //机会编辑 |
| 371 | -func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmitRequest) (rsp *protocol.ChanceSubmitResponse, err error) { | 413 | +func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdateRequest) (rsp *protocol.ChanceUpdateResponse, err error) { |
| 372 | var ( | 414 | var ( |
| 373 | template *models.AuditTemplate | 415 | template *models.AuditTemplate |
| 374 | chance *models.Chance | 416 | chance *models.Chance |
| 375 | auditConfig *protocol.AuditConfig | 417 | auditConfig *protocol.AuditConfig |
| 376 | chanceData *models.ChanceData | 418 | chanceData *models.ChanceData |
| 377 | - //auditFlows []*models.AuditFlowProcess | 419 | + //auditFlows *models.AuditFlowProcess |
| 378 | updateMap = make(map[string]interface{}) | 420 | updateMap = make(map[string]interface{}) |
| 421 | + | ||
| 422 | + auditFlows []*models.AuditFlowProcess | ||
| 423 | + suplusApprove SuplusApprove | ||
| 424 | + chanceType *models.ChanceType | ||
| 379 | ) | 425 | ) |
| 426 | + //验证机会是否存在 | ||
| 380 | if chance, err = models.GetChanceById(request.Id); err != nil { | 427 | if chance, err = models.GetChanceById(request.Id); err != nil { |
| 381 | - log.Error(err) | 428 | + log.Error(request.Id, err) |
| 429 | + err = protocol.NewErrWithMessage(5101) | ||
| 382 | return | 430 | return |
| 383 | } | 431 | } |
| 384 | - //TODO:非本人 1.需要验证角色权限,是否是审核人 | 432 | + //编辑重新发布 是否可以重新发布 |
| 433 | + if request.IsPublish && chance.ReviewStatus == protocol.ReviewStatusReturn && chance.UserId == header.UserId { | ||
| 434 | + request.IsPublish = false | ||
| 435 | + //当前没有被人审核过 | ||
| 436 | + if _, e := models.GetAuditFlowProcessApproved(request.Id, 1); e == orm.ErrNoRows && chance.AuditLevel == 1 { | ||
| 437 | + //当前状态是退回-待处理 | ||
| 438 | + if _, e := models.GetAuditFlowProcessByReview(request.Id, 0, protocol.ReviewStatusWait); e == nil { | ||
| 439 | + request.IsPublish = true | ||
| 440 | + } | ||
| 441 | + } | ||
| 442 | + } else { | ||
| 443 | + request.IsPublish = false | ||
| 444 | + } | ||
| 445 | + //TODO:非本人 1.需要验证角色权限 2是否是审核人 3.是否是本人 (目前本人才可以审核) | ||
| 385 | if chance.UserId != header.Uid { | 446 | if chance.UserId != header.Uid { |
| 386 | - err = protocol.NewErrWithMessage(1) | 447 | + err = protocol.NewErrWithMessage(5206) |
| 387 | log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v", header.Uid, chance.Id)) | 448 | log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v", header.Uid, chance.Id)) |
| 388 | return | 449 | return |
| 389 | } | 450 | } |
| 390 | - //TODO:验证机会当前是否在审核中 | ||
| 391 | //1.模板是否存在 | 451 | //1.模板是否存在 |
| 392 | - if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil { | ||
| 393 | - log.Error("模板不存在:", request.AuditTemplateId, err) | 452 | + if template, err = models.GetAuditTemplateById(chance.AuditTemplateId); err != nil { |
| 453 | + log.Error("模板不存在:", chance.AuditTemplateId, err) | ||
| 454 | + err = protocol.NewErrWithMessage(5301) | ||
| 394 | return | 455 | return |
| 395 | } | 456 | } |
| 396 | auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover} | 457 | auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover} |
| 397 | orm := orm.NewOrm() | 458 | orm := orm.NewOrm() |
| 398 | orm.Begin() | 459 | orm.Begin() |
| 399 | { | 460 | { |
| 461 | + if request.IsPublish { | ||
| 462 | + updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) | ||
| 463 | + } | ||
| 400 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) | 464 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) |
| 401 | updateMap["Content"] = request.Content | 465 | updateMap["Content"] = request.Content |
| 402 | updateMap["SourceContent"] = common.AssertJson(request.FormList) | 466 | updateMap["SourceContent"] = common.AssertJson(request.FormList) |
| @@ -440,11 +504,55 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -440,11 +504,55 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
| 440 | } | 504 | } |
| 441 | } | 505 | } |
| 442 | } | 506 | } |
| 443 | - orm.Commit() | ||
| 444 | 507 | ||
| 445 | - //6.激活审核流 | ||
| 446 | - //TODO:7.发送消息通知给审核人(审核消息) | ||
| 447 | - rsp = &protocol.ChanceSubmitResponse{} | 508 | + { |
| 509 | + if request.IsPublish { | ||
| 510 | + //更新待处理->提交 | ||
| 511 | + if err = models.UpdatetAuditFlowProcessToSubmit(orm, request.Id, 0, protocol.ReviewStatusSubmit, header.UserId); err != nil { | ||
| 512 | + log.Error(err) | ||
| 513 | + orm.Rollback() | ||
| 514 | + return | ||
| 515 | + } | ||
| 516 | + //4.查询审核配置 | ||
| 517 | + //5.生成审核流 | ||
| 518 | + if auditFlows, err = GenAuditFlowProcess(header, chance.Id, chance.DepartmentId, template.Id, auditConfig); err != nil { | ||
| 519 | + log.Error(err) | ||
| 520 | + orm.Rollback() | ||
| 521 | + return | ||
| 522 | + } | ||
| 523 | + for i := 0; i < len(auditFlows); i++ { | ||
| 524 | + auditFlows[i].ApproveMessage = fmt.Sprintf(protocol.MessageApproving, chanceType.Name) | ||
| 525 | + //auditFlows[i].TemplateId = int(template.Id) | ||
| 526 | + if _, err = orm.Insert(auditFlows[i]); err != nil { | ||
| 527 | + log.Error(err) | ||
| 528 | + orm.Rollback() | ||
| 529 | + return | ||
| 530 | + } | ||
| 531 | + } | ||
| 532 | + if len(auditFlows) > 0 { | ||
| 533 | + //7.发送审批实例给审批服务器 | ||
| 534 | + if m, e := suplusApprove.NewApproveInstance(header, auditFlows); e != nil { | ||
| 535 | + log.Error(fmt.Sprintf("uid:%v", header.UserId), "request suplus-approve.NewApproveInstance err", e) | ||
| 536 | + orm.Rollback() | ||
| 537 | + err = e | ||
| 538 | + return | ||
| 539 | + } else { | ||
| 540 | + //7.发送消息通知给审核人(审核消息) | ||
| 541 | + for i := range m.MessageData { | ||
| 542 | + message := m.MessageData[i] | ||
| 543 | + if err = agg.SendApproveMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, | ||
| 544 | + header.CompanyId, chance.Id, chance.ChanceTypeId, protocol.ReviewStatusAuditging); err != nil { | ||
| 545 | + log.Error(err) | ||
| 546 | + orm.Rollback() | ||
| 547 | + return | ||
| 548 | + } | ||
| 549 | + } | ||
| 550 | + } | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + } | ||
| 554 | + orm.Commit() | ||
| 555 | + rsp = &protocol.ChanceUpdateResponse{} | ||
| 448 | return | 556 | return |
| 449 | } | 557 | } |
| 450 | 558 | ||
| @@ -549,7 +657,10 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | @@ -549,7 +657,10 @@ func ChanceChangeScore(header *protocol.RequestHeader, request *protocol.ChanceC | ||
| 549 | return | 657 | return |
| 550 | } | 658 | } |
| 551 | orm.Commit() | 659 | orm.Commit() |
| 552 | - rsp = &protocol.ChanceChangeScoreResponse{} | 660 | + rsp = &protocol.ChanceChangeScoreResponse{ |
| 661 | + DiscoveryScore: result.DiscoveryScore, | ||
| 662 | + DiscoveryScorePercent: result.DiscoveryScorePercent, | ||
| 663 | + } | ||
| 553 | return | 664 | return |
| 554 | } | 665 | } |
| 555 | 666 |
-
请 注册 或 登录 后发表评论