Search in sources :

Example 21 with EvidenceEnclosure

use of com.itrus.portal.db.EvidenceEnclosure in project portal by ixinportal.

the class BasicInformationController method loadImg.

/**
 * 得到图片
 *
 * @param type1
 *            企业 个人
 * @param type2
 *            代理人 法定代表人
 * @param id
 * @param response
 * @return
 */
@RequestMapping(value = "/img/{type1}/{type2}/{id}")
public String loadImg(@PathVariable("type1") int type1, @PathVariable("type2") int type2, @PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    String img1 = null;
    OutputStream os = null;
    FileInputStream fis = null;
    File file = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        if (type1 == 1) {
            EvidenceCompaniesSubmit companiesSubmit = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByPrimaryKey", id);
            String cid = companiesSubmit.getIdCode();
            EvidenceRealNameExample real = new EvidenceRealNameExample();
            EvidenceRealNameExample.Criteria nameEx = real.createCriteria();
            nameEx.andCompaniesSubmitEqualTo(cid);
            EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", real);
            // erealname.getEvidenceEnclosure());
            if (type2 == 1) {
                img = companiesSubmit.getPhotoCodeImg();
            }
            if (type2 == 2) {
                img = companiesSubmit.getInformationImg();
            }
            if (type2 == 3) {
                EvidenceRepresentative repseentative = sqlSession.selectOne("com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey", companiesSubmit.getRepresentative());
                img = repseentative.getInformationImg();
            }
            if (type2 == 4) {
                EvidenceRepresentative repseentative = sqlSession.selectOne("com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey", companiesSubmit.getRepresentative());
                img = repseentative.getPhotoCodeImg();
            }
            if (type2 == 5) {
                EvidenceTheAgent theagent = sqlSession.selectOne("com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey", companiesSubmit.getTheAgent());
                img = theagent.getInformationImg();
            }
            if (type2 == 6) {
                EvidenceTheAgent theagent = sqlSession.selectOne("com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey", companiesSubmit.getTheAgent());
                img = theagent.getPhotoCodeImg();
            }
            file = filePathUtils.getBillFile(erealname.getEvidenceSn());
        }
        if (type1 == 2) {
            EvidenceIndividual indiv = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey", id);
            String cid = indiv.getIdCode();
            EvidenceRealNameExample real = new EvidenceRealNameExample();
            EvidenceRealNameExample.Criteria nameEx = real.createCriteria();
            nameEx.andIndividualEqualTo(cid);
            EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", real);
            /*EvidenceEnclosure enclosure = sqlSession.selectOne(
						"com.itrus.portal.db.EvidenceEnclosureMapper.selectByPrimaryKey",
						erealname.getEvidenceEnclosure());*/
            EvidenceEnclosureExample enclou = new EvidenceEnclosureExample();
            EvidenceEnclosureExample.Criteria sure = enclou.createCriteria();
            // sure.andBasicInformationEqualTo(id);
            sure.andEvidenceSnEqualTo(erealname.getEvidenceSn());
            // sure.andPdfTypeEqualTo("1");
            EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclou);
            if (type2 == 1) {
                img = indiv.getPhotoCodeImg();
            }
            if (type2 == 2) {
                img = indiv.getInformationImg();
            }
            file = filePathUtils.getBillFile(enclosure.getEvidenceSn());
        }
        if (img == null) {
            return "status403";
        }
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (IOException e) {
        // 未找到
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) BufferedOutputStream(java.io.BufferedOutputStream) FileOutputStream(java.io.FileOutputStream) OutputStream(java.io.OutputStream) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) JSONException(org.json.JSONException) IOException(java.io.IOException) EvidenceTheAgent(com.itrus.portal.db.EvidenceTheAgent) EvidenceRepresentative(com.itrus.portal.db.EvidenceRepresentative) File(java.io.File) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceRealNameExample(com.itrus.portal.db.EvidenceRealNameExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 22 with EvidenceEnclosure

use of com.itrus.portal.db.EvidenceEnclosure in project portal by ixinportal.

the class BasicInformationController method alertpdf.

/**
 * 下载回执报告的错误信息
 *
 * @param evidenceSn
 * @param uiModel
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/{evidenceSn}", method = RequestMethod.POST, produces = "text/html")
@ResponseBody
public String alertpdf(@PathVariable("evidenceSn") String evidenceSn, Model uiModel) throws Exception {
    RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
    if (realNameAuthentication == null) {
        realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
    }
    try {
        if (realNameAuthentication == null) {
            String oper = "下载回执报告失败";
            String info = "失败原因:服务器出错,请联系管理员";
            LogUtil.evidencelog(sqlSession, null, oper, info);
            return "服务器出错,请联系管理员";
        }
        // 得到接口路径
        String urlAgent = realNameAuthentication.getRealNameddress();
        EvidenceEnclosureExample enclo = new EvidenceEnclosureExample();
        EvidenceEnclosureExample.Criteria enclosureEx = enclo.createCriteria();
        enclosureEx.andEvidenceSnEqualTo(evidenceSn);
        enclosureEx.andPdfTypeEqualTo("3");
        EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclo);
        if (enclosure == null) {
            return "未找到该证据编号的信息";
        }
        String base64 = EvidenceSaveServiceApi.decryptedAndDownload(sqlSession, enclosure.getBuid(), urlAgent);
        if (base64 == null || base64.contains("exception")) {
            String oper = "下载回执报告失败";
            String info = "失败原因:base64为空";
            LogUtil.evidencelog(sqlSession, null, oper, info);
            return "base64为空";
        }
    } catch (Exception e) {
        // TODO Auto-generated catch
        e.printStackTrace();
        String oper = "下载回执报告失败";
        String info = "失败原因:" + e.getMessage();
        LogUtil.evidencelog(sqlSession, null, oper, info);
    }
    return "0";
}
Also used : EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) JSONException(org.json.JSONException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 23 with EvidenceEnclosure

use of com.itrus.portal.db.EvidenceEnclosure in project portal by ixinportal.

the class EvidenceQueryQueue method run.

@Override
public void run() {
    // 回调
    while (true) {
        if (OBJECT_QUEUE.isEmpty()) {
            try {
                // 若队列中没有信息则等待10秒
                sleep(5 * 1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            continue;
        }
        String url = null;
        String app_id = null;
        String secret_key = null;
        // 需要回执报告 // TODO: 2018/3/15 有问题
        Map<Long, EvidenceBasicInformation> dataRet = new HashMap<Long, EvidenceBasicInformation>();
        // 不需要回执报告
        Map<Long, List<String>> data = new HashMap<Long, List<String>>();
        for (int i = 0; OBJECT_QUEUE != null && i < OBJECT_QUEUE.size() && i < 1000; i++) {
            EvidenceBasicInformation obj = (EvidenceBasicInformation) OBJECT_QUEUE.poll();
            if (obj.getOutAppService() == null || obj.getEvidenceType() == 1) {
                if (data.containsKey(obj.getApplicationInfo())) {
                    data.get(obj.getApplicationInfo()).add(obj.getEvidenceSn());
                } else {
                    List<String> sns = new ArrayList<String>();
                    sns.add(obj.getEvidenceSn());
                    data.put(obj.getApplicationInfo(), sns);
                }
            } else {
                dataRet.put(obj.getApplicationInfo(), obj);
            }
        }
        try {
            // <----------------------------    处理data   start   ------------------------------>
            for (Map.Entry<Long, List<String>> entry : data.entrySet()) {
                ApplicationInfo applicationInfo = CacheCustomer.getAPP_INFO_MAP_BY_ID().get(entry.getKey());
                if (applicationInfo == null) {
                    // TODO: 2018/3/15 从缓存取
                    applicationInfo = infoService.selectById(entry.getKey());
                }
                // 得到配置信息
                if (applicationInfo.getAppId() != app_id || url == null || app_id == null || secret_key == null) {
                    if (StringUtils.isEmpty(applicationInfo.getCallback()) || StringUtils.isEmpty(applicationInfo.getAppId()) || StringUtils.isEmpty(applicationInfo.getSecretKey())) {
                        log.error("回调失败:缺少配置。");
                        return;
                    }
                    if (url == null) {
                        url = applicationInfo.getCallback().trim();
                    }
                    if (app_id == null) {
                        app_id = applicationInfo.getAppId();
                    }
                    if (secret_key == null) {
                        secret_key = applicationInfo.getSecretKey();
                    }
                    log.error("EvidenceQueryQueue : URL=" + url + ",APP_ID=" + app_id + ",SECRET_KEY=" + secret_key);
                    if (StringUtils.isEmpty(url) || StringUtils.isEmpty(app_id) || StringUtils.isEmpty(secret_key)) {
                        log.error("回调失败:缺少配置。");
                        return;
                    }
                }
                Map<String, Object> param = new HashMap<String, Object>();
                param.put("status", 1);
                param.put("message", "存证成功");
                param.put("appId", app_id);
                param.put("evidenceSns", JSONObject.toJSONString(entry.getValue()));
                String header = "HMAC-SHA1 " + Base64.encode(HMACSHA1.getHmacSHA1(app_id + entry.getValue(), secret_key), false);
                String retStr = OkHttpClientManagerCallback.post(url, header, param);
                JSONObject ret_data = JSONObject.parseObject(retStr);
                final List<String> dataSn = entry.getValue();
                final Long appId = entry.getKey();
                // 判断是否成功  true ——> 失败
                if (retStr == null || ret_data.getInteger("status") != 1) {
                    log.error("EvidenceQueryQueue failure count [" + entry.getValue().size() + "]");
                    // 创建新线程 处理数据批量添加
                    List<String> sns = dataSn;
                    Long aId = appId;
                    List<EvidenceCallback> callbacks = new ArrayList<EvidenceCallback>();
                    ;
                    for (String sn : sns) {
                        EvidenceCallback evidenceCallback = new EvidenceCallback();
                        evidenceCallback.setAppId(aId);
                        evidenceCallback.setCounnt(1);
                        evidenceCallback.setEvidenceSn(sn);
                        callbacks.add(evidenceCallback);
                    }
                    sqlSession.insert("com.itrus.portal.db.EvidenceCallbackMapper.insert", callbacks.toArray());
                } else {
                    log.error("EvidenceQueryQueue success count [" + entry.getValue().size() + "]");
                    // 创建新线程 处理数据批量修改
                    List<String> sns = dataSn;
                    sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updates", sns.toArray());
                }
            }
            // <----------------------------    处理dataRet   start   ------------------------------>
            for (Entry<Long, EvidenceBasicInformation> entry : dataRet.entrySet()) {
                ApplicationInfo applicationInfo = CacheCustomer.getAPP_INFO_MAP_BY_ID().get(entry.getKey());
                if (applicationInfo == null) {
                    // TODO: 2018/3/15 从缓存取
                    applicationInfo = infoService.selectById(entry.getKey());
                }
                if (applicationInfo.getAppId() != app_id || url == null || app_id == null || secret_key == null) {
                    if (StringUtils.isEmpty(applicationInfo.getCallback()) || StringUtils.isEmpty(applicationInfo.getAppId()) || StringUtils.isEmpty(applicationInfo.getSecretKey())) {
                        log.error("回调失败:缺少配置。");
                        return;
                    }
                    if (url == null) {
                        url = applicationInfo.getCallback().trim();
                    }
                    if (app_id == null) {
                        app_id = applicationInfo.getAppId();
                    }
                    if (secret_key == null) {
                        secret_key = applicationInfo.getSecretKey();
                    }
                    log.error("EvidenceQueryQueue : URL=" + url + ",APP_ID=" + app_id + ",SECRET_KEY=" + secret_key);
                    if (StringUtils.isEmpty(url) || StringUtils.isEmpty(app_id) || StringUtils.isEmpty(secret_key)) {
                        log.error("回调失败:缺少配置。");
                        return;
                    }
                }
                // 得到证据回执base64
                String reportBase64 = null;
                // reportBase64 = EvidenceSaveServiceApi.cacheReportBySnMap.get(entry.getValue().getEvidenceSn());
                if (StringUtils.isEmpty(reportBase64)) {
                    // 获取原子服务地址  1.实名认证  2.密码服务  3.时间戳
                    RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
                    if (realNameAuthentication == null) {
                        try {
                            realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    // 获取回执报告附件表信息
                    EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
                    EvidenceEnclosureExample.Criteria ec = enclosureExample.createCriteria();
                    ec.andEvidenceSnEqualTo(entry.getValue().getEvidenceSn());
                    ec.andPdfTypeEqualTo("3");
                    List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
                    if (enclosures != null && !enclosures.isEmpty()) {
                        EvidenceEnclosure enclosure = enclosures.get(0);
                        // 调解密下载接口从原子服务拿到回执报告base64
                        reportBase64 = EvidenceSaveServiceApi.decryptedAndDownload(sqlSession, enclosure.getBuid(), realNameAuthentication.getRealNameddress());
                    } else {
                        // 调用生成回执报告方法
                        Map<String, Object> mapRet = reportTemplate.returnreceipt(entry.getValue().getEvidenceSn(), applicationInfo, null);
                        log.error("EvidenceQueryQueue mapRet is " + mapRet.get("status"));
                        ;
                        if (mapRet.get("status") != null && (int) mapRet.get("status") == 0) {
                            // 修改证据基本信息回执状态为已出
                            reportBase64 = (String) mapRet.get("pdfBase64");
                            EvidenceBasicInformation basicInformation = informationService.getInformationBySn(entry.getValue().getEvidenceSn(), null);
                            basicInformation.setReceiptStatus(1);
                            sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
                        }
                    }
                } else {
                // EvidenceSaveServiceApi.cacheReportBySnMap.remove(entry.getValue().getEvidenceSn());
                }
                Map<String, Object> param = new HashMap<String, Object>();
                param.put("status", 1);
                param.put("appId", app_id);
                param.put("evidenceSn", entry.getValue().getEvidenceSn());
                log.error("EvidenceQueryQueue reportBase64 is " + (reportBase64 == null) + ", evidenceSn is " + entry.getValue().getEvidenceSn());
                if (reportBase64 == null) {
                    param.put("message", "存证成功,回执报告生成失败!");
                } else {
                    param.put("message", "存证成功");
                    param.put("reportBase64", reportBase64);
                }
                String header = "HMAC-SHA1 " + Base64.encode(HMACSHA1.getHmacSHA1(app_id + entry.getValue().getEvidenceSn(), secret_key), false);
                String retStr = OkHttpClientManagerCallback.post(url, header, param);
                JSONObject ret_data = JSONObject.parseObject(retStr);
                String dataSn = entry.getValue().getEvidenceSn();
                Long appId = entry.getKey();
                // 判断是否成功  true ——> 失败
                if (retStr == null || ret_data.getInteger("status") != 1) {
                    log.error("EvidenceQueryQueue failure sn is [" + entry.getValue().getEvidenceSn() + "]" + "retStr is [" + retStr + "]");
                    EvidenceCallback evidenceCallback = new EvidenceCallback();
                    evidenceCallback.setAppId(appId);
                    evidenceCallback.setCounnt(1);
                    evidenceCallback.setEvidenceSn(dataSn);
                    evidenceCallback.setAppServiceId(entry.getValue().getOutAppService());
                    sqlSession.insert("com.itrus.portal.db.EvidenceCallbackMapper.insert", evidenceCallback);
                } else {
                    log.error("EvidenceQueryQueue success sn is [" + entry.getValue().getEvidenceSn() + "]" + "retStr is [" + retStr + "]");
                    List<String> sns = new ArrayList<>();
                    sns.add(dataSn);
                    sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updates", sns.toArray());
                }
            }
        // <----------------------------    处理dataRet   end   ------------------------------>
        } catch (Exception e) {
            e.printStackTrace();
            LogUtil.evidencelog(sqlSession, null, "存证回调接口", "失败原因:" + e.toString());
        }
    }
}
Also used : EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceCallback(com.itrus.portal.db.EvidenceCallback) JSONObject(com.alibaba.fastjson.JSONObject) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) Map(java.util.Map)

Example 24 with EvidenceEnclosure

use of com.itrus.portal.db.EvidenceEnclosure 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));
    }
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) HashMap(java.util.HashMap) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) ArrayList(java.util.ArrayList) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) EvidenceCertUser(com.itrus.portal.db.EvidenceCertUser) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceEventTime(com.itrus.portal.db.EvidenceEventTime) JSONObject(com.alibaba.fastjson.JSONObject) EvidenceRepresentative(com.itrus.portal.db.EvidenceRepresentative) EvidenceEventNetworkAddress(com.itrus.portal.db.EvidenceEventNetworkAddress) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceTheAgent(com.itrus.portal.db.EvidenceTheAgent) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) EvidenceClientSignature(com.itrus.portal.db.EvidenceClientSignature) Calendar(java.util.Calendar) Date(java.util.Date) EvidenceEventBehavior(com.itrus.portal.db.EvidenceEventBehavior) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) EvidenceLog(com.itrus.portal.db.EvidenceLog)

Aggregations

EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)24 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)20 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)18 HashMap (java.util.HashMap)17 ArrayList (java.util.ArrayList)13 IOException (java.io.IOException)12 List (java.util.List)11 EvidenceEventContent (com.itrus.portal.db.EvidenceEventContent)10 Date (java.util.Date)9 AppService (com.itrus.portal.db.AppService)8 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)8 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)8 EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)8 JSONObject (com.alibaba.fastjson.JSONObject)7 EvidenceBasicInformationExample (com.itrus.portal.db.EvidenceBasicInformationExample)7 EvidenceCompaniesSubmit (com.itrus.portal.db.EvidenceCompaniesSubmit)7 EvidenceHisRelationshipExample (com.itrus.portal.db.EvidenceHisRelationshipExample)7 EvidenceIndividual (com.itrus.portal.db.EvidenceIndividual)7 EvidenceRealName (com.itrus.portal.db.EvidenceRealName)7