Search in sources :

Example 1 with UserCertPojo

use of com.itrus.portal.utils.UserCertPojo in project portal by ixinportal.

the class BindCertWebController method bindPage.

@RequestMapping("/bindCertPage")
public String bindPage(@RequestParam(value = "certSn", required = true) String certSn, HttpSession session, Model uiModel) throws UserInfoServiceException {
    // 是否登录
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        // 登录状态失效,跳转到注册页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 返回所有信任源所有
    List<String> allIssUerDn = new ArrayList<String>();
    allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
    try {
        uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
    } catch (JsonGenerationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JsonMappingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    UserCert userCert = null;
    userCert = userCertService.getUserCertByCertSn(certSn);
    if (null == userCert)
        throw new UserInfoServiceException("未找到对应的证书信息");
    // DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    UserCertPojo ucp = new UserCertPojo(userCert, userCert.getCertStartTime().getTime() + "", userCert.getCertEndTime().getTime() + "");
    CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectByPrimaryKey", userCert.getCertBuf());
    uiModel.addAttribute("userCert", ucp);
    uiModel.addAttribute("certBase64", certBuf.getCertBuf().replaceAll("\n", ""));
    return "ixinweb/bangding";
}
Also used : UserCertPojo(com.itrus.portal.utils.UserCertPojo) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) Enterprise(com.itrus.portal.db.Enterprise) ArrayList(java.util.ArrayList) CertBuf(com.itrus.portal.db.CertBuf) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CertBuf (com.itrus.portal.db.CertBuf)1 Enterprise (com.itrus.portal.db.Enterprise)1 UserCert (com.itrus.portal.db.UserCert)1 UserInfo (com.itrus.portal.db.UserInfo)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 UserCertPojo (com.itrus.portal.utils.UserCertPojo)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1