|
@@ -13,6 +13,7 @@ import com.imed.costaccount.model.dto.CostAccountShareEditDto;
|
|
|
import com.imed.costaccount.model.dto.CostAccountShareSaveDto;
|
|
|
import com.imed.costaccount.model.dto.ShareParamEditDto;
|
|
|
import com.imed.costaccount.model.vo.CostAccountShareVO;
|
|
|
+import com.imed.costaccount.model.vo.CostShareParamStatusVO;
|
|
|
import com.imed.costaccount.model.vo.CostShareParamVO;
|
|
|
import com.imed.costaccount.model.vo.ShareParamProportionVO;
|
|
|
import com.imed.costaccount.service.CostAccountShareService;
|
|
@@ -124,9 +125,13 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
|
if (costAccountShareSaveDto.getAccountingId()>0 && NumberConstant.ZERO.equals(costShareLevel.getCalcType())){
|
|
|
throw new CostException(500,"合并计算不允许选择成本科目");
|
|
|
}
|
|
|
+ if (costAccountShareSaveDto.getAccountingId()<= 0 && NumberConstant.ONE.equals(costShareLevel.getCalcType())){
|
|
|
+ throw new CostException(500,"分开计算需要选择成本科目");
|
|
|
+ }
|
|
|
}else {
|
|
|
throw new CostException(500,"对不起该责任中心没有对应分摊层级");
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -229,4 +234,33 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
|
return JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 成本分摊参数中被分摊参数对应选中的状态
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param hospId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<CostShareParamStatusVO> getAllShareParamStatusById(Integer id, Integer hospId) {
|
|
|
+ List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
|
|
|
+ CostAccountShare costAccountShare = baseMapper.selectById(id);
|
|
|
+ if (Objects.isNull(costAccountShare)){
|
|
|
+ throw new CostException(500,"成本分摊对应数据不存在");
|
|
|
+ }
|
|
|
+ String paramList = costAccountShare.getParamList();
|
|
|
+ List<CostShareParamStatusVO> costShareParamStatusVOList = BeanUtil.convertList(costShareParamServiceAll, CostShareParamStatusVO.class);
|
|
|
+ if (!StringUtils.isEmpty(paramList)) {
|
|
|
+ List<ShareParamProportionVO> shareParamProportionVOList = JsonUtil.toList(paramList, ShareParamProportionVO.class);
|
|
|
+ Map<Integer, List<ShareParamProportionVO>> map = shareParamProportionVOList.stream().collect(Collectors.groupingBy(ShareParamProportionVO::getId));
|
|
|
+ costShareParamStatusVOList.forEach(i -> {
|
|
|
+ Integer paramId = i.getId();
|
|
|
+ if (!CollectionUtils.isEmpty(map.get(paramId))) {
|
|
|
+ i.setShareParamStatus(NumberConstant.ONE);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return costShareParamStatusVOList;
|
|
|
+ }
|
|
|
+
|
|
|
}
|