Search in sources :

Example 1 with EvidenceHisRelationship

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

the class HisCertificateController method showpdf.

/**
 * 查看详情 导入PDF跳转详情方法
 *
 * @param id
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/showpdf/{id}/{type}", produces = "text/html")
public String showpdf(@PathVariable("id") Long id, @PathVariable("type") int type, Model uiModel) {
    EvidenceHisCertificate hisCertificate = hiscertificate.selectById(id);
    // 得到服务编码
    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);
    Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
    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);
    // 获取证据附件表
    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);
    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) {
        uiModel.addAttribute("error", error);
        return "hiscertificate/show";
    } else if (type == 2) {
        return "hiscertificate/show1";
    }
    return null;
}
Also used : EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ArrayList(java.util.ArrayList) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) ArrayList(java.util.ArrayList) List(java.util.List) AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with EvidenceHisRelationship

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

the class ReceiptContoller method outhis.

/**
 * 预览出证信息
 *
 * @param serialnumber
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/outhis/{serialnumber}", produces = "text/html")
public String outhis(@PathVariable("serialnumber") String serialnumber, Model uiModel) {
    // 得到证据基本信息表
    List<EvidenceBasicInformation> blist = new ArrayList<EvidenceBasicInformation>();
    // 得到企业平台信息
    Map<Long, EvidenceCompaniesSubmit> companiesSubmit = new HashMap<Long, EvidenceCompaniesSubmit>();
    // 得到天威企业信息
    Map<Long, List<RealNameRecord>> realnameRecor = new HashMap<Long, List<RealNameRecord>>();
    // 得到天威个人信息
    Map<Long, PersonalName> personalName = new HashMap<Long, PersonalName>();
    // 得到个人平台信息
    Map<Long, EvidenceIndividual> denceid = new HashMap<Long, EvidenceIndividual>();
    // 得到得到身份意愿信息
    Map<Long, EvidenceDesireIdentify> mdesire = new HashMap<Long, EvidenceDesireIdentify>();
    // 得到事件内容信息
    Map<Long, EvidenceEventContent> eventcontent = new HashMap<Long, EvidenceEventContent>();
    // 得到时间对象
    Map<Long, List<EvidenceTrustedIdentity>> trusid = new HashMap<Long, List<EvidenceTrustedIdentity>>();
    // 得到身份标识信息
    Map<Long, List<EvidenceTrustedIdentity>> trusted = new HashMap<Long, List<EvidenceTrustedIdentity>>();
    // 得到事件时间信息
    Map<Long, List<EvidenceEventTime>> enenttime = new HashMap<Long, List<EvidenceEventTime>>();
    // 得到事件行为认证信息
    Map<Long, List<EvidenceEventBehavior>> enenbehavior = new HashMap<Long, List<EvidenceEventBehavior>>();
    // 得到事件意愿认证信息
    Map<Long, List<EvidenceEventDesire>> evendesire = new HashMap<Long, List<EvidenceEventDesire>>();
    // 得到平台提交信息代表人
    Map<Long, EvidenceRepresentative> erepresetative = new HashMap<Long, EvidenceRepresentative>();
    // 得到平台提交信息代理人
    Map<Long, EvidenceTheAgent> etheagent = new HashMap<Long, EvidenceTheAgent>();
    // 得到营业执照
    Map<Long, Licenseinformation> licensein = new HashMap<Long, Licenseinformation>();
    // 得到企业银行信息
    Map<Long, Enterprisebank> enterpris = new HashMap<Long, Enterprisebank>();
    // 得到组织机构代码
    Map<Long, Organization> organiza = new HashMap<Long, Organization>();
    // 得到法定代表人信息
    Map<Long, Corporateinformation> corporat = new HashMap<Long, Corporateinformation>();
    // 得到代理人信息
    Map<Long, Agentinformation> agemtom = new HashMap<Long, Agentinformation>();
    // 得到银行三四要素信息
    Map<Long, Bankcardelements> bankcardele = new HashMap<Long, Bankcardelements>();
    // 证据基本信息,放入多个基本信息
    List<EvidenceBasicInformation> basicinfos = new ArrayList<EvidenceBasicInformation>();
    // 得到出证信息
    EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
    EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
    tificate.andSerialnumberEqualTo(serialnumber);
    EvidenceHisCertificate hisCertificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
    // 得到出证存证中间表
    EvidenceHisRelationshipExample hisrelation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria shipEx = hisrelation.createCriteria();
    shipEx.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisrelationship = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisrelation);
    for (EvidenceHisRelationship h : hisrelationship) {
        // 得到基本信息表
        EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
        basicinfos.add(basic);
        // 得到身份意愿信息
        EvidenceDesireIdentifyExample desireIdentify = new EvidenceDesireIdentifyExample();
        EvidenceDesireIdentifyExample.Criteria desireExample = desireIdentify.createCriteria();
        desireExample.andEvidenceSnEqualTo(basic.getEvidenceSn());
        EvidenceDesireIdentify desire = sqlSession.selectOne("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", desireIdentify);
        mdesire.put(basic.getId(), desire);
        EvidenceRealNameExample realnameE = new EvidenceRealNameExample();
        EvidenceRealNameExample.Criteria realnameEx = realnameE.createCriteria();
        realnameEx.andBasicInformationEqualTo(basic.getId());
        EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realnameE);
        if (erealname != null) {
            if (!"1".equals(erealname.getEventVerifierType())) {
                if ("1".equals(erealname.getType())) {
                    EvidenceCompaniesSubmit companiesSubmit1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByPrimaryKey", erealname.getCompaniesSubmit());
                    companiesSubmit.put(basic.getId(), companiesSubmit1);
                    // 得到法定代表人
                    EvidenceRepresentative representative = sqlSession.selectOne("com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey", companiesSubmit1.getRepresentative());
                    erepresetative.put(basic.getId(), representative);
                    // 得到代理人
                    EvidenceTheAgent theAgen = sqlSession.selectOne("com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey", companiesSubmit1.getTheAgent());
                    etheagent.put(basic.getId(), theAgen);
                    uiModel.addAttribute("companiesSubmit", companiesSubmit);
                    uiModel.addAttribute("realname", companiesSubmit);
                } else {
                    EvidenceIndividual dic = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey", erealname.getIndividual());
                    denceid.put(basic.getId(), dic);
                    uiModel.addAttribute("denceid", denceid);
                    uiModel.addAttribute("realname", denceid);
                }
            } else {
                if ("1".equals(erealname.getType())) {
                    String serialnamber = erealname.getSerialnumber();
                    String[] namber = serialnamber.split(",");
                    // List<RealNameRecord> listReal = new ArrayList<RealNameRecord>();
                    List<String> listString = new ArrayList<String>();
                    for (int i = 0; i < namber.length; i++) {
                        listString.add(namber[i]);
                    }
                    RealNameRecordExample realname = new RealNameRecordExample();
                    RealNameRecordExample.Criteria recor = realname.createCriteria();
                    // recor.andSerialnumberEqualTo(erealname.getSerialnumber());
                    recor.andSerialnumberIn(listString);
                    List<RealNameRecord> realnameRecor1 = sqlSession.selectList("com.itrus.portal.db.RealNameRecordMapper.selectByExample", realname);
                    realnameRecor.put(basic.getId(), realnameRecor1);
                    for (RealNameRecord real : realnameRecor1) {
                        // 得到营业执照
                        if (real.getLicenseinformation() != null) {
                            Licenseinformation information = sqlSession.selectOne("com.itrus.portal.db.LicenseinformationMapper.selectByPrimaryKey", real.getLicenseinformation());
                            licensein.put(basic.getId(), information);
                        }
                        // 得到企业银行信息
                        if (real.getEnterprisebank() != null) {
                            Enterprisebank enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterprisebankMapper.selectByPrimaryKey", real.getEnterprisebank());
                            enterpris.put(basic.getId(), enterprise);
                        }
                        // 得到组织机构代码信息
                        if (real.getOrganization() != null) {
                            Organization organization = sqlSession.selectOne("com.itrus.portal.db.OrganizationMapper.selectByPrimaryKey", real.getOrganization());
                            organiza.put(basic.getId(), organization);
                        }
                        // 得到法定代表人信息
                        if (real.getCorporateinformation() != null) {
                            Corporateinformation enterprise = sqlSession.selectOne("com.itrus.portal.db.CorporateinformationMapper.selectByPrimaryKey", real.getCorporateinformation());
                            corporat.put(basic.getId(), enterprise);
                        }
                        // 得到代理人信息
                        if (real.getAgentinformation() != null) {
                            Agentinformation enterprise = sqlSession.selectOne("com.itrus.portal.db.AgentinformationMapper.selectByPrimaryKey", real.getAgentinformation());
                            agemtom.put(basic.getId(), enterprise);
                        }
                    }
                    uiModel.addAttribute("realname", realnameRecor);
                } else {
                    PersonalNameExample personal = new PersonalNameExample();
                    PersonalNameExample.Criteria personalname = personal.createCriteria();
                    personalname.andSerialnumberEqualTo(erealname.getSerialnumber());
                    PersonalName personalName1 = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectByExample", personal);
                    personalName.put(basic.getId(), personalName1);
                    // 得到银行三四要素信息
                    Bankcardelements bank = sqlSession.selectOne("com.itrus.portal.db.BankcardelementsMapper.selectByPrimaryKey", personalName1.getBankcardelements());
                    bankcardele.put(basic.getId(), bank);
                    uiModel.addAttribute("personalName", personalName);
                    uiModel.addAttribute("realname", personalName);
                }
            }
        }
        // 事件内容
        EvidenceEventContentExample evencontent = new EvidenceEventContentExample();
        EvidenceEventContentExample.Criteria countent = evencontent.createCriteria();
        // countent.andBasicInformationEqualTo(basic.getId());
        countent.andEvidenceSnEqualTo(basic.getEvidenceSn());
        List<EvidenceEventContent> mevencontent = sqlSession.selectList("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", evencontent);
        eventcontent.put(basic.getId(), mevencontent.get(0));
        // 得到身份可信标识
        EvidenceTrustedIdentityExample trusten = new EvidenceTrustedIdentityExample();
        EvidenceTrustedIdentityExample.Criteria identityex = trusten.createCriteria();
        identityex.andBasicInformationEqualTo(basic.getEvidenceSn());
        identityex.andEventContentIsNull();
        List<EvidenceTrustedIdentity> trustedidentity = sqlSession.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trusten);
        trusted.put(basic.getId(), trustedidentity);
        // 事件对象认证
        EvidenceTrustedIdentityExample trustenid = new EvidenceTrustedIdentityExample();
        EvidenceTrustedIdentityExample.Criteria identitye = trustenid.createCriteria();
        identitye.andEventContentEqualTo(mevencontent.get(0).getIdCode());
        List<EvidenceTrustedIdentity> trustedidentit = sqlSession.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustenid);
        trusid.put(basic.getId(), trustedidentit);
        // 事件时间认证
        EvidenceEventTimeExample eventime = new EvidenceEventTimeExample();
        EvidenceEventTimeExample.Criteria eventimeEx = eventime.createCriteria();
        eventimeEx.andEventContentEqualTo(mevencontent.get(0).getIdCode());
        List<EvidenceEventTime> meventime = sqlSession.selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", eventime);
        enenttime.put(basic.getId(), meventime);
        // 事件行为认证
        EvidenceEventBehaviorExample eventbehaciorEx = new EvidenceEventBehaviorExample();
        EvidenceEventBehaviorExample.Criteria eventbe = eventbehaciorEx.createCriteria();
        eventbe.andEventContentEqualTo(mevencontent.get(0).getIdCode());
        List<EvidenceEventBehavior> eventbehacior = sqlSession.selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", eventbehaciorEx);
        enenbehavior.put(basic.getId(), eventbehacior);
        // 事件意愿认证
        EvidenceEventDesireExample desireEx = new EvidenceEventDesireExample();
        EvidenceEventDesireExample.Criteria eventdesire = desireEx.createCriteria();
        // eventdesire.andMainInformationEqualTo(basic.getId());
        eventdesire.andEventContenteEqualTo(mevencontent.get(0).getIdCode());
        List<EvidenceEventDesire> meventdesire = sqlSession.selectList("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", desireEx);
        evendesire.put(basic.getId(), meventdesire);
        blist.add(basic);
        // 判断图片是否存在
        if (mevencontent.get(0).getIsimg() == null) {
            // EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", mevencontent.getBasicInformation());
            // 得到证据附件表,用于获取信息
            EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
            EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
            envlosureEx.andEvidenceSnEqualTo(basic.getEvidenceSn());
            envlosureEx.andPdfTypeEqualTo("2");
            EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
            // 判断是否为用户上传pdf
            if (envlosure != null) {
                String urlFile = systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn();
                File filePathStr = new File(urlFile, envlosure.getObjectName());
                int pdfToPng = 0;
                if (filePathStr != null && filePathStr.getPath() != null) {
                    try {
                        pdfToPng = Pdf.pdf2png(filePathStr.getPath());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                // 判断生成图片是否成功
                if (pdfToPng > 0) {
                    // 修改内容表信息,表示生成图片
                    mevencontent.get(0).setIsimg(1);
                    mevencontent.get(0).setImgCount(pdfToPng);
                    sqlSession.update("com.itrus.portal.db.EvidenceEventContentMapper.updateByPrimaryKey", mevencontent);
                    String oper = "原文图片生成成功";
                    String info = "图片地址:" + urlFile;
                    LogUtil.evidencelog(sqlSession, null, oper, info);
                } else {
                    String oper = "原文图片生成失败";
                    String info = "失败原因:" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
                    LogUtil.evidencelog(sqlSession, null, oper, info);
                }
            }
        }
    }
    uiModel.addAttribute("basicinfos", basicinfos);
    // 平台代表人
    uiModel.addAttribute("erepresetative", erepresetative);
    // 平台代理人
    uiModel.addAttribute("etheagent", etheagent);
    // 营业执照信息
    uiModel.addAttribute("licensein", licensein);
    // 企业银行信息
    uiModel.addAttribute("enterpris", enterpris);
    // 住址机构代码
    uiModel.addAttribute("organiza", organiza);
    // 法定代表人
    uiModel.addAttribute("corporat", corporat);
    // 法定代理人
    uiModel.addAttribute("agemtom", agemtom);
    // 银行卡三四要素
    uiModel.addAttribute("bankcardele", bankcardele);
    // 得到得到身份意愿信息
    uiModel.addAttribute("mdesire", mdesire);
    // 得到事件时间信息
    uiModel.addAttribute("enenttime", enenttime);
    // 得到事件行为认证信息
    uiModel.addAttribute("enenbehavior", enenbehavior);
    // 得到时间对象
    uiModel.addAttribute("trusid", trusid);
    // 得到身份标识信息
    uiModel.addAttribute("trusted", trusted);
    // 得到证据基本信息表
    uiModel.addAttribute("blist", blist);
    // 得到事件内容信息
    uiModel.addAttribute("eventcontent", eventcontent);
    // 得到出证信息
    uiModel.addAttribute("hisCertificate", hisCertificate);
    // 出证时间
    uiModel.addAttribute("datetime", new Date());
    return "reporttemplate/certificationReport1";
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) HashMap(java.util.HashMap) PersonalNameExample(com.itrus.portal.db.PersonalNameExample) ArrayList(java.util.ArrayList) Corporateinformation(com.itrus.portal.db.Corporateinformation) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) List(java.util.List) ArrayList(java.util.ArrayList) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) Enterprisebank(com.itrus.portal.db.Enterprisebank) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) EvidenceEventBehaviorExample(com.itrus.portal.db.EvidenceEventBehaviorExample) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) RealNameRecord(com.itrus.portal.db.RealNameRecord) EvidenceEventContentExample(com.itrus.portal.db.EvidenceEventContentExample) EvidenceEventTime(com.itrus.portal.db.EvidenceEventTime) EvidenceRepresentative(com.itrus.portal.db.EvidenceRepresentative) File(java.io.File) EvidenceRealNameExample(com.itrus.portal.db.EvidenceRealNameExample) Organization(com.itrus.portal.db.Organization) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceTheAgent(com.itrus.portal.db.EvidenceTheAgent) Agentinformation(com.itrus.portal.db.Agentinformation) EvidenceDesireIdentifyExample(com.itrus.portal.db.EvidenceDesireIdentifyExample) PersonalName(com.itrus.portal.db.PersonalName) EvidenceEventDesireExample(com.itrus.portal.db.EvidenceEventDesireExample) EvidenceEventTimeExample(com.itrus.portal.db.EvidenceEventTimeExample) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) Licenseinformation(com.itrus.portal.db.Licenseinformation) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) IOException(java.io.IOException) Date(java.util.Date) EvidenceEventBehavior(com.itrus.portal.db.EvidenceEventBehavior) EvidenceHisCertificateExample(com.itrus.portal.db.EvidenceHisCertificateExample) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) Bankcardelements(com.itrus.portal.db.Bankcardelements) RealNameRecordExample(com.itrus.portal.db.RealNameRecordExample) EvidenceTrustedIdentityExample(com.itrus.portal.db.EvidenceTrustedIdentityExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with EvidenceHisRelationship

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

the class BasicInformationController method show.

/**
 * 查看详情
 *
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    Date time = new Date();
    // 得到方法开始的时间
    log.error("---------------------------" + time);
    basid = id;
    int coutn = 0;
    int size = 0;
    int cousize = 0;
    EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", id);
    List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
    Map<Long, EvidenceCompaniesSubmit> companiesSubmit = new HashMap<Long, EvidenceCompaniesSubmit>();
    Map<Long, List<RealNameRecord>> realnameRecor = new HashMap<Long, List<RealNameRecord>>();
    Map<Long, List<PersonalName>> personalName = new HashMap<Long, List<PersonalName>>();
    Map<Long, EvidenceIndividual> denceid = new HashMap<Long, EvidenceIndividual>();
    Map<Long, EvidenceRealName> realName = new HashMap<Long, EvidenceRealName>();
    // 事件对象认证
    Map<Long, EvidenceTrustedIdentity> trustedidentit = new HashMap<Long, EvidenceTrustedIdentity>();
    // 事件时间认证
    Map<Long, EvidenceEventTime> meventime = new HashMap<Long, EvidenceEventTime>();
    // 事件行为认证
    Map<Long, EvidenceEventBehavior> eventbehacior = new HashMap<Long, EvidenceEventBehavior>();
    // 无主体 事件对象认证
    Map<Integer, EvidenceTrustedIdentity> maintrustedidentit = new HashMap<Integer, EvidenceTrustedIdentity>();
    // 无主体事件时间认证
    Map<Integer, EvidenceEventTime> mainmeventime = new HashMap<Integer, EvidenceEventTime>();
    // 无主体事件行为认证
    Map<Integer, EvidenceEventBehavior> maineventbehacior = new HashMap<Integer, EvidenceEventBehavior>();
    // 事件意愿认证
    Map<Long, EvidenceEventDesire> meventdesire = new HashMap<Long, EvidenceEventDesire>();
    // 事件网络地址
    Map<Long, EvidenceEventNetworkAddress> networkaddress = new HashMap<Long, EvidenceEventNetworkAddress>();
    // 得到主体身份信息
    EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
    EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
    // subjectExample.isDistinct();
    identity.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
    List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
    for (int i = 0; i < subjectIdentity.size(); i++) {
        // 得到主体信息
        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));
        }
    }
    for (int i = 0; i < mlist.size() - 1; i++) {
        for (int j = mlist.size() - 1; j > i; j--) {
            if (mlist.get(j).getIdentification().equals(mlist.get(i).getIdentification()) && mlist.get(j).getSubjectName().equals(mlist.get(i).getSubjectName())) {
                mlist.remove(j);
            }
        }
    }
    log.error("主题数量**********" + mlist.size());
    // 得到主题的时间
    Date time1 = new Date();
    Long Ltime = time1.getTime() - time.getTime();
    log.error("得到主题身份的毫秒数,Ltime" + Ltime);
    // 得到身份可信标识
    EvidenceTrustedIdentityExample trusten = new EvidenceTrustedIdentityExample();
    EvidenceTrustedIdentityExample.Criteria identityex = trusten.createCriteria();
    identityex.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
    identityex.andEventContentIsNull();
    Map<Long, EvidenceTrustedIdentity> trustedidentity = sqlSession.selectMap("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trusten, "mainInformation");
    // 得到主题的时间
    Date time2 = new Date();
    Long Ltime1 = time2.getTime() - time.getTime();
    log.error("得到身份可信标识的毫秒数,Ltime1=" + Ltime1);
    // 身份意愿map
    Map<Long, EvidenceDesireIdentify> desire = new HashMap<Long, EvidenceDesireIdentify>();
    // 证据基本信息map
    Map<Long, EvidenceBasicInformation> basi = new HashMap<Long, EvidenceBasicInformation>();
    EvidenceRealName erealname = new EvidenceRealName();
    // 循环主题信息
    for (EvidenceMainInformation m : mlist) {
        // 判断可信身份标识是否为空
        if (/*trustedidentity!=null && trustedidentity.size()!=0&&*/
        trustedidentity.get(m.getId()) != null && trustedidentity.get(m.getId()).getEvidenceSn() != null) {
            // 得到可信身份标识关联的身份证据编号
            String evidenceSn = trustedidentity.get(m.getId()).getEvidenceSn().toString();
            if (StringUtils.isNotEmpty(evidenceSn)) {
                EvidenceBasicInformationExample basicinforE = new EvidenceBasicInformationExample();
                EvidenceBasicInformationExample.Criteria critbasic = basicinforE.createCriteria();
                critbasic.andEvidenceSnEqualTo(evidenceSn);
                EvidenceBasicInformation basicinfor1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicinforE);
                // 得到身份意愿信息
                EvidenceDesireIdentifyExample desireIdentify = new EvidenceDesireIdentifyExample();
                EvidenceDesireIdentifyExample.Criteria desireExample = desireIdentify.createCriteria();
                desireExample.andEvidenceSnEqualTo(basicinfor1.getEvidenceSn());
                EvidenceDesireIdentify desire1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", desireIdentify);
                desire.put(m.getId(), desire1);
                // 将身份认证信息放入map
                basi.put(m.getId(), basicinfor1);
                // 得到实名认证信息
                EvidenceRealNameExample realnameE = new EvidenceRealNameExample();
                EvidenceRealNameExample.Criteria realnameEx = realnameE.createCriteria();
                realnameEx.andMainInformationEqualTo(m.getSubjectName() + ";" + m.getIdentification());
                // realnameEx.andBasicInformationEqualTo(basicinfor1.getId());
                realnameEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
                erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realnameE);
                realName.put(m.getId(), erealname);
            }
            if (erealname != null) {
                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 companiesSubmit1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByExample", evidenceCompanies);
                        companiesSubmit.put(m.getId(), companiesSubmit1);
                    } else {
                        // 天威
                        EvidenceIndividualExample evidenceIndividual = new EvidenceIndividualExample();
                        EvidenceIndividualExample.Criteria individual = evidenceIndividual.createCriteria();
                        individual.andIdCodeEqualTo(erealname.getIndividual());
                        EvidenceIndividual dic = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByExample", evidenceIndividual);
                        denceid.put(m.getId(), dic);
                    }
                } 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);
                        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);
                        personalName.put(m.getId(), listPersonal);
                    }
                }
            }
        }
    }
    // 得到身份的时间
    Date time3 = new Date();
    Long Ltime2 = time3.getTime() - time.getTime();
    log.error("得到身份信息的毫秒数,Ltime2=" + Ltime2);
    // 事件内容
    /*EvidenceEventContentExample evencontent = new EvidenceEventContentExample();
		EvidenceEventContentExample.Criteria countent = evencontent.createCriteria();
		//countent.andBasicInformationEqualTo(id);
		countent.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
		EvidenceEventContent mevencontent = sqlSession
				.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", evencontent);*/
    EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selecttId", basicinfor.getEvidenceSn());
    // 得到事件内容的时间
    Date time4 = new Date();
    Long Ltime3 = time4.getTime() - time.getTime();
    log.error("得到事件内容的毫秒数,Ltime3=" + Ltime3);
    if (mevencontent != null && mevencontent.getIdCode() != null) {
        // 事件对象认证
        EvidenceTrustedIdentityExample trustenid = new EvidenceTrustedIdentityExample();
        EvidenceTrustedIdentityExample.Criteria identitye = trustenid.createCriteria();
        identitye.andEventContentEqualTo(mevencontent.getIdCode());
        trustedidentit = sqlSession.selectMap("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustenid, "mainInformation");
        // 事件时间认证
        EvidenceEventTimeExample eventime = new EvidenceEventTimeExample();
        EvidenceEventTimeExample.Criteria eventimeEx = eventime.createCriteria();
        eventimeEx.andEventContentEqualTo(mevencontent.getIdCode());
        meventime = sqlSession.selectMap("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", eventime, "mainInformation");
        // 事件行为认证
        EvidenceEventBehaviorExample eventbehaciorEx = new EvidenceEventBehaviorExample();
        EvidenceEventBehaviorExample.Criteria eventbe = eventbehaciorEx.createCriteria();
        eventbe.andEventContentEqualTo(mevencontent.getIdCode());
        eventbehacior = sqlSession.selectMap("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", eventbehaciorEx, "mainInformation");
        // 事件意愿认证
        EvidenceEventDesireExample desireEx = new EvidenceEventDesireExample();
        EvidenceEventDesireExample.Criteria eventdesire = desireEx.createCriteria();
        eventdesire.andEventContenteEqualTo(mevencontent.getIdCode());
        meventdesire = sqlSession.selectMap("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", desireEx, "mainInformation");
        // 事件网络地址
        EvidenceEventNetworkAddressExample network = new EvidenceEventNetworkAddressExample();
        EvidenceEventNetworkAddressExample.Criteria address = network.createCriteria();
        address.andEventContentEqualTo(mevencontent.getIdCode());
        networkaddress = sqlSession.selectMap("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", network, "mainInformation");
        // 得到证据附件表,用于获取信息
        EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByPrimaryKey", mevencontent.getEvidenceEnclosure());
        uiModel.addAttribute("enclosure", envlosure);
    }
    // 得到事件的时间
    Date time5 = new Date();
    Long Ltime4 = time5.getTime() - time.getTime();
    log.error("得到事件详情的毫秒数,Ltime4=" + Ltime4);
    // 得到证据附件信息,用于查询服务委托人等信息
    EvidenceEnclosureExample enclou = new EvidenceEnclosureExample();
    EvidenceEnclosureExample.Criteria sure = enclou.createCriteria();
    sure.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    ;
    sure.andPdfTypeEqualTo("1");
    List<EvidenceEnclosure> enclosure = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclou);
    // 得到事件的时间
    Date qtime = new Date();
    Long qLtime = qtime.getTime() - time5.getTime();
    log.error("***得到证据附件信息1的毫秒数,qLtime=" + qLtime);
    EvidenceEnclosureExample enclouE = new EvidenceEnclosureExample();
    EvidenceEnclosureExample.Criteria sureEX = enclouE.createCriteria();
    sureEX.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    ;
    sureEX.andPdfTypeEqualTo("3");
    EvidenceEnclosure enclosurepdf = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclouE);
    // 得到事件的时间
    Date wtime = new Date();
    Long wLtime = wtime.getTime() - qtime.getTime();
    log.error("---得到证据附件信息2的毫秒数,wLtime=" + wLtime);
    // 得到无主题信息的数量
    int evencount = 0;
    if (trustedidentit.size() > 0) {
        evencount = trustedidentit.size();
    } else if (meventime.size() > 0) {
        evencount = meventime.size();
    } else if (maineventbehacior.size() > 0) {
        evencount = maineventbehacior.size();
    }
    Map<Integer, Integer> mapcoune = new HashMap<Integer, Integer>();
    // 用于得到无主题信息和数量
    for (int g = 0; g < evencount; g++) {
        int intsize = 0;
        // 得到无主题信息的key
        long z = g - evencount;
        String s = String.valueOf(z);
        // 将long类型转换为int类型,作为map的key进行重组
        int f = Integer.parseInt(s);
        if (trustedidentit.get(z) != null) {
            // System.out.println(trustedidentit.get(z).getMainInformation());
            // if(trustedidentit.get(z).getMainInformation()<0){
            maintrustedidentit.put(f, trustedidentit.get(z));
            cousize++;
            intsize++;
        // }
        }
        if (meventime.get(z) != null) {
            // if(meventime.get(z).getMainInformation()<0){
            mainmeventime.put(f, meventime.get(z));
            cousize++;
            intsize++;
        // }
        }
        if (eventbehacior.get(z) != null) {
            // if(eventbehacior.get(z).getMainInformation()<0){
            maineventbehacior.put(f, eventbehacior.get(z));
            cousize++;
            intsize++;
        // }
        }
        mapcoune.put(f, intsize);
    }
    uiModel.addAttribute("mapcoune", mapcoune);
    uiModel.addAttribute("enclosurepdf", enclosurepdf);
    uiModel.addAttribute("maintrustedidentit", maintrustedidentit);
    uiModel.addAttribute("mainmeventime", mainmeventime);
    uiModel.addAttribute("maineventbehacior", maineventbehacior);
    // 得到事件的时间
    Date time6 = new Date();
    Long Ltime5 = time6.getTime() - time.getTime();
    log.error("得到无主题信息的毫秒数,Ltime5=" + Ltime5);
    // 服务委托人签名信息
    Map<Long, EvidenceClientSignature> cilentsignat = new HashMap<Long, EvidenceClientSignature>();
    // 天威签名信息
    Map<Long, EvidenceClientSignature> cilentsignature = new HashMap<Long, EvidenceClientSignature>();
    // 服务委托人时间戳信息
    Map<Long, EvidenceClientTimeStamp> clientTimestamp = new HashMap<Long, EvidenceClientTimeStamp>();
    // 天威时间戳信息
    Map<Long, EvidenceClientTimeStamp> tclientTimestamp = new HashMap<Long, EvidenceClientTimeStamp>();
    // 服务委托人证书信息
    Map<Long, List<EvidenceCert>> listcert = new HashMap<Long, List<EvidenceCert>>();
    // 服务委托人核验信息
    Map<Long, EvidenceCheck> check = new HashMap<Long, EvidenceCheck>();
    // 天威核验信息
    Map<Long, EvidenceCheck> tcheck = new HashMap<Long, EvidenceCheck>();
    int ensize = 0;
    Map<Long, Integer> mint = new HashMap<Long, Integer>();
    // 循环附件信息取得服务委托人和天威签名时间戳信息
    for (EvidenceEnclosure en : enclosure) {
        Date time11 = new Date();
        int encount = 0;
        // 服务委托人签名信息
        /*EvidenceClientSignatureExample cilent = new EvidenceClientSignatureExample();
			EvidenceClientSignatureExample.Criteria signat = cilent.createCriteria();
			signat.andEvidenceSnEqualTo(en.getEvidenceSn());*/
        // signat.andNameEqualTo("0");
        List<EvidenceClientSignature> listclient = sqlSession.selectList("com.itrus.portal.db.EvidenceClientSignatureMapper.selectcertId", en.getEvidenceSn());
        EvidenceClientSignature clien1 = new EvidenceClientSignature();
        EvidenceClientSignature clien2 = new EvidenceClientSignature();
        for (int i = 0; i < listclient.size(); i++) {
            if ("0".equals(listclient.get(i).getName())) {
                clien1 = listclient.get(i);
            }
            if ("1".equals(listclient.get(i).getName())) {
                clien2 = listclient.get(i);
            }
        }
        cilentsignat.put(en.getId(), clien1);
        if (clien1.getId() != null) {
            ensize++;
            encount++;
            // 服务委托人证书信息
            /*EvidenceCertExample certEx = new EvidenceCertExample();
				EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
				evidenceCert.andClientSignatureEqualTo(listclient.getId());*/
            List<EvidenceCert> listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", clien1.getCertId());
            listcert.put(en.getId(), listCert);
            // 服务委托人核验信息
            EvidenceCheckExample checkEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
            evidenceCheck.andClientSignatureEqualTo(clien1.getId());
            EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
            check.put(en.getId(), listCheck);
        }
        Date time12 = new Date();
        Long gettime = time12.getTime() - time11.getTime();
        log.error("-----------gettime0--------------" + gettime);
        // 天威签名信息
        /*EvidenceClientSignatureExample cilentsign = new EvidenceClientSignatureExample();
			EvidenceClientSignatureExample.Criteria signature = cilentsign.createCriteria();
			signature.andEvidenceSnEqualTo(en.getEvidenceSn());
			signature.andNameEqualTo("1");
			EvidenceClientSignature clientlist = sqlSession
					.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilentsign);*/
        cilentsignature.put(en.getId(), clien2);
        if (clien2.getId() != null) {
            ensize++;
            encount++;
            // 服务委托人核验信息
            EvidenceCheckExample checkEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
            evidenceCheck.andClientSignatureEqualTo(clien2.getId());
            EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
            tcheck.put(en.getId(), listCheck);
        }
        Date time13 = new Date();
        Long gettime1 = time13.getTime() - time12.getTime();
        log.error("-----------gettime1--------------" + gettime1);
        // 服务委托人时间戳信息
        /*EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
			EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
			stamp.andEvidenceSnEqualTo(en.getEvidenceSn());*/
        // stamp.andNameEqualTo("0");
        log.error("证据编号=======" + en.getEvidenceSn());
        List<EvidenceClientTimeStamp> listtime = sqlSession.selectList("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectTimeStamp", en.getEvidenceSn());
        EvidenceClientTimeStamp timestamp1 = new EvidenceClientTimeStamp();
        EvidenceClientTimeStamp timestamp2 = new EvidenceClientTimeStamp();
        log.error("时间戳listtime==--**" + listtime);
        for (int j = 0; j < listtime.size(); j++) {
            if ("0".equals(listtime.get(j).getName())) {
                timestamp1 = listtime.get(j);
                log.error("服务委托人时间-----------" + timestamp1);
            }
            /*else if("1".equals(listtime.get(j).getName())){
					timestamp2 = listtime.get(j);
				}*/
            log.error("服务委托人时间***********" + listtime.get(j).getName());
            if ("1".equals(listtime.get(j).getName())) {
                timestamp2 = listtime.get(j);
                log.error("服务委托人时间-----------" + timestamp2);
            }
        /*else if("0".equals(listtime.get(j).getName())){
					timestamp1 = listtime.get(j);
				}*/
        }
        clientTimestamp.put(en.getId(), timestamp1);
        if (timestamp1 != null) {
            ensize++;
            encount++;
        }
        Date time14 = new Date();
        Long gettime2 = time14.getTime() - time13.getTime();
        log.error("-----------gettime2--------------" + gettime2);
        // 天威时间戳信息
        /*EvidenceClientTimeStampExample tclientTime = new EvidenceClientTimeStampExample();
			EvidenceClientTimeStampExample.Criteria tstamp = tclientTime.createCriteria();
			tstamp.andEvidenceSnEqualTo(en.getEvidenceSn());
			tstamp.andNameEqualTo("1");
			EvidenceClientTimeStamp timelist = sqlSession
					.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", tclientTime);*/
        tclientTimestamp.put(en.getId(), timestamp2);
        if (timestamp2 != null) {
            ensize++;
            encount++;
        }
        mint.put(en.getId(), encount);
        Date time15 = new Date();
        Long gettime3 = time15.getTime() - time14.getTime();
        log.error("-----------gettime3--------------" + gettime3);
    }
    // 得到事件的时间
    Date time7 = new Date();
    Long Ltime6 = time7.getTime() - time.getTime();
    log.error("得到证据申请信息和申请时间戳的毫秒数,Ltime6=" + Ltime6);
    Long Ltime10 = time7.getTime() - time6.getTime();
    log.error("+++++++++++*********---------,Ltime10++++++++++++++=" + Ltime10);
    uiModel.addAttribute("ensize", ensize);
    uiModel.addAttribute("mint", mint);
    List<EvidenceHisCertificate> hisCertificete = new ArrayList<EvidenceHisCertificate>();
    EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
    hisreation.andBasicInformationEqualTo(id);
    List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
    for (int g = 0; g < hisRelation.size(); g++) {
        // 得到证据基本信息
        /*EvidenceBasicInformation basic = sqlSession.selectOne(
					"com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey",
					hisRelation.get(g).getBasicInformation());*/
        EvidenceHisCertificate eh = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByPrimaryKey", hisRelation.get(g).getHisCertificate());
        hisCertificete.add(eh);
    }
    // 出证信息
    // List<Map<String, Object>> hisCertificete = hiscertificate.selectHisCertificateEnt();
    Map<Long, EvidenceOutTemplate> mout = new HashMap<Long, EvidenceOutTemplate>();
    Map<Long, EvidenceEnclosure> closure = new HashMap<Long, EvidenceEnclosure>();
    Map<Long, List<EvidenceBasicInformation>> mbasilist = new HashMap<Long, List<EvidenceBasicInformation>>();
    // ArrayList<EvidenceBasicInformation>();
    for (int j = 0; j < hisCertificete.size(); j++) {
        List<EvidenceBasicInformation> blist = new ArrayList<EvidenceBasicInformation>();
        Long hidId = hisCertificete.get(j).getId();
        String serialnumber = hisCertificete.get(j).getSerialnumber();
        if (hisCertificete.get(j).getHisAppService() != null && hisCertificete.get(j).getHisAppService() > 0) {
            Long appServiceId = hisCertificete.get(j).getHisAppService();
            // 得到服务编码
            AppService happservice = appService.selectById(appServiceId);
            // 得到出证服务配置
            EvidenceOutServiceConfigExample outsaveService = new EvidenceOutServiceConfigExample();
            EvidenceOutServiceConfigExample.Criteria saveServiceEx = outsaveService.createCriteria();
            saveServiceEx.andAppServiceEqualTo(happservice.getId());
            EvidenceOutServiceConfig outService = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutServiceConfigMapper.selectByExample", outsaveService);
            // 得到出证模板信息
            EvidenceOutTemplate outtemp = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", outService.getSaveRetTemplate());
            mout.put(hidId, outtemp);
            // 获取证据附件表
            EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
            EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
            envlosureEx.andSerialnumberEqualTo(serialnumber);
            envlosureEx.andPdfTypeEqualTo("4");
            EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
            closure.put(hidId, envlosure);
        }
        uiModel.addAttribute("closure", closure);
    /*long hid = Long.parseLong(hisCertificete.get(j).get("id").toString());
			EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
			EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
			hisreation.andHisCertificateEqualTo(hid);
			List<EvidenceHisRelationship> hisRelation = sqlSession
					.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
			for (int g = 0; g < hisRelation.size(); g++) {
				// 得到证据基本信息
				EvidenceBasicInformation basic = sqlSession.selectOne(
						"com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey",
						hisRelation.get(g).getBasicInformation());
				blist.add(basic);
			}
			mbasilist.put(hidId, blist);*/
    }
    uiModel.addAttribute("basi", basi);
    uiModel.addAttribute("check", check);
    uiModel.addAttribute("listcert", listcert);
    uiModel.addAttribute("realName", realName);
    uiModel.addAttribute("mbasilist", mbasilist);
    uiModel.addAttribute("mout", mout);
    uiModel.addAttribute("envlosure", enclosure);
    uiModel.addAttribute("hisCertificete", hisCertificete);
    uiModel.addAttribute("basicinfor", basicinfor);
    uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
    uiModel.addAttribute("clientTimestamp", clientTimestamp);
    uiModel.addAttribute("cilentsignature", cilentsignature);
    uiModel.addAttribute("cilentsignat", cilentsignat);
    uiModel.addAttribute("networkaddress", networkaddress);
    uiModel.addAttribute("meventdesire", meventdesire);
    uiModel.addAttribute("eventbehacior", eventbehacior);
    uiModel.addAttribute("meventime", meventime);
    uiModel.addAttribute("trustedidentit", trustedidentit);
    uiModel.addAttribute("mevencontent", mevencontent);
    uiModel.addAttribute("trustedidentity", trustedidentity);
    uiModel.addAttribute("companiesSubmit", companiesSubmit);
    uiModel.addAttribute("realnameRecor", realnameRecor);
    uiModel.addAttribute("denceid", denceid);
    uiModel.addAttribute("personalName", personalName);
    uiModel.addAttribute("mainInfo", mlist);
    uiModel.addAttribute("milist", mlist);
    Map<Long, Integer> msize = new HashMap<Long, Integer>();
    // 得到认证数量
    for (EvidenceMainInformation m : mlist) {
        int showsize = 0;
        // 身份认证
        if (companiesSubmit.get(m.getId()) != null) {
            coutn++;
        }
        if (realnameRecor.get(m.getId()) != null) {
            coutn++;
        }
        if (personalName.get(m.getId()) != null) {
            coutn++;
        }
        if (desire.get(m.getId()) != null) {
            coutn++;
        }
        if (trustedidentity.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            coutn++;
        }
        if (denceid.get(m.getId()) != null) {
            coutn++;
        }
        // 事件认证
        if (trustedidentit.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            size++;
            showsize++;
        }
        if (meventime.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            size++;
            showsize++;
        }
        if (eventbehacior.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            size++;
            showsize++;
        }
        if (meventdesire.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            size++;
            showsize++;
        }
        if (networkaddress.get(m.getSubjectName() + ";" + m.getIdentification()) != null) {
            size++;
            showsize++;
        }
        msize.put(m.getId(), showsize);
    }
    uiModel.addAttribute("cousize", cousize);
    uiModel.addAttribute("rowsize", size + 1 + cousize);
    uiModel.addAttribute("showsize", msize);
    uiModel.addAttribute("rowcoutn", coutn);
    uiModel.addAttribute("desire", desire);
    // 得到事件的时间
    Date time8 = new Date();
    // 方法结束时间
    log.error("******************time8=" + time8);
    Long Ltime7 = time8.getTime() - time.getTime();
    log.error("方法结束的毫秒数,Ltime7=" + Ltime7);
    return "basicinformation/show";
}
Also used : EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) PersonalNameExample(com.itrus.portal.db.PersonalNameExample) ArrayList(java.util.ArrayList) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) EvidenceCompaniesSubmitExample(com.itrus.portal.db.EvidenceCompaniesSubmitExample) EvidenceEventNetworkAddressExample(com.itrus.portal.db.EvidenceEventNetworkAddressExample) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) EvidenceEventBehaviorExample(com.itrus.portal.db.EvidenceEventBehaviorExample) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) RealNameRecord(com.itrus.portal.db.RealNameRecord) EvidenceEventNetworkAddress(com.itrus.portal.db.EvidenceEventNetworkAddress) EvidenceIndividualExample(com.itrus.portal.db.EvidenceIndividualExample) EvidenceRealNameExample(com.itrus.portal.db.EvidenceRealNameExample) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) PersonalName(com.itrus.portal.db.PersonalName) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceClientSignature(com.itrus.portal.db.EvidenceClientSignature) EvidenceCheck(com.itrus.portal.db.EvidenceCheck) EvidenceEventBehavior(com.itrus.portal.db.EvidenceEventBehavior) EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) HashMap(java.util.HashMap) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceCheckExample(com.itrus.portal.db.EvidenceCheckExample) EvidenceCert(com.itrus.portal.db.EvidenceCert) EvidenceEventTime(com.itrus.portal.db.EvidenceEventTime) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceDesireIdentifyExample(com.itrus.portal.db.EvidenceDesireIdentifyExample) EvidenceEventDesireExample(com.itrus.portal.db.EvidenceEventDesireExample) EvidenceEventTimeExample(com.itrus.portal.db.EvidenceEventTimeExample) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) AppService(com.itrus.portal.db.AppService) Date(java.util.Date) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) EvidenceBasicInformationExample(com.itrus.portal.db.EvidenceBasicInformationExample) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) RealNameRecordExample(com.itrus.portal.db.RealNameRecordExample) EvidenceTrustedIdentityExample(com.itrus.portal.db.EvidenceTrustedIdentityExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with EvidenceHisRelationship

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

the class EvidenceSaveServiceApi method generate.

/**
 * 保存证件包到本地
 * @param evidenceContent
 * @param fileName
 * @return
 * @throws Exception
 */
// public void saveEvidence(String evidenceContent, String fileName) {
// try {
// File file = new File(systemConfigService.getpdfurl(), fileName);
// if(!file.exists()) {
// file.createNewFile();
// }
// FileOutputStream fos = new FileOutputStream(file);
// fos.write(evidenceContent.getBytes("UTF-8"));
// fos.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
/**
 * 核验处理方法
 * @param result
 * 			返回值
 * @param applicationInfo
 * 			应用
 * @param evidenceSaveService
 * 			服务配置
 * @param evidenceSn
 * 			证据编号
 * @param signedBase64
 * 			签名值
 * @param evidencePackage
 * 			证据包
 * @return
 */
/*
	private Map<String, Object> saveBody(Map<String, Object> result,ApplicationInfo applicationInfo,
			AppService appService,EvidenceSaveService evidenceSaveService, String hashAlg, String evidenceSn, 
			String signedBase64, String evidencePackage, Date date, RealNameAuthentication realNameAuthentication, 
			RealNameAuthentication realNameAuthenticationTime, Map<String, Object> mapCharging){
		// 定义时间戳固定时间
		Date genTime = null;
		String failureReason = null;
		try {
			// 得到证据申请对象认证要素配置
			String factorCertSave = evidenceSaveService.getFactorCertSave();
			JSONObject jsonCs = JSONArray.parseArray(factorCertSave).getJSONObject(0);	
			// 解析证据包 base64 转 String
			String evidenceContent = Base64Util.getFromBASE64(evidencePackage);
			JSONObject jsonEvidenceContent = JSONObject.parseObject(evidenceContent);
			// 定义证据附件对象
			EvidenceEnclosure enclosure = new EvidenceEnclosure();
			enclosure.setEvidenceSn(evidenceSn);
			sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insert", enclosure);
			// 判断是否需要验证委托人的P7签名 
			if(jsonCs.getBooleanValue("c_isVerify")) {
				// 验证委托人的P7签名
				// 核验时间
				Date dateVp = new Date();
				// 整合参数
				Map<String, Object> param = new HashMap<String, Object>();
				param.put("contentType", "CT_HASH");
				param.put("signedData", signedBase64);
				param.put("content", HMACSHA1.getDigest(hashAlg, evidenceContent));
				// 整合url e4867c41307ac3343b78b016f32fcfeb1fbb14db
				String url = realNameAuthentication.getRealNameddress() + SIGNATURE_VERIFY_P7;
				// 验签得到第三方返回结果
				String rep_verify_p7 = HttpClientUtil.postForm(url, AuthService.getHeader(), param);
				JSONObject jsonVerifyP7 = JSONObject.parseObject(rep_verify_p7); 
				EvidenceClientSignature clientSignature = new EvidenceClientSignature();
				clientSignature.setHashAlgorithm(hashAlg);
				if(param.get("content") != null)
					clientSignature.setHashvalue(param.get("content").toString());
				clientSignature.setName("0");
				clientSignature.setSignatureType("2");
				clientSignature.setSignaturevalue(signedBase64);
				clientSignature.setCreateTime(new Date());
				clientSignature.setEvidenceEnclosure(evidenceSn);
				sqlSession.insert("com.itrus.portal.db.EvidenceClientSignatureMapper.insert", 
						clientSignature);
				// 添加核验结果
				EvidenceCheck check = new EvidenceCheck();
				check.setCheckTime(dateVp);
				check.setVewestCheckTime(dateVp);
				check.setCheckContent("签名原文完整、真实、是否被篡改");
				check.setClientSignature(clientSignature.getId());
				if(jsonVerifyP7.getIntValue("code") == 0) {
					check.setCheckSuccessTime(dateVp);
					check.setCheckStatus("1");
				} else {
					check.setCheckStatus("0");
					check.setUnreason(jsonVerifyP7.getString("message"));
					
					failureReason = mergeFactor(failureReason, "委托人P7验签失败:" + jsonVerifyP7.getString("message"));
				}
				sqlSession.insert("com.itrus.portal.db.EvidenceCheckMapper.insert", 
						check);
				// 得到证书集合
				List<String> certs = null;
				if(jsonVerifyP7.get("signerCerts") != null) {
					certs = (List<String>) jsonVerifyP7.get("signerCerts");
				}
				int loseCertCount = 0;
				if(certs != null){
					// 核验证书并保存
					for(String cert:certs) {
						EvidenceCert evidenceCert = new EvidenceCert();
						if(StringUtils.isNotEmpty(cert)) {
							// 解析证书Base64
							UserCert userCert = CertUtil.getCertFromBase64(cert);
							evidenceCert.setCertSerialnumber(userCert.getCertSn());
							evidenceCert.setSubjectdn(userCert.getCertDn());
							evidenceCert.setIssuerdn(userCert.getIssuerDn());
							if(userCert.getCertBuf() != null)
								evidenceCert.setEvidenceBuf(userCert.getCertBuf().toString());
							evidenceCert.setStartTime(userCert.getCertStartTime());
							evidenceCert.setEndTime(userCert.getCertEndTime());
						}
						evidenceCert.setCertBase64(cert);
						evidenceCert.setCreateTime(new Date());
						evidenceCert.setClientSignature(clientSignature.getId());
						// 验证证书
						Date dateVc = new Date();
						String urlCertVerify = realNameAuthentication.getRealNameddress() + CERT_VERIFY;
						Map<String, Object> mapCertVerify = new HashMap<String, Object>();
						mapCertVerify.put("cert", cert);
						mapCertVerify.put("verifyFlag", "7");
						String rep_cert_verify = HttpClientUtil.postForm(urlCertVerify, AuthService.getHeader(), mapCertVerify);
						JSONObject jsonCertVerify = JSONObject.parseObject(rep_cert_verify);
						// 添加证书核验结果
						EvidenceCheck checkCert = new EvidenceCheck();
						checkCert.setCheckTime(dateVc);
						checkCert.setVewestCheckTime(dateVc);
						checkCert.setCheckContent("1.验证证书有效期/n2.验证证书颁发者签名/n3.验证证书是否吊销");
						checkCert.setEvidenceCert(evidenceCert.getId());
						if(jsonVerifyP7.getIntValue("code") == 0) {
							check.setCheckSuccessTime(dateVc);
							check.setCheckStatus("1");
						} else {
							check.setCheckStatus("0");
							check.setUnreason(jsonCertVerify.getString("message"));
							if(loseCertCount == 0)
								failureReason = mergeFactor(failureReason, "委托人验证证书存在失败");
							loseCertCount++;
						}
						sqlSession.insert("com.itrus.portal.db.EvidenceCheckMapper.insert", 
								checkCert);
					}
				}
			}
			// 定义证书固定服务配置
			EvidenceServiceConfiguration serviceConfiguration = null;
			// 密钥别名定义
			String alias = null;
			// 判断是否需要签名或时间戳
			if(evidenceSaveService.getFixationWay() != null && evidenceSaveService.getFixationWay() != 1) {
				// 得到证书固定服务配置
				List<EvidenceServiceConfiguration> serviceconfig = sqlSession
						.selectList("com.itrus.portal.db.EvidenceServiceConfigurationMapper.selectByExample");
				if (null != serviceconfig && !serviceconfig.isEmpty()) {
					 serviceConfiguration = serviceconfig.get(0);
				}
				// 判断是否需要签名
				if(evidenceSaveService.getFixationWay() == 2 ||evidenceSaveService.getFixationWay() == 4) {
					// 定义签名参数
					Map<String, Object> param = new HashMap<String, Object>();
					String url = null;
					// 判断签名类型配置是否为空 
					if(StringUtils.isNotBlank(serviceConfiguration.getSignatureType())) {
						// 得到配置证书
						EvidenceCertificate evidenceCertificate = certificateService.selectById(
								(long)serviceConfiguration.getSignatureCertificate());
						// 得到服务配置的签名证书的密钥别名
						alias = secretKeyService.getAliasByCertId(
								(long)serviceConfiguration.getSignatureCertificate());
						// 配置签名url 和 参数   1.裸签名  2.p7分离式签名  3.p7非分离式签名  (本期只做2)
						switch (Integer.parseInt(serviceConfiguration.getSignatureType())) {
						case 1:
							param.put("alias", alias);
							param.put("hashAlg", serviceConfiguration.getArithmetic());
							param.put("contentType", "CT_HASH");
							url = realNameAuthentication.getRealNameddress() + SIGNATURE_SIGN;
							break;
						case 2:
							param.put("alias", alias);
							param.put("hashAlg", serviceConfiguration.getArithmetic());
							param.put("detached", true);
							param.put("contentType", "CT_HASH");
							param.put("content", HMACSHA1.getDigest(serviceConfiguration.getArithmetic(), evidenceContent));
							url = realNameAuthentication.getRealNameddress() + P7_SIGN;
							break;
						case 3:
							param.put("alias", alias);
							param.put("hashAlg", serviceConfiguration.getArithmetic());
							param.put("detached", false);
							param.put("contentType", "CT_HASH");
							param.put("content", HMACSHA1.getDigest(serviceConfiguration.getArithmetic(), evidenceContent));
							url = realNameAuthentication.getRealNameddress() + P7_SIGN;
							break;
						}
						// 证据包签名
						String rep_p7_sign = HttpClientUtil.postForm(url, AuthService.getHeader(), param);
						JSONObject jsonRepP7Sign = JSONObject.parseObject(rep_p7_sign);
						// 存储天威签名服务记录
						EvidenceClientSignature clientSignature = new EvidenceClientSignature();
						clientSignature.setHashAlgorithm(param.get("hashAlg").toString());
						clientSignature.setName("1");
						clientSignature.setEvidenceEnclosure(enclosure.getId());
						clientSignature.setSignatureType("2");
						clientSignature.setHashvalue(param.get("content").toString());
						clientSignature.setSignaturevalue(jsonRepP7Sign.getString("signedData"));
						clientSignature.setCreateTime(new Date());
						if(jsonRepP7Sign.getIntValue("code") != 0) {
							failureReason = mergeFactor(failureReason, "天威签名失败");
						}
						sqlSession.insert("com.itrus.portal.db.EvidenceClientSignatureMapper.insert", clientSignature);
						EvidenceCert cert = new EvidenceCert();
						// 解析证书Base64
						UserCert userCert = CertUtil.getCertFromBase64(evidenceCertificate.getCert());
						cert.setCertSerialnumber(userCert.getCertSn());
						cert.setSubjectdn(userCert.getCertDn());
						cert.setIssuerdn(userCert.getIssuerDn());
						if(userCert.getCertBuf() != null)
							cert.setEvidenceBuf(userCert.getCertBuf().toString());
						cert.setStartTime(userCert.getCertStartTime());
						cert.setEndTime(userCert.getCertEndTime());
						cert.setCertBase64(evidenceCertificate.getCert());
						cert.setCreateTime(new Date());
						cert.setClientSignature(clientSignature.getId());
						sqlSession.insert("com.itrus.portal.db.EvidenceCertMapper.insert", cert);
					} 
				}
				// 判断是否需要签名时间戳
				if(evidenceSaveService.getFixationWay() == 3 ||evidenceSaveService.getFixationWay() == 4) {
					// 证据包时间戳
					String repTimeStr = null;
					boolean blTimeSign = false;
					try {
						repTimeStr = genTimeStamp(realNameAuthenticationTime, 
								HMACSHA1.getDigest(serviceConfiguration.getArithmetic(), evidenceContent).getBytes("utf-8"), 
								serviceConfiguration.getArithmetic());
						blTimeSign = true;
					} catch (Exception e) {
						e.printStackTrace();
						String oper = "存证接口_时间戳签名-异常";
						String info = "错误原因:" + e.toString();
						LogUtil.evidencelog(sqlSession, oper, info);
					}
					// 判断签名时间戳是否成功
					if(StringUtils.isNotEmpty(repTimeStr) && blTimeSign) {
						genTime = new Date();
						EvidenceClientTimeStamp clientTimeStamp = new EvidenceClientTimeStamp();
						clientTimeStamp.setHashAlgorithm(serviceConfiguration.getArithmetic());
						clientTimeStamp.setEvidenceEnclosure(enclosure.getId());
						clientTimeStamp.setName("1");
						clientTimeStamp.setCreateTime(new Date());
						clientTimeStamp.setCertificate(repTimeStr);
						clientTimeStamp.setSignatureTime(genTime);
						sqlSession.insert("com.itrus.portal.db.EvidenceClientTimeStampMapper.insert", clientTimeStamp);
					} else {
						failureReason = mergeFactor(failureReason, "天威时间戳签名失败");
					}
 				}
			}
			// 本次证据包大小
			int fileSize = evidencePackage.getBytes().length;
			// 证据服务记录
			EvidenceBasicInformation basicInformation = null;
			// 判断证据编号是否为空   true -> 证据编码为空 代表第一次存证   ,false ->证据编码不为空 代表不是第一次存证
			if(StringUtils.isEmpty(evidenceSn)) {
				// 生成证据编号
				evidenceSn = UniqueIDUtils.genAppServiceUID(
						applicationInfo, appService.getAppServiceName(), sqlSession,3);
				basicInformation = new EvidenceBasicInformation();
				basicInformation.setReceiptStatus(0);
				basicInformation.setStatus(0);
				basicInformation.setCreateTime(new Date());
				basicInformation.setEndTime(convertDate(evidenceSaveService.getSaveTime()));
				basicInformation.setEvidenceSize(fileSize);
				basicInformation.setEvidenceSn(evidenceSn);
				basicInformation.setAppService(appService.getId());
				basicInformation.setOutAppService(evidenceSaveService.getAppServiceName());
				basicInformation.setSaveServiceNmae(appService.getAppServiceName());
				basicInformation.setServicePlatformName(applicationInfo.getName());
				basicInformation.setServiceClientName(applicationInfo.getServiceClientName());
				basicInformation.setServiceClientId(applicationInfo.getServiceClientId());
				if(StringUtils.isNotEmpty(failureReason)) {
					basicInformation.setFailureReason(failureReason);
					basicInformation.setEvidenceStatus(0);
					result.put("status", 0);
				}
				// 对要素 (接收 核验 必填) 操作进行处理
				result =  saveFactor(result, evidenceSaveService, evidenceSn, jsonEvidenceContent, 
						basicInformation, realNameAuthentication, realNameAuthenticationTime, enclosure,
						serviceConfiguration, applicationInfo.getServiceClientId(), true);
			} else {
				EvidenceBasicInformationExample basicInformationExample = new EvidenceBasicInformationExample();
				EvidenceBasicInformationExample.Criteria beCriteria = basicInformationExample.createCriteria();
				beCriteria.andEvidenceSnEqualTo(evidenceSn);
				List<EvidenceBasicInformation> basicInformationList = sqlSession
						.selectList("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", 
								basicInformationExample);
				if(basicInformationList.size() == 0 || basicInformationList.isEmpty()){
					result.put("status", 0);
					result.put("message", "未找到对应证据编号信息");
					return result;
				}
				basicInformation = basicInformationList.get(0);
				if(basicInformation.getEvidenceStatus() == 0) {
					result.put("status", 0);
					result.put("message", "本次证据补交失败。对应证据编号已存在核验失败信息,原因:" + basicInformation.getFailureReason());
					return result;
				}
				basicInformation.setEvidenceSize(basicInformation.getEvidenceSize() + fileSize);
				basicInformation.setAppService(appService.getId());
				// 对要素 (接收 核验) 操作进行处理
				result =  saveFactor(result, evidenceSaveService, evidenceSn, jsonEvidenceContent, 
						basicInformation, realNameAuthentication, realNameAuthenticationTime, enclosure,
						serviceConfiguration, applicationInfo.getServiceClientId(), false);
			}
			if((int) result.get("status") == 1){
				// 得到加密证书别名
				String encryptionAlias = secretKeyService.getAliasByCertId(
						(long)serviceConfiguration.getEncryptionCertificate());
				
				// 内部加密存储证据包
				String urlSave = realNameAuthentication.getRealNameddress() + "/storage/save";
				Map<String, Object> mapSave = new HashMap<String, Object>();
				mapSave.put("type", "ST_E");
			//	mapSave.put("bucketName", applicationInfo.getServiceClientId());
				mapSave.put("bucketName", "hood");
				mapSave.put("objectName", evidenceSn);
				mapSave.put("contentType", "CT_BASE64_DATA");
				mapSave.put("content", evidencePackage);
				mapSave.put("alias", encryptionAlias);
				mapSave.put("digestZValue", false);
				mapSave.put("encAlg", serviceConfiguration.getEncryptionAlgorithm());
				String rep_save = HttpClientUtil.postForm(urlSave, AuthService.getHeader(), mapSave);
				JSONObject jsonSave = JSONObject.parseObject(rep_save);
				
				if(jsonSave.getIntValue("code") == 0) {
					// 存证成功操作
					enclosure = (EvidenceEnclosure) result.get("enclosure");
					enclosure.setBuid(jsonSave.getString("buid"));
					enclosure.setEvidenceSn(evidenceSn);
					enclosure.setFilesize(Integer.toString(fileSize));
					enclosure.setPdfType("1");
					enclosure.setType("ST_E");
					enclosure.setContentType("CT_BASE64_DATA");
					enclosure.setBucketName(mapSave.get("bucketName").toString());
					enclosure.setObjectName(mapSave.get("objectName").toString());
					enclosure.setAlias(alias);
					enclosure.setFilesize(Integer.toString(fileSize));
					enclosure.setApplicationTime(date);
					if(genTime != null )
						enclosure.setFixationTime(genTime);
					else
						enclosure.setFixationTime(new Date());
					enclosure.setCreateTime(new Date());
					enclosure.setSaveTime(Integer.toString(evidenceSaveService.getSaveTime()));
					enclosure.setSaveFactor(result.get("saveFactor").toString());
					result.remove("saveFactor");
					result.remove("enclosure");
					sqlSession.update("com.itrus.portal.db.EvidenceEnclosureMapper.updateByPrimaryKey", 
							enclosure);
				} else {
					result.put("status", 0);
					result.put("message", "存证失败");
					return result;
				}
			}
			// 调用计费 
			// 判断是否为第一次提交
			boolean isNew;
			if(StringUtils.isBlank(evidenceSn))
				isNew = true;
			else
				isNew = false;
			// 记录计费流水
			if((int)mapCharging.get("retCode") == 1) {
				Map<String, Object> mapStoreCg = storeChargingService.storeCharging(appService.getServiceConfigName(), appService.getServiceConfigId(), 
						applicationInfo, appService, basicInformation.getId(), "EvidenceBasicInformation", 
						fileSize, evidenceSaveService.getBaseSpace(), isNew);
				if((int)mapStoreCg.get("retCode") != 1){
					result.put("status", -4);
					result.put("message", mapStoreCg.get("retMsg"));
				}
			}	
			if((int)result.get("status") == 1) {
				basicInformation.setEvidenceStatus(1);
				result.put("status", "1");
				result.put("message", "成功");
				result.put("evidenceSn", basicInformation.getEvidenceSn());
				// 生成存证回执报告
				Map<String, Object> mapRet = reportTemplate.returnreceipt(
						basicInformation.getEvidenceSn(), applicationInfo);
				log.debug("mapRet__ : " + mapRet);
				if(mapRet.get("status") != null && (int)mapRet.get("status") == 0) {
					result.put("pdfBase64", mapRet.get("pdfBase64"));
					basicInformation.setReceiptStatus(1);
				}
			} else {
				basicInformation.setEvidenceStatus(0);
				if(StringUtils.isEmpty(basicInformation.getFailureReason())) {
					if(result.get("message") != null)
						basicInformation.setFailureReason(result.get("message").toString());
				} else {
					if(result.get("message") != null)
						basicInformation.setFailureReason(basicInformation.getFailureReason() + "," + result.get("message").toString());
				}
			}
			sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", 
					basicInformation);
		} catch (Exception e) {
			//返回用户信息
			e.printStackTrace();
			result.put("status", -5);
			result.put("message", "服务器出错,请联系管理员");
			
			String oper = "存证接口-异常";
//			String info = "证据编码" +  + ",错误原因:" + e.toString();
			String info = "错误原因:" + e.toString();
			LogUtil.evidencelog(sqlSession, oper, info);
			return result;
		}
		return result;
	}
	
	
	// 核验要素
	private Map<String, Object> saveFactor(Map<String, Object> result, EvidenceSaveService evidenceSaveService, String evidenceSn, 
			JSONObject jsonEvidenceContent, EvidenceBasicInformation basicInformation, RealNameAuthentication realNameAuthentication,
			RealNameAuthentication realNameAuthenticationTime, EvidenceEnclosure enclosure, EvidenceServiceConfiguration serviceConfiguration,
			String clientId, Boolean bl){
		// 定义证据要素字段
		String saveFactor = null;
		// 证据存证的业务类型
		String type = null;
		// 定义主体身份
		Map<String, EvidenceMainInformation> mapIdCache = new HashMap<String, EvidenceMainInformation>();
		// 可信身份缓存信息
		List<EvidenceTrustedIdentity> tiCacheList = new ArrayList<>();
		try {
			// 得到业务基本信息要素配置
			String factorBusinessInfo = evidenceSaveService.getFactorBusinessInfo();
			JSONArray jsonBiArray = JSONArray.parseArray(factorBusinessInfo);
			for(int i=0;i<jsonBiArray.size();i++) {
				JSONObject object = jsonBiArray.getJSONObject(i);
				String name = object.getString("name");
				String content = jsonEvidenceContent.getString(name);
				JSONObject jsonContent;
				switch (i) {
				// 事件发生平台
				case 0:
					jsonContent = JSONObject.parseObject(content);
					// 判断是否接收
					if(object.getBooleanValue("b_isReception")
							&& StringUtils.isEmpty(basicInformation.getCompanyName())) {
						// 判断是否必填
						if(bl && object.getBooleanValue("b_isRequired") 
							&& (StringUtils.isEmpty(jsonContent.getString("hapPrincipalName"))
									|| StringUtils.isEmpty(jsonContent.getString("hapPlatformDomain")))) {
							result.put("status", 0);
							result.put("message", "提交的参数信息不完整,缺少事件发生平台必要参数值");
							return result;
						}
						if(StringUtils.isEmpty(saveFactor) || !saveFactor.contains("证据基本信息")) 
							saveFactor = mergeFactor(saveFactor, "证据基本信息");
						basicInformation.setCompanyName(jsonContent.getString("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 = mergeFactor(saveFactor, "证据基本信息");
						basicInformation.setType(content);
						type = content;
					}
					break;
				// 业务描述
				case 2:
					// 判断是否接收
					if(object.getBooleanValue("b_isReception")
							&& StringUtils.isEmpty(basicInformation.getDescription())) {
						if(StringUtils.isEmpty(saveFactor) || !saveFactor.contains("证据基本信息")) 
							saveFactor = mergeFactor(saveFactor, "证据基本信息");
						basicInformation.setDescription(content);
					}
					break;
				// 业务单号
				case 3:
					// 判断是否接收
					if(object.getBooleanValue("b_isReception")
							&& StringUtils.isEmpty(basicInformation.getServiceNumber())) {
						if(StringUtils.isEmpty(saveFactor) || !saveFactor.contains("证据基本信息")) 
							saveFactor = mergeFactor(saveFactor, "证据基本信息");
						basicInformation.setServiceNumber(content);
					}
					break;
				}
			}
			if(basicInformation.getId() == null) {
				// 存储证据基本信息
				sqlSession.insert("com.itrus.portal.db.EvidenceBasicInformationMapper.insert", basicInformation);
				sqlSession.flushStatements();
			}
			enclosure.setBasicInformation(basicInformation.getId());
			sqlSession.update("com.itrus.portal.db.EvidenceEnclosureMapper.updateByPrimaryKey", 
					enclosure);
			// 得到身份认证要素配置
			String factorIdVerify = evidenceSaveService.getFactorIdVerify();
			JSONArray jsonIdArray = JSONArray.parseArray(factorIdVerify);	
			// 得到证据包中的身份认证数据
			JSONObject jsonAuthId = jsonEvidenceContent.getJSONObject("authId");
			for(int i=0;i<jsonIdArray.size();i++){
				JSONObject object = jsonIdArray.getJSONObject(i);
				String name = object.getString("name");
				JSONArray jsonContentArray = jsonAuthId.getJSONArray(name);
				switch (i) {
				// 主体身份
				case 0:
					// 查询信息是否已经存证
					List<EvidenceSubjectIdentity> subjectIdentities = null;
					if(!bl) {
						EvidenceSubjectIdentityExample se = new EvidenceSubjectIdentityExample();
						EvidenceSubjectIdentityExample.Criteria sec = se.createCriteria();
						sec.andBasicInformationEqualTo(basicInformation.getId());
						subjectIdentities = sqlSession
								.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", se);
					}
					// 判断是否接收
					if(object.getBooleanValue("i_isReception") 
							&& subjectIdentities == null) {
						for(int j=0;j<jsonContentArray.size();j++) {
							JSONObject jsonContent = jsonContentArray.getJSONObject(j);
							// 判断是否必填
							if(bl && object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContent.getString("name"))
									|| StringUtils.isEmpty(jsonContent.getString("dataId"))
									|| StringUtils.isEmpty(jsonContent.getString("type")))){
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少主体身份参数值");
								return result;
							}
							// 查询该条信息数据库里是否存证
							EvidenceMainInformation mainInformation = null;
							EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
							EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
							mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name"));
							mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId"));
							List<EvidenceMainInformation> mainInformationList = sqlSession
									.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
							if(mainInformationList.size() != 0 && !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.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
							// 存储证据主体身份关系
							EvidenceSubjectIdentity subjectIdentity = new EvidenceSubjectIdentity();
							subjectIdentity.setBasicInformation(basicInformation.getId());
							subjectIdentity.setMainInformation(mainInformation.getId());
							sqlSession.insert("com.itrus.portal.db.EvidenceSubjectIdentityMapper.insert", subjectIdentity);
						}
						if(jsonContentArray.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("i_factor"));
					}
					break;
				// 身份意愿鉴别
				case 1:
					// 查询信息是否已经存证
					List<EvidenceDesireIdentify> desireIdentifys = null;
					if(!bl) {
						EvidenceDesireIdentifyExample de = new EvidenceDesireIdentifyExample();
						EvidenceDesireIdentifyExample.Criteria dec = de.createCriteria();
						dec.andBasicInformationEqualTo(basicInformation.getId());
						desireIdentifys = sqlSession
								.selectList("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", de);
					}
					// 判断是否接收
					if(object.getBooleanValue("i_isReception") && desireIdentifys == null) {
						for(int j=0;j<jsonContentArray.size();j++) {
							JSONObject jsonContent = jsonContentArray.getJSONObject(j);
							// 判断主体是否存在
							String idCacheKey = jsonContent.getString("name") + jsonContent.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(jsonContent.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							// 得到短信验证方式内容
							JSONObject smsWayContent = jsonContent.getJSONObject("smsWayContent");
							// 判断是否必填
							if(bl && object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContent.getString("name")) 
									|| StringUtils.isEmpty(jsonContent.getString("dataId"))
									|| StringUtils.isEmpty(smsWayContent.getString("phone"))
									|| StringUtils.isEmpty(smsWayContent.getString("sendTime"))
									|| StringUtils.isEmpty(smsWayContent.getString("content"))
									|| StringUtils.isEmpty(smsWayContent.getString("verifyCode"))
									|| StringUtils.isEmpty(smsWayContent.getString("smsService"))
									|| StringUtils.isEmpty(smsWayContent.getString("verifySmsTime"))
									|| StringUtils.isEmpty(jsonContent.getString("verifierType")))){
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少身份意愿鉴别参数值");
								return result;
							}
							// 存储身份意愿鉴别信息
							EvidenceDesireIdentify desireIdentify = new EvidenceDesireIdentify(); 
							desireIdentify.setVerifier(jsonContent.getString("verifier"));
//							desireIdentify.setVerifierTime(jsonContent.getDate("time"));
							desireIdentify.setVerifierType(jsonContent.getString("verifierType"));
							desireIdentify.setPhone(smsWayContent.getString("phone"));
							desireIdentify.setSendOutTime(smsWayContent.getDate("sendTime"));
							desireIdentify.setSmsContent(smsWayContent.getString("content"));
							desireIdentify.setVerificationCode(smsWayContent.getString("verifyCode"));
							desireIdentify.setSmsServer(smsWayContent.getString("smsService"));
							desireIdentify.setVerificationTime(smsWayContent.getDate("verifySmsTime"));
							desireIdentify.setBasicInformation(basicInformation.getId());
							desireIdentify.setMainInformation(mainInformation.getId());
							desireIdentify.setCreateTime(new Date());
							desireIdentify.setEvidenceEnclosure(enclosure.getId());
							sqlSession.insert("com.itrus.portal.db.EvidenceDesireIdentifyMapper.insert", desireIdentify);	
						}
						if(jsonContentArray.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("i_factor"));
					}
					break;
				// 身份实名认证
				case 2:
					// 查询信息是否已经存证
					List<EvidenceRealName> realNames = null;
					if(!bl) {
						// 查询是否存在企业提交信息
						EvidenceRealNameExample realNameExample = new EvidenceRealNameExample();
						EvidenceRealNameExample.Criteria rnec = realNameExample.createCriteria();
						rnec.andBasicInformationEqualTo(basicInformation.getId());
						realNames = sqlSession
								.selectList("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realNameExample);
					}
					// 判断是否接收
					if(object.getBooleanValue("i_isReception") 
							&& realNames == null) {
						for(int j=0;j<jsonContentArray.size();j++) {
							JSONObject jsonContent = jsonContentArray.getJSONObject(j);
							// 判断主体是否存在
							String idCacheKey = jsonContent.getString("name") + jsonContent.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(jsonContent.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							// 判断是否必填
							if(bl && object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContent.getString("name"))
									|| StringUtils.isEmpty(jsonContent.getString("dataId"))
									|| StringUtils.isEmpty(jsonContent.getString("authenticatorType"))
									|| StringUtils.isEmpty(jsonContent.getString("time"))
									)){
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
								return result;
							}
							// 身份实名认证表
							EvidenceRealName realName = new EvidenceRealName();
							realName.setEventVerifierType(jsonContent.getString("authenticatorType"));
							realName.setEventVerifier(jsonContent.getString("authenticator"));
							realName.setCertificationTime(jsonContent.getDate("time"));
							realName.setType(mainInformation.getMainType());
							realName.setMainInformation(mainInformation.getId());
							realName.setEvidenceEnclosure(enclosure.getId());
							realName.setBasicInformation(basicInformation.getId());
							if(StringUtils.isNotEmpty(jsonContent.getString("orderNumber")))
								realName.setSerialnumber(jsonContent.getString("orderNumber"));
							// 存储身份实名认证信息
							// 判断主体类型	1. 企业  2. 个人 
							if(mainInformation.getMainType().equals("1") && StringUtils.isEmpty(realName.getSerialnumber())) {
								EvidenceCompaniesSubmit companiesSubmit = new EvidenceCompaniesSubmit();
								
								JSONObject anthEnt = jsonContent.getJSONObject("anthEnt");
								if(bl && object.getBooleanValue("i_isRequired") 
										&& ((StringUtils.isEmpty(anthEnt.getJSONObject("businessLicense").getString("blCode"))
												&& StringUtils.isEmpty(anthEnt.getJSONObject("businessLicense").getString("img")))
											|| (StringUtils.isEmpty(anthEnt.getJSONObject("organization").getString("orgCode"))
													&& StringUtils.isEmpty(anthEnt.getJSONObject("organization").getString("img"))))){
									result.put("status", 0);
									result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
									return result;
								}
								// 法人
								JSONObject corporation = anthEnt.getJSONObject("corporation");
								EvidenceRepresentative representative = new EvidenceRepresentative();
								representative.setName(corporation.getString("idName"));
								representative.setType(corporation.getString("idType"));
								representative.setCertificateid(corporation.getString("idCode"));
								representative.setCreateTime(new Date());
								// 1.身份证 2.其他
								if(corporation.getIntValue("idType") == 1) {
									if(StringUtils.isNotEmpty(corporation.getString("idImg1"))) {
										// 存储图片
									 	File frontImg = saveImg(evidenceSn
									 			, corporation.getString("idImg1"), IMG_ID_IMG_FRONT);
									 	representative.setPhotoCodeImg(frontImg.getName());
									 	representative.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
									if(StringUtils.isNotEmpty(corporation.getString("idImg2"))) {
									 	// 存储图片
										File frontImg = saveImg(evidenceSn
									 			, corporation.getString("idImg2"), IMG_ID_IMG_BACK);
										representative.setInformationImg(frontImg.getName());
										representative.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
								} else {
									if(StringUtils.isNotEmpty(corporation.getString("idImg1"))){
										// 存储图片
									 	File frontImg = saveImg(evidenceSn
									 			, corporation.getString("idImg1"), IMG_ID_IMG_FRONT);
									 	representative.setPhotoCodeImg(frontImg.getName());
									 	representative.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
								}
								// 存储法人信息
								sqlSession.insert("com.itrus.portal.db.EvidenceRepresentativeMapper.insert", representative);
								// 代理人
								JSONObject agent = anthEnt.getJSONObject("agent");
								EvidenceTheAgent theAgent = new EvidenceTheAgent();
								theAgent.setName(agent.getString("idName"));
								theAgent.setType(agent.getString("idType"));
								theAgent.setCertificateid(agent.getString("idCode"));
								theAgent.setCreateTime(new Date());
								// 1.身份证 2.其他
								if(agent.getIntValue("idType") == 1) {
									if(StringUtils.isNotEmpty(agent.getString("idImg1"))) {
										// 存储图片
									 	File frontImg = saveImg(evidenceSn
									 			, agent.getString("idImg1"), IMG_ID_IMG_FRONT);
									 	theAgent.setPhotoCodeImg(frontImg.getName());
									 	theAgent.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
									if(StringUtils.isNotEmpty(agent.getString("idImg2"))) {
									 	// 存储图片
										File frontImg = saveImg(evidenceSn
									 			, agent.getString("idImg2"), IMG_ID_IMG_BACK);
										theAgent.setInformationImg(frontImg.getName());
										theAgent.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
								} else {
									if(StringUtils.isNotEmpty(agent.getString("idImg1"))){
										// 存储图片
									 	File frontImg = saveImg(evidenceSn
									 			, agent.getString("idImg1"), IMG_ID_IMG_FRONT);
									 	representative.setPhotoCodeImg(frontImg.getName());
									 	representative.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
								}
								// 存储代理人信息
								sqlSession.insert("com.itrus.portal.db.EvidenceTheAgentMapper.insert", theAgent);
								// 营业执照
								JSONObject businessLicense = anthEnt.getJSONObject("businessLicense");
								companiesSubmit.setBusCertificateid(businessLicense.getString("blCode"));
								if(StringUtils.isNotEmpty(businessLicense.getString("img"))){
									// 存储图片
									File frontImg = saveImg(evidenceSn
								 			, businessLicense.getString("img"), IMG_BL);
									companiesSubmit.setPhotoCodeImg(frontImg.getName());
									companiesSubmit.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
								}
								// 组织机构代码
								JSONObject organization = anthEnt.getJSONObject("organization");
								companiesSubmit.setOrgCertificateid(organization.getString("orgCode"));
								if(StringUtils.isNotEmpty(organization.getString("img"))){
									// 存储图片
									File frontImg = saveImg(evidenceSn
								 			, organization.getString("img"), IMG_ORG);
									companiesSubmit.setInformationImg(frontImg.getName());
									companiesSubmit.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
								}
								companiesSubmit.setTheAgent(theAgent.getId().intValue());
								companiesSubmit.setRepresentative(representative.getId().intValue());
								companiesSubmit.setBusinessName(jsonContent.getString("name"));
								companiesSubmit.setCreateTime(new Date());
								sqlSession.insert("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.insert", companiesSubmit);
								sqlSession.flushStatements();
								realName.setCompaniesSubmit(companiesSubmit.getId().intValue());
							} else if(jsonContent.getIntValue("type") == 2 
									&& StringUtils.isEmpty(realName.getSerialnumber())) {
								JSONObject jsonAnthPerson = jsonContent.getJSONObject("anthPerson");
								EvidenceIndividual individual = new EvidenceIndividual();
								individual.setName(jsonContent.getString("name"));
								individual.setCreateTime(new Date());
								// 必填判断
								if(bl && object.getBooleanValue("i_isRequired") && (
										StringUtils.isEmpty(jsonAnthPerson.getString("idType"))
										|| StringUtils.isEmpty(jsonAnthPerson.getString("idCode"))
										)){
									result.put("status", 0);
									result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
									return result;
								}
								individual.setType(jsonAnthPerson.getString("idType"));
								individual.setCertificateid(jsonAnthPerson.getString("idCode"));
								// 1.身份证 2.其他
								if(jsonAnthPerson.getIntValue("idType") == 1) {
									if(StringUtils.isNotEmpty(jsonAnthPerson.getString("idImg1"))
											&& StringUtils.isNotEmpty(jsonAnthPerson.getString("idImg2"))){
										// 存储图片
										File frontImg = saveImg(evidenceSn
									 			, jsonAnthPerson.getString("idImg1"), IMG_ID_IMG_FRONT);
										individual.setPhotoCodeImg(frontImg.getName());
										individual.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
										File frontImg2 = saveImg(evidenceSn
									 			, jsonAnthPerson.getString("idImg2"), IMG_ID_IMG_BACK);
										individual.setInformationImg(frontImg2.getName());
										individual.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg2));
									}
								} else {
									if(StringUtils.isNotEmpty(jsonAnthPerson.getString("idImg1"))){
										// 存储图片
										File frontImg = saveImg(evidenceSn
									 			, jsonAnthPerson.getString("idImg1"), IMG_ID_IMG_BACK);
										individual.setPhotoCodeImg(frontImg.getName());
										individual.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
									}
								}
								sqlSession.insert("com.itrus.portal.db.EvidenceIndividualMapper.insert", individual);
								sqlSession.flushStatements();
								realName.setIndividual(individual.getId().intValue());
							}
							sqlSession.insert("com.itrus.portal.db.EvidenceRealNameMapper.insert", realName);
						}
						if(jsonContentArray.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("i_factor"));
					}
					break;
				// 可信身份标识
				case 3:
					// 查询信息是否已经存证
					List<EvidenceTrustedIdentity> trustedIdentities = null;
					if(!bl) {
						EvidenceTrustedIdentityExample tie = new EvidenceTrustedIdentityExample();
						EvidenceTrustedIdentityExample.Criteria tiec = tie.createCriteria();
						tiec.andBasicInformationEqualTo(basicInformation.getId());
						tiec.andEventContentIsNull();
						trustedIdentities = sqlSession
								.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", tie);
					}
					// 判断是否接收
					if(object.getBooleanValue("i_isReception") 
							&& trustedIdentities == null ) {
						for(int j=0;j<jsonContentArray.size();j++){
							JSONObject jsonContent = jsonContentArray.getJSONObject(j);
							// 判断主体是否存在
							String idCacheKey = jsonContent.getString("name") + jsonContent.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(jsonContent.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonContent.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 result;
							}
							log.debug("type __ : " + type + ", equals__ :" + "1".equals(type));
							// 判断是否必填
							if(bl && object.getBooleanValue("i_isRequired") && (
									StringUtils.isEmpty(jsonContent.getString("name"))
									|| StringUtils.isEmpty(jsonContent.getString("dataId"))
									|| 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 result;
							}
							EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
							// 判断证据base64 字段是否为空  
							if(!"1".equals(type) && 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(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.setMainInformation(mainInformation.getId());
							trustedIdentity.setBasicInformation(basicInformation.getId());
							trustedIdentity.setEvidenceEnclosure(enclosure.getId());
							sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
							tiCacheList.add(trustedIdentity);
						}
						if(jsonContentArray.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("i_factor"));
					}
					break;
				}
			}
			// 默认true 当电子合同为pdf格式时  改为false
			boolean blEvent = true;
			// 得到身份认证要素配置
			String factorEventVerify = evidenceSaveService.getFactorEventVerify();
			JSONArray jsonEvArray = JSONArray.parseArray(factorEventVerify);	
			EvidenceEventContent eventContent = new EvidenceEventContent();
			// 得到证据包中的事件数据
			JSONObject jsonEvent = jsonEvidenceContent.getJSONObject("event");
			for(int i=0;i<jsonEvArray.size();i++){
				JSONObject object = jsonEvArray.getJSONObject(i);
				String name = object.getString("name");
				switch (i) {
				// 事件认证
				case 0:
					// 查询信息是否已经存证
					List<EvidenceEventContent> eventContents = null;
					if(!bl) {
						EvidenceEventContentExample ece = new EvidenceEventContentExample();
						EvidenceEventContentExample.Criteria ecec = ece.createCriteria();
						ecec.andBasicInformationEqualTo(basicInformation.getId());
						eventContents = sqlSession
								.selectList("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", ece);
					} 
					if(eventContents != null) {
						eventContent = eventContents.get(0);
					}
					// 判断是否接收
					if(object.getBooleanValue("e_isReception") 
							&& eventContents == null) {
						// 得到证据包中的事件认证
						JSONObject jsonAuthEvent = jsonEvidenceContent.getJSONObject("authEvent");
						// 得到事件内容中的信息
						JSONObject jsonEventContent = jsonAuthEvent.getJSONObject(name);
						// 内容描述
						JSONObject jsonPdfDpt = jsonEventContent.getJSONObject("description");
						// 判断必填
						if(bl && object.getBooleanValue("e_isRequired") && (
								StringUtils.isEmpty(jsonEventContent.getString("pdfBase64"))
								|| StringUtils.isEmpty(jsonPdfDpt.getString("title"))
								|| StringUtils.isEmpty(jsonPdfDpt.getString("size"))
								|| StringUtils.isEmpty(jsonPdfDpt.getString("page"))
								)){
							result.put("status", 0);
							result.put("message", "提交的参数信息不完整,缺少事件认证参数值");
							return result;
						}
						// 存储事件内容信息
						eventContent.setIsPdf(jsonAuthEvent.getBooleanValue("ispdf"));
						eventContent.setContractTitle(jsonPdfDpt.getString("title"));
						eventContent.setContractNumber(jsonPdfDpt.getString("code"));
						eventContent.setValidStartTime(jsonPdfDpt.getDate("validStartTime"));
						eventContent.setValidEndTime(jsonPdfDpt.getDate("validEndTime"));
						eventContent.setDataFormat(jsonPdfDpt.getString("dataFormat"));
						eventContent.setEventSize(jsonPdfDpt.getString("size"));
						eventContent.setThePages(jsonPdfDpt.getInteger("page"));
						eventContent.setCreateTime(new Date());
						eventContent.setBasicInformation(basicInformation.getId());
						eventContent.setEvidenceEnclosure(enclosure.getId());
						sqlSession.insert("com.itrus.portal.db.EvidenceEventContentMapper.insert", eventContent);
						// 判断类型是否是pdf电子合同
						if("1".equals(type)) {
							// 定义存储路径和存储名称
							String bucketName = "hood";
							String pdfName = evidenceSn + "UserUp.pdf";
							// 得到加密证书别名
							String encryptionAlias = secretKeyService.getAliasByCertId(
									(long)serviceConfiguration.getEncryptionCertificate());
							// 存储pdfBase64 到原子服务
							String retSave = storageSave("ST_O", bucketName, pdfName, "CT_BASE64_DATA",
									jsonEventContent.get("pdfBase64").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", "存储用户pdfBase64失败");
								return result;
							} else {
								String pdfSaveFile = systemConfigService.getpdfurl()+ File.separator + bucketName + File.separator + evidenceSn;
								File filePathStr = new File(pdfSaveFile, pdfName);
								// 判断目录是否存在
								File fileUrl = new File(pdfSaveFile);
						        if(!fileUrl.exists()) {
						        	fileUrl.mkdir();
						        }
								// 用户pdfBase64转pdf存储到本地
								boolean pdfSaveBl = Base64Util.genFileFromBase64(jsonEventContent.getString("pdfBase64"), 
										filePathStr.getPath());
								boolean blStr = false;
								if(StringUtils.isNotEmpty(jsonEventContent.getString("pdfBase64"))) {
									blStr = true;
								}
								if(pdfSaveBl) {
									EvidenceEnclosure evidenceEnclosure = new EvidenceEnclosure();
									evidenceEnclosure.setEvidenceSn(evidenceSn);
									evidenceEnclosure.setBuid(jsonRetSave.getString("buid"));
									evidenceEnclosure.setPdfType("2");
									evidenceEnclosure.setType("ST_E");
									evidenceEnclosure.setContentType("CT_BASE64_DATA");
									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转图片
					//			int pdfToPng = Pdf.pdf2png(filePathStr.getPath());
					//			log.debug("pdfToPng :" + pdfToPng);
							}
							// 调用pdf验章接口
							Map<String, Object> mapPdfVerify = new HashMap<String, Object>();
							String urlPdfVerify = realNameAuthentication.getRealNameddress() + PDF_VERIFY;
							mapPdfVerify.put("pdfContent", jsonEventContent.get("pdfBase64"));
							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);
									// 解析签名者证书base64编码
									UserCert userCert1 = CertUtil.getCertFromBase64(json.getString("signerCert"));
									boolean blt = true;
									// 对应可信身份
									EvidenceTrustedIdentity trustedIdentity1 = null;
									// 循环已经存在的证书序列号   判断证书序列号是否存在
									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.setEvidenceEnclosure(enclosure.getId());
										if(trustedIdentity1 != null){
											trustedIdentity.setMainInformation(trustedIdentity1.getMainInformation());
											// 整合证书信息存储到对应可信身份表
											trustedIdentity1.setCertBase64(json.getString("signerCert"));
											trustedIdentity1.setSubjectdn(userCert1.getCertDn());
											trustedIdentity1.setIssuerdn(userCert1.getIssuerDn());
											trustedIdentity1.setIssuer(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.setIssuer(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());
									// 验证时间戳
									EvidenceEventTime eventTime = new EvidenceEventTime();
									if(trustedIdentity1 != null){
										eventTime.setMainInformation(trustedIdentity1.getMainInformation());
									} else {
										eventTime.setMainInformation((long)noId);
									}
									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
									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);
									// 事件行为定义
									EvidenceEventBehavior eventBehavior = new EvidenceEventBehavior();
									eventBehavior.setHashAlgorithm(json.getString("hashAlg"));
									eventBehavior.setSignaturevalue(json.getString("signature"));
									eventBehavior.setEventContent(eventContent.getId());
									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);
								}
								// 整合错误信息
								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(basicInformation.getEvidenceStatus() == 0) {
										 basicInformation.setFailureReason(basicInformation.getFailureReason() + eventContent.getFailureReason());
									 } else {
										 basicInformation.setEvidenceStatus(0);
										 basicInformation.setFailureReason(eventContent.getFailureReason());
									 }
									 sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey",
											 basicInformation);
								 }
							}
							// 当电子合同为pdf时 修改为false
							blEvent = false;
						} else {
							result.put("status", 0);
							result.put("message", "只接受pdf电子合同");
							return result;
							eventContent.setFailureReason("电子合同不为pdf");
							eventContent.setEventStatus(0);
						}
						saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
					}
					break;
				// 事件对象认证 (本期不做)
				case 1:
					// 查询信息是否已经存证
					List<EvidenceTrustedIdentity> trustedIdentities = null;
					if(!bl) {
						EvidenceTrustedIdentityExample tie = new EvidenceTrustedIdentityExample();
						EvidenceTrustedIdentityExample.Criteria tiec = tie.createCriteria();
						tiec.andBasicInformationEqualTo(basicInformation.getId());
						tiec.andEventContentIsNotNull();
						trustedIdentities = sqlSession
								.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", tie);
					}
					// 判断是否接收
					if(blEvent && object.getBooleanValue("e_isReception") 
							&& (trustedIdentities.size() == 0 || trustedIdentities.isEmpty())) {
						JSONArray jsonEventObject = jsonEvent.getJSONArray(name);
						for(int j=0;j<jsonEventObject.size();j++) {
							// 得到事件对象认证对应信息
							JSONObject jsonObject = jsonEventObject.getJSONObject(j);
							// 判断主体是否存在
							String idCacheKey = jsonObject.getString("name") + jsonObject.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(jsonObject.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonObject.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							// 必填判断
							if(bl && object.getBooleanValue("e_isRequired") && (
									StringUtils.isEmpty(jsonObject.getString("name"))
									|| StringUtils.isEmpty(jsonObject.getString("dataId"))
									|| StringUtils.isEmpty(jsonObject.getString("time"))
									|| StringUtils.isEmpty(jsonObject.getString("certBase64"))
									|| StringUtils.isEmpty(jsonObject.getString("authenticatorThen"))
									|| StringUtils.isEmpty(jsonObject.getString("verifyResult"))
									)) {
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少事件对象认证参数值");
								return result;
							}
							EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
							// 判断是否需要调验证证书接口
							if(blEvent){
								// 验证证书
								String urlCertVerify = realNameAuthentication.getRealNameddress() + CERT_VERIFY;
								Map<String, Object> mapCertVerify = new HashMap<String, Object>();
								mapCertVerify.put("cert", jsonObject.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(jsonObject.getString("certBase64"));
									trustedIdentity.setCertSerialnumber(userCert.getCertSn());
									trustedIdentity.setSubjectdn(userCert.getCertDn());
									trustedIdentity.setIssuerdn(userCert.getIssuerDn());
									trustedIdentity.setEvidenceBuf(userCert.getCertBuf().toString());
									trustedIdentity.setStartTime(userCert.getCertStartTime());
									trustedIdentity.setEndTime(userCert.getCertEndTime());
									
									trustedIdentity.setCheckTime(new Date());
									trustedIdentity.setCheckStatus("1");
									
								} else {
									trustedIdentity.setCheckTime(new Date());
									trustedIdentity.setCheckStatus("0");
									trustedIdentity.setUnreason(jsonCertVerify.getString("message"
											+ ""));
									result.put("status", 0);
									result.put("message", "验证证书失败");
									return result;
								}
							}
							trustedIdentity.setBasicInformation(basicInformation.getId());
							trustedIdentity.setMainInformation(mainInformation.getId());
							trustedIdentity.setEvidenceEnclosure(enclosure.getId());
							trustedIdentity.setEventVerifier(jsonObject.getString("authenticatorThen"));
							trustedIdentity.setVerificationResult(jsonObject.getString("verifyResult"));
							trustedIdentity.setCreateTime(new Date());
							
							sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
						}
						if(jsonEventObject.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
					}
					break;
				// 事件意愿认证
				case 2:
					// 查询信息是否已经存证
					List<EvidenceEventDesire> eventDesires = null;
					if(!bl) {
						EvidenceEventDesireExample ede = new EvidenceEventDesireExample();
						EvidenceEventDesireExample.Criteria edec = ede.createCriteria();
						edec.andEventContenteEqualTo(eventContent.getId());
						eventDesires = sqlSession
								.selectList("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", ede);
					}
					// 判断是否接收
					if((object.getJSONObject("e_isReception").getBooleanValue("e_isReception1")
							|| object.getJSONObject("e_isReception").getBooleanValue("e_isReception2"))
							&& (eventDesires.size() == 0 || eventDesires.isEmpty())) {
						JSONArray jsonEventWill = jsonEvent.getJSONArray(name);
						for(int j=0;j<jsonEventWill.size();j++){
							// 得到事件意愿认证对应信息
							JSONObject jsonWill = jsonEventWill.getJSONObject(j);
							// 判断主体是否存在  不存在则获取
							String idCacheKey = jsonWill.getString("name") + jsonWill.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(jsonWill.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonWill.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							if(bl && object.getBooleanValue("e_isRequired") && (
									StringUtils.isEmpty(jsonWill.getString("name"))
									||	StringUtils.isEmpty(jsonWill.getString("dataId"))
									||	StringUtils.isEmpty(jsonWill.getString("way"))
									)) {
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少事件意愿认证参数值");
								return result;
							}
							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 result;
								}
								// 验证证书
								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 result;
								}
								eventDesire.setChallengeCode(jsonCertContent.getString("challengeCode"));
								eventDesire.setAnswerCode(jsonCertContent.getString("answerCode"));
								eventDesire.setClientDevice(jsonCertContent.getString("clientFacility"));
								eventDesire.setVerificationTime(jsonCertContent.getDate("verifyTime"));
								eventDesire.setWaysExpression("证书授权");
							} 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 result;
								}
								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("短信验证");
							}
							eventDesire.setMainInformation(mainInformation.getId());
							eventDesire.setEventContente(eventContent.getId());
							eventDesire.setCreateTime(new Date());
							eventDesire.setEventVerifier(jsonWill.getString("authenticatorThen"));
							eventDesire.setVerificationResult(jsonWill.getString("verifyResult"));
							
							sqlSession.insert("com.itrus.portal.db.EvidenceEventDesireMapper.insert", eventDesire);
						}
						if(jsonEventWill.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
					}
					break;
				// 事件时间认证 (本期不做)
				case 3:
					// 查询信息是否已经存证
					List<EvidenceEventTime> eventTimes = null;
					if(!bl) {
						EvidenceEventTimeExample ete = new EvidenceEventTimeExample();
						EvidenceEventTimeExample.Criteria etec = ete.createCriteria();
						etec.andEventContentEqualTo(eventContent.getId());
						eventTimes = sqlSession
								.selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", ete);
					}
					// 判断是否接收
					if(blEvent && object.getBooleanValue("e_isReception")
							&& (eventTimes.size() == 0 || eventTimes.isEmpty())) {
						JSONArray jsonEventTime = jsonEvent.getJSONArray(name);
						for(int j=0;j<jsonEventTime.size();j++) {
							// 得到事件时间认证队员信息
							JSONObject jsonTime = jsonEventTime.getJSONObject(j);
							// 判断主体是否存在
							String idCacheKey = jsonTime.getString("name") + jsonTime.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(jsonTime.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonTime.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							JSONObject jsonContent = jsonTime.getJSONObject("jsonTime");
							// 必填验证
							if(bl && object.getBooleanValue("e_isRequired") && (
									StringUtils.isEmpty(jsonTime.getString("name"))
									|| StringUtils.isEmpty(jsonTime.getString("dataId"))
									|| StringUtils.isEmpty(jsonTime.getString("type"))
									|| StringUtils.isEmpty(jsonTime.getString("time"))
									|| StringUtils.isEmpty(jsonTime.getString("authenticatorThen"))
									|| StringUtils.isEmpty(jsonTime.getString("verifyResult"))
									|| StringUtils.isEmpty(jsonTime.getString("hashVal"))
									|| StringUtils.isEmpty(jsonTime.getString("hashArithmetic"))
									|| StringUtils.isEmpty(jsonTime.getString("signatureValTime"))
									|| StringUtils.isEmpty(jsonTime.getString("timeSource"))
									|| StringUtils.isEmpty(jsonTime.getString("signTime"))
									|| StringUtils.isEmpty(jsonTime.getString("signatureCert"))
									)) {
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少事件时间认证参数值");
								return result;
							}
							EvidenceEventTime eventTime = new EvidenceEventTime();
							// 判断是否需要调
							if(blEvent){
								// 验证时间戳
								byte[] arg = jsonContent.getBytes("signatureValTime");
								byte[] arg1 = jsonContent.getBytes("hashVal");
								
								org.json.JSONObject jsonTimeVerify = TsaVerifier.verifyTimeStamp(arg, arg1);
						
								if(jsonTimeVerify != null) {
									// 解析证书base64
									UserCert userCert = CertUtil
											.getCertFromBase64(jsonTimeVerify.getString("certBase64"));
									eventTime.setCertificateDn(userCert.getCertDn());
								} else {
									result.put("status", 0);
									result.put("message", "验证证书失败");
									return result;
								}
							}
								eventTime.setCreateTime(new Date());
								eventTime.setEventContent(eventContent.getId());
								eventTime.setMainInformation(mainInformation.getId());
								sqlSession.insert("com.itrus.portal.db.EvidenceEventTimeMapper.insert", eventTime);
							}
							if(jsonEventTime.size() != 0) 
								saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
						}
					break;
				// 事件地点认证
				case 4:
					// 查询信息是否已经存证
					List<EvidenceEventNetworkAddress> eventNetworkAddresses = null;
					if(!bl) {
						EvidenceEventNetworkAddressExample nae = new EvidenceEventNetworkAddressExample();
						EvidenceEventNetworkAddressExample.Criteria naec = nae.createCriteria();
						naec.andEventContentEqualTo(eventContent.getId());
						eventNetworkAddresses = sqlSession
								.selectList("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", nae);
					}
					// 判断是否接收
					if(object.getBooleanValue("e_isReception")
							&& (eventNetworkAddresses == null || eventNetworkAddresses.isEmpty())) {
						JSONArray jsonNetAddress = jsonEvent.getJSONArray(name);
						for(int j=0;j<jsonNetAddress.size();j++) {
							JSONObject jsonAddress = jsonNetAddress.getJSONObject(j);
							// 判断是否必填
							if(bl && object.getBooleanValue("e_isRequired") && (
									StringUtils.isEmpty(jsonAddress.getString("name"))
									|| StringUtils.isEmpty(jsonAddress.getString("dataId"))
									)){
								result.put("status", 0);
								result.put("message", "提交的参数信息不完整,缺少事件地点认证参数值");
								return result;
							}
							EvidenceEventNetworkAddress eventNetworkAddress = new EvidenceEventNetworkAddress();
							// 判断主体是否存在
							String idCacheKey = jsonAddress.getString("name") + jsonAddress.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(jsonAddress.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonAddress.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}
							// 整合数据 存储
							eventNetworkAddress.setEventContent(eventContent.getId());
							eventNetworkAddress.setMainInformation(mainInformation.getId());
							eventNetworkAddress.setCreateTime(new Date());
							if(jsonAddress.getBooleanValue("typeReg")) {
								JSONObject jsonContent = jsonAddress.getJSONObject("content");
								eventNetworkAddress.setType("1");
								eventNetworkAddress.setAccountNumber(jsonContent.getString("code"));
								eventNetworkAddress.setIpAddress(jsonContent.getString("ipAddress"));
								eventNetworkAddress.setSigninTime(jsonContent.getDate("time"));
							} else {
								eventNetworkAddress.setType("0");
							}
							if(jsonAddress.getBooleanValue("typeSign")) {
								JSONObject jsonContent1 = jsonAddress.getJSONObject("content1");
								eventNetworkAddress.setSigninNumber(jsonContent1.getString("code"));
								eventNetworkAddress.setSigninipAddress(jsonContent1.getString("ipAddress"));
								eventNetworkAddress.setSigninTime(jsonContent1.getDate("time"));
								eventNetworkAddress.setSigninType("1");
							} else {
								eventNetworkAddress.setSigninType("0");
							}
							sqlSession.insert("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.insert", eventNetworkAddress);
						}
						if(jsonNetAddress.size() != 0) 
							saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
					}
					break;
				// 事件行为认证 (本期不做)
				case 5:
					// 查询信息是否已经存证
					List<EvidenceEventBehavior> behaviors = null;
					if(!bl) {
						EvidenceEventBehaviorExample ebe = new EvidenceEventBehaviorExample();
						EvidenceEventBehaviorExample.Criteria ebec = ebe.createCriteria();
						ebec.andEventContentEqualTo(eventContent.getId());
						behaviors = sqlSession
								.selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", ebec);
					}
					// 判断是否接收
					if(blEvent && object.getBooleanValue("e_isReception")
							&& (behaviors == null || behaviors.isEmpty())) {	
						JSONArray jsonEventBehavior = jsonEvent.getJSONArray(name);
						for(int j=0;j<jsonEventBehavior.size();j++) {
							// 得到事件行为认证的对应信息
							JSONObject jsonBehavior = jsonEventBehavior.getJSONObject(j);
							
							// 判断是否需要调接口
							if(blEvent){
								// 判断是否必填
								if(bl && object.getBooleanValue("e_isRequired") && (
										StringUtils.isEmpty(jsonBehavior.getString("name"))
										|| StringUtils.isEmpty(jsonBehavior.getString("dataId"))
										|| StringUtils.isEmpty(jsonBehavior.getString("type"))
										|| StringUtils.isEmpty(jsonBehavior.getString("time")))){
								
									result.put("status", 0);
									result.put("message", "提交的参数信息不完整,缺少事件行为认证参数值");
									return result;
								}
								if(StringUtils.isEmpty(jsonBehavior.getJSONObject("content").getString("hashVal"))
										|| StringUtils.isEmpty(jsonBehavior.getJSONObject("content").getString("hashArithmetic"))
										|| StringUtils.isEmpty(jsonBehavior.getJSONObject("content").getString("signatureVal"))
										|| StringUtils.isEmpty(jsonBehavior.getJSONObject("content").getString("signatureCert"))) {
									
									result.put("status", 0);
									result.put("message", "提交的参数信息不完整,缺少事件行为认证参数值");
									return result;
								}
							}
							JSONObject jsonContent = jsonBehavior.getJSONObject("content");
							// 判断主体是否存在
							String idCacheKey = jsonBehavior.getString("name") + jsonBehavior.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(jsonBehavior.getString("name"));
								mainExampleCriteria.andIdentificationEqualTo(jsonBehavior.getString("dataId"));
								List<EvidenceMainInformation> mainInformationList = sqlSession
										.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
								if(mainInformationList != null)
									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 result;
							}

							EvidenceEventBehavior eventBehavior = new EvidenceEventBehavior();
							eventBehavior.setSignatureType(jsonBehavior.getString("type"));
							eventBehavior.setMainInformation(mainInformation.getId());
							eventBehavior.setEventContent(eventContent.getId());
							eventBehavior.setEventVerifier(jsonBehavior.getString("authenticatorThen"));
							eventBehavior.setVerificationResult(jsonBehavior.getString("verificationResult"));
							eventBehavior.setHashBeforeSigning(jsonContent.getString("hashVal"));
							eventBehavior.setHashAlgorithm(jsonContent.getString("hashArithmetic"));
							eventBehavior.setCreateTime(new Date());
							
							sqlSession.insert("com.itrus.portal.db.EvidenceEventBehaviorMapper.insert", eventBehavior);
						}
						if(jsonEventBehavior.size() != 0)
							saveFactor = mergeFactor(saveFactor, object.getString("e_factor"));
					}
					break;
				
				}
			}
		} catch (Exception e) {
			//返回用户信息
			e.printStackTrace();
			result.put("status", -5);
			result.put("message", "服务器出错,请联系管理员");
			
			String oper = "存证接口-异常";
			String info = "证据编码:" + basicInformation.getEvidenceSn() + ",错误原因:" + e.toString();
			LogUtil.evidencelog(sqlSession, oper, info);
			
			return result;
		}
		result.put("saveFactor", saveFactor);
		result.put("enclosure", enclosure);
		
		return result;
	}
	*/
/**
 * 出证
 * @param signature
 * 			签名值
 * @param appId
 * 			应用标识
 * @param serviceCode
 * 			服务编码
 * @param evidenceSns
 * 			要出证的证据编号(多个用逗号隔开)
 * @param businessSn
 * 			事件发生平台业务单号
 * @param request
 * @return
 */
// @RequestMapping(value = "/generate")
@ResponseBody
public Map<String, Object> generate(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "serviceCode", required = true) String serviceCode, @RequestParam(value = "evidenceSns", required = false) String evidenceSns, @RequestParam(value = "businessSn", required = false) String businessSn, @RequestParam(value = "name", required = true) String name, @RequestParam(value = "code", required = true) String code, HttpServletRequest request) {
    // 申请时间
    Date date = new Date();
    // TODO : 出证接口
    Map<String, Object> result = new HashMap<String, Object>();
    // 验证参数是否完整
    if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(code) || StringUtils.isEmpty(name) || (evidenceSns == null && StringUtils.isEmpty(businessSn))) {
        result.put("status", 0);
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 得到应用信息 改成service
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    if (applicationInfo == null) {
        result.put("status", -11);
        result.put("message", "应用标识不存在");
        return result;
    }
    if (applicationInfo.getIsAppStatus() == 0) {
        result.put("status", -12);
        result.put("message", "应用状态已关闭");
        return result;
    }
    // 核验ip限制
    if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
        result.put("status", -1);
        result.put("message", "没有此服务权限");
        log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
        return result;
    }
    // 验证hmac有效性
    try {
        String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + serviceCode + evidenceSns + businessSn + name + code, applicationInfo.getSecretKey()), false);
        if (!signature.equals("HMAC-SHA1 " + macVal)) {
            result.put("status", -2);
            result.put("message", "服务密钥错误");
            return result;
        }
    } catch (Exception e) {
        result.put("status", -3);
        result.put("message", "Hmac验证错误");
        e.printStackTrace();
        return result;
    }
    // 获取对应应用信息
    EvidenceOutServiceConfig outServiceConfig = null;
    AppService appService = appServiceExt.getAppService(serviceCode);
    if (appService != null && "EvidenceOutServiceConfig".equals(appService.getServiceConfigName())) {
        outServiceConfig = configService.selectById(appService.getServiceConfigId());
    } else {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (outServiceConfig == null) {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (appService.getIsAppServiceStatus() == 0) {
        result.put("status", -22);
        result.put("message", "服务已关闭");
        return result;
    }
    if (outServiceConfig.getOutWay() == null) {
        result.put("status", 0);
        result.put("message", "请联系管理员配置出证方式");
        return result;
    }
    // 生成流水号
    String orderNumber = UniqueIDUtils.genAppServiceUID(applicationInfo, appService.getAppServiceName(), sqlSession, 3);
    // 整合出证信息表
    EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
    hisCertificate.setServiceRequestPlatform(applicationInfo.getName());
    hisCertificate.setSisServiceName(appService.getAppServiceName());
    hisCertificate.setSerialnumber(orderNumber);
    hisCertificate.setHisAppService(appService.getId());
    hisCertificate.setApplicationTime(date);
    hisCertificate.setHisApplicant(code);
    hisCertificate.setHisState("1");
    hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
    sqlSession.insert("com.itrus.portal.db.EvidenceHisCertificateMapper.insert", hisCertificate);
    int count = 0;
    if (StringUtils.isNotEmpty(evidenceSns)) {
        String[] evidenceSnArr = evidenceSns.split(",");
        for (String evidenceSn : evidenceSnArr) {
            // 获得对应证据编号的信息
            EvidenceBasicInformationExample basicInformationExample = new EvidenceBasicInformationExample();
            EvidenceBasicInformationExample.Criteria bec = basicInformationExample.createCriteria();
            bec.andEvidenceSnEqualTo(evidenceSn);
            bec.andEvidenceTypeEqualTo(2);
            List<EvidenceBasicInformation> basicInformations = sqlSession.selectList("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicInformationExample);
            if (basicInformations == null || basicInformations.isEmpty()) {
                continue;
            }
            count++;
            EvidenceBasicInformation basicInformation = basicInformations.get(0);
            if (basicInformation.getEvidenceStatus() == 0) {
                result.put("status", 0);
                result.put("message", "证据编号:" + evidenceSn + ",不满足出证要求");
                return result;
            }
            // 存储出证与证据关系
            EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
            hisRelationship.setBasicInformation(basicInformation.getId());
            hisRelationship.setHisCertificate(hisCertificate.getId());
            sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
        }
        if (count == 0) {
            result.put("status", 0);
            result.put("message", "提交的证据编号有误");
            return result;
        }
    } else {
        EvidenceBasicInformationExample informationExample = new EvidenceBasicInformationExample();
        EvidenceBasicInformationExample.Criteria ec = informationExample.createCriteria();
        ec.andServiceNumberEqualTo(businessSn);
        ec.andEvidenceTypeEqualTo(2);
        List<EvidenceBasicInformation> basicInformations = sqlSession.selectList("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", informationExample);
        if (basicInformations == null || basicInformations.isEmpty()) {
            result.put("status", 0);
            result.put("message", "提交的业务单号有误");
            return result;
        }
        for (EvidenceBasicInformation basicInformation : basicInformations) {
            count++;
            if (basicInformation.getEvidenceStatus() == 0) {
                result.put("status", 0);
                result.put("message", "证据编号:" + basicInformation.getEvidenceSn() + ",不满足出证要求");
                return result;
            }
            // 存储出证与证据关系
            EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
            hisRelationship.setBasicInformation(basicInformation.getId());
            hisRelationship.setHisCertificate(hisCertificate.getId());
            sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
        }
    }
    if (count == 1)
        hisCertificate.setHis("0");
    else
        hisCertificate.setHis("1");
    sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
    sqlSession.flushStatements();
    // 核验计费
    /*	boolean blCharing = takeChargingService.checkTakeCharing(applicationInfo, appService, count);
		if(!blCharing) {
			result.put("status", -4);
			result.put("message", "服务计费失败");
			return result;
		}*/
    // 生成出证报告
    Map<String, Object> mapRet = null;
    // 判断是否为自动出证
    if (hisCertificate.getHisway().equals("1")) {
        // 生成出证报告
        try {
            mapRet = reportTemplate.certificationReport(hisCertificate.getSerialnumber());
        } catch (Exception e) {
            result.put("status", 0);
            result.put("message", "出证失败");
            return result;
        }
    } else {
        result.put("status", 0);
        result.put("message", "无法自动出证");
        return result;
    }
    // 判断出证报告是否生成成功
    if (mapRet != null && (int) mapRet.get("status") == 0) {
        result.put("status", 1);
        result.put("message", "出证成功");
        result.put("orderNumber", hisCertificate.getSerialnumber());
        result.put("pdfBase64", mapRet.get("pdfBase64"));
        hisCertificate.setHisState("0");
    } else {
        result.put("status", 0);
        result.put("message", "出证失败");
        hisCertificate.setHisCauseFailure(mapRet.get("message").toString());
        // 判断为自动出证失败后  转人工出证
        if (hisCertificate.getHisway().equals("1")) {
            hisCertificate.setHisway("3");
            result.put("message", "出证失败,已自动转人工出证");
        }
    }
    sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
    return result;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) AppService(com.itrus.portal.db.AppService) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) Date(java.util.Date) IOException(java.io.IOException) EvidenceBasicInformationExample(com.itrus.portal.db.EvidenceBasicInformationExample) JSONObject(com.alibaba.fastjson.JSONObject) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with EvidenceHisRelationship

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

the class EvidenceOutTask method outBody1.

/**
 * 人工出证
 * @param hisCertificate
 * @param orderNumber
 */
private void outBody1(String orderNumber, EvidenceOutServiceConfig outServiceConfig, ApplicationInfo applicationInfo, AppService appService, String evidenceSns, String businessSn, Date date, String code, Integer count) {
    try {
        // 定义错误原因字段
        String hisCauseFailure = null;
        // 整合出证信息表
        EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
        hisCertificate.setServiceRequestPlatform(applicationInfo.getName());
        hisCertificate.setApplicationInfo(applicationInfo.getId());
        hisCertificate.setSisServiceName(appService.getAppServiceName());
        hisCertificate.setSerialnumber(orderNumber);
        hisCertificate.setHisAppService(appService.getId());
        hisCertificate.setApplicationTime(date);
        hisCertificate.setHisApplicant(code);
        if (outServiceConfig.getOutWay() == null) {
            hisCertificate.setHisway("2");
        } else {
            hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
        }
        hisCertificate.setHisState("1");
        hisCertificate.setOutState(0);
        hisCertificate.setOutTemplate(outServiceConfig.getOutReportTemplate());
        hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
        sqlSession.insert("com.itrus.portal.db.EvidenceHisCertificateMapper.insert", hisCertificate);
        sqlSession.flushStatements();
        // int count = 0;
        if (StringUtils.isNotEmpty(evidenceSns)) {
            String[] evidenceSnArr = evidenceSns.split(",");
            for (String evidenceSn : evidenceSnArr) {
                // 获得对应证据编号的信息
                EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 2);
                if (basicInformation == null) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "提交的" + evidenceSn + "证据编号为无效的证据编码";
                    else
                        hisCauseFailure = hisCauseFailure + "," + "提交的" + evidenceSn + "证据编号为无效的证据编码";
                    continue;
                }
                // count++;
                if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
                    else
                        hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
                }
                // 得到证据附件信息
                /*EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
					EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
					eec.andEvidenceSnEqualTo(evidenceSn);
					eec.andPdfTypeEqualTo("1");
					List<EvidenceEnclosure> enclosures = sqlSession
							.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", 
									enclosureExample);*/
                // 存储出证与证据关系
                EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
                hisRelationship.setBasicInformation(basicInformation.getId());
                hisRelationship.setHisCertificate(hisCertificate.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
            }
        } else {
            List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
            if (basicInformations == null || basicInformations.isEmpty()) {
                if (StringUtils.isEmpty(hisCauseFailure))
                    hisCauseFailure = "提交的业务单号有误";
                else
                    hisCauseFailure = hisCauseFailure + "," + "提交的业务单号有误";
            }
            for (EvidenceBasicInformation basicInformation : basicInformations) {
                // 存储出证与证据关系
                EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
                hisRelationship.setBasicInformation(basicInformation.getId());
                hisRelationship.setHisCertificate(hisCertificate.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
            }
        }
        // 判断出证模式
        if (count == 1)
            hisCertificate.setHis("0");
        else
            hisCertificate.setHis("1");
        // 判断出证是否有错
        if (StringUtils.isNotEmpty(hisCauseFailure)) {
            // hisCertificate.setHisway("3");
            hisCertificate.setOutState(1);
            hisCertificate.setHisCauseFailure(hisCauseFailure);
        }
        sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
        sqlSession.flushStatements();
        // 出证计费加流水
        takeChargingService.takeCharing(appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, hisCertificate.getId(), "EvidenceHisCertificate", count, applicationInfo.getName(), hisCertificate.getHisApplicant());
        if (hisCertificate.getOutState() == 0) {
            String oper1 = "出证接口";
            String info1 = "人工出证申请成功,流水号:" + orderNumber;
            LogUtil.evidencelog(sqlSession, null, oper1, info1);
        } else {
            String oper = "出证接口";
            String info = "人工出证失败,流水号:" + orderNumber;
            // 判断为自动出证失败后  转人工出证
            LogUtil.evidencelog(sqlSession, null, oper, info);
        }
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
        StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
        String info = "出证失败,错误详情:" + stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
        String oper = "出证接口";
        LogUtil.evidencelog(sqlSession, null, oper, info);
    }
}
Also used : EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate)

Aggregations

EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)11 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)11 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)11 HashMap (java.util.HashMap)9 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)8 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)8 EvidenceHisRelationshipExample (com.itrus.portal.db.EvidenceHisRelationshipExample)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 ArrayList (java.util.ArrayList)7 List (java.util.List)6 AppService (com.itrus.portal.db.AppService)5 EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)5 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)5 IOException (java.io.IOException)5 Date (java.util.Date)5 EvidenceOutServiceConfigExample (com.itrus.portal.db.EvidenceOutServiceConfigExample)4 EvidenceOutTemplate (com.itrus.portal.db.EvidenceOutTemplate)4 EvidenceSubjectIdentity (com.itrus.portal.db.EvidenceSubjectIdentity)4 EvidenceSubjectIdentityExample (com.itrus.portal.db.EvidenceSubjectIdentityExample)4 EvidenceTrustedIdentity (com.itrus.portal.db.EvidenceTrustedIdentity)4