|
|
|
|
@ -37,14 +37,14 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
|
|
|
|
|
private final BusinessLogMapper businessLogMapper; |
|
|
|
|
|
|
|
|
|
private final SupDepartMapper supDepartMapper; |
|
|
|
|
|
|
|
|
|
private final ModelClueService modelClueService; |
|
|
|
|
|
|
|
|
|
private final SupExternalDepartService externalDepartService; |
|
|
|
|
|
|
|
|
|
private final GBaseAJJBXXMapper gBaseAJJBXXMapper; |
|
|
|
|
|
|
|
|
|
private final SupExternalDepartMapper supExternalDepartMapper; |
|
|
|
|
|
|
|
|
|
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) { |
|
|
|
|
// 测基础数据
|
|
|
|
|
if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) { |
|
|
|
|
@ -110,29 +110,24 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
if (departIds.isEmpty()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> idsByDepartIds = supDepartMapper.getIdsByDepartIds(departIds);// 430100221100-1011
|
|
|
|
|
List<Map<String, Object>> idsByCode = supDepartMapper.getIdsByCode(departIds); |
|
|
|
|
Map<String, String> resultMap2 = idsByDepartIds.stream().collect(Collectors.toMap(map -> (String) map.get("domain_name"), map -> (String) map.get("id"))); |
|
|
|
|
List<Map<String, Object>> idsByDepartIds = supExternalDepartMapper.getIdsByDepartIds(departIds);// 430100221100-1011
|
|
|
|
|
Map<String, String> resultMap2 = idsByDepartIds.stream().filter(map -> map.get("external_id") != null).collect(Collectors.toMap( |
|
|
|
|
map -> (String) map.get("external_id"), |
|
|
|
|
map -> map.get("internal_id") == null ? "" : (String) map.get("internal_id") |
|
|
|
|
)); |
|
|
|
|
List<String> values = resultMap2.values().stream().filter(Objects::nonNull).toList();// 1011
|
|
|
|
|
Map<String, String> resultMap3 = idsByCode.stream().collect(Collectors.toMap(map -> (String) map.get("code"), map -> (String) map.get("id"))); |
|
|
|
|
List<String> values3 = resultMap3.values().stream().filter(Objects::nonNull).toList();// 1011
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>(); |
|
|
|
|
if (!values.isEmpty()) { |
|
|
|
|
resultList = statisticsDepartMapper.getGroupIdsByDepartIds(values); |
|
|
|
|
} |
|
|
|
|
List<Map<String, Object>> resultList2 = new ArrayList<>(); |
|
|
|
|
if (!values3.isEmpty()) { |
|
|
|
|
resultList2 = statisticsDepartMapper.getGroupIdsByDepartIds(values3); |
|
|
|
|
} |
|
|
|
|
if (resultList.isEmpty() && resultList2.isEmpty()) { |
|
|
|
|
if (resultList.isEmpty()) { |
|
|
|
|
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(0).setCreateTime(LocalDateTime.now())); |
|
|
|
|
log.info("{}没有单位数据", happenTime.get(0)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Map<String, Long> resultMap = resultList.stream().collect(Collectors.toMap(map -> (String) map.get("departId"), map -> (Long) map.get("groupId"))); |
|
|
|
|
Map<String, Long> resultMap4 = resultList2.stream().collect(Collectors.toMap(map -> (String) map.get("departId"), map -> (Long) map.get("groupId"))); |
|
|
|
|
List<Long> groupIds = new ArrayList<>(); |
|
|
|
|
generateBusinessDepartList(happenTime, gBaseJJDSList, resultMap, resultMap2, resultMap4, groupIds, businessDepartList, gBaseAJJBXXListSA, gBaseAJJBXXListLA, gBaseAJJBXXListPA); |
|
|
|
|
generateBusinessDepartList(happenTime, gBaseJJDSList, resultMap, resultMap2, groupIds, businessDepartList, gBaseAJJBXXListSA, gBaseAJJBXXListLA, gBaseAJJBXXListPA); |
|
|
|
|
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds); |
|
|
|
|
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(map -> (Long) map.get("groupId"), map -> (String) map.get("name"))); |
|
|
|
|
for (BusinessDepart businessDepart : businessDepartList) { |
|
|
|
|
@ -146,11 +141,11 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(gBaseJJDSList.size() + gBaseAJJBXXListSA.size() + gBaseAJJBXXListLA.size() + gBaseAJJBXXListPA.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void generateBusinessDepartList(List<Date> happenTime, List<GBaseJJD> gBaseJJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, Map<String, Long> resultMap4, List<Long> groupIds, List<BusinessDepart> businessDepartList, List<GBaseAJJBXX> gBaseAJJBXXListSA, List<GBaseAJJBXX> gBaseAJJBXXListLA, List<GBaseAJJBXX> gBaseAJJBXXListPA) { |
|
|
|
|
private static void generateBusinessDepartList(List<Date> happenTime, List<GBaseJJD> gBaseJJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, List<Long> groupIds, List<BusinessDepart> businessDepartList, List<GBaseAJJBXX> gBaseAJJBXXListSA, List<GBaseAJJBXX> gBaseAJJBXXListLA, List<GBaseAJJBXX> gBaseAJJBXXListPA) { |
|
|
|
|
for (GBaseJJD gBaseJJD : gBaseJJDSList) { |
|
|
|
|
Long groupId = resultMap.get(resultMap2.get(gBaseJJD.getGxdwdm())); |
|
|
|
|
if (groupId == null) { |
|
|
|
|
groupId = resultMap4.get(resultMap2.get(gBaseJJD.getGxdwdm())); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
groupIds.add(groupId); |
|
|
|
|
BusinessDepart businessDepart = getJJDBusinessDepart(happenTime, gBaseJJD, groupId); |
|
|
|
|
@ -159,7 +154,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListSA) { |
|
|
|
|
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
if (groupId == null) { |
|
|
|
|
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
groupIds.add(groupId); |
|
|
|
|
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 1); |
|
|
|
|
@ -168,7 +163,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListLA) { |
|
|
|
|
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
if (groupId == null) { |
|
|
|
|
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
groupIds.add(groupId); |
|
|
|
|
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 2); |
|
|
|
|
@ -177,7 +172,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
|
|
|
|
|
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListPA) { |
|
|
|
|
Long groupId = resultMap.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
if (groupId == null) { |
|
|
|
|
groupId = resultMap4.get(resultMap2.get(gBaseAJJBXX.getBADWIDdm())); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
groupIds.add(groupId); |
|
|
|
|
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 3); |
|
|
|
|
|