Search in sources :

Example 16 with EvidenceEnclosure

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

the class HisCertificateController method preview.

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

Example 17 with EvidenceEnclosure

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

the class HisCertificateController method show.

/**
 * 查看详情
 *
 * @param id
 * @param type
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/{id}/{type}", produces = "text/html")
public String show(@PathVariable("id") Long id, @PathVariable("type") int type, Model uiModel) {
    EvidenceHisCertificate hisCertificate = hiscertificate.selectById(id);
    // 出征流水号
    contractNumber = hisCertificate.getSerialnumber();
    // 得到服务编码
    AppService appservice = appService.selectById(hisCertificate.getHisAppService());
    // 得到出证服务配置
    EvidenceOutServiceConfigExample saveService = new EvidenceOutServiceConfigExample();
    EvidenceOutServiceConfigExample.Criteria saveServiceEx = saveService.createCriteria();
    saveServiceEx.andAppServiceEqualTo(appservice.getId());
    EvidenceOutServiceConfig outService = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutServiceConfigMapper.selectByExample", saveService);
    // 得到出证模板信息
    EvidenceOutTemplate outtemp = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByPrimaryKey", outService.getSaveRetTemplate());
    uiModel.addAttribute("hisCertificate", hisCertificate);
    uiModel.addAttribute("outtemp", outtemp);
    // 获取证据附件表
    EvidenceEnclosureExample envlosureE = new EvidenceEnclosureExample();
    EvidenceEnclosureExample.Criteria envlosureEx = envlosureE.createCriteria();
    envlosureEx.andSerialnumberEqualTo(hisCertificate.getSerialnumber());
    envlosureEx.andPdfTypeEqualTo("4");
    EvidenceEnclosure envlosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", envlosureE);
    uiModel.addAttribute("envlosure", envlosure);
    Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
    // Map<Long, List<EvidenceBasicInformation>> mbasi = new HashMap<Long,
    // List<EvidenceBasicInformation>>();
    List<EvidenceBasicInformation> blists = new ArrayList<EvidenceBasicInformation>();
    // 得到出证关联表信息
    EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
    hisreation.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
    for (int j = 0; j < hisRelation.size(); j++) {
        List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
        // 得到证据基本信息
        EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
        blists.add(basic);
        // 得到证据身份主题关联信息
        EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
        EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
        identity.andBasicInformationEqualTo(basic.getEvidenceSn());
        List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
        for (int g = 0; g < subjectIdentity.size(); g++) {
            // 得到主题身份信息
            EvidenceMainInformation mainInfo = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey", subjectIdentity.get(g).getMainInformation());
            mlist.add(mainInfo);
        }
        minfo.put(basic.getId(), mlist);
    }
    uiModel.addAttribute("mainInfo", minfo);
    uiModel.addAttribute("blists", blists);
    if (type == 1) {
        // 待出证
        return "hiscertificate/show";
    } else if (type == 2) {
        // 已出证
        return "hiscertificate/show1";
    }
    return null;
}
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 18 with EvidenceEnclosure

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

the class HisCertificateController method savepdf.

@RequestMapping(params = "uploadPDF", method = RequestMethod.POST, produces = "text/html")
public String savepdf(MultipartFile excelFile, int id, int type, HttpServletRequest request, Model uiModel) throws Exception {
    JSONObject ret_data = null;
    BufferedInputStream bin = null;
    ByteArrayOutputStream baos = null;
    BufferedOutputStream bout = null;
    String fileName = excelFile.getOriginalFilename();
    // 文件类型
    String fileType = FilenameUtils.getExtension(fileName);
    if ((!fileType.toLowerCase().equals("pdf"))) {
        error = "上传失败,上传的文件不是以‘.pdf’文件名结尾";
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    }
    // 得到出征信息
    EvidenceHisCertificateExample hiscer = new EvidenceHisCertificateExample();
    EvidenceHisCertificateExample.Criteria tificate = hiscer.createCriteria();
    tificate.andSerialnumberEqualTo(contractNumber);
    EvidenceHisCertificate hisCertificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hiscer);
    // 得到出证关系表
    EvidenceHisRelationshipExample hisrelation = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria shipEx = hisrelation.createCriteria();
    shipEx.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisrelationship = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisrelation);
    try {
        // 建立读取文件的文件输出流
        // fin = new FileInputStream(excelFile.getName());
        // 在文件输出流上安装节点流(更大效率读取)
        // 读取文件流
        bin = new BufferedInputStream(excelFile.getInputStream());
        // 创建一个新的 byte 数组输出流,它具有指定大小的缓冲区容量
        baos = new ByteArrayOutputStream();
        // 创建一个新的缓冲输出流,以将数据写入指定的底层输出流
        bout = new BufferedOutputStream(baos);
        byte[] buffer = new byte[1024];
        int len = bin.read(buffer);
        while (len != -1) {
            bout.write(buffer, 0, len);
            len = bin.read(buffer);
        }
        // 刷新此输出流并强制写出所有缓冲的输出字节,必须这行代码,否则有可能有问题
        bout.flush();
        byte[] bytes = baos.toByteArray();
        // sun公司的API
        // return encoder.encodeBuffer(bytes).trim();
        // apache公司的API
        String base64 = Base64.encodeBase64String(bytes);
        RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
        if (realNameAuthentication == null) {
            realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
        }
        if (realNameAuthentication == null) {
            error = "无服务路径";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到服务编码
        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);
        // 得到出证名称
        if (outService == null) {
            error = "无服务配置";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到证书信息
        EvidenceCertificate certificate = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertificateMapper.selectByPrimaryKey", outService.getEvidenceCertificate());
        if (certificate == null) {
            error = "无证书信息";
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
        // 得到密钥信息
        EvidenceSecretKey secrerkey = sqlSession.selectOne("com.itrus.portal.db.EvidenceSecretKeyMapper.selectByPrimaryKey", certificate.getEvidenceSecretKey());
        EvidenceEnclosure enclosure = new EvidenceEnclosure();
        // 得到签章位置配置信息
        EvidenceSignetPlaceConfigExample signet = new EvidenceSignetPlaceConfigExample();
        EvidenceSignetPlaceConfigExample.Criteria palace = signet.createCriteria();
        palace.andEvidenceOutServiceConfigEqualTo(outService.getId());
        List<EvidenceSignetPlaceConfig> configlist = sqlSession.selectList("com.itrus.portal.db.EvidenceSignetPlaceConfigMapper.selectByExample", signet);
        // 得到接口路径
        String urlAgent = realNameAuthentication.getRealNameddress() + PDF_SIGN;
        Map<String, Object> paramsAgent = new HashMap<String, Object>();
        // 参数信息
        paramsAgent.put("alias", secrerkey.getAlias());
        paramsAgent.put("pdfContent", base64);
        for (EvidenceSignetPlaceConfig config : configlist) {
            // 获取签章信息
            List<Map> list = new ArrayList<Map>();
            Map<String, String> map = new HashMap<String, String>();
            if (config != null) {
                if (config.getType() == 2) {
                    // 参数信息
                    map.put("y", config.getDistanceToDown());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("pagingSeal", JSON.toJSONString(list));
                } else if (config.getType() == 3) {
                    // 参数信息
                    map.put("page", config.getPage());
                    // 参数信息
                    map.put("x", config.getDistanceToLeft());
                    // 参数信息
                    map.put("y", config.getDistanceToDown());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("multiPagesSeal", JSON.toJSONString(list));
                } else if (config.getType() == 1) {
                    // 参数信息
                    map.put("keyWord", config.getKeyword());
                    // 参数信息
                    map.put("page", config.getPage());
                    // 参数信息
                    map.put("width", config.getWidthOfImage());
                    // 参数信息
                    map.put("height", config.getHeightOfImage());
                    list.add(map);
                    paramsAgent.put("keyWordSeal", JSON.toJSONString(list));
                }
            }
        }
        boolean isbool = true;
        String signedPdf = null;
        if (outService.getIsAddTimestamp() == 2) {
            isbool = false;
        }
        // 参数信息
        paramsAgent.put("timeStamp", isbool);
        // paramsAgent.put("resultType",2L);//参数信息
        // 调用签章接口返回数据
        String repAgent = HttpClientUtil.postForm(urlAgent, AuthService.getHeader(), paramsAgent);
        // 把数据转换为json格式
        ret_data = JSONObject.parseObject(repAgent);
        if (ret_data.getIntValue("code") != 0) {
            // 判断是否成功
            String oper = "出证报告失败-pdf签章失败";
            String info = "错误原因:" + ret_data.getString("message");
            LogUtil.evidencelog(sqlSession, null, oper, info);
            error = ret_data.getString("message");
            // 修改证据中的出证状态
            for (EvidenceHisRelationship h : hisrelationship) {
                // 得到基本信息表
                EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
                basic.setStatus(4);
                sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
            }
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        } else {
            // 证书base编码
            signedPdf = ret_data.getString("signedPdf");
            // 正式系统将hood替换为/**/重的值
            String retpdf = EvidenceSaveServiceApi.storageSave("ST_O", "hood", /*realNameAuthentication.getKeyCode()*/
            hisCertificate.getSerialnumber() + ".pdf", "CT_MESSAGE", signedPdf, null, null, null, null, null, false, null, realNameAuthentication.getRealNameddress());
            // 把数据转换为json格式
            ret_data = JSONObject.parseObject(retpdf);
            if (ret_data.getInteger("code") == 0) {
                // 获取证据附件表
                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);
                if (envlosure != null && envlosure.getPdfType() != null) {
                    envlosure.setPdfType("4");
                    envlosure.setEvidenceSn(null);
                    envlosure.setSerialnumber(hisCertificate.getSerialnumber());
                    envlosure.setType("ST_E");
                    envlosure.setContentType("CT_BASE64_DATA");
                    envlosure.setBucketName(realNameAuthentication.getKeyCode());
                    envlosure.setObjectName(fileName);
                    envlosure.setAlias(secrerkey.getAlias());
                    envlosure.setFilesize(null);
                    envlosure.setApplicationTime(new Date());
                    envlosure.setFixationTime(new Date());
                    envlosure.setSaveFactor(null);
                    envlosure.setBuid(ret_data.getString("buid").toString());
                    // ret_data.remove("saveFactor");
                    sqlSession.update("com.itrus.portal.db.EvidenceEnclosureMapper.updateByPrimaryKey", envlosure);
                } else {
                    enclosure.setPdfType("4");
                    enclosure.setEvidenceSn(null);
                    enclosure.setSerialnumber(hisCertificate.getSerialnumber());
                    enclosure.setType("ST_E");
                    enclosure.setContentType("CT_BASE64_DATA");
                    enclosure.setBucketName(realNameAuthentication.getKeyCode());
                    enclosure.setObjectName(fileName);
                    enclosure.setAlias(secrerkey.getAlias());
                    enclosure.setFilesize(null);
                    enclosure.setApplicationTime(new Date());
                    enclosure.setFixationTime(new Date());
                    enclosure.setSaveFactor(null);
                    enclosure.setBuid(ret_data.getString("buid").toString());
                    // ret_data.remove("saveFactor");
                    sqlSession.insert("com.itrus.portal.db.EvidenceEnclosureMapper.insert", enclosure);
                }
                hisCertificate.setHisTime(new Date());
                hisCertificate.setHisway("2");
                hisCertificate.setHisState("0");
                hisCertificate.setOutState(0);
                sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
                // 修改证据中的出证状态
                for (EvidenceHisRelationship h : hisrelationship) {
                    // 得到基本信息表
                    EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
                    basic.setStatus(2);
                    sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
                }
                error = "上传pdf成功";
                String oper = "pdf上传成功";
                String info = "存储编号:" + ret_data.getString("buid").toString() + "pdf名称:" + hisCertificate.getSerialnumber();
                LogUtil.evidencelog(sqlSession, null, oper, info);
            }
        }
    } catch (FileNotFoundException e) {
        // 修改证据中的出证状态
        for (EvidenceHisRelationship h : hisrelationship) {
            // 得到基本信息表
            EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
            basic.setStatus(4);
            sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
        }
        e.printStackTrace();
        String oper = "pdf上传失败";
        String info = "失败原因:" + e.getMessage();
        LogUtil.evidencelog(sqlSession, null, oper, info);
        error = e.getMessage();
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    } catch (IOException e) {
        // 修改证据中的出证状态
        for (EvidenceHisRelationship h : hisrelationship) {
            // 得到基本信息表
            EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", h.getBasicInformation());
            basic.setStatus(4);
            sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basic);
        }
        e.printStackTrace();
        String oper = "pdf上传失败";
        String info = "失败原因:" + e.getMessage();
        LogUtil.evidencelog(sqlSession, null, oper, info);
        error = e.getMessage();
        return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
    } finally {
        try {
            bin.close();
            // 关闭 ByteArrayOutputStream 无效。此类中的方法在关闭此流后仍可被调用,而不会产生任何
            // IOException
            // 暂时关闭掉
            baos.close();
            bout.close();
        } catch (IOException e) {
            e.printStackTrace();
            error = e.getMessage();
            return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
        }
    }
    return "redirect:/hiscertificate/showpdf/" + id + "/" + type;
}
Also used : HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) EvidenceSignetPlaceConfigExample(com.itrus.portal.db.EvidenceSignetPlaceConfigExample) BufferedInputStream(java.io.BufferedInputStream) EvidenceCertificate(com.itrus.portal.db.EvidenceCertificate) BufferedOutputStream(java.io.BufferedOutputStream) AppService(com.itrus.portal.db.AppService) EvidenceOutServiceConfigExample(com.itrus.portal.db.EvidenceOutServiceConfigExample) EvidenceSignetPlaceConfig(com.itrus.portal.db.EvidenceSignetPlaceConfig) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) EvidenceSecretKey(com.itrus.portal.db.EvidenceSecretKey) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) Date(java.util.Date) JSONObject(com.alibaba.fastjson.JSONObject) EvidenceHisCertificateExample(com.itrus.portal.db.EvidenceHisCertificateExample) JSONObject(com.alibaba.fastjson.JSONObject) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with EvidenceEnclosure

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

