songhuangfeng123
2022-08-05 d887d1db33d88948c71c5af670033382079bb250
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/TargetDutySummaryServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.targetDuty.repository.TargetDutySummaryRepository;
import com.gkhy.safePlatform.targetDuty.entity.TargetDutySummary;
import com.gkhy.safePlatform.targetDuty.service.CommonService;
import com.gkhy.safePlatform.targetDuty.service.TargetDutySummaryService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +18,11 @@
import com.gkhy.safePlatform.targetDuty.utils.QueryHelpPlus;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * (TargetDutySummary)表服务实现类
@@ -30,7 +35,9 @@
    @Autowired
    private TargetDutySummaryRepository targetDutySummaryRepository;
    @Resource
    private CommonService commonService;
    
   
   @Override
@@ -43,7 +50,18 @@
                QueryHelpPlus.getPredicate(TargetDutySummary.class, pageQuery.getSearchParams()));
        List<TargetDutySummaryDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), TargetDutySummaryDto.class);
        // TODO:获取责任部门名称
        // --------------------------- 获取部门信息-----------------------
        //收集所用到的部门ID
        Set<Long> collectDepIdSet = new HashSet();
        respList.forEach(f->{
            collectDepIdSet.add(f.getDepartmentId());
        });
        //获取部门名集合
        Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet);
        respList.forEach(f->{
            f.setDepartmentName(depNameMap.get(f.getDepartmentId()));
        });
        return new SearchResultVO<>(
                true,