|  | @@ -29,8 +29,11 @@ import com.xunmei.system.api.domain.SysDictData;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.vo.FindOrgTypes;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.vo.SysOrgVO;
 | 
	
		
			
				|  |  | +import com.xunmei.system.domain.SysPhysicalDefenseConstruction;
 | 
	
		
			
				|  |  |  import com.xunmei.system.dto.SysOrgDto;
 | 
	
		
			
				|  |  | +import com.xunmei.system.dto.SysPhysicalDefenseConstructionDTO;
 | 
	
		
			
				|  |  |  import com.xunmei.system.mapper.SysOrgMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.system.mapper.SysPhysicalDefenseConstructionMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.system.mapper.SysUserMapper;
 | 
	
		
			
				|  |  |  import com.xunmei.system.service.ISysOrgService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.util.*;
 | 
	
	
		
			
				|  | @@ -63,6 +66,9 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SysUserMapper sysUserMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysPhysicalDefenseConstructionMapper sysPhysicalDefenseConstructionMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private static List<SysOrg> handleTree(Map<Long, List<SysOrg>> map, Long parentId) {
 | 
	
		
			
				|  |  |          List<SysOrg> orgList = map.get(parentId);
 | 
	
		
			
				|  |  |          if (ObjectUtil.isNotEmpty(orgList)) {
 | 
	
	
		
			
				|  | @@ -153,14 +159,74 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 | 
	
		
			
				|  |  |              sysOrgs = this.selectSysOrgByPathAndType(sysOrg.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        List<SysOrg> allChildOrgs = this.selectSysOrgByPathAndType(sysOrg.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<SysPhysicalDefenseConstructionDTO> allOrgGA38Datas= sysPhysicalDefenseConstructionMapper.selectListByPath(sysOrg.getPath(),1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  |           *根据查询机构机构,统计查询数据
 | 
	
		
			
				|  |  |           */
 | 
	
		
			
				|  |  | -        List<OrgPhysicalDefenseConstructionExport> excelData = getExcelData(sysOrgs);
 | 
	
		
			
				|  |  | +        List<OrgPhysicalDefenseConstructionExport> excelData = getExcelData(sysOrgs,allChildOrgs,allOrgGA38Datas);
 | 
	
		
			
				|  |  |          return excelData;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +      * @param showOrgs
 | 
	
		
			
				|  |  | +     * @param allChildOrgs
 | 
	
		
			
				|  |  | +     * @param allOrgGA38Datas
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private List<OrgPhysicalDefenseConstructionExport> getExcelData(List<SysOrg> showOrgs, List<SysOrg> allChildOrgs, List<SysPhysicalDefenseConstructionDTO> allOrgGA38Datas){
 | 
	
		
			
				|  |  | +        List<OrgPhysicalDefenseConstructionExport> data = new ArrayList<>();
 | 
	
		
			
				|  |  | +        OrgPhysicalDefenseConstructionExport export = null;
 | 
	
		
			
				|  |  | +        for (SysOrg s : showOrgs) {
 | 
	
		
			
				|  |  | +            export = baseMapper.complianceStatus(s.getPath());
 | 
	
		
			
				|  |  | +            export.setCity(s.getAffiliatedArea());
 | 
	
		
			
				|  |  | +            export.setOrgName(s.getAffiliatedBank());
 | 
	
		
			
				|  |  | +            Integer orgSize = allChildOrgs.stream().filter(x->x.getPath().startsWith(s.getPath())).collect(Collectors.toList()).size();  //baseMapper.selectNetworkNumberByPath(s.getPath());
 | 
	
		
			
				|  |  | +            Double avg = 0d;
 | 
	
		
			
				|  |  | +            if (orgSize != 0 || export.getReachNumber() != 0) {
 | 
	
		
			
				|  |  | +                avg = (double) export.getReachNumber() / orgSize * 100;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            export.setReachRate(Double.valueOf(String.format("%.2f", avg)) + "%");
 | 
	
		
			
				|  |  | +            export.setNetworkNumber(orgSize);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //年度完成
 | 
	
		
			
				|  |  | +            LocalDate currentDate = LocalDate.now();
 | 
	
		
			
				|  |  | +            Date nowDate= DateUtil.beginOfDay(new Date());
 | 
	
		
			
				|  |  | +            String year = String.valueOf(currentDate.getYear());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            Integer s1 =allOrgGA38Datas.stream().filter(x->x.getOrgPath().startsWith(s.getPath()) && year.equals(DateUtil.format(x.getDateOfCompliance(),"yyyy")) && "1".equals(x.getStandard())).collect(Collectors.toList()).size(); //baseMapper.rectificationStatus(s.getPath(), year);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            Map<Long, List<SysPhysicalDefenseConstructionDTO>> orgGroupList = allOrgGA38Datas.stream().filter(x -> x.getOrgPath().startsWith(s.getPath())).collect(Collectors.groupingBy(ga38 -> ga38.getOrgId()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            AtomicInteger tempNewYeaTransformOldReachNumber=new  AtomicInteger();
 | 
	
		
			
				|  |  | +            AtomicInteger tempNewYeaTransformInconformityNumber=new  AtomicInteger();
 | 
	
		
			
				|  |  | +            orgGroupList.forEach((k,v)->{
 | 
	
		
			
				|  |  | +                // 今天达标 2021标
 | 
	
		
			
				|  |  | +                if(v.stream().anyMatch(x->"1".equals(x.getStandard()) && year.equals(DateUtil.format(x.getDateOfCompliance(),"yyyy"))))
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    // 存在 2015 标
 | 
	
		
			
				|  |  | +                    if(v.stream().anyMatch(y->"2".equals(y.getStandard())))
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        tempNewYeaTransformOldReachNumber.incrementAndGet();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    else{
 | 
	
		
			
				|  |  | +                        tempNewYeaTransformInconformityNumber.incrementAndGet();
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            export.setNewYearReachNumber(s1);
 | 
	
		
			
				|  |  | +            export.setNewYeaTransformOldReachNumber(tempNewYeaTransformOldReachNumber.get());
 | 
	
		
			
				|  |  | +            export.setNewYeaTransformInconformityNumber(tempNewYeaTransformInconformityNumber.get());
 | 
	
		
			
				|  |  | +            data.add(export);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return data;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 组装数据
 | 
	
		
			
				|  |  |       * @param orgs
 | 
	
		
			
				|  |  |       * @return
 |