Search in sources :

Example 31 with AppService

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

the class CertificationChargingController method createForm.

// 新建处理页面
@RequestMapping(params = "form", produces = "text/html")
public String createForm(Model uiModel) {
    // 系统配置的应用集合
    List<ApplicationInfo> applicationInfos = new ArrayList<ApplicationInfo>();
    applicationInfos = sqlSession.selectList("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", null);
    // 移除已经存在了的应用集合
    Iterator<ApplicationInfo> iterator = applicationInfos.iterator();
    while (iterator.hasNext()) {
        ApplicationInfo applicationInfo = iterator.next();
        List<CertificationCharging> certificationChargings = certificationChargingService.selectListByAppId(applicationInfo.getId(), null);
        if (null != certificationChargings && certificationChargings.size() > 0) {
            iterator.remove();
        }
    }
    Map<String, Object> map = new HashMap<>();
    map.put("serviceType", 1);
    // 系统配置的实名认证服务集合-企业
    List<AppService> appServices_e = new ArrayList<AppService>();
    appServices_e = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    // 系统配置的实名认证服务集合-个人
    map.put("serviceType", 2);
    List<AppService> appServices_p = new ArrayList<AppService>();
    appServices_p = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    uiModel.addAttribute("applicationInfos", applicationInfos);
    uiModel.addAttribute("appServices_e", appServices_e);
    uiModel.addAttribute("appServices_p", appServices_p);
    return "certificationcharging/create";
}
Also used : AppService(com.itrus.portal.db.AppService) CertificationCharging(com.itrus.portal.db.CertificationCharging) HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 32 with AppService

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

the class CertificationChargingController method update.

// 返回修改页面
@RequestMapping(value = "/update/{id}")
public String update(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    ApplicationInfo applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByPrimaryKey", id);
    uiModel.addAttribute("applicationInfo", applicationInfo);
    // 系统配置的实名认证服务集合
    List<AppService> appServices = new ArrayList<AppService>();
    AppServiceExample ase = new AppServiceExample();
    AppServiceExample.Criteria criteria = ase.or();
    // 筛选实名认证类型的服务
    criteria.andTypeEqualTo(ComNames.SERVICE_TYPE_CERTIFICATION);
    appServices = sqlSession.selectList("com.itrus.portal.db.AppServiceMapper.selectByExample", ase);
    uiModel.addAttribute("appServices", appServices);
    Map<String, Object> map = new HashMap<>();
    map.put("serviceType", 1);
    // 系统配置的实名认证服务集合-企业
    List<AppService> appServices_e = new ArrayList<AppService>();
    appServices_e = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    // 系统配置的实名认证服务集合-个人
    map.put("serviceType", 2);
    List<AppService> appServices_p = new ArrayList<AppService>();
    appServices_p = sqlSession.selectList("com.itrus.portal.db.CertificationChargingMapper.selectAppServiceByServiceType", map);
    uiModel.addAttribute("appServices_e", appServices_e);
    uiModel.addAttribute("appServices_p", appServices_p);
    List<CertificationCharging> certificationChargings = new ArrayList<CertificationCharging>();
    certificationChargings = certificationChargingService.selectList(id, ComNames.CHARGING_TYPE_SMRZ_1);
    CertificationChargingWrap certificationChargingWrap = new CertificationChargingWrap();
    List<CertificationChargingList> certificationChargingLists = new ArrayList<CertificationChargingList>();
    for (int i = 0; i < certificationChargings.size(); i++) {
        CertificationChargingList certificationChargingList = new CertificationChargingList();
        List<ServiceName> serviceNames = new ArrayList<ServiceName>();
        serviceNames = serviceNameService.selectListByCertificationCharging(certificationChargings.get(i));
        List<ServiceNameList> serviceNameLists = new ArrayList<ServiceNameList>();
        for (int j = 0; j < serviceNames.size(); j++) {
            List<ChargingPrice> chargingPrices = chargingPriceService.selectListByOneServiceName(serviceNames.get(j));
            ServiceNameList serviceNameList = new ServiceNameList();
            ChargingPriceList chargingPriceList = new ChargingPriceList();
            // 1
            chargingPriceList.setChargingPriceLists(chargingPrices);
            // 2
            serviceNameList.setServiceName(serviceNames.get(j));
            serviceNameList.setChargingPriceList(chargingPriceList);
            serviceNameLists.add(serviceNameList);
        }
        certificationChargingList.setCertificationCharging(certificationChargings.get(i));
        certificationChargingList.setServiceNameLists(serviceNameLists);
        certificationChargingLists.add(certificationChargingList);
    }
    certificationChargingWrap.setCertificationChargingLists(certificationChargingLists);
    uiModel.addAttribute("ccw", certificationChargingWrap);
    Map<Long, AppService> appServiceMap = sqlSession.selectMap("com.itrus.portal.db.AppServiceMapper.selectByExample", null, "id");
    uiModel.addAttribute("appServiceMap", appServiceMap);
    returnParam(request, uiModel);
    return "certificationcharging/update";
}
Also used : HashMap(java.util.HashMap) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) ArrayList(java.util.ArrayList) ChargingPriceList(com.itrus.portal.entity.ChargingPriceList) CertificationChargingList(com.itrus.portal.entity.CertificationChargingList) AppServiceExample(com.itrus.portal.db.AppServiceExample) ServiceNameList(com.itrus.portal.entity.ServiceNameList) AppService(com.itrus.portal.db.AppService) CertificationCharging(com.itrus.portal.db.CertificationCharging) CertificationChargingWrap(com.itrus.portal.entity.CertificationChargingWrap) ServiceName(com.itrus.portal.db.ServiceName) ChargingPrice(com.itrus.portal.db.ChargingPrice) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 33 with AppService

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

