Search in sources :

Example 6 with EvidenceHisRelationship

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

the class EvidenceOutTask method outBody.

/**
 * 自动出证
 * @param hisCertificate
 * @param orderNumber
 */
private void outBody(String orderNumber, EvidenceOutServiceConfig outServiceConfig, ApplicationInfo applicationInfo, AppService appService, String evidenceSns, String businessSn, Date date, String code, Integer count) {
    try {
        // 定义错误原因字段
        String hisCauseFailure = null;
        // 得到出证模板信息
        EvidenceOutTemplateExample outTemplateExample = new EvidenceOutTemplateExample();
        EvidenceOutTemplateExample.Criteria tec = outTemplateExample.createCriteria();
        tec.andIdEqualTo(outServiceConfig.getOutReportTemplate());
        EvidenceOutTemplate outTemplate = sqlSession.selectOne("com.itrus.portal.db.EvidenceOutTemplateMapper.selectByExample", outTemplateExample);
        // 整合证书需要的要素
        String[] factorArr = outTemplate.getFactor().split(",");
        // 整合出证信息表
        EvidenceHisCertificate hisCertificate = new EvidenceHisCertificate();
        hisCertificate.setServiceRequestPlatform(applicationInfo.getName());
        hisCertificate.setApplicationInfo(applicationInfo.getId());
        hisCertificate.setSisServiceName(appService.getAppServiceName());
        hisCertificate.setSerialnumber(orderNumber);
        hisCertificate.setHisAppService(appService.getId());
        hisCertificate.setApplicationTime(date);
        hisCertificate.setHisApplicant(code);
        hisCertificate.setHisState("1");
        hisCertificate.setOutState(0);
        hisCertificate.setOutTemplate(outServiceConfig.getOutReportTemplate());
        hisCertificate.setHisway(outServiceConfig.getOutWay().toString());
        sqlSession.insert("com.itrus.portal.db.EvidenceHisCertificateMapper.insert", hisCertificate);
        sqlSession.flushStatements();
        // int count = 0;
        if (StringUtils.isNotEmpty(evidenceSns)) {
            String[] evidenceSnArr = evidenceSns.split(",");
            for (String evidenceSn : evidenceSnArr) {
                // 获得对应证据编号的信息
                EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 2);
                if (basicInformation == null) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "提交的" + evidenceSn + "证据编号为无效的证据编码";
                    else
                        hisCauseFailure = hisCauseFailure + "," + "提交的" + evidenceSn + "证据编号为无效的证据编码";
                    continue;
                }
                // count++;
                if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
                    else
                        hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + "核验未通过,不满足出证要求";
                }
                // 得到证据附件信息
                EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
                EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
                eec.andEvidenceSnEqualTo(evidenceSn);
                eec.andPdfTypeEqualTo("1");
                List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
                // 核验事件证据提交的要素
                String subFactor = null;
                String lackFactor = null;
                for (EvidenceEnclosure enclosure : enclosures) {
                    if (StringUtils.isEmpty(subFactor))
                        subFactor = enclosure.getSaveFactor();
                    else
                        subFactor = subFactor + "," + enclosure.getSaveFactor();
                }
                for (String factor : factorArr) {
                    if (!subFactor.contains(factor) && !(factor.contains("主体身份") || factor.contains("身份实名认证") || factor.contains("身份意愿鉴别"))) {
                        if (StringUtils.isEmpty(lackFactor))
                            lackFactor = factor;
                        else
                            lackFactor = lackFactor + "," + factor;
                    }
                }
                if (StringUtils.isNotEmpty(lackFactor)) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "证据编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactor;
                    else
                        hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactor;
                }
                // 核验身份提交的要素
                String idFactor = null;
                for (String factor : factorArr) {
                    if (factor.contains("主体身份") || factor.contains("身份实名认证") || factor.contains("身份意愿鉴别")) {
                        if (StringUtils.isEmpty(idFactor))
                            idFactor = factor;
                        else
                            idFactor = idFactor + "," + factor;
                    }
                }
                log.debug("idFactor__ : " + idFactor);
                if (StringUtils.isNotEmpty(idFactor)) {
                    EvidenceTrustedIdentityExample trustedIdentityExample = new EvidenceTrustedIdentityExample();
                    EvidenceTrustedIdentityExample.Criteria ttc = trustedIdentityExample.createCriteria();
                    ttc.andBasicInformationEqualTo(basicInformation.getId().toString());
                    ttc.andEventContentIsNull();
                    List<EvidenceTrustedIdentity> trustedIdentities = sqlSession.selectList("com.itrus.portal.db.EvidenceTrustedIdentityMapper.selectByExample", trustedIdentityExample);
                    if (trustedIdentities == null || trustedIdentities.isEmpty()) {
                        if (StringUtils.isEmpty(hisCauseFailure))
                            hisCauseFailure = "证据编号:" + evidenceSn + ",缺少必要要素信息:可信身份标识";
                        else
                            hisCauseFailure = hisCauseFailure + "," + "证据编号:" + evidenceSn + ",缺少必要要素信息:可信身份标识";
                    } else {
                        for (EvidenceTrustedIdentity trustedIdentity : trustedIdentities) {
                            // 得到主体身份信息
                            EvidenceMainInformationExample informationExample = new EvidenceMainInformationExample();
                            EvidenceMainInformationExample.Criteria iec = informationExample.createCriteria();
                            // iec.andIdEqualTo(trustedIdentity.getMainInformation());
                            EvidenceMainInformation mainInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceMainInformationMapper.selectByExample", informationExample);
                            // 整合没关联主体身份证据的信息
                            if (StringUtils.isEmpty(trustedIdentity.getEvidenceSn())) {
                                if (StringUtils.isEmpty(hisCauseFailure))
                                    hisCauseFailure = "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + idFactor;
                                else
                                    hisCauseFailure = hisCauseFailure + "," + "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + idFactor;
                            } else {
                                // 得到证据附件信息
                                EvidenceEnclosureExample enclosureExample1 = new EvidenceEnclosureExample();
                                EvidenceEnclosureExample.Criteria eec1 = enclosureExample1.createCriteria();
                                eec1.andEvidenceSnEqualTo(trustedIdentity.getEvidenceSn());
                                eec1.andPdfTypeEqualTo("1");
                                List<EvidenceEnclosure> enclosures1 = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample1);
                                String subFactorId = null;
                                String lackFactorId = null;
                                for (EvidenceEnclosure enclosure : enclosures1) {
                                    if (StringUtils.isEmpty(subFactorId))
                                        subFactorId = enclosure.getSaveFactor();
                                    else
                                        subFactorId = subFactorId + "," + enclosure.getSaveFactor();
                                }
                                log.debug("subFactorId__ : " + subFactorId);
                                String[] factorIdArr = idFactor.split(",");
                                for (String factor : factorIdArr) {
                                    if (!subFactorId.contains(factor)) {
                                        if (StringUtils.isEmpty(lackFactorId))
                                            lackFactorId = factor;
                                        else
                                            lackFactorId = lackFactorId + "," + factor;
                                    }
                                }
                                log.debug("lackFactorId__ : " + lackFactorId);
                                if (StringUtils.isNotEmpty(lackFactorId)) {
                                    if (StringUtils.isEmpty(hisCauseFailure))
                                        hisCauseFailure = "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactorId;
                                    else
                                        hisCauseFailure = hisCauseFailure + "," + "证据主体:" + mainInformation.getSubjectName() + ",编号:" + evidenceSn + ",缺少必要要素信息:" + lackFactorId;
                                }
                            }
                        }
                    }
                }
                // 存储出证与证据关系
                EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
                hisRelationship.setBasicInformation(basicInformation.getId());
                hisRelationship.setHisCertificate(hisCertificate.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
            }
        } else {
            List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
            if (basicInformations == null || basicInformations.isEmpty()) {
                if (StringUtils.isEmpty(hisCauseFailure))
                    hisCauseFailure = "提交的业务单号有误";
                else
                    hisCauseFailure = hisCauseFailure + "," + "提交的业务单号有误";
            }
            for (EvidenceBasicInformation basicInformation : basicInformations) {
                // 得到证据附件信息
                EvidenceEnclosureExample enclosureExample = new EvidenceEnclosureExample();
                EvidenceEnclosureExample.Criteria eec = enclosureExample.createCriteria();
                eec.andBasicInformationEqualTo(basicInformation.getId());
                eec.andPdfTypeEqualTo("1");
                List<EvidenceEnclosure> enclosures = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosureExample);
                // 得到提交的要素
                String subFactor = null;
                String lackFactor = null;
                for (EvidenceEnclosure enclosure : enclosures) {
                    if (StringUtils.isEmpty(subFactor))
                        subFactor = enclosure.getSaveFactor();
                    else
                        subFactor = subFactor + "," + enclosure.getSaveFactor();
                }
                for (String factor : factorArr) {
                    if (!subFactor.contains(factor)) {
                        if (StringUtils.isEmpty(lackFactor))
                            lackFactor = factor;
                        else
                            lackFactor = lackFactor + "," + factor;
                    }
                }
                if (StringUtils.isNotEmpty(lackFactor)) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "证据编号:" + basicInformation.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor;
                    else
                        hisCauseFailure = hisCauseFailure + "," + "证据编号:" + basicInformation.getEvidenceSn() + ",缺少必要要素信息:" + lackFactor;
                }
                // count++;
                if (basicInformation.getEvidenceStatus() == 0 || StringUtils.isNotEmpty(basicInformation.getLackMainContent())) {
                    if (StringUtils.isEmpty(hisCauseFailure))
                        hisCauseFailure = "证据编号:" + basicInformation.getEvidenceSn() + ",不满足出证要求";
                    else
                        hisCauseFailure = hisCauseFailure + "," + "证据编号:" + basicInformation.getEvidenceSn() + ",不满足出证要求";
                }
                // 存储出证与证据关系
                EvidenceHisRelationship hisRelationship = new EvidenceHisRelationship();
                hisRelationship.setBasicInformation(basicInformation.getId());
                hisRelationship.setHisCertificate(hisCertificate.getId());
                sqlSession.insert("com.itrus.portal.db.EvidenceHisRelationshipMapper.insert", hisRelationship);
            }
        }
        // 判断出证模式
        if (count == 1)
            hisCertificate.setHis("0");
        else
            hisCertificate.setHis("1");
        // 判断出证是否有错
        if (StringUtils.isNotEmpty(hisCauseFailure)) {
            // hisCertificate.setHisway("3");
            hisCertificate.setOutState(1);
            hisCertificate.setHisCauseFailure(hisCauseFailure);
        }
        sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
        sqlSession.flushStatements();
        // 判断是否为自动出证
        if ("1".equals(hisCertificate.getHisway()) && hisCertificate.getOutState() == 0) {
            String oper1 = "出证接口";
            String info1 = "出证申请成功,流水号:" + orderNumber;
            LogUtil.evidencelog(sqlSession, null, oper1, info1);
            Map<String, Object> mapRet = null;
            // 生成出证报告
            try {
                mapRet = reportTemplate.certificationReport(hisCertificate.getSerialnumber());
            } catch (Exception e) {
                StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
                String infoErr = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
                String oper = "出证接口";
                String info = "生成出证报告失败,流水号:" + orderNumber + ",失败原因:" + infoErr;
                LogUtil.evidencelog(sqlSession, null, oper, info);
                e.printStackTrace();
            }
            // 判断出证报告是否生成成功
            if (mapRet != null) {
                if ((int) mapRet.get("status") == 0) {
                    // hisCertificate.setOutState(0);
                    String oper = "出证接口";
                    String info = "生成出证报告成功,流水号:" + orderNumber;
                    LogUtil.evidencelog(sqlSession, null, oper, info);
                    hisCertificate.setHisState("0");
                } else {
                    // hisCertificate.setOutState(1);
                    String oper = "出证接口";
                    String info = null;
                    if (mapRet.get("message") != null) {
                        info = "生成出证报告失败,流水号:" + orderNumber + ",失败原因:" + mapRet.get("message").toString();
                    // hisCertificate.setHisCauseFailure(mapRet.get("message").toString());
                    } else {
                        info = "生成出证报告失败,流水号:" + orderNumber;
                    // hisCertificate.setHisCauseFailure("出证失败");
                    }
                    LogUtil.evidencelog(sqlSession, null, oper, info);
                }
            }
        } else {
            String oper = "出证接口";
            String info = "出证失败,流水号:" + orderNumber;
            // 判断为自动出证失败后  转人工出证
            if (hisCertificate.getHisway().equals("1")) {
                hisCertificate.setHisway("3");
                info = info + ",已自动转人工出证";
            }
            LogUtil.evidencelog(sqlSession, null, oper, info);
        }
        sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKeySelective", hisCertificate);
        // 出证计费加流水
        takeChargingService.takeCharing(appService.getServiceConfigName(), appService.getServiceConfigId(), applicationInfo, appService, hisCertificate.getId(), "EvidenceHisCertificate", count, applicationInfo.getName(), hisCertificate.getHisApplicant());
    } catch (Exception e) {
        e.printStackTrace();
        StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 3];
        String info = "出证失败,错误详情:" + stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
        String oper = "出证接口";
        LogUtil.evidencelog(sqlSession, null, oper, info);
    }
}
Also used : EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) EvidenceOutTemplateExample(com.itrus.portal.db.EvidenceOutTemplateExample) EvidenceTrustedIdentity(com.itrus.portal.db.EvidenceTrustedIdentity) EvidenceOutTemplate(com.itrus.portal.db.EvidenceOutTemplate) EvidenceMainInformationExample(com.itrus.portal.db.EvidenceMainInformationExample) EvidenceTrustedIdentityExample(com.itrus.portal.db.EvidenceTrustedIdentityExample)

