Search in sources :

Example 1 with EvidenceClientTimeStamp

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

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

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

the class EvidenceSaveServiceApi method genTimeStamp.

/**
 * 签时间戳接口
 * @param authentication
 * @param plainHash
 * @param hashAlg
 * @return
 * @throws Exception
 */
public static Map<String, Object> genTimeStamp(RealNameAuthentication authentication, String plainHash, String hashAlg, String sn, HttpClientService clientService) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    boolean bl = false;
    retMap.put("retStatus", bl);
    String url = null;
    String str = null;
    String retTime = null;
    try {
        if (authentication.getVersionNumber() == 1) {
            TsaSigner tsaSigner = new TsaSigner(authentication.getAccessTokenaddress(), authentication.getIdCode(), authentication.getKeyCode());
            byte[] repTime = tsaSigner.genTimeStamp(plainHash.getBytes("utf-8"), hashAlg);
            Base64Encoder enc = new Base64Encoder();
            String rep = enc.encode(repTime);
        // return rep;
        } else {
            url = authentication.getRealNameddress() + "/openapi/timestamp";
            String hex = String.valueOf(HexUtils.str2HexStr(plainHash, "utf-8"));
            str = "{\"plainHash\":\"" + hex + "\"," + "\"hashAlg\":\"" + hashAlg + "\"," + "\"accessToken\":\"" + authentication.getAuthorizationCode() + "\"}";
            Map<String, String> header = new HashMap<>();
            header.put("Content-Type", "application/json");
            // System.out.println("genTimeStamp start param : " + str);
            retTime = OkHttpClientManagerTime.post(url, AuthService.getHeader().get("Authorization").toString(), str);
            JSONObject jsonRep = JSONObject.parseObject(retTime);
            // 判断签名时间戳是否成功
            if (StringUtils.isNotEmpty(retTime) && jsonRep.getInteger("retCode") == 0 && StringUtils.isNotEmpty(jsonRep.getString("b64TimeStamp"))) {
                // 得到时间戳签名值
                String timeStamp = jsonRep.getString("b64TimeStamp");
                EvidenceClientTimeStamp clientTimeStamp = new EvidenceClientTimeStamp();
                clientTimeStamp.setHashAlgorithm(hashAlg);
                clientTimeStamp.setEvidenceSn(sn);
                clientTimeStamp.setName("1");
                clientTimeStamp.setCreateTime(new Date());
                clientTimeStamp.setTimeSource("国家授时中心");
                clientTimeStamp.setHashvalue(plainHash);
                clientTimeStamp.setCertificate(timeStamp);
                clientTimeStamp.setSignatureTime(new Date());
                clientTimeStamp.setCertificateDn(authentication.getCertificateCn());
                // clientTimeStamp.setCreateTimeMs(date.getTime());
                bl = true;
                retMap.put("obj", clientTimeStamp);
                retMap.put("retStatus", bl);
            } else {
                LogUtil.evidencelog(SpringContextHolder.getBean(SqlSession.class), sn, "存证接口_时间戳", "时间戳失败,证据编号:" + sn + ", 请求参数:" + str + ", 请求地址:" + url + ", 返回结果:" + retTime);
                return retMap;
            }
        }
    } catch (Exception e) {
        bl = false;
        retMap.put("retStatus", bl);
        // TODO: handle exception
        LogUtil.evidencelog(SpringContextHolder.getBean(SqlSession.class), sn, "存证接口_时间戳", "时间戳失败,证据编号:" + sn + ", 请求参数:" + str + ", 请求地址:" + url + ", 返回结果:" + retTime + ", 失败原因:" + e.toString());
        return retMap;
    }
    return retMap;
}
Also used : SqlSession(org.apache.ibatis.session.SqlSession) HashMap(java.util.HashMap) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) Base64Encoder(com.thoughtworks.xstream.core.util.Base64Encoder) Date(java.util.Date) IOException(java.io.IOException) JSONObject(com.alibaba.fastjson.JSONObject) JSONObject(com.alibaba.fastjson.JSONObject) TsaSigner(cn.topca.tsa.TsaSigner)

Example 4 with EvidenceClientTimeStamp

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

