|
|
|
|
@ -11,10 +11,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
|
@ -32,6 +29,8 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
|
|
|
|
|
|
|
|
|
|
private final GBaseCJDMapper gBaseCJDMapper; |
|
|
|
|
|
|
|
|
|
public final ModelClueDataMapper modelClueDataMapper; |
|
|
|
|
|
|
|
|
|
public void insertPreData() { |
|
|
|
|
List<SupExternalDepart> supExternalDeparts = new ArrayList<>(); |
|
|
|
|
Set<String> dms = new HashSet<>(); |
|
|
|
|
@ -39,6 +38,7 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
|
|
|
|
|
selectAJJBXX(2, supExternalDeparts, dms); |
|
|
|
|
selectAJJBXX(3, supExternalDeparts, dms); |
|
|
|
|
selectJJDandCJD(dms, supExternalDeparts); |
|
|
|
|
selectWFQYZFRYB(dms, supExternalDeparts); |
|
|
|
|
List<SupDepart> supDeparts = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getCode, dms)); |
|
|
|
|
for (SupExternalDepart supExternalDepart : supExternalDeparts) { |
|
|
|
|
SupDepart supDepart = supDeparts.stream().filter(item -> item.getCode().equals(supExternalDepart.getExternalId())).findFirst().orElse(null); |
|
|
|
|
@ -46,18 +46,20 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
|
|
|
|
|
supExternalDepart.setInternalId(supDepart.getId()); |
|
|
|
|
supExternalDepart.setInternalName(supDepart.getName()); |
|
|
|
|
supExternalDepart.setInternalShortName(supDepart.getShortName()); |
|
|
|
|
supExternalDepart.setStatus(0); |
|
|
|
|
supExternalDepart.setCreateTime(LocalDateTime.now()); |
|
|
|
|
supExternalDepart.setLevel(supDepart.getLevel()); |
|
|
|
|
supExternalDepart.setPid(supDepart.getPid()); |
|
|
|
|
} |
|
|
|
|
supExternalDepart.setStatus(0); |
|
|
|
|
supExternalDepart.setCreateTime(LocalDateTime.now()); |
|
|
|
|
} |
|
|
|
|
supExternalDepartMapper.insert(supExternalDeparts); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void selectJJDandCJD(Set<String> dms, List<SupExternalDepart> supExternalDeparts) { |
|
|
|
|
List<GBaseJJD> gBaseJJDS = gBaseJJDMapper.selectList(new QueryWrapper<GBaseJJD>().select("DISTINCT gxdwdm, gxdwmc")); |
|
|
|
|
List<GBaseJJD> gBaseJJDS = gBaseJJDMapper.selectList(new QueryWrapper<GBaseJJD>().select("DISTINCT gxdwdm, gxdwmc").ge("bjsj", "2022-10-01")); |
|
|
|
|
if (!gBaseJJDS.isEmpty()) { |
|
|
|
|
gBaseJJDS.forEach(item -> { |
|
|
|
|
if (item != null && !dms.contains(item.getGxdwdm()) && item.getGxdwdm() != null && !item.getGxdwdm().isEmpty()) { |
|
|
|
|
if (item != null && item.getGxdwdm() != null && !item.getGxdwdm().isEmpty() && !dms.contains(item.getGxdwdm())) { |
|
|
|
|
SupExternalDepart supExternalDepart = new SupExternalDepart(); |
|
|
|
|
supExternalDepart.setExternalId(item.getGxdwdm()); |
|
|
|
|
supExternalDepart.setExternalName(item.getGxdwmc() == null ? "" : item.getGxdwmc()); |
|
|
|
|
@ -67,10 +69,10 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
List<GBaseCJD> gBaseCJDS = gBaseCJDMapper.selectList(new QueryWrapper<GBaseCJD>().select("DISTINCT cjdxssdwdm, cjdxssdwmc")); |
|
|
|
|
List<GBaseCJD> gBaseCJDS = gBaseCJDMapper.selectList(new QueryWrapper<GBaseCJD>().select("DISTINCT cjdxssdwdm, cjdxssdwmc").ge("cjsj", "2022-10-01")); |
|
|
|
|
if (!gBaseCJDS.isEmpty()) { |
|
|
|
|
gBaseCJDS.forEach(item -> { |
|
|
|
|
if (item != null && !dms.contains(item.getCjdxssdwdm()) && item.getCjdxssdwdm() != null && !item.getCjdxssdwdm().isEmpty()) { |
|
|
|
|
if (item != null && item.getCjdxssdwdm() != null && !item.getCjdxssdwdm().isEmpty() && !dms.contains(item.getCjdxssdwdm())) { |
|
|
|
|
SupExternalDepart supExternalDepart = new SupExternalDepart(); |
|
|
|
|
supExternalDepart.setExternalId(item.getCjdxssdwdm()); |
|
|
|
|
supExternalDepart.setExternalName(item.getCjdxssdwmc() == null ? "" : item.getCjdxssdwmc()); |
|
|
|
|
@ -82,15 +84,31 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void selectWFQYZFRYB(Set<String> dms, List<SupExternalDepart> supExternalDeparts) { |
|
|
|
|
List<Map<String, Object>> jjdmaps = modelClueDataMapper.selectByUniqueKeys("SELECT DISTINCT csid, csmc FROM dwd_ry_zfba_zfqywfryb WHERE STR_TO_DATE(djsj, '%Y%m%d%H%i%s') > '2022-10-01';"); |
|
|
|
|
if (!jjdmaps.isEmpty()) { |
|
|
|
|
jjdmaps.forEach(item -> { |
|
|
|
|
if (item != null && (String)item.get("csid") != null && !Objects.equals(item.get("csid"), "") && !dms.contains((String)item.get("csid"))) { |
|
|
|
|
SupExternalDepart supExternalDepart = new SupExternalDepart(); |
|
|
|
|
supExternalDepart.setExternalId((String)item.get("csid")); |
|
|
|
|
supExternalDepart.setExternalName(item.get("csmc") == null ? "" : (String)item.get("csmc")); |
|
|
|
|
dms.add((String)item.get("csid")); |
|
|
|
|
supExternalDepart.setSource("情指行"); |
|
|
|
|
supExternalDeparts.add(supExternalDepart); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@DS("slave2") |
|
|
|
|
private void selectAJJBXX(int type, List<SupExternalDepart> result, Set<String> dms) { |
|
|
|
|
QueryWrapper<GBaseAJJBXX> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
if (type == 1) { |
|
|
|
|
queryWrapper.select("DISTINCT LADWBMdm, LADWBMmc"); |
|
|
|
|
queryWrapper.select("DISTINCT LADWBMdm, LADWBMmc").ge("BARQ", "2022-10-01"); |
|
|
|
|
} else if (type == 2) { |
|
|
|
|
queryWrapper.select("DISTINCT PADWBMdm, PADWBMmc"); |
|
|
|
|
queryWrapper.select("DISTINCT PADWBMdm, PADWBMmc").ge("BARQ", "2022-10-01"); |
|
|
|
|
} else if (type == 3) { |
|
|
|
|
queryWrapper.select("DISTINCT BADWIDdm, BADWIDmc"); |
|
|
|
|
queryWrapper.select("DISTINCT BADWIDdm, BADWIDmc").ge("BARQ", "2022-10-01"); |
|
|
|
|
} else { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|