|
@@ -579,16 +579,41 @@ func getAddChapter(reportInfo *models.Report, minClassifyId, inheritReportId int
|
|
|
chapterItem.ReportLayout = chapterNewest.ReportLayout
|
|
|
chapterItem.ReportCreateTime = time.Now()
|
|
|
|
|
|
- // 继承历史章节中的授权用户列表
|
|
|
- tmpGrantList, ok = oldChapterIdGrantListMap[chapterNewest.ReportChapterId]
|
|
|
- if !ok {
|
|
|
- tmpGrantList = make([]*report.ReportChapterGrant, 0)
|
|
|
- }
|
|
|
- // 继承历史章节中的关联品种列表
|
|
|
- tmpChapterPermissionList, ok = oldChapterPermissionListMap[chapterNewest.ReportChapterId]
|
|
|
- if !ok {
|
|
|
- tmpChapterPermissionList = make([]*report.ReportChapterPermissionMapping, 0)
|
|
|
+ // 这里的授权和品种权限需要额外查询
|
|
|
+ tmpGrantList = make([]*report.ReportChapterGrant, 0)
|
|
|
+ tmpChapterPermissionList = make([]*report.ReportChapterPermissionMapping, 0)
|
|
|
+ {
|
|
|
+ grantOb := report.ReportChapterGrant{}
|
|
|
+ chapterGrant, e := grantOb.GetGrantListById(chapterNewest.ReportChapterId)
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "获取待继承的报告章节的授权用户列表失败"
|
|
|
+ err = fmt.Errorf("获取待继承的报告章节的授权用户列表失败, ChapterId: %d, Err: %v", chapterNewest.ReportChapterId, e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, cg := range chapterGrant {
|
|
|
+ // 如果不在报告授权的用户ID里面,那么该章节就不继承该授权用户
|
|
|
+ if _, ok := needAdminIdMap[cg.AdminId]; !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ cg.ReportChapterId = 0
|
|
|
+ cg.GrantId = 0
|
|
|
+ tmpGrantList = append(tmpGrantList, cg)
|
|
|
+ }
|
|
|
+
|
|
|
+ permissionOb := report.ReportChapterPermissionMapping{}
|
|
|
+ permissions, e := permissionOb.GetPermissionListById(chapterNewest.ReportChapterId)
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "获取待继承的报告章节的品种权限失败"
|
|
|
+ err = fmt.Errorf("获取待继承的报告章节的品种权限失败, ChapterId: %d, Err: %v", chapterNewest.ReportChapterId, e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, ps := range permissions {
|
|
|
+ ps.ReportChapterId = 0
|
|
|
+ ps.ReportChapterPermissionMappingId = 0
|
|
|
+ tmpChapterPermissionList = append(tmpChapterPermissionList, ps)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
findChapter = true
|
|
|
}
|
|
|
}
|