Search in sources :

Example 1 with EvidenceSubjectIdentityExample

use of com.itrus.portal.db.EvidenceSubjectIdentityExample 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 EvidenceSubjectIdentityExample

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

the class BasicInformationController method show2.

/**
 * 查看详情
 *
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "show/{identification}", produces = "text/html")
public String show2(@PathVariable("identification") String id, Model uiModel) {
    List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
    List<EvidenceMainInformation> milist = 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, EvidenceTrustedIdentity> trustedidentit = new HashMap<Long, EvidenceTrustedIdentity>();
    // 事件时间认证
    Map<Long, EvidenceEventTime> meventime = new HashMap<Long, EvidenceEventTime>();
    // 事件行为认证
    Map<Long, EvidenceEventBehavior> eventbehacior = new HashMap<Long, EvidenceEventBehavior>();
    // 事件意愿认证
    Map<Long, EvidenceEventDesire> meventdesire = new HashMap<Long, EvidenceEventDesire>();
    // 事件网络地址
    Map<Long, EvidenceEventNetworkAddress> networkaddress = new HashMap<Long, EvidenceEventNetworkAddress>();
    // 身份意愿信息
    Map<Long, EvidenceDesireIdentify> desire = new HashMap<Long, EvidenceDesireIdentify>();
    // 得到基本信息
    EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", basid);
    // 得到主体身份信息
    EvidenceMainInformationExample mainExample = new EvidenceMainInformationExample();
    EvidenceMainInformationExample.Criteria info = mainExample.createCriteria();
    info.andIdentificationEqualTo(id);
    // 得到主体信息
    List<EvidenceMainInformation> mainInfor = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainExample);
    EvidenceMainInformation mainInfo = new EvidenceMainInformation();
    if (mainInfor.size() != 0) {
        mlist.add(mainInfor.get(0));
        mainInfo = mainInfor.get(0);
    }
    EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
    EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
    identity.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
    List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
    for (int i = 0; i < subjectIdentity.size(); i++) {
        // 得到主体信息
        EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
        EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
        tionE.andIdentificationEqualTo(subjectIdentity.get(i).getMainInformation());
        if (subjectIdentity.get(i).getMainName() != null) {
            tionE.andSubjectNameEqualTo(subjectIdentity.get(i).getMainName());
        }
        List<EvidenceMainInformation> ainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
        if (ainInfo.size() != 0) {
            milist.add(ainInfo.get(0));
        }
    /*EvidenceMainInformation ainInfo = sqlSession.selectOne(
					"com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
					subjectIdentity.get(i).getMainInformation());
			milist.add(ainInfo);*/
    }
    // 身份信息证据的map
    Map<Long, EvidenceBasicInformation> basi = new HashMap<Long, EvidenceBasicInformation>();
    // 得到身份可信标识
    EvidenceTrustedIdentityExample trusten = new EvidenceTrustedIdentityExample();
    EvidenceTrustedIdentityExample.Criteria identityex = trusten.createCriteria();
    // identityex.andMainInformationEqualTo(mainInfo.getId());
    identityex.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
    identityex.andEventContentIsNull();
    Map<Long, EvidenceTrustedIdentity> trustedidentity = sqlSession.selectMap("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trusten, "mainInformation");
    // String evidenceSn = null;
    if (trustedidentity != null && trustedidentity.get(mainInfo.getId()) != null) {
        if (trustedidentity.get(mainInfo.getId()).getEvidenceSn() != null) {
            String evidenceSn = trustedidentity.get(mainInfo.getId()).getEvidenceSn().toString();
            // 得到可信身份标识关联的证据身份信息
            EvidenceBasicInformationExample basicinforE = new EvidenceBasicInformationExample();
            EvidenceBasicInformationExample.Criteria critbasic = basicinforE.createCriteria();
            critbasic.andEvidenceSnEqualTo(evidenceSn);
            EvidenceBasicInformation basicinfor1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicinforE);
            basi.put(mainInfo.getId(), basicinfor1);
            // 得到身份意愿信息
            EvidenceDesireIdentifyExample desireIdentify = new EvidenceDesireIdentifyExample();
            EvidenceDesireIdentifyExample.Criteria desireExample = desireIdentify.createCriteria();
            desireExample.andMainInformationEqualTo(mainInfo.getIdentification());
            desire = sqlSession.selectMap("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", desireIdentify, "mainInformation");
            // 得到实名认证信息
            EvidenceRealNameExample realnameE = new EvidenceRealNameExample();
            EvidenceRealNameExample.Criteria realnameEx = realnameE.createCriteria();
            realnameEx.andMainInformationEqualTo(mainInfo.getSubjectName() + ";" + mainInfo.getIdentification());
            // realnameEx.andBasicInformationEqualTo(basicinfor1.getId());
            realnameEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
            EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realnameE);
            if (erealname != null) {
                if ("2".equals(erealname.getEventVerifierType()) || "3".equals(erealname.getEventVerifierType())) {
                    // 判断企业还是个人
                    if ("1".equals(erealname.getType())) {
                        EvidenceCompaniesSubmitExample evidenceCompanies = new EvidenceCompaniesSubmitExample();
                        EvidenceCompaniesSubmitExample.Criteria submitEx = evidenceCompanies.createCriteria();
                        submitEx.andIdCodeEqualTo(erealname.getCompaniesSubmit());
                        EvidenceCompaniesSubmit companiesSubmit1 = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByExample", evidenceCompanies);
                        companiesSubmit.put(mainInfo.getId(), companiesSubmit1);
                    } else {
                        EvidenceIndividualExample evidenceIndiv = new EvidenceIndividualExample();
                        EvidenceIndividualExample.Criteria idualEx = evidenceIndiv.createCriteria();
                        idualEx.andIdCodeEqualTo(erealname.getIndividual());
                        EvidenceIndividual dic = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey", evidenceIndiv);
                        denceid.put(mainInfo.getId(), dic);
                    }
                } else if ("1".equals(erealname.getEventVerifierType())) {
                    if ("1".equals(erealname.getType())) {
                        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]);
                        }
                        RealNameRecordExample realname = new RealNameRecordExample();
                        RealNameRecordExample.Criteria recor = realname.createCriteria();
                        // recor.andSerialnumberEqualTo(a[i]);
                        recor.andSerialnumberIn(listString);
                        realname.setOrderByClause("returntime");
                        listReal = sqlSession.selectList("com.itrus.portal.db.RealNameRecordMapper.selectByExample", realname);
                        realnameRecor.put(mainInfo.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]);
                        }
                        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(mainInfo.getId(), listPersonal);
                    }
                }
            }
            uiModel.addAttribute("erealname", erealname);
        }
    }
    // 事件内容
    EvidenceEventContentExample evencontent = new EvidenceEventContentExample();
    EvidenceEventContentExample.Criteria countent = evencontent.createCriteria();
    // countent.andBasicInformationEqualTo(basicinfor.getId());
    countent.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByExample", evencontent);
    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);
    }
    // 得到证据附件信息
    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);
    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);
    uiModel.addAttribute("enclosurepdf", enclosurepdf);
    // 服务委托人签名信息
    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>();
    int ensize = 0;
    for (EvidenceEnclosure en : enclosure) {
        // 服务委托人签名信息
        EvidenceClientSignatureExample cilent = new EvidenceClientSignatureExample();
        EvidenceClientSignatureExample.Criteria signat = cilent.createCriteria();
        signat.andEvidenceSnEqualTo(en.getEvidenceSn());
        signat.andNameEqualTo("0");
        EvidenceClientSignature listclient = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilent);
        if (listclient != null) {
            cilentsignat.put(en.getId(), listclient);
            ensize++;
            // 服务委托人证书信息
            /*	EvidenceCertExample certEx = new EvidenceCertExample();
				EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
				evidenceCert.andClientSignatureEqualTo(listclient.getId());
				List<EvidenceCert> listCert = sqlSession
						.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByExample", certEx);*/
            List<EvidenceCert> listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", listclient.getCertId());
            listcert.put(en.getId(), listCert);
            // 服务委托人核验信息
            EvidenceCheckExample checkEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
            evidenceCheck.andClientSignatureEqualTo(listclient.getId());
            EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
            check.put(en.getId(), listCheck);
        }
        // 天威签名信息
        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);
        if (clientlist != null) {
            cilentsignature.put(en.getId(), clientlist);
            ensize++;
        }
        // 服务委托人时间戳信息
        EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
        EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
        stamp.andEvidenceSnEqualTo(en.getEvidenceSn());
        stamp.andNameEqualTo("0");
        EvidenceClientTimeStamp listtime = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", clientTime);
        if (listtime != null) {
            clientTimestamp.put(en.getId(), listtime);
            ensize++;
        }
        // 天威时间戳信息
        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);
        if (timelist != null) {
            tclientTimestamp.put(en.getId(), timelist);
            ensize++;
        }
    }
    uiModel.addAttribute("basi", basi);
    uiModel.addAttribute("ensize", ensize);
    uiModel.addAttribute("check", check);
    uiModel.addAttribute("listcert", listcert);
    uiModel.addAttribute("envlosure", enclosure);
    // uiModel.addAttribute("erealname", erealname);
    uiModel.addAttribute("milist", milist);
    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("desire", desire);
    int coutn = 0;
    int size = 0;
    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("showsize", msize);
    uiModel.addAttribute("rowsize", size + 1);
    uiModel.addAttribute("rowcoutn", coutn);
    return "basicinformation/show";
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) HashMap(java.util.HashMap) PersonalNameExample(com.itrus.portal.db.PersonalNameExample) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) ArrayList(java.util.ArrayList) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) EvidenceClientTimeStampExample(com.itrus.portal.db.EvidenceClientTimeStampExample) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) EvidenceCompaniesSubmitExample(com.itrus.portal.db.EvidenceCompaniesSubmitExample) EvidenceEventNetworkAddressExample(com.itrus.portal.db.EvidenceEventNetworkAddressExample) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) EvidenceEventBehaviorExample(com.itrus.portal.db.EvidenceEventBehaviorExample) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) RealNameRecord(com.itrus.portal.db.RealNameRecord) EvidenceCheckExample(com.itrus.portal.db.EvidenceCheckExample) EvidenceEventContentExample(com.itrus.portal.db.EvidenceEventContentExample) EvidenceCert(com.itrus.portal.db.EvidenceCert) EvidenceEventTime(com.itrus.portal.db.EvidenceEventTime) EvidenceEventNetworkAddress(com.itrus.portal.db.EvidenceEventNetworkAddress) EvidenceIndividualExample(com.itrus.portal.db.EvidenceIndividualExample) EvidenceRealNameExample(com.itrus.portal.db.EvidenceRealNameExample) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) 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) EvidenceClientSignature(com.itrus.portal.db.EvidenceClientSignature) EvidenceCheck(com.itrus.portal.db.EvidenceCheck) EvidenceClientSignatureExample(com.itrus.portal.db.EvidenceClientSignatureExample) EvidenceBasicInformationExample(com.itrus.portal.db.EvidenceBasicInformationExample) EvidenceEventBehavior(com.itrus.portal.db.EvidenceEventBehavior) 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 3 with EvidenceSubjectIdentityExample

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

