فهرست منبع

Merge branch 'master' of huangrui/CostAccount into dev

huangrui 4 سال پیش
والد
کامیت
e766408ff8

+ 5 - 1
src/main/java/com/imed/costaccount/mapper/CostShareLevelMapper.java

@@ -3,6 +3,9 @@ package com.imed.costaccount.mapper;
 import com.imed.costaccount.model.CostShareLevel;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 分摊层级对照表
@@ -12,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
  */
 @Mapper
 public interface CostShareLevelMapper extends BaseMapper<CostShareLevel> {
-	
+
+    List<Long> getMaxIds(@Param("hospId") Long hospId);
 }

+ 3 - 0
src/main/java/com/imed/costaccount/service/CostShareLevelService.java

@@ -54,5 +54,8 @@ public interface CostShareLevelService extends IService<CostShareLevel> {
      * @return
      */
     List<CostShareLevel> getListByLevelSort(ArrayList<String> targetLevelList, Long hospId);
+
+    List<Long> getMaxId(Long hospId);
+
 }
 

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

@@ -228,7 +228,8 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
     public void saveAllocationQuery(List<Allocation> list, List<CostCostingGroup> costingGroups, Long hospId) {
         List<AllocationQuery> saveList = new ArrayList<>();
-
+        List<Long> maxId = shareLevelService.getMaxId(hospId);
+        list = list.stream().filter(i -> maxId.contains(i.getTargetShareLevelId())).collect(Collectors.toList());
         list.forEach(i -> {
             Long accountShareId = i.getAccountShareId();
             CostAccountShare byId = accountShareService.getById(accountShareId);

+ 6 - 0
src/main/java/com/imed/costaccount/service/impl/CostShareLevelServiceImpl.java

@@ -151,4 +151,10 @@ public class CostShareLevelServiceImpl extends ServiceImpl<CostShareLevelMapper,
                         .eq(CostShareLevel::getHospId, hospId)
         );
     }
+
+    @Override
+    public List<Long> getMaxId(Long hospId) {
+        List<Long> ids = baseMapper.getMaxIds(hospId);
+        return ids;
+    }
 }

+ 6 - 0
src/main/resources/mapper/CostShareLevelMapper.xml

@@ -14,6 +14,12 @@
         <result property="createTime" column="create_time"/>
         <result property="deleteTime" column="delete_time"/>
     </resultMap>
+    <select id="getMaxIds" resultType="java.lang.Long">
+        select *
+        from cost_share_level
+        where hosp_id = #{hospId}
+          and lever_sort = (select max(lever_sort) from cost_share_level where hosp_id = #{hospId})
+    </select>
 
 
 </mapper>