修改 机会审核(编码)
增加 草稿箱列表/删除/添加草稿 增加 储备类型列表
正在显示
7 个修改的文件
包含
188 行增加
和
31 行删除
@@ -206,26 +206,26 @@ func (this *ChanceController) ChanceType() { | @@ -206,26 +206,26 @@ func (this *ChanceController) ChanceType() { | ||
206 | msg = protocol.NewReturnResponse(chance.ChanceType(header, request)) | 206 | msg = protocol.NewReturnResponse(chance.ChanceType(header, request)) |
207 | } | 207 | } |
208 | 208 | ||
209 | -//Permission 机会权限 | ||
210 | -//@router /permission [post] | ||
211 | -//func (this *ChanceController) Permission() { | ||
212 | -// var msg *protocol.ResponseMessage | ||
213 | -// defer func() { | ||
214 | -// this.Resp(msg) | ||
215 | -// }()// | ||
216 | -// var request *protocol.ChancePermissionRequest | ||
217 | -// if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
218 | -// log.Error(err) | ||
219 | -// msg = protocol.BadRequestParam(1) | ||
220 | -// return | ||
221 | -// } | ||
222 | -// if b, m := this.Valid(request); !b { | ||
223 | -// msg = m | ||
224 | -// return | ||
225 | -// } | ||
226 | -// header := controllers.GetRequestHeader(this.Ctx) | ||
227 | -// msg = protocol.NewReturnResponse(chance.ChancePermission(header, request)) | ||
228 | -//} | 209 | +//ChanceReserveType 机会储备类型 |
210 | +//@router /chanceReserveType [post] | ||
211 | +func (this *ChanceController) ChanceReserveType() { | ||
212 | + var msg *protocol.ResponseMessage | ||
213 | + defer func() { | ||
214 | + this.Resp(msg) | ||
215 | + }() | ||
216 | + var request *protocol.ChanceReserveTypeRequest | ||
217 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
218 | + log.Error(err) | ||
219 | + msg = protocol.BadRequestParam(1) | ||
220 | + return | ||
221 | + } | ||
222 | + if b, m := this.Valid(request); !b { | ||
223 | + msg = m | ||
224 | + return | ||
225 | + } | ||
226 | + header := controllers.GetRequestHeader(this.Ctx) | ||
227 | + msg = protocol.NewReturnResponse(chance.ChanceReserveType(header, request)) | ||
228 | +} | ||
229 | 229 | ||
230 | //Templates | 230 | //Templates |
231 | //@router /templates [post] | 231 | //@router /templates [post] |
@@ -643,6 +643,28 @@ func (this *ChanceController) ChancePool() { | @@ -643,6 +643,28 @@ func (this *ChanceController) ChancePool() { | ||
643 | msg = protocol.NewReturnResponse(chance.ChancePool(header, request)) | 643 | msg = protocol.NewReturnResponse(chance.ChancePool(header, request)) |
644 | } | 644 | } |
645 | 645 | ||
646 | +//ChanceReservePool 储备池 | ||
647 | +//@router /chanceReservePool [post] | ||
648 | +func (this *ChanceController) ChanceReservePool() { | ||
649 | + var msg *protocol.ResponseMessage | ||
650 | + defer func() { | ||
651 | + this.Resp(msg) | ||
652 | + }() | ||
653 | + var request *protocol.ChancePoolRequest | ||
654 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
655 | + log.Error(err) | ||
656 | + msg = protocol.BadRequestParam(1) | ||
657 | + return | ||
658 | + } | ||
659 | + if b, m := this.Valid(request); !b { | ||
660 | + msg = m | ||
661 | + return | ||
662 | + } | ||
663 | + header := controllers.GetRequestHeader(this.Ctx) | ||
664 | + request.Type = 1 | ||
665 | + msg = protocol.NewReturnResponse(chance.ChancePool(header, request)) | ||
666 | +} | ||
667 | + | ||
646 | //ChanceReviseDetail 机会补充详情 | 668 | //ChanceReviseDetail 机会补充详情 |
647 | //@router /chanceReviseDetail [post] | 669 | //@router /chanceReviseDetail [post] |
648 | func (this *ChanceController) ChanceReviseDetail() { | 670 | func (this *ChanceController) ChanceReviseDetail() { |
@@ -7,12 +7,12 @@ import ( | @@ -7,12 +7,12 @@ import ( | ||
7 | ) | 7 | ) |
8 | 8 | ||
9 | type ChanceReserveType struct { | 9 | type ChanceReserveType struct { |
10 | - Id int `orm:"column(id);auto"` | ||
11 | - Name string `orm:"column(name);size(50)" description:"储备类型名称"` | ||
12 | - CompanyId int `orm:"column(company_id)" description:"表company.id 公司编号"` | ||
13 | - SortNum int `orm:"column(sort_num);null" description:"序号 "` | ||
14 | - CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间 "` | ||
15 | - UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间 "` | 10 | + Id int `orm:"column(id);auto" json:"id"` |
11 | + Name string `orm:"column(name);size(50)" description:"储备类型名称" json:"name"` | ||
12 | + CompanyId int `orm:"column(company_id)" description:"表company.id 公司编号" json:"-"` | ||
13 | + SortNum int `orm:"column(sort_num);null" description:"序号 " json:"-"` | ||
14 | + CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间 " json:"-"` | ||
15 | + UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间 " json:"-"` | ||
16 | } | 16 | } |
17 | 17 | ||
18 | func (t *ChanceReserveType) TableName() string { | 18 | func (t *ChanceReserveType) TableName() string { |
@@ -33,3 +33,12 @@ func GetChanceReserveTypeById(id int) (v *ChanceReserveType, err error) { | @@ -33,3 +33,12 @@ func GetChanceReserveTypeById(id int) (v *ChanceReserveType, err error) { | ||
33 | } | 33 | } |
34 | return nil, err | 34 | return nil, err |
35 | } | 35 | } |
36 | + | ||
37 | +func GetChanceReserveTypes(cid int64) (v []*ChanceReserveType, err error) { | ||
38 | + o := orm.NewOrm() | ||
39 | + sql := "select * from chance_reserve_type where company_id=? order by sort_num,id" | ||
40 | + if _, err = o.Raw(sql, cid).QueryRows(&v); err == nil { | ||
41 | + return | ||
42 | + } | ||
43 | + return | ||
44 | +} |
models/menu_app.go
0 → 100644
1 | +package models | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "github.com/astaxie/beego/orm" | ||
7 | +) | ||
8 | + | ||
9 | +type MenuApp struct { | ||
10 | + Id int `orm:"column(id);auto" description:"主键"` | ||
11 | + Name string `orm:"column(name);size(10)" description:"菜单名称"` | ||
12 | + Icon string `orm:"column(icon);size(128)" description:"菜单图标地址"` | ||
13 | + ParentId int `orm:"column(parent_id)" description:"上一级菜单 id"` | ||
14 | + Type int `orm:"column(type)" description:"类型:1为 pc 2为app"` | ||
15 | + Url string `orm:"column(url);size(128)" description:"菜单地址"` | ||
16 | + Code string `orm:"column(code);size(128)" description:"菜单编码"` | ||
17 | + Sort int `orm:"column(sort)" description:"同级菜单序号 "` | ||
18 | + CreateTime time.Time `orm:"column(create_time);type(timestamp);null" description:"创建时间"` | ||
19 | + Enabled int8 `orm:"column(enabled)" description:"是否有效"` | ||
20 | +} | ||
21 | + | ||
22 | +func (t *MenuApp) TableName() string { | ||
23 | + return "menu_app" | ||
24 | +} | ||
25 | + | ||
26 | +func init() { | ||
27 | + orm.RegisterModel(new(MenuApp)) | ||
28 | +} | ||
29 | + | ||
30 | +// GetMenuAppById retrieves MenuApp by Id. Returns error if | ||
31 | +// Id doesn't exist | ||
32 | +func GetMenuAppById(id int) (v *MenuApp, err error) { | ||
33 | + o := orm.NewOrm() | ||
34 | + v = &MenuApp{Id: id} | ||
35 | + if err = o.Read(v); err == nil { | ||
36 | + return v, nil | ||
37 | + } | ||
38 | + return nil, err | ||
39 | +} | ||
40 | + | ||
41 | +func GetMenuApp() (v []*MenuApp, err error) { | ||
42 | + o := orm.NewOrm() | ||
43 | + sql := "select * from menu_app where enabled=1 order by sort" | ||
44 | + if _, err = o.Raw(sql).QueryRows(&v); err == nil { | ||
45 | + return | ||
46 | + } | ||
47 | + return | ||
48 | +} |
1 | package protocol | 1 | package protocol |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "opp/models" | ||
5 | "time" | 4 | "time" |
6 | ) | 5 | ) |
7 | 6 | ||
@@ -56,6 +55,11 @@ const ( | @@ -56,6 +55,11 @@ const ( | ||
56 | ChanceStatusClose = 2 //关闭 | 55 | ChanceStatusClose = 2 //关闭 |
57 | ) | 56 | ) |
58 | 57 | ||
58 | +const ( | ||
59 | + ChanceClass = iota //机会一级分类 | ||
60 | + SubmitMenu //提交菜单 | ||
61 | +) | ||
62 | + | ||
59 | /*Favorite 我的收藏/点赞*/ | 63 | /*Favorite 我的收藏/点赞*/ |
60 | type FavoriteRequest struct { | 64 | type FavoriteRequest struct { |
61 | ObjectType int `json:"object_type" valid:"Required"` //收藏 点赞 | 65 | ObjectType int `json:"object_type" valid:"Required"` //收藏 点赞 |
@@ -84,7 +88,32 @@ type SympathyActionResponse struct { | @@ -84,7 +88,32 @@ type SympathyActionResponse struct { | ||
84 | type ChanceTypeRequest struct { | 88 | type ChanceTypeRequest struct { |
85 | } | 89 | } |
86 | type ChanceTypeResponse struct { | 90 | type ChanceTypeResponse struct { |
87 | - List []*models.ChanceType `json:"list"` | 91 | + List []*MenuItem `json:"list"` |
92 | +} | ||
93 | + | ||
94 | +/*ChanceReserveType 机会储备类型*/ | ||
95 | +type ChanceReserveTypeRequest struct { | ||
96 | +} | ||
97 | +type ChanceReserveTypeResponse struct { | ||
98 | + List interface{} `json:"list"` | ||
99 | +} | ||
100 | + | ||
101 | +type MenuItem struct { | ||
102 | + Id int `json:"id"` | ||
103 | + Name string `json:"name"` | ||
104 | + Icon string `json:"icon"` | ||
105 | + Code string `json:"code"` //草稿箱-机会列表 CHANCE_DRAFT | ||
106 | + Type int `json:"type"` //0:机会一级分类 1:菜单 | ||
107 | +} | ||
108 | + | ||
109 | +func NewMenuItem(id int, name, icon, code string, t int) *MenuItem { | ||
110 | + return &MenuItem{ | ||
111 | + Id: id, | ||
112 | + Name: name, | ||
113 | + Icon: icon, | ||
114 | + Code: code, | ||
115 | + Type: t, | ||
116 | + } | ||
88 | } | 117 | } |
89 | 118 | ||
90 | /*Templates 模板列表请求*/ | 119 | /*Templates 模板列表请求*/ |
@@ -121,6 +121,22 @@ func init() { | @@ -121,6 +121,22 @@ func init() { | ||
121 | 121 | ||
122 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | 122 | beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], |
123 | beego.ControllerComments{ | 123 | beego.ControllerComments{ |
124 | + Method: "ChanceReservePool", | ||
125 | + Router: `/chanceReservePool`, | ||
126 | + AllowHTTPMethods: []string{"post"}, | ||
127 | + MethodParams: param.Make(), | ||
128 | + Params: nil}) | ||
129 | + | ||
130 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
131 | + beego.ControllerComments{ | ||
132 | + Method: "ChanceReserveType", | ||
133 | + Router: `/chanceReserveType`, | ||
134 | + AllowHTTPMethods: []string{"post"}, | ||
135 | + MethodParams: param.Make(), | ||
136 | + Params: nil}) | ||
137 | + | ||
138 | + beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"], | ||
139 | + beego.ControllerComments{ | ||
124 | Method: "ChanceReviseDetail", | 140 | Method: "ChanceReviseDetail", |
125 | Router: `/chanceReviseDetail`, | 141 | Router: `/chanceReviseDetail`, |
126 | AllowHTTPMethods: []string{"post"}, | 142 | AllowHTTPMethods: []string{"post"}, |
@@ -184,10 +184,11 @@ END: | @@ -184,10 +184,11 @@ END: | ||
184 | //机会类型 | 184 | //机会类型 |
185 | func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequest) (rsp *protocol.ChanceTypeResponse, err error) { | 185 | func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequest) (rsp *protocol.ChanceTypeResponse, err error) { |
186 | var ( | 186 | var ( |
187 | - list []*models.ChanceType | 187 | + list []*models.ChanceType |
188 | + menus []*models.MenuApp | ||
188 | ) | 189 | ) |
189 | rsp = &protocol.ChanceTypeResponse{} | 190 | rsp = &protocol.ChanceTypeResponse{} |
190 | - rsp.List = make([]*models.ChanceType, 0) | 191 | + rsp.List = make([]*protocol.MenuItem, 0) |
191 | if list, err = models.GetChanceTypeAll(header.CompanyId); err != nil { | 192 | if list, err = models.GetChanceTypeAll(header.CompanyId); err != nil { |
192 | if err == orm.ErrNoRows { | 193 | if err == orm.ErrNoRows { |
193 | err = nil | 194 | err = nil |
@@ -196,7 +197,35 @@ func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequ | @@ -196,7 +197,35 @@ func ChanceType(header *protocol.RequestHeader, request *protocol.ChanceTypeRequ | ||
196 | log.Error(err) | 197 | log.Error(err) |
197 | return | 198 | return |
198 | } | 199 | } |
199 | - rsp.List = append(rsp.List, list...) | 200 | + for i := range list { |
201 | + item := list[i] | ||
202 | + rsp.List = append(rsp.List, protocol.NewMenuItem(item.Id, item.Name, item.Icon, item.Code, protocol.ChanceClass)) //机会一级分类 | ||
203 | + } | ||
204 | + if menus, err = models.GetMenuApp(); err != nil { | ||
205 | + if err == orm.ErrNoRows { | ||
206 | + err = nil | ||
207 | + return | ||
208 | + } | ||
209 | + log.Error(err) | ||
210 | + return | ||
211 | + } | ||
212 | + for i := range menus { | ||
213 | + item := menus[i] | ||
214 | + rsp.List = append(rsp.List, protocol.NewMenuItem(item.Id, item.Name, item.Icon, item.Code, protocol.SubmitMenu)) //菜单 | ||
215 | + } | ||
216 | + return | ||
217 | +} | ||
218 | + | ||
219 | +//机会储备类型 | ||
220 | +func ChanceReserveType(header *protocol.RequestHeader, request *protocol.ChanceReserveTypeRequest) (rsp *protocol.ChanceReserveTypeResponse, err error) { | ||
221 | + var ( | ||
222 | + v []*models.ChanceReserveType | ||
223 | + ) | ||
224 | + v, _ = models.GetChanceReserveTypes(header.CompanyId) | ||
225 | + if len(v) == 0 { | ||
226 | + v = make([]*models.ChanceReserveType, 0) | ||
227 | + } | ||
228 | + rsp = &protocol.ChanceReserveTypeResponse{List: v} | ||
200 | return | 229 | return |
201 | } | 230 | } |
202 | 231 |
@@ -113,6 +113,10 @@ func SubmitChecks(header *protocol.RequestHeader, request *protocol.SubmitChecks | @@ -113,6 +113,10 @@ func SubmitChecks(header *protocol.RequestHeader, request *protocol.SubmitChecks | ||
113 | err = protocol.NewCustomMessage(5102, "该机会已被关闭") | 113 | err = protocol.NewCustomMessage(5102, "该机会已被关闭") |
114 | return | 114 | return |
115 | } | 115 | } |
116 | + if chance.Type == models.ChanceReserve { | ||
117 | + err = protocol.NewCustomMessage(1, "该机会已被移至储备池,不允许提交") | ||
118 | + return | ||
119 | + } | ||
116 | if _, result := CheckIsCommitAllCheck(request.ChanceId); result { | 120 | if _, result := CheckIsCommitAllCheck(request.ChanceId); result { |
117 | err = protocol.NewCustomMessage(1, "所有人均已提交,不允许修改自查内容") | 121 | err = protocol.NewCustomMessage(1, "所有人均已提交,不允许修改自查内容") |
118 | return | 122 | return |
-
请 注册 或 登录 后发表评论