the class EvidenceSaveServiceApi method save.

// @Autowired
// private ProducerService producerService;
// 回执报告缓存Map key:证据编号  value:回执base64
// public static ConcurrentHashMap<String, String> cacheReportBySnMap = new ConcurrentHashMap<>();
/**
 * 存证接口
 * @param signature
 * 			签名值
 * @param appId
 * 			应用id
 * @param serviceCode
 * 			服务编号
 * @param evidenceSn
 * 			证据编号
 * @param signedBase64
 * 			签名值base64
 * @param evidencePackage
 * 			证据包
 * @param request
 * @return
 */
@RequestMapping("/save")
@ResponseBody
public Map<String, Object> save(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = false) String appId, @RequestParam(value = "serviceCode", required = false) String serviceCode, @RequestParam(value = "evidenceSn", required = false) String evidenceSn, @RequestParam(value = "hashAlg", required = false) String hashAlg, @RequestParam(value = "signedBase64", required = false) String signedBase64, @RequestParam(value = "evidencePackage", required = false) String evidencePackage, HttpServletRequest request) {
    // 返回值
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("status", 1);
    // 申请时间
    Date date = new Date();
    // 验证参数是否完整
    if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(evidencePackage) || StringUtils.isEmpty(hashAlg) || StringUtils.isEmpty(signedBase64)) {
        result.put("status", 0);
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 获取对应应用信息
    ApplicationInfo applicationInfo = applicationInfoService.getApplicationInfo(appId);
    if (applicationInfo == null) {
        result.put("status", -11);
        result.put("message", "应用标识不存在");
        return result;
    }
    if (applicationInfo.getIsAppStatus() == 0) {
        result.put("status", -12);
        result.put("message", "应用状态已关闭");
        return result;
    }
    // 核验ip限制
    if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
        result.put("status", -1);
        result.put("message", "没有此服务权限");
        log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
        return result;
    }
    // 验证hmac有效性
    try {
        String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + serviceCode + evidenceSn + hashAlg + signedBase64 + evidencePackage, 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;
    }
    // 获取对应应用信息
    EvidenceSaveService evidenceSaveService = null;
    AppService appService = appServiceExt.getAppService(serviceCode);
    if (appService != null && "EvidenceSaveService".equals(appService.getServiceConfigName())) {
        evidenceSaveService = saveServiceImpl.selectById(appService.getServiceConfigId());
    } else {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (evidenceSaveService == null) {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (appService.getIsAppServiceStatus() == 0) {
        result.put("status", -22);
        result.put("message", "服务已关闭");
        return result;
    }
    // 获取存证回执模版
    if (evidenceSaveService.getAppServiceName() != null) {
        AppService appServiceOut = CacheCustomer.APP_SERVICE_MAP_BY_ID().get(evidenceSaveService.getAppServiceName());
        if (appServiceOut == null) {
            appServiceOut = appServiceExt.selectById(evidenceSaveService.getAppServiceName());
            if (appServiceOut == null) {
                result.put("status", -22);
                result.put("message", "回执模版不存在");
                return result;
            }
        }
    }
    if (StringUtils.isNotEmpty(evidenceSn)) {
        EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 1);
        if (basicInformation != null) {
            result.put("status", 0);
            result.put("message", "该证据不可补交");
            return result;
        }
    }
    RealNameAuthentication realNameAuthentication = null;
    RealNameAuthentication realNameAuthenticationTime = null;
    RealNameAuthentication realNameAuthenticationOss = null;
    try {
        // 获取原子服务地址  1.实名认证  2.密码服务  3.时间戳  4.OSS
        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;
        }
        // 获取原子服务地址  1.实名认证  2.密码服务  3.时间戳  4.OSS
        realNameAuthenticationTime = CacheCustomer.getAUTH_CONFIG_MAP().get(3);
        if (realNameAuthenticationTime == null) {
            realNameAuthenticationTime = realNameAuthenticationSerivce.getRealNameAuthenticationByThree();
        }
        if (realNameAuthenticationTime == null) {
            result.put("status", -6);
            result.put("message", "缺少时间戳服务配置,请联系管理员");
            return result;
        }
        // 获取原子服务地址  1.实名认证  2.密码服务  3.时间戳  4.OSS
        realNameAuthenticationOss = CacheCustomer.getAUTH_CONFIG_MAP().get(4);
        if (realNameAuthenticationOss == null) {
            realNameAuthenticationOss = realNameAuthenticationSerivce.getRealNameAuthenticationByOss();
        }
        if (realNameAuthenticationOss == null) {
            result.put("status", -6);
            result.put("message", "缺少OSS配置,请联系管理员");
            return result;
        }
        // 本次证据包大小
        int fileSize = evidencePackage.getBytes("utf-8").length;
        // 存证计费校验接口
        Map<String, Object> mapCharging = storeChargingService.checkStoreCharging(StringUtils.isBlank(evidenceSn), applicationInfo, appService, evidenceSaveService.getBaseSpace(), getSize(fileSize));
        // log.debug("存证计费校验   mapCharging__ : " + mapCharging);
        if ((int) mapCharging.get("retCode") == 0) {
            result.put("status", -4);
            if (mapCharging.get("retMsg") != null)
                result.put("message", mapCharging.get("retMsg"));
            else
                result.put("message", "服务计费失败");
            return result;
        }
        // 证据包申请
        String hashvalue = HMACSHA1.getDigest(hashAlg, evidencePackage);
        // 1.验签之后返回
        List<String> certs = verifySign(result, applicationInfo, evidenceSaveService, hashvalue, signedBase64, realNameAuthentication);
        Date dateVp = (Date) result.get("dateVp");
        Date dateVc = (Date) result.get("dateVc");
        result.remove("dateVp");
        result.remove("dateVc");
        if (null != certs) {
            String genSn = null;
            if (StringUtils.isEmpty(evidenceSn)) {
                genSn = UniqueIDUtils.genAppServiceUID(applicationInfo, appService.getAppServiceName(), sqlSession, 3);
            }
            result = saveTask.saveBody(result, applicationInfo, appService, evidenceSaveService, date, evidenceSn, genSn, signedBase64, evidencePackage, hashAlg, hashvalue, dateVp, dateVc, certs, realNameAuthentication, realNameAuthenticationTime, realNameAuthenticationOss, mapCharging);
            if ((int) result.get("status") == 1) {
                result.put("message", "申请存证成功,请稍后通过查询存证接口查看存证结果!");
                if (StringUtils.isNotEmpty(evidenceSn))
                    result.put("evidenceSn", evidenceSn);
                else
                    result.put("evidenceSn", genSn);
            }
        } else {
            result.put("status", -8);
            result.put("message", "验证证书失败");
        }
        return result;
    } catch (Exception e) {
        e.printStackTrace();
        if (e instanceof IllegalStateException) {
            result.put("status", -100);
            result.put("message", "当前系统忙,请稍后再尝试!");
            return result;
        }
        StackTraceElement stackTraceElement = e.getStackTrace()[e.getStackTrace().length - 2];
        String info = stackTraceElement.getClassName() + stackTraceElement.getLineNumber() + e.toString();
        LogUtil.evidencelog(sqlSession, null, "存证接口", "申请存证失败,失败原因:" + info);
        result = new HashMap<String, Object>();
        result.put("status", -5);
        result.put("message", "系统服务错误,请联系管理员");
        return result;
    } finally {
        if (realNameAuthentication != null) {
            realNameAuthentication = null;
        }
        if (realNameAuthenticationOss != null) {
            realNameAuthenticationOss = null;
        }
        if (realNameAuthenticationTime != null) {
            realNameAuthenticationTime = null;
        }
    }
}
Also used : AppService(com.itrus.portal.db.AppService) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) EvidenceSaveService(com.itrus.portal.db.EvidenceSaveService) RealNameAuthentication(com.itrus.portal.db.RealNameAuthentication) Date(java.util.Date) IOException(java.io.IOException) JSONObject(com.alibaba.fastjson.JSONObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 34 with AppService

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

the class EvidenceSaveServiceApi method generateTask.

/**
 * 出证
 * @param signature
 * 			签名值
 * @param appId
 * 			应用标识
 * @param serviceCode
 * 			服务编码
 * @param evidenceSns
 * 			要出证的证据编号(多个用逗号隔开)
 * @param businessSn
 * 			事件发生平台业务单号
 * @param request
 * @return
 */
@RequestMapping(value = "/generate")
@ResponseBody
public Map<String, Object> generateTask(@RequestHeader("Content-Signature") String signature, @RequestParam(value = "appId", required = true) String appId, @RequestParam(value = "serviceCode", required = true) String serviceCode, @RequestParam(value = "evidenceSns", required = false) String evidenceSns, @RequestParam(value = "businessSn", required = false) String businessSn, @RequestParam(value = "name", required = true) String name, @RequestParam(value = "code", required = true) String code, HttpServletRequest request) {
    log.equals("【提交出证申请日志】appId=" + appId + ",serviceCode=" + serviceCode + ",evidenceSns=" + evidenceSns + ",businessSn=" + businessSn + ",name=" + name + ",code=" + code);
    // 申请时间
    Date date = new Date();
    // TODO : 出证接口
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("status", 1);
    // 验证参数是否完整
    if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(appId) || StringUtils.isEmpty(serviceCode) || StringUtils.isEmpty(code) || StringUtils.isEmpty(name) || (evidenceSns == null && StringUtils.isEmpty(businessSn))) {
        result.put("status", 0);
        result.put("message", "提交的参数信息不完整");
        return result;
    }
    // 得到应用信息 改成service
    Map<String, ApplicationInfo> appInfoMap = CacheCustomer.getAPP_INFO_MAP();
    ApplicationInfo applicationInfo = appInfoMap.get(appId);
    if (applicationInfo == null) {
        ApplicationInfoExample applicationInfoExample = new ApplicationInfoExample();
        ApplicationInfoExample.Criteria appInfoExampleCriteria = applicationInfoExample.createCriteria();
        appInfoExampleCriteria.andAppIdEqualTo(appId);
        applicationInfo = sqlSession.selectOne("com.itrus.portal.db.ApplicationInfoMapper.selectByExample", applicationInfoExample);
    }
    if (applicationInfo == null) {
        result.put("status", -11);
        result.put("message", "应用标识不存在");
        return result;
    }
    if (applicationInfo.getIsAppStatus() == 0) {
        result.put("status", -12);
        result.put("message", "应用状态已关闭");
        return result;
    }
    // 核验ip限制
    if (!applicationInfo.getAccessIp().contains(request.getRemoteAddr()) && "1".equals(applicationInfo.getIsIpStatus())) {
        result.put("status", -1);
        result.put("message", "没有此服务权限");
        log.debug("EvidenceSaveSeriveceTest_AccsessIp : " + request.getRemoteAddr());
        return result;
    }
    // 验证hmac有效性
    try {
        String macVal = Base64.encode(HMACSHA1.getHmacSHA1(appId + serviceCode + evidenceSns + businessSn + name + code, applicationInfo.getSecretKey()), false);
        if (!signature.equals("HMAC-SHA1 " + macVal)) {
            result.put("status", -2);
            result.put("message", "服务密钥错误");
            return result;
        }
    } catch (Exception e) {
        result.put("status", -3);
        result.put("message", "Hmac验证错误");
        e.printStackTrace();
        return result;
    }
    // 获取对应应用信息
    EvidenceOutServiceConfig outServiceConfig = null;
    AppService appService = appServiceExt.getAppService(serviceCode);
    if (appService != null && "EvidenceOutServiceConfig".equals(appService.getServiceConfigName())) {
        outServiceConfig = configService.selectById(appService.getServiceConfigId());
    } else {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (outServiceConfig == null) {
        result.put("status", -21);
        result.put("message", "应用服务不存在");
        return result;
    }
    if (appService.getIsAppServiceStatus() == 0) {
        result.put("status", -22);
        result.put("message", "服务已关闭");
        return result;
    }
    if (outServiceConfig.getOutWay() == null) {
        result.put("status", 0);
        result.put("message", "请联系管理员配置出证方式");
        return result;
    }
    // 得到出证份数
    int count = 0;
    if (StringUtils.isNotEmpty(evidenceSns)) {
        count = evidenceSns.split(",").length;
    } else {
        List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
        count = basicInformations.size();
    }
    // 核验计费
    boolean blCharing = takeChargingService.checkTakeCharing(applicationInfo, appService, count);
    if (!blCharing) {
        result.put("status", -4);
        result.put("message", "服务计费失败");
        return result;
    }
    // 生成流水号
    String orderNumber = UniqueIDUtils.genAppServiceUID(applicationInfo, appService.getAppServiceName(), sqlSession, 3);
    // 修改需要出证的证据为待出征状态
    if (StringUtils.isNotEmpty(evidenceSns)) {
        String[] evidenceSnArr = evidenceSns.split(",");
        for (String evidenceSn : evidenceSnArr) {
            EvidenceBasicInformation basicInformation = basicInformationService.getInformationBySn(evidenceSn, 2);
            if (basicInformation != null) {
                basicInformation.setStatus(1);
                sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
                sqlSession.flushStatements();
            }
        }
    } else {
        List<EvidenceBasicInformation> basicInformations = basicInformationService.getInformationByBusinessSn(businessSn, 2);
        if (basicInformations != null) {
            for (EvidenceBasicInformation basicInformation : basicInformations) {
                basicInformation.setStatus(1);
                sqlSession.update("com.itrus.portal.db.EvidenceBasicInformationMapper.updateByPrimaryKey", basicInformation);
                sqlSession.flushStatements();
            }
        }
    }
    // 判断是否为自动出证
    if ((int) result.get("status") == 1 && outServiceConfig.getOutWay() == 1) {
        // queueTask.putObjectQueue(new EvidenceLog(orderNumber, outServiceConfig, applicationInfo, appService, evidenceSns, businessSn, date, code, count, true));
        result.put("status", 1);
        result.put("message", "申请自动出证成功,请稍后通过查询出证接口查看出证结果!");
        result.put("orderNumber", orderNumber);
    } else {
        queueTask.putObjectQueue(new EvidenceOutTask(orderNumber, outServiceConfig, applicationInfo, appService, evidenceSns, businessSn, date, code, count, false));
        result.put("status", 0);
        result.put("message", "已转入人工出证");
    }
    return result;
}
Also used : ApplicationInfoExample(com.itrus.portal.db.ApplicationInfoExample) AppService(com.itrus.portal.db.AppService) HashMap(java.util.HashMap) EvidenceBasicInformation(com.itrus.portal.db.EvidenceBasicInformation) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) EvidenceOutServiceConfig(com.itrus.portal.db.EvidenceOutServiceConfig) Date(java.util.Date) IOException(java.io.IOException) JSONObject(com.alibaba.fastjson.JSONObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 35 with AppService

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

Aggregations

AppService (com.itrus.portal.db.AppService)53 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)34 HashMap (java.util.HashMap)25 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)19 Date (java.util.Date)16 EvidenceBasicInformation (com.itrus.portal.db.EvidenceBasicInformation)13 ArrayList (java.util.ArrayList)12 AppServiceExample (com.itrus.portal.db.AppServiceExample)10 EvidenceOutServiceConfig (com.itrus.portal.db.EvidenceOutServiceConfig)9 EvidenceSaveService (com.itrus.portal.db.EvidenceSaveService)9 EvidenceEnclosure (com.itrus.portal.db.EvidenceEnclosure)8 IOException (java.io.IOException)8 List (java.util.List)8 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)8 JSONObject (com.alibaba.fastjson.JSONObject)7 AppServiceAuthentication (com.itrus.portal.db.AppServiceAuthentication)7 EvidenceEnclosureExample (com.itrus.portal.db.EvidenceEnclosureExample)6 EvidenceHisCertificate (com.itrus.portal.db.EvidenceHisCertificate)6 Map (java.util.Map)6 EvidenceHisRelationship (com.itrus.portal.db.EvidenceHisRelationship)5