use of com.itrus.portal.db.EvidenceSubjectIdentity in project portal by ixinportal.
the class EvidenceSaveTask method saveFactor.
// 核验要素
private Map<String, Object> saveFactor(Map<String, Object> result, EvidenceSaveService evidenceSaveService, String evidenceSn, JSONObject jsonEvidenceContent, EvidenceBasicInformation basicInformation, RealNameAuthentication realNameAuthentication, RealNameAuthentication realNameAuthenticationOss, EvidenceServiceConfiguration serviceConfiguration, Boolean bl) throws Exception {
try {
List<Object> objs = new ArrayList<Object>();
// 定义证据要素字段
String saveFactor = null;
// 证据存证的业务类型
String type = null;
String hapPrincipalName = null;
// 定义主体身份
// Map<String, EvidenceMainInformation> mapIdCache = new HashMap<String, EvidenceMainInformation>();
// 得到业务基本信息要素配置
String factorBusinessInfo = evidenceSaveService.getFactorBusinessInfo();
JSONArray jsonBiArray = JSONArray.parseArray(factorBusinessInfo);
// TODO : 核验事件认证
if (jsonEvidenceContent.get("authEvent") != null) {
// 可信身份缓存信息
// List<EvidenceTrustedIdentity> tiCacheList = new ArrayList<>();
JSONObject jsonAuthEvent = jsonEvidenceContent.getJSONObject("authEvent");
// 判断是否为补交信息
if (bl) {
basicInformation.setEvidenceType(2);
// 核验基础信息
for (int i = 0; i < jsonBiArray.size(); i++) {
JSONObject object = jsonBiArray.getJSONObject(i);
String name = object.getString("name");
String content = jsonAuthEvent.getString(name);
JSONObject jsonContent;
switch(i) {
// 事件发生平台
case 0:
jsonContent = JSONObject.parseObject(content);
hapPrincipalName = jsonContent.getString("hapPrincipalName");
// 判断是否接收
if (object.getBooleanValue("b_isReception") && StringUtils.isEmpty(basicInformation.getCompanyName())) {
// 判断是否必填
if (bl && object.getBooleanValue("b_isRequired") && StringUtils.isEmpty(jsonContent.getString("hapPlatformDomain"))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少事件发生平台必要参数值");
return result;
}
if (StringUtils.isEmpty(saveFactor) || !saveFactor.contains("基本信息"))
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
basicInformation.setCompanyName(hapPrincipalName);
basicInformation.setEventPlatformName(jsonContent.getString("hapPlatformName"));
basicInformation.setDomainName(jsonContent.getString("hapPlatformDomain"));
}
break;
// 业务类型
case 1:
// 判断是否接收
if (object.getBooleanValue("b_isReception") && StringUtils.isEmpty(basicInformation.getType())) {
// 判断是否必填
if (bl && object.getBooleanValue("b_isRequired") && StringUtils.isEmpty(content)) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少业务类型参数值");
return result;
}
if (StringUtils.isEmpty(saveFactor) || !saveFactor.contains("基本信息"))
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
basicInformation.setType(content);
type = object.getString("b_category");
}
break;
// 业务描述
case 2:
// 判断是否接收
if (object.getBooleanValue("b_isReception") && StringUtils.isEmpty(basicInformation.getDescription())) {
if (StringUtils.isEmpty(saveFactor) || !saveFactor.contains("基本信息"))
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
basicInformation.setDescription(content);
}
break;
// 业务单号
case 3:
// 判断是否接收
if (object.getBooleanValue("b_isReception") && StringUtils.isEmpty(basicInformation.getServiceNumber())) {
if (StringUtils.isEmpty(saveFactor) || !saveFactor.contains("基本信息"))
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
basicInformation.setServiceNumber(content);
}
break;
}
}
// if(basicInformation.getId() == null) {
// // 存储证据基本信息
// long beginTime = System.currentTimeMillis();//1、开始时间
// sqlSession.insert("com.itrus.portal.db.EvidenceBasicInformationMapper.insert", basicInformation);
// sqlSession.flushStatements();
// log.error("证据表耗时:{}", System.currentTimeMillis() - beginTime);
// } else {
// sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
// sqlSession.flushStatements();
// log.debug("Size : " + basicInformation.getEvidenceSize());
// }
} else {
sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
sqlSession.flushStatements();
// 核验基础信息
for (int i = 0; i < jsonBiArray.size(); i++) {
JSONObject object = jsonBiArray.getJSONObject(i);
if (i == 1) {
type = object.getString("b_category");
}
}
}
// 得到身份认证要素配置
String factorIdVerify = evidenceSaveService.getFactorIdVerify();
JSONArray jsonIdArray = JSONArray.parseArray(factorIdVerify);
Map<String, Object> cacheSubjectIdentity = new HashMap<String, Object>();
// 得到证据包中的事件认证数据中的事件对象认证
for (int i = 0; i < jsonIdArray.size(); i++) {
JSONObject object = jsonIdArray.getJSONObject(i);
/**
*********************************************** 《合同摘要数据》和《图片摘要数据》, 《信息摘要数据》获取主体 start *******************************************
*/
if ("合同摘要数据".equals(type) || "图片摘要数据".equals(type) || "信息摘要数据".equals(type)) {
// 得到事件包信息数据
JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("principalId");
if (i == 0 && object.getBooleanValue("i_isReception")) {
// 循环主体
for (int j = 0; j < jsonContentArray.size(); j++) {
JSONObject jsonContent = jsonContentArray.getJSONObject(j);
// 判断是否必填
if (object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContent.getString("type")) || StringUtils.isEmpty(jsonContent.getString("name")) || StringUtils.isEmpty(jsonContent.getString("dataId")))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少主体身份参数值");
return result;
}
// 判断主体是否存在
// String idCacheKey = jsonContent.getString("name") + jsonContent.getString("dataId");
EvidenceMainInformation mainInformation = null;
// EvidenceBasicInformation basicInformation2 = null;
EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name").trim());
mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId").trim());
mainExampleCriteria.andMainTypeEqualTo(jsonContent.getString("type"));
List<EvidenceMainInformation> mainInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
if (!mainInformationList.isEmpty()) {
mainInformation = mainInformationList.get(0);
}
// 当主体为空时 添加主体信息
if (mainInformation == null) {
mainInformation = new EvidenceMainInformation();
mainInformation.setSubjectName(jsonContent.getString("name").trim());
mainInformation.setIdentification(jsonContent.getString("dataId").trim());
mainInformation.setMainType(jsonContent.getString("type"));
mainInformation.setCreateTime(new Date());
mainInformation.setId(basicInformation.getId());
// queueThread.putObjectQueue(mainInformation);
objs.add(mainInformation);
// queueThread.putMap(mainInformation.getSubjectName() + mainInformation.getIdentification());
}
// else {
// // 判断基础信息表 和 主体表是否存在关联
// EvidenceSubjectIdentityExample subjectIdentityExampleExist = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iece = subjectIdentityExampleExist.createCriteria();
// iece.andBasicInformationEqualTo(evidenceSn!=null?evidenceSn:genSn);
// iece.andMainInformationEqualTo(mainInformation.getIdentification());
// EvidenceSubjectIdentity subjectIdentityExist = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExampleExist);
// if(subjectIdentityExist == null) {
// EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
// subjectIdentity1.setBasicInformation(evidenceSn!=null?evidenceSn:genSn);
// subjectIdentity1.setMainInformation(mainInformation.getIdentification());
// queueThread.putObjectQueue(subjectIdentity1);
// // sqlSession.insert("com.itrus.portal.db.EvidenceSubjectIdentityMapper.insert", subjectIdentity1);
// }
// }
String key = evidenceSn + jsonContent.getString("name").trim() + jsonContent.getString("dataId").trim();
if (cacheSubjectIdentity.get(key) == null) {
EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
subjectIdentity1.setBasicInformation(evidenceSn);
subjectIdentity1.setMainInformation(jsonContent.getString("dataId").trim());
subjectIdentity1.setMainName(jsonContent.getString("name").trim());
subjectIdentity1.setMainType(jsonContent.getShort("type"));
subjectIdentity1.setCreateTime(new Date());
// queueThread.putObjectQueue(subjectIdentity1);
objs.add(subjectIdentity1);
cacheSubjectIdentity.put(key, subjectIdentity1);
}
// 遍历 mapIdCache 的key值 判断是否存在 不存在则添加
// for(String key:mapIdCache.keySet()) {
// if(!idCacheKey.equals(key)) {
// mapIdCache.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
// }
// }
mainInformation = null;
mainInformationExample = null;
}
}
}
/**
*********************************************** 《合同摘要数据》和《图片摘要数据》 , 《信息摘要数据》获取主体 end *******************************************
*/
}
// 得到事件认证要素配置
String factorEventVerify = evidenceSaveService.getFactorEventVerify();
JSONArray jsonEvArray = JSONArray.parseArray(factorEventVerify);
// 得到证据包中的事件认证数据中的事件对象认证
// for(int i=0;i<jsonEvArray.size();i++) {
// JSONObject object = jsonEvArray.getJSONObject(i);
// // 可信身份标识
// // 判断是否接收
// if(i == 3 && object.getBooleanValue("e_isReception")) {
// if("电子合同PDF".equals(type)) {
// /************************************************* 《电子合同PDF》 获取事件发生主体 start ********************************************/
// // 得到事件包信息数据
// JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("event");
// for(int j=0;j<jsonContentArray.size();j++) {
// JSONObject jsonContent = jsonContentArray.getJSONObject(j).getJSONObject("idIdentify");
// // 判断是否必填
// if(object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonContent.getString("type"))
// || StringUtils.isEmpty(jsonContent.getString("certSn"))
// || StringUtils.isEmpty(jsonContent.getString("name"))
// || StringUtils.isEmpty(jsonContent.getString("dataId")))
// ) {
// result.put("status", 0);
// result.put("message", "提交的参数信息不完整,缺少可信身份标识参数值");
// return;
// }
// // 判断主体是否存在
// String idCacheKey = jsonContent.getString("name") + jsonContent.getString("dataId");
// EvidenceMainInformation mainInformation = null;
// EvidenceBasicInformation basicInformation2 = null;
// EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
// EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
// mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name"));
// mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId"));
// mainExampleCriteria.andMainTypeEqualTo(jsonContent.getString("type"));
// List<EvidenceMainInformation> mainInformationList = sqlSession
// .selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
// if(!mainInformationList.isEmpty()) {
// mainInformation = mainInformationList.get(0);
// }
// // 当主体为空时 添加主体信息
// if(mainInformation == null) {
// mainInformation = new EvidenceMainInformation();
// mainInformation.setSubjectName(jsonContent.getString("name"));
// mainInformation.setIdentification(jsonContent.getString("dataId"));
// mainInformation.setMainType(jsonContent.getString("type"));
// mainInformation.setCreateTime(new Date());
// sqlSession.insert("com.itrus.portal.db.EvidenceMainInformationMapper.insert", mainInformation);
// sqlSession.flushStatements();
// }
// // 遍历 mapIdCache 的key值 判断是否存在 不存在则添加
// for(String key:mapIdCache.keySet()) {
// if(!idCacheKey.equals(key)) {
// mapIdCache.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
// }
// }
// // 判断基础信息表 和 主体表是否存在关联
// EvidenceSubjectIdentityExample subjectIdentityExampleExist = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iece = subjectIdentityExampleExist.createCriteria();
// iece.andBasicInformationEqualTo(evidenceSn!=null?evidenceSn:genSn);
// iece.andMainInformationEqualTo(mainInformation.getIdentification());
// EvidenceSubjectIdentity subjectIdentityExist = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExampleExist);
// if(subjectIdentityExist == null) {
// EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
// subjectIdentity1.setBasicInformation(evidenceSn!=null?evidenceSn:genSn);
// subjectIdentity1.setMainInformation(mainInformation.getIdentification());
// sqlSession.insert("com.itrus.portal.db.EvidenceSubjectIdentityMapper.insert", subjectIdentity1);
// }
// // 判断是否需要关联身份证据
// if(StringUtils.isNotEmpty(jsonContent.getString("evidenceSn"))) {
// basicInformation2 = informationServiceImpl.getInformationBySn(jsonContent.getString("evidenceSn"), 1);
// if(basicInformation2 != null) {
// EvidenceSubjectIdentityExample subjectIdentityExample = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iec = subjectIdentityExample.createCriteria();
// iec.andBasicInformationEqualTo(evidenceSn!=null?evidenceSn:genSn);
// iec.andMainInformationEqualTo(mainInformation.getIdentification());
// EvidenceSubjectIdentity subjectIdentity = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExample);
// if(subjectIdentity == null) {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// } else {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// }
// EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
// // 判断是否为补交信息
// if(!bl && jsonContent.getString("certSn") != null) {
// EvidenceTrustedIdentityExample trustedIdentityExample = new EvidenceTrustedIdentityExample();
// EvidenceTrustedIdentityExample.Criteria tec = trustedIdentityExample.createCriteria();
// tec.andBasicInformationEqualTo(basicInformation.getId());
// tec.andCertSerialnumberEqualTo(jsonContent.getString("certSn"));
// List<EvidenceTrustedIdentity> trustedIdentities = sqlSession
// .selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustedIdentityExample);
// // 补交主体后判断 事件对象不为空则修改事件对象关联的主体
// if(!trustedIdentities.isEmpty()) {
// EvidenceTrustedIdentity ti = trustedIdentities.get(0);
// Long oldMainId = ti.getMainInformation();
// ti.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceTrustedIdentityMapper.updateByPrimaryKey", ti);
// // 给可信身份赋值
// trustedIdentity.setCertSerialnumber(ti.getCertSerialnumber());
// trustedIdentity.setSubjectdn(ti.getSubjectdn());
// trustedIdentity.setIssuerdn(ti.getIssuerdn());
// trustedIdentity.setIssuer(ti.getIssuer());
// trustedIdentity.setEvidenceBuf(ti.getEvidenceBuf());
// trustedIdentity.setStartTime(ti.getStartTime());
// trustedIdentity.setEndTime(ti.getEndTime());
// // 修改事件时间关联的主体信息
// EvidenceEventTimeExample timeExample = new EvidenceEventTimeExample();
// EvidenceEventTimeExample.Criteria timeEc = timeExample.createCriteria();
// timeEc.andMainInformationEqualTo(oldMainId);
// timeEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventTime> times = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", timeExample);
// for(EvidenceEventTime time:times) {
// time.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventTimeMapper.updateByPrimaryKey", time);
// }
// // 修改事件行为关联的主体信息
// EvidenceEventBehaviorExample behaviorExample = new EvidenceEventBehaviorExample();
// EvidenceEventBehaviorExample.Criteria behaviorEc = behaviorExample.createCriteria();
// behaviorEc.andMainInformationEqualTo(oldMainId);
// behaviorEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventBehavior> behaviors = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", behaviorExample);
// for(EvidenceEventBehavior behavior:behaviors) {
// behavior.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventBehaviorMapper.updateByPrimaryKey", behavior);
// }
// sqlSession.flushStatements();
// } else {
// continue;
// }
// }
// // 判断证据base64 字段是否为空
// // if(StringUtils.isNotEmpty(jsonContent.getString("certBase64"))) {
// // trustedIdentity.setCertBase64(jsonContent.getString("certBase64"));
// // // 解析证书Base64
// // UserCert userCert = CertUtil.getCertFromBase64(jsonContent.getString("certBase64"));
// // trustedIdentity.setCertSerialnumber(userCert.getCertSn());
// // trustedIdentity.setSubjectdn(userCert.getCertDn());
// // trustedIdentity.setIssuerdn(userCert.getIssuerDn());
// // trustedIdentity.setIssuer(EvidenceSaveServiceApi.getCertCn(userCert.getIssuerDn()));
// // if(userCert.getCertBuf() != null) {
// // trustedIdentity.setEvidenceBuf(userCert.getCertBuf().toString());
// // }
// // trustedIdentity.setStartTime(userCert.getCertStartTime());
// // trustedIdentity.setEndTime(userCert.getCertEndTime());
// // }
// //// trustedIdentity.setCertSerialnumber(jsonContent.getString("certSn"));
// // trustedIdentity.setIdentiType(jsonContent.getString("type"));
// // trustedIdentity.setBasicInformation(basicInformation.getId());
// // trustedIdentity.setEvidenceEnclosure(enclosure.getId());
// // if(StringUtils.isNotEmpty(jsonContent.getString("evidenceSn")))
// // trustedIdentity.setEvidenceSn(jsonContent.getString("evidenceSn"));
// // trustedIdentity.setCreateTime(new Date());
// // if(mainInformation != null && !"".equals(mainInformation))
// // trustedIdentity.setMainInformation(mainInformation.getId());
// // sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
// // sqlSession.flushStatements();
// tiCacheList.add(trustedIdentity);
// }
// if(jsonContentArray.size() != 0) {
// saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
// }
// }
// /************************************************* 《电子合同PDF》 获取事件发生主体 end ********************************************/
// }
// }
// 得到事件包信息数据
// JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("event");
// for(int j=0;j<jsonContentArray.size();j++) {
// JSONObject jsonContent = jsonContentArray.getJSONObject(j).getJSONObject("idIdentify");
// // 判断是否必填
// if(object.getBooleanValue("i_isRequired") && ( StringUtils.isEmpty(jsonContent.getString("type"))
// || (("1".equals(type) && StringUtils.isEmpty(jsonContent.getString("certSn")))
// || (!"1".equals(type) && StringUtils.isEmpty(jsonContent.getString("certBase64")))))) {
// result.put("status", 0);
// result.put("message", "提交的参数信息不完整,缺少可信身份标识参数值");
// return;
// }
// // 判断主体是否存在
// String idCacheKey = jsonContent.getString("name") + jsonContent.getString("dataId");
// EvidenceMainInformation mainInformation = null;
// EvidenceBasicInformation basicInformation2 = null;
// EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
// EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
// mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name"));
// mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId"));
// mainExampleCriteria.andMainTypeEqualTo(jsonContent.getString("type"));
// List<EvidenceMainInformation> mainInformationList = sqlSession
// .selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
// if(!mainInformationList.isEmpty()) {
// mainInformation = mainInformationList.get(0);
// }
// // 当主体为空时 添加主体信息
// if(mainInformation == null) {
// mainInformation = new EvidenceMainInformation();
// mainInformation.setSubjectName(jsonContent.getString("name"));
// mainInformation.setIdentification(jsonContent.getString("dataId"));
// mainInformation.setMainType(jsonContent.getString("type"));
// mainInformation.setCreateTime(new Date());
// sqlSession.insert("com.itrus.portal.db.EvidenceMainInformationMapper.insert", mainInformation);
// sqlSession.flushStatements();
// }
// // 遍历 mapIdCache 的key值 判断是否存在 不存在则添加
// for(String key:mapIdCache.keySet()) {
// if(!idCacheKey.equals(key)) {
// mapIdCache.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
// }
// }
// // 判断基础信息表 和 主体表是否存在关联
// EvidenceSubjectIdentityExample subjectIdentityExampleExist = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iece = subjectIdentityExampleExist.createCriteria();
// iece.andBasicInformationEqualTo(basicInformation.getId());
// iece.andMainInformationEqualTo(mainInformation.getId());
// EvidenceSubjectIdentity subjectIdentityExist = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExampleExist);
// if(subjectIdentityExist == null) {
// EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
// subjectIdentity1.setBasicInformation(basicInformation.getId());
// subjectIdentity1.setMainInformation(mainInformation.getId());
// sqlSession.insert("com.itrus.portal.db.EvidenceSubjectIdentityMapper.insert", subjectIdentity1);
// }
// // 判断是否需要关联身份证据
// if(StringUtils.isNotEmpty(jsonContent.getString("evidenceSn"))) {
// basicInformation2 = informationServiceImpl.getInformationBySn(jsonContent.getString("evidenceSn"), 1);
// if(basicInformation2 != null) {
// EvidenceSubjectIdentityExample subjectIdentityExample = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iec = subjectIdentityExample.createCriteria();
// iec.andBasicInformationEqualTo(basicInformation2.getId());
// iec.andMainInformationEqualTo(mainInformation.getId());
// EvidenceSubjectIdentity subjectIdentity = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExample);
// if(subjectIdentity == null) {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// } else {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// }
// EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
// // 判断是否为补交信息
// if(!bl && jsonContent.getString("certSn") != null) {
// EvidenceTrustedIdentityExample trustedIdentityExample = new EvidenceTrustedIdentityExample();
// EvidenceTrustedIdentityExample.Criteria tec = trustedIdentityExample.createCriteria();
// tec.andBasicInformationEqualTo(basicInformation.getId());
// tec.andCertSerialnumberEqualTo(jsonContent.getString("certSn"));
// List<EvidenceTrustedIdentity> trustedIdentities = sqlSession
// .selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustedIdentityExample);
// // 补交主体后判断 事件对象不为空则修改事件对象关联的主体
// if(!trustedIdentities.isEmpty()) {
// EvidenceTrustedIdentity ti = trustedIdentities.get(0);
// Long oldMainId = ti.getMainInformation();
// ti.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceTrustedIdentityMapper.updateByPrimaryKey", ti);
// // 给可信身份赋值
// trustedIdentity.setCertSerialnumber(ti.getCertSerialnumber());
// trustedIdentity.setSubjectdn(ti.getSubjectdn());
// trustedIdentity.setIssuerdn(ti.getIssuerdn());
// trustedIdentity.setIssuer(ti.getIssuer());
// trustedIdentity.setEvidenceBuf(ti.getEvidenceBuf());
// trustedIdentity.setStartTime(ti.getStartTime());
// trustedIdentity.setEndTime(ti.getEndTime());
// // 修改事件时间关联的主体信息
// EvidenceEventTimeExample timeExample = new EvidenceEventTimeExample();
// EvidenceEventTimeExample.Criteria timeEc = timeExample.createCriteria();
// timeEc.andMainInformationEqualTo(oldMainId);
// timeEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventTime> times = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", timeExample);
// for(EvidenceEventTime time:times) {
// time.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventTimeMapper.updateByPrimaryKey", time);
// }
// // 修改事件行为关联的主体信息
// EvidenceEventBehaviorExample behaviorExample = new EvidenceEventBehaviorExample();
// EvidenceEventBehaviorExample.Criteria behaviorEc = behaviorExample.createCriteria();
// behaviorEc.andMainInformationEqualTo(oldMainId);
// behaviorEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventBehavior> behaviors = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", behaviorExample);
// for(EvidenceEventBehavior behavior:behaviors) {
// behavior.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventBehaviorMapper.updateByPrimaryKey", behavior);
// }
// sqlSession.flushStatements();
// } else {
// continue;
// }
// }
//
// // 判断是否为电子合同
// if("1".equals(type)) {
// // 判断是否需要关联身份证据
// if(StringUtils.isNotEmpty(jsonContent.getString("evidenceSn"))) {
// basicInformation2 = informationServiceImpl.getInformationBySn(jsonContent.getString("evidenceSn"), 1);
// if(basicInformation2 != null) {
// EvidenceSubjectIdentityExample subjectIdentityExample = new EvidenceSubjectIdentityExample();
// EvidenceSubjectIdentityExample.Criteria iec = subjectIdentityExample.createCriteria();
// iec.andBasicInformationEqualTo(basicInformation2.getId());
// iec.andMainInformationEqualTo(mainInformation.getId());
// EvidenceSubjectIdentity subjectIdentity = sqlSession
// .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExample);
// if(subjectIdentity == null) {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// } else {
// result.put("status", 0);
// result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:"
// + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
// return;
// }
// }
// EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
// // 判断是否为补交信息
// if(!bl && jsonContent.getString("certSn") != null) {
// EvidenceTrustedIdentityExample trustedIdentityExample = new EvidenceTrustedIdentityExample();
// EvidenceTrustedIdentityExample.Criteria tec = trustedIdentityExample.createCriteria();
// tec.andBasicInformationEqualTo(basicInformation.getId());
// tec.andCertSerialnumberEqualTo(jsonContent.getString("certSn"));
// List<EvidenceTrustedIdentity> trustedIdentities = sqlSession
// .selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustedIdentityExample);
// // 补交主体后判断 事件对象不为空则修改事件对象关联的主体
// if(!trustedIdentities.isEmpty()) {
// EvidenceTrustedIdentity ti = trustedIdentities.get(0);
// Long oldMainId = ti.getMainInformation();
// ti.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceTrustedIdentityMapper.updateByPrimaryKey", ti);
// // 给可信身份赋值
// trustedIdentity.setCertSerialnumber(ti.getCertSerialnumber());
// trustedIdentity.setSubjectdn(ti.getSubjectdn());
// trustedIdentity.setIssuerdn(ti.getIssuerdn());
// trustedIdentity.setIssuer(ti.getIssuer());
// trustedIdentity.setEvidenceBuf(ti.getEvidenceBuf());
// trustedIdentity.setStartTime(ti.getStartTime());
// trustedIdentity.setEndTime(ti.getEndTime());
// // 修改事件时间关联的主体信息
// EvidenceEventTimeExample timeExample = new EvidenceEventTimeExample();
// EvidenceEventTimeExample.Criteria timeEc = timeExample.createCriteria();
// timeEc.andMainInformationEqualTo(oldMainId);
// timeEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventTime> times = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", timeExample);
// for(EvidenceEventTime time:times) {
// time.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventTimeMapper.updateByPrimaryKey", time);
// }
// // 修改事件行为关联的主体信息
// EvidenceEventBehaviorExample behaviorExample = new EvidenceEventBehaviorExample();
// EvidenceEventBehaviorExample.Criteria behaviorEc = behaviorExample.createCriteria();
// behaviorEc.andMainInformationEqualTo(oldMainId);
// behaviorEc.andEventContentEqualTo(ti.getEventContent());
// List<EvidenceEventBehavior> behaviors = sqlSession
// .selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", behaviorExample);
// for(EvidenceEventBehavior behavior:behaviors) {
// behavior.setMainInformation(mainInformation.getId());
// sqlSession.update("com.itrus.portal.db.EvidenceEventBehaviorMapper.updateByPrimaryKey", behavior);
// }
// sqlSession.flushStatements();
// } else {
// continue;
// }
// }
// // 判断证据base64 字段是否为空
// if(StringUtils.isNotEmpty(jsonContent.getString("certBase64"))) {
// trustedIdentity.setCertBase64(jsonContent.getString("certBase64"));
// // 解析证书Base64
// UserCert userCert = CertUtil.getCertFromBase64(jsonContent.getString("certBase64"));
// trustedIdentity.setCertSerialnumber(userCert.getCertSn());
// trustedIdentity.setSubjectdn(userCert.getCertDn());
// trustedIdentity.setIssuerdn(userCert.getIssuerDn());
// trustedIdentity.setIssuer(EvidenceSaveServiceApi.getCertCn(userCert.getIssuerDn()));
// if(userCert.getCertBuf() != null) {
// trustedIdentity.setEvidenceBuf(userCert.getCertBuf().toString());
// }
// trustedIdentity.setStartTime(userCert.getCertStartTime());
// trustedIdentity.setEndTime(userCert.getCertEndTime());
// }
// trustedIdentity.setCertSerialnumber(jsonContent.getString("certSn"));
// trustedIdentity.setIdentiType(jsonContent.getString("type"));
// trustedIdentity.setBasicInformation(basicInformation.getId());
// trustedIdentity.setEvidenceEnclosure(enclosure.getId());
// if(StringUtils.isNotEmpty(jsonContent.getString("evidenceSn")))
// trustedIdentity.setEvidenceSn(jsonContent.getString("evidenceSn"));
// trustedIdentity.setCreateTime(new Date());
// if(mainInformation != null && !"".equals(mainInformation))
// trustedIdentity.setMainInformation(mainInformation.getId());
// sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
// sqlSession.flushStatements();
// tiCacheList.add(trustedIdentity);
// }
// if(jsonContentArray.size() != 0) {
// saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
// }
// }
EvidenceEventContent eventContent = new EvidenceEventContent();
// 判断 补交不接收
if (bl) {
// 得到证据包中的事件数据
for (int i = 0; i < jsonEvArray.size(); i++) {
JSONObject object = jsonEvArray.getJSONObject(i);
String name = object.getString("name");
switch(i) {
// 事件认证
case 0:
// 判断合同类型
if ("电子合同PDF".equals(type)) {
// 电子合同
// // 判断是否接收
// if(object.getBooleanValue("e_isReception")) {
// // 得到事件内容中的信息
// JSONObject jsonEventContent = jsonAuthEvent.getJSONObject(name);
// // 判断必填
// if(object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonEventContent.getString("contCode"))
// || StringUtils.isEmpty(jsonEventContent.getString("title"))
// || StringUtils.isEmpty(jsonEventContent.getString("size"))
// || StringUtils.isEmpty(jsonEventContent.getString("page"))
// || StringUtils.isEmpty(jsonEventContent.getString("eventVerifierType")))) {
// result.put("status", 0);
// result.put("message", "提交的参数信息不完整,缺少事件内容认证参数值");
// return;
// }
// String eventVerifier = getAuthenticator(Integer.parseInt(jsonEventContent.getString("eventVerifierType")),
// hapPrincipalName, jsonEventContent.getString("eventVerifier"));
// if(StringUtils.isEmpty(eventVerifier)) {
// result.put("status", 0);
// result.put("message", "提交的参数信息不完整,缺少事件认证参数值");
// return;
// }
// // 存储事件内容信息
// eventContent.setEventVerifierType(jsonEventContent.getString("eventVerifierType"));
// eventContent.setEventVerifier(eventVerifier);
// eventContent.setIsPdf(true);
// eventContent.setContractTitle(jsonEventContent.getString("title"));
// eventContent.setContractNumber(jsonEventContent.getString("code"));
// eventContent.setValidStartTime(jsonEventContent.getDate("validStartTime"));
// eventContent.setValidEndTime(jsonEventContent.getDate("validEndTime"));
// eventContent.setDataFormat(jsonEventContent.getString("dataFormat"));
// eventContent.setEventSize(jsonEventContent.getString("size"));
// eventContent.setThePages(jsonEventContent.getInteger("page"));
// eventContent.setCreateTime(new Date());
// eventContent.setBasicInformation(basicInformation.getId());
// // eventContent.setEvidenceEnclosure(enclosure.getId());
// if (StringUtils.isNotEmpty(evidenceSn))
// eventContent.setEvidenceSn(evidenceSn);
// else
// eventContent.setEvidenceSn(genSn);
// sqlSession.insert("com.itrus.portal.db.EvidenceEventContentMapper.insert", eventContent);
//
// // 定义存储路径和存储名称
// // String bucketName = realNameAuthenticationOss.getKeyCode();
// String pdfName = evidenceSn + "UserUp.pdf";
// // 得到加密证书别名
// // String encryptionAlias = secretKeyService.getAliasByCertId((long)serviceConfiguration.getEncryptionCertificate());
// // 存储contCode 到原子服务
// // String retSave = EvidenceSaveServiceApi.storageSave("ST_O", bucketName, pdfName, "CT_MESSAGE",
// // jsonEventContent.get("contCode").toString(), null, null, null, null, null, false, null,
// // realNameAuthentication.getRealNameddress());
// // JSONObject jsonRetSave = JSONObject.parseObject(retSave);
// // if(jsonRetSave.getIntValue("code") != 0) {
// // result.put("status", 0);
// // result.put("message", "存储用户contCode失败");
// //// throw new Exception("存储用户contCode失败");
// // return;
// // } else {
// // String pdfSaveFile = systemConfigService.getpdfurl()+ File.separator + bucketName + File.separator + evidenceSn;
// // pdf存储到本地
// String pdfSaveFile = systemConfigService.getpdfurl()+ File.separator + evidenceSn;
// File filePathStr = new File(pdfSaveFile, pdfName);
// // 判断目录是否存在
// File fileUrl = new File(pdfSaveFile);
// if(!fileUrl.exists()) {
// fileUrl.mkdir();
// }
// // 用户contCode转pdf存储到本地
// boolean pdfSaveBl = Base64Util.genFileFromBase64(jsonEventContent.getString("contCode"), filePathStr.getPath());
// // boolean blStr = false;
// // if(StringUtils.isNotEmpty(jsonEventContent.getString("contCode"))) {
// // blStr = true;
// // }
// // if(pdfSaveBl) {
// // EvidenceEnclosure evidenceEnclosure = new EvidenceEnclosure();
// // evidenceEnclosure.setEvidenceSn(evidenceSn);
// // evidenceEnclosure.setBuid(jsonRetSave.getString("buid"));
// // evidenceEnclosure.setPdfType("2");
// // evidenceEnclosure.setType("ST_O");
// // evidenceEnclosure.setContentType("CT_MESSAGE");
// // evidenceEnclosure.setBucketName(bucketName);
// // evidenceEnclosure.setObjectName(pdfName);
// //// evidenceEnclosure.setAlias(encryptionAlias);
// // evidenceEnclosure.setApplicationTime(new Date());
// // evidenceEnclosure.setFixationTime(new Date());
// // evidenceEnclosure.setCreateTime(new Date());
// // evidenceEnclosure.setBasicInformation(basicInformation.getId());
// // sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insert", evidenceEnclosure);
// // }
// // }
// // 调用pdf验章接口
// Map<String, Object> mapPdfVerify = new HashMap<String, Object>();
// String urlPdfVerify = realNameAuthentication.getRealNameddress() + PDF_VERIFY;
// mapPdfVerify.put("pdfContent", jsonEventContent.get("contCode"));
// String rep_pdf_verify = HttpClientUtil.postForm(urlPdfVerify, AuthService.getHeader(), mapPdfVerify);
// JSONObject jsonPdfVerify = JSONObject.parseObject(rep_pdf_verify);
// if(jsonPdfVerify.getInteger("code") == 0){
// eventContent.setEventStatus(1);
// } else {
// eventContent.setEventStatus(0);
// eventContent.setFailureReason(jsonPdfVerify.getString("message"));
// basicInformation.setEvidenceStatus(0);
// if(StringUtils.isEmpty(basicInformation.getFailureReason())) {
// basicInformation.setFailureReason(jsonPdfVerify.getString("message"));
// } else {
// basicInformation.setFailureReason(basicInformation.getFailureReason() + "," + jsonPdfVerify.getString("message"));
// }
// sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
// }
// String retVerifyTi = null;
// String retVerifyBehavior = null;
// String retVerifyTime = null;
// if(StringUtils.isNotEmpty(rep_pdf_verify)
// && StringUtils.isNotEmpty(jsonPdfVerify.getString("signInfos"))) {
// // 解析pdf验章返回信息
// JSONArray jsonArraySignInfos = jsonPdfVerify.getJSONArray("signInfos");
// List<String> listStr = new ArrayList<>();
// int noId = 0;
// for(int k=0;k<jsonArraySignInfos.size();k++) {
// // 循环得到pdf验章返回数据
// JSONObject json = jsonArraySignInfos.getJSONObject(k);
// // 对应可信身份
// EvidenceTrustedIdentity trustedIdentity1 = null;
//
// // 判断验章是否包含证书
// if(StringUtils.isNotEmpty(json.getString("signerCert"))) {
// // 解析签名者证书base64编码
// UserCert userCert1 = CertUtil.getCertFromBase64(json.getString("signerCert"));
// boolean blt = true;
// // 循环已经存在的证书序列号 判断证书序列号是否存在
// for(String strCertSn:listStr){
// if(userCert1 != null && strCertSn.equals(userCert1.getCertSn())){
// blt = false;
// }
// }
// // 循环可信身份list缓存 判断证书序列号是否相同
// if(!tiCacheList.isEmpty() && tiCacheList != null){
// for(EvidenceTrustedIdentity identity:tiCacheList) {
// if(identity.getCertSerialnumber().equals(userCert1.getCertSn())){
// trustedIdentity1 = identity;
// }
// }
// }
// if(trustedIdentity1 == null) {
// noId--;
// }
// if(blt) {
// // 事件对象定义
// EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
// trustedIdentity.setBasicInformation(basicInformation.getId());
// trustedIdentity.setEventContent(eventContent.getId());
// trustedIdentity.setEvidenceSn(evidenceSn);
// if(trustedIdentity1 != null){
// trustedIdentity.setMainInformation(trustedIdentity1.getMainInformation());
// // 整合证书信息存储到对应可信身份表
// trustedIdentity1.setCertBase64(json.getString("signerCert"));
// trustedIdentity1.setSubjectdn(userCert1.getCertDn());
// trustedIdentity1.setIssuerdn(userCert1.getIssuerDn());
// trustedIdentity1.setIssuer(EvidenceSaveServiceApi.getCertCn(userCert1.getIssuerDn()));
// if(userCert1.getCertBuf() != null){
// trustedIdentity1.setEvidenceBuf(userCert1.getCertBuf().toString());
// }
// trustedIdentity1.setStartTime(userCert1.getCertStartTime());
// trustedIdentity1.setEndTime(userCert1.getCertEndTime());
// sqlSession.update("com.itrus.portal.db.EvidenceTrustedIdentityMapper.updateByPrimaryKey",
// trustedIdentity1);
// } else {
// trustedIdentity.setMainInformation((long)noId);
// }
// trustedIdentity.setCertBase64(json.getString("signerCert"));
// trustedIdentity.setCreateTime(new Date());
// trustedIdentity.setCertSerialnumber(userCert1.getCertSn());
// trustedIdentity.setSubjectdn(userCert1.getCertDn());
// trustedIdentity.setIssuerdn(userCert1.getIssuerDn());
// trustedIdentity.setIdentiType("1");
// trustedIdentity.setIssuer(EvidenceSaveServiceApi.getCertCn(userCert1.getIssuerDn()));
// if(userCert1.getCertBuf() != null){
// trustedIdentity.setEvidenceBuf(userCert1.getCertBuf().toString());
// }
// trustedIdentity.setStartTime(userCert1.getCertStartTime());
// trustedIdentity.setEndTime(userCert1.getCertEndTime());
//
// // 事件对象核验结果
// trustedIdentity.setCheckTime(new Date());
// if(json.getIntValue("vcResult") == 0) {
// trustedIdentity.setCheckStatus("1");
// trustedIdentity.setCheckSuccessTime(new Date());
// } else {
// if(StringUtils.isEmpty(retVerifyTi))
// retVerifyTi = "事件对象核验失败";
// trustedIdentity.setCheckStatus("0");
// if(json.getIntValue("vcResult") == 30006)
// trustedIdentity.setUnreason("未找到对应的受信任CA证书");
// else if(json.getIntValue("vcResult") == 30007)
// trustedIdentity.setUnreason("证书已吊销");
// else if(json.getIntValue("vcResult") == 30008)
// trustedIdentity.setUnreason("证书不在有效期内");
// else if(json.getIntValue("vcResult") == 30009)
// trustedIdentity.setUnreason("无效的证书签名");
// else if(json.getIntValue("vcResult") == 300010)
// trustedIdentity.setUnreason("其他证书验证错误");
// else
// trustedIdentity.setUnreason("非正常其他证书验证错误");
// }
// trustedIdentity.setVewestCheckTime(new Date());
// trustedIdentity.setCheckContent("1.验证证书有效期/n2.验证证书颁发者签名/n3.验证证书是否吊销");
// sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
// }
// listStr.add(userCert1.getCertSn());
// } else {
// retVerifyTi = "事件对象核验失败";
// }
// // 事件行为定义
// EvidenceEventBehavior eventBehavior = new EvidenceEventBehavior();
// // 判断时间戳是否存在
// if(StringUtils.isNotEmpty(json.getString("timeStamp"))
// && !json.getString("timeStamp").equals("{}")) {
// // 验证时间戳
// EvidenceEventTime eventTime = new EvidenceEventTime();
// if(trustedIdentity1 != null){
// eventTime.setMainInformation(trustedIdentity1.getMainInformation());
// } else {
// eventTime.setMainInformation((long)noId);
// }
// eventTime.setIdentiType("1");
// eventTime.setEventContent(eventContent.getId());
// eventTime.setCertificate(json.getJSONObject("timeStamp").getString("signature"));
// eventTime.setHashAlgorithm(json.getJSONObject("timeStamp").getString("hashAlg"));
// eventTime.setHashvalue(json.getJSONObject("timeStamp").getString("hashData"));
// eventTime.setCertBase64(json.getJSONObject("timeStamp").getString("tsCert"));
// if(StringUtils.isNotEmpty(json.getJSONObject("timeStamp").getString("time"))) {
// eventTime.setSignatureTime(json.getJSONObject("timeStamp").getDate("time"));
// } else {
// eventTime.setSignatureTime(json.getDate("stampTime"));
// }
// eventTime.setCreateTime(new Date());
// // 解析时间戳证书 Base64
// if(json.getJSONObject("timeStamp").getString("tsCert") != null) {
// UserCert userCert = CertUtil.getCertFromBase64(json.getJSONObject("timeStamp").getString("tsCert"));
// eventTime.setCertificateDn(userCert.getCertDn());
// eventTime.setIssuerdn(userCert.getIssuerDn());
// }
// // 时间核验结果
// eventTime.setCheckTime(new Date());
// if(json.getIntValue("vtsResult") == 0) {
// eventTime.setCheckStatus("1");
// eventTime.setCheckSuccessTime(new Date());
// } else {
// if(StringUtils.isEmpty(retVerifyTime)) {
// retVerifyTime = "事件时间核验失败";
// }
// eventTime.setCheckStatus("0");
// if(json.getIntValue("vtsResult") == 60002) {
// eventTime.setUnreason("验证时戳失败");
// } else {
// eventTime.setUnreason("其他验证时戳错误");
// }
// }
// eventTime.setVewestCheckTime(new Date());
// eventTime.setCheckContent("签名原文完整、真实、是否被篡改");
// sqlSession.insert("com.itrus.portal.db.EvidenceEventTimeMapper.insert", eventTime);
// } else {
// eventBehavior.setVerificationTime(json.getDate("stampTime"));
// }
// // 判断事件行为是否返回为空
// if(StringUtils.isNotEmpty(json.getString("signature"))) {
// eventBehavior.setHashAlgorithm(json.getString("hashAlg"));
// eventBehavior.setSignaturevalue(json.getString("signature"));
// eventBehavior.setHashBackSigning(json.getString("msgDigest"));
// eventBehavior.setEventContent(eventContent.getId());
// eventBehavior.setIdentiType("1");
// if(trustedIdentity1 != null){
// eventBehavior.setMainInformation(trustedIdentity1.getMainInformation());
// } else {
// eventBehavior.setMainInformation((long)noId);
// }
// // 事件行为核验结果
// eventBehavior.setCheckTime(new Date());
// if(json.getIntValue("vdsResult") == 0) {
// eventBehavior.setCheckStatus("1");
// eventBehavior.setCheckSuccessTime(new Date());
// } else {
// if(StringUtils.isEmpty(retVerifyBehavior)) {
// retVerifyBehavior = "事件行为核验失败";
// }
// eventBehavior.setCheckStatus("0");
// if(json.getIntValue("vdsResult") == 40002) {
// eventBehavior.setUnreason("验证签名失败");
// } else {
// eventBehavior.setUnreason("其他验证签名错误");
// }
// }
// eventBehavior.setVewestCheckTime(new Date());
// eventBehavior.setCheckContent("签名原文完整、真实、是否被篡改");
// sqlSession.insert("com.itrus.portal.db.EvidenceEventBehaviorMapper.insert", eventBehavior);
// } else {
// retVerifyBehavior = "事件行为核验失败";
// }
// }
// if(jsonArraySignInfos.size() == 0) {
// eventContent.setEventStatus(0);
// if(StringUtils.isNotEmpty(eventContent.getFailureReason())) {
// eventContent.setFailureReason(eventContent.getFailureReason() + ",pdf签章失败:返回集合为空。");
// } else {
// eventContent.setFailureReason("pdf签章失败:返回集合为空。");
// }
// }
// // 整合错误信息
// // if(StringUtils.isNotEmpty(eventContent.getFailureReason())) {
// // eventContent.setFailureReason(eventContent.getFailureReason());
// // }
// if(StringUtils.isNotEmpty(retVerifyTi)) {
// if(StringUtils.isNotEmpty(eventContent.getFailureReason()))
// eventContent.setFailureReason(eventContent.getFailureReason() + "," + retVerifyTi);
// else
// eventContent.setFailureReason(retVerifyTi);
// }
// if(StringUtils.isNotEmpty(retVerifyBehavior)) {
// if(StringUtils.isNotEmpty(eventContent.getFailureReason()))
// eventContent.setFailureReason(retVerifyBehavior);
// else
// eventContent.setFailureReason(eventContent.getFailureReason() + "," + retVerifyBehavior);
// }
// if(StringUtils.isNotEmpty(retVerifyTime)) {
// if(StringUtils.isNotEmpty(eventContent.getFailureReason()))
// eventContent.setFailureReason(retVerifyTime);
// else
// eventContent.setFailureReason(eventContent.getFailureReason() + "," + retVerifyTime);
// }
// sqlSession.update("com.itrus.portal.db.EvidenceEventContentMapper.updateByPrimaryKey", eventContent);
// if(eventContent.getEventStatus() == 0) {
// if(StringUtils.isNotEmpty(basicInformation.getFailureReason())) {
// basicInformation.setFailureReason(basicInformation.getFailureReason() + "," + eventContent.getFailureReason());
// } else {
// basicInformation.setEvidenceStatus(0);
// basicInformation.setFailureReason(eventContent.getFailureReason());
// }
// sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
// }
// }
// saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
// }
/**
*********************************************** 《电子合同PDF》 获取事件内容 end *******************************************
*/
} else if ("合同摘要数据".equals(type) || "图片摘要数据".equals(type) || "信息摘要数据".equals(type)) {
// 判断是否接收
if (object.getBooleanValue("e_isReception")) {
// 得到事件内容中的信息
JSONObject jsonEventContent = jsonAuthEvent.getJSONObject(name);
// 判断必填
if (object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonEventContent.getString("contCode")) || StringUtils.isEmpty(jsonEventContent.getString("dataFormat")))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少事件内容认证参数值");
return result;
}
// 存储事件内容信息
eventContent.setIsPdf(false);
eventContent.setContractTitle(jsonEventContent.getString("title"));
eventContent.setCreateTime(new Date());
eventContent.setBasicInformation(basicInformation.getId());
eventContent.setEvidenceSn(evidenceSn);
eventContent.setContCode(jsonEventContent.getString("contCode"));
if ("合同摘要数据".equals(type) || "信息摘要数据".equals(type)) {
eventContent.setValidStartTime(jsonEventContent.getDate("validStartTime"));
eventContent.setValidEndTime(jsonEventContent.getDate("validEndTime"));
eventContent.setDataFormat(jsonEventContent.getString("dataFormat"));
} else {
eventContent.setDataFormatImg(jsonEventContent.getString("dataFormat"));
}
// queueThread.putObjectQueue(eventContent);
objs.add(eventContent);
eventContent = null;
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
}
/**
*********************************************** 《合同摘要数据》 和 《图片摘要数据》 获取事件内容 end *******************************************
*/
}
break;
}
}
} else {
// 补交信息得到事件内容
EvidenceEventContentExample contentExample = new EvidenceEventContentExample();
EvidenceEventContentExample.Criteria cec = contentExample.createCriteria();
cec.andBasicInformationEqualTo(basicInformation.getId());
List<EvidenceEventContent> eventContents = sqlSession.selectList("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", contentExample);
if (!eventContents.isEmpty()) {
eventContent = eventContents.get(0);
}
}
/*if(StringUtils.isNotEmpty(jsonAuthEvent.getString("event"))) {
JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("event");
for(int i=0;i<jsonContentArray.size();i++) {
// 得到对应的主体信息
JSONObject jsonContent = jsonContentArray.getJSONObject(i);
JSONObject jsonIdIdentify = jsonContentArray.getJSONObject(i).getJSONObject("idIdentify");
// 判断主体是否存在
String idCacheKey = jsonIdIdentify.getString("name") + jsonIdIdentify.getString("dataId");
EvidenceMainInformation mainInformation = null;
if(mapIdCache.get(idCacheKey) == null || "".equals(mapIdCache.get(idCacheKey))) {
EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
mainExampleCriteria.andSubjectNameEqualTo(jsonIdIdentify.getString("name"));
mainExampleCriteria.andIdentificationEqualTo(jsonIdIdentify.getString("dataId"));
List<EvidenceMainInformation> mainInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
if(!mainInformationList.isEmpty()) {
mainInformation = mainInformationList.get(0);
mapIdCache.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
}
} else {
mainInformation = mapIdCache.get(idCacheKey);
}
if(mainInformation == null || "".equals(mainInformation)) {
result.put("status", 0);
result.put("message", "判断主体为空");
return;
}
// 核验事件认证
// 得到证据包中的事件数据
for(int j=0;j<jsonEvArray.size();j++) {
JSONObject object = jsonEvArray.getJSONObject(j);
String name = object.getString("name");
switch (j) {
// 事件意愿认证
case 2:
if(!bl) {
// 查询信息是否已经存证
EvidenceEventDesireExample ede = new EvidenceEventDesireExample();
EvidenceEventDesireExample.Criteria edec = ede.createCriteria();
edec.andEventContenteEqualTo(eventContent.getId());
edec.andMainInformationEqualTo(mainInformation.getId());
List<EvidenceEventDesire> eventDesires = sqlSession
.selectList("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", ede);
if(!eventDesires.isEmpty()) {
break;
}
}
// 判断是否接收
if(object.getJSONObject("e_isReception").getBooleanValue("e_isReception_1")
|| object.getJSONObject("e_isReception").getBooleanValue("e_isReception_2")) {
JSONObject jsonWill = jsonContent.getJSONObject(name);
if(bl && object.getBooleanValue("e_isRequired") && (
StringUtils.isEmpty(jsonWill.getString("authenticatorThenType"))
|| (jsonWill.getString("authenticatorThenType").equals("3")
&& StringUtils.isEmpty(jsonWill.getString("authenticatorThen")))
|| StringUtils.isEmpty(jsonWill.getString("way")))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少事件意愿认证参数值");
return;
}
EvidenceEventDesire eventDesire = new EvidenceEventDesire();
// 1.证书授权 2.短信验证
if(jsonWill.getIntValue("way") == 1) {
JSONObject jsonCertContent = jsonWill.getJSONObject("certAccreditContent");
if(bl && object.getBooleanValue("e_isRequired") && (
StringUtils.isEmpty(jsonCertContent.getString("certBase64"))
|| StringUtils.isEmpty(jsonCertContent.getString("challengeCode"))
|| StringUtils.isEmpty(jsonCertContent.getString("answerCode"))
|| StringUtils.isEmpty(jsonCertContent.getString("verifyTime")))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少事件意愿认证参数值");
return;
}
// 验证证书
String urlCertVerify = realNameAuthentication.getRealNameddress() + CERT_VERIFY;
Map<String, Object> mapCertVerify = new HashMap<String, Object>();
mapCertVerify.put("cert", jsonCertContent.getString("certBase64"));
mapCertVerify.put("verifyFlag", "7");
String rep_cert_verify = HttpClientUtil.postForm(urlCertVerify, AuthService.getHeader(), mapCertVerify);
JSONObject jsonCertVerify = JSONObject.parseObject(rep_cert_verify);
if(StringUtils.isNotEmpty(rep_cert_verify) && jsonCertVerify.getIntValue("code") == 0) {
// 解析证书Base64
UserCert userCert = CertUtil.getCertFromBase64(jsonCertVerify.getString("certBase64"));
eventDesire.setCertSerialnumber(userCert.getCertSn());
eventDesire.setSubjectdn(userCert.getCertDn());
eventDesire.setIssuerdn(userCert.getIssuerDn());
eventDesire.setEvidenceBuf(userCert.getCertBuf().toString());
eventDesire.setStartTime(userCert.getCertStartTime());
eventDesire.setEndTime(userCert.getCertEndTime());
} else {
result.put("status", 0);
result.put("message", "验证证书失败");
return;
}
eventDesire.setChallengeCode(jsonCertContent.getString("challengeCode"));
eventDesire.setAnswerCode(jsonCertContent.getString("answerCode"));
eventDesire.setClientDevice(jsonCertContent.getString("clientFacility"));
eventDesire.setVerificationTime(jsonCertContent.getDate("verifyTime"));
eventDesire.setWaysExpression(jsonWill.getString("way"));
} else if(jsonWill.getIntValue("way") == 2) {
JSONObject jsonSmsContent = jsonWill.getJSONObject("verifySmsContent");
if(bl && object.getBooleanValue("e_isRequired") && (
StringUtils.isEmpty(jsonSmsContent.getString("phone"))
|| StringUtils.isEmpty(jsonSmsContent.getString("sendTime"))
|| StringUtils.isEmpty(jsonSmsContent.getString("smsContent"))
|| StringUtils.isEmpty(jsonSmsContent.getString("verifyCode"))
|| StringUtils.isEmpty(jsonSmsContent.getString("verifyTime")))) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少事件意愿认证参数值");
return;
}
eventDesire.setPhone(jsonSmsContent.getString("phone"));
eventDesire.setSmsContent(jsonSmsContent.getString("smsContent"));
eventDesire.setVerificationCode(jsonSmsContent.getString("verifyCode"));
eventDesire.setSendOutTime(jsonSmsContent.getDate("sendTime"));
eventDesire.setVerificationTime(jsonSmsContent.getDate("verifyTime"));
eventDesire.setWaysExpression(jsonWill.getString("way"));
}
String eventVerifier = getAuthenticator(Integer.parseInt(jsonWill.getString("authenticatorThenType")),
hapPrincipalName, jsonWill.getString("authenticatorThen"));
if(StringUtils.isEmpty(eventVerifier)) {
result.put("status", 0);
result.put("message", "提交的参数信息不完整,缺少身份意愿鉴别参数值");
return;
}
eventDesire.setMainInformation(mainInformation.getId());
eventDesire.setEventContente(eventContent.getId());
eventDesire.setCreateTime(new Date());
eventDesire.setEventVerifierType(jsonWill.getString("authenticatorThenType"));
eventDesire.setEventVerifier(eventVerifier);
eventDesire.setVerificationResult(jsonWill.getString("verifyResult"));
sqlSession.insert("com.itrus.portal.db.EvidenceEventDesireMapper.insert", eventDesire);
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
}
break;
// 事件地点认证
case 4:
if(!bl) {
// 查询信息是否已经存证
EvidenceEventNetworkAddressExample nae = new EvidenceEventNetworkAddressExample();
EvidenceEventNetworkAddressExample.Criteria naec = nae.createCriteria();
naec.andEventContentEqualTo(eventContent.getId());
naec.andMainInformationEqualTo(mainInformation.getId());
List<EvidenceEventNetworkAddress> eventNetworkAddresses = sqlSession
.selectList("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", nae);
if(!eventNetworkAddresses.isEmpty()) {
break;
}
}
// 判断是否接收
if(object.getBooleanValue("e_isReception")) {
JSONObject jsonAddress = jsonContent.getJSONObject("netAddress");
// 定义事件网络地址对象
EvidenceEventNetworkAddress eventNetworkAddress = new EvidenceEventNetworkAddress();
// 整合数据 存储
eventNetworkAddress.setEventContent(eventContent.getId());
eventNetworkAddress.setMainInformation(mainInformation.getId());
eventNetworkAddress.setCreateTime(new Date());
if(jsonAddress.getBooleanValue("typeReg")) {
JSONObject jsonContentReg = jsonAddress.getJSONObject("content");
eventNetworkAddress.setType("1");
eventNetworkAddress.setAccountNumber(jsonContentReg.getString("code"));
eventNetworkAddress.setIpAddress(jsonContentReg.getString("ipAddress"));
eventNetworkAddress.setSigninTime(jsonContentReg.getDate("time"));
} else {
eventNetworkAddress.setType("0");
}
if(jsonAddress.getBooleanValue("typeSign")) {
JSONObject jsonContentSign = jsonAddress.getJSONObject("content1");
eventNetworkAddress.setSigninNumber(jsonContentSign.getString("code"));
eventNetworkAddress.setSigninipAddress(jsonContentSign.getString("ipAddress"));
eventNetworkAddress.setSendOutTime(jsonContentSign.getDate("time"));
eventNetworkAddress.setSigninType("1");
} else {
eventNetworkAddress.setSigninType("0");
}
sqlSession.insert("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.insert", eventNetworkAddress);
saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
}
break;
}
}
}
}*/
}
result.put("saveFactor", saveFactor);
result.put("basicInformation", basicInformation);
result.put("objs", objs);
return result;
} catch (Exception e) {
e.printStackTrace();
StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 5];
String info = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
LogUtil.evidencelog(sqlSession, evidenceSn, "存证接口", "存证失败,证据编号:" + evidenceSn + ", 失败原因:" + info);
result.put("status", -5);
result.put("message", "系统服务错误,请联系管理员");
return result;
}
}
use of com.itrus.portal.db.EvidenceSubjectIdentity in project portal by ixinportal.
the class HisCertificateController method show.
/**
* 查看详情
*
* @param id
* @param type
* @param uiModel
* @return
*/
@RequestMapping(value = "/{id}/{type}", produces = "text/html")
public String show(@PathVariable("id") Long id, @PathVariable("type") int type, Model uiModel) {
EvidenceHisCertificate hisCertificate = hiscertificate.selectById(id);
// 出征流水号
contractNumber = hisCertificate.getSerialnumber();
// 得到服务编码
AppService appservice = appService.selectById(hisCertificate.getHisAppService());
// 得到出证服务配置
EvidenceOutServiceConfigExample saveService = new EvidenceOutServiceConfigExample();
EvidenceOutServiceConfigExample.Criteria saveServiceEx = saveService.createCriteria();
saveServiceEx.andAppServiceEqualTo(appservice.getId());
EvidenceOutServiceConfig outService = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutServiceConfigMapper.selectByExample", saveService);
// 得到出证模板信息
EvidenceOutTemplate outtemp = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", outService.getSaveRetTemplate());
uiModel.addAttribute("hisCertificate", hisCertificate);
uiModel.addAttribute("outtemp", outtemp);
// 获取证据附件表
EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
envlosureEx.andSerialnumberEqualTo(hisCertificate.getSerialnumber());
envlosureEx.andPdfTypeEqualTo("4");
EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
uiModel.addAttribute("envlosure", envlosure);
Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
// Map<Long, List<EvidenceBasicInformation>> mbasi = new HashMap<Long,
// List<EvidenceBasicInformation>>();
List<EvidenceBasicInformation> blists = new ArrayList<EvidenceBasicInformation>();
// 得到出证关联表信息
EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
hisreation.andHisCertificateEqualTo(hisCertificate.getId());
List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
for (int j = 0; j < hisRelation.size(); j++) {
List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
// 得到证据基本信息
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
blists.add(basic);
// 得到证据身份主题关联信息
EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
identity.andBasicInformationEqualTo(basic.getEvidenceSn());
List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
for (int g = 0; g < subjectIdentity.size(); g++) {
// 得到主题身份信息
EvidenceMainInformation mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey", subjectIdentity.get(g).getMainInformation());
mlist.add(mainInfo);
}
minfo.put(basic.getId(), mlist);
}
uiModel.addAttribute("mainInfo", minfo);
uiModel.addAttribute("blists", blists);
if (type == 1) {
// 待出证
return "hiscertificate/show";
} else if (type == 2) {
// 已出证
return "hiscertificate/show1";
}
return null;
}
use of com.itrus.portal.db.EvidenceSubjectIdentity in project portal by ixinportal.
the class HisCertificateController method list.
@RequestMapping(produces = "text/html")
public // 待出证
String list(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, @RequestParam(value = "serialnumber", required = false) String serialnumber, @RequestParam(value = "serviceRequestPlatform", required = false) String serviceRequestPlatform, @RequestParam(value = "hisApplicant", required = false) String hisApplicant, @RequestParam(value = "subjectName", required = false) String subjectName, @RequestParam(value = "identification", required = false) String identification, @RequestParam(value = "hisway", required = false) String hisway, // 返回页面
@RequestParam(value = "status", required = false) String status, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, // 已出证
@RequestParam(value = "queryDate3", required = false) Date queryDate3, @RequestParam(value = "queryDate4", required = false) Date queryDate4, @RequestParam(value = "queryDate5", required = false) Date queryDate5, @RequestParam(value = "queryDate6", required = false) Date queryDate6, @RequestParam(value = "evidenceSn1", required = false) String evidenceSn1, @RequestParam(value = "serialnumber1", required = false) String serialnumber1, @RequestParam(value = "serviceRequestPlatform1", required = false) String serviceRequestPlatform1, @RequestParam(value = "hisApplicant1", required = false) String hisApplicant1, @RequestParam(value = "subjectName1", required = false) String subjectName1, @RequestParam(value = "hisState", required = false) String hisState, @RequestParam(value = "hisway1", required = false) String hisway1, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, Model uiModel) {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate1 = calendar.getTime();
}
if (queryDate3 == null && queryDate4 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate4 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate3 = calendar.getTime();
}
if (queryDate5 == null && queryDate6 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate6 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate5 = calendar.getTime();
}
// 待出证记录
Map param = new HashMap();
if (page == null || page < 1)
page = 1;
if (size == null || size < 1)
size = 10;
Integer offset = size * (page - 1);
param.put("offset", offset);
param.put("limit", size);
param.put("queryDate1", queryDate1);
param.put("queryDate2", queryDate2);
if (StringUtils.isNotEmpty(evidenceSn)) {
param.put("evidenceSn", "%" + evidenceSn + "%");
}
if (StringUtils.isNotEmpty(serialnumber)) {
param.put("serialnumber", "%" + serialnumber + "%");
}
if (StringUtils.isNotEmpty(serviceRequestPlatform)) {
param.put("serviceRequestPlatform", "%" + serviceRequestPlatform + "%");
}
if (StringUtils.isNotEmpty(hisApplicant)) {
param.put("hisApplicant", "%" + hisApplicant + "%");
}
if (StringUtils.isNotEmpty(subjectName)) {
param.put("subjectName", "%" + subjectName + "%");
}
if (StringUtils.isNotEmpty(identification)) {
param.put("identification", "%" + identification + "%");
}
if (StringUtils.isNotEmpty(hisway)) {
param.put("hisway", hisway);
}
// else{
// //String hisw = "2,3";
// param.put("hisway", "2,3");
// }
// 得到待出证信息
List<Map<String, Object>> list = hiscertificate.selectHisCertificateListEnt(param);
int count = hiscertificate.selectHisCertificateCountEnt(param);
Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
Map<Long, List<EvidenceBasicInformation>> mbasi = new HashMap<Long, List<EvidenceBasicInformation>>();
for (int i = 0; i < list.size(); i++) {
// 得到出证关联表信息
long id = Long.parseLong(list.get(i).get("id").toString());
EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
hisreation.andHisCertificateEqualTo(id);
List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
List<EvidenceBasicInformation> blist = new ArrayList<EvidenceBasicInformation>();
List<EvidenceMainInformation> lists = new ArrayList<EvidenceMainInformation>();
for (int j = 0; j < hisRelation.size(); j++) {
// 得到证据基本信息
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
blist.add(basic);
// 得到证据身份主题关联信息
EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
identity.andBasicInformationEqualTo(basic.getEvidenceSn());
List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
for (int g = 0; g < subjectIdentity.size(); g++) {
// 得到主题身份信息
EvidenceMainInformation mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey", subjectIdentity.get(g).getMainInformation());
lists.add(mainInfo);
}
}
minfo.put(id, lists);
mbasi.put(id, blist);
}
uiModel.addAttribute("pages", (count + size - 1) / size);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("count", count);
uiModel.addAttribute("list", list);
uiModel.addAttribute("mainInfo", minfo);
uiModel.addAttribute("blist", mbasi);
// 已出证
Map param1 = new HashMap();
// page,size
if (page2 == null || page2 < 1)
page2 = 1;
if (size2 == null || size2 < 1)
size2 = 10;
// query data
Integer offset2 = size2 * (page2 - 1);
param1.put("offset", offset2);
param1.put("limit", size2);
param1.put("queryDate3", queryDate3);
param1.put("queryDate4", queryDate4);
param1.put("queryDate5", queryDate5);
param1.put("queryDate6", queryDate6);
if (StringUtils.isNotEmpty(evidenceSn1)) {
param1.put("evidenceSn", "%" + evidenceSn1 + "%");
}
if (StringUtils.isNotEmpty(serialnumber1)) {
param1.put("serialnumber", "%" + serialnumber1 + "%");
}
if (StringUtils.isNotEmpty(serviceRequestPlatform1)) {
param1.put("serviceRequestPlatform", "%" + serviceRequestPlatform1 + "%");
}
if (StringUtils.isNotEmpty(hisApplicant1)) {
param1.put("hisApplicant", "%" + hisApplicant1 + "%");
}
if (StringUtils.isNotEmpty(subjectName1)) {
param1.put("subjectName", "%" + subjectName1 + "%");
}
if (StringUtils.isNotEmpty(hisState) && !"-1".equals(hisState)) {
param1.put("hisState", hisState);
}
if (StringUtils.isNotEmpty(hisway1) && !"0".equals(hisway1)) {
param1.put("hisway", hisway1);
}
List<Map<String, Object>> hlist = hiscertificate.selectHisCertificateEnt(param1);
int count1 = hiscertificate.selectHisCertificateSizeEnt(param1);
Map<Long, List<EvidenceMainInformation>> minfor = new HashMap<Long, List<EvidenceMainInformation>>();
Map<Long, List<EvidenceBasicInformation>> mbasic = new HashMap<Long, List<EvidenceBasicInformation>>();
for (int i = 0; i < hlist.size(); i++) {
// 得到出证关联表信息
long id = Long.parseLong(hlist.get(i).get("id").toString());
EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
hisreation.andHisCertificateEqualTo(id);
List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
List<EvidenceBasicInformation> blists = new ArrayList<EvidenceBasicInformation>();
for (int j = 0; j < hisRelation.size(); j++) {
// 得到证据基本信息
EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
blists.add(basic);
// 得到证据身份主题关联信息
EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
identity.andBasicInformationEqualTo(basic.getEvidenceSn());
List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
for (int g = 0; g < subjectIdentity.size(); g++) {
// 得到主题身份信息
EvidenceMainInformation mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey", subjectIdentity.get(g).getMainInformation());
mlist.add(mainInfo);
}
}
minfor.put(id, mlist);
mbasic.put(id, blists);
}
uiModel.addAttribute("pages2", (count1 + size2 - 1) / size2);
// page, size
if (page2 > 1 && size2 * (page2 - 1) >= count1) {
page2 = (count1 + size2 - 1) / size2;
}
List<EvidenceHisCertificate> his = hiscertificate.selecthisway();
uiModel.addAttribute("his", his);
uiModel.addAttribute("page2", page2);
uiModel.addAttribute("size2", size2);
uiModel.addAttribute("count2", count1);
uiModel.addAttribute("hlist", hlist);
uiModel.addAttribute("ainInfo", minfor);
uiModel.addAttribute("blists", mbasic);
uiModel.addAttribute("status", status);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
uiModel.addAttribute("queryDate3", queryDate3);
uiModel.addAttribute("queryDate4", queryDate4);
uiModel.addAttribute("queryDate5", queryDate5);
uiModel.addAttribute("queryDate6", queryDate6);
uiModel.addAttribute("evidenceSn", evidenceSn);
uiModel.addAttribute("serialnumber", serialnumber);
uiModel.addAttribute("serviceRequestPlatform", serviceRequestPlatform);
uiModel.addAttribute("hisApplicant", hisApplicant);
uiModel.addAttribute("subjectName", subjectName);
uiModel.addAttribute("identification", identification);
uiModel.addAttribute("hisway2", hisway);
uiModel.addAttribute("serialnumber1", serialnumber1);
uiModel.addAttribute("serviceRequestPlatform1", serviceRequestPlatform1);
uiModel.addAttribute("hisApplicant", hisApplicant1);
uiModel.addAttribute("subjectName1", subjectName1);
uiModel.addAttribute("hisState", hisState);
uiModel.addAttribute("hisway3", hisway1);
uiModel.addAttribute("evidenceSn1", evidenceSn1);
return "hiscertificate/list";
}
use of com.itrus.portal.db.EvidenceSubjectIdentity in project portal by ixinportal.
the class BasicInformationController method show1.
/**
* 身份认证详情
*
* @param id
* @param uiModel
* @return
*/
@RequestMapping(value = "/identity/{id}", produces = "text/html")
public String show1(@PathVariable("id") Long id, Model uiModel) {
// 得到证据详情
EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", id);
List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
// 得到主体身份信息
EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
identity.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
for (int i = 0; i < subjectIdentity.size(); i++) {
// 得到主体信息
/*List<EvidenceMainInformation> mainInfo = sqlSession.selectList(
"com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
subjectIdentity.get(i).getMainInformation());*/
EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
tionE.andIdentificationEqualTo(subjectIdentity.get(i).getMainInformation());
// infomationE.isDistinct();
if (subjectIdentity.get(i).getMainName() != null) {
tionE.andSubjectNameEqualTo(subjectIdentity.get(i).getMainName());
}
List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
if (mainInfo.size() != 0) {
mlist.add(mainInfo.get(0));
}
// mlist.add(mainInfo);
}
// 得到身份意愿鉴别
EvidenceDesireIdentifyExample desireid = new EvidenceDesireIdentifyExample();
EvidenceDesireIdentifyExample.Criteria desireidentitfy = desireid.createCriteria();
desireidentitfy.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
EvidenceDesireIdentify desire = sqlSession.selectOne("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", desireid);
// 得到证据附件信息,用于查询服务委托人等信息
EvidenceEnclosureExample enclou = new EvidenceEnclosureExample();
EvidenceEnclosureExample.Criteria sure = enclou.createCriteria();
// sure.andBasicInformationEqualTo(id);
sure.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
sure.andPdfTypeEqualTo("1");
EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclou);
if (enclosure != null) {
// 服务委托人签名信息
EvidenceClientSignatureExample client = new EvidenceClientSignatureExample();
EvidenceClientSignatureExample.Criteria signat = client.createCriteria();
signat.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
signat.andNameEqualTo("0");
EvidenceClientSignature cliensig = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", client);
// 天威签名信息
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);
if (cilentsignature != null) {
// 天威证书信息
/*EvidenceCertExample certE = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCertE = certE.createCriteria();
evidenceCertE.andClientSignatureEqualTo(cilentsignature.getId());*/
EvidenceCert oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cilentsignature.getCertId());
// 天威核验信息
EvidenceCheckExample checkE = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheckE = checkE.createCriteria();
evidenceCheckE.andClientSignatureEqualTo(cilentsignature.getId());
EvidenceCheck oneCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkE);
// 天威证书信息
uiModel.addAttribute("oneCert", oneCert);
// 天威核验信息
uiModel.addAttribute("oneCheck", oneCheck);
}
// 服务委托人时间戳信息
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);
EvidenceCheck listCheck = new EvidenceCheck();
List<EvidenceCert> listCert = new ArrayList<EvidenceCert>();
if (cliensig != null && cliensig.getId() != null) {
// 服务委托人证书信息
/*EvidenceCertExample certEx = new EvidenceCertExample();
EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
evidenceCert.andClientSignatureEqualTo(cliensig.getId());*/
listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cliensig.getCertId());
// 服务委托人核验信息
EvidenceCheckExample checkEx = new EvidenceCheckExample();
EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
evidenceCheck.andClientSignatureEqualTo(cliensig.getId());
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("mapCheck", mapCheck);
// 服务委托人签名信息
uiModel.addAttribute("cliensig", cliensig);
// 天威签名信息
uiModel.addAttribute("cilentsignature", cilentsignature);
// 服务委托人时间戳信息
uiModel.addAttribute("clientTimestamp", clientTimestamp);
// 天威时间戳信息
uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
}
// 身份实名认证信息
EvidenceRealNameExample realnameE = new EvidenceRealNameExample();
EvidenceRealNameExample.Criteria realnameEx = realnameE.createCriteria();
// realnameEx.andMainInformationEqualTo(m.getId());
// realnameEx.andBasicInformationEqualTo(id);
realnameEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realnameE);
Map<Long, AppService> rappService = new HashMap<Long, AppService>();
if (erealname != null) {
uiModel.addAttribute("erealname", erealname);
if ("2".equals(erealname.getEventVerifierType()) || "3".equals(erealname.getEventVerifierType())) {
// 判断平台
if ("1".equals(erealname.getType())) {
EvidenceCompaniesSubmitExample evidenceCompanies = new EvidenceCompaniesSubmitExample();
EvidenceCompaniesSubmitExample.Criteria submit = evidenceCompanies.createCriteria();
submit.andIdCodeEqualTo(erealname.getCompaniesSubmit());
EvidenceCompaniesSubmit companiesSubmit = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByExample", evidenceCompanies);
if (companiesSubmit != null && companiesSubmit.getRepresentative() != null) {
// 法定代表人
EvidenceRepresentativeExample representaioce = new EvidenceRepresentativeExample();
EvidenceRepresentativeExample.Criteria evidenceRepresent = representaioce.createCriteria();
evidenceRepresent.andIdCodeEqualTo(companiesSubmit.getRepresentative());
EvidenceRepresentative representative = sqlSession.selectOne("com.itrus.portal.db.EvidenceRepresentativeMapper.selectByExample", representaioce);
uiModel.addAttribute("representative", representative);
}
if (companiesSubmit != null && companiesSubmit.getTheAgent() != null) {
// 代理人
EvidenceTheAgentExample evidenceTheAgent = new EvidenceTheAgentExample();
EvidenceTheAgentExample.Criteria theAgentEx = evidenceTheAgent.createCriteria();
theAgentEx.andIdCodeEqualTo(companiesSubmit.getTheAgent());
EvidenceTheAgent theagent = sqlSession.selectOne("com.itrus.portal.db.EvidenceTheAgentMapper.selectByExample", evidenceTheAgent);
uiModel.addAttribute("theagent", theagent);
}
uiModel.addAttribute("companiesSubmit", companiesSubmit);
} else {
// 天威
EvidenceIndividualExample evidenceIndividual = new EvidenceIndividualExample();
EvidenceIndividualExample.Criteria individual = evidenceIndividual.createCriteria();
individual.andIdCodeEqualTo(erealname.getIndividual());
EvidenceIndividual indiv = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByExample", evidenceIndividual);
uiModel.addAttribute("indiv", indiv);
}
} else if ("1".equals(erealname.getEventVerifierType())) {
// 天威
if ("1".equals(erealname.getType())) {
// 获取流水号
String serialnamber = erealname.getSerialnumber();
// 将多个流水号以逗号分隔成一个数组
String[] namber = serialnamber.split(",");
// 声明一个list存储流水号
List<String> listString = new ArrayList<String>();
for (int i = 0; i < namber.length; i++) {
// 将数组中的流水号放入list中
listString.add(namber[i]);
}
// 查询实名认证信息
RealNameRecordExample realname = new RealNameRecordExample();
RealNameRecordExample.Criteria recor = realname.createCriteria();
recor.andSerialnumberIn(listString);
realname.setOrderByClause("returntime");
listReal = sqlSession.selectList("com.itrus.portal.db.RealNameRecordMapper.selectByExample", realname);
for (RealNameRecord real : listReal) {
AppServiceAuthentication authent = sqlSession.selectOne("com.itrus.portal.db.AppServiceAuthenticationMapper.selectByPrimaryKey", real.getAppServiceAuthentication());
// 得到服务编码
AppService appservice = appService.selectById(authent.getAppService());
rappService.put(real.getId(), appservice);
}
// realnameRecor.put(m.getId(), listReal);
} else {
String serialnamber = erealname.getSerialnumber();
String[] namber = serialnamber.split(",");
List<String> listString = new ArrayList<String>();
for (int i = 0; i < namber.length; i++) {
listString.add(namber[i]);
// listReal.add(realnameRecor1);
}
PersonalNameExample personal = new PersonalNameExample();
PersonalNameExample.Criteria personalname = personal.createCriteria();
personalname.andSerialnumberIn(listString);
personal.setOrderByClause("returntime");
listPersonal = sqlSession.selectList("com.itrus.portal.db.PersonalNameMapper.selectByExample", personal);
uiModel.addAttribute("listPersonal", listPersonal);
// personalName.put(m.getId(), listPersonal);
}
}
}
uiModel.addAttribute("enclosure", enclosure);
uiModel.addAttribute("rappService", rappService);
uiModel.addAttribute("listReal", listReal);
uiModel.addAttribute("desire", desire);
uiModel.addAttribute("mainInfo", mlist);
uiModel.addAttribute("basicinfor", basicinfor);
return "basicinformation/show1";
}
use of com.itrus.portal.db.EvidenceSubjectIdentity 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