the class BasicInformationController method list.

@RequestMapping(produces = "text/html")
public // 事件认证
String list(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, @RequestParam(value = "serviceClientName", required = false) String serviceClientName, @RequestParam(value = "identification", required = false) String identification, @RequestParam(value = "subjectName", required = false) String subjectName, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "hisstatus", required = false) String hisStatus, @RequestParam(value = "receiptStatus", required = false) String receiptStatus, @RequestParam(value = "identieyEvidenceSn", required = false) String identieyEvidenceSn, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, // 返回页面
@RequestParam(value = "status", required = false) String status, // 身份认证
@RequestParam(value = "queryDate3", required = false) Date queryDate3, @RequestParam(value = "queryDate4", required = false) Date queryDate4, @RequestParam(value = "evidenceSn1", required = false) String evidenceSn1, @RequestParam(value = "serviceClientName1", required = false) String serviceClientName1, @RequestParam(value = "identification1", required = false) String identification1, @RequestParam(value = "subjectName1", required = false) String subjectName1, @RequestParam(value = "receiptStatus1", required = false) String receiptStatus1, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.DATE, -1);
        // calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    if (queryDate3 == null && queryDate4 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate4 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate3 = calendar.getTime();
    }
    Map param = new HashMap();
    if (page2 == null || page2 < 1)
        page2 = 1;
    if (size2 == null || size2 < 1)
        size2 = 10;
    // query data
    Integer offset2 = size2 * (page2 - 1);
    param.put("offset", offset2);
    param.put("limit", size2);
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    if (StringUtils.isNotEmpty(evidenceSn)) {
        param.put("evidenceSn", "%" + evidenceSn + "%");
    }
    if (StringUtils.isNotEmpty(serviceClientName)) {
        param.put("serviceClientName", "%" + serviceClientName + "%");
    }
    if (StringUtils.isNotEmpty(identification)) {
        param.put("identification", "%" + identification + "%");
    }
    if (StringUtils.isNotEmpty(subjectName)) {
        param.put("subjectName", "%" + subjectName + "%");
    }
    if (StringUtils.isNotEmpty(type) && !"0".equals(type)) {
        param.put("type", type);
    }
    if (StringUtils.isNotEmpty(hisStatus) && !"-1".equals(hisStatus)) {
        param.put("hisStatus", hisStatus);
    }
    if (StringUtils.isNotEmpty(receiptStatus) && !"-1".equals(receiptStatus)) {
        param.put("receiptStatus", receiptStatus);
    }
    if (StringUtils.isNotEmpty(identieyEvidenceSn)) {
        param.put("identieyEvidenceSn", identieyEvidenceSn);
    }
    // Date time = new Date();
    List<Map<String, Object>> list = basicInformationimpl.selectBasicInformationListEnt(param);
    int count1 = basicInformationimpl.selectBasicInformationCountEnt(param);
    Map<Long, List<EvidenceMainInformation>> listmain = new HashMap<Long, List<EvidenceMainInformation>>();
    for (int i = 0; i < list.size(); i++) {
        long id = Long.parseLong(list.get(i).get("id").toString());
        EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
        EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
        identity.andBasicInformationEqualTo(list.get(i).get("evidence_sn").toString());
        List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
        List<EvidenceMainInformation> lists = new ArrayList<EvidenceMainInformation>();
        for (int j = 0; j < subjectIdentity.size(); j++) {
            EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
            EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
            tionE.andIdentificationEqualTo(subjectIdentity.get(j).getMainInformation());
            if (subjectIdentity.get(j).getMainName() != null) {
                tionE.andSubjectNameEqualTo(subjectIdentity.get(j).getMainName());
            }
            log.error("**************" + subjectIdentity.get(j).getMainInformation());
            List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
            if (mainInfo.size() != 0) {
                lists.add(mainInfo.get(0));
            }
        }
        listmain.put(id, lists);
    }
    uiModel.addAttribute("lists", listmain);
    uiModel.addAttribute("pages2", (count1 + size2 - 1) / size2);
    // page, size
    if (page2 > 1 && size2 * (page2 - 1) >= count1) {
        page2 = (count1 + size2 - 1) / size2;
    }
    // 身份认证
    Map param1 = new HashMap();
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    param1.put("offset", offset);
    param1.put("limit", size);
    param1.put("queryDate3", queryDate3);
    param1.put("queryDate4", queryDate4);
    if (StringUtils.isNotEmpty(evidenceSn1)) {
        param1.put("evidenceSn1", "%" + evidenceSn1 + "%");
    }
    if (StringUtils.isNotEmpty(serviceClientName1)) {
        param1.put("serviceClientName1", "%" + serviceClientName1 + "%");
    }
    if (StringUtils.isNotEmpty(identification1)) {
        param1.put("identification1", "%" + identification1 + "%");
    }
    if (StringUtils.isNotEmpty(subjectName1)) {
        param1.put("subjectName1", "%" + subjectName1 + "%");
    }
    if (StringUtils.isNotEmpty(receiptStatus1) && !"-1".equals(receiptStatus1)) {
        param1.put("receiptStatus1", receiptStatus1);
    }
    List<Map<String, Object>> identifylist = basicInformationimpl.selectIdentifyListEnt(param1);
    int count = basicInformationimpl.selectIdentifyCountEnt(param1);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    Map<Long, List<EvidenceMainInformation>> listmain1 = new HashMap<Long, List<EvidenceMainInformation>>();
    for (int i = 0; i < identifylist.size(); i++) {
        long id = Long.parseLong(identifylist.get(i).get("id").toString());
        EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
        EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
        identity.andBasicInformationEqualTo(identifylist.get(i).get("evidence_sn").toString());
        List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
        List<EvidenceMainInformation> lists = new ArrayList<EvidenceMainInformation>();
        for (int j = 0; j < subjectIdentity.size(); j++) {
            EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
            EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
            tionE.andIdentificationEqualTo(subjectIdentity.get(j).getMainInformation());
            if (subjectIdentity.get(j).getMainName() != null) {
                tionE.andSubjectNameEqualTo(subjectIdentity.get(j).getMainName());
            }
            /*EvidenceMainInformation mainInfo = sqlSession.selectOne(
						"com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample",
						infomationE);
				lists.add(mainInfo);*/
            List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
            if (mainInfo.size() != 0) {
                lists.add(mainInfo.get(0));
            }
        }
        listmain1.put(id, lists);
    }
    uiModel.addAttribute("mlists1", listmain1);
    // }
    uiModel.addAttribute("list", list);
    uiModel.addAttribute("count2", count1);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("evidenceSn", evidenceSn);
    uiModel.addAttribute("serviceClientName", serviceClientName);
    uiModel.addAttribute("identification", identification);
    uiModel.addAttribute("subjectName", subjectName);
    uiModel.addAttribute("type", type);
    uiModel.addAttribute("hisstatus", hisStatus);
    uiModel.addAttribute("receiptStatus", receiptStatus);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("status", status);
    uiModel.addAttribute("queryDate3", queryDate3);
    uiModel.addAttribute("queryDate4", queryDate4);
    uiModel.addAttribute("identifylist", identifylist);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("evidenceSn1", evidenceSn1);
    uiModel.addAttribute("serviceClientName1", serviceClientName1);
    uiModel.addAttribute("identification1", identification1);
    uiModel.addAttribute("subjectName1", subjectName1);
    uiModel.addAttribute("receiptStatus1", receiptStatus1);
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    return "basicinformation/list";
}
Also used : EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) HashMap(java.util.HashMap) Calendar(java.util.Calendar) ArrayList(java.util.ArrayList) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with EvidenceSubjectIdentityExample

