use of com.itrus.portal.db.EvidenceEventContent in project portal by ixinportal.
the class BasicInformationController method show1.
/**
* 查看详细内容(事件详细)
*
* @param id
* @param type
* @param uiModel
* @return
*/
@RequestMapping(value = "show1/{id}/{mid}/{type}", produces = "text/html")
public String show1(@PathVariable("id") Long id, @PathVariable("mid") Long mid, @PathVariable("type") int type, Model uiModel) {
/*
* if (type == 1) {// 身份意愿鉴别信息 EvidenceDesireIdentify desire =
* sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByPrimaryKey",
* id); EvidenceMainInformation mainInfo = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* desire.getMainInformation()); uiModel.addAttribute("desire", desire);
* uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/desireIdentify"; } else if (type == 2) {// 获取实名认证信息
* EvidenceCompaniesSubmit companiesSubmit = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByPrimaryKey",
* id); String cid = companiesSubmit.getId().toString(); int evid =
* Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
* EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
* realnameEx = realnameE.createCriteria();
* realnameEx.andCompaniesSubmitEqualTo(evid); EvidenceRealName
* erealname = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
* realnameE); EvidenceMainInformation mainInfo = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* erealname.getMainInformation()); if
* (companiesSubmit.getRepresentative() != null) {// 法定代表人
* EvidenceRepresentative representative = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey",
* companiesSubmit.getRepresentative());
* uiModel.addAttribute("representative", representative); } if
* (companiesSubmit.getTheAgent() != null) {// 代理人 EvidenceTheAgent
* theagent = sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey",
* companiesSubmit.getTheAgent()); uiModel.addAttribute("theagent",
* theagent); } uiModel.addAttribute("erealname", erealname);
* uiModel.addAttribute("companiesSubmit", companiesSubmit);
* uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/companiesSubmit";
*
* } else
*/
if (type == 3) {
// 可信身份标识
// EvidenceTrustedIdentity trusted = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
// EvidenceMainInformation mainInfo = sqlSession.selectOne(
// "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
// trusted.getMainInformation());
// uiModel.addAttribute("trusted", trusted);
// uiModel.addAttribute("mainInfo", mainInfo);
EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
String idCode = trusted.getMainInformation().split(";")[1];
String idName = trusted.getMainInformation().split(";")[0];
EvidenceMainInformationExample maininfor = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria mation = maininfor.createCriteria();
mation.andIdentificationEqualTo(idCode);
mation.andSubjectNameEqualTo(idName);
List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", maininfor);
uiModel.addAttribute("trusted", trusted);
/*EvidenceCertExample basicEx = new EvidenceCertExample();
EvidenceCertExample.Criteria information = basicEx.createCriteria();
information.andCertSerialnumberEqualTo(trusted.getCertSerialnumber().trim());
EvidenceCert cert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample", basicEx);
uiModel.addAttribute("cert", cert);
if(cert!=null && cert.getIssuerdn()!=null){
uiModel.addAttribute("Issuerdn", EvidenceSaveServiceApi.getCertCn(cert.getIssuerdn()));
}*/
uiModel.addAttribute("mainInfo", mainInfo.get(0));
return "basicinformation/trustedIdentity";
} else if (type == 4) {
// 事件内容
EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
// 得到基本信息
/*EvidenceBasicInformation basicinfor = sqlSession
.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", mevencontent.getBasicInformation());*/
EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
// 得到服务表信息
AppService appservice = appService.selectById(basicinfor.getAppService());
EvidenceSaveServiceExample save = new EvidenceSaveServiceExample();
EvidenceSaveServiceExample.Criteria saveEx = save.createCriteria();
saveEx.andAppServiceEqualTo(appservice.getId());
EvidenceSaveService evidenceSave = sqlSession.selectOne("com.itrus.portal.db.EvidenceSaveServiceMapper.selectByExample", save);
// String js = evidenceSave.getFactorBusinessInfo();
String evidenceType = null;
try {
JSONArray jsonArray = new JSONArray(evidenceSave.getFactorBusinessInfo());
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsob = JSONObject.parseObject(jsonArray.get(i).toString());
if ("业务类型".equals(jsob.getString("b_factor"))) {
evidenceType = jsob.getString("b_category");
}
}
if ("电子合同PDF".equals(evidenceType)) {
// 判断图片是否存在
if (mevencontent.getIsimg() == null) {
// EvidenceBasicInformation basic = sqlSession.selectOne(
// "com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey",
// mevencontent.getEvidenceSn());
// 得到证据附件表,用于获取信息
EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
envlosureEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
envlosureEx.andPdfTypeEqualTo("1");
EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
if (realNameAuthentication == null) {
try {
realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String pdfbase64 = null;
String urlAgent = realNameAuthentication.getRealNameddress();
if (envlosure != null && envlosure.getBuid() != null) {
log.error("Buid======" + envlosure.getBuid());
pdfbase64 = EvidenceSaveServiceApi.decryptedAndDownload(sqlSession, envlosure.getBuid(), urlAgent);
}
if (pdfbase64 != null) {
log.error("*******pdfbase64不为空*********");
// 得到证据包的json
JSONObject jsonEvidenceContent = JSONObject.parseObject(pdfbase64);
String authEvent = jsonEvidenceContent.getString("authEvent");
JSONObject authEvent1 = JSONObject.parseObject(authEvent);
String jsonpdf = authEvent1.getString("eventContent");
JSONObject jsonpdf1 = JSONObject.parseObject(jsonpdf);
// 得到pdf的base64编码
String jsonbase64 = jsonpdf1.getString("contCode");
BufferedInputStream bin = null;
FileOutputStream fout = null;
BufferedOutputStream bout = null;
try {
BASE64Decoder decoder = new sun.misc.BASE64Decoder();
// 将base64编码的字符串解码成字节数组
byte[] bytes = decoder.decodeBuffer(jsonbase64);
// apache公司的API
// byte[] bytes = Base64.decodeBase64(base64sString);
// 创建一个将bytes作为其缓冲区的ByteArrayInputStream对象
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
// 创建从底层输入流中读取数据的缓冲输入流对象
bin = new BufferedInputStream(bais);
// 指定输出的文件
log.error("路径地址=" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
File file = new File(systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
// 创建到指定文件的输出流
fout = new FileOutputStream(file);
// 为文件输出流对接缓冲输出流对象
bout = new BufferedOutputStream(fout);
byte[] buffers = new byte[1024];
int len = bin.read(buffers);
while (len != -1) {
bout.write(buffers, 0, len);
len = bin.read(buffers);
}
// 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
bout.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bin != null) {
bin.close();
}
if (fout != null) {
fout.close();
}
if (bout != null) {
bout.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
// 判断是否为用户上传pdf
if (envlosure != null) {
String urlFile = systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
File filePathStr = new File(urlFile, envlosure.getEvidenceSn() + ".pdf");
log.error("***********filePathStr=" + filePathStr.getPath());
int pdfToPng = 0;
if (filePathStr != null && filePathStr.getPath() != null) {
try {
pdfToPng = Pdf.pdf2png(filePathStr.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
log.error("是否生成,数量****pdfToPng=" + pdfToPng);
// 判断生成图片是否成功
if (pdfToPng > 0) {
// 修改内容表信息,表示生成图片
mevencontent.setIsimg(1);
mevencontent.setImgCount(pdfToPng);
sqlSession.update("com.itrus.portal.db.EvidenceEventContentMapper.updateByPrimaryKey", mevencontent);
String oper = "原文图片生成成功";
String info = "图片地址:" + urlFile;
LogUtil.evidencelog(sqlSession, null, oper, info);
} else {
String oper = "原文图片生成失败";
String info = "失败原因:" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
LogUtil.evidencelog(sqlSession, null, oper, info);
}
}
}
}
uiModel.addAttribute("selectType", 1);
} else if ("合同摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 2);
} else if ("图片摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 3);
} else if ("信息摘要数据".equals(evidenceType)) {
uiModel.addAttribute("selectType", 4);
}
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
uiModel.addAttribute("mevencontent", mevencontent);
return "basicinformation/evenconrent";
} else if (type == 5) {
// 事件详细
EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
// EvidenceBasicInformation basicInformation = basicInformationimpl.selectById(mevencontent.getEvidenceSn());
EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
EvidenceMainInformation mainInfo = new EvidenceMainInformation();
// 事件对象
EvidenceTrustedIdentityExample trustenid = new EvidenceTrustedIdentityExample();
EvidenceTrustedIdentityExample.Criteria identitye = trustenid.createCriteria();
// identitye.andBasicInformationEqualTo(mevencontent.getEvidenceSn());// 获取事件对象
identitye.andEventContentEqualTo(mevencontent.getIdCode());
// identitye.andMainInformationEqualTo(mid);
EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustenid);
if (trusted != null) {
String mainName = trusted.getMainInformation().split(";")[0];
String mainIdentity = trusted.getMainInformation().split(";")[1];
// 证据主体信息
EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
tionE.andIdentificationEqualTo(mainIdentity);
if (mainName != null) {
tionE.andSubjectNameEqualTo(mainName);
}
List<EvidenceMainInformation> ainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
mainInfo = ainInfo.get(0);
/*mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
trusted.getMainInformation());*/
}
// 事件行为
EvidenceEventBehaviorExample eventbehaciorEx = new EvidenceEventBehaviorExample();
EvidenceEventBehaviorExample.Criteria eventbe = eventbehaciorEx.createCriteria();
eventbe.andEventContentEqualTo(mevencontent.getIdCode());
// eventbe.andMainInformationEqualTo(mid);
List<EvidenceEventBehavior> elist = sqlSession.selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", eventbehaciorEx);
// 事件时间
EvidenceEventTimeExample eventime = new EvidenceEventTimeExample();
EvidenceEventTimeExample.Criteria eventimeEx = eventime.createCriteria();
eventimeEx.andEventContentEqualTo(mevencontent.getIdCode());
// eventimeEx.andMainInformationEqualTo(mid);
List<EvidenceEventTime> meventime = sqlSession.selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", eventime);
// 事件意愿
EvidenceEventDesireExample desireEx = new EvidenceEventDesireExample();
EvidenceEventDesireExample.Criteria eventdesire = desireEx.createCriteria();
eventdesire.andEventContenteEqualTo(mevencontent.getIdCode());
// eventdesire.andMainInformationEqualTo(mid);
EvidenceEventDesire meventdesire = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", desireEx);
// 事件网络地址
EvidenceEventNetworkAddressExample network = new EvidenceEventNetworkAddressExample();
EvidenceEventNetworkAddressExample.Criteria address = network.createCriteria();
address.andEventContentEqualTo(mevencontent.getIdCode());
// address.andMainInformationEqualTo(mid);
EvidenceEventNetworkAddress networkaddress = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", network);
uiModel.addAttribute("mevencontent", mevencontent);
uiModel.addAttribute("meventdesire", meventdesire);
uiModel.addAttribute("networkaddress", networkaddress);
uiModel.addAttribute("basicInformation", basicInformation);
uiModel.addAttribute("trusted", trusted);
uiModel.addAttribute("mainInfo", mainInfo);
uiModel.addAttribute("elist", elist);
uiModel.addAttribute("meventime", meventime);
return "basicinformation/certificationdetails";
} else if (type == 6) {
// 服务委托人签名信息
EvidenceClientSignature cliensig = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByPrimaryKey", id);
EvidenceEnclosureExample enclo = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria enclosureEx = enclo.createCriteria();
enclosureEx.andEvidenceSnEqualTo(cliensig.getEvidenceSn());
enclosureEx.andPdfTypeEqualTo("1");
EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclo);
// 天威签名信息
EvidenceClientSignatureExample cilentsign = new EvidenceClientSignatureExample();
EvidenceClientSignatureExample.Criteria signature = cilentsign.createCriteria();
signature.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
signature.andNameEqualTo("1");
EvidenceClientSignature cilentsignature = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilentsign);
EvidenceCert oneCert = new EvidenceCert();
EvidenceCheck oneCheck = new EvidenceCheck();
if (cilentsignature != null) {
// 天威证书信息
/*EvidenceCertExample certE = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCertE = certE.createCriteria();
evidenceCertE.andClientSignatureEqualTo(cilentsignature.getId());
oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample",certE);*/
oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cilentsignature.getCertId());
// 天威核验信息
EvidenceCheckExample checkE = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheckE = checkE.createCriteria();
evidenceCheckE.andClientSignatureEqualTo(cilentsignature.getId());
oneCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkE);
}
// 服务委托人时间戳信息
EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
stamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
stamp.andNameEqualTo("0");
EvidenceClientTimeStamp clientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", clientTime);
// 天威时间戳信息
EvidenceClientTimeStampExample tclientTime = new EvidenceClientTimeStampExample();
EvidenceClientTimeStampExample.Criteria tstamp = tclientTime.createCriteria();
tstamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
tstamp.andNameEqualTo("1");
EvidenceClientTimeStamp tclientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", tclientTime);
// 服务委托人证书信息
/*EvidenceCertExample certEx = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
evidenceCert.andClientSignatureEqualTo(cliensig.getId());
List<EvidenceCert> listCert = sqlSession
.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByExample", certEx);*/
List<EvidenceCert> listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cliensig.getCertId());
// 服务委托人核验信息
EvidenceCheckExample checkEx = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
evidenceCheck.andClientSignatureEqualTo(cliensig.getId());
EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
Map<Long, EvidenceCheck> mapCheck = new HashMap<Long, EvidenceCheck>();
// 服务委托人证书核验信息
for (EvidenceCert c : listCert) {
EvidenceCheckExample certcheckEx = new EvidenceCheckExample();
EvidenceCheckExample.Criteria certCheck = certcheckEx.createCriteria();
certCheck.andEvidenceCertEqualTo(c.getId());
EvidenceCheck listCertCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", certcheckEx);
mapCheck.put(c.getId(), listCertCheck);
}
// 服务委托人证书信息
uiModel.addAttribute("listCert", listCert);
// 服务委托人核验信息
uiModel.addAttribute("listCheck", listCheck);
// 天威证书信息
uiModel.addAttribute("oneCert", oneCert);
// 天威核验信息
uiModel.addAttribute("oneCheck", oneCheck);
// 服务委托人证书核验信息
uiModel.addAttribute("mapCheck", mapCheck);
// 服务委托人签名信息
uiModel.addAttribute("cliensig", cliensig);
// 天威签名信息
uiModel.addAttribute("cilentsignature", cilentsignature);
// 服务委托人时间戳信息
uiModel.addAttribute("clientTimestamp", clientTimestamp);
// 天威时间戳信息
uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
return "basicinformation/evidenceexists";
}
/*
* else if (type == 7) { EvidenceIndividual indiv = sqlSession
* .selectOne(
* "com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey",
* id); String cid = indiv.getId().toString(); int evid =
* Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
* EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
* realnameEx = realnameE.createCriteria();
* realnameEx.andIndividualEqualTo(evid); EvidenceRealName erealname
* = sqlSession .selectOne(
* "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
* realnameE); EvidenceMainInformation mainInfo =
* sqlSession.selectOne(
* "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
* erealname.getMainInformation()); uiModel.addAttribute("indiv",
* indiv); uiModel.addAttribute("mainInfo", mainInfo); return
* "basicinformation/ineividual"; }
*/
return null;
}
use of com.itrus.portal.db.EvidenceEventContent in project portal by ixinportal.
the class EvidenceQueueThread method run.
@Override
public void run() {
boolean isException = false;
while (true) {
// long startDate = System.currentTimeMillis();
log.debug("EvidenceQueueThread execute run,the queue size is [" + OBJECT_QUEUE.size() + "]");
if (OBJECT_QUEUE.isEmpty()) {
try {
// 若队列中没有信息则等待10秒
sleep(10 * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
continue;
}
log.debug("EvidenceQueueThread execute run,the queue size is [" + OBJECT_QUEUE.size() + "]");
// 存证记录信息
List<EvidenceBasicInformation> basicInformations = new ArrayList<EvidenceBasicInformation>();
// 事件内容记录
List<EvidenceEventContent> eventContents = new ArrayList<EvidenceEventContent>();
// 主体
Map<String, EvidenceMainInformation> mainInformationMap = new HashMap<>();
// 主体与记录关联
List<EvidenceSubjectIdentity> subjectIdentites = new ArrayList<EvidenceSubjectIdentity>();
// 日志记录
List<EvidenceLog> logs = new ArrayList<EvidenceLog>();
// 签名服务信息记录
List<EvidenceClientSignature> signatures = new ArrayList<EvidenceClientSignature>();
// 时间戳服务信息记录
List<EvidenceClientTimeStamp> clientTimeStamps = new ArrayList<EvidenceClientTimeStamp>();
// 附件信息记录
List<EvidenceEnclosure> enclosures = new ArrayList<EvidenceEnclosure>();
// 身份意愿鉴别信息记录
List<EvidenceDesireIdentify> desireIdentifies = new ArrayList<EvidenceDesireIdentify>();
// 身份实名信息记录
List<EvidenceRealName> realNames = new ArrayList<EvidenceRealName>();
// 身份个人实名提交信息
List<EvidenceIndividual> individuals = new ArrayList<EvidenceIndividual>();
// 身份企业法人实名提交信息
List<EvidenceRepresentative> representatives = new ArrayList<EvidenceRepresentative>();
// 身份企业代理人实名提交信息
List<EvidenceTheAgent> agents = new ArrayList<EvidenceTheAgent>();
// 身份企业实名提交信息
List<EvidenceCompaniesSubmit> companiesSubmits = new ArrayList<EvidenceCompaniesSubmit>();
// 事件意愿认证信息
List<EvidenceEventDesire> eventDesires = new ArrayList<EvidenceEventDesire>();
// 事件地点认证信息
List<EvidenceEventNetworkAddress> addresses = new ArrayList<EvidenceEventNetworkAddress>();
// 事件对象认证信息
List<EvidenceTrustedIdentity> trustedIdentities = new ArrayList<EvidenceTrustedIdentity>();
// 事件行为信息
List<EvidenceEventBehavior> eventBehaviors = new ArrayList<EvidenceEventBehavior>();
// 事件时间戳信息
List<EvidenceEventTime> eventTimes = new ArrayList<EvidenceEventTime>();
// 用户上传证书信息
List<EvidenceCertUser> certUsers = new ArrayList<EvidenceCertUser>();
for (int i = 0; !OBJECT_QUEUE.isEmpty() && i < 1000; i++) {
Object object = OBJECT_QUEUE.poll();
isOver = false;
if (object instanceof EvidenceBasicInformation) {
EvidenceBasicInformation ebi = (EvidenceBasicInformation) object;
basicInformations.add(ebi);
} else if (object instanceof EvidenceEventContent) {
EvidenceEventContent eec = (EvidenceEventContent) object;
eventContents.add(eec);
} else if (object instanceof EvidenceMainInformation) {
EvidenceMainInformation emi = (EvidenceMainInformation) object;
mainInformationMap.put(emi.getSubjectName() + emi.getIdentification(), emi);
} else if (object instanceof EvidenceSubjectIdentity) {
EvidenceSubjectIdentity esi = (EvidenceSubjectIdentity) object;
subjectIdentites.add(esi);
} else if (object instanceof EvidenceLog) {
EvidenceLog eLog = (EvidenceLog) object;
eLog.setInfo(StringUtils.replaceHtml(eLog.getInfo()));
logs.add(eLog);
} else if (object instanceof EvidenceClientSignature) {
EvidenceClientSignature ecs = (EvidenceClientSignature) object;
signatures.add(ecs);
} else if ((object instanceof EvidenceClientTimeStamp)) {
EvidenceClientTimeStamp ects = (EvidenceClientTimeStamp) object;
clientTimeStamps.add(ects);
} else if ((object instanceof EvidenceEnclosure)) {
EvidenceEnclosure ee = (EvidenceEnclosure) object;
enclosures.add(ee);
} else if ((object instanceof EvidenceDesireIdentify)) {
EvidenceDesireIdentify edi = (EvidenceDesireIdentify) object;
desireIdentifies.add(edi);
} else if ((object instanceof EvidenceEnclosure)) {
EvidenceEnclosure ee = (EvidenceEnclosure) object;
enclosures.add(ee);
} else if ((object instanceof EvidenceRealName)) {
EvidenceRealName erl = (EvidenceRealName) object;
realNames.add(erl);
} else if ((object instanceof EvidenceIndividual)) {
EvidenceIndividual ei = (EvidenceIndividual) object;
individuals.add(ei);
} else if ((object instanceof EvidenceRepresentative)) {
EvidenceRepresentative er = (EvidenceRepresentative) object;
representatives.add(er);
} else if ((object instanceof EvidenceTheAgent)) {
EvidenceTheAgent eta = (EvidenceTheAgent) object;
agents.add(eta);
} else if ((object instanceof EvidenceCompaniesSubmit)) {
EvidenceCompaniesSubmit ecs = (EvidenceCompaniesSubmit) object;
companiesSubmits.add(ecs);
} else if ((object instanceof EvidenceEventDesire)) {
EvidenceEventDesire eed = (EvidenceEventDesire) object;
eventDesires.add(eed);
} else if ((object instanceof EvidenceEventNetworkAddress)) {
EvidenceEventNetworkAddress eena = (EvidenceEventNetworkAddress) object;
addresses.add(eena);
} else if ((object instanceof EvidenceTrustedIdentity)) {
EvidenceTrustedIdentity eti = (EvidenceTrustedIdentity) object;
trustedIdentities.add(eti);
} else if ((object instanceof EvidenceEventBehavior)) {
EvidenceEventBehavior eeb = (EvidenceEventBehavior) object;
eventBehaviors.add(eeb);
} else if ((object instanceof EvidenceEventTime)) {
EvidenceEventTime eet = (EvidenceEventTime) object;
eventTimes.add(eet);
} else if ((object instanceof EvidenceCertUser)) {
EvidenceCertUser ecu = (EvidenceCertUser) object;
certUsers.add(ecu);
}
}
// 保存事件内容记录
if (!eventContents.isEmpty())
try {
sqlSession.insert("com.itrus.portal.db.EvidenceEventContentMapper.insertOrUpdate", eventContents.toArray());
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add eventContents " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(eventContents.toArray());
String fileName = "EvidenceEventContent" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件内容");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
eventContents = null;
}
// 保存证据主体记录
if (!mainInformationMap.isEmpty())
try {
sqlSession.insert("com.itrus.portal.db.EvidenceMainInformationMapper.insertOrUpdate", mainInformationMap.values().toArray());
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add mainInformations " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(mainInformationMap.values().toArray());
String fileName = "EvidenceMainInformation" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证主体");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
mainInformationMap.clear();
}
// 保存主体与记录关联记录
if (!subjectIdentites.isEmpty())
try {
sqlSession.insert("com.itrus.portal.db.EvidenceSubjectIdentityMapper.insertOrUpdate", subjectIdentites.toArray());
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add subjectIdentites " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(subjectIdentites.toArray());
String fileName = "EvidenceSubjectIdentity" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证主体");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
subjectIdentites = null;
}
// 保存签名服务信息记录
if (!signatures.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceClientSignatureMapper.insertOrUpdate", signatures.toArray());
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add signatures " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(signatures.toArray());
String fileName = "EvidenceClientSignature" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证签名服务");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
signatures = null;
}
}
// 保存时间戳服务信息
if (!clientTimeStamps.isEmpty()) {
try {
this.sqlSession.insert("com.itrus.portal.db.EvidenceClientTimeStampMapper.insertOrUpdate", clientTimeStamps.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add clientTimeStamps " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(clientTimeStamps.toArray());
String fileName = "EvidenceClientTimeStamp" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证时间戳服务");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
clientTimeStamps = null;
}
}
// 保存附件信息
if (!enclosures.isEmpty()) {
try {
this.sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insertOrUpdate", enclosures.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add enclosures " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(enclosures.toArray());
String fileName = "EvidenceEnclosure" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证附件");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
enclosures = null;
}
}
// 保存身份意愿信息
if (!desireIdentifies.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceDesireIdentifyMapper.insertOrUpdate", desireIdentifies.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add desireIdentifies " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(desireIdentifies.toArray());
String fileName = "EvidenceDesireIdentify" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份意愿");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
desireIdentifies = null;
}
}
// 保存身份个人实名提交信息
if (!individuals.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceIndividualMapper.insertOrUpdate", individuals.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add individuals " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(individuals.toArray());
String fileName = "EvidenceIndividual" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份个人实名提交信息");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
individuals = null;
}
}
// 保存身份实名信息
if (!realNames.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceRealNameMapper.insertOrUpdate", realNames.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add realNames " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(realNames.toArray());
String fileName = "EvidenceRealName" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份实名");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
realNames = null;
}
}
// 保存身份企业法人实名提交信息
if (!representatives.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceRepresentativeMapper.insertOrUpdate", representatives.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add representatives " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(representatives.toArray());
String fileName = "EvidenceRepresentative" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份企业法人实名");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
representatives = null;
}
}
// 保存身份企业代理人实名提交信息
if (!agents.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceTheAgentMapper.insertOrUpdate", agents.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add agents " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(agents.toArray());
String fileName = "EvidenceTheAgent" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份企业代理人");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
agents = null;
}
}
// 保存身份企业实名提交信息
if (!companiesSubmits.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.insertOrUpdate", companiesSubmits.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add companiesSubmits " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(companiesSubmits.toArray());
String fileName = "EvidenceCompaniesSubmit" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证身份企业实名");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
companiesSubmits = null;
}
}
// 保存事件意愿认证信息
if (!eventDesires.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceEventDesireMapper.insertOrUpdate", eventDesires.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add eventDesires " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(eventDesires.toArray());
String fileName = "EvidenceEventDesire" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件意愿认证");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
eventDesires = null;
}
}
// 保存事件地点认证信息
if (!addresses.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.insertOrUpdate", addresses.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add addresses " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(addresses.toArray());
String fileName = "EvidenceEventNetworkAddress" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件地点认证");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
addresses = null;
}
}
// 保存事件对象认证信息
if (!trustedIdentities.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insertOrUpdate", trustedIdentities.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add trustedIdentities " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(trustedIdentities.toArray());
String fileName = "EvidenceTrustedIdentity" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件对象认证");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
trustedIdentities = null;
}
}
// 保存事件行为信息
if (!eventBehaviors.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceEventBehaviorMapper.insertOrUpdate", eventBehaviors.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add eventBehaviors " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(eventBehaviors.toArray());
String fileName = "EvidenceEventBehavior" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件行为");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
eventBehaviors = null;
}
}
// 保存事件时间戳信息
if (!eventTimes.isEmpty()) {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceEventTimeMapper.insertOrUpdate", eventTimes.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add eventTimes " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(eventTimes.toArray());
String fileName = "EvidenceEventTime" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证事件时间戳");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
eventTimes = null;
}
}
// 保存用户上传证书信息
if (!certUsers.isEmpty()) {
// TODO
try {
sqlSession.insert("com.itrus.portal.db.EvidenceCertUserMapper.insertOrUpdate", certUsers.toArray());
} catch (Exception e) {
isException = true;
this.log.error("EvidenceQueueThread add certUsers " + e);
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(certUsers.toArray());
String fileName = "EvidenceCertUser" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证用户上传证书");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
}
} finally {
certUsers = null;
}
}
// 保存存证记录信息
if (!basicInformations.isEmpty()) {
try {
try {
sqlSession.insert("com.itrus.portal.db.EvidenceBasicInformationMapper.insertOrUpdate", basicInformations.toArray());
// 调用回调方法
if (evidenceQueryQueue != null) {
try {
evidenceQueryQueue.putObjectList(basicInformations);
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
Calendar cal = Calendar.getInstance();
String content = JSONObject.toJSONString(basicInformations.toArray());
String fileName = "EvidenceBasicInformation" + "_" + cal.get(Calendar.YEAR) + cal.get(Calendar.MONTH) + cal.get(Calendar.DATE) + cal.get(Calendar.HOUR) + cal.get(Calendar.MINUTE) + cal.get(Calendar.SECOND);
try {
saveContent(content, fileName);
} catch (Exception e2) {
EvidenceLog log = new EvidenceLog();
log.setCreateTime(new Date());
log.setType("存储入库异常_存证基础信息");
log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
log.setIp(null);
logs.add(log);
throw new Exception("失败原因:" + e2);
}
}
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add basicInformations " + e);
} finally {
basicInformations = null;
}
}
// 保存日志记录
if (!logs.isEmpty())
try {
sqlSession.insert("com.itrus.portal.db.EvidenceLogMapper.insertOrUpdate", logs.toArray());
} catch (Exception e) {
isException = true;
// 将错误信息显示,不进行操作
this.log.error("EvidenceQueueThread add logs " + e);
// Calendar cal = Calendar.getInstance();
// String content = JSONObject.toJSONString(logs.toArray());
// String fileName = "EvidenceLog"
// + "_"
// + cal.get(Calendar.YEAR)
// + cal.get(Calendar.MONTH)
// + cal.get(Calendar.DATE)
// + cal.get(Calendar.HOUR)
// + cal.get(Calendar.MINUTE)
// + cal.get(Calendar.SECOND);
// try {
// saveContent(content, fileName);
// } catch (Exception e2) {
// EvidenceLog log = new EvidenceLog();
// log.setCreateTime(new Date());
// log.setType("存储入库异常_存证日志");
// log.setInfo("失败原因:" + e2 + ",失败数据:" + content);
// log.setIp(null);
// logs.add(log);
// }
} finally {
logs = null;
}
log.debug("EvidenceQueueThread the exception is [" + isException + "]");
// 若出现异常则暂停10秒钟
if (isException) {
try {
// 若队列中没有信息则等待10秒
sleep(10 * 1000);
} catch (InterruptedException e) {
log.error(e);
} finally {
isException = false;
}
}
isOver = true;
// log.error("Queue 耗时:" + (System.currentTimeMillis() - startDate));
}
}
Aggregations