Example 7 with EvidenceHisRelationship

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

the class EvidenceSaveServiceApi method searchGenerated.

/**
 * 查询出证
 * @param signature
 * 			签名值
 * @param appId
 * 			应用标识
 * @param orderNumber
 * 			服务流水号
 * @param request
 * @return
 */
@RequestMapping(value = "/searchGenerated")
@ResponseBody
public Map<String, Object> searchGenerated(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "orderNumber", required = true) String orderNumber, HttpServletRequest request) {
    // TODO : 查询出证接口
    Map<String, Object> result = new HashMap<String, Object>();
    // 验证参数是否完整
    if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(orderNumber)) {
        result.put("status", 0);
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 得到应用信息 改成service
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    if (applicationInfo == null) {
        result.put("status", -11);
        result.put("message", "应用标识不存在");
        return result;
    }
    if (applicationInfo.getIsAppStatus() == 0) {
        result.put("status", -12);
        result.put("message", "应用状态已关闭");
        return result;
    }
    // 核验ip限制
    if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
        result.put("status", -1);
        result.put("message", "没有此服务权限");
        log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
        return result;
    }
    // 验证hmac有效性
    try {
        String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + orderNumber, applicationInfo.getSecretKey()), false);
        if (!signature.equals("HMAC-SHA1 " + macVal)) {
            result.put("status", -2);
            result.put("message", "服务密钥错误");
            return result;
        }
    } catch (Exception e) {
        result.put("status", -3);
        result.put("message", "Hmac验证错误");
        e.printStackTrace();
        return result;
    }
    EvidenceHisCertificateExample hisCertificateExample = new EvidenceHisCertificateExample();
    EvidenceHisCertificateExample.Criteria hec = hisCertificateExample.createCriteria();
    hec.andSerialnumberEqualTo(orderNumber);
    List<EvidenceHisCertificate> hisCertificates = sqlSession.selectList("com.itrus.portal.db.EvidenceHisCertificateMapper.selectByExample", hisCertificateExample);
    if (hisCertificates.size() == 0 || hisCertificates.isEmpty()) {
        result.put("status", 0);
        result.put("message", "流水号信息有误");
        return result;
    }
    EvidenceHisCertificate hisCertificate = hisCertificates.get(0);
    if (StringUtils.isNotEmpty(hisCertificate.getHisCauseFailure())) {
        result.put("status", 0);
        result.put("message", hisCertificate.getHisCauseFailure());
        return result;
    }
    EvidenceHisRelationshipExample hisRelationshipExample = new EvidenceHisRelationshipExample();
    EvidenceHisRelationshipExample.Criteria rec = hisRelationshipExample.createCriteria();
    rec.andHisCertificateEqualTo(hisCertificate.getId());
    List<EvidenceHisRelationship> hisRelationships = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", hisCertificates);
    for (EvidenceHisRelationship hisRelationship : hisRelationships) {
        EvidenceBasicInformation basicInformation = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelationship.getBasicInformation());
        Map<String, Object> map = evidenceSaveService.verifyFactor(basicInformation.getEvidenceSn());
        if ((int) map.get("status") != 1) {
            result.put("status", map.get("status"));
            result.put("message", map.get("message"));
            return result;
        }
    }
    // 通过流水号得到证据附件信息
    EvidenceEnclosureExample enclosurExample = new EvidenceEnclosureExample();
    EvidenceEnclosureExample.Criteria ec = enclosurExample.createCriteria();
    ec.andSerialnumberEqualTo(orderNumber);
    ec.andPdfTypeEqualTo("4");
    List<EvidenceEnclosure> enclosurs = sqlSession.selectList("com.itrus.portal.db.EvidenceEnclosureMapper.selectByExample", enclosurExample);
    // 判断证据是否已出
    if ("0".equals(hisCertificate.getHisState()) && enclosurs != null) {
        EvidenceEnclosure enclosure = enclosurs.get(0);
        try {
            // 获取密码服务
            RealNameAuthentication realNameAuthentication = CacheCustomer.getAUTH_CONFIG_MAP().get(2);
            if (realNameAuthentication == null) {
                realNameAuthentication = realNameAuthenticationSerivce.getRealNameAuthenticationByTwo();
            }
            if (realNameAuthentication == null) {
                result.put("status", -6);
                result.put("message", "缺少服务配置,请联系管理员");
                return result;
            }
            // 下载出证报告base64
            String str = decryptedAndDownload(sqlSession, enclosure.getBuid(), realNameAuthentication.getRealNameddress());
        } catch (Exception e) {
            result.put("status", -5);
            result.put("message", "服务器出错,请联系管理员");
            String oper = "查询出证接口-异常";
            String info = "服务流水号: " + orderNumber + ",错误原因:" + e.toString();
            LogUtil.evidencelog(sqlSession, null, oper, info);
        }
    } else {
        // 生成出证报告
        Map<String, Object> mapRet = null;
        // 判断是否为自动出证
        if (hisCertificate.getHisway().equals("1")) {
            // 生成出证报告
            try {
                mapRet = reportTemplate.certificationReport(hisCertificate.getSerialnumber());
            } catch (Exception e) {
                result.put("status", 0);
                result.put("message", "出证失败");
                return result;
            }
        } else {
            result.put("status", 0);
            result.put("message", "无法自动出证");
            return result;
        }
        // 判断出证报告是否生成成功
        if (mapRet != null && (int) mapRet.get("status") == 0) {
            result.put("status", 1);
            result.put("message", "出证成功");
            result.put("orderNumber", hisCertificate.getSerialnumber());
            result.put("pdfBase64", mapRet.get("pdfBase64"));
            hisCertificate.setHisState("0");
        } else {
            result.put("status", 0);
            result.put("message", "出证失败");
            hisCertificate.setHisCauseFailure(mapRet.get("message").toString());
            // 判断为自动出证失败后  转人工出证
            if (hisCertificate.getHisway().equals("1")) {
                hisCertificate.setHisway("3");
                result.put("message", "出证失败,已自动转人工出证");
            }
        }
        sqlSession.update("com.itrus.portal.db.EvidenceHisCertificateMapper.updateByPrimaryKey", hisCertificate);
    }
    return result;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) EvidenceHisCertificate(com.itrus.portal.db.EvidenceHisCertificate) EvidenceEnclosureExample(com.itrus.portal.db.EvidenceEnclosureExample) EvidenceEnclosure(com.itrus.portal.db.EvidenceEnclosure) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) IOException(java.io.IOException) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) EvidenceHisCertificateExample(com.itrus.portal.db.EvidenceHisCertificateExample) JSONObject(com.alibaba.fastjson.JSONObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with EvidenceHisRelationship

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

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

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

the class HisCertificateController method list.

@RequestMapping(produces = "text/html")
public // 待出证
String list(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, @RequestParam(value = "serialnumber", required = false) String serialnumber, @RequestParam(value = "serviceRequestPlatform", required = false) String serviceRequestPlatform, @RequestParam(value = "hisApplicant", required = false) String hisApplicant, @RequestParam(value = "subjectName", required = false) String subjectName, @RequestParam(value = "identification", required = false) String identification, @RequestParam(value = "hisway", required = false) String hisway, // 返回页面
@RequestParam(value = "status", required = false) String status, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, // 已出证
@RequestParam(value = "queryDate3", required = false) Date queryDate3, @RequestParam(value = "queryDate4", required = false) Date queryDate4, @RequestParam(value = "queryDate5", required = false) Date queryDate5, @RequestParam(value = "queryDate6", required = false) Date queryDate6, @RequestParam(value = "evidenceSn1", required = false) String evidenceSn1, @RequestParam(value = "serialnumber1", required = false) String serialnumber1, @RequestParam(value = "serviceRequestPlatform1", required = false) String serviceRequestPlatform1, @RequestParam(value = "hisApplicant1", required = false) String hisApplicant1, @RequestParam(value = "subjectName1", required = false) String subjectName1, @RequestParam(value = "hisState", required = false) String hisState, @RequestParam(value = "hisway1", required = false) String hisway1, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    if (queryDate3 == null && queryDate4 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate4 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate3 = calendar.getTime();
    }
    if (queryDate5 == null && queryDate6 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate6 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate5 = calendar.getTime();
    }
    // 待出证记录
    Map param = new HashMap();
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    param.put("offset", offset);
    param.put("limit", size);
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    if (StringUtils.isNotEmpty(evidenceSn)) {
        param.put("evidenceSn", "%" + evidenceSn + "%");
    }
    if (StringUtils.isNotEmpty(serialnumber)) {
        param.put("serialnumber", "%" + serialnumber + "%");
    }
    if (StringUtils.isNotEmpty(serviceRequestPlatform)) {
        param.put("serviceRequestPlatform", "%" + serviceRequestPlatform + "%");
    }
    if (StringUtils.isNotEmpty(hisApplicant)) {
        param.put("hisApplicant", "%" + hisApplicant + "%");
    }
    if (StringUtils.isNotEmpty(subjectName)) {
        param.put("subjectName", "%" + subjectName + "%");
    }
    if (StringUtils.isNotEmpty(identification)) {
        param.put("identification", "%" + identification + "%");
    }
    if (StringUtils.isNotEmpty(hisway)) {
        param.put("hisway", hisway);
    }
    // else{
    // //String hisw = "2,3";
    // param.put("hisway", "2,3");
    // }
    // 得到待出证信息
    List<Map<String, Object>> list = hiscertificate.selectHisCertificateListEnt(param);
    int count = hiscertificate.selectHisCertificateCountEnt(param);
    Map<Long, List<EvidenceMainInformation>> minfo = new HashMap<Long, List<EvidenceMainInformation>>();
    Map<Long, List<EvidenceBasicInformation>> mbasi = new HashMap<Long, List<EvidenceBasicInformation>>();
    for (int i = 0; i < list.size(); i++) {
        // 得到出证关联表信息
        long id = Long.parseLong(list.get(i).get("id").toString());
        EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
        EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
        hisreation.andHisCertificateEqualTo(id);
        List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
        List<EvidenceBasicInformation> blist = new ArrayList<EvidenceBasicInformation>();
        List<EvidenceMainInformation> lists = new ArrayList<EvidenceMainInformation>();
        for (int j = 0; j < hisRelation.size(); j++) {
            // 得到证据基本信息
            EvidenceBasicInformation basic = sqlSession.selectOne("com.itrus.portal.db.EvidenceBasicInformationMapper.selectByPrimaryKey", hisRelation.get(j).getBasicInformation());
            blist.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());
                lists.add(mainInfo);
            }
        }
        minfo.put(id, lists);
        mbasi.put(id, blist);
    }
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("list", list);
    uiModel.addAttribute("mainInfo", minfo);
    uiModel.addAttribute("blist", mbasi);
    // 已出证
    Map param1 = new HashMap();
    // page,size
    if (page2 == null || page2 < 1)
        page2 = 1;
    if (size2 == null || size2 < 1)
        size2 = 10;
    // query data
    Integer offset2 = size2 * (page2 - 1);
    param1.put("offset", offset2);
    param1.put("limit", size2);
    param1.put("queryDate3", queryDate3);
    param1.put("queryDate4", queryDate4);
    param1.put("queryDate5", queryDate5);
    param1.put("queryDate6", queryDate6);
    if (StringUtils.isNotEmpty(evidenceSn1)) {
        param1.put("evidenceSn", "%" + evidenceSn1 + "%");
    }
    if (StringUtils.isNotEmpty(serialnumber1)) {
        param1.put("serialnumber", "%" + serialnumber1 + "%");
    }
    if (StringUtils.isNotEmpty(serviceRequestPlatform1)) {
        param1.put("serviceRequestPlatform", "%" + serviceRequestPlatform1 + "%");
    }
    if (StringUtils.isNotEmpty(hisApplicant1)) {
        param1.put("hisApplicant", "%" + hisApplicant1 + "%");
    }
    if (StringUtils.isNotEmpty(subjectName1)) {
        param1.put("subjectName", "%" + subjectName1 + "%");
    }
    if (StringUtils.isNotEmpty(hisState) && !"-1".equals(hisState)) {
        param1.put("hisState", hisState);
    }
    if (StringUtils.isNotEmpty(hisway1) && !"0".equals(hisway1)) {
        param1.put("hisway", hisway1);
    }
    List<Map<String, Object>> hlist = hiscertificate.selectHisCertificateEnt(param1);
    int count1 = hiscertificate.selectHisCertificateSizeEnt(param1);
    Map<Long, List<EvidenceMainInformation>> minfor = new HashMap<Long, List<EvidenceMainInformation>>();
    Map<Long, List<EvidenceBasicInformation>> mbasic = new HashMap<Long, List<EvidenceBasicInformation>>();
    for (int i = 0; i < hlist.size(); i++) {
        // 得到出证关联表信息
        long id = Long.parseLong(hlist.get(i).get("id").toString());
        EvidenceHisRelationshipExample relation = new EvidenceHisRelationshipExample();
        EvidenceHisRelationshipExample.Criteria hisreation = relation.createCriteria();
        hisreation.andHisCertificateEqualTo(id);
        List<EvidenceHisRelationship> hisRelation = sqlSession.selectList("com.itrus.portal.db.EvidenceHisRelationshipMapper.selectByExample", relation);
        List<EvidenceMainInformation> mlist = new ArrayList<EvidenceMainInformation>();
        List<EvidenceBasicInformation> blists = new ArrayList<EvidenceBasicInformation>();
        for (int j = 0; j < hisRelation.size(); j++) {
            // 得到证据基本信息
            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);
            }
        }
        minfor.put(id, mlist);
        mbasic.put(id, blists);
    }
    uiModel.addAttribute("pages2", (count1 + size2 - 1) / size2);
    // page, size
    if (page2 > 1 && size2 * (page2 - 1) >= count1) {
        page2 = (count1 + size2 - 1) / size2;
    }
    List<EvidenceHisCertificate> his = hiscertificate.selecthisway();
    uiModel.addAttribute("his", his);
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    uiModel.addAttribute("count2", count1);
    uiModel.addAttribute("hlist", hlist);
    uiModel.addAttribute("ainInfo", minfor);
    uiModel.addAttribute("blists", mbasic);
    uiModel.addAttribute("status", status);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("queryDate3", queryDate3);
    uiModel.addAttribute("queryDate4", queryDate4);
    uiModel.addAttribute("queryDate5", queryDate5);
    uiModel.addAttribute("queryDate6", queryDate6);
    uiModel.addAttribute("evidenceSn", evidenceSn);
    uiModel.addAttribute("serialnumber", serialnumber);
    uiModel.addAttribute("serviceRequestPlatform", serviceRequestPlatform);
    uiModel.addAttribute("hisApplicant", hisApplicant);
    uiModel.addAttribute("subjectName", subjectName);
    uiModel.addAttribute("identification", identification);
    uiModel.addAttribute("hisway2", hisway);
    uiModel.addAttribute("serialnumber1", serialnumber1);
    uiModel.addAttribute("serviceRequestPlatform1", serviceRequestPlatform1);
    uiModel.addAttribute("hisApplicant", hisApplicant1);
    uiModel.addAttribute("subjectName1", subjectName1);
    uiModel.addAttribute("hisState", hisState);
    uiModel.addAttribute("hisway3", hisway1);
    uiModel.addAttribute("evidenceSn1", evidenceSn1);
    return "hiscertificate/list";
}
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) EvidenceMainInformation(com.itrus.portal.db.EvidenceMainInformation) ArrayList(java.util.ArrayList) List(java.util.List) EvidenceHisRelationship(com.itrus.portal.db.EvidenceHisRelationship) Calendar(java.util.Calendar) EvidenceSubjectIdentity(com.itrus.portal.db.EvidenceSubjectIdentity) EvidenceHisRelationshipExample(com.itrus.portal.db.EvidenceHisRelationshipExample) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

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