...
|
...
|
@@ -27,6 +27,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) |
|
|
header.CompanyId,
|
|
|
request.ObjectType,
|
|
|
request.ChanceType,
|
|
|
0,
|
|
|
request.LastId,
|
|
|
request.PageSize)
|
|
|
if err != nil {
|
...
|
...
|
@@ -290,7 +291,7 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit |
|
|
}
|
|
|
//4.查询审核配置
|
|
|
//5.生成审核流
|
|
|
if auditFlows, err = GenAuditFlowProcess(header, chance.Id, template.Id, auditConfig); err != nil {
|
|
|
if auditFlows, err = GenAuditFlowProcess(header, chance.Id, chance.DepartmentId, template.Id, auditConfig); err != nil {
|
|
|
log.Error(err)
|
|
|
orm.Rollback()
|
|
|
return
|
...
|
...
|
@@ -628,7 +629,7 @@ func GenAuditFlowProcess_Submit(header *protocol.RequestHeader, chanceId int64, |
|
|
}
|
|
|
|
|
|
//生成审批流
|
|
|
func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templateId int64, auditConfig *protocol.AuditConfig) (v []*models.AuditFlowProcess, err error) {
|
|
|
func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, relatedDeparmentId int64, templateId int64, auditConfig *protocol.AuditConfig) (v []*models.AuditFlowProcess, err error) {
|
|
|
var (
|
|
|
configs []*models.AuditFlowConfig
|
|
|
IsSpecailAuditFlow bool = false
|
...
|
...
|
@@ -704,7 +705,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
var userIds []int64
|
|
|
switch config.AuditFlowType {
|
|
|
case protocol.AuditByDepartmentor:
|
|
|
if userIds, err = getDepartmentors(header); err != nil {
|
|
|
if userIds, err = getDepartmentors(header, relatedDeparmentId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -730,7 +731,7 @@ func GenAuditFlowProcess(header *protocol.RequestHeader, chanceId int64, templat |
|
|
uid = company.AdminId
|
|
|
}
|
|
|
if approver, err = models.GetUserByUcid(uid); err != nil {
|
|
|
log.Error(err)
|
|
|
log.Error(uid, err)
|
|
|
return
|
|
|
}
|
|
|
item := &models.AuditFlowProcess{
|
...
|
...
|
@@ -769,33 +770,28 @@ func resolveActionType(t uint) string { |
|
|
}
|
|
|
|
|
|
//获取部门长用户列表
|
|
|
func getDepartmentors(header *protocol.RequestHeader) (ids []int64, err error) {
|
|
|
func getDepartmentors(header *protocol.RequestHeader, relatedDeparmentId int64) (ids []int64, err error) {
|
|
|
var (
|
|
|
departments []*protocol.Department
|
|
|
departments *models.Department
|
|
|
)
|
|
|
if err = models.GetUserDepartments(header.Uid, header.CompanyId, &departments); err != nil {
|
|
|
log.Error(err)
|
|
|
//if err = models.GetUserDepartments(header.UserId, header.CompanyId, &departments); err != nil {
|
|
|
// log.Error(header.UserId,header.CompanyId,err)
|
|
|
// return
|
|
|
//}
|
|
|
if departments, err = models.GetDepartmentById(int(relatedDeparmentId)); err != nil {
|
|
|
log.Error(relatedDeparmentId, err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
for i := 0; i < len(departments); i++ {
|
|
|
d := departments[i]
|
|
|
//部门长存在
|
|
|
if len(d.ManagerString) > 0 {
|
|
|
var tmpIds []int64
|
|
|
if err = json.Unmarshal([]byte(d.ManagerString), &tmpIds); err == nil && len(ids) > 0 {
|
|
|
ids = append(ids, tmpIds...)
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
//部门长不存在
|
|
|
if d.PId == 0 {
|
|
|
ids = append(ids, 0)
|
|
|
continue
|
|
|
} else {
|
|
|
ids = append(ids, getParentDepartmentors(d.PId)...)
|
|
|
if len(departments.Managers) > 0 {
|
|
|
var tmpIds []int64
|
|
|
if err = json.Unmarshal([]byte(departments.Managers), &tmpIds); err == nil && len(ids) > 0 {
|
|
|
ids = append(ids, tmpIds...)
|
|
|
}
|
|
|
}
|
|
|
//部门长不存在
|
|
|
if len(ids) == 0 {
|
|
|
ids = append(ids, 0)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
@@ -888,7 +884,10 @@ func MySubmitChance(header *protocol.RequestHeader, request *protocol.MySubmitCh |
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
if request.ReviewStatus == protocol.ReviewStatusPass {
|
|
|
jsonUnmarshal(chance.ApproveData, &commItem.ApproveData)
|
|
|
var approveData protocol.ApproveData
|
|
|
jsonUnmarshal(chance.ApproveData, &approveData)
|
|
|
//commItem.ApproveData = approveData //TODO:删除不需要
|
|
|
commItem.Score = approveData.Score
|
|
|
}
|
|
|
rsp.List = append(rsp.List, commItem)
|
|
|
}
|
...
|
...
|
|