|
@@ -328,20 +328,24 @@ func GetTotalPageCountByPermissionIds(permissionIds []int, isLogin bool, userId
|
|
|
//}
|
|
|
}
|
|
|
func filterPermissionsByRisk(permissionList []permissionService.PermissionDTO, riskLevel string) (resultList []permissionService.PermissionDTO) {
|
|
|
- riskLevelNum, err := parseRiskLevel(riskLevel)
|
|
|
- if err != nil {
|
|
|
- logger.Error("风险等级解析失败:%v", err)
|
|
|
- return
|
|
|
- }
|
|
|
- for _, permission := range permissionList {
|
|
|
- pRiskNum, riskErr := parseRiskLevel(permission.RiskLevel)
|
|
|
- if riskErr != nil {
|
|
|
- logger.Error("解析品种风险等级失败 permission:%d,risk:%v", permission.PermissionId, permission.RiskLevel)
|
|
|
- continue
|
|
|
+ if riskLevel != "" {
|
|
|
+ riskLevelNum, err := parseRiskLevel(riskLevel)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("风险等级解析失败:%v", err)
|
|
|
+ return
|
|
|
}
|
|
|
- if pRiskNum <= riskLevelNum {
|
|
|
- resultList = append(resultList, permission)
|
|
|
+ for _, permission := range permissionList {
|
|
|
+ pRiskNum, riskErr := parseRiskLevel(permission.RiskLevel)
|
|
|
+ if riskErr != nil {
|
|
|
+ logger.Error("解析品种风险等级失败 permission:%d,risk:%v", permission.PermissionId, permission.RiskLevel)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if pRiskNum <= riskLevelNum {
|
|
|
+ resultList = append(resultList, permission)
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ resultList = permissionList
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -1024,11 +1028,13 @@ func checkUserRisk(permissionIds []int, isLogin bool, userId int) (filterPermiss
|
|
|
if userProfile.RiskLevelStatus == user.RiskExpired {
|
|
|
logger.Warn("客户风险等级已过期,mobile:%v", userProfile.Mobile)
|
|
|
}
|
|
|
- mapping, mappingErr := permissionService.GetRiskMappingByCustomerRiskLevel(userProfile.RiskLevel)
|
|
|
- if mappingErr != nil {
|
|
|
- logger.Error("查询产品风险等级映射失败:%v", mappingErr)
|
|
|
- err = mappingErr
|
|
|
- return
|
|
|
+ var mapping permissionService.CustomerProductRiskMappingDTO
|
|
|
+ if userProfile.RiskLevel != "" {
|
|
|
+ mapping, err = permissionService.GetRiskMappingByCustomerRiskLevel(userProfile.RiskLevel)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("查询产品风险等级映射失败:%v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
var permissionList []permissionService.PermissionDTO
|
|
|
if len(permissionIds) == 0 {
|