正在显示
12 个修改的文件
包含
445 行增加
和
74 行删除
| @@ -286,11 +286,12 @@ func (this *ChanceController) ChanceSubmit() { | @@ -286,11 +286,12 @@ func (this *ChanceController) ChanceSubmit() { | ||
| 286 | msg = m | 286 | msg = m |
| 287 | return | 287 | return |
| 288 | } | 288 | } |
| 289 | + if e := request.SelfChecks.Valid(); e != nil { | ||
| 290 | + log.Error(e) | ||
| 291 | + msg = protocol.NewReturnResponse(nil, e) | ||
| 292 | + return | ||
| 293 | + } | ||
| 289 | header := controllers.GetRequestHeader(this.Ctx) | 294 | header := controllers.GetRequestHeader(this.Ctx) |
| 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 | msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request)) |
| 295 | } | 296 | } |
| 296 | 297 | ||
| @@ -311,6 +312,11 @@ func (this *ChanceController) ChanceUpdate() { | @@ -311,6 +312,11 @@ func (this *ChanceController) ChanceUpdate() { | ||
| 311 | msg = m | 312 | msg = m |
| 312 | return | 313 | return |
| 313 | } | 314 | } |
| 315 | + if e := request.SelfChecks.Valid(); e != nil { | ||
| 316 | + log.Error(e) | ||
| 317 | + msg = protocol.NewReturnResponse(nil, e) | ||
| 318 | + return | ||
| 319 | + } | ||
| 314 | header := controllers.GetRequestHeader(this.Ctx) | 320 | header := controllers.GetRequestHeader(this.Ctx) |
| 315 | msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) | 321 | msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) |
| 316 | } | 322 | } |
| @@ -443,6 +449,11 @@ func (this *ChanceController) ChanceApprove() { | @@ -443,6 +449,11 @@ func (this *ChanceController) ChanceApprove() { | ||
| 443 | return | 449 | return |
| 444 | } | 450 | } |
| 445 | } | 451 | } |
| 452 | + if e := request.SelfChecks.Valid(); e != nil { | ||
| 453 | + log.Error(e) | ||
| 454 | + msg = protocol.NewReturnResponse(nil, e) | ||
| 455 | + return | ||
| 456 | + } | ||
| 446 | header := controllers.GetRequestHeader(this.Ctx) | 457 | header := controllers.GetRequestHeader(this.Ctx) |
| 447 | msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request)) | 458 | msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request)) |
| 448 | } | 459 | } |
| @@ -636,3 +647,24 @@ func (this *ChanceController) ChanceReviseDetail() { | @@ -636,3 +647,24 @@ func (this *ChanceController) ChanceReviseDetail() { | ||
| 636 | header := controllers.GetRequestHeader(this.Ctx) | 647 | header := controllers.GetRequestHeader(this.Ctx) |
| 637 | msg = protocol.NewReturnResponse(chance.ChanceReviseDetail(header, request)) | 648 | msg = protocol.NewReturnResponse(chance.ChanceReviseDetail(header, request)) |
| 638 | } | 649 | } |
| 650 | + | ||
| 651 | +//CheckQuestions 自查问题列表 | ||
| 652 | +//@router /checkQuestions [post] | ||
| 653 | +func (this *ChanceController) CheckQuestions() { | ||
| 654 | + var msg *protocol.ResponseMessage | ||
| 655 | + defer func() { | ||
| 656 | + this.Resp(msg) | ||
| 657 | + }() | ||
| 658 | + var request *protocol.CheckQuestionsRequest | ||
| 659 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 660 | + log.Error(err) | ||
| 661 | + msg = protocol.BadRequestParam(1) | ||
| 662 | + return | ||
| 663 | + } | ||
| 664 | + if b, m := this.Valid(request); !b { | ||
| 665 | + msg = m | ||
| 666 | + return | ||
| 667 | + } | ||
| 668 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 669 | + msg = protocol.NewReturnResponse(chance.CheckQuestions(header, request)) | ||
| 670 | +} |
models/audit_check.go
0 → 100644
| 1 | +package models | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "time" | ||
| 5 | + | ||
| 6 | + "github.com/astaxie/beego/orm" | ||
| 7 | +) | ||
| 8 | + | ||
| 9 | +type AuditCheck struct { | ||
| 10 | + Id int `orm:"column(id);pk"` | ||
| 11 | + Pid int64 `orm:"column(pid)"` | ||
| 12 | + TemplateId int64 `orm:"column(template_id)" description:"模板id"` | ||
| 13 | + Title string `orm:"column(title);size(100)" description:"标题"` | ||
| 14 | + Items string `orm:"column(items)" description:"选项数据json格式"` | ||
| 15 | + Enable int8 `orm:"column(enable)" description:"是否有效【0:无效】【1:有效】"` | ||
| 16 | + CreateTime time.Time `orm:"column(create_time);type(timestamp)"` | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +func (t *AuditCheck) TableName() string { | ||
| 20 | + return "audit_check" | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func init() { | ||
| 24 | + orm.RegisterModel(new(AuditCheck)) | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +// GetAuditCheckById retrieves AuditCheck by Id. Returns error if | ||
| 28 | +// Id doesn't exist | ||
| 29 | +func GetAuditCheckById(id int) (v *AuditCheck, err error) { | ||
| 30 | + o := orm.NewOrm() | ||
| 31 | + v = &AuditCheck{Id: id} | ||
| 32 | + if err = o.Read(v); err == nil { | ||
| 33 | + return v, nil | ||
| 34 | + } | ||
| 35 | + return nil, err | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +func GetAuditCheckBy(tpId int64) (v []*AuditCheck, err error) { | ||
| 39 | + sql := `select * from( | ||
| 40 | +select id,(case when pid=0 then id else id end) pid,title,items from audit_check where template_id=? and enable=1 | ||
| 41 | +)a | ||
| 42 | +order by a.pid` | ||
| 43 | + o := orm.NewOrm() | ||
| 44 | + if _, err = o.Raw(sql, tpId).QueryRows(&v); err != nil { | ||
| 45 | + if err == orm.ErrNoRows { | ||
| 46 | + err = nil | ||
| 47 | + } | ||
| 48 | + return | ||
| 49 | + } | ||
| 50 | + return | ||
| 51 | +} |
| @@ -32,6 +32,7 @@ type AuditFlowProcess struct { | @@ -32,6 +32,7 @@ type AuditFlowProcess struct { | ||
| 32 | RoleId int `orm:"column(role_id);size(50)" description:"角色id-冗余"` | 32 | RoleId int `orm:"column(role_id);size(50)" description:"角色id-冗余"` |
| 33 | ApproveMessage string `orm:"column(approve_message);size(50)" description:"审核消息-冗余"` | 33 | ApproveMessage string `orm:"column(approve_message);size(50)" description:"审核消息-冗余"` |
| 34 | TemplateId int `orm:"column(template_id);size(50)" description:"模板编号-冗余"` | 34 | TemplateId int `orm:"column(template_id);size(50)" description:"模板编号-冗余"` |
| 35 | + SelfChecks string `orm:"column(self_checks);null" description:"自查内容"` | ||
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | func (t *AuditFlowProcess) TableName() string { | 38 | func (t *AuditFlowProcess) TableName() string { |
| @@ -125,7 +126,7 @@ func GetAuditFlowProcessList(chanceId int64) (v []*AuditFlowProcess, err error) | @@ -125,7 +126,7 @@ func GetAuditFlowProcessList(chanceId int64) (v []*AuditFlowProcess, err error) | ||
| 125 | o := orm.NewOrm() | 126 | o := orm.NewOrm() |
| 126 | sql := `select id ,chance_id,uid,level,is_active,IFNULL(approve_time,NOW()) approve_time,basic_score,extra_score,value_score,discovery_score, | 127 | sql := `select id ,chance_id,uid,level,is_active,IFNULL(approve_time,NOW()) approve_time,basic_score,extra_score,value_score,discovery_score, |
| 127 | review_status,audit_flow_type,flow_type,action_type,update_at,create_at,enable_status,approve_data,user_name,role_name,role_id,approve_message, | 128 | review_status,audit_flow_type,flow_type,action_type,update_at,create_at,enable_status,approve_data,user_name,role_name,role_id,approve_message, |
| 128 | -template_id from audit_flow_process | 129 | +template_id,self_checks from audit_flow_process |
| 129 | where chance_id =? and enable_status=1 order by approve_time,level desc` | 130 | where chance_id =? and enable_status=1 order by approve_time,level desc` |
| 130 | if _, err = o.Raw(sql, chanceId).QueryRows(&v); err == nil { | 131 | if _, err = o.Raw(sql, chanceId).QueryRows(&v); err == nil { |
| 131 | return v, nil | 132 | return v, nil |
| @@ -35,6 +35,7 @@ type Chance struct { | @@ -35,6 +35,7 @@ type Chance struct { | ||
| 35 | ApproveTime time.Time `orm:"column(approve_time);type(timestamp)" description:"审批时间"` | 35 | ApproveTime time.Time `orm:"column(approve_time);type(timestamp)" description:"审批时间"` |
| 36 | Code string `orm:"column(code)" description:"机会编码 一级编码+二级编码"` | 36 | Code string `orm:"column(code)" description:"机会编码 一级编码+二级编码"` |
| 37 | Status int8 `orm:"column(status)" description:"状态 1:开启 2:关闭 "` | 37 | Status int8 `orm:"column(status)" description:"状态 1:开启 2:关闭 "` |
| 38 | + SelfChecks string `orm:"column(self_checks);size(1000);null" description:"自查内容"` | ||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | const ( | 41 | const ( |
| @@ -42,6 +43,10 @@ const ( | @@ -42,6 +43,10 @@ const ( | ||
| 42 | ChanceStatusClose = 2 //关闭 | 43 | ChanceStatusClose = 2 //关闭 |
| 43 | ) | 44 | ) |
| 44 | 45 | ||
| 46 | +var ( | ||
| 47 | + SqlGetChanceSelfChecks = `select self_checks from chance where id =?` //机会自查数据 | ||
| 48 | +) | ||
| 49 | + | ||
| 45 | func (t *Chance) TableName() string { | 50 | func (t *Chance) TableName() string { |
| 46 | return "chance" | 51 | return "chance" |
| 47 | } | 52 | } |
| @@ -159,7 +164,7 @@ from audit_flow_process where uid=? and review_status in (%v) `, utils.JoinInt8 | @@ -159,7 +164,7 @@ from audit_flow_process where uid=? and review_status in (%v) `, utils.JoinInt8 | ||
| 159 | 164 | ||
| 160 | func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) { | 165 | func GetChanceMyApproveChanceEnable(uid, cid int64, reviewStatus []int8, lastId int64, pageSize int, v interface{}) (total int, err error) { |
| 161 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( | 166 | sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos from ( |
| 162 | -select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status,b.update_at process_create_time from ( | 167 | +select a.*,b.user_id,b.source_content,b.enable_status,b.review_status,b.create_at,b.update_at,b.approve_time chance_approve_time,b.status,b.update_at process_create_time,b.self_checks from ( |
| 163 | select id,approve_time,approve_data,uid,chance_id,approve_message | 168 | select id,approve_time,approve_data,uid,chance_id,approve_message |
| 164 | from audit_flow_process where uid=? and review_status in (%v) and enable_status =1 | 169 | from audit_flow_process where uid=? and review_status in (%v) and enable_status =1 |
| 165 | )a left outer join chance b on a.chance_id = b.id | 170 | )a left outer join chance b on a.chance_id = b.id |
models/chance_self_check.go
0 → 100644
| 1 | +package models | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "fmt" | ||
| 5 | + "time" | ||
| 6 | + | ||
| 7 | + "github.com/astaxie/beego/orm" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type ChanceSelfCheck struct { | ||
| 11 | + Id int64 `orm:"column(id);pk" description:"编号"` | ||
| 12 | + UserCompanyId int64 `orm:"column(user_company_id);null" description:"提交人"` | ||
| 13 | + ChanceId int64 `orm:"column(chanceId);null" description:"机会编号"` | ||
| 14 | + RelateId int64 `orm:"column(relateId)" description:"关联编号 机会编号 / 审核流程编号"` | ||
| 15 | + CheckItem string `orm:"column(checkItem);size(50)" description:"检查项"` | ||
| 16 | + GroupId int64 `orm:"column(groupId)" description:"分组编号(audit_check.id/pid)"` | ||
| 17 | + Answer string `orm:"column(answer);size(50);null" description:"回答"` | ||
| 18 | + Reason string `orm:"column(reason);size(200);null" description:"理由"` | ||
| 19 | + CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"` | ||
| 20 | + UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"` | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +func (t *ChanceSelfCheck) TableName() string { | ||
| 24 | + return "chance_self_check" | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func init() { | ||
| 28 | + orm.RegisterModel(new(ChanceSelfCheck)) | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +// AddChanceSelfCheck insert a new ChanceSelfCheck into database and returns | ||
| 32 | +// last inserted Id on success. | ||
| 33 | +func AddChanceSelfCheck(m *ChanceSelfCheck) (id int64, err error) { | ||
| 34 | + o := orm.NewOrm() | ||
| 35 | + id, err = o.Insert(m) | ||
| 36 | + return | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +// GetChanceSelfCheckById retrieves ChanceSelfCheck by Id. Returns error if | ||
| 40 | +// Id doesn't exist | ||
| 41 | +func GetChanceSelfCheckById(id int64) (v *ChanceSelfCheck, err error) { | ||
| 42 | + o := orm.NewOrm() | ||
| 43 | + v = &ChanceSelfCheck{Id: id} | ||
| 44 | + if err = o.Read(v); err == nil { | ||
| 45 | + return v, nil | ||
| 46 | + } | ||
| 47 | + return nil, err | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +// UpdateChanceSelfCheck updates ChanceSelfCheck by Id and returns error if | ||
| 51 | +// the record to be updated doesn't exist | ||
| 52 | +func UpdateChanceSelfCheckById(m *ChanceSelfCheck) (err error) { | ||
| 53 | + o := orm.NewOrm() | ||
| 54 | + v := ChanceSelfCheck{Id: m.Id} | ||
| 55 | + // ascertain id exists in the database | ||
| 56 | + if err = o.Read(&v); err == nil { | ||
| 57 | + var num int64 | ||
| 58 | + if num, err = o.Update(m); err == nil { | ||
| 59 | + fmt.Println("Number of records updated in database:", num) | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + return | ||
| 63 | +} |
| @@ -117,14 +117,15 @@ type ChanceExampleResponse struct { | @@ -117,14 +117,15 @@ type ChanceExampleResponse struct { | ||
| 117 | 117 | ||
| 118 | /*提交机会*/ | 118 | /*提交机会*/ |
| 119 | type ChanceSubmitRequest struct { | 119 | type ChanceSubmitRequest struct { |
| 120 | - Id int64 `json:"id"` // = 0添加 >0 编辑 | ||
| 121 | - AuditTemplateId int64 `json:"auditTemplateId" valid:"Required"` | ||
| 122 | - Content string `json:"content"` | ||
| 123 | - FormList []*Form `json:"formList" valid:"Required"` | ||
| 124 | - Speechs []Speech `json:"speechs"` | ||
| 125 | - Pictures []Picture `json:"pictures"` | ||
| 126 | - Videos []Video `json:"videos"` | ||
| 127 | - RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"` | 120 | + Id int64 `json:"id"` // = 0添加 >0 编辑 |
| 121 | + AuditTemplateId int64 `json:"auditTemplateId" valid:"Required"` | ||
| 122 | + Content string `json:"content"` | ||
| 123 | + FormList []*Form `json:"formList" valid:"Required"` | ||
| 124 | + SelfChecks SelfChecks `json:"selfChecks"` | ||
| 125 | + Speechs []Speech `json:"speechs"` | ||
| 126 | + Pictures []Picture `json:"pictures"` | ||
| 127 | + Videos []Video `json:"videos"` | ||
| 128 | + RelatedDepartment int64 `json:"relatedDepartments" valid:"Required"` | ||
| 128 | } | 129 | } |
| 129 | type ChanceSubmitResponse struct { | 130 | type ChanceSubmitResponse struct { |
| 130 | } | 131 | } |
| @@ -140,7 +141,8 @@ type ChanceUpdateRequest struct { | @@ -140,7 +141,8 @@ type ChanceUpdateRequest struct { | ||
| 140 | Videos []Video `json:"videos"` | 141 | Videos []Video `json:"videos"` |
| 141 | RelatedDepartment int64 `json:"relatedDepartments"` | 142 | RelatedDepartment int64 `json:"relatedDepartments"` |
| 142 | 143 | ||
| 143 | - IsPublish bool `json:"isPublish"` //是否重新发布 | 144 | + IsPublish bool `json:"isPublish"` //是否重新发布 |
| 145 | + SelfChecks SelfChecks `json:"selfChecks"` | ||
| 144 | } | 146 | } |
| 145 | type ChanceUpdateResponse struct { | 147 | type ChanceUpdateResponse struct { |
| 146 | } | 148 | } |
| @@ -236,6 +238,8 @@ type ChanceApproveItemOrm struct { | @@ -236,6 +238,8 @@ type ChanceApproveItemOrm struct { | ||
| 236 | ApproveUserId int64 `orm:"column(uid)"` | 238 | ApproveUserId int64 `orm:"column(uid)"` |
| 237 | ProcessCreateTime time.Time `orm:"column(process_create_time)"` | 239 | ProcessCreateTime time.Time `orm:"column(process_create_time)"` |
| 238 | ChanceId int64 `orm:"column(chance_id)"` // 机会id | 240 | ChanceId int64 `orm:"column(chance_id)"` // 机会id |
| 241 | + | ||
| 242 | + SelfChecks string `orm:"column(self_checks)"` | ||
| 239 | } | 243 | } |
| 240 | 244 | ||
| 241 | /*MyCollectChance 我的收藏*/ | 245 | /*MyCollectChance 我的收藏*/ |
| @@ -451,12 +455,13 @@ type ChanceDetail struct { | @@ -451,12 +455,13 @@ type ChanceDetail struct { | ||
| 451 | 455 | ||
| 452 | //模板 | 456 | //模板 |
| 453 | type Template struct { | 457 | type Template struct { |
| 454 | - Id int64 `json:"id"` | ||
| 455 | - Name string `json:"name"` | ||
| 456 | - Doc string `json:"doc"` | ||
| 457 | - Icon string `json:"icon"` | ||
| 458 | - FormList []*Form `json:"formList"` | ||
| 459 | - Link string `json:"link"` //示例 | 458 | + Id int64 `json:"id"` |
| 459 | + Name string `json:"name"` | ||
| 460 | + Doc string `json:"doc"` | ||
| 461 | + Icon string `json:"icon"` | ||
| 462 | + FormList []*Form `json:"formList"` | ||
| 463 | + Question []*CheckQuestion `json:"question"` | ||
| 464 | + Link string `json:"link"` //示例 | ||
| 460 | } | 465 | } |
| 461 | 466 | ||
| 462 | //表单 | 467 | //表单 |
| @@ -527,6 +532,8 @@ type CommonListItem struct { | @@ -527,6 +532,8 @@ type CommonListItem struct { | ||
| 527 | ThumbUpData interface{} `json:"thumbUpData,omitempty"` //点赞数据 | 532 | ThumbUpData interface{} `json:"thumbUpData,omitempty"` //点赞数据 |
| 528 | //我审核的-通过 | 533 | //我审核的-通过 |
| 529 | Score interface{} `json:"score,omitempty"` | 534 | Score interface{} `json:"score,omitempty"` |
| 535 | + //我审核的-待审核 | ||
| 536 | + SelfCheckResult interface{} `json:"selfCheckResult,omitempty"` //自查统计数据 | ||
| 530 | 537 | ||
| 531 | //模板 | 538 | //模板 |
| 532 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 | 539 | ChanceType interface{} `json:"chanceType,omitempty"` //机会类型 |
| @@ -580,14 +587,16 @@ type ChanceItem struct { | @@ -580,14 +587,16 @@ type ChanceItem struct { | ||
| 580 | Id int64 `json:"id"` | 587 | Id int64 `json:"id"` |
| 581 | CreateTime int64 `json:"createTime"` | 588 | CreateTime int64 `json:"createTime"` |
| 582 | //CreateTimeCopy int64 `json:"createTimeCopy"` | 589 | //CreateTimeCopy int64 `json:"createTimeCopy"` |
| 583 | - UpdateTime int64 `json:"updateTime"` | ||
| 584 | - ApproveTime int64 `json:"approveTime"` | ||
| 585 | - Provider *BaseUserInfo `json:"provider"` | ||
| 586 | - FormList []*Form `json:"formList" valid:"Required"` | ||
| 587 | - Speechs []Speech `json:"speechs"` | ||
| 588 | - Pictures []Picture `json:"pictures"` | ||
| 589 | - Videos []Video `json:"videos"` | ||
| 590 | - PublicStatus int `json:"-"` //publicStatus | 590 | + UpdateTime int64 `json:"updateTime"` |
| 591 | + ApproveTime int64 `json:"approveTime"` | ||
| 592 | + Provider *BaseUserInfo `json:"provider"` | ||
| 593 | + FormList []*Form `json:"formList" valid:"Required"` | ||
| 594 | + SelfChecks SelfChecks `json:"selfChecks"` | ||
| 595 | + Speechs []Speech `json:"speechs"` | ||
| 596 | + Pictures []Picture `json:"pictures"` | ||
| 597 | + Videos []Video `json:"videos"` | ||
| 598 | + | ||
| 599 | + PublicStatus int `json:"-"` //publicStatus | ||
| 591 | } | 600 | } |
| 592 | type ChanceData struct { | 601 | type ChanceData struct { |
| 593 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 | 602 | ThumbsUpTotal int `json:"thumbsupTotal"` //点赞总数 |
| @@ -24,6 +24,7 @@ type ChanceApproveRequest struct { | @@ -24,6 +24,7 @@ type ChanceApproveRequest struct { | ||
| 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 | ApproveData ApproveData `json:"approveData"` //审核数据 |
| 27 | + SelfChecks SelfChecks `json:"selfChecks"` | ||
| 27 | } | 28 | } |
| 28 | type ChanceApproveResponse struct { | 29 | type ChanceApproveResponse struct { |
| 29 | } | 30 | } |
| @@ -66,13 +67,13 @@ type ProcessItem struct { | @@ -66,13 +67,13 @@ type ProcessItem struct { | ||
| 66 | ApproveType int `json:"approveType"` //审批类型 1 业务区域负责人 2 指定成员 3 角色 | 67 | ApproveType int `json:"approveType"` //审批类型 1 业务区域负责人 2 指定成员 3 角色 |
| 67 | ApproveTime int64 `json:"approveTime"` //审核时间 | 68 | ApproveTime int64 `json:"approveTime"` //审核时间 |
| 68 | //Role Role `json:"role"` //角色 | 69 | //Role Role `json:"role"` //角色 |
| 69 | - Uid int64 `json:"uid"` | ||
| 70 | - Name string `json:"name"` | ||
| 71 | - RoleName string `json:"roleName"` | ||
| 72 | - Role int `json:"-"` | ||
| 73 | - ApproveData *ApproveData `json:"approveData"` //审核数据 | ||
| 74 | - //ApproveUser UserItem `json:"approveUser"` //审核人 //状态不是审核中 | ||
| 75 | - ApproveUsers []UserItem `json:"approveUsers"` //审核人员 //1 会签 2 或签 //审核中 1.部门长 2.角色 | 70 | + Uid int64 `json:"uid"` |
| 71 | + Name string `json:"name"` | ||
| 72 | + RoleName string `json:"roleName"` | ||
| 73 | + Role int `json:"-"` | ||
| 74 | + SelfChecks SelfChecks `json:"selfChecks"` | ||
| 75 | + ApproveData *ApproveData `json:"approveData"` //审核数据 | ||
| 76 | + ApproveUsers []UserItem `json:"approveUsers"` //审核人员 //1 会签 2 或签 //审核中 1.部门长 2.角色 | ||
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | //公开数据 | 79 | //公开数据 |
| 1 | package protocol | 1 | package protocol |
| 2 | 2 | ||
| 3 | -import "strings" | 3 | +import ( |
| 4 | + "bytes" | ||
| 5 | + "encoding/json" | ||
| 6 | + "fmt" | ||
| 7 | + "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | ||
| 8 | + "opp/internal/utils" | ||
| 9 | + "strings" | ||
| 10 | +) | ||
| 4 | 11 | ||
| 5 | /*机会-自查内容*/ | 12 | /*机会-自查内容*/ |
| 13 | +var CheckOptionsCommit = []CheckOption{{Item: "是", NeedOther: false}, {Item: "否", NeedOther: false}, {Item: "不清楚", NeedOther: false}} | ||
| 6 | 14 | ||
| 15 | +//var CheckOptionsApprove = []CheckOption{{Item: "是",NeedOther:false},{Item: "否",NeedOther:true},{Item: "不清楚",NeedOther:false}} | ||
| 7 | //自查结果列表 | 16 | //自查结果列表 |
| 8 | type SelfCheckResults []selfCheckResult | 17 | type SelfCheckResults []selfCheckResult |
| 9 | type selfCheckResult struct { | 18 | type selfCheckResult struct { |
| 10 | - CheckItem string `json:"checkItem"` | ||
| 11 | - Total int `json:"total"` | 19 | + Item string `json:"item"` |
| 20 | + Total int `json:"total"` | ||
| 12 | } | 21 | } |
| 13 | 22 | ||
| 14 | //自查项列表 | 23 | //自查项列表 |
| 15 | type SelfChecks []SelfCheck | 24 | type SelfChecks []SelfCheck |
| 16 | type SelfCheck struct { | 25 | type SelfCheck struct { |
| 17 | - Id int64 `json:"id"` | ||
| 18 | CheckItem string `json:"checkItem"` | 26 | CheckItem string `json:"checkItem"` |
| 27 | + GroupId int64 `json:"groupId"` //分组 | ||
| 19 | Answer string `json:"answer,omitempty"` | 28 | Answer string `json:"answer,omitempty"` |
| 20 | Reason string `json:"reason,omitempty"` | 29 | Reason string `json:"reason,omitempty"` |
| 21 | - Group int `json:"group"` //分组 | 30 | +} |
| 31 | + | ||
| 32 | +func (c SelfCheck) Key() string { | ||
| 33 | + return fmt.Sprintf("%v-%v", c.GroupId, c.CheckItem) | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +func NewSelfChecks(data string) (rsp SelfChecks) { | ||
| 37 | + if len(data) == 0 { | ||
| 38 | + return | ||
| 39 | + } | ||
| 40 | + e := json.Unmarshal([]byte(data), &rsp) | ||
| 41 | + if e != nil { | ||
| 42 | + log.Error(e) | ||
| 43 | + } | ||
| 44 | + return | ||
| 22 | } | 45 | } |
| 23 | 46 | ||
| 24 | //统计自查结果 | 47 | //统计自查结果 |
| 25 | func (s SelfChecks) Static() SelfCheckResults { | 48 | func (s SelfChecks) Static() SelfCheckResults { |
| 26 | - results := []selfCheckResult{{CheckItem: "是"}, {CheckItem: "否"}, {CheckItem: "不清楚"}} | 49 | + if len(s) == 0 { |
| 50 | + return []selfCheckResult{} | ||
| 51 | + } | ||
| 52 | + results := []selfCheckResult{{Item: "是"}, {Item: "否"}, {Item: "不清楚"}} | ||
| 27 | for i := range s { | 53 | for i := range s { |
| 28 | check := (s)[i] | 54 | check := (s)[i] |
| 29 | for k := range results { | 55 | for k := range results { |
| 30 | - if strings.EqualFold(results[k].CheckItem, check.CheckItem) { | 56 | + if strings.EqualFold(results[k].Item, check.Answer) { |
| 31 | results[k].Total = results[k].Total + 1 | 57 | results[k].Total = results[k].Total + 1 |
| 32 | break | 58 | break |
| 33 | } | 59 | } |
| @@ -35,3 +61,104 @@ func (s SelfChecks) Static() SelfCheckResults { | @@ -35,3 +61,104 @@ func (s SelfChecks) Static() SelfCheckResults { | ||
| 35 | } | 61 | } |
| 36 | return SelfCheckResults(results) | 62 | return SelfCheckResults(results) |
| 37 | } | 63 | } |
| 64 | + | ||
| 65 | +//自查校验 | ||
| 66 | +func (s SelfChecks) Valid() (err error) { | ||
| 67 | + if len(s) == 0 { | ||
| 68 | + return | ||
| 69 | + } | ||
| 70 | + for i := range s { | ||
| 71 | + c := s[i] | ||
| 72 | + if c.GroupId == 0 { | ||
| 73 | + err = NewErrWithMessage(2) | ||
| 74 | + return | ||
| 75 | + } | ||
| 76 | + if len(c.CheckItem) == 0 { | ||
| 77 | + err = NewErrWithMessage(2) | ||
| 78 | + return | ||
| 79 | + } | ||
| 80 | + if len(c.Answer) == 0 { | ||
| 81 | + err = NewCustomMessage(2, "自查项未填写") | ||
| 82 | + return | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + return | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +//自查内容 | ||
| 89 | +func (s SelfChecks) String() string { | ||
| 90 | + var buf bytes.Buffer | ||
| 91 | + for i := range s { | ||
| 92 | + c := s[i] | ||
| 93 | + if len(c.Reason) == 0 { | ||
| 94 | + buf.WriteString(fmt.Sprintf("%v:%v;\n", c.CheckItem, c.Answer)) | ||
| 95 | + } else { | ||
| 96 | + buf.WriteString(fmt.Sprintf("%v:%v,理由:%v;\n", c.CheckItem, c.Answer, c.Reason)) | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + return buf.String() | ||
| 100 | +} | ||
| 101 | +func (s SelfChecks) Compare(dst string) (rspChecks SelfChecks, err error) { | ||
| 102 | + var ( | ||
| 103 | + dstChecks SelfChecks | ||
| 104 | + mapChecks = make(map[string]SelfCheck) | ||
| 105 | + ) | ||
| 106 | + rspChecks = make([]SelfCheck, 0) | ||
| 107 | + if len(s) == 0 { | ||
| 108 | + return | ||
| 109 | + } | ||
| 110 | + utils.JsonUnmarshal(dst, &dstChecks) | ||
| 111 | + if len(s) != len(dstChecks) { | ||
| 112 | + err = NewCustomMessage(1, "自查项有误") | ||
| 113 | + log.Error(err, s, dstChecks) | ||
| 114 | + return | ||
| 115 | + } | ||
| 116 | + for i := range dstChecks { | ||
| 117 | + c := dstChecks[i] | ||
| 118 | + mapChecks[c.Key()] = c | ||
| 119 | + } | ||
| 120 | + for i := range s { | ||
| 121 | + c := s[i] | ||
| 122 | + if v, ok := mapChecks[c.Key()]; ok { | ||
| 123 | + //回答不一直 | ||
| 124 | + if !strings.EqualFold(c.Answer, v.Answer) { | ||
| 125 | + rspChecks = append(rspChecks, c) | ||
| 126 | + continue | ||
| 127 | + } | ||
| 128 | + if len(c.Reason) > 0 { | ||
| 129 | + rspChecks = append(rspChecks, c) | ||
| 130 | + continue | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + return | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +//自查问题 | ||
| 138 | +type CheckQuestion struct { | ||
| 139 | + CheckItem string `json:"checkItem"` | ||
| 140 | + Title string `json:"title"` | ||
| 141 | + GroupId int64 `json:"groupId"` | ||
| 142 | + CheckOptions []CheckOption `json:"options"` | ||
| 143 | +} | ||
| 144 | +type CheckOption struct { | ||
| 145 | + Item string `json:"item"` | ||
| 146 | + NeedOther bool `json:"needOther"` //是否需填写其他的内容【1:需要】【2:不需要】 | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +func NewCheckQuestion(checkItem, title string, groupId int64, ops []CheckOption) *CheckQuestion { | ||
| 150 | + return &CheckQuestion{ | ||
| 151 | + CheckItem: checkItem, | ||
| 152 | + Title: title, | ||
| 153 | + GroupId: groupId, | ||
| 154 | + CheckOptions: ops, | ||
| 155 | + } | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | +/*CheckQuestions 自查问题列表*/ | ||
| 159 | +type CheckQuestionsRequest struct { | ||
| 160 | + ChanceId int64 `json:"chanceId" valid:"Required"` | ||
| 161 | +} | ||
| 162 | +type CheckQuestionsResponse struct { | ||
| 163 | + Questions []*CheckQuestion `json:"questions"` | ||
| 164 | +} |
| @@ -61,9 +61,9 @@ func init() { | @@ -61,9 +61,9 @@ func init() { | ||
| 61 | var ApproveLog = map[int]string{ | 61 | var ApproveLog = map[int]string{ |
| 62 | 1: "提交了机会", //提交人提交机会 | 62 | 1: "提交了机会", //提交人提交机会 |
| 63 | 2: "删除了机会", //提交人删除机会 | 63 | 2: "删除了机会", //提交人删除机会 |
| 64 | - 3: "退回了机会", //审批人退回机会 | ||
| 65 | - 4: "通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:公司公开", //审批人通过机会(公司公开) | ||
| 66 | - 5: "通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:%v", //审批人通过机会(部门公开) 测试部、销售部 | 64 | + 3: "退回了机会;\n%v", //审批人退回机会 |
| 65 | + 4: "通过了机会;\n%v\n基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:公司公开", //审批人通过机会(公司公开) | ||
| 66 | + 5: "通过了机会;\n%v\n基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:%v", //审批人通过机会(部门公开) 测试部、销售部 | ||
| 67 | 6: "系统 自动通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:公司公开", //审批人通过了机会(系统自动通过) | 67 | 6: "系统 自动通过了机会;基础评分:%v分,附加评分:%v分,价值评分:%v分,公开状态:公司公开", //审批人通过了机会(系统自动通过) |
| 68 | 7: "修改了公开状态:公司公开", //审批通过后修改公开状态(公司公开) | 68 | 7: "修改了公开状态:公司公开", //审批通过后修改公开状态(公司公开) |
| 69 | 8: "修改了公开状态:%v", //审批通过后修改公开状态(部门公开) | 69 | 8: "修改了公开状态:%v", //审批通过后修改公开状态(部门公开) |
| 1 | package agg | 1 | package agg |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "encoding/json" | ||
| 4 | "fmt" | 5 | "fmt" |
| 6 | + "github.com/astaxie/beego/orm" | ||
| 5 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" | 7 | "gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log" |
| 6 | "opp/internal/utils" | 8 | "opp/internal/utils" |
| 7 | "opp/models" | 9 | "opp/models" |
| @@ -233,3 +235,79 @@ func SetMsgItem(header *protocol.RequestHeader, msg protocol.MsgItemOrm, commIte | @@ -233,3 +235,79 @@ func SetMsgItem(header *protocol.RequestHeader, msg protocol.MsgItemOrm, commIte | ||
| 233 | commItem.SourceId = msg.SourceId | 235 | commItem.SourceId = msg.SourceId |
| 234 | commItem.SourceType = msg.SourceType | 236 | commItem.SourceType = msg.SourceType |
| 235 | } | 237 | } |
| 238 | + | ||
| 239 | +//获取自查问题列表 通过模板 | ||
| 240 | +func GetCheckQuestionsByTemplateId(id int64) (rsp []*protocol.CheckQuestion, err error) { | ||
| 241 | + var ( | ||
| 242 | + checks []*models.AuditCheck | ||
| 243 | + ) | ||
| 244 | + rsp = make([]*protocol.CheckQuestion, 0) | ||
| 245 | + if checks, err = models.GetAuditCheckBy(id); err != nil { | ||
| 246 | + log.Error(err) | ||
| 247 | + return | ||
| 248 | + } | ||
| 249 | + if len(checks) == 0 { | ||
| 250 | + return | ||
| 251 | + } | ||
| 252 | + var tmpGroupId int64 | ||
| 253 | + var idx int = 0 | ||
| 254 | + var groupIdx = 0 | ||
| 255 | + for i := range checks { | ||
| 256 | + c := checks[i] | ||
| 257 | + | ||
| 258 | + if tmpGroupId != c.Pid { | ||
| 259 | + groupIdx++ | ||
| 260 | + idx = 0 | ||
| 261 | + } | ||
| 262 | + tmpGroupId = c.Pid | ||
| 263 | + item := protocol.NewCheckQuestion(c.Title, getQuestionTitle(groupIdx, idx, c.Title), c.Pid, protocol.CheckOptionsCommit) | ||
| 264 | + rsp = append(rsp, item) | ||
| 265 | + idx++ | ||
| 266 | + } | ||
| 267 | + return | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | +//获取自查问题列表 通过机会(历史模板) | ||
| 271 | +func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err error) { | ||
| 272 | + var ( | ||
| 273 | + chance *models.Chance | ||
| 274 | + selfChecks protocol.SelfChecks | ||
| 275 | + ) | ||
| 276 | + rsp = make([]*protocol.CheckQuestion, 0) | ||
| 277 | + if err = utils.ExecuteQueryOne(&chance, models.SqlGetChanceSelfChecks, id); err != nil { | ||
| 278 | + if err == orm.ErrNoRows { | ||
| 279 | + err = nil | ||
| 280 | + return | ||
| 281 | + } | ||
| 282 | + log.Error(err) | ||
| 283 | + return | ||
| 284 | + } | ||
| 285 | + if len(chance.SelfChecks) == 0 { | ||
| 286 | + return | ||
| 287 | + } | ||
| 288 | + if e := json.Unmarshal([]byte(chance.SelfChecks), &selfChecks); e != nil { | ||
| 289 | + log.Error(e) | ||
| 290 | + return | ||
| 291 | + } | ||
| 292 | + var tmpGroupId int64 | ||
| 293 | + var idx int = 0 | ||
| 294 | + var groupIdx = 0 | ||
| 295 | + for i := range selfChecks { | ||
| 296 | + c := selfChecks[i] | ||
| 297 | + if tmpGroupId != c.GroupId { | ||
| 298 | + groupIdx++ | ||
| 299 | + idx = 0 | ||
| 300 | + } | ||
| 301 | + item := protocol.NewCheckQuestion(c.CheckItem, getQuestionTitle(groupIdx, idx, c.CheckItem), c.GroupId, protocol.CheckOptionsCommit) | ||
| 302 | + rsp = append(rsp, item) | ||
| 303 | + idx++ | ||
| 304 | + } | ||
| 305 | + return | ||
| 306 | +} | ||
| 307 | + | ||
| 308 | +func getQuestionTitle(groupIdx int, idx int, title string) string { | ||
| 309 | + if idx == 0 { | ||
| 310 | + return fmt.Sprintf("%v、%v?", groupIdx, title) | ||
| 311 | + } | ||
| 312 | + return fmt.Sprintf("%v.%v、%v?", groupIdx, idx, title) | ||
| 313 | +} |
| @@ -276,6 +276,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -276,6 +276,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 276 | mapProcess = make(map[string]interface{}) | 276 | mapProcess = make(map[string]interface{}) |
| 277 | mapChance = make(map[string]interface{}) | 277 | mapChance = make(map[string]interface{}) |
| 278 | result *protocol.ChanceCalculateScoreResponse | 278 | result *protocol.ChanceCalculateScoreResponse |
| 279 | + difChecks protocol.SelfChecks | ||
| 279 | ) | 280 | ) |
| 280 | rsp = &protocol.ChanceApproveResponse{} | 281 | rsp = &protocol.ChanceApproveResponse{} |
| 281 | //TODO:测试注入 | 282 | //TODO:测试注入 |
| @@ -308,6 +309,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -308,6 +309,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 308 | err = protocol.NewErrWithMessage(5202) | 309 | err = protocol.NewErrWithMessage(5202) |
| 309 | return | 310 | return |
| 310 | } | 311 | } |
| 312 | + difChecks, _ = request.SelfChecks.Compare(chance.SelfChecks) | ||
| 311 | { | 313 | { |
| 312 | if request.ReviewStatus == protocol.ReviewStatusPass { | 314 | if request.ReviewStatus == protocol.ReviewStatusPass { |
| 313 | //计算发现分 | 315 | //计算发现分 |
| @@ -325,6 +327,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -325,6 +327,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 325 | mapProcess["ApproveTime"] = time.Now() | 327 | mapProcess["ApproveTime"] = time.Now() |
| 326 | mapProcess["IsActive"] = int8(0) | 328 | mapProcess["IsActive"] = int8(0) |
| 327 | mapProcess["UpdateAt"] = time.Now() | 329 | mapProcess["UpdateAt"] = time.Now() |
| 330 | + mapProcess["SelfChecks"] = common.AssertJson(difChecks) | ||
| 328 | 331 | ||
| 329 | mapChance["ApproveTime"] = time.Now() | 332 | mapChance["ApproveTime"] = time.Now() |
| 330 | mapChance["BasicScore"] = request.ApproveData.Score.BasicScore | 333 | mapChance["BasicScore"] = request.ApproveData.Score.BasicScore |
| @@ -341,13 +344,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -341,13 +344,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 341 | mapProcess["DiscoveryScore"] = request.ApproveData.Score.DiscoveryScore | 344 | mapProcess["DiscoveryScore"] = request.ApproveData.Score.DiscoveryScore |
| 342 | mapProcess["ApproveData"] = common.AssertJson(request.ApproveData) | 345 | mapProcess["ApproveData"] = common.AssertJson(request.ApproveData) |
| 343 | mapProcess["EnableStatus"] = int8(1) | 346 | mapProcess["EnableStatus"] = int8(1) |
| 344 | - | ||
| 345 | - //mapChance["BasicScore"] = request.ApproveData.Score.BasicScore | ||
| 346 | - //mapChance["ExtraScore"] = request.ApproveData.Score.ExtraScore | ||
| 347 | - //mapChance["ValueScore"] = request.ApproveData.Score.ValueScore | ||
| 348 | - //mapChance["DiscoveryScore"] = request.ApproveData.Score.DiscoveryScore | ||
| 349 | - //mapChance["ApproveData"] = common.AssertJson(request.ApproveData) | ||
| 350 | - //mapChance["PublishStatus"] = request.ApproveData.PublicData.PublishStatus | 347 | + mapChance["SelfChecks"] = common.AssertJson(request.SelfChecks) |
| 351 | } | 348 | } |
| 352 | } | 349 | } |
| 353 | log.Info(fmt.Sprintf("用户:%v 提交审核 机会编号:%v 审批流编号:%v 审批状态:%v", header.UserId, chance.Id, process.Id, request.ReviewStatus)) | 350 | log.Info(fmt.Sprintf("用户:%v 提交审核 机会编号:%v 审批流编号:%v 审批状态:%v", header.UserId, chance.Id, process.Id, request.ReviewStatus)) |
| @@ -384,16 +381,6 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -384,16 +381,6 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 384 | { | 381 | { |
| 385 | mapChance["ReviewStatus"] = int8(request.ReviewStatus) | 382 | mapChance["ReviewStatus"] = int8(request.ReviewStatus) |
| 386 | } | 383 | } |
| 387 | - //发送审核结果消息给提交人 | ||
| 388 | - //for i := range approveItemResponse.MessageData.ApplyUserMessage { | ||
| 389 | - // message := approveItemResponse.MessageData.ApplyUserMessage[i] | ||
| 390 | - // nextApprovers = append(nextApprovers, message.ReceiverInfo.ReceiverUid) | ||
| 391 | - // if err = agg.SendApprovedMsg(message.ReceiverInfo.ReceiverUid, message.ReceiverInfo.ReceiverName, | ||
| 392 | - // header.CompanyId, chance.Id, chance.ChanceTypeId, request.ReviewStatus, protocol.MsgTypeAuditBy); err != nil { | ||
| 393 | - // log.Error(err) | ||
| 394 | - // return | ||
| 395 | - // } | ||
| 396 | - //} | ||
| 397 | } else { | 384 | } else { |
| 398 | //发送下一个消息给下一流程的审核人 | 385 | //发送下一个消息给下一流程的审核人 |
| 399 | for i := range approveItemResponse.MessageData.ApproveMessage { | 386 | for i := range approveItemResponse.MessageData.ApproveMessage { |
| @@ -423,7 +410,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | @@ -423,7 +410,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro | ||
| 423 | } | 410 | } |
| 424 | } | 411 | } |
| 425 | } | 412 | } |
| 426 | - if err = saveApproveMsgByApproveData(header, orm, request.ReviewStatus, chance, request.ApproveData); err != nil { | 413 | + if err = saveApproveMsgByApproveData(header, orm, request.ReviewStatus, chance, request.ApproveData, difChecks); err != nil { |
| 427 | orm.Rollback() | 414 | orm.Rollback() |
| 428 | log.Error("发送审核日志失败", err) | 415 | log.Error("发送审核日志失败", err) |
| 429 | return | 416 | return |
| @@ -486,7 +473,7 @@ func ProcessIntegrate(header *protocol.RequestHeader, request *ProcessIntegrateR | @@ -486,7 +473,7 @@ func ProcessIntegrate(header *protocol.RequestHeader, request *ProcessIntegrateR | ||
| 486 | } | 473 | } |
| 487 | 474 | ||
| 488 | //发送审核日志 | 475 | //发送审核日志 |
| 489 | -func saveApproveMsgByApproveData(header *protocol.RequestHeader, orm orm.Ormer, reviewStatus int, chance *models.Chance, approveData protocol.ApproveData) (err error) { | 476 | +func saveApproveMsgByApproveData(header *protocol.RequestHeader, orm orm.Ormer, reviewStatus int, chance *models.Chance, approveData protocol.ApproveData, selfChecks protocol.SelfChecks) (err error) { |
| 490 | var ( | 477 | var ( |
| 491 | parames = make([]interface{}, 0) | 478 | parames = make([]interface{}, 0) |
| 492 | code = 0 | 479 | code = 0 |
| @@ -494,11 +481,12 @@ func saveApproveMsgByApproveData(header *protocol.RequestHeader, orm orm.Ormer, | @@ -494,11 +481,12 @@ func saveApproveMsgByApproveData(header *protocol.RequestHeader, orm orm.Ormer, | ||
| 494 | if reviewStatus == protocol.ReviewStatusReturn { | 481 | if reviewStatus == protocol.ReviewStatusReturn { |
| 495 | //发送退回日志 | 482 | //发送退回日志 |
| 496 | code = 3 | 483 | code = 3 |
| 484 | + parames = append(parames, selfChecks.String()) | ||
| 497 | } | 485 | } |
| 498 | if reviewStatus == protocol.ReviewStatusPass { | 486 | if reviewStatus == protocol.ReviewStatusPass { |
| 499 | //发送通过日志 | 487 | //发送通过日志 |
| 500 | score := approveData.Score | 488 | score := approveData.Score |
| 501 | - parames = append(parames, []interface{}{score.BasicScore, score.ExtraScore, score.ValueScore}...) | 489 | + parames = append(parames, []interface{}{selfChecks.String(), score.BasicScore, score.ExtraScore, score.ValueScore}...) |
| 502 | if approveData.PublicData.PublishStatus == protocol.PublicToCompany { | 490 | if approveData.PublicData.PublishStatus == protocol.PublicToCompany { |
| 503 | code = 4 | 491 | code = 4 |
| 504 | } | 492 | } |
| @@ -561,6 +549,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | @@ -561,6 +549,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance) | ||
| 561 | Uid: process.Uid, | 549 | Uid: process.Uid, |
| 562 | Name: process.UserName, | 550 | Name: process.UserName, |
| 563 | } | 551 | } |
| 552 | + utils.JsonUnmarshal(process.SelfChecks, &item.SelfChecks) | ||
| 564 | if item.ApproveType == protocol.AuditBySpecailUser { | 553 | if item.ApproveType == protocol.AuditBySpecailUser { |
| 565 | item.ApproveType = protocol.AuditByUser | 554 | item.ApproveType = protocol.AuditByUser |
| 566 | } | 555 | } |
| @@ -292,6 +292,10 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) | @@ -292,6 +292,10 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) | ||
| 292 | if len(item.Example) > 0 { | 292 | if len(item.Example) > 0 { |
| 293 | template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id) | 293 | template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id) |
| 294 | } | 294 | } |
| 295 | + if template.Question, err = agg.GetCheckQuestionsByTemplateId(templates.Id); err != nil { | ||
| 296 | + log.Error(err) | ||
| 297 | + return | ||
| 298 | + } | ||
| 295 | for j := range forms { | 299 | for j := range forms { |
| 296 | form := forms[j] | 300 | form := forms[j] |
| 297 | template.FormList[j] = &protocol.Form{ | 301 | template.FormList[j] = &protocol.Form{ |
| @@ -395,6 +399,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -395,6 +399,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
| 395 | DepartmentId: request.RelatedDepartment, | 399 | DepartmentId: request.RelatedDepartment, |
| 396 | Code: fmt.Sprintf("%v%v", chanceType.Code, template.Code), | 400 | Code: fmt.Sprintf("%v%v", chanceType.Code, template.Code), |
| 397 | Status: models.ChanceStatusOpen, | 401 | Status: models.ChanceStatusOpen, |
| 402 | + SelfChecks: common.AssertJson(request.SelfChecks), | ||
| 398 | } | 403 | } |
| 399 | //生成提交记录 | 404 | //生成提交记录 |
| 400 | if _, err = orm.Insert(GenAuditFlowProcess_Submit(header.UserId, chance.Id, template.Id, protocol.ReviewStatusSubmit)); err != nil { | 405 | if _, err = orm.Insert(GenAuditFlowProcess_Submit(header.UserId, chance.Id, template.Id, protocol.ReviewStatusSubmit)); err != nil { |
| @@ -591,13 +596,13 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -591,13 +596,13 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
| 591 | //6.更新文件 | 596 | //6.更新文件 |
| 592 | { | 597 | { |
| 593 | if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { | 598 | if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { |
| 594 | - | ||
| 595 | - if err = utils.UpdateTableByMapWithOrmer(orm, chanceData, map[string]interface{}{ | 599 | + chanceDataMap := map[string]interface{}{ |
| 596 | "Speechs": common.AssertJson(request.Speechs), | 600 | "Speechs": common.AssertJson(request.Speechs), |
| 597 | "Images": common.AssertJson(request.Pictures), | 601 | "Images": common.AssertJson(request.Pictures), |
| 598 | "Videos": common.AssertJson(request.Videos), | 602 | "Videos": common.AssertJson(request.Videos), |
| 599 | "UpdateAt": time.Now(), | 603 | "UpdateAt": time.Now(), |
| 600 | - }); err != nil { | 604 | + } |
| 605 | + if err = utils.UpdateTableByMapWithOrmer(orm, chanceData, chanceDataMap); err != nil { | ||
| 601 | log.Error(err) | 606 | log.Error(err) |
| 602 | orm.Rollback() | 607 | orm.Rollback() |
| 603 | return | 608 | return |
| @@ -700,6 +705,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -700,6 +705,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
| 700 | //机会发布 并且当前机会不是已经通过的,机会状态审核中(存在更新时自动通过) | 705 | //机会发布 并且当前机会不是已经通过的,机会状态审核中(存在更新时自动通过) |
| 701 | if request.IsPublish && chance.ReviewStatus != protocol.ReviewStatusPass { | 706 | if request.IsPublish && chance.ReviewStatus != protocol.ReviewStatusPass { |
| 702 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) | 707 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) |
| 708 | + updateMap["SelfChecks"] = common.AssertJson(request.SelfChecks) | ||
| 703 | } | 709 | } |
| 704 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) | 710 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) |
| 705 | updateMap["Content"] = request.Content | 711 | updateMap["Content"] = request.Content |
| @@ -1655,7 +1661,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -1655,7 +1661,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 1655 | commItem.ChanceStatus = protocol.ChanceStatusDelete | 1661 | commItem.ChanceStatus = protocol.ChanceStatusDelete |
| 1656 | log.Error(chance.ChanceUserId, header.CompanyId, err) | 1662 | log.Error(chance.ChanceUserId, header.CompanyId, err) |
| 1657 | err = nil | 1663 | err = nil |
| 1658 | - //return | ||
| 1659 | } else { | 1664 | } else { |
| 1660 | item := protocol.ChanceItem{ | 1665 | item := protocol.ChanceItem{ |
| 1661 | Id: chance.ChanceId, | 1666 | Id: chance.ChanceId, |
| @@ -1663,8 +1668,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -1663,8 +1668,6 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 1663 | CreateTime: chance.CreateTime.Unix() * 1000, | 1668 | CreateTime: chance.CreateTime.Unix() * 1000, |
| 1664 | UpdateTime: chance.UpdateTime.Unix() * 1000, | 1669 | UpdateTime: chance.UpdateTime.Unix() * 1000, |
| 1665 | ApproveTime: chance.ChanceApproveTime.Unix() * 1000, | 1670 | ApproveTime: chance.ChanceApproveTime.Unix() * 1000, |
| 1666 | - //CreateTime:chance.c | ||
| 1667 | - //CreateTime: chance.CreateTime.Unix() * 1000, | ||
| 1668 | } | 1671 | } |
| 1669 | if item.ApproveTime < 0 { | 1672 | if item.ApproveTime < 0 { |
| 1670 | item.ApproveTime = chance.UpdateTime.Unix() * 1000 | 1673 | item.ApproveTime = chance.UpdateTime.Unix() * 1000 |
| @@ -1678,8 +1681,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -1678,8 +1681,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 1678 | } | 1681 | } |
| 1679 | } | 1682 | } |
| 1680 | approve := protocol.Approve{ | 1683 | approve := protocol.Approve{ |
| 1681 | - ProcessId: chance.Id, | ||
| 1682 | - //Provider:provider, | 1684 | + ProcessId: chance.Id, |
| 1683 | CreateTime: chance.ProcessCreateTime.Unix() * 1000, | 1685 | CreateTime: chance.ProcessCreateTime.Unix() * 1000, |
| 1684 | } | 1686 | } |
| 1685 | //审核过的才有审核时间 | 1687 | //审核过的才有审核时间 |
| @@ -1701,6 +1703,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | @@ -1701,6 +1703,7 @@ func MyApproveChance(header *protocol.RequestHeader, request *protocol.MyApprove | ||
| 1701 | commItem.Score = approveData.Score | 1703 | commItem.Score = approveData.Score |
| 1702 | } | 1704 | } |
| 1703 | } | 1705 | } |
| 1706 | + commItem.SelfCheckResult = protocol.NewSelfChecks(chance.SelfChecks).Static() | ||
| 1704 | rsp.List = append(rsp.List, commItem) | 1707 | rsp.List = append(rsp.List, commItem) |
| 1705 | } | 1708 | } |
| 1706 | return | 1709 | return |
| @@ -2084,6 +2087,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | @@ -2084,6 +2087,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail | ||
| 2084 | UpdateTime: chance.UpdateAt.Unix() * 1000, | 2087 | UpdateTime: chance.UpdateAt.Unix() * 1000, |
| 2085 | } | 2088 | } |
| 2086 | jsonUnmarshal(chance.SourceContent, &item.FormList) | 2089 | jsonUnmarshal(chance.SourceContent, &item.FormList) |
| 2090 | + jsonUnmarshal(chance.SelfChecks, &item.SelfChecks) | ||
| 2087 | item.FormList = clearEmptyForm(item.FormList) | 2091 | item.FormList = clearEmptyForm(item.FormList) |
| 2088 | 2092 | ||
| 2089 | if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { | 2093 | if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { |
| @@ -2324,3 +2328,14 @@ func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.Chance | @@ -2324,3 +2328,14 @@ func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.Chance | ||
| 2324 | rsp.ChanceId = detail.ChanceId | 2328 | rsp.ChanceId = detail.ChanceId |
| 2325 | return | 2329 | return |
| 2326 | } | 2330 | } |
| 2331 | + | ||
| 2332 | +//自查问题列表 | ||
| 2333 | +func CheckQuestions(header *protocol.RequestHeader, request *protocol.CheckQuestionsRequest) (rsp *protocol.CheckQuestionsResponse, err error) { | ||
| 2334 | + var () | ||
| 2335 | + rsp = &protocol.CheckQuestionsResponse{} | ||
| 2336 | + rsp.Questions, err = agg.GetCheckQuestionsByChanceId(request.ChanceId) | ||
| 2337 | + if err != nil { | ||
| 2338 | + log.Error(err) | ||
| 2339 | + } | ||
| 2340 | + return | ||
| 2341 | +} |
-
请 注册 或 登录 后发表评论