the class EvidenceTimeStampTask method saveTimeStamp.

private void saveTimeStamp(String data) {
    JSONObject jsonRep = JSONObject.parseObject(data);
    // 判断签名时间戳是否成功
    if (jsonRep.getInteger("retCode") != null && jsonRep.getInteger("retCode") == 0 && StringUtils.isNotEmpty(jsonRep.getString("b64TimeStamp"))) {
        // 得到时间戳签名值
        String timeStamp = jsonRep.getString("b64TimeStamp");
        EvidenceClientTimeStamp clientTimeStamp = new EvidenceClientTimeStamp();
        clientTimeStamp.setHashAlgorithm(hashAlg);
        clientTimeStamp.setEvidenceSn(evidenceSn);
        clientTimeStamp.setName("1");
        clientTimeStamp.setCreateTime(new Date());
        clientTimeStamp.setTimeSource("国家授时中心");
        clientTimeStamp.setHashvalue(plainHash);
        clientTimeStamp.setCertificate(timeStamp);
        clientTimeStamp.setSignatureTime(new Date());
        clientTimeStamp.setCertificateDn(authentication.getCertificateCn());
        queueThread.putObjectQueue(clientTimeStamp);
    } else {
        log.error("saveTimeStamp rep is " + data);
        LogUtil.evidencelog(sqlSession, evidenceSn.toString(), "存证接口_时间戳", "时间戳失败,证据编号:" + evidenceSn.toString() + ", 失败原因:" + jsonRep.getString("retMsg"));
    }
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) Date(java.util.Date)

Example 5 with EvidenceClientTimeStamp

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

the class BasicInformationController method show1.

