正在显示
11 个修改的文件
包含
201 行增加
和
44 行删除
@@ -273,6 +273,48 @@ func (this *ChanceController) MySubmitChance() { | @@ -273,6 +273,48 @@ func (this *ChanceController) MySubmitChance() { | ||
273 | msg = protocol.NewReturnResponse(chance.MySubmitChance(header, request)) | 273 | msg = protocol.NewReturnResponse(chance.MySubmitChance(header, request)) |
274 | } | 274 | } |
275 | 275 | ||
276 | +//ChanceDetail 机会详情 | ||
277 | +//@router /chanceDetail [post] | ||
278 | +func (this *ChanceController) ChanceDetail() { | ||
279 | + var msg *protocol.ResponseMessage | ||
280 | + defer func() { | ||
281 | + this.Resp(msg) | ||
282 | + }() | ||
283 | + var request *protocol.ChanceDetailRequest | ||
284 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
285 | + log.Error(err) | ||
286 | + msg = protocol.BadRequestParam(1) | ||
287 | + return | ||
288 | + } | ||
289 | + if b, m := this.Valid(request); !b { | ||
290 | + msg = m | ||
291 | + return | ||
292 | + } | ||
293 | + header := controllers.GetRequestHeader(this.Ctx) | ||
294 | + msg = protocol.NewReturnResponse(chance.ChanceDetail(header, request)) | ||
295 | +} | ||
296 | + | ||
297 | +//ChanceDelete 机会删除 | ||
298 | +//@router /chanceDelete [post] | ||
299 | +func (this *ChanceController) ChanceDelete() { | ||
300 | + var msg *protocol.ResponseMessage | ||
301 | + defer func() { | ||
302 | + this.Resp(msg) | ||
303 | + }() | ||
304 | + var request *protocol.ChanceDeleteRequest | ||
305 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
306 | + log.Error(err) | ||
307 | + msg = protocol.BadRequestParam(1) | ||
308 | + return | ||
309 | + } | ||
310 | + if b, m := this.Valid(request); !b { | ||
311 | + msg = m | ||
312 | + return | ||
313 | + } | ||
314 | + header := controllers.GetRequestHeader(this.Ctx) | ||
315 | + msg = protocol.NewReturnResponse(chance.ChanceDelete(header, request)) | ||
316 | +} | ||
317 | + | ||
276 | //ChanceApprove 机会审核 | 318 | //ChanceApprove 机会审核 |
277 | //func(this *ChanceController)ChanceApprove(){ | 319 | //func(this *ChanceController)ChanceApprove(){ |
278 | // var msg *protocol.ResponseMessage | 320 | // var msg *protocol.ResponseMessage |
@@ -8,12 +8,13 @@ import ( | @@ -8,12 +8,13 @@ import ( | ||
8 | ) | 8 | ) |
9 | 9 | ||
10 | type UserDepartment struct { | 10 | type UserDepartment struct { |
11 | - Id int64 `orm:"column(id);auto" description:"主键"` | ||
12 | - UserId int64 `orm:"column(user_id)" description:"用户id"` | ||
13 | - CompanyId int `orm:"column(company_id)" description:"公司id"` | ||
14 | - DepartmentId int `orm:"column(department_id)" description:"部门id"` | ||
15 | - CreateTime time.Time `orm:"column(create_time);type(timestamp);null" description:"创建时间"` | ||
16 | - EnableStatus int8 `orm:"column(enable_status)" description:"是否有效"` | 11 | + Id int64 `orm:"column(id);auto" description:"主键"` |
12 | + //UserId int64 `orm:"column(user_id)" description:"用户id"` | ||
13 | + CompanyId int `orm:"column(company_id)" description:"公司id"` | ||
14 | + UserCompanyId int64 `orm:"column(user_company_id)" description:"用户公司id"` | ||
15 | + DepartmentId int `orm:"column(department_id)" description:"部门id"` | ||
16 | + CreateTime time.Time `orm:"column(create_time);type(timestamp);null" description:"创建时间"` | ||
17 | + EnableStatus int8 `orm:"column(enable_status)" description:"是否有效"` | ||
17 | } | 18 | } |
18 | 19 | ||
19 | func (t *UserDepartment) TableName() string { | 20 | func (t *UserDepartment) TableName() string { |
@@ -8,12 +8,13 @@ import ( | @@ -8,12 +8,13 @@ import ( | ||
8 | ) | 8 | ) |
9 | 9 | ||
10 | type UserPosition struct { | 10 | type UserPosition struct { |
11 | - Id int `orm:"column(id);pk" description:"唯一键值"` | ||
12 | - UserId int64 `orm:"column(user_id)" description:"表user.id 用户编号"` | ||
13 | - PositionId int `orm:"column(position_id)" description:"表position.id 职位编号"` | ||
14 | - CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"` | ||
15 | - CompanyId int `orm:"column(company_id)" description:"表company.id 公司编号"` | ||
16 | - EnableStatus int8 `orm:"column(enable_status);null" description:"是否有效 1:有效 0:无效"` | 11 | + Id int `orm:"column(id);pk" description:"唯一键值"` |
12 | + //UserId int64 `orm:"column(user_id)" description:"表user.id 用户编号"` | ||
13 | + PositionId int `orm:"column(position_id)" description:"表position.id 职位编号"` | ||
14 | + UserCompanyId int64 `orm:"column(user_company_id)" description:"用户公司id"` | ||
15 | + CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"` | ||
16 | + CompanyId int `orm:"column(company_id)" description:"表company.id 公司编号"` | ||
17 | + EnableStatus int8 `orm:"column(enable_status);null" description:"是否有效 1:有效 0:无效"` | ||
17 | } | 18 | } |
18 | 19 | ||
19 | func (t *UserPosition) TableName() string { | 20 | func (t *UserPosition) TableName() string { |
@@ -201,3 +201,19 @@ type ChanceItem struct { | @@ -201,3 +201,19 @@ type ChanceItem struct { | ||
201 | Pictures []Picture `json:"pictures"` | 201 | Pictures []Picture `json:"pictures"` |
202 | Videos []Video `json:"videos"` | 202 | Videos []Video `json:"videos"` |
203 | } | 203 | } |
204 | + | ||
205 | +/*ChanceDetail 机会详情*/ | ||
206 | +type ChanceDetailRequest struct { | ||
207 | + Id int64 `json:"id"` //机会编号 | ||
208 | +} | ||
209 | +type ChanceDetailResponse struct { | ||
210 | + ChanceDetail ChanceItem `json:"chanceDetail"` | ||
211 | + ApproveProcess interface{} `json:"approveProcess"` | ||
212 | +} | ||
213 | + | ||
214 | +/*ChanceDelete 机会删除*/ | ||
215 | +type ChanceDeleteRequest struct { | ||
216 | + Id int64 `json:"id"` //机会编号 | ||
217 | +} | ||
218 | +type ChanceDeleteResponse struct { | ||
219 | +} |
protocol/chance_approve.go
0 → 100644
1 | +package protocol | ||
2 | + | ||
3 | +type ApproveProcess struct { | ||
4 | + //RelativeId int64 `json:"relativeId"` | ||
5 | + Uid int64 `json:"uid"` | ||
6 | + Name string `json:"name"` | ||
7 | + ApproveWay int `json:"approveWay"` //审核方式 | ||
8 | + Status int `json:"status"` //状态 | ||
9 | + Active int `json:"active"` | ||
10 | + ApproveTime int64 `json:"approveTime"` //审核时间 | ||
11 | +} |
@@ -9,6 +9,7 @@ var errmessge ErrorMap = map[int]string{ | @@ -9,6 +9,7 @@ var errmessge ErrorMap = map[int]string{ | ||
9 | 1: "系统异常", | 9 | 1: "系统异常", |
10 | 2: "参数错误", | 10 | 2: "参数错误", |
11 | 3: "统一用户中心操作异常", | 11 | 3: "统一用户中心操作异常", |
12 | + 5: "繁忙,请稍后再试", | ||
12 | 101: "clientId或clientSecret无效", | 13 | 101: "clientId或clientSecret无效", |
13 | 113: "签名验证失败", | 14 | 113: "签名验证失败", |
14 | 1009: "验证码已失效", | 15 | 1009: "验证码已失效", |
@@ -30,7 +31,12 @@ var errmessge ErrorMap = map[int]string{ | @@ -30,7 +31,12 @@ var errmessge ErrorMap = map[int]string{ | ||
30 | 4141: "accessToken过期或无效,需要进行重新获取令牌", | 31 | 4141: "accessToken过期或无效,需要进行重新获取令牌", |
31 | 4142: "Uuid已存在,请求失败", | 32 | 4142: "Uuid已存在,请求失败", |
32 | 4201: "无该公司", | 33 | 4201: "无该公司", |
33 | - 5000: "繁忙,请稍后再试", | 34 | + |
35 | + //机会相关 | ||
36 | + 5101: "该机会已被删除", | ||
37 | + | ||
38 | + //机会审批相关 | ||
39 | + 5201: "该机会模板未配置审批人,请选择其他模板", | ||
34 | } | 40 | } |
35 | 41 | ||
36 | /*MessageCenter */ | 42 | /*MessageCenter */ |
@@ -73,6 +73,7 @@ type User struct { | @@ -73,6 +73,7 @@ type User struct { | ||
73 | type Company struct { | 73 | type Company struct { |
74 | Id int64 `json:"id"` | 74 | Id int64 `json:"id"` |
75 | Name string `json:"name"` | 75 | Name string `json:"name"` |
76 | + CId int64 `json:"cid"` //统一用户中心公司编号 | ||
76 | } | 77 | } |
77 | 78 | ||
78 | //部门 | 79 | //部门 |
@@ -25,6 +25,9 @@ func GetUserBaseInfoAggregation(id int64, companyId int64) (v *protocol.UserBase | @@ -25,6 +25,9 @@ func GetUserBaseInfoAggregation(id int64, companyId int64) (v *protocol.UserBase | ||
25 | log.Error(err) | 25 | log.Error(err) |
26 | return | 26 | return |
27 | } | 27 | } |
28 | + if len(v.UserCompany.NickName) > 0 { | ||
29 | + v.User.NickName = v.UserCompany.NickName //公司里面的用户名称 | ||
30 | + } | ||
28 | wg.Add(3) | 31 | wg.Add(3) |
29 | go func() { | 32 | go func() { |
30 | defer wg.Done() | 33 | defer wg.Done() |
@@ -14,9 +14,6 @@ import ( | @@ -14,9 +14,6 @@ import ( | ||
14 | "encoding/json" | 14 | "encoding/json" |
15 | ) | 15 | ) |
16 | 16 | ||
17 | -type SuplusApprove struct { | ||
18 | -} | ||
19 | - | ||
20 | var ( | 17 | var ( |
21 | ErrorRequestSuplus = fmt.Errorf("请求素加后台失败") | 18 | ErrorRequestSuplus = fmt.Errorf("请求素加后台失败") |
22 | ) | 19 | ) |
@@ -29,12 +26,15 @@ const ( | @@ -29,12 +26,15 @@ const ( | ||
29 | ApproveIntegrate = "/approve-processes/integrate" | 26 | ApproveIntegrate = "/approve-processes/integrate" |
30 | ) | 27 | ) |
31 | 28 | ||
29 | +type SuplusApprove struct { | ||
30 | +} | ||
31 | + | ||
32 | //新增审批实例 | 32 | //新增审批实例 |
33 | func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, process []*models.AuditFlowProcess) (err error) { | 33 | func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, process []*models.AuditFlowProcess) (err error) { |
34 | var ( | 34 | var ( |
35 | request NewApproveInstanceRequest | 35 | request NewApproveInstanceRequest |
36 | response NewApproveInstanceResponse | 36 | response NewApproveInstanceResponse |
37 | - mapApproves map[int]Approve = make(map[int]Approve) | 37 | + mapApproves map[int]*Approve = make(map[int]*Approve) |
38 | relativeId int64 | 38 | relativeId int64 |
39 | userCompany *models.UserCompany | 39 | userCompany *models.UserCompany |
40 | ) | 40 | ) |
@@ -51,7 +51,7 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | @@ -51,7 +51,7 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | ||
51 | } | 51 | } |
52 | for i := range process { | 52 | for i := range process { |
53 | var ( | 53 | var ( |
54 | - approve Approve | 54 | + approve *Approve |
55 | approveType int //审批类型 | 55 | approveType int //审批类型 |
56 | approveWay int //审批方式 | 56 | approveWay int //审批方式 |
57 | approver *models.User | 57 | approver *models.User |
@@ -72,10 +72,11 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | @@ -72,10 +72,11 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | ||
72 | } else { | 72 | } else { |
73 | approveWay = 2 //或签 | 73 | approveWay = 2 //或签 |
74 | } | 74 | } |
75 | - mapApproves[i] = Approve{ | 75 | + approve = &Approve{ |
76 | ApproveType: item.AuditFlowType, | 76 | ApproveType: item.AuditFlowType, |
77 | ApproveWay: approveWay, | 77 | ApproveWay: approveWay, |
78 | } | 78 | } |
79 | + mapApproves[i] = approve | ||
79 | } | 80 | } |
80 | if approver, err = models.GetUserByUcid(item.Uid); err != nil { | 81 | if approver, err = models.GetUserByUcid(item.Uid); err != nil { |
81 | log.Error(err) | 82 | log.Error(err) |
@@ -84,6 +85,8 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | @@ -84,6 +85,8 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | ||
84 | approve.ApproveUsers = append(approve.ApproveUsers, ApproveUsers{ | 85 | approve.ApproveUsers = append(approve.ApproveUsers, ApproveUsers{ |
85 | Uid: item.Uid, | 86 | Uid: item.Uid, |
86 | Name: approver.NickName, | 87 | Name: approver.NickName, |
88 | + //RoleId:5, | ||
89 | + RoleId: 0, | ||
87 | }) | 90 | }) |
88 | } | 91 | } |
89 | request.RelativeId = relativeId | 92 | request.RelativeId = relativeId |
@@ -92,10 +95,9 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | @@ -92,10 +95,9 @@ func (s SuplusApprove) NewApproveInstance(header *protocol.RequestHeader, proces | ||
92 | request.Approves = append(request.Approves, v) | 95 | request.Approves = append(request.Approves, v) |
93 | } | 96 | } |
94 | } | 97 | } |
95 | - if s.DoRequest(NewApproveInstance, http.MethodPost, request, &response); err != nil { | 98 | + if err = s.DoRequest(NewApproveInstance, http.MethodPost, request, &response); err != nil { |
96 | log.Error(err) | 99 | log.Error(err) |
97 | } | 100 | } |
98 | - log.Info(fmt.Sprintf("success request suplus-approve:%v request:%v response:%v", NewApproveInstance, common.AssertJson(request), common.AssertJson(response))) | ||
99 | return | 101 | return |
100 | } | 102 | } |
101 | 103 | ||
@@ -162,7 +164,8 @@ func (s SuplusApprove) DoRequest(method string, methodType string, request inter | @@ -162,7 +164,8 @@ func (s SuplusApprove) DoRequest(method string, methodType string, request inter | ||
162 | return | 164 | return |
163 | } | 165 | } |
164 | if message.Errno != 0 { | 166 | if message.Errno != 0 { |
165 | - err = fmt.Errorf("request-%v response-code:%v msg:%v", url, message.Errno, message.Errmsg) | 167 | + err = fmt.Errorf("request-%v request-%v response-code:%v msg:%v", url, common.AssertJson(request), message.Errno, message.Errmsg) |
168 | + return | ||
166 | } | 169 | } |
167 | var responseData string | 170 | var responseData string |
168 | if len(data) > 500 { | 171 | if len(data) > 500 { |
@@ -170,29 +173,27 @@ func (s SuplusApprove) DoRequest(method string, methodType string, request inter | @@ -170,29 +173,27 @@ func (s SuplusApprove) DoRequest(method string, methodType string, request inter | ||
170 | } else { | 173 | } else { |
171 | responseData = string(data) | 174 | responseData = string(data) |
172 | } | 175 | } |
173 | - if err = json.Unmarshal(message.Data, &response); err != nil { | ||
174 | - log.Error(err) | 176 | + if e := json.Unmarshal(message.Data, &response); e != nil { |
177 | + log.Debug(fmt.Sprintf("request-%v request:%v rsp:%v", url, common.AssertJson(request), string(responseData))) | ||
178 | + log.Error(e) | ||
175 | return | 179 | return |
176 | } | 180 | } |
177 | - log.Debug(fmt.Sprintf("request-%v request:%v rsp:%v", url, request, responseData)) | 181 | + log.Debug(fmt.Sprintf("request-%v request:%v rsp:%v", url, common.AssertJson(request), common.AssertJson(response))) |
178 | return | 182 | return |
179 | } | 183 | } |
180 | 184 | ||
181 | /*NewApproveInstance 新增审批实例*/ | 185 | /*NewApproveInstance 新增审批实例*/ |
182 | type NewApproveInstanceRequest struct { | 186 | type NewApproveInstanceRequest struct { |
183 | - Approves []Approve `json:"approves"` //审批节点列表 | ||
184 | - CompanyId int64 `json:"companyId"` //公司id | ||
185 | - Approver string `json:"approver"` //提交人 | ||
186 | - Uid int64 `json:"uid"` //提交人id | ||
187 | - Sign string `json:"sign"` //标识 ORDER-订单 ELSERK-其他入库 CHANCE-机会 | ||
188 | - Type int `json:"type"` //1-新增 2-编辑 | ||
189 | - RelativeId int64 `json:"relativeId"` //关联id | 187 | + Approves []*Approve `json:"approves"` //审批节点列表 |
188 | + CompanyId int64 `json:"companyId"` //公司id | ||
189 | + Approver string `json:"approver"` //提交人 | ||
190 | + Uid int64 `json:"uid"` //提交人id | ||
191 | + Sign string `json:"sign"` //标识 ORDER-订单 ELSERK-其他入库 CHANCE-机会 | ||
192 | + Type int `json:"type"` //1-新增 2-编辑 | ||
193 | + RelativeId int64 `json:"relativeId"` //关联id | ||
190 | 194 | ||
191 | } | 195 | } |
192 | -type NewApproveInstanceResponse struct { | ||
193 | - protocol.ErrorCode | ||
194 | - Data []string `json:"data"` | ||
195 | -} | 196 | +type NewApproveInstanceResponse interface{} |
196 | 197 | ||
197 | //审批节点 | 198 | //审批节点 |
198 | type Approve struct { | 199 | type Approve struct { |
@@ -207,7 +208,7 @@ type ApproveUsers struct { | @@ -207,7 +208,7 @@ type ApproveUsers struct { | ||
207 | Name string `json:"name"` //用户名 | 208 | Name string `json:"name"` //用户名 |
208 | IsDefault int `json:"isDefault"` //1 是默认 0 不是 | 209 | IsDefault int `json:"isDefault"` //1 是默认 0 不是 |
209 | RoleName string `json:"roleName"` //角色名/负责人 | 210 | RoleName string `json:"roleName"` //角色名/负责人 |
210 | - RoleId string `json:"roleId"` //角色id | 211 | + RoleId int `json:"roleId"` //角色id |
211 | ParentIds []int `json:"parentIds"` | 212 | ParentIds []int `json:"parentIds"` |
212 | } | 213 | } |
213 | 214 | ||
@@ -231,3 +232,8 @@ type ApproveIntegrateRequest struct { | @@ -231,3 +232,8 @@ type ApproveIntegrateRequest struct { | ||
231 | } | 232 | } |
232 | type ApproveIntegrateResponse struct { | 233 | type ApproveIntegrateResponse struct { |
233 | } | 234 | } |
235 | + | ||
236 | +type AppproveProcess struct { | ||
237 | + ExtendRelativeId int64 `json:"extendRelativeId"` | ||
238 | + Status int `json:"status"` | ||
239 | +} |
@@ -215,10 +215,11 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud | @@ -215,10 +215,11 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud | ||
215 | //提交机会 | 215 | //提交机会 |
216 | func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmitRequest) (rsp *protocol.ChanceSubmitResponse, err error) { | 216 | func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmitRequest) (rsp *protocol.ChanceSubmitResponse, err error) { |
217 | var ( | 217 | var ( |
218 | - template *models.AuditTemplate | ||
219 | - chance *models.Chance | ||
220 | - auditConfig *protocol.AuditConfig | ||
221 | - auditFlows []*models.AuditFlowProcess | 218 | + template *models.AuditTemplate |
219 | + chance *models.Chance | ||
220 | + auditConfig *protocol.AuditConfig | ||
221 | + auditFlows []*models.AuditFlowProcess | ||
222 | + suplusApprove SuplusApprove | ||
222 | ) | 223 | ) |
223 | //1.模板是否存在 | 224 | //1.模板是否存在 |
224 | if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil { | 225 | if template, err = models.GetAuditTemplateById(request.AuditTemplateId); err != nil { |
@@ -267,6 +268,14 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -267,6 +268,14 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
267 | return | 268 | return |
268 | } | 269 | } |
269 | } | 270 | } |
271 | + if len(auditFlows) > 0 { | ||
272 | + if err = suplusApprove.NewApproveInstance(header, auditFlows); err != nil { | ||
273 | + log.Error(fmt.Sprintf("uid:%v", header.UserId), "request suplus-approve.NewApproveInstance err", err) | ||
274 | + orm.Rollback() | ||
275 | + return | ||
276 | + } | ||
277 | + } | ||
278 | + | ||
270 | //6.文件 | 279 | //6.文件 |
271 | { | 280 | { |
272 | data := &models.ChanceData{ | 281 | data := &models.ChanceData{ |
@@ -403,6 +412,11 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | @@ -403,6 +412,11 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | ||
403 | log.Error(err) | 412 | log.Error(err) |
404 | return | 413 | return |
405 | } | 414 | } |
415 | + if len(configs) == 0 { | ||
416 | + //err = protocol.NewErrWithMessage(5201) //未配置审核人 | ||
417 | + //log.Error(err) | ||
418 | + return | ||
419 | + } | ||
406 | 420 | ||
407 | //1.检查是否是特殊审核人 | 421 | //1.检查是否是特殊审核人 |
408 | for i := range configs { | 422 | for i := range configs { |
@@ -431,7 +445,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | @@ -431,7 +445,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | ||
431 | 445 | ||
432 | if groupId == 0 { | 446 | if groupId == 0 { |
433 | log.Error(fmt.Sprintf("group_id=0 template_id:%v", templateId)) | 447 | log.Error(fmt.Sprintf("group_id=0 template_id:%v", templateId)) |
434 | - //log.Error(err) | 448 | + log.Error(err) |
435 | return | 449 | return |
436 | } | 450 | } |
437 | 451 | ||
@@ -478,7 +492,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | @@ -478,7 +492,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | ||
478 | uid = company.AdminId | 492 | uid = company.AdminId |
479 | } | 493 | } |
480 | if uid == header.Uid { //审核人自己 转交给管理员 | 494 | if uid == header.Uid { //审核人自己 转交给管理员 |
481 | - log.Info(fmt.Sprintf("GenAuditFlowProcess:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId)) | 495 | + log.Info(fmt.Sprintf("生成机会审批流-转给管理员:chance_id:%v audit_level:%v audit_user:%v -> admin:%v", chanceId, config.Level, uid, company.AdminId)) |
482 | uid = company.AdminId | 496 | uid = company.AdminId |
483 | } | 497 | } |
484 | item := &models.AuditFlowProcess{ | 498 | item := &models.AuditFlowProcess{ |
@@ -500,7 +514,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | @@ -500,7 +514,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat | ||
500 | item.IsActive = 1 | 514 | item.IsActive = 1 |
501 | //通知 user_msg | 515 | //通知 user_msg |
502 | } | 516 | } |
503 | - log.Info(fmt.Sprintf("GenAuditFlowProcess:chance_id:%v audit_id:%v audit_level:%v audit_user:%v action_type:%v", chanceId, item.Id, config.Level, uid, resolveActionType(config.ActionType))) | 517 | + log.Info(fmt.Sprintf("生成机会审批流:chance_id:%v audit_id:%v audit_level:%v audit_user:%v action_type:%v", chanceId, item.Id, config.Level, uid, resolveActionType(config.ActionType))) |
504 | v = append(v, item) | 518 | v = append(v, item) |
505 | } | 519 | } |
506 | } | 520 | } |
@@ -634,3 +648,57 @@ func jsonUnmarshal(jsonData string, v interface{}) { | @@ -634,3 +648,57 @@ func jsonUnmarshal(jsonData string, v interface{}) { | ||
634 | log.Error("json.unmarshal error data:", jsonData, e) | 648 | log.Error("json.unmarshal error data:", jsonData, e) |
635 | } | 649 | } |
636 | } | 650 | } |
651 | + | ||
652 | +//机会详情 | ||
653 | +func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetailRequest) (rsp *protocol.ChanceDetailResponse, err error) { | ||
654 | + var ( | ||
655 | + chance *models.Chance | ||
656 | + chanceData *models.ChanceData | ||
657 | + provider *protocol.BaseUserInfo | ||
658 | + ) | ||
659 | + //检查是否可见 | ||
660 | + if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil { | ||
661 | + log.Error(err) | ||
662 | + return | ||
663 | + } | ||
664 | + if chance, err = models.GetChanceById(request.Id); err != nil { | ||
665 | + if err == orm.ErrNoRows { | ||
666 | + err = protocol.NewErrWithMessage(5101) | ||
667 | + return | ||
668 | + } | ||
669 | + log.Error(err) | ||
670 | + return | ||
671 | + } | ||
672 | + item := protocol.ChanceItem{ | ||
673 | + Id: chance.Id, | ||
674 | + Provider: provider, | ||
675 | + CreateTime: chance.CreateAt.Unix() * 1000, | ||
676 | + } | ||
677 | + jsonUnmarshal(chance.SourceContent, &item.FormList) | ||
678 | + if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { | ||
679 | + jsonUnmarshal(chanceData.Images, &item.Pictures) | ||
680 | + jsonUnmarshal(chanceData.Speechs, &item.Speechs) | ||
681 | + jsonUnmarshal(chanceData.Videos, &item.Videos) | ||
682 | + } | ||
683 | + rsp = &protocol.ChanceDetailResponse{} | ||
684 | + return | ||
685 | +} | ||
686 | + | ||
687 | +//机会删除 | ||
688 | +func ChanceDelete(header *protocol.RequestHeader, request *protocol.ChanceDeleteRequest) (rsp *protocol.ChanceDeleteResponse, err error) { | ||
689 | + var ( | ||
690 | + chance *models.Chance | ||
691 | + ) | ||
692 | + if chance, err = models.GetChanceById(request.Id); err != nil { | ||
693 | + if err == orm.ErrNoRows { | ||
694 | + err = protocol.NewErrWithMessage(5101) | ||
695 | + return | ||
696 | + } | ||
697 | + log.Error(err) | ||
698 | + return | ||
699 | + } | ||
700 | + if chance != nil { | ||
701 | + } | ||
702 | + rsp = &protocol.ChanceDeleteResponse{} | ||
703 | + return | ||
704 | +} |
@@ -335,6 +335,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | @@ -335,6 +335,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | ||
335 | Company: protocol.Company{ | 335 | Company: protocol.Company{ |
336 | Id: userBaseAgg.Company.Id, | 336 | Id: userBaseAgg.Company.Id, |
337 | Name: userBaseAgg.Company.Name, | 337 | Name: userBaseAgg.Company.Name, |
338 | + CId: userBaseAgg.Company.UserCenterId, | ||
338 | }, | 339 | }, |
339 | }, | 340 | }, |
340 | } | 341 | } |
@@ -342,6 +343,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | @@ -342,6 +343,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) | ||
342 | rsp.User.Companys = append(rsp.User.Companys, protocol.Company{ | 343 | rsp.User.Companys = append(rsp.User.Companys, protocol.Company{ |
343 | Id: companys[i].Id, | 344 | Id: companys[i].Id, |
344 | Name: companys[i].Name, | 345 | Name: companys[i].Name, |
346 | + CId: companys[i].UserCenterId, | ||
345 | }) | 347 | }) |
346 | } | 348 | } |
347 | if topDep := agg.GetTopDepartment(userBaseAgg.Department); topDep.DepartmentId != 0 { | 349 | if topDep := agg.GetTopDepartment(userBaseAgg.Department); topDep.DepartmentId != 0 { |
-
请 注册 或 登录 后发表评论