正在显示
5 个修改的文件
包含
54 行增加
和
10 行删除
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | "oppmg/protocol" | 7 | "oppmg/protocol" |
8 | serveaudit "oppmg/services/audit" | 8 | serveaudit "oppmg/services/audit" |
9 | servecommon "oppmg/services/common" | 9 | servecommon "oppmg/services/common" |
10 | + "strconv" | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type AuditController struct { | 13 | type AuditController struct { |
@@ -59,3 +60,26 @@ func (c *AuditController) AuditListBefore() { | @@ -59,3 +60,26 @@ func (c *AuditController) AuditListBefore() { | ||
59 | msg = protocol.NewReturnResponse(data, nil) | 60 | msg = protocol.NewReturnResponse(data, nil) |
60 | return | 61 | return |
61 | } | 62 | } |
63 | + | ||
64 | +//AuditInfo 获取机会详情 | ||
65 | +//@router /v1/audit/info | ||
66 | +func (c *AuditController) AuditInfo() { | ||
67 | + var msg *protocol.ResponseMessage | ||
68 | + defer func() { | ||
69 | + c.ResposeJson(msg) | ||
70 | + }() | ||
71 | + type Parameter struct { | ||
72 | + ChanceId string `json:"chance_id"` | ||
73 | + } | ||
74 | + var param Parameter | ||
75 | + if err := json.Unmarshal(c.Ctx.Input.RequestBody, ¶m); err != nil { | ||
76 | + log.Error("json 解析失败", err) | ||
77 | + msg = protocol.BadRequestParam("1") | ||
78 | + return | ||
79 | + } | ||
80 | + chanceid, _ := strconv.ParseInt(param.ChanceId, 10, 64) | ||
81 | + companyId := c.GetCompanyId() | ||
82 | + list, err := serveaudit.GetChanceDetail(chanceid, companyId) | ||
83 | + msg = protocol.NewReturnResponse(list, err) | ||
84 | + return | ||
85 | +} |
@@ -15,7 +15,7 @@ const ( | @@ -15,7 +15,7 @@ const ( | ||
15 | type InputElement struct { | 15 | type InputElement struct { |
16 | Id int `json:"id"` | 16 | Id int `json:"id"` |
17 | Sort int `json:"sort"` //排序 | 17 | Sort int `json:"sort"` //排序 |
18 | - Lable string `json:"lable"` //标题 | 18 | + Label string `json:"label"` //标题 |
19 | InputType string `json:"inputType"` //输入类型 | 19 | InputType string `json:"inputType"` //输入类型 |
20 | Required int `json:"required"` //是否必填 | 20 | Required int `json:"required"` //是否必填 |
21 | // CurrentValue string `json:"-"` //"当前填写的值" | 21 | // CurrentValue string `json:"-"` //"当前填写的值" |
@@ -263,7 +263,8 @@ type RspAuditList struct { | @@ -263,7 +263,8 @@ type RspAuditList struct { | ||
263 | } | 263 | } |
264 | 264 | ||
265 | type ChanceFlowLog struct { | 265 | type ChanceFlowLog struct { |
266 | - CreateTime string `json:"create_time"` | ||
267 | - Content string `json:"content"` | ||
268 | - UserrName string `json:"user_name"` | 266 | + ChanceId string `json:"chance_id" orm:"column(chance_id)"` |
267 | + CreateAt string `json:"create_at" orm:"column(create_at)"` | ||
268 | + Content string `json:"content" orm:"column(content)"` | ||
269 | + NickName string `json:"nick_name" orm:"column(nick_name)"` | ||
269 | } | 270 | } |
@@ -100,6 +100,7 @@ func init() { | @@ -100,6 +100,7 @@ func init() { | ||
100 | beego.NSNamespace("/audit", | 100 | beego.NSNamespace("/audit", |
101 | beego.NSRouter("/list", &controllers.AuditController{}, "post:AuditList"), | 101 | beego.NSRouter("/list", &controllers.AuditController{}, "post:AuditList"), |
102 | beego.NSRouter("/list/before", &controllers.AuditController{}, "post:AuditListBefore"), | 102 | beego.NSRouter("/list/before", &controllers.AuditController{}, "post:AuditListBefore"), |
103 | + beego.NSRouter("/info", &controllers.AuditController{}, "post:AuditInfo"), | ||
103 | ), | 104 | ), |
104 | ) | 105 | ) |
105 | 106 |
@@ -190,7 +190,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error | @@ -190,7 +190,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error | ||
190 | var ( | 190 | var ( |
191 | chanceContent []protocol.InputElement | 191 | chanceContent []protocol.InputElement |
192 | ) | 192 | ) |
193 | - err = json.Unmarshal([]byte(chanceInfo.Content), &chanceContent) | 193 | + err = json.Unmarshal([]byte(chanceInfo.SourceContent), &chanceContent) |
194 | if err != nil { | 194 | if err != nil { |
195 | log.Error("解析机会内容失败:%s", err) | 195 | log.Error("解析机会内容失败:%s", err) |
196 | } | 196 | } |
@@ -225,6 +225,24 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error | @@ -225,6 +225,24 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error | ||
225 | } else { | 225 | } else { |
226 | log.Error("GetChanceTypeById(%d) err:%s", chanceInfo.ChanceTypeId, err) | 226 | log.Error("GetChanceTypeById(%d) err:%s", chanceInfo.ChanceTypeId, err) |
227 | } | 227 | } |
228 | - | 228 | + flowlogs, err := getAuditFlowLog(chanceid) |
229 | + if err != nil { | ||
230 | + log.Warn("获取获取记录失败") | ||
231 | + } | ||
232 | + returnData.FlowLog = flowlogs | ||
229 | return returnData, nil | 233 | return returnData, nil |
230 | } | 234 | } |
235 | + | ||
236 | +func getAuditFlowLog(chanceid int64) ([]protocol.ChanceFlowLog, error) { | ||
237 | + var ( | ||
238 | + flowLogs = make([]protocol.ChanceFlowLog, 0) | ||
239 | + err error | ||
240 | + ) | ||
241 | + const datasql string = `SELECT a.chance_id,a.content,a.create_at,c.nick_name | ||
242 | + FROM audit_flow_log AS a | ||
243 | + LEFT JOIN user_company AS b ON a.approve_user_id=b.id | ||
244 | + LEFT JOIN user AS c ON b.user_id = c.id | ||
245 | + WHERE chance_id =? ` | ||
246 | + err = utils.ExecuteQueryAll(&flowLogs, datasql, chanceid) | ||
247 | + return flowLogs, err | ||
248 | +} |
@@ -72,7 +72,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | @@ -72,7 +72,7 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | ||
72 | AuditTemplateId: int(templateId), | 72 | AuditTemplateId: int(templateId), |
73 | Section: input.SectionType, | 73 | Section: input.SectionType, |
74 | SortNum: input.Sort, | 74 | SortNum: input.Sort, |
75 | - Label: input.Lable, | 75 | + Label: input.Label, |
76 | InputType: input.InputType, | 76 | InputType: input.InputType, |
77 | Required: int8(input.Required), | 77 | Required: int8(input.Required), |
78 | CreateAt: time.Now(), | 78 | CreateAt: time.Now(), |
@@ -256,7 +256,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input | @@ -256,7 +256,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input | ||
256 | AuditTemplateId: int(templateId), | 256 | AuditTemplateId: int(templateId), |
257 | Section: input.SectionType, | 257 | Section: input.SectionType, |
258 | SortNum: input.Sort, | 258 | SortNum: input.Sort, |
259 | - Label: input.Lable, | 259 | + Label: input.Label, |
260 | InputType: input.InputType, | 260 | InputType: input.InputType, |
261 | Required: int8(input.Required), | 261 | Required: int8(input.Required), |
262 | CreateAt: time.Now(), | 262 | CreateAt: time.Now(), |
@@ -275,7 +275,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input | @@ -275,7 +275,7 @@ func insertOrUpdateInput(orm orm2.Ormer, companyId int64, templateId int, input | ||
275 | } | 275 | } |
276 | { | 276 | { |
277 | updateMap := map[string]interface{}{ | 277 | updateMap := map[string]interface{}{ |
278 | - "Label": input.Lable, | 278 | + "Label": input.Label, |
279 | "InputType": input.InputType, | 279 | "InputType": input.InputType, |
280 | "Required": int8(input.Required), | 280 | "Required": int8(input.Required), |
281 | } | 281 | } |
@@ -448,7 +448,7 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs | @@ -448,7 +448,7 @@ func TemplateGet(uid, companyId int64, request *protocol.TemplateGetRequest) (rs | ||
448 | rsp.Template.InputList = append(rsp.Template.InputList, &protocol.InputElement{ | 448 | rsp.Template.InputList = append(rsp.Template.InputList, &protocol.InputElement{ |
449 | Id: input.Id, | 449 | Id: input.Id, |
450 | Sort: input.SortNum, | 450 | Sort: input.SortNum, |
451 | - Lable: input.InputType, | 451 | + Label: input.InputType, |
452 | Required: int(input.Required), | 452 | Required: int(input.Required), |
453 | SectionType: input.Section, | 453 | SectionType: input.Section, |
454 | }) | 454 | }) |
-
请 注册 或 登录 后发表评论