作者 yangfu

Merge remote-tracking branch 'origin/dev' into test

... ... @@ -4,6 +4,7 @@ import (
"encoding/json"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
"opp/controllers"
"opp/internal/utils"
"opp/protocol"
"opp/services/chance"
)
... ... @@ -352,6 +353,20 @@ func (this *ChanceController) ChanceApprove() {
msg = m
return
}
if request.ReviewStatus == protocol.ReviewStatusPass {
if utils.IsNil(request.ApproveData) {
msg = protocol.BadRequestParam(5204)
return
}
if utils.IsNil(request.ApproveData.PublicData) {
msg = protocol.BadRequestParam(5204)
return
}
if utils.IsNil(request.ApproveData.PublicData) {
msg = protocol.BadRequestParam(5204)
return
}
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(chance.ChanceApprove(header, request))
}
... ...
... ... @@ -18,6 +18,7 @@ type AuditFlowProcess struct {
BasicSorce float64 `orm:"column(basic_sorce);null;digits(4);decimals(1)" description:"基础评分"`
ExtraSorce float64 `orm:"column(extra_sorce);null;digits(4);decimals(1)" description:"附加评分"`
ValueSorce float64 `orm:"column(value_sorce);null;digits(4);decimals(1)" description:"价值评分"`
DiscoverySorce float64 `orm:"column(discovery_sorce);null;digits(4);decimals(1)" description:"发现得分(发现得分=基础评分*系数 + 附加评分*系数 + 价值评分*系数)"`
ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:审核中 1:被退回 2:已通过 3.自动通过 "`
AuditFlowType int `orm:"column(audit_flow_type)" description:"审核流类型 1.部门长 2.指定成员 3.指定角色 4.特殊审核人"`
FlowType int `orm:"column(flow_type)" description:"审批类型 1:正常审核 2:特殊审核"`
... ... @@ -25,6 +26,7 @@ type AuditFlowProcess struct {
CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`
EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 (被驳回以后,未完成的审核置为无效)"`
ApproveData string `orm:"column(approve_data);size(500)" description:"审核数据 json{公开状态 公开对象 分数}"`
UserName string `orm:"column(user_name);size(50)" description:"用户名-冗余"`
RoleName string `orm:"column(role_name);size(50)" description:"角色名-冗余"`
RoleId int `orm:"column(role_id);size(50)" description:"角色id-冗余"`
... ...
... ... @@ -23,6 +23,7 @@ type ChanceApproveRequest struct {
ProcessId int64 `json:"processId"` //审批流程编号
ReviewStatus int `json:"reviewStatus"` //protocol.ReviewStatus
//Suggestion string `json:"suggestion"` //原因/建议
ApproveData ApproveData `json:"approveData"` //审核数据
}
type ChanceApproveResponse struct {
}
... ... @@ -67,13 +68,13 @@ type Role struct {
//审核数据 审核通过
type ApproveData struct {
PublicData *PublicData `json:"publicData"` // 公开数据
Score *Score `json:"score"`
PublicData PublicData `json:"publicData"` // 公开数据
Score Score `json:"score"`
}
//公开数据
type PublicData struct {
PublishStatus int `json:"publishStatus"`
PublishStatus int `json:"publishStatus"` //公开状态 0未公开、1部门公开、2公司公开
VisibleObjects []*VisibleObject `json:"visibleObject"`
}
... ... @@ -86,10 +87,10 @@ type VisibleObject struct {
//评分
type Score struct {
BasicScore int `json:"basicScore"` //基础评分
ExtraScore int `json:"extraScore"` //额外分
ValueScore int `json:"valueScore"` //价值分
DiscoveryScore int `json:"-"` //发现分
BasicScore float32 `json:"basicScore"` //基础评分
ExtraScore float32 `json:"extraScore"` //额外分
ValueScore float32 `json:"valueScore"` //价值分
DiscoveryScore float32 `json:"discoveryScore"` //发现分
}
//审核操作权限
... ...
... ... @@ -39,6 +39,7 @@ var errmessge ErrorMap = map[int]string{
5201: "该机会模板未配置审批人,请选择其他模板",
5202: "该机会已被审批",
5203: "审批服务器操作失败",
5204: "评分或者公开状态不能为空",
//模板相关
5301: "机会模板不存在",
... ...
package protocol
import (
"fmt"
"github.com/astaxie/beego"
)
//短信类型
const (
SmsCode = "sms_code"
... ... @@ -15,3 +20,15 @@ type SmsInfo struct {
CreateTime int64 `json:"create_time"`
Checked int `json:"checked"` //0:未校验证 1:已校验
}
//redis键值
func RedisKey(businessKey string) string {
//项目:环境:业务码
return fmt.Sprintf("%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey)
}
//redis键值 项标识
func RedisKeyWithId(businessKey string, id int64) string {
//项目:环境:业务码
return fmt.Sprintf("%v:%v:%v:%v", "opp", beego.BConfig.RunMode, businessKey, id)
}
... ...
... ... @@ -272,7 +272,10 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro
suplusApprove SuplusApprove
approveType int
approveItemResponse ApproveItemResponse
mapProcess map[string]interface{}
mapChance map[string]interface{}
)
rsp = &protocol.ChanceApproveResponse{}
//TODO:测试注入
if request.Uid != 0 {
header.UserId = request.Uid
... ... @@ -304,9 +307,29 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro
err = protocol.NewErrWithMessage(5203)
return
}
if err = utils.UpdateTableByMap(process, map[string]interface{}{
"ReviewStatus": int8(request.ReviewStatus), "ApproveTime": time.Now()}); err != nil {
log.Error("更新机会审核状态失败 process_id:", process.Id, err)
{
mapProcess["ReviewStatus"] = int8(request.ReviewStatus)
mapProcess["ApproveTime"] = time.Now()
if request.ReviewStatus == protocol.ReviewStatusPass {
mapProcess["BasicSorce"] = request.ApproveData.Score.BasicScore
mapProcess["ExtraSorce"] = request.ApproveData.Score.ExtraScore
mapProcess["ValueSorce"] = request.ApproveData.Score.ValueScore
mapProcess["DiscoverySorce"] = request.ApproveData.Score.DiscoveryScore
mapProcess["ApproveData"] = common.AssertJson(request.ApproveData)
mapChance["BasicSorce"] = request.ApproveData.Score.BasicScore
mapChance["ExtraSorce"] = request.ApproveData.Score.ExtraScore
mapChance["ValueSorce"] = request.ApproveData.Score.ValueScore
mapChance["DiscoverySorce"] = request.ApproveData.Score.DiscoveryScore
mapChance["ApproveData"] = common.AssertJson(request.ApproveData)
mapChance["PublishStatus"] = request.ApproveData.PublicData.PublishStatus
}
}
orm := orm.NewOrm()
orm.Begin()
if err = utils.UpdateTableByMapWithOrmer(orm, process, mapProcess); err != nil {
log.Error("更新机会审核流程 状态失败 process_id:", process.Id, err)
orm.Rollback()
return
}
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
var nextApprovers []int64
if approveItemResponse.IsOver == 1 {
//结束审批
if err = utils.UpdateTableByMap(chance, map[string]interface{}{
"ReviewStatus": int8(request.ReviewStatus), "AuditLevel": chance.AuditLevel}); err != nil {
log.Error("更新机会审核状态失败 chance_id:", chance.Id, err)
return
{
mapChance["ReviewStatus"] = int8(request.ReviewStatus)
}
//发送审核结果消息给提交人
for i := range approveItemResponse.MessageData.ApplyUserMessage {
... ... @@ -361,7 +382,13 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro
}
}
}
rsp = &protocol.ChanceApproveResponse{}
if err = utils.UpdateTableByMapWithOrmer(orm, chance, mapChance); err != nil {
orm.Rollback()
log.Error("更新机会审核状态失败 chance_id:", chance.Id, err)
return
}
orm.Commit()
return
}
... ... @@ -460,6 +487,10 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance)
rsp.ApproveProcess = append(rsp.ApproveProcess, item)
continue
}
if p.ReviewStatus == protocol.ReviewStatusPass {
rsp.ApproveProcess = append(rsp.ApproveProcess, item)
continue
}
//当前再审核的列表
if p.Level == chance.AuditLevel && item.ReviewStatus == protocol.ReviewStatusAuditging {
item = newProcessItem(p)
... ...
... ... @@ -105,7 +105,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen
Title: bulletin.Title,
Control: int(bulletin.AllowClose),
//link:'https://web-open.fjmaimaimai.com/#/ability/announcement?id='+announcementCfgData[i].id+'&uid='+param.uid
Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v&oppo", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId),
Link: fmt.Sprintf("%v#/ability/announcement?id=%v&uid=%v&oppo=", beego.AppConfig.String("h5_host"), bulletin.Id, msg.ReceiveUserId),
}
item.Cover = protocol.Cover{
Path: bulletin.Cover,
... ...