Browse Source

修改导入单位功能

main
sjh 1 year ago
parent
commit
dd1ea1ff72
  1. 4
      src/main/java/com/biutag/supervision/service/ModelClueService.java
  2. 42
      src/main/java/com/biutag/supervision/service/SupExternalDepartService.java

4
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -264,7 +264,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
List<ModelClue> jjdModelClues = new ArrayList<>(); List<ModelClue> jjdModelClues = new ArrayList<>();
for (Map<String, Object> data : jjdmaps) { for (Map<String, Object> data : jjdmaps) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id"))); SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")));
if (supExternalDepart != null) { if (supExternalDepart != null && supExternalDepart.getExternalId() != null && supExternalDepart.getExternalName() != null && supExternalDepart.getInternalId() != null && supExternalDepart.getLevel() != null && supExternalDepart.getPid() != null) {
ModelClue modelClue = new ModelClue(); ModelClue modelClue = new ModelClue();
modelClue.setData(JSONObject.toJSONString(data)); modelClue.setData(JSONObject.toJSONString(data));
modelClue.setInvolveDepartId(supExternalDepart.getExternalId()); modelClue.setInvolveDepartId(supExternalDepart.getExternalId());
@ -284,7 +284,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
List<ModelClue> zfqymModelClues = new ArrayList<>(); List<ModelClue> zfqymModelClues = new ArrayList<>();
for (Map<String, Object> data : zfqymaps) { for (Map<String, Object> data : zfqymaps) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id"))); SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")));
if (supExternalDepart != null) { if (supExternalDepart != null && supExternalDepart.getExternalId() != null && supExternalDepart.getExternalName() != null && supExternalDepart.getInternalId() != null && supExternalDepart.getLevel() != null && supExternalDepart.getPid() != null) {
ModelClue modelClue = new ModelClue(); ModelClue modelClue = new ModelClue();
modelClue.setData(JSONObject.toJSONString(data)); modelClue.setData(JSONObject.toJSONString(data));
modelClue.setInvolveDepartId(supExternalDepart.getExternalId()); modelClue.setInvolveDepartId(supExternalDepart.getExternalId());

42
src/main/java/com/biutag/supervision/service/SupExternalDepartService.java

@ -11,10 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@ -32,6 +29,8 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
private final GBaseCJDMapper gBaseCJDMapper; private final GBaseCJDMapper gBaseCJDMapper;
public final ModelClueDataMapper modelClueDataMapper;
public void insertPreData() { public void insertPreData() {
List<SupExternalDepart> supExternalDeparts = new ArrayList<>(); List<SupExternalDepart> supExternalDeparts = new ArrayList<>();
Set<String> dms = new HashSet<>(); Set<String> dms = new HashSet<>();
@ -39,6 +38,7 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
selectAJJBXX(2, supExternalDeparts, dms); selectAJJBXX(2, supExternalDeparts, dms);
selectAJJBXX(3, supExternalDeparts, dms); selectAJJBXX(3, supExternalDeparts, dms);
selectJJDandCJD(dms, supExternalDeparts); selectJJDandCJD(dms, supExternalDeparts);
selectWFQYZFRYB(dms, supExternalDeparts);
List<SupDepart> supDeparts = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getCode, dms)); List<SupDepart> supDeparts = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getCode, dms));
for (SupExternalDepart supExternalDepart : supExternalDeparts) { for (SupExternalDepart supExternalDepart : supExternalDeparts) {
SupDepart supDepart = supDeparts.stream().filter(item -> item.getCode().equals(supExternalDepart.getExternalId())).findFirst().orElse(null); 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.setInternalId(supDepart.getId());
supExternalDepart.setInternalName(supDepart.getName()); supExternalDepart.setInternalName(supDepart.getName());
supExternalDepart.setInternalShortName(supDepart.getShortName()); supExternalDepart.setInternalShortName(supDepart.getShortName());
supExternalDepart.setLevel(supDepart.getLevel());
supExternalDepart.setPid(supDepart.getPid());
}
supExternalDepart.setStatus(0); supExternalDepart.setStatus(0);
supExternalDepart.setCreateTime(LocalDateTime.now()); supExternalDepart.setCreateTime(LocalDateTime.now());
} }
}
supExternalDepartMapper.insert(supExternalDeparts); supExternalDepartMapper.insert(supExternalDeparts);
} }
private void selectJJDandCJD(Set<String> dms, List<SupExternalDepart> 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()) { if (!gBaseJJDS.isEmpty()) {
gBaseJJDS.forEach(item -> { 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 supExternalDepart = new SupExternalDepart();
supExternalDepart.setExternalId(item.getGxdwdm()); supExternalDepart.setExternalId(item.getGxdwdm());
supExternalDepart.setExternalName(item.getGxdwmc() == null ? "" : item.getGxdwmc()); 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()) { if (!gBaseCJDS.isEmpty()) {
gBaseCJDS.forEach(item -> { 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 supExternalDepart = new SupExternalDepart();
supExternalDepart.setExternalId(item.getCjdxssdwdm()); supExternalDepart.setExternalId(item.getCjdxssdwdm());
supExternalDepart.setExternalName(item.getCjdxssdwmc() == null ? "" : item.getCjdxssdwmc()); 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") @DS("slave2")
private void selectAJJBXX(int type, List<SupExternalDepart> result, Set<String> dms) { private void selectAJJBXX(int type, List<SupExternalDepart> result, Set<String> dms) {
QueryWrapper<GBaseAJJBXX> queryWrapper = new QueryWrapper<>(); QueryWrapper<GBaseAJJBXX> queryWrapper = new QueryWrapper<>();
if (type == 1) { if (type == 1) {
queryWrapper.select("DISTINCT LADWBMdm, LADWBMmc"); queryWrapper.select("DISTINCT LADWBMdm, LADWBMmc").ge("BARQ", "2022-10-01");
} else if (type == 2) { } else if (type == 2) {
queryWrapper.select("DISTINCT PADWBMdm, PADWBMmc"); queryWrapper.select("DISTINCT PADWBMdm, PADWBMmc").ge("BARQ", "2022-10-01");
} else if (type == 3) { } else if (type == 3) {
queryWrapper.select("DISTINCT BADWIDdm, BADWIDmc"); queryWrapper.select("DISTINCT BADWIDdm, BADWIDmc").ge("BARQ", "2022-10-01");
} else { } else {
return; return;
} }

Loading…
Cancel
Save