use of com.itrus.portal.db.EvidenceSubjectIdentityExample 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 5 with EvidenceSubjectIdentityExample

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

the class EvidenceSaveContractService method saveFactor.

// 核验要素
private Map<String, Object> saveFactor(Map<String, Object> result, EvidenceSaveService evidenceSaveService, String evidenceSn, JSONObject jsonEvidenceContent, EvidenceBasicInformation basicInformation, RealNameAuthentication realNameAuthentication, RealNameAuthentication realNameAuthenticationOss, EvidenceServiceConfiguration serviceConfiguration, Boolean bl, Long sbtTime) throws Exception {
    List<Object> objs = new ArrayList<Object>();
    // 定义证据要素字段
    String saveFactor = null;
    // 证据存证的业务类型
    String type = null;
    // 得到业务基本信息要素配置
    String factorBusinessInfo = evidenceSaveService.getFactorBusinessInfo();
    JSONArray jsonBiArray = JSONArray.parseArray(factorBusinessInfo);
    try {
        // TODO : 核验身份认证
        if (jsonEvidenceContent.get("authId") != null && bl) {
            basicInformation.setEvidenceType(1);
            // 得到数据包身份认证数据
            JSONObject jsonAuthId = jsonEvidenceContent.getJSONObject("authId");
            for (int i = 0; i < jsonBiArray.size(); i++) {
                JSONObject object = jsonBiArray.getJSONObject(i);
                JSONObject jsonContent;
                // 事件发生平台
                if (i == 0) {
                    jsonContent = jsonAuthId.getJSONObject("eventHapPlatform");
                    // 判断是否接收
                    if (object.getBooleanValue("b_isReception")) {
                        // 判断是否必填
                        if (object.getBooleanValue("b_isRequired") && StringUtils.isEmpty(jsonContent.getString("hapPlatformDomain"))) {
                            result.put("status", 0);
                            result.put("message", "提交的参数信息不完整,缺少事件发生平台必要参数值");
                            return result;
                        }
                        basicInformation.setEventPlatformName(jsonContent.getString("hapPlatformName"));
                        basicInformation.setDomainName(jsonContent.getString("hapPlatformDomain"));
                        if (StringUtils.isEmpty(saveFactor) || !saveFactor.contains("基本信息"))
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
                    }
                }
            }
            EvidenceMainInformation mainInformation = null;
            // 得到身份认证要素配置
            String factorIdVerify = evidenceSaveService.getFactorIdVerify();
            JSONArray jsonIdArray = JSONArray.parseArray(factorIdVerify);
            // 得到证据包中的身份认证数据
            for (int i = 0; i < jsonIdArray.size(); i++) {
                // 得到对应认证配置
                JSONObject object = jsonIdArray.getJSONObject(i);
                JSONObject jsonContent = null;
                switch(i) {
                    // 主体身份
                    case 0:
                        jsonContent = jsonAuthId.getJSONObject("principalId");
                        // 判断是否接收
                        if (object.getBooleanValue("i_isReception")) {
                            // 判断是否必填
                            if (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;
                            }
                            // 判断主体是否存在
                            String idCacheKey = jsonContent.getString("name") + jsonContent.getString("dataId");
                            if (cacheMainMap.get(idCacheKey) != null) {
                                mainInformation = cacheMainMap.get(idCacheKey);
                            } else {
                                EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
                                EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
                                mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name").trim());
                                mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId").trim());
                                mainExampleCriteria.andMainTypeEqualTo(jsonContent.getString("type"));
                                mainInformationExample.setOrderByClause("create_time DESC");
                                List<EvidenceMainInformation> mainInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
                                if (!mainInformationList.isEmpty()) {
                                    mainInformation = mainInformationList.get(0);
                                }
                                // 当主体为空时 添加主体信息
                                if (mainInformation == null) {
                                    mainInformation = new EvidenceMainInformation();
                                    mainInformation.setSubjectName(jsonContent.getString("name").trim());
                                    mainInformation.setIdentification(jsonContent.getString("dataId").trim());
                                    mainInformation.setMainType(jsonContent.getString("type"));
                                    mainInformation.setCreateTime(new Date());
                                    objs.add(mainInformation);
                                }
                                cacheMainMap.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
                            }
                            // 添加证据和主体关系表
                            EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
                            subjectIdentity1.setBasicInformation(evidenceSn);
                            subjectIdentity1.setMainInformation(jsonContent.getString("dataId").trim());
                            subjectIdentity1.setMainName(jsonContent.getString("name").trim());
                            subjectIdentity1.setMainType(jsonContent.getShort("type"));
                            subjectIdentity1.setCreateTime(new Date());
                            objs.add(subjectIdentity1);
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
                        }
                        break;
                    // 身份意愿鉴别
                    case 1:
                        jsonContent = jsonAuthId.getJSONObject("authIdWillSms");
                        // 判断是否接收
                        if (object.getBooleanValue("i_isReception")) {
                            // 判断是否必填
                            if (object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContent.getString("phone")) || StringUtils.isEmpty(jsonContent.getString("sendTime")) || StringUtils.isEmpty(jsonContent.getString("content")) || StringUtils.isEmpty(jsonContent.getString("verifyCode")) || StringUtils.isEmpty(jsonContent.getString("verifySmsTime")) || StringUtils.isEmpty(jsonContent.getString("verifierType")))) {
                                result.put("status", 0);
                                result.put("message", "提交的参数信息不完整,缺少身份意愿鉴别参数值");
                                return result;
                            }
                            // 获取验证方
                            String eventVerifier = getAuthenticator(Integer.parseInt(jsonContent.getString("verifierType")), basicInformation.getEventPlatformName());
                            // 存储身份意愿鉴别信息
                            EvidenceDesireIdentify desireIdentify = new EvidenceDesireIdentify();
                            desireIdentify.setVerifier(eventVerifier);
                            desireIdentify.setVerifierType(jsonContent.getString("verifierType"));
                            desireIdentify.setPhone(jsonContent.getString("phone"));
                            desireIdentify.setSendOutTime(jsonContent.getDate("sendTime"));
                            desireIdentify.setSmsContent(jsonContent.getString("content"));
                            desireIdentify.setVerificationCode(jsonContent.getString("verifyCode"));
                            desireIdentify.setVerificationTime(jsonContent.getDate("verifySmsTime"));
                            desireIdentify.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                            desireIdentify.setCreateTime(new Date());
                            desireIdentify.setEvidenceSn(evidenceSn);
                            objs.add(desireIdentify);
                            // 整合提交要素
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
                        }
                        break;
                    // 身份实名认证
                    case 2:
                        JSONObject jsonContentPerson = jsonAuthId.getJSONObject("authIdInfoPerson");
                        JSONObject jsonContentBusiness = jsonAuthId.getJSONObject("authIdInfoBusiness");
                        // 判断是否接收
                        if (object.getBooleanValue("i_isReception")) {
                            // 核验个人身份认证和企业身份认证是否提交其一
                            if ((jsonContentPerson == null && jsonContentBusiness == null) || (jsonContentPerson != null && jsonContentBusiness != null)) {
                                result.put("status", 0);
                                result.put("message", "提交的参数信息错误,个人身份认证和企业身份认证只能提交其一");
                                return result;
                            }
                            // true 代表个人身份认证       false 代表企业身份认证
                            if (jsonContentPerson != null) {
                                // 判断是否必填
                                if (object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContentPerson.getString("authenticatorType")))) {
                                    result.put("status", 0);
                                    result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                    return result;
                                }
                                String eventVerifier = getAuthenticator(Integer.parseInt(jsonContentPerson.getString("authenticatorType")), basicInformation.getEventPlatformName());
                                // 身份实名认证表
                                EvidenceRealName realName = new EvidenceRealName();
                                realName.setEventVerifierType(jsonContentPerson.getString("authenticatorType"));
                                realName.setEventVerifier(eventVerifier);
                                realName.setCertificationTime(jsonContentPerson.getDate("time"));
                                realName.setType(mainInformation.getMainType());
                                realName.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                                realName.setEvidenceSn(evidenceSn);
                                String orderNumber = jsonContentPerson.getString("orderNumber");
                                if (jsonContentPerson.getInteger("authenticatorType") == 1) {
                                    // 认证方 为 1 时,orderNumber 为必填项
                                    if (StringUtils.isEmpty(orderNumber)) {
                                        result.put("status", 0);
                                        result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                        return result;
                                    }
                                    realName.setSerialnumber(orderNumber);
                                    // 判断企业实名认证信息是否为可靠信息
                                    for (String o : orderNumber.split(",")) {
                                        PersonalNameExample personalNameExample = new PersonalNameExample();
                                        PersonalNameExample.Criteria pec = personalNameExample.createCriteria();
                                        pec.andSerialnumberEqualTo(o);
                                        PersonalName personalName = sqlSession.selectOne("com.itrus.portal.db.PersonalNameMapper.selectByExample", personalNameExample);
                                        if (personalName == null || personalName.getAuthenticationstatus() != 0) {
                                            result.put("status", 0);
                                            result.put("message", "流水号为:" + o + "的个人信息验证未通过");
                                            return result;
                                        }
                                    }
                                } else if (jsonContentPerson.getInteger("authenticatorType") == 2) {
                                    EvidenceIndividual individual = new EvidenceIndividual();
                                    individual.setName(mainInformation.getSubjectName());
                                    individual.setCreateTime(new Date());
                                    individual.setIdCode(UniqueIDUtils.getUID());
                                    // 必填判断
                                    if (object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContentPerson.getString("idType")) || StringUtils.isEmpty(jsonContentPerson.getString("idCode")) || StringUtils.isEmpty(jsonContentPerson.getString("idImg1")))) {
                                        result.put("status", 0);
                                        result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                        return result;
                                    }
                                    individual.setType(jsonContentPerson.getString("idType"));
                                    individual.setCertificateid(jsonContentPerson.getString("idCode"));
                                    // 1.身份证 2.其他
                                    if (jsonContentPerson.getIntValue("idType") == 1) {
                                        if (StringUtils.isNotEmpty(jsonContentPerson.getString("idImg1")) && StringUtils.isNotEmpty(jsonContentPerson.getString("idImg2"))) {
                                            // 存储图片
                                            File frontImg = saveImg(evidenceSn, jsonContentPerson.getString("idImg1"), IMG_ID_IMG_FRONT);
                                            individual.setPhotoCodeImg(frontImg.getName());
                                            individual.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                            File frontImg2 = saveImg(evidenceSn, jsonContentPerson.getString("idImg2"), IMG_ID_IMG_BACK);
                                            individual.setInformationImg(frontImg2.getName());
                                            individual.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg2));
                                        } else {
                                            result.put("status", 0);
                                            result.put("message", "提交的参数信息不完整,个人身份认证证据为身份证时 idImg2 为必选参数。");
                                            return result;
                                        }
                                    } else {
                                        // 存储图片
                                        File frontImg = saveImg(evidenceSn, jsonContentPerson.getString("idImg1"), IMG_ID_IMG_BACK);
                                        individual.setPhotoCodeImg(frontImg.getName());
                                        individual.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                    }
                                    objs.add(individual);
                                    realName.setIndividual(individual.getIdCode());
                                }
                                objs.add(realName);
                            } else {
                                // 判断是否必填
                                if (object.getBooleanValue("i_isRequired") && (StringUtils.isEmpty(jsonContentBusiness.getString("authenticatorType")))) {
                                    result.put("status", 0);
                                    result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                    return result;
                                }
                                String eventVerifier = getAuthenticator(Integer.parseInt(jsonContentBusiness.getString("authenticatorType")), basicInformation.getEventPlatformName());
                                // 身份实名认证表
                                EvidenceRealName realName = new EvidenceRealName();
                                realName.setEventVerifierType(jsonContentBusiness.getString("authenticatorType"));
                                realName.setEventVerifier(eventVerifier);
                                realName.setCertificationTime(jsonContentBusiness.getDate("time"));
                                realName.setType(mainInformation.getMainType());
                                realName.setMainInformation(mainInformation.getSubjectName() + ":" + mainInformation.getIdentification());
                                realName.setEvidenceSn(evidenceSn);
                                String orderNumber = jsonContentBusiness.getString("orderNumber");
                                if (jsonContentBusiness.getInteger("authenticatorType") == 1) {
                                    // 认证方 为 1 时,orderNumber 为必填项
                                    if (StringUtils.isEmpty(orderNumber)) {
                                        result.put("status", 0);
                                        result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                        return result;
                                    }
                                    realName.setSerialnumber(orderNumber);
                                    // 判断企业实名认证信息是否为可靠信息
                                    for (String o : orderNumber.split(",")) {
                                        RealNameRecordExample recordExample = new RealNameRecordExample();
                                        RealNameRecordExample.Criteria rec = recordExample.createCriteria();
                                        rec.andSerialnumberEqualTo(o);
                                        RealNameRecord realNameRecord = sqlSession.selectOne("com.itrus.portal.db.RealNameRecordMapper.selectByExample", recordExample);
                                        if (realNameRecord == null || realNameRecord.getAuthenticationstatus() != 0) {
                                            result.put("status", 0);
                                            result.put("message", "流水号为:" + o + "的企业信息验证未通过");
                                            return result;
                                        }
                                    }
                                } else if (jsonContentBusiness.getInteger("authenticatorType") == 2) {
                                    if (object.getBooleanValue("i_isRequired") && ((StringUtils.isEmpty(jsonContentBusiness.getString("blCode")) && StringUtils.isEmpty(jsonContentBusiness.getString("blImg"))) && (StringUtils.isEmpty(jsonContentBusiness.getString("orgCode")) && StringUtils.isEmpty(jsonContentBusiness.getString("orgImg"))))) {
                                        result.put("status", 0);
                                        result.put("message", "提交的参数信息不完整,缺少身份实名认证参数值");
                                        return result;
                                    }
                                    // 法人
                                    EvidenceRepresentative representative = null;
                                    if (StringUtils.isNotEmpty(jsonContentBusiness.getString("legalIdName")) && StringUtils.isNotEmpty(jsonContentBusiness.getString("legalIdType")) && StringUtils.isNotEmpty(jsonContentBusiness.getString("legalIdCode"))) {
                                        representative = new EvidenceRepresentative();
                                        representative.setName(jsonContentBusiness.getString("legalIdName"));
                                        representative.setType(jsonContentBusiness.getString("legalIdType"));
                                        representative.setCertificateid(jsonContentBusiness.getString("legalIdCode"));
                                        representative.setCreateTime(new Date());
                                        representative.setIdCode(UniqueIDUtils.getUID());
                                        // 存储图片
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("idImg1"))) {
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("idImg1"), IMG_ID_IMG_FRONT);
                                            representative.setPhotoCodeImg(frontImg.getName());
                                            representative.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("idImg2"))) {
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("idImg2"), IMG_ID_IMG_BACK);
                                            representative.setInformationImg(frontImg.getName());
                                            representative.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        // 存储法人信息
                                        objs.add(representative);
                                    }
                                    // 代理人
                                    EvidenceTheAgent theAgent = null;
                                    if (StringUtils.isNotEmpty(jsonContentBusiness.getString("agentIdName")) && StringUtils.isNotEmpty(jsonContentBusiness.getString("agentIdType")) && StringUtils.isNotEmpty(jsonContentBusiness.getString("agentIdCode"))) {
                                        theAgent = new EvidenceTheAgent();
                                        theAgent.setName(jsonContentBusiness.getString("agentIdName"));
                                        theAgent.setType(jsonContentBusiness.getString("agentIdType"));
                                        theAgent.setCertificateid(jsonContentBusiness.getString("agentIdCode"));
                                        theAgent.setCreateTime(new Date());
                                        theAgent.setIdCode(UniqueIDUtils.getUID());
                                        // 存储图片
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("agentIdImg1"))) {
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("agentIdImg1"), IMG_ID_IMG_FRONT);
                                            theAgent.setPhotoCodeImg(frontImg.getName());
                                            theAgent.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("agentIdImg2"))) {
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("agentIdImg2"), IMG_ID_IMG_BACK);
                                            theAgent.setInformationImg(frontImg.getName());
                                            theAgent.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        // // 存储代理人信息
                                        objs.add(theAgent);
                                        // 营业执照
                                        EvidenceCompaniesSubmit companiesSubmit = new EvidenceCompaniesSubmit();
                                        companiesSubmit.setBusCertificateid(jsonContentBusiness.getString("blCode"));
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("blImg"))) {
                                            // 存储图片
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("blImg"), IMG_BL);
                                            companiesSubmit.setPhotoCodeImg(frontImg.getName());
                                            companiesSubmit.setPhotoCodeImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        // 组织机构代码
                                        companiesSubmit.setOrgCertificateid(jsonContentBusiness.getString("orgCode"));
                                        if (StringUtils.isNotEmpty(jsonContentBusiness.getString("orgImg"))) {
                                            // 存储图片
                                            File frontImg = saveImg(evidenceSn, jsonContentBusiness.getString("orgImg"), IMG_ORG);
                                            companiesSubmit.setInformationImg(frontImg.getName());
                                            companiesSubmit.setInformationImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
                                        }
                                        if (theAgent != null)
                                            companiesSubmit.setTheAgent(theAgent.getIdCode());
                                        if (representative != null)
                                            companiesSubmit.setRepresentative(representative.getIdCode());
                                        companiesSubmit.setBusinessName(mainInformation.getSubjectName());
                                        companiesSubmit.setCreateTime(new Date());
                                        companiesSubmit.setIdCode(UniqueIDUtils.getUID());
                                        objs.add(companiesSubmit);
                                        realName.setCompaniesSubmit(companiesSubmit.getIdCode());
                                    }
                                }
                                objs.add(realName);
                            }
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
                        }
                        break;
                    default:
                        break;
                }
            }
        }
        // TODO : 核验事件认证
        if (jsonEvidenceContent.get("authEvent") != null) {
            basicInformation.setEvidenceType(2);
            JSONObject jsonAuthEvent = jsonEvidenceContent.getJSONObject("authEvent");
            // 可信身份缓存信息
            List<EvidenceTrustedIdentity> tiCacheList = new ArrayList<>();
            // 核验基础信息
            for (int i = 0; i < jsonBiArray.size(); i++) {
                JSONObject object = jsonBiArray.getJSONObject(i);
                JSONObject jsonContent;
                switch(i) {
                    // 事件发生平台
                    case 0:
                        jsonContent = jsonAuthEvent.getJSONObject("eventHapPlatform");
                        // 判断是否接收
                        if (object.getBooleanValue("b_isReception")) {
                            // 判断是否必填
                            if (object.getBooleanValue("b_isRequired") && StringUtils.isEmpty(jsonContent.getString("hapPlatformDomain"))) {
                                result.put("status", 0);
                                result.put("message", "提交的参数信息不完整,缺少事件发生平台必要参数值");
                                return result;
                            }
                            basicInformation.setEventPlatformName(jsonContent.getString("hapPlatformName"));
                            basicInformation.setDomainName(jsonContent.getString("hapPlatformDomain"));
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
                        }
                        break;
                    // 业务类型
                    case 1:
                        String eventType = jsonAuthEvent.getString("eventType");
                        // 判断是否接收
                        if (object.getBooleanValue("b_isReception")) {
                            // 判断是否必填
                            if (object.getBooleanValue("b_isRequired") && StringUtils.isEmpty(eventType)) {
                                result.put("status", 0);
                                result.put("message", "提交的参数信息不完整,缺少业务类型参数值");
                                return result;
                            }
                            basicInformation.setType(eventType);
                            type = object.getString("b_category");
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
                        }
                        break;
                    // 业务单号
                    case 3:
                        String eventSn = jsonAuthEvent.getString("eventSn");
                        // 判断是否接收
                        if (object.getBooleanValue("b_isReception")) {
                            basicInformation.setServiceNumber(eventSn);
                            saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, "基本信息");
                        }
                        break;
                    default:
                        break;
                }
            }
            // 得到身份认证要素配置
            JSONArray jsonIdArray = JSONArray.parseArray(evidenceSaveService.getFactorIdVerify());
            for (int i = 0; i < jsonIdArray.size(); i++) {
                JSONObject object = jsonIdArray.getJSONObject(i);
                if (i == 3 && object.getBooleanValue("i_isReception")) {
                    // 得到事件包信息数据
                    JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("event");
                    for (int j = 0; j < jsonContentArray.size(); j++) {
                        JSONObject jsonContent = jsonContentArray.getJSONObject(j).getJSONObject("principalId");
                        // 判断是否必填
                        if (object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonContent.getString("type")) || StringUtils.isEmpty(jsonContent.getString("certSn")) || StringUtils.isEmpty(jsonContent.getString("name")) || StringUtils.isEmpty(jsonContent.getString("dataId")))) {
                            result.put("status", 0);
                            result.put("message", "提交的参数信息不完整,缺少可信身份标识参数值");
                            return result;
                        }
                        // 判断主体是否存在
                        String idCacheKey = jsonContent.getString("name").trim() + jsonContent.getString("dataId").trim();
                        EvidenceMainInformation mainInformation = cacheMainMap.get(idCacheKey);
                        EvidenceBasicInformation basicInformation2 = null;
                        if (mainInformation == null) {
                            EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
                            EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
                            mainExampleCriteria.andSubjectNameEqualTo(jsonContent.getString("name").trim());
                            mainExampleCriteria.andIdentificationEqualTo(jsonContent.getString("dataId").trim());
                            mainExampleCriteria.andMainTypeEqualTo(jsonContent.getString("type"));
                            mainInformationExample.setOrderByClause("create_time DESC");
                            List<EvidenceMainInformation> mainInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
                            if (!mainInformationList.isEmpty()) {
                                mainInformation = mainInformationList.get(0);
                            }
                        }
                        // 当主体为空时 添加主体信息
                        if (mainInformation == null) {
                            mainInformation = new EvidenceMainInformation();
                            mainInformation.setSubjectName(jsonContent.getString("name").trim());
                            mainInformation.setIdentification(jsonContent.getString("dataId").trim());
                            mainInformation.setMainType(jsonContent.getString("type"));
                            mainInformation.setCreateTime(new Date());
                            objs.add(mainInformation);
                        }
                        // 遍历 mapIdCache 的key值 判断是否存在   不存在则添加
                        // for(String key:mapIdCache.keySet()) {
                        // if(!idCacheKey.equals(key)) {
                        cacheMainMap.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
                        // }
                        // }
                        // 判断基础信息表 和 主体表是否存在关联
                        // EvidenceSubjectIdentityExample subjectIdentityExampleExist = new EvidenceSubjectIdentityExample();
                        // EvidenceSubjectIdentityExample.Criteria iece = subjectIdentityExampleExist.createCriteria();
                        // iece.andBasicInformationEqualTo(evidenceSn);
                        // iece.andMainInformationEqualTo(mainInformation.getIdentification());
                        // EvidenceSubjectIdentity subjectIdentityExist = sqlSession
                        // .selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExampleExist);
                        // if(subjectIdentityExist == null) {
                        // 
                        // }
                        // 基础信息表 和 主体表添加关联
                        EvidenceSubjectIdentity subjectIdentity1 = new EvidenceSubjectIdentity();
                        subjectIdentity1.setBasicInformation(evidenceSn);
                        subjectIdentity1.setMainInformation(mainInformation.getIdentification());
                        subjectIdentity1.setCreateTime(new Date());
                        subjectIdentity1.setMainName(mainInformation.getSubjectName());
                        subjectIdentity1.setMainType(Short.parseShort(mainInformation.getMainType()));
                        objs.add(subjectIdentity1);
                        // 判断是否需要关联身份证据
                        if (StringUtils.isNotEmpty(jsonContent.getString("evidenceSn"))) {
                            basicInformation2 = basicInformationService.getInformationBySn(jsonContent.getString("evidenceSn"), 1);
                            if (basicInformation2 != null) {
                                EvidenceSubjectIdentityExample subjectIdentityExample = new EvidenceSubjectIdentityExample();
                                EvidenceSubjectIdentityExample.Criteria iec = subjectIdentityExample.createCriteria();
                                iec.andBasicInformationEqualTo(jsonContent.getString("evidenceSn"));
                                iec.andMainInformationEqualTo(mainInformation.getIdentification());
                                EvidenceSubjectIdentity subjectIdentity = sqlSession.selectOne("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectIdentityExample);
                                if (subjectIdentity == null) {
                                    result.put("status", 0);
                                    result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:" + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
                                    return result;
                                }
                            } else {
                                result.put("status", 0);
                                result.put("message", "证据编码:" + jsonContent.getString("evidenceSn") + "与主体:" + jsonContent.getString("name") + "," + jsonContent.getString("dataId") + "不存在关联");
                                return result;
                            }
                        }
                        EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
                        trustedIdentity.setCertSerialnumber(jsonContent.getString("certSn"));
                        trustedIdentity.setIdentiType(jsonContent.getString("type"));
                        trustedIdentity.setBasicInformation(basicInformation.getEvidenceSn());
                        // trustedIdentity.setEvidenceEnclosure(enclosure.getId());
                        if (StringUtils.isNotEmpty(jsonContent.getString("evidenceSn")))
                            trustedIdentity.setEvidenceSn(jsonContent.getString("evidenceSn"));
                        trustedIdentity.setCreateTime(new Date());
                        if (mainInformation != null && !"".equals(mainInformation))
                            trustedIdentity.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                        // sqlSession.insert("com.itrus.portal.db.EvidenceTrustedIdentityMapper.insert", trustedIdentity);
                        // sqlSession.flushStatements();
                        tiCacheList.add(trustedIdentity);
                    }
                    saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("i_factor"));
                }
            }
            // 得到事件认证要素配置
            JSONArray jsonEvArray = JSONArray.parseArray(evidenceSaveService.getFactorEventVerify());
            EvidenceEventContent eventContent = new EvidenceEventContent();
            // 得到证据包中的事件数据
            for (int i = 0; i < jsonEvArray.size(); i++) {
                JSONObject object = jsonEvArray.getJSONObject(i);
                switch(i) {
                    // 事件认证
                    case 0:
                        log.equals("type is " + "电子合同PDF".equals(type));
                        // 判断合同类型
                        if ("电子合同PDF".equals(type)) {
                            // 电子合同
                            log.error("e_isReception is " + object.getBooleanValue("e_isReception"));
                            // 判断是否接收
                            if (object.getBooleanValue("e_isReception")) {
                                // 得到事件内容中的信息
                                JSONObject jsonEventContent = jsonAuthEvent.getJSONObject("eventContent");
                                // 判断必填
                                if (object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonEventContent.getString("contCode")))) {
                                    result.put("status", 0);
                                    result.put("message", "提交的参数信息不完整,缺少事件内容认证参数值");
                                    return result;
                                }
                                String urlPdfVerify = realNameAuthentication.getRealNameddress() + PDF_VERIFY;
                                Map<String, Object> mapPdfVerify = new HashMap<String, Object>();
                                mapPdfVerify.put("pdfContent", jsonEventContent.get("contCode"));
                                eventContent.setIsPdf(true);
                                eventContent.setContractTitle(jsonEventContent.getString("title"));
                                eventContent.setValidStartTime(jsonEventContent.getDate("validStartTime"));
                                eventContent.setValidEndTime(jsonEventContent.getDate("validEndTime"));
                                eventContent.setCreateTime(new Date());
                                eventContent.setEvidenceSn(evidenceSn);
                                eventContent.setIdCode(UniqueIDUtils.getUID());
                                log.error("e_isVerify is " + object.getBooleanValue("e_isVerify"));
                                if (object.getBooleanValue("e_isVerify")) {
                                    Long pdfVerifyTimeAsync = System.currentTimeMillis();
                                    // 异步处理pdf验章
                                    // HttpAsyncClientUtil.getInstance().execute(
                                    // urlPdfVerify,
                                    // AuthService.getHeader(),
                                    // mapPdfVerify,
                                    // new EvidencePdfVerifyService(
                                    // urlPdfVerify,
                                    // jsonEventContent.getString("contCode"),
                                    // eventContent,
                                    // tiCacheList));
                                    OkHttpClientManagerPdfVerify.postAsyn(urlPdfVerify, AuthService.getHeader().get("Authorization").toString(), mapPdfVerify, new EvidencePdfVerifyService(urlPdfVerify, jsonEventContent.getString("contCode"), eventContent, tiCacheList));
                                    log.error("pdfVerifyTimeAsync time is [" + (System.currentTimeMillis() - pdfVerifyTimeAsync) + "]");
                                // 调用pdf验章接口
                                // Long pdfVerifyTime = System.currentTimeMillis();
                                // String rep_pdf_verify = OkHttpClientManagerPdfVerify.post(urlPdfVerify, AuthService.getHeader().get("Authorization").toString(), mapPdfVerify);
                                // log.error("pdfVerifyTime time is [" + (System.currentTimeMillis() - pdfVerifyTime) + "]");
                                // 
                                // 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"));
                                // }
                                // }
                                // String retVerifyTi = null;
                                // String retVerifyBehavior = null;
                                // String retVerifyTime = null;
                                // if(StringUtils.isNotEmpty(rep_pdf_verify)
                                // && StringUtils.isNotEmpty(jsonPdfVerify.getString("signInfos"))) {
                                // // 解析pdf验章返回信息
                                // JSONArray jsonArraySignInfos = jsonPdfVerify.getJSONArray("signInfos");
                                // List<String> listStr = new ArrayList<>();
                                // int noId = 0;
                                // for(int k=0;k<jsonArraySignInfos.size();k++) {
                                // // 循环得到pdf验章返回数据
                                // JSONObject json = jsonArraySignInfos.getJSONObject(k);
                                // // 对应可信身份
                                // EvidenceTrustedIdentity trustedIdentity1 = null;
                                // 
                                // // 判断验章是否包含证书
                                // if(StringUtils.isNotEmpty(json.getString("signerCert"))) {
                                // // 解析签名者证书base64编码
                                // UserCert userCert1 = CertUtil.getCertFromBase64(json.getString("signerCert"));
                                // EvidenceCertUser certUser = certUserService.getCertBySn(userCert1.getCertSn());
                                // if(certUser == null) {
                                // certUser = new EvidenceCertUser();
                                // certUser.setCertBase64(json.getString("signerCert"));
                                // certUser.setCertSerialnumber(userCert1.getCertSn());
                                // certUser.setSubjectdn(userCert1.getCertDn());
                                // certUser.setIssuerdn(userCert1.getIssuerDn());
                                // certUser.setIssuer(EvidenceSaveServiceApi.getCertCn(userCert1.getIssuerDn()));
                                // if(userCert1.getCertBuf() != null){
                                // certUser.setEvidenceBuf(userCert1.getCertBuf().toString());
                                // }
                                // certUser.setStartTime(userCert1.getCertStartTime());
                                // certUser.setEndTime(userCert1.getCertEndTime());
                                // certUser.setCreateTime(new Date());
                                // certUser.setIdCode(UniqueIDUtils.getUID());
                                // objs.add(certUser);
                                // }
                                // 
                                // boolean blt = true;
                                // // 循环已经存在的证书序列号   判断证书序列号是否存在
                                // for(String strCertSn:listStr){
                                // if(userCert1 != null && strCertSn.equals(userCert1.getCertSn())){
                                // blt = false;
                                // }
                                // }
                                // // 循环可信身份list缓存  判断证书序列号是否相同
                                // if(!tiCacheList.isEmpty() && tiCacheList != null){
                                // for(EvidenceTrustedIdentity identity:tiCacheList) {
                                // if(identity.getCertSerialnumber().equals(userCert1.getCertSn())){
                                // trustedIdentity1 = identity;
                                // }
                                // }
                                // }
                                // if(trustedIdentity1 == null) {
                                // noId--;
                                // }
                                // if(blt) {
                                // // 事件对象定义
                                // EvidenceTrustedIdentity trustedIdentity = new EvidenceTrustedIdentity();
                                // trustedIdentity.setBasicInformation(basicInformation.getEvidenceSn());
                                // trustedIdentity.setEventContent(eventContent.getIdCode());
                                // if(trustedIdentity1 != null){
                                // trustedIdentity.setMainInformation(trustedIdentity1.getMainInformation());
                                // // 整合证书信息存储到对应可信身份表
                                // trustedIdentity1.setCertBase64(certUser.getIdCode());
                                // //                                    					  sqlSession.update("com.itrus.portal.db.EvidenceTrustedIdentityMapper.updateByPrimaryKey",
                                // //                                    							  trustedIdentity1);
                                // objs.add(trustedIdentity1);
                                // } else {
                                // trustedIdentity.setMainInformation(noId+"");
                                // }
                                // trustedIdentity.setCertBase64(certUser.getIdCode());
                                // trustedIdentity.setCreateTime(new Date());
                                // trustedIdentity.setIdentiType("1");
                                // 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);
                                // objs.add(trustedIdentity);
                                // }
                                // listStr.add(userCert1.getCertSn());
                                // } else {
                                // retVerifyTi = "事件对象核验失败";
                                // }
                                // // 事件行为定义
                                // EvidenceEventBehavior eventBehavior = new EvidenceEventBehavior();
                                // // 判断时间戳是否存在
                                // if(StringUtils.isNotEmpty(json.getString("timeStamp"))
                                // && !json.getString("timeStamp").equals("{}")) {
                                // // 验证时间戳
                                // EvidenceEventTime eventTime = new EvidenceEventTime();
                                // if(trustedIdentity1 != null){
                                // eventTime.setMainInformation(trustedIdentity1.getMainInformation());
                                // } else {
                                // eventTime.setMainInformation(noId+"");
                                // }
                                // eventTime.setIdentiType("1");
                                // eventTime.setEventContent(eventContent.getIdCode());
                                // eventTime.setCertificate(json.getJSONObject("timeStamp").getString("signature"));
                                // eventTime.setHashAlgorithm(json.getJSONObject("timeStamp").getString("hashAlg"));
                                // eventTime.setHashvalue(json.getJSONObject("timeStamp").getString("hashData"));
                                // eventTime.setCertBase64(json.getJSONObject("timeStamp").getString("tsCert"));
                                // if(StringUtils.isNotEmpty(json.getJSONObject("timeStamp").getString("time"))) {
                                // eventTime.setSignatureTime(json.getJSONObject("timeStamp").getDate("time"));
                                // } else {
                                // eventTime.setSignatureTime(json.getDate("stampTime"));
                                // }
                                // eventTime.setCreateTime(new Date());
                                // // 解析时间戳证书 Base64
                                // if(json.getJSONObject("timeStamp").getString("tsCert") != null) {
                                // UserCert userCert = CertUtil.getCertFromBase64(json.getJSONObject("timeStamp").getString("tsCert"));
                                // eventTime.setCertificateDn(userCert.getCertDn());
                                // eventTime.setIssuerdn(userCert.getIssuerDn());
                                // }
                                // // 时间核验结果
                                // eventTime.setCheckTime(new Date());
                                // if(json.getIntValue("vtsResult") == 0) {
                                // eventTime.setCheckStatus("1");
                                // eventTime.setCheckSuccessTime(new Date());
                                // } else {
                                // if(StringUtils.isEmpty(retVerifyTime)) {
                                // retVerifyTime = "事件时间核验失败";
                                // }
                                // eventTime.setCheckStatus("0");
                                // if(json.getIntValue("vtsResult") == 60002) {
                                // eventTime.setUnreason("验证时戳失败");
                                // } else {
                                // eventTime.setUnreason("其他验证时戳错误");
                                // }
                                // }
                                // eventTime.setVewestCheckTime(new Date());
                                // //        										eventTime.setCheckContent("签名原文完整、真实、是否被篡改");
                                // objs.add(eventTime);
                                // } else {
                                // eventBehavior.setVerificationTime(json.getDate("stampTime"));
                                // }
                                // // 判断事件行为是否返回为空
                                // if(StringUtils.isNotEmpty(json.getString("signature"))) {
                                // eventBehavior.setHashAlgorithm(json.getString("hashAlg"));
                                // eventBehavior.setSignaturevalue(json.getString("signature"));
                                // eventBehavior.setHashBackSigning(json.getString("msgDigest"));
                                // eventBehavior.setEventContent(eventContent.getIdCode());
                                // eventBehavior.setIdentiType("1");
                                // eventBehavior.setCreateTime(new Date());
                                // if(trustedIdentity1 != null){
                                // eventBehavior.setMainInformation(trustedIdentity1.getMainInformation());
                                // } else {
                                // eventBehavior.setMainInformation(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("签名原文完整、真实、是否被篡改");
                                // objs.add(eventBehavior);
                                // } else {
                                // retVerifyBehavior = "事件行为核验失败";
                                // }
                                // }
                                // if(jsonArraySignInfos.size() == 0) {
                                // //        									eventContent.setEventStatus(0);
                                // //        									if(StringUtils.isNotEmpty(eventContent.getFailureReason())) {
                                // //        										eventContent.setFailureReason(eventContent.getFailureReason() + ",pdf签章失败:返回集合为空。");
                                // //        									} else {
                                // //        										eventContent.setFailureReason("pdf签章失败:返回集合为空。");
                                // //        									}
                                // 
                                // result.put("status", 0);
                                // result.put("message", "pdf签章失败:返回集合为空。");
                                // return result;
                                // }
                                // // 整合错误信息
                                // //       	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);
                                // }
                                // if(eventContent.getEventStatus() == 0) {
                                // if(StringUtils.isNotEmpty(basicInformation.getFailureReason())) {
                                // basicInformation.setFailureReason(basicInformation.getFailureReason() + "," + eventContent.getFailureReason());
                                // } else {
                                // basicInformation.setEvidenceStatus(0);
                                // basicInformation.setFailureReason(eventContent.getFailureReason());
                                // }
                                // result.put("status", 0);
                                // result.put("message", eventContent.getFailureReason());
                                // return result;
                                // }
                                // }
                                } else {
                                    objs.add(eventContent);
                                    for (EvidenceTrustedIdentity identity : tiCacheList) {
                                        objs.add(identity);
                                    }
                                }
                                saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
                            }
                        /**
                         ***********************************************     《电子合同PDF》 获取事件内容    end      *******************************************
                         */
                        }
                        break;
                    default:
                        break;
                }
            }
            JSONArray jsonContentArray = jsonAuthEvent.getJSONArray("event");
            for (int i = 0; i < jsonContentArray.size(); i++) {
                // 得到对应的主体信息
                JSONObject jsonContent = jsonContentArray.getJSONObject(i);
                JSONObject jsonIdIdentify = jsonContent.getJSONObject("principalId");
                // 判断主体是否存在
                String idCacheKey = jsonIdIdentify.getString("name") + jsonIdIdentify.getString("dataId");
                EvidenceMainInformation mainInformation = null;
                if (cacheMainMap.get(idCacheKey) == null || "".equals(cacheMainMap.get(idCacheKey))) {
                    EvidenceMainInformationExample mainInformationExample = new EvidenceMainInformationExample();
                    EvidenceMainInformationExample.Criteria mainExampleCriteria = mainInformationExample.createCriteria();
                    mainExampleCriteria.andSubjectNameEqualTo(jsonIdIdentify.getString("name"));
                    mainExampleCriteria.andIdentificationEqualTo(jsonIdIdentify.getString("dataId"));
                    List<EvidenceMainInformation> mainInformationList = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", mainInformationExample);
                    if (!mainInformationList.isEmpty()) {
                        mainInformation = mainInformationList.get(0);
                        cacheMainMap.put(mainInformation.getSubjectName() + mainInformation.getIdentification(), mainInformation);
                    }
                } else {
                    mainInformation = cacheMainMap.get(idCacheKey);
                }
                if (mainInformation == null || "".equals(mainInformation)) {
                    result.put("status", 0);
                    result.put("message", "判断主体为空");
                    return result;
                }
                // 得到证据包中的事件数据
                for (int j = 0; j < jsonEvArray.size(); j++) {
                    JSONObject object = jsonEvArray.getJSONObject(j);
                    switch(j) {
                        // 事件意愿认证
                        case 2:
                            // <---------------------   提交证书授权    start  ------------------------->
                            JSONObject jsonWillCert = jsonContent.getJSONObject("authEventWillCert");
                            JSONObject jsonWillSms = jsonContent.getJSONObject("authEventWillSms");
                            if (jsonWillSms != null && jsonWillCert != null) {
                                result.put("status", 0);
                                result.put("message", "提交的参数信息错误,证据及短信授权信息只能填写其一");
                                return result;
                            }
                            if (jsonWillCert != null) {
                                // 判断是否接收
                                if (object.getJSONObject("e_isReception").getBooleanValue("e_isReception_1")) {
                                    EvidenceEventDesire eventDesire = new EvidenceEventDesire();
                                    if (object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonWillCert.getString("certBase64")) || StringUtils.isEmpty(jsonWillCert.getString("challengeCode")) || StringUtils.isEmpty(jsonWillCert.getString("answerCode")) || StringUtils.isEmpty(jsonWillCert.getString("verifyTime")) || StringUtils.isEmpty(jsonWillCert.getString("authenticatorThenType")))) {
                                        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", jsonWillCert.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(jsonWillCert.getString("certBase64"));
                                        eventDesire.setCertSerialnumber(userCert.getCertSn());
                                        eventDesire.setSubjectdn(userCert.getCertDn());
                                        eventDesire.setIssuerdn(userCert.getIssuerDn());
                                        if (userCert.getCertBuf() != null) {
                                            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(jsonWillCert.getString("challengeCode"));
                                    eventDesire.setAnswerCode(jsonWillCert.getString("answerCode"));
                                    eventDesire.setClientDevice(jsonWillCert.getString("clientFacility"));
                                    eventDesire.setVerificationTime(jsonWillCert.getDate("verifyTime"));
                                    eventDesire.setWaysExpression("1");
                                    String eventVerifier = getAuthenticator(Integer.parseInt(jsonWillCert.getString("authenticatorThenType")), basicInformation.getEventPlatformName());
                                    eventDesire.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                                    eventDesire.setEventContente(eventContent.getIdCode());
                                    eventDesire.setCreateTime(new Date());
                                    eventDesire.setEventVerifierType(jsonWillCert.getString("authenticatorThenType"));
                                    eventDesire.setEventVerifier(eventVerifier);
                                    objs.add(eventDesire);
                                    saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
                                }
                            }
                            // <---------------------   提交短信授权    start  ------------------------->
                            if (jsonWillSms != null) {
                                // 判断是否接收
                                if (object.getJSONObject("e_isReception").getBooleanValue("e_isReception_2")) {
                                    EvidenceEventDesire eventDesire = new EvidenceEventDesire();
                                    if (object.getBooleanValue("e_isRequired") && (StringUtils.isEmpty(jsonWillSms.getString("phone")) || StringUtils.isEmpty(jsonWillSms.getString("sendTime")) || StringUtils.isEmpty(jsonWillSms.getString("smsContent")) || StringUtils.isEmpty(jsonWillSms.getString("verifyCode")) || StringUtils.isEmpty(jsonWillSms.getString("verifyTime")) || StringUtils.isEmpty(jsonWillSms.getString("authenticatorThenType")))) {
                                        result.put("status", 0);
                                        result.put("message", "提交的参数信息不完整,缺少事件意愿认证参数值");
                                        return result;
                                    }
                                    eventDesire.setPhone(jsonWillSms.getString("phone"));
                                    eventDesire.setSmsContent(jsonWillSms.getString("smsContent"));
                                    eventDesire.setVerificationCode(jsonWillSms.getString("verifyCode"));
                                    eventDesire.setSendOutTime(jsonWillSms.getDate("sendTime"));
                                    eventDesire.setVerificationTime(jsonWillSms.getDate("verifyTime"));
                                    eventDesire.setWaysExpression("2");
                                    String eventVerifier = getAuthenticator(Integer.parseInt(jsonWillSms.getString("authenticatorThenType")), basicInformation.getEventPlatformName());
                                    eventDesire.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                                    eventDesire.setEventContente(eventContent.getIdCode());
                                    eventDesire.setCreateTime(new Date());
                                    eventDesire.setEventVerifierType(jsonWillSms.getString("authenticatorThenType"));
                                    eventDesire.setEventVerifier(eventVerifier);
                                    objs.add(eventDesire);
                                    saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
                                }
                            }
                            break;
                        // 事件地点认证
                        case 4:
                            // 判断是否接收
                            if (object.getBooleanValue("e_isReception")) {
                                JSONObject jsonAddress = jsonContent.getJSONObject("netAddress");
                                if (jsonAddress != null && !(jsonAddress.getString("appUid") == null && jsonAddress.getString("timeReg") == null && jsonAddress.getString("ipAddressReg") == null && jsonAddress.getString("ipAddressSign") == null)) {
                                    // 定义事件网络地址对象
                                    EvidenceEventNetworkAddress eventNetworkAddress = new EvidenceEventNetworkAddress();
                                    // 整合数据 存储
                                    eventNetworkAddress.setEventContent(eventContent.getIdCode());
                                    eventNetworkAddress.setMainInformation(mainInformation.getSubjectName() + ";" + mainInformation.getIdentification());
                                    eventNetworkAddress.setCreateTime(new Date());
                                    eventNetworkAddress.setAccountNumber(jsonAddress.getString("appUid"));
                                    eventNetworkAddress.setIpAddress(jsonAddress.getString("ipAddressReg"));
                                    eventNetworkAddress.setSigninTime(jsonAddress.getDate("timeReg"));
                                    eventNetworkAddress.setSigninNumber(jsonAddress.getString("appUid"));
                                    eventNetworkAddress.setSigninipAddress(jsonAddress.getString("ipAddressReg"));
                                    eventNetworkAddress.setSendOutTime(jsonAddress.getDate("timeReg"));
                                    objs.add(eventNetworkAddress);
                                }
                                saveFactor = EvidenceSaveServiceApi.mergeFactor(saveFactor, object.getString("e_factor"));
                            }
                            break;
                    }
                }
            }
        }
        log.error("saveFactor content is [" + saveFactor + "]");
        result.put("saveFactor", saveFactor);
        result.put("basicInformation", basicInformation);
        result.put("objs", objs);
        return result;
    } catch (Exception e) {
        e.printStackTrace();
        StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 5];
        String info = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
        LogUtil.evidencelog(sqlSession, evidenceSn, "存证接口", "存证失败,证据编号:" + evidenceSn + ", 失败原因:" + info);
        result.put("status", -5);
        result.put("message", "系统服务错误,请联系管理员");
        return result;
    }
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) PersonalNameExample(com.itrus.portal.db.PersonalNameExample) ArrayList(java.util.ArrayList) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) EvidenceTheAgent(com.itrus.portal.db.EvidenceTheAgent) PersonalName(com.itrus.portal.db.PersonalName) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) UserCert(com.itrus.portal.db.UserCert) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) JSONArray(com.alibaba.fastjson.JSONArray) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) RealNameRecord(com.itrus.portal.db.RealNameRecord) Date(java.util.Date) JSONObject(com.alibaba.fastjson.JSONObject) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) JSONObject(com.alibaba.fastjson.JSONObject) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) RealNameRecordExample(com.itrus.portal.db.RealNameRecordExample) EvidenceRepresentative(com.itrus.portal.db.EvidenceRepresentative) File(java.io.File) EvidenceEventNetworkAddress(com.itrus.portal.db.EvidenceEventNetworkAddress)

Aggregations

EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)8 EvidenceSubjectIdentity (com.itrus.portal.db.EvidenceSubjectIdentity)8 EvidenceSubjectIdentityExample (com.itrus.portal.db.EvidenceSubjectIdentityExample)8 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)7 List (java.util.List)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)5 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)5 EvidenceMainInformationExample (com.itrus.portal.db.EvidenceMainInformationExample)5 AppService (com.itrus.portal.db.AppService)4 EvidenceCompaniesSubmit (com.itrus.portal.db.EvidenceCompaniesSubmit)4 EvidenceDesireIdentify (com.itrus.portal.db.EvidenceDesireIdentify)4 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)4 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)4 EvidenceIndividual (com.itrus.portal.db.EvidenceIndividual)4 EvidenceRealName (com.itrus.portal.db.EvidenceRealName)4 PersonalNameExample (com.itrus.portal.db.PersonalNameExample)4 RealNameRecord (com.itrus.portal.db.RealNameRecord)4