Commit e534c3f0 authored by lihuiling's avatar lihuiling

加注释

parent 817b21b7
...@@ -275,12 +275,15 @@ public class CollectService { ...@@ -275,12 +275,15 @@ public class CollectService {
sjLogSub1InfoMapper.updateState(sub1Id, ManageConstant.CommonStateEnum.COLEND.getCode()); sjLogSub1InfoMapper.updateState(sub1Id, ManageConstant.CommonStateEnum.COLEND.getCode());
} }
} }
//更新sjLog
long successCount = sjLogSub1Mapper.countSjState(sjLogId, " and sj_state = '" + ManageConstant.CommonStateEnum.COLEND.getCode() + "'"); long successCount = sjLogSub1Mapper.countSjState(sjLogId, " and sj_state = '" + ManageConstant.CommonStateEnum.COLEND.getCode() + "'");
sjLog.setSjSuss((int)successCount); sjLog.setSjSuss((int)successCount);
if (0 == sjLogSub1Mapper.countSjState(sjLogId, " and sj_state != '" + ManageConstant.CommonStateEnum.COLEND.getCode() + "'")) { if (0 == sjLogSub1Mapper.countSjState(sjLogId, " and sj_state != '" + ManageConstant.CommonStateEnum.COLEND.getCode() + "'")) {
sjLog.setSjState(ManageConstant.CommonStateEnum.COLEND.getCode()); sjLog.setSjState(ManageConstant.CommonStateEnum.COLEND.getCode());
}else{
sjLog.setSjState(ManageConstant.CommonStateEnum.COLAIL.getCode());
} }
sjLogMapper.updateById(sjLog); sjLogMapper.updateById(sjLog);
} }
} }
...@@ -293,6 +296,7 @@ public class CollectService { ...@@ -293,6 +296,7 @@ public class CollectService {
Integer fileTypeId = sjLogSub1.getFileTypeId(); Integer fileTypeId = sjLogSub1.getFileTypeId();
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的信息及文件
saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, null); saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, null);
QueryWrapper sub2Exam = new QueryWrapper(); QueryWrapper sub2Exam = new QueryWrapper();
...@@ -301,7 +305,7 @@ public class CollectService { ...@@ -301,7 +305,7 @@ public class CollectService {
List<SjLogSub2PO> sjLogSub2List = sjLogSub2Mapper.selectList(sub2Exam); List<SjLogSub2PO> sjLogSub2List = sjLogSub2Mapper.selectList(sub2Exam);
int fjxh = 0; int fjxh = 0;
//保存sub1下所有sub2的信息及文件
for(SjLogSub2PO sub2Po: sjLogSub2List){ for(SjLogSub2PO sub2Po: sjLogSub2List){
fjxh++; fjxh++;
Integer sub2Id = sub2Po.getId(); Integer sub2Id = sub2Po.getId();
...@@ -313,11 +317,13 @@ public class CollectService { ...@@ -313,11 +317,13 @@ public class CollectService {
collectbySub2ById(xtId, ermsQiyePO, ermsOrganizationPO, sjLogSub2InfoPOList, fjxh, sjLogSub1); collectbySub2ById(xtId, ermsQiyePO, ermsOrganizationPO, sjLogSub2InfoPOList, fjxh, sjLogSub1);
} }
//更新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()+"'")){
sjLogSub1.setSjState(ManageConstant.CommonStateEnum.COLEND.getCode()); sjLogSub1.setSjState(ManageConstant.CommonStateEnum.COLEND.getCode());
sjLogSub1Mapper.updateById(sjLogSub1); }else{
sjLogSub1.setSjState(ManageConstant.CommonStateEnum.COLAIL.getCode());
} }
sjLogSub1Mapper.updateById(sjLogSub1);
} }
/* /*
...@@ -328,6 +334,7 @@ public class CollectService { ...@@ -328,6 +334,7 @@ public class CollectService {
SjLogSub2PO sjLogSub2 = sjLogSub2Mapper.selectById(sub2Id); SjLogSub2PO sjLogSub2 = sjLogSub2Mapper.selectById(sub2Id);
Integer fileTypeId = sjLogSub2.getFileTypeId(); Integer fileTypeId = sjLogSub2.getFileTypeId();
Map<String, String> map = sjLogInfoPOList.stream().collect(Collectors.toMap(SjLogSub2InfoPO::getInfoKey, SjLogSub2InfoPO::getInfoValue)); Map<String, String> map = sjLogInfoPOList.stream().collect(Collectors.toMap(SjLogSub2InfoPO::getInfoKey, SjLogSub2InfoPO::getInfoValue));
//保存sub2的信息及文件
saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, sjLogSub2 ); saveCcFileInfo(xtId, fileTypeId, ermsQiyePO, ermsOrganizationPO, map, xh, sjLogSub1, sjLogSub2 );
} }
...@@ -507,10 +514,12 @@ public class CollectService { ...@@ -507,10 +514,12 @@ public class CollectService {
String status = ""; String status = "";
try { try {
//调用接口,获取文件信息
String res = HttpUtil.openHttpByPost("http://192.168.106.150:39091/" + "sjCollection/sjFile", fjObject.toString()); String res = HttpUtil.openHttpByPost("http://192.168.106.150:39091/" + "sjCollection/sjFile", fjObject.toString());
JSONObject jsonRes = JSONUtil.parseObj(res); JSONObject jsonRes = JSONUtil.parseObj(res);
status = jsonRes.getStr("status"); status = jsonRes.getStr("status");
if (StringUtils.equals("200", status)) { if (StringUtils.equals("200", status)) {
//调用接口成功,保存文件
Map data = jsonRes.get("data", Map.class); Map data = jsonRes.get("data", Map.class);
String fileData = (String) data.get("fileData"); String fileData = (String) data.get("fileData");
...@@ -530,6 +539,7 @@ public class CollectService { ...@@ -530,6 +539,7 @@ public class CollectService {
if(ManageConstant.CommonStateEnum.COLEND.getCode().equals(filePO.getState())) { if(ManageConstant.CommonStateEnum.COLEND.getCode().equals(filePO.getState())) {
if (format.equals("pdf")) { if (format.equals("pdf")) {
//如果是pdf文件,加签名
FileInputStream inputStream = new FileInputStream(file); FileInputStream inputStream = new FileInputStream(file);
PdfReader pdfReader = new PdfReader(inputStream); PdfReader pdfReader = new PdfReader(inputStream);
pagenumber = pdfReader.getNumberOfPages(); pagenumber = pdfReader.getNumberOfPages();
...@@ -558,7 +568,7 @@ public class CollectService { ...@@ -558,7 +568,7 @@ public class CollectService {
//其他类型的文件默认页数是1 //其他类型的文件默认页数是1
pagenumber = 1; pagenumber = 1;
} }
//保存文件信息
CcFileSaveInfoPO ccFileSaveInfoPO = new CcFileSaveInfoPO(); CcFileSaveInfoPO ccFileSaveInfoPO = new CcFileSaveInfoPO();
ccFileSaveInfoPO.setFileSize(fileSize.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); ccFileSaveInfoPO.setFileSize(fileSize.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
ccFileSaveInfoPO.setFilePath(fileName); ccFileSaveInfoPO.setFilePath(fileName);
...@@ -576,6 +586,7 @@ public class CollectService { ...@@ -576,6 +586,7 @@ public class CollectService {
errMsg = e.getMessage(); errMsg = e.getMessage();
} finally { } finally {
if (errMsg != null) { if (errMsg != null) {
//采集文件发生错误,保存错误信息,更新对应sub记录的状态
SjLogErrorPO sjLogErrorPO = new SjLogErrorPO(); SjLogErrorPO sjLogErrorPO = new SjLogErrorPO();
sjLogErrorPO.setSjLogSub1Id(sjLogSub1PO != null ? sjLogSub1PO.getId() : null); sjLogErrorPO.setSjLogSub1Id(sjLogSub1PO != null ? sjLogSub1PO.getId() : null);
sjLogErrorPO.setSjLogSub2Id(sjLogSub2PO != null ? sjLogSub2PO.getId() : null); sjLogErrorPO.setSjLogSub2Id(sjLogSub2PO != null ? sjLogSub2PO.getId() : null);
...@@ -590,6 +601,7 @@ public class CollectService { ...@@ -590,6 +601,7 @@ public class CollectService {
sjLogSub1PO.setSjState(ManageConstant.CommonStateEnum.COLAIL.getCode()); sjLogSub1PO.setSjState(ManageConstant.CommonStateEnum.COLAIL.getCode());
sjLogSub1Mapper.updateById(sjLogSub1PO); sjLogSub1Mapper.updateById(sjLogSub1PO);
}else{ }else{
//如果获取文件成功且没有错误信息,更新文件信息及对应sub记录的状态
if (StringUtils.equals("200", status)) { if (StringUtils.equals("200", status)) {
ccFileInfoMapper.upDateFile(fileTypeId, updateSql, uuid); ccFileInfoMapper.upDateFile(fileTypeId, updateSql, uuid);
if (sjLogSub2PO != null) { if (sjLogSub2PO != null) {
......
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