|
@@ -66,13 +66,39 @@ public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMap
|
|
|
.orderByAsc(CostAccountShare::getShareLevel));
|
|
|
List<CostAccountShare> costAccountShareList = pages.getRecords();
|
|
|
List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
|
|
|
- // 设置责任中心的数据 与 会计科目的数据从对应的id里面获取
|
|
|
-
|
|
|
+ getMessage(hospId, costAccountShareList);
|
|
|
+ //
|
|
|
PageUtils pageUtils = new PageUtils(pages);
|
|
|
pageUtils.setList(costAccountShareVOList);
|
|
|
return pageUtils;
|
|
|
}
|
|
|
|
|
|
+ private void getMessage(Integer hospId, List<CostAccountShare> costAccountShareList) {
|
|
|
+ // 设置责任中心的数据 与 会计科目的数据从对应的id里面获取
|
|
|
+ List<Responsibility> list = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
|
|
|
+ List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
|
|
|
+ Map<Integer, List<Responsibility>> resMap = list.stream().collect(Collectors.groupingBy(Responsibility::getId));
|
|
|
+ Map<Integer, List<Accounting>> accountMap = accountingList.stream().collect(Collectors.groupingBy(Accounting::getId));
|
|
|
+ costAccountShareList.forEach(i->{
|
|
|
+ Integer id = i.getResponsibilityId();
|
|
|
+ List<Responsibility> responsibilities = resMap.get(id);
|
|
|
+ if (!CollectionUtils.isEmpty(responsibilities)){
|
|
|
+ i.setResponsibilityId(id);
|
|
|
+ i.setResponsibilityName(responsibilities.get(0).getResponsibilityName());
|
|
|
+ i.setResponsibilityCode(responsibilities.get(0).getResponsibilityCode());
|
|
|
+ }
|
|
|
+ Integer accountingId = i.getAccountingId();
|
|
|
+ if (accountingId>0){
|
|
|
+ List<Accounting> accountingList1 = accountMap.get(accountingId);
|
|
|
+ if (!CollectionUtils.isEmpty(accountingList1)){
|
|
|
+ i.setAccountingId(accountingId);
|
|
|
+ i.setAccountingName(accountingList1.get(0).getAccountingName());
|
|
|
+ i.setAccountingCode(accountingList1.get(0).getAccountingCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存责任中心成本对照表
|
|
|
*
|