Example 20 with EvidenceEnclosure

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

the class BasicInformationController method show1.

/**
 * 身份认证详情
 *
 * @param id
 * @param uiModel
 * @return
 */
@RequestMapping(value = "/identity/{id}", produces = "text/html")
public String show1(@PathVariable("id") Long id, Model uiModel) {
    // 得到证据详情
    EvidenceBasicInformation basicinfor = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", id);
    List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
    // 得到主体身份信息
    EvidenceSubjectIdentityExample subjectExample = new EvidenceSubjectIdentityExample();
    EvidenceSubjectIdentityExample.Criteria identity = subjectExample.createCriteria();
    identity.andBasicInformationEqualTo(basicinfor.getEvidenceSn());
    List<EvidenceSubjectIdentity> subjectIdentity = sqlSession.selectList("com.itrus.portal.db.EvidenceSubjectIdentityMapper.selectByExample", subjectExample);
    for (int i = 0; i < subjectIdentity.size(); i++) {
        // 得到主体信息
        /*List<EvidenceMainInformation> mainInfo = sqlSession.selectList(
					"com.itrus.portal.db.EvidenceMainInformationMapper.selectByPrimaryKey",
					subjectIdentity.get(i).getMainInformation());*/
        EvidenceMainInformationExample infomationE = new EvidenceMainInformationExample();
        EvidenceMainInformationExample.Criteria tionE = infomationE.createCriteria();
        tionE.andIdentificationEqualTo(subjectIdentity.get(i).getMainInformation());
        // infomationE.isDistinct();
        if (subjectIdentity.get(i).getMainName() != null) {
            tionE.andSubjectNameEqualTo(subjectIdentity.get(i).getMainName());
        }
        List<EvidenceMainInformation> mainInfo = sqlSession.selectList("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", infomationE);
        if (mainInfo.size() != 0) {
            mlist.add(mainInfo.get(0));
        }
    // mlist.add(mainInfo);
    }
    // 得到身份意愿鉴别
    EvidenceDesireIdentifyExample desireid = new EvidenceDesireIdentifyExample();
    EvidenceDesireIdentifyExample.Criteria desireidentitfy = desireid.createCriteria();
    desireidentitfy.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    EvidenceDesireIdentify desire = sqlSession.selectOne("com.itrus.portal.db.EvidenceDesireIdentifyMapper.selectByExample", desireid);
    // 得到证据附件信息,用于查询服务委托人等信息
    EvidenceEnclosureExample enclou = new EvidenceEnclosureExample();
    EvidenceEnclosureExample.Criteria sure = enclou.createCriteria();
    // sure.andBasicInformationEqualTo(id);
    sure.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    sure.andPdfTypeEqualTo("1");
    EvidenceEnclosure enclosure = sqlSession.selectOne("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclou);
    if (enclosure != null) {
        // 服务委托人签名信息
        EvidenceClientSignatureExample client = new EvidenceClientSignatureExample();
        EvidenceClientSignatureExample.Criteria signat = client.createCriteria();
        signat.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        signat.andNameEqualTo("0");
        EvidenceClientSignature cliensig = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", client);
        // 天威签名信息
        EvidenceClientSignatureExample cilentsign = new EvidenceClientSignatureExample();
        EvidenceClientSignatureExample.Criteria signature = cilentsign.createCriteria();
        signature.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        signature.andNameEqualTo("1");
        EvidenceClientSignature cilentsignature = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientSignatureMapper.selectByExample", cilentsign);
        if (cilentsignature != null) {
            // 天威证书信息
            /*EvidenceCertExample certE = new EvidenceCertExample();
				EvidenceCertExample.Criteria evidenceCertE = certE.createCriteria();
				evidenceCertE.andClientSignatureEqualTo(cilentsignature.getId());*/
            EvidenceCert oneCert = sqlSession.selectOne("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cilentsignature.getCertId());
            // 天威核验信息
            EvidenceCheckExample checkE = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheckE = checkE.createCriteria();
            evidenceCheckE.andClientSignatureEqualTo(cilentsignature.getId());
            EvidenceCheck oneCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkE);
            // 天威证书信息
            uiModel.addAttribute("oneCert", oneCert);
            // 天威核验信息
            uiModel.addAttribute("oneCheck", oneCheck);
        }
        // 服务委托人时间戳信息
        EvidenceClientTimeStampExample clientTime = new EvidenceClientTimeStampExample();
        EvidenceClientTimeStampExample.Criteria stamp = clientTime.createCriteria();
        stamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        stamp.andNameEqualTo("0");
        EvidenceClientTimeStamp clientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", clientTime);
        // 天威时间戳信息
        EvidenceClientTimeStampExample tclientTime = new EvidenceClientTimeStampExample();
        EvidenceClientTimeStampExample.Criteria tstamp = tclientTime.createCriteria();
        tstamp.andEvidenceSnEqualTo(enclosure.getEvidenceSn());
        tstamp.andNameEqualTo("1");
        EvidenceClientTimeStamp tclientTimestamp = sqlSession.selectOne("com.itrus.portal.db.EvidenceClientTimeStampMapper.selectByExample", tclientTime);
        EvidenceCheck listCheck = new EvidenceCheck();
        List<EvidenceCert> listCert = new ArrayList<EvidenceCert>();
        if (cliensig != null && cliensig.getId() != null) {
            // 服务委托人证书信息
            /*EvidenceCertExample certEx = new EvidenceCertExample();
				EvidenceCertExample.Criteria evidenceCert = certEx.createCriteria();
				evidenceCert.andClientSignatureEqualTo(cliensig.getId());*/
            listCert = sqlSession.selectList("com.itrus.portal.db.EvidenceCertMapper.selectByPrimaryKey", cliensig.getCertId());
            // 服务委托人核验信息
            EvidenceCheckExample checkEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria evidenceCheck = checkEx.createCriteria();
            evidenceCheck.andClientSignatureEqualTo(cliensig.getId());
            listCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", checkEx);
        }
        Map<Long, EvidenceCheck> mapCheck = new HashMap<Long, EvidenceCheck>();
        // 服务委托人证书核验信息
        for (EvidenceCert c : listCert) {
            EvidenceCheckExample certcheckEx = new EvidenceCheckExample();
            EvidenceCheckExample.Criteria certCheck = certcheckEx.createCriteria();
            certCheck.andEvidenceCertEqualTo(c.getId());
            EvidenceCheck listCertCheck = sqlSession.selectOne("com.itrus.portal.db.EvidenceCheckMapper.selectByExample", certcheckEx);
            mapCheck.put(c.getId(), listCertCheck);
        }
        // 服务委托人证书信息
        uiModel.addAttribute("listCert", listCert);
        // 服务委托人核验信息
        uiModel.addAttribute("listCheck", listCheck);
        // 服务委托人证书核验信息
        uiModel.addAttribute("mapCheck", mapCheck);
        // 服务委托人签名信息
        uiModel.addAttribute("cliensig", cliensig);
        // 天威签名信息
        uiModel.addAttribute("cilentsignature", cilentsignature);
        // 服务委托人时间戳信息
        uiModel.addAttribute("clientTimestamp", clientTimestamp);
        // 天威时间戳信息
        uiModel.addAttribute("tclientTimestamp", tclientTimestamp);
    }
    // 身份实名认证信息
    EvidenceRealNameExample realnameE = new EvidenceRealNameExample();
    EvidenceRealNameExample.Criteria realnameEx = realnameE.createCriteria();
    // realnameEx.andMainInformationEqualTo(m.getId());
    // realnameEx.andBasicInformationEqualTo(id);
    realnameEx.andEvidenceSnEqualTo(basicinfor.getEvidenceSn());
    EvidenceRealName erealname = sqlSession.selectOne("com.itrus.portal.db.EvidenceRealNameMapper.selectByExample", realnameE);
    Map<Long, AppService> rappService = new HashMap<Long, AppService>();
    if (erealname != null) {
        uiModel.addAttribute("erealname", erealname);
        if ("2".equals(erealname.getEventVerifierType()) || "3".equals(erealname.getEventVerifierType())) {
            // 判断平台
            if ("1".equals(erealname.getType())) {
                EvidenceCompaniesSubmitExample evidenceCompanies = new EvidenceCompaniesSubmitExample();
                EvidenceCompaniesSubmitExample.Criteria submit = evidenceCompanies.createCriteria();
                submit.andIdCodeEqualTo(erealname.getCompaniesSubmit());
                EvidenceCompaniesSubmit companiesSubmit = sqlSession.selectOne("com.itrus.portal.db.EvidenceCompaniesSubmitMapper.selectByExample", evidenceCompanies);
                if (companiesSubmit != null && companiesSubmit.getRepresentative() != null) {
                    // 法定代表人
                    EvidenceRepresentativeExample representaioce = new EvidenceRepresentativeExample();
                    EvidenceRepresentativeExample.Criteria evidenceRepresent = representaioce.createCriteria();
                    evidenceRepresent.andIdCodeEqualTo(companiesSubmit.getRepresentative());
                    EvidenceRepresentative representative = sqlSession.selectOne("com.itrus.portal.db.EvidenceRepresentativeMapper.selectByExample", representaioce);
                    uiModel.addAttribute("representative", representative);
                }
                if (companiesSubmit != null && companiesSubmit.getTheAgent() != null) {
                    // 代理人
                    EvidenceTheAgentExample evidenceTheAgent = new EvidenceTheAgentExample();
                    EvidenceTheAgentExample.Criteria theAgentEx = evidenceTheAgent.createCriteria();
                    theAgentEx.andIdCodeEqualTo(companiesSubmit.getTheAgent());
                    EvidenceTheAgent theagent = sqlSession.selectOne("com.itrus.portal.db.EvidenceTheAgentMapper.selectByExample", evidenceTheAgent);
                    uiModel.addAttribute("theagent", theagent);
                }
                uiModel.addAttribute("companiesSubmit", companiesSubmit);
            } else {
                // 天威
                EvidenceIndividualExample evidenceIndividual = new EvidenceIndividualExample();
                EvidenceIndividualExample.Criteria individual = evidenceIndividual.createCriteria();
                individual.andIdCodeEqualTo(erealname.getIndividual());
                EvidenceIndividual indiv = sqlSession.selectOne("com.itrus.portal.db.EvidenceIndividualMapper.selectByExample", evidenceIndividual);
                uiModel.addAttribute("indiv", indiv);
            }
        } else if ("1".equals(erealname.getEventVerifierType())) {
            // 天威
            if ("1".equals(erealname.getType())) {
                // 获取流水号
                String serialnamber = erealname.getSerialnumber();
                // 将多个流水号以逗号分隔成一个数组
                String[] namber = serialnamber.split(",");
                // 声明一个list存储流水号
                List<String> listString = new ArrayList<String>();
                for (int i = 0; i < namber.length; i++) {
                    // 将数组中的流水号放入list中
                    listString.add(namber[i]);
                }
                // 查询实名认证信息
                RealNameRecordExample realname = new RealNameRecordExample();
                RealNameRecordExample.Criteria recor = realname.createCriteria();
                recor.andSerialnumberIn(listString);
                realname.setOrderByClause("returntime");
                listReal = sqlSession.selectList("com.itrus.portal.db.RealNameRecordMapper.selectByExample", realname);
                for (RealNameRecord real : listReal) {
                    AppServiceAuthentication authent = sqlSession.selectOne("com.itrus.portal.db.AppServiceAuthenticationMapper.selectByPrimaryKey", real.getAppServiceAuthentication());
                    // 得到服务编码
                    AppService appservice = appService.selectById(authent.getAppService());
                    rappService.put(real.getId(), appservice);
                }
            // realnameRecor.put(m.getId(), listReal);
            } else {
                String serialnamber = erealname.getSerialnumber();
                String[] namber = serialnamber.split(",");
                List<String> listString = new ArrayList<String>();
                for (int i = 0; i < namber.length; i++) {
                    listString.add(namber[i]);
                // listReal.add(realnameRecor1);
                }
                PersonalNameExample personal = new PersonalNameExample();
                PersonalNameExample.Criteria personalname = personal.createCriteria();
                personalname.andSerialnumberIn(listString);
                personal.setOrderByClause("returntime");
                listPersonal = sqlSession.selectList("com.itrus.portal.db.PersonalNameMapper.selectByExample", personal);
                uiModel.addAttribute("listPersonal", listPersonal);
            // personalName.put(m.getId(), listPersonal);
            }
        }
    }
    uiModel.addAttribute("enclosure", enclosure);
    uiModel.addAttribute("rappService", rappService);
    uiModel.addAttribute("listReal", listReal);
    uiModel.addAttribute("desire", desire);
    uiModel.addAttribute("mainInfo", mlist);
    uiModel.addAttribute("basicinfor", basicinfor);
    return "basicinformation/show1";
}
Also used : EvidenceIndividual(com.itrus.portal.db.EvidenceIndividual) EvidenceSubjectIdentityExample(com.itrus.portal.db.EvidenceSubjectIdentityExample) HashMap(java.util.HashMap) EvidenceClientTimeStamp(com.itrus.portal.db.EvidenceClientTimeStamp) PersonalNameExample(com.itrus.portal.db.PersonalNameExample) ArrayList(java.util.ArrayList) EvidenceRealName(com.itrus.portal.db.EvidenceRealName) EvidenceClientTimeStampExample(com.itrus.portal.db.EvidenceClientTimeStampExample) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceCompaniesSubmitExample(com.itrus.portal.db.EvidenceCompaniesSubmitExample) EvidenceDesireIdentify(com.itrus.portal.db.EvidenceDesireIdentify) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceCheckExample(com.itrus.portal.db.EvidenceCheckExample) RealNameRecord(com.itrus.portal.db.RealNameRecord) AppServiceAuthentication(com.itrus.portal.db.AppServiceAuthentication) EvidenceCert(com.itrus.portal.db.EvidenceCert) EvidenceRepresentative(com.itrus.portal.db.EvidenceRepresentative) 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) EvidenceTheAgent(com.itrus.portal.db.EvidenceTheAgent) EvidenceDesireIdentifyExample(com.itrus.portal.db.EvidenceDesireIdentifyExample) EvidenceCompaniesSubmit(com.itrus.portal.db.EvidenceCompaniesSubmit) EvidenceClientSignature(com.itrus.portal.db.EvidenceClientSignature) AppService(com.itrus.portal.db.AppService) EvidenceCheck(com.itrus.portal.db.EvidenceCheck) EvidenceClientSignatureExample(com.itrus.portal.db.EvidenceClientSignatureExample) EvidenceTheAgentExample(com.itrus.portal.db.EvidenceTheAgentExample) EvidenceRepresentativeExample(com.itrus.portal.db.EvidenceRepresentativeExample) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) RealNameRecordExample(com.itrus.portal.db.RealNameRecordExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

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