ljx il y a 4 ans
Parent
commit
56941cdb93

+ 13 - 4
src/main/java/com/imed/costaccount/service/impl/ShareParamValueServiceImpl.java

@@ -20,7 +20,7 @@ import com.imed.costaccount.model.dto.ShareParamValueSaveDTO;
 import com.imed.costaccount.model.dto.ShareParamValueVO;
 import com.imed.costaccount.model.vo.IncomeErrorMessage;
 import com.imed.costaccount.service.*;
-import io.lettuce.core.Limit;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
 import static cn.hutool.core.date.DatePattern.PURE_DATE_PATTERN;
 import static com.imed.costaccount.common.constants.Constant.LIMIT;
 
-
+@Slf4j
 @Service("shareParamValueService")
 public class ShareParamValueServiceImpl extends ServiceImpl<ShareParamValueMapper, ShareParamValue> implements ShareParamValueService {
 
@@ -462,15 +462,24 @@ public class ShareParamValueServiceImpl extends ServiceImpl<ShareParamValueMappe
             });
             i.setCalcList(calcList);
         });
+        log.info("list={}", accountCodes);
         List<IncomeCollection> incomeCollections = incomeCollectionService.list(
                 new LambdaQueryWrapper<IncomeCollection>()
                         .eq(IncomeCollection::getYear, year)
                         .eq(IncomeCollection::getMonth, month)
                         .eq(IncomeCollection::getHospId, hospId)
-                        .in(IncomeCollection::getAccountingCode, accountCodes)
+                        .in(IncomeCollection::getAccountingCode, accountCodes.stream().distinct().collect(Collectors.toList()))
         );
         if (incomeCollections.isEmpty()) {
-            throw new CostException("本月未归集数据,请先归集数据");
+            List<IncomeCollection> collections = incomeCollectionService.list(
+                    new LambdaQueryWrapper<IncomeCollection>()
+                            .eq(IncomeCollection::getYear, year)
+                            .eq(IncomeCollection::getMonth, month)
+                            .eq(IncomeCollection::getHospId, hospId));
+            if (collections.isEmpty()) {
+                throw new CostException("本月未归集数据,请先归集数据");
+            }
+            return ;
         }
 
         Map<String, List<IncomeCollection>> collectMap = incomeCollections.stream()