Merge remote-tracking branch 'origin/dev' into test
正在显示
7 个修改的文件
包含
83 行增加
和
16 行删除
@@ -4,6 +4,7 @@ import ( | @@ -4,6 +4,7 @@ import ( | ||
4 | "encoding/json" | 4 | "encoding/json" |
5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
6 | "opp/controllers" | 6 | "opp/controllers" |
7 | + "opp/internal/utils" | ||
7 | "opp/protocol" | 8 | "opp/protocol" |
8 | "opp/services/chance" | 9 | "opp/services/chance" |
9 | ) | 10 | ) |
@@ -352,6 +353,20 @@ func (this *ChanceController) ChanceApprove() { | @@ -352,6 +353,20 @@ func (this *ChanceController) ChanceApprove() { | ||
352 | msg = m | 353 | msg = m |
353 | return | 354 | return |
354 | } | 355 | } |
356 | + if request.ReviewStatus == protocol.ReviewStatusPass { | ||
357 | + if utils.IsNil(request.ApproveData) { | ||
358 | + msg = protocol.BadRequestParam(5204) | ||
359 | + return | ||
360 | + } | ||
361 | + if utils.IsNil(request.ApproveData.PublicData) { | ||
362 | + msg = protocol.BadRequestParam(5204) | ||
363 | + return | ||
364 | + } | ||
365 | + if utils.IsNil(request.ApproveData.PublicData) { | ||
366 | + msg = protocol.BadRequestParam(5204) | ||
367 | + return | ||
368 | + } | ||
369 | + } | ||
355 | header := controllers.GetRequestHeader(this.Ctx) | 370 | header := controllers.GetRequestHeader(this.Ctx) |
356 | msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request)) | 371 | msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request)) |
357 | } | 372 | } |
@@ -18,6 +18,7 @@ type AuditFlowProcess struct { | @@ -18,6 +18,7 @@ type AuditFlowProcess struct { | ||
18 | BasicSorce float64 `orm:"column(basic_sorce);null;digits(4);decimals(1)" description:"基础评分"` | 18 | BasicSorce float64 `orm:"column(basic_sorce);null;digits(4);decimals(1)" description:"基础评分"` |
19 | ExtraSorce float64 `orm:"column(extra_sorce);null;digits(4);decimals(1)" description:"附加评分"` | 19 | ExtraSorce float64 `orm:"column(extra_sorce);null;digits(4);decimals(1)" description:"附加评分"` |
20 | ValueSorce float64 `orm:"column(value_sorce);null;digits(4);decimals(1)" description:"价值评分"` | 20 | ValueSorce float64 `orm:"column(value_sorce);null;digits(4);decimals(1)" description:"价值评分"` |
21 | + DiscoverySorce float64 `orm:"column(discovery_sorce);null;digits(4);decimals(1)" description:"发现得分(发现得分=基础评分*系数 + 附加评分*系数 + 价值评分*系数)"` | ||
21 | ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:审核中 1:被退回 2:已通过 3.自动通过 "` | 22 | ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:审核中 1:被退回 2:已通过 3.自动通过 "` |
22 | AuditFlowType int `orm:"column(audit_flow_type)" description:"审核流类型 1.部门长 2.指定成员 3.指定角色 4.特殊审核人"` | 23 | AuditFlowType int `orm:"column(audit_flow_type)" description:"审核流类型 1.部门长 2.指定成员 3.指定角色 4.特殊审核人"` |
23 | FlowType int `orm:"column(flow_type)" description:"审批类型 1:正常审核 2:特殊审核"` | 24 | FlowType int `orm:"column(flow_type)" description:"审批类型 1:正常审核 2:特殊审核"` |
@@ -25,6 +26,7 @@ type AuditFlowProcess struct { | @@ -25,6 +26,7 @@ type AuditFlowProcess struct { | ||
25 | CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"` | 26 | CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"` |
26 | UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"` | 27 | UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"` |
27 | EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)"` | 28 | EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)"` |
29 | + ApproveData string `orm:"column(approve_data);size(500)" description:"审核数据 json{公开状态 公开对象 分数}"` | ||
28 | UserName string `orm:"column(user_name);size(50)" description:"用户名-冗余"` | 30 | UserName string `orm:"column(user_name);size(50)" description:"用户名-冗余"` |
29 | RoleName string `orm:"column(role_name);size(50)" description:"角色名-冗余"` | 31 | RoleName string `orm:"column(role_name);size(50)" description:"角色名-冗余"` |
30 | RoleId int `orm:"column(role_id);size(50)" description:"角色id-冗余"` | 32 | RoleId int `orm:"column(role_id);size(50)" description:"角色id-冗余"` |
@@ -23,6 +23,7 @@ type ChanceApproveRequest struct { | @@ -23,6 +23,7 @@ type ChanceApproveRequest struct { | ||
23 | ProcessId int64 `json:"processId"` //审批流程编号 | 23 | ProcessId int64 `json:"processId"` //审批流程编号 |
24 | ReviewStatus int `json:"reviewStatus"` //protocol.ReviewStatus | 24 | ReviewStatus int `json:"reviewStatus"` //protocol.ReviewStatus |
25 | //Suggestion string `json:"suggestion"` //原因/建议 | 25 | //Suggestion string `json:"suggestion"` //原因/建议 |
26 | + ApproveData ApproveData `json:"approveData"` //审核数据 | ||
26 | } | 27 | } |
27 | type ChanceApproveResponse struct { | 28 | type ChanceApproveResponse struct { |
28 | } | 29 | } |
@@ -67,13 +68,13 @@ type Role struct { | @@ -67,13 +68,13 @@ type Role struct { | ||
67 | 68 | ||
68 | //审核数据 审核通过 | 69 | //审核数据 审核通过 |
69 | type ApproveData struct { | 70 | type ApproveData struct { |
70 | - PublicData *PublicData `json:"publicData"` // 公开数据 | ||
71 | - Score *Score `json:"score"` | 71 | + PublicData PublicData `json:"publicData"` // 公开数据 |
72 | + Score Score `json:"score"` | ||
72 | } | 73 | } |
73 | 74 | ||
74 | //公开数据 | 75 | //公开数据 |
75 | type PublicData struct { | 76 | type PublicData struct { |
76 | - PublishStatus int `json:"publishStatus"` | 77 | + PublishStatus int `json:"publishStatus"` //公开状态 0未公开、1部门公开、2公司公开 |
77 | VisibleObjects []*VisibleObject `json:"visibleObject"` | 78 | VisibleObjects []*VisibleObject `json:"visibleObject"` |
78 | } | 79 | } |
79 | 80 | ||
@@ -86,10 +87,10 @@ type VisibleObject struct { | @@ -86,10 +87,10 @@ type VisibleObject struct { | ||
86 | 87 | ||
87 | //评分 | 88 | //评分 |
88 | type Score struct { | 89 | type Score struct { |
89 | - BasicScore int `json:"basicScore"` //基础评分 | ||
90 | - ExtraScore int `json:"extraScore"` //额外分 | ||
91 | - ValueScore int `json:"valueScore"` //价值分 | ||
92 | - DiscoveryScore int `json:"-"` //发现分 | 90 | + BasicScore float32 `json:"basicScore"` //基础评分 |
91 | + ExtraScore float32 `json:"extraScore"` //额外分 | ||
92 | + ValueScore float32 `json:"valueScore"` //价值分 | ||
93 | + DiscoveryScore float32 `json:"discoveryScore"` //发现分 | ||
93 | } | 94 | } |
94 | 95 | ||
95 | //审核操作权限 | 96 | //审核操作权限 |
@@ -39,6 +39,7 @@ var errmessge ErrorMap = map[int]string{ | @@ -39,6 +39,7 @@ var errmessge ErrorMap = map[int]string{ | ||
39 | 5201: "该机会模板未配置审批人,请选择其他模板", | 39 | 5201: "该机会模板未配置审批人,请选择其他模板", |
40 | 5202: "该机会已被审批", | 40 | 5202: "该机会已被审批", |
41 | 5203: "审批服务器操作失败", | 41 | 5203: "审批服务器操作失败", |
42 | + 5204: "评分或者公开状态不能为空", | ||
42 | 43 | ||
43 | //模板相关 | 44 | //模板相关 |
44 | 5301: "机会模板不存在", | 45 | 5301: "机会模板不存在", |
1 | package protocol | 1 | package protocol |
2 | 2 | ||
3 | +import ( | ||
4 | + "fmt" | ||
5 | + "github.com/astaxie/beego" | ||
6 | +) | ||
7 | + | ||
3 | //短信类型 | 8 | //短信类型 |
4 | const ( | 9 | const ( |
5 | SmsCode = "sms_code" | 10 | SmsCode = "sms_code" |
@@ -15,3 +20,15 @@ type SmsInfo struct { | @@ -15,3 +20,15 @@ type SmsInfo struct { | ||
15 | CreateTime int64 `json:"create_time"` | 20 | CreateTime int64 `json:"create_time"` |
16 | Checked int `json:"checked"` //0:未校验证 1:已校验 | 21 | Checked int `json:"checked"` //0:未校验证 1:已校验 |
17 | } | 22 | } |
23 | + | ||
24 | +//redis键值 | ||
25 | +func RedisKey(businessKey string) string { | ||
26 | + //项目:环境:业务码 | ||
27 | + return fmt.Sprintf("%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey) | ||
28 | +} | ||
29 | + | ||
30 | +//redis键值 项标识 | ||
31 | +func RedisKeyWithId(businessKey string, id int64) string { | ||
32 | + //项目:环境:业务码 | ||
33 | + return fmt.Sprintf("%v:%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey, id) | ||
34 | +} |
@@ -272,7 +272,10 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -272,7 +272,10 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
272 | suplusApprove SuplusApprove | 272 | suplusApprove SuplusApprove |
273 | approveType int | 273 | approveType int |
274 | approveItemResponse ApproveItemResponse | 274 | approveItemResponse ApproveItemResponse |
275 | + mapProcess map[string]interface{} | ||
276 | + mapChance map[string]interface{} | ||
275 | ) | 277 | ) |
278 | + rsp = &protocol.ChanceApproveResponse{} | ||
276 | //TODO:测试注入 | 279 | //TODO:测试注入 |
277 | if request.Uid != 0 { | 280 | if request.Uid != 0 { |
278 | header.UserId = request.Uid | 281 | header.UserId = request.Uid |
@@ -304,9 +307,29 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -304,9 +307,29 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
304 | err = protocol.NewErrWithMessage(5203) | 307 | err = protocol.NewErrWithMessage(5203) |
305 | return | 308 | return |
306 | } | 309 | } |
307 | - if err = utils.UpdateTableByMap(process, map[string]interface{}{ | ||
308 | - "ReviewStatus": int8(request.ReviewStatus), "ApproveTime": time.Now()}); err != nil { | ||
309 | - log.Error("更新机会审核状态失败 process_id:", process.Id, err) | 310 | + { |
311 | + mapProcess["ReviewStatus"] = int8(request.ReviewStatus) | ||
312 | + mapProcess["ApproveTime"] = time.Now() | ||
313 | + if request.ReviewStatus == protocol.ReviewStatusPass { | ||
314 | + mapProcess["BasicSorce"] = request.ApproveData.Score.BasicScore | ||
315 | + mapProcess["ExtraSorce"] = request.ApproveData.Score.ExtraScore | ||
316 | + mapProcess["ValueSorce"] = request.ApproveData.Score.ValueScore | ||
317 | + mapProcess["DiscoverySorce"] = request.ApproveData.Score.DiscoveryScore | ||
318 | + mapProcess["ApproveData"] = common.AssertJson(request.ApproveData) | ||
319 | + | ||
320 | + mapChance["BasicSorce"] = request.ApproveData.Score.BasicScore | ||
321 | + mapChance["ExtraSorce"] = request.ApproveData.Score.ExtraScore | ||
322 | + mapChance["ValueSorce"] = request.ApproveData.Score.ValueScore | ||
323 | + mapChance["DiscoverySorce"] = request.ApproveData.Score.DiscoveryScore | ||
324 | + mapChance["ApproveData"] = common.AssertJson(request.ApproveData) | ||
325 | + mapChance["PublishStatus"] = request.ApproveData.PublicData.PublishStatus | ||
326 | + } | ||
327 | + } | ||
328 | + orm := orm.NewOrm() | ||
329 | + orm.Begin() | ||
330 | + if err = utils.UpdateTableByMapWithOrmer(orm, process, mapProcess); err != nil { | ||
331 | + log.Error("更新机会审核流程 状态失败 process_id:", process.Id, err) | ||
332 | + orm.Rollback() | ||
310 | return | 333 | return |
311 | } | 334 | } |
312 | log.Info(fmt.Sprintf("用户%v 更新机会审核状态 process_id:%v 状态:%v", header.UserId, process.Id, request.ReviewStatus)) | 335 | log.Info(fmt.Sprintf("用户%v 更新机会审核状态 process_id:%v 状态:%v", header.UserId, process.Id, request.ReviewStatus)) |
@@ -315,10 +338,8 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -315,10 +338,8 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
315 | var nextApprovers []int64 | 338 | var nextApprovers []int64 |
316 | if approveItemResponse.IsOver == 1 { | 339 | if approveItemResponse.IsOver == 1 { |
317 | //结束审批 | 340 | //结束审批 |
318 | - if err = utils.UpdateTableByMap(chance, map[string]interface{}{ | ||
319 | - "ReviewStatus": int8(request.ReviewStatus), "AuditLevel": chance.AuditLevel}); err != nil { | ||
320 | - log.Error("更新机会审核状态失败 chance_id:", chance.Id, err) | ||
321 | - return | 341 | + { |
342 | + mapChance["ReviewStatus"] = int8(request.ReviewStatus) | ||
322 | } | 343 | } |
323 | //发送审核结果消息给提交人 | 344 | //发送审核结果消息给提交人 |
324 | for i := range approveItemResponse.MessageData.ApplyUserMessage { | 345 | for i := range approveItemResponse.MessageData.ApplyUserMessage { |
@@ -361,7 +382,13 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -361,7 +382,13 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
361 | } | 382 | } |
362 | } | 383 | } |
363 | } | 384 | } |
364 | - rsp = &protocol.ChanceApproveResponse{} | 385 | + |
386 | + if err = utils.UpdateTableByMapWithOrmer(orm, chance, mapChance); err != nil { | ||
387 | + orm.Rollback() | ||
388 | + log.Error("更新机会审核状态失败 chance_id:", chance.Id, err) | ||
389 | + return | ||
390 | + } | ||
391 | + orm.Commit() | ||
365 | return | 392 | return |
366 | } | 393 | } |
367 | 394 | ||
@@ -460,6 +487,10 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | @@ -460,6 +487,10 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | ||
460 | rsp.ApproveProcess = append(rsp.ApproveProcess, item) | 487 | rsp.ApproveProcess = append(rsp.ApproveProcess, item) |
461 | continue | 488 | continue |
462 | } | 489 | } |
490 | + if p.ReviewStatus == protocol.ReviewStatusPass { | ||
491 | + rsp.ApproveProcess = append(rsp.ApproveProcess, item) | ||
492 | + continue | ||
493 | + } | ||
463 | //当前再审核的列表 | 494 | //当前再审核的列表 |
464 | if p.Level == chance.AuditLevel && item.ReviewStatus == protocol.ReviewStatusAuditging { | 495 | if p.Level == chance.AuditLevel && item.ReviewStatus == protocol.ReviewStatusAuditging { |
465 | item = newProcessItem(p) | 496 | item = newProcessItem(p) |
@@ -105,7 +105,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen | @@ -105,7 +105,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen | ||
105 | Title: bulletin.Title, | 105 | Title: bulletin.Title, |
106 | Control: int(bulletin.AllowClose), | 106 | Control: int(bulletin.AllowClose), |
107 | //link:'https://web-open.fjmaimaimai.com/#/ability/announcement?id='+announcementCfgData[i].id+'&uid='+param.uid | 107 | //link:'https://web-open.fjmaimaimai.com/#/ability/announcement?id='+announcementCfgData[i].id+'&uid='+param.uid |
108 | - Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v&oppo", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId), | 108 | + Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v&oppo=", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId), |
109 | } | 109 | } |
110 | item.Cover = protocol.Cover{ | 110 | item.Cover = protocol.Cover{ |
111 | Path: bulletin.Cover, | 111 | Path: bulletin.Cover, |
-
请 注册 或 登录 后发表评论