|
@@ -67,6 +67,7 @@ import java.util.stream.IntStream;
|
|
|
|
|
|
import static com.kcim.common.constants.Constant.PROFIT_REPORT_TYPE;
|
|
|
import static com.kcim.common.constants.ParameterConstant.MEDICAL_TECHNIQUES_SHARE_LEVEL_ID;
|
|
|
+import static com.kcim.common.constants.ParameterConstant.USER_REPORT_AUTHOR_ABLE;
|
|
|
|
|
|
|
|
|
@Service("costDepartmentProfitService")
|
|
@@ -108,6 +109,9 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
|
private final AccountingService accountingService;
|
|
|
|
|
|
private final CostAccountShareService costAccountShareService;
|
|
|
+
|
|
|
+ private final UserResponsibilityRightService userResponsibilityRightService ;
|
|
|
+
|
|
|
private final String AMOUNT = "金额";
|
|
|
|
|
|
private final String PERCENT = "占比";
|
|
@@ -116,7 +120,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
|
|
|
|
private final String PERCENT_FIELD = "percent";
|
|
|
|
|
|
- public CostDepartmentProfitServiceImpl(ReportFormService reportFormService, IncomeCollectionService incomeCollectionService, CostShareLevelService costShareLevelService, ResponsibilityService responsibilityService, ReportRelationService reportRelationService, AllocationService allocationService, AllocationQueryService allocationQueryService, FileRecordService fileRecordService, MinioConfig minioConfig, MinioFileUtil minioFileUtil, CenterService centerService, CostDepartmentProfitRepository costDepartmentProfitRepository, ComputeLastProfitDateRepository computeLastProfitDateRepository, AccountingService accountingService, CostAccountShareService costAccountShareService) {
|
|
|
+ public CostDepartmentProfitServiceImpl(ReportFormService reportFormService, IncomeCollectionService incomeCollectionService, CostShareLevelService costShareLevelService, ResponsibilityService responsibilityService, ReportRelationService reportRelationService, AllocationService allocationService, AllocationQueryService allocationQueryService, FileRecordService fileRecordService, MinioConfig minioConfig, MinioFileUtil minioFileUtil, CenterService centerService, CostDepartmentProfitRepository costDepartmentProfitRepository, ComputeLastProfitDateRepository computeLastProfitDateRepository, AccountingService accountingService, CostAccountShareService costAccountShareService,UserResponsibilityRightService userResponsibilityRightService) {
|
|
|
this.reportFormService = reportFormService;
|
|
|
this.incomeCollectionService = incomeCollectionService;
|
|
|
this.costShareLevelService = costShareLevelService;
|
|
@@ -132,6 +136,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
|
this.computeLastProfitDateRepository = computeLastProfitDateRepository;
|
|
|
this.accountingService = accountingService;
|
|
|
this.costAccountShareService = costAccountShareService;
|
|
|
+ this.userResponsibilityRightService=userResponsibilityRightService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1590,6 +1595,21 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
|
if (CollectionUtils.isEmpty(responsibilityList)) {
|
|
|
throw new CostException("未找到对应分摊层级责任中心");
|
|
|
}
|
|
|
+ //开启用户报表数据权限时
|
|
|
+ if(IsUserReportRightAble()){
|
|
|
+ //获取用户所有有权限的责任中心
|
|
|
+ List<UserResponsibilityRight> currentUserResponsibilityRights = userResponsibilityRightService.getUserResponsibilityRight();
|
|
|
+ if(CollectionUtils.isEmpty(currentUserResponsibilityRights)){
|
|
|
+ throw new CostException("您没有分配责任中心权限,请联系管理员");
|
|
|
+ }
|
|
|
+ //筛选出有权限的责任中心对象
|
|
|
+ responsibilityList = responsibilityList.stream().filter(responsibility ->
|
|
|
+ currentUserResponsibilityRights.stream().anyMatch(userRight ->
|
|
|
+ userRight.getResponsibilityCode().equals(responsibility.getResponsibilityCode()))).collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isEmpty(responsibilityList)){
|
|
|
+ throw new CostException("您没有对应的责任中心权限,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
List<Responsibility> responsibilityAllList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
|
|
|
.eq(Responsibility::getHospId, hospId));
|
|
|
Map<Long, Responsibility> map = responsibilityAllList.stream().collect(Collectors.toMap(Responsibility::getId, responsibility -> responsibility, (a, b) -> b));
|
|
@@ -1623,6 +1643,19 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
|
|
|
return responsibilities;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断是否开启用户报表权限功能
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean IsUserReportRightAble(){
|
|
|
+ CommonParameterVo parameter = centerService.getParameter(USER_REPORT_AUTHOR_ABLE);
|
|
|
+ if (Objects.isNull(parameter)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String incomeCollectType = parameter.getValue();
|
|
|
+ return incomeCollectType.equals(NumberConstant.ONE_S);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void getResponsibilityParent(Responsibility responsibility, Map<Long, Responsibility> collect, List<Responsibility> addList) {
|
|
|
Responsibility responsibility1 = collect.get(responsibility.getParentId());
|