Преглед на файлове

增加responsibilityId字段

ljx преди 4 години
родител
ревизия
e832615ec8

+ 2 - 0
src/main/java/com/imed/costaccount/model/vo/CostResponsibilityLevelVO.java

@@ -15,6 +15,8 @@ public class CostResponsibilityLevelVO {
     @ApiModelProperty(name = "id",value = "主键")
     private Integer id;
 
+    private Integer responsibilityId;
+
     @ApiModelProperty(name = "responsibilityName",value = "名称")
     private String responsibilityName;
 

+ 28 - 2
src/main/java/com/imed/costaccount/service/impl/CostAccountShareServiceImpl.java

@@ -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());
+                }
+            }
+        });
+    }
+
     /**
      * 保存责任中心成本对照表
      *

+ 1 - 1
src/main/java/com/imed/costaccount/service/impl/ResponsibilityServiceImpl.java

@@ -16,7 +16,6 @@ import com.imed.costaccount.model.vo.*;
 import com.imed.costaccount.service.ResponsibilityService;
 import com.imed.costaccount.utils.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -298,6 +297,7 @@ public class ResponsibilityServiceImpl extends ServiceImpl<ResponsibilityMapper,
         Map<Integer, List<CostShareLevelVO>> listMap = costShareLevelServiceAll.stream().collect(Collectors.groupingBy(CostShareLevelVO::getId));
         // 设置责任中心的计算方式
         costResponsibilityLevelVOS.forEach(i->{
+            i.setResponsibilityId(i.getId());
             Integer shareLevel = i.getShareLevel();
             List<CostShareLevelVO> costShareLevelVOList = listMap.get(shareLevel);
             if (!CollectionUtils.isEmpty(costShareLevelVOList)){

+ 1 - 1
src/main/java/com/imed/costaccount/web/CostAccountShareController.java

@@ -82,7 +82,7 @@ public class CostAccountShareController {
      * 在全部分摊参数里面显示当前责任中心已经存在的分摊参数
      */
     @GetMapping("/getAllShareParamStatusById")
-    @ApiOperation("在全部分摊参数里面显示当前责任中心已经存在的分摊参数")
+    @ApiOperation("在全部分摊参数里面显示当前责任中心已经存在的分摊参数的状态")
     public Result getAllShareParamStatusById(Integer id){
         User user = (User) SecurityUtils.getSubject().getPrincipal();
         Integer hospId = user.getHospId();