/**
 * 查看详细内容(事件详细)
 *
 * @param id
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "show1/{id}/{mid}/{type}", produces = "text/html")
public String show1(@PathVariable("id") Long id, @PathVariable("mid") Long mid, @PathVariable("type") int type, Model uiModel) {
    /*
		 * if (type == 1) {// 身份意愿鉴别信息 EvidenceDesireIdentify desire =
		 * sqlSession .selectOne(
		 * "com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByPrimaryKey",
		 * id); EvidenceMainInformation mainInfo = sqlSession.selectOne(
		 * "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
		 * desire.getMainInformation()); uiModel.addAttribute("desire", desire);
		 * uiModel.addAttribute("mainInfo", mainInfo); return
		 * "basicinformation/desireIdentify"; } else if (type == 2) {// 获取实名认证信息
		 * EvidenceCompaniesSubmit companiesSubmit = sqlSession .selectOne(
		 * "com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByPrimaryKey",
		 * id); String cid = companiesSubmit.getId().toString(); int evid =
		 * Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
		 * EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
		 * realnameEx = realnameE.createCriteria();
		 * realnameEx.andCompaniesSubmitEqualTo(evid); EvidenceRealName
		 * erealname = sqlSession .selectOne(
		 * "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
		 * realnameE); EvidenceMainInformation mainInfo = sqlSession.selectOne(
		 * "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
		 * erealname.getMainInformation()); if
		 * (companiesSubmit.getRepresentative() != null) {// 法定代表人
		 * EvidenceRepresentative representative = sqlSession.selectOne(
		 * "com.itrus.portal.db.EvidenceRepresentativeMapper.selectByPrimaryKey",
		 * companiesSubmit.getRepresentative());
		 * uiModel.addAttribute("representative", representative); } if
		 * (companiesSubmit.getTheAgent() != null) {// 代理人 EvidenceTheAgent
		 * theagent = sqlSession.selectOne(
		 * "com.itrus.portal.db.EvidenceTheAgentMapper.selectByPrimaryKey",
		 * companiesSubmit.getTheAgent()); uiModel.addAttribute("theagent",
		 * theagent); } uiModel.addAttribute("erealname", erealname);
		 * uiModel.addAttribute("companiesSubmit", companiesSubmit);
		 * uiModel.addAttribute("mainInfo", mainInfo); return
		 * "basicinformation/companiesSubmit";
		 * 
		 * } else
		 */
    if (type == 3) {
        // 可信身份标识
        // EvidenceTrustedIdentity trusted = sqlSession
        // .selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
        // EvidenceMainInformation mainInfo = sqlSession.selectOne(
        // "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
        // trusted.getMainInformation());
        // uiModel.addAttribute("trusted", trusted);
        // uiModel.addAttribute("mainInfo", mainInfo);
        EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByPrimaryKey", id);
        String idCode = trusted.getMainInformation().split(";")[1];
        String idName = trusted.getMainInformation().split(";")[0];
        EvidenceMainInformationExample maininfor = new EvidenceMainInformationExample();
        EvidenceMainInformationExample.Criteria mation = maininfor.createCriteria();
        mation.andIdentificationEqualTo(idCode);
        mation.andSubjectNameEqualTo(idName);
        List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", maininfor);
        uiModel.addAttribute("trusted", trusted);
        /*EvidenceCertExample basicEx = new EvidenceCertExample();
			EvidenceCertExample.Criteria information = basicEx.createCriteria();
			information.andCertSerialnumberEqualTo(trusted.getCertSerialnumber().trim());
			EvidenceCert cert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample", basicEx);
			uiModel.addAttribute("cert", cert); 
			if(cert!=null && cert.getIssuerdn()!=null){
				
				uiModel.addAttribute("Issuerdn", EvidenceSaveServiceApi.getCertCn(cert.getIssuerdn()));
			}*/
        uiModel.addAttribute("mainInfo", mainInfo.get(0));
        return "basicinformation/trustedIdentity";
    } else if (type == 4) {
        // 事件内容
        EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
        // 得到基本信息
        /*EvidenceBasicInformation basicinfor = sqlSession
					.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", mevencontent.getBasicInformation());*/
        EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
        EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
        information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
        EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
        // 得到服务表信息
        AppService appservice = appService.selectById(basicinfor.getAppService());
        EvidenceSaveServiceExample save = new EvidenceSaveServiceExample();
        EvidenceSaveServiceExample.Criteria saveEx = save.createCriteria();
        saveEx.andAppServiceEqualTo(appservice.getId());
        EvidenceSaveService evidenceSave = sqlSession.selectOne("com.itrus.portal.db.EvidenceSaveServiceMapper.selectByExample", save);
        // String js = evidenceSave.getFactorBusinessInfo();
        String evidenceType = null;
        try {
            JSONArray jsonArray = new JSONArray(evidenceSave.getFactorBusinessInfo());
            for (int i = 0; i < jsonArray.length(); i++) {
                JSONObject jsob = JSONObject.parseObject(jsonArray.get(i).toString());
                if ("业务类型".equals(jsob.getString("b_factor"))) {
                    evidenceType = jsob.getString("b_category");
                }
            }
            if ("电子合同PDF".equals(evidenceType)) {
                // 判断图片是否存在
                if (mevencontent.getIsimg() == null) {
                    // EvidenceBasicInformation basic = sqlSession.selectOne(
                    // "com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey",
                    // mevencontent.getEvidenceSn());
                    // 得到证据附件表,用于获取信息
                    EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
                    EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
                    envlosureEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
                    envlosureEx.andPdfTypeEqualTo("1");
                    EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
                    RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
                    if (realNameAuthentication == null) {
                        try {
                            realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
                        } catch (Exception e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }
                    }
                    String pdfbase64 = null;
                    String urlAgent = realNameAuthentication.getRealNameddress();
                    if (envlosure != null && envlosure.getBuid() != null) {
                        log.error("Buid======" + envlosure.getBuid());
                        pdfbase64 = EvidenceSaveServiceApi.decryptedAndDownload(sqlSession, envlosure.getBuid(), urlAgent);
                    }
                    if (pdfbase64 != null) {
                        log.error("*******pdfbase64不为空*********");
                        // 得到证据包的json
                        JSONObject jsonEvidenceContent = JSONObject.parseObject(pdfbase64);
                        String authEvent = jsonEvidenceContent.getString("authEvent");
                        JSONObject authEvent1 = JSONObject.parseObject(authEvent);
                        String jsonpdf = authEvent1.getString("eventContent");
                        JSONObject jsonpdf1 = JSONObject.parseObject(jsonpdf);
                        // 得到pdf的base64编码
                        String jsonbase64 = jsonpdf1.getString("contCode");
                        BufferedInputStream bin = null;
                        FileOutputStream fout = null;
                        BufferedOutputStream bout = null;
                        try {
                            BASE64Decoder decoder = new sun.misc.BASE64Decoder();
                            // 将base64编码的字符串解码成字节数组
                            byte[] bytes = decoder.decodeBuffer(jsonbase64);
                            // apache公司的API
                            // byte[] bytes = Base64.decodeBase64(base64sString);
                            // 创建一个将bytes作为其缓冲区的ByteArrayInputStream对象
                            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                            // 创建从底层输入流中读取数据的缓冲输入流对象
                            bin = new BufferedInputStream(bais);
                            // 指定输出的文件
                            log.error("路径地址=" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
                            File file = new File(systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName() + File.separator + envlosure.getEvidenceSn() + ".pdf");
                            // 创建到指定文件的输出流
                            fout = new FileOutputStream(file);
                            // 为文件输出流对接缓冲输出流对象
                            bout = new BufferedOutputStream(fout);
                            byte[] buffers = new byte[1024];
                            int len = bin.read(buffers);
                            while (len != -1) {
                                bout.write(buffers, 0, len);
                                len = bin.read(buffers);
                            }
                            // 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
                            bout.flush();
                        } catch (IOException e) {
                            e.printStackTrace();
                        } finally {
                            try {
                                if (bin != null) {
                                    bin.close();
                                }
                                if (fout != null) {
                                    fout.close();
                                }
                                if (bout != null) {
                                    bout.close();
                                }
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                        // 判断是否为用户上传pdf
                        if (envlosure != null) {
                            String urlFile = systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
                            File filePathStr = new File(urlFile, envlosure.getEvidenceSn() + ".pdf");
                            log.error("***********filePathStr=" + filePathStr.getPath());
                            int pdfToPng = 0;
                            if (filePathStr != null && filePathStr.getPath() != null) {
                                try {
                                    pdfToPng = Pdf.pdf2png(filePathStr.getPath());
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                            log.error("是否生成,数量****pdfToPng=" + pdfToPng);
                            // 判断生成图片是否成功
                            if (pdfToPng > 0) {
                                // 修改内容表信息,表示生成图片
                                mevencontent.setIsimg(1);
                                mevencontent.setImgCount(pdfToPng);
                                sqlSession.update("com.itrus.portal.db.EvidenceEventContentMapper.updateByPrimaryKey", mevencontent);
                                String oper = "原文图片生成成功";
                                String info = "图片地址:" + urlFile;
                                LogUtil.evidencelog(sqlSession, null, oper, info);
                            } else {
                                String oper = "原文图片生成失败";
                                String info = "失败原因:" + systemConfigService.getpdfurl() + File.separator + envlosure.getBucketName();
                                LogUtil.evidencelog(sqlSession, null, oper, info);
                            }
                        }
                    }
                }
                uiModel.addAttribute("selectType", 1);
            } else if ("合同摘要数据".equals(evidenceType)) {
                uiModel.addAttribute("selectType", 2);
            } else if ("图片摘要数据".equals(evidenceType)) {
                uiModel.addAttribute("selectType", 3);
            } else if ("信息摘要数据".equals(evidenceType)) {
                uiModel.addAttribute("selectType", 4);
            }
        } catch (JSONException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        uiModel.addAttribute("mevencontent", mevencontent);
        return "basicinformation/evenconrent";
    } else if (type == 5) {
        // 事件详细
        EvidenceEventContent mevencontent = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventContentMapper.selectByPrimaryKey", id);
        // EvidenceBasicInformation basicInformation = basicInformationimpl.selectById(mevencontent.getEvidenceSn());
        EvidenceBasicInformationExample basicEx = new EvidenceBasicInformationExample();
        EvidenceBasicInformationExample.Criteria information = basicEx.createCriteria();
        information.andEvidenceSnEqualTo(mevencontent.getEvidenceSn());
        EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByExample", basicEx);
        EvidenceMainInformation mainInfo = new EvidenceMainInformation();
        // 事件对象
        EvidenceTrustedIdentityExample trustenid = new EvidenceTrustedIdentityExample();
        EvidenceTrustedIdentityExample.Criteria identitye = trustenid.createCriteria();
        // identitye.andBasicInformationEqualTo(mevencontent.getEvidenceSn());// 获取事件对象
        identitye.andEventContentEqualTo(mevencontent.getIdCode());
        // identitye.andMainInformationEqualTo(mid);
        EvidenceTrustedIdentity trusted = sqlSession.selectOne("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustenid);
        if (trusted != null) {
            String mainName = trusted.getMainInformation().split(";")[0];
            String mainIdentity = trusted.getMainInformation().split(";")[1];
            // 证据主体信息
            EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
            EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
            tionE.andIdentificationEqualTo(mainIdentity);
            if (mainName != null) {
                tionE.andSubjectNameEqualTo(mainName);
            }
            List<EvidenceMainInformation> ainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
            mainInfo = ainInfo.get(0);
        /*mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
						trusted.getMainInformation());*/
        }
        // 事件行为
        EvidenceEventBehaviorExample eventbehaciorEx = new EvidenceEventBehaviorExample();
        EvidenceEventBehaviorExample.Criteria eventbe = eventbehaciorEx.createCriteria();
        eventbe.andEventContentEqualTo(mevencontent.getIdCode());
        // eventbe.andMainInformationEqualTo(mid);
        List<EvidenceEventBehavior> elist = sqlSession.selectList("com.itrus.portal.db.EvidenceEventBehaviorMapper.selectByExample", eventbehaciorEx);
        // 事件时间
        EvidenceEventTimeExample eventime = new EvidenceEventTimeExample();
        EvidenceEventTimeExample.Criteria eventimeEx = eventime.createCriteria();
        eventimeEx.andEventContentEqualTo(mevencontent.getIdCode());
        // eventimeEx.andMainInformationEqualTo(mid);
        List<EvidenceEventTime> meventime = sqlSession.selectList("com.itrus.portal.db.EvidenceEventTimeMapper.selectByExample", eventime);
        // 事件意愿
        EvidenceEventDesireExample desireEx = new EvidenceEventDesireExample();
        EvidenceEventDesireExample.Criteria eventdesire = desireEx.createCriteria();
        eventdesire.andEventContenteEqualTo(mevencontent.getIdCode());
        // eventdesire.andMainInformationEqualTo(mid);
        EvidenceEventDesire meventdesire = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventDesireMapper.selectByExample", desireEx);
        // 事件网络地址
        EvidenceEventNetworkAddressExample network = new EvidenceEventNetworkAddressExample();
        EvidenceEventNetworkAddressExample.Criteria address = network.createCriteria();
        address.andEventContentEqualTo(mevencontent.getIdCode());
        // address.andMainInformationEqualTo(mid);
        EvidenceEventNetworkAddress networkaddress = sqlSession.selectOne("com.itrus.portal.db.EvidenceEventNetworkAddressMapper.selectByExample", network);
        uiModel.addAttribute("mevencontent", mevencontent);
        uiModel.addAttribute("meventdesire", meventdesire);
        uiModel.addAttribute("networkaddress", networkaddress);
        uiModel.addAttribute("basicInformation", basicInformation);
        uiModel.addAttribute("trusted", trusted);
        uiModel.addAttribute("mainInfo", mainInfo);
        uiModel.addAttribute("elist", elist);
        uiModel.addAttribute("meventime", meventime);
        return "basicinformation/certificationdetails";
    } else if (type == 6) {
        // 服务委托人签名信息
        EvidenceClientSignature cliensig = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByPrimaryKey", id);
        EvidenceEnclosureExample enclo = new EvidenceEnclosureExample();
        EvidenceEnclosureExample.Criteria enclosureEx = enclo.createCriteria();
        enclosureEx.andEvidenceSnEqualTo(cliensig.getEvidenceSn());
        enclosureEx.andPdfTypeEqualTo("1");
        EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclo);
        // 天威签名信息
        EvidenceClientSignatureExample cilentsign = new EvidenceClientSignatureExample();
        EvidenceClientSignatureExample.Criteria signature = cilentsign.createCriteria();
        signature.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        signature.andNameEqualTo("1");
        EvidenceClientSignature cilentsignature = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilentsign);
        EvidenceCert oneCert = new EvidenceCert();
        EvidenceCheck oneCheck = new EvidenceCheck();
        if (cilentsignature != null) {
            // 天威证书信息
            /*EvidenceCertExample certE = new EvidenceCertExample();
				EvidenceCertExample.Criteria evidenceCertE = certE.createCriteria();
				evidenceCertE.andClientSignatureEqualTo(cilentsignature.getId());
				oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByExample",certE);*/
            oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cilentsignature.getCertId());
            // 天威核验信息
            EvidenceCheckExample checkE = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheckE = checkE.createCriteria();
            evidenceCheckE.andClientSignatureEqualTo(cilentsignature.getId());
            oneCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkE);
        }
        // 服务委托人时间戳信息
        EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
        EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
        stamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        stamp.andNameEqualTo("0");
        EvidenceClientTimeStamp clientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", clientTime);
        // 天威时间戳信息
        EvidenceClientTimeStampExample tclientTime = new EvidenceClientTimeStampExample();
        EvidenceClientTimeStampExample.Criteria tstamp = tclientTime.createCriteria();
        tstamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        tstamp.andNameEqualTo("1");
        EvidenceClientTimeStamp tclientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", tclientTime);
        // 服务委托人证书信息
        /*EvidenceCertExample certEx = new EvidenceCertExample();
			EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
			evidenceCert.andClientSignatureEqualTo(cliensig.getId());
			List<EvidenceCert> listCert = sqlSession
					.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByExample", certEx);*/
        List<EvidenceCert> listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cliensig.getCertId());
        // 服务委托人核验信息
        EvidenceCheckExample checkEx = new EvidenceCheckExample();
        EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
        evidenceCheck.andClientSignatureEqualTo(cliensig.getId());
        EvidenceCheck listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
        Map<Long, EvidenceCheck> mapCheck = new HashMap<Long, EvidenceCheck>();
        // 服务委托人证书核验信息
        for (EvidenceCert c : listCert) {
            EvidenceCheckExample certcheckEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria certCheck = certcheckEx.createCriteria();
            certCheck.andEvidenceCertEqualTo(c.getId());
            EvidenceCheck listCertCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", certcheckEx);
            mapCheck.put(c.getId(), listCertCheck);
        }
        // 服务委托人证书信息
        uiModel.addAttribute("listCert", listCert);
        // 服务委托人核验信息
        uiModel.addAttribute("listCheck", listCheck);
        // 天威证书信息
        uiModel.addAttribute("oneCert", oneCert);
        // 天威核验信息
        uiModel.addAttribute("oneCheck", oneCheck);
        // 服务委托人证书核验信息
        uiModel.addAttribute("mapCheck", mapCheck);
        // 服务委托人签名信息
        uiModel.addAttribute("cliensig", cliensig);
        // 天威签名信息
        uiModel.addAttribute("cilentsignature", cilentsignature);
        // 服务委托人时间戳信息
        uiModel.addAttribute("clientTimestamp", clientTimestamp);
        // 天威时间戳信息
        uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
        return "basicinformation/evidenceexists";
    }
    /*
			 * else if (type == 7) { EvidenceIndividual indiv = sqlSession
			 * .selectOne(
			 * "com.itrus.portal.db.EvidenceIndividualMapper.selectByPrimaryKey",
			 * id); String cid = indiv.getId().toString(); int evid =
			 * Integer.parseInt(cid); EvidenceRealNameExample realnameE = new
			 * EvidenceRealNameExample(); EvidenceRealNameExample.Criteria
			 * realnameEx = realnameE.createCriteria();
			 * realnameEx.andIndividualEqualTo(evid); EvidenceRealName erealname
			 * = sqlSession .selectOne(
			 * "com.itrus.portal.db.EvidenceRealNameMapper.selectByExample",
			 * realnameE); EvidenceMainInformation mainInfo =
			 * sqlSession.selectOne(
			 * "com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
			 * erealname.getMainInformation()); uiModel.addAttribute("indiv",
			 * indiv); uiModel.addAttribute("mainInfo", mainInfo); return
			 * "basicinformation/ineividual"; }
			 */
    return null;
}
Also used : EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) EvidenceClientTimeStampExample(com.itrus.portal.db.EvidenceClientTimeStampExample) BufferedInputStream(java.io.BufferedInputStream) BASE64Decoder(sun.misc.BASE64Decoder) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceEventDesire(com.itrus.portal.db.EvidenceEventDesire) EvidenceEventNetworkAddressExample(com.itrus.portal.db.EvidenceEventNetworkAddressExample) EvidenceEventBehaviorExample(com.itrus.portal.db.EvidenceEventBehaviorExample) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceCheckExample(com.itrus.portal.db.EvidenceCheckExample) EvidenceSaveServiceExample(com.itrus.portal.db.EvidenceSaveServiceExample) EvidenceCert(com.itrus.portal.db.EvidenceCert) JSONObject(com.alibaba.fastjson.JSONObject) ByteArrayInputStream(java.io.ByteArrayInputStream) FileOutputStream(java.io.FileOutputStream) EvidenceEventTime(com.itrus.portal.db.EvidenceEventTime) File(java.io.File) EvidenceEventNetworkAddress(com.itrus.portal.db.EvidenceEventNetworkAddress) Map(java.util.Map) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceSaveService(com.itrus.portal.db.EvidenceSaveService) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceEventDesireExample(com.itrus.portal.db.EvidenceEventDesireExample) EvidenceEventTimeExample(com.itrus.portal.db.EvidenceEventTimeExample) BufferedOutputStream(java.io.BufferedOutputStream) BASE64Decoder(sun.misc.BASE64Decoder) EvidenceEventContent(com.itrus.portal.db.EvidenceEventContent) EvidenceClientSignature(com.itrus.portal.db.EvidenceClientSignature) AppService(com.itrus.portal.db.AppService) EvidenceCheck(com.itrus.portal.db.EvidenceCheck) JSONArray(org.json.JSONArray) JSONException(org.json.JSONException) IOException(java.io.IOException) EvidenceClientSignatureExample(com.itrus.portal.db.EvidenceClientSignatureExample) JSONException(org.json.JSONException) IOException(java.io.IOException) EvidenceBasicInformationExample(com.itrus.portal.db.EvidenceBasicInformationExample) EvidenceEventBehavior(com.itrus.portal.db.EvidenceEventBehavior) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) EvidenceTrustedIdentityExample(com.itrus.portal.db.EvidenceTrustedIdentityExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

EvidenceClientTimeStamp (com.itrus.portal.db.EvidenceClientTimeStamp)7 HashMap (java.util.HashMap)6 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)5 EvidenceClientSignature (com.itrus.portal.db.EvidenceClientSignature)5 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)5 EvidenceMainInformation (com.itrus.portal.db.EvidenceMainInformation)5 ArrayList (java.util.ArrayList)5 EvidenceCert (com.itrus.portal.db.EvidenceCert)4 EvidenceCheck (com.itrus.portal.db.EvidenceCheck)4 EvidenceCheckExample (com.itrus.portal.db.EvidenceCheckExample)4 EvidenceCompaniesSubmit (com.itrus.portal.db.EvidenceCompaniesSubmit)4 EvidenceDesireIdentify (com.itrus.portal.db.EvidenceDesireIdentify)4 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)4 EvidenceEventBehavior (com.itrus.portal.db.EvidenceEventBehavior)4 EvidenceEventContent (com.itrus.portal.db.EvidenceEventContent)4 EvidenceEventDesire (com.itrus.portal.db.EvidenceEventDesire)4 EvidenceEventNetworkAddress (com.itrus.portal.db.EvidenceEventNetworkAddress)4 EvidenceEventTime (com.itrus.portal.db.EvidenceEventTime)4 EvidenceIndividual (com.itrus.portal.db.EvidenceIndividual)4 EvidenceMainInformationExample (com.itrus.portal.db.EvidenceMainInformationExample)4