Commit 2691f0f3 authored by lihuiling's avatar lihuiling

梳理逻辑分层

parent e534c3f0
...@@ -250,6 +250,11 @@ public class CollectService { ...@@ -250,6 +250,11 @@ public class CollectService {
List<SjLogPO> logList = sjLogMapper.selectList(sjLogExam); List<SjLogPO> logList = sjLogMapper.selectList(sjLogExam);
for(SjLogPO sjLog : logList) { for(SjLogPO sjLog : logList) {
collectByLog(sjLog);
}
}
public void collectByLog(SjLogPO sjLog){
Integer sjLogId = sjLog.getId(); Integer sjLogId = sjLog.getId();
QueryWrapper sjLogSub1Exam = new QueryWrapper(); QueryWrapper sjLogSub1Exam = new QueryWrapper();
sjLogSub1Exam.ne("sj_state", ManageConstant.CommonStateEnum.COLEND.getCode()); sjLogSub1Exam.ne("sj_state", ManageConstant.CommonStateEnum.COLEND.getCode());
...@@ -263,14 +268,9 @@ public class CollectService { ...@@ -263,14 +268,9 @@ public class CollectService {
for(SjLogSub1PO sjLogSub1 : logSub1List) { for(SjLogSub1PO sjLogSub1 : logSub1List) {
Integer sub1Id = sjLogSub1.getId(); Integer sub1Id = sjLogSub1.getId();
QueryWrapper sub1InfoExam = new QueryWrapper();
sub1InfoExam.eq("state", ManageConstant.CommonStateEnum.COLIN.getCode());
sub1InfoExam.eq("sj_log_sub1_id", sub1Id);
List<SjLogSub1InfoPO> sjLogInfoPOList = sjLogSub1InfoMapper.selectList(sub1InfoExam);
List<Integer> lineList = sjLogInfoPOList.stream().map(e -> e.getSjLogSub1Id()).distinct().collect(Collectors.toList());
xh++; xh++;
Integer sjLogSub1Id = sjLogSub1.getId();
collectbySub1ById(sjLogSub1,ermsQiyePO, ermsOrganizationPO, sjLogInfoPOList, xh, sjLog.getXtId()); collectBySub1(ermsQiyePO, ermsOrganizationPO, sjLogSub1, xh, sjLog.getXtId());
if(ManageConstant.CommonStateEnum.COLIN.getCode().equals(sjLogSub1.getSjState())){ if(ManageConstant.CommonStateEnum.COLIN.getCode().equals(sjLogSub1.getSjState())){
sjLogSub1InfoMapper.updateState(sub1Id, ManageConstant.CommonStateEnum.COLEND.getCode()); sjLogSub1InfoMapper.updateState(sub1Id, ManageConstant.CommonStateEnum.COLEND.getCode());
} }
...@@ -286,18 +286,21 @@ public class CollectService { ...@@ -286,18 +286,21 @@ public class CollectService {
sjLogMapper.updateById(sjLog); sjLogMapper.updateById(sjLog);
} }
}
/* /*
* 采集sjLogSub1 * 采集sjLogSub1
* */ * */
public void collectbySub1ById(SjLogSub1PO sjLogSub1, ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, List<SjLogSub1InfoPO> sjLogInfoPOList, Integer xh, String xtId){ public void collectBySub1(ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, SjLogSub1PO sjLogSub1, Integer xh, String xtId){
Integer sub1Id = sjLogSub1.getId(); Integer sub1Id = sjLogSub1.getId();
Integer fileTypeId = sjLogSub1.getFileTypeId();
QueryWrapper sub1InfoExam = new QueryWrapper();
sub1InfoExam.eq("state", ManageConstant.CommonStateEnum.COLIN.getCode());
sub1InfoExam.eq("sj_log_sub1_id", sub1Id);
List<SjLogSub1InfoPO> sjLogInfoPOList = sjLogSub1InfoMapper.selectList(sub1InfoExam);
Map<String, String> map = sjLogInfoPOList.stream().collect(Collectors.toMap(SjLogSub1InfoPO::getInfoKey, SjLogSub1InfoPO::getInfoValue)); Map<String, String> map = sjLogInfoPOList.stream().collect(Collectors.toMap(SjLogSub1InfoPO::getInfoKey, SjLogSub1InfoPO::getInfoValue));
//保存sub1的信息及文件 //保存sub1的信息及文件
saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, null); saveCcFileInfo(xtId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, null);
QueryWrapper sub2Exam = new QueryWrapper(); QueryWrapper sub2Exam = new QueryWrapper();
sub2Exam.eq("sj_sub1_id",sub1Id); sub2Exam.eq("sj_sub1_id",sub1Id);
...@@ -309,13 +312,7 @@ public class CollectService { ...@@ -309,13 +312,7 @@ public class CollectService {
for(SjLogSub2PO sub2Po: sjLogSub2List){ for(SjLogSub2PO sub2Po: sjLogSub2List){
fjxh++; fjxh++;
Integer sub2Id = sub2Po.getId(); Integer sub2Id = sub2Po.getId();
collectBySub2(ermsQiyePO, ermsOrganizationPO, sjLogSub1, sub2Po, fjxh, xtId);
QueryWrapper sub2InfoExam = new QueryWrapper();
sub2InfoExam.eq("sj_sub2_id", sub2Id);
sub2InfoExam.eq("state", ManageConstant.CommonStateEnum.COLIN.getCode());
List<SjLogSub2InfoPO> sjLogSub2InfoPOList = sjLogSub2InfoMapper.selectList(sub2InfoExam);
collectbySub2ById(xtId, ermsQiyePO, ermsOrganizationPO, sjLogSub2InfoPOList, fjxh, sjLogSub1);
} }
//更新sub1状态 //更新sub1状态
if(0 == sjLogSub2Mapper.countSjState(sub1Id, " and sj_state != '" +ManageConstant.CommonStateEnum.COLEND.getCode()+"'")){ if(0 == sjLogSub2Mapper.countSjState(sub1Id, " and sj_state != '" +ManageConstant.CommonStateEnum.COLEND.getCode()+"'")){
...@@ -329,28 +326,35 @@ public class CollectService { ...@@ -329,28 +326,35 @@ public class CollectService {
/* /*
* 采集sjLogSub2 * 采集sjLogSub2
* */ * */
public void collectbySub2ById(String xtId, ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, List<SjLogSub2InfoPO> sjLogInfoPOList, Integer xh, SjLogSub1PO sjLogSub1){ public void collectBySub2(ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, SjLogSub1PO sjLogSub1, SjLogSub2PO sjLogSub2, Integer xh, String xtId){
Integer sub2Id = sjLogInfoPOList.get(0).getSjLogSub2Id(); Integer sub2Id = sjLogSub2.getId();
SjLogSub2PO sjLogSub2 = sjLogSub2Mapper.selectById(sub2Id);
Integer fileTypeId = sjLogSub2.getFileTypeId(); QueryWrapper sub2InfoExam = new QueryWrapper();
Map<String, String> map = sjLogInfoPOList.stream().collect(Collectors.toMap(SjLogSub2InfoPO::getInfoKey, SjLogSub2InfoPO::getInfoValue)); sub2InfoExam.eq("sj_sub2_id", sub2Id);
sub2InfoExam.eq("state", ManageConstant.CommonStateEnum.COLIN.getCode());
List<SjLogSub2InfoPO> sjLogSub2InfoPOList = sjLogSub2InfoMapper.selectList(sub2InfoExam);
Map<String, String> map = sjLogSub2InfoPOList.stream().collect(Collectors.toMap(SjLogSub2InfoPO::getInfoKey, SjLogSub2InfoPO::getInfoValue));
//保存sub2的信息及文件 //保存sub2的信息及文件
saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, sjLogSub2 ); saveCcFileInfo(xtId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, sjLogSub2);
} }
/* /*
* 保存文件信息 * 保存文件信息
* */ * */
public void saveCcFileInfo(String xtId, Integer fileTypeId, ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, Map<String,String> map, Integer xh, SjLogSub1PO sjLogSub1PO, SjLogSub2PO sjLogSub2PO){ public void saveCcFileInfo(String xtId, ErmsQiyePO ermsQiyePO, ErmsOrganizationPO ermsOrganizationPO, Map<String,String> map, Integer xh, SjLogSub1PO sjLogSub1PO, SjLogSub2PO sjLogSub2PO){
String uuid=""; String uuid="";
String dzwjh=""; String dzwjh="";
Integer fileTypeId = 0;
if(sjLogSub2PO == null){ if(sjLogSub2PO == null){
uuid = sjLogSub1PO.getXtUuid(); uuid = sjLogSub1PO.getXtUuid();
dzwjh = sjLogSub1PO.getDzwjh(); dzwjh = sjLogSub1PO.getDzwjh();
fileTypeId = sjLogSub1PO.getFileTypeId();
}else{ }else{
uuid = sjLogSub2PO.getXtUuid(); uuid = sjLogSub2PO.getXtUuid();
dzwjh = sjLogSub2PO.getDzwjh(); dzwjh = sjLogSub2PO.getDzwjh();
fileTypeId = sjLogSub2PO.getFileTypeId();
} }
long count = ccFileInfoMapper.count(fileTypeId, " where dzwjh = '" + uuid + "'" ); long count = ccFileInfoMapper.count(fileTypeId, " where dzwjh = '" + uuid + "'" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment