Search in sources :

Example 1 with AppBean

use of com.itrus.portal.entity.AppBean in project portal by ixinportal.

the class UserFromClientLoginController method toClientHomePage.

/**
 * 服务型客户端首页
 * type,类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
 * @param keySn
 * @param certSn
 * @param enterpriseName
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping("/toClientHomePage")
public String toClientHomePage(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "keySn", required = false) String keySn, @RequestParam(value = "certSn", required = false) String certSn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    try {
        UserInfo userInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
        if (null == userInfo) {
            return ComNames.DENG_LU_CLIENT;
        }
        Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
        if (null == enterprise && StringUtils.isNotBlank(enterpriseName)) {
            enterprise = enterpriseService.getEntByName(enterpriseName);
        }
        UserCert userCert = (UserCert) session.getAttribute("userCert");
        if (null == userCert && StringUtils.isNotBlank(certSn)) {
            userCert = userCertService.getUserCertByCertSn(certSn);
        }
        uiModel.addAttribute("userCert", userCert);
        Project project = null;
        if (StringUtils.isNotBlank(keySn)) {
            ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
            project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
        } else {
            project = projectService.selectByPrimaryKey(userInfo.getProject());
        }
        if (project.getId() != null) {
            List<AppBean> appBeanList = appService.getAppList(project.getId(), type);
            uiModel.addAttribute("appBeanList", appBeanList);
        }
        // TODO 返回足迹信息
        if (enterprise.getId() != null) {
            Records record = signatureRecordService.getRecord(enterprise.getId());
            uiModel.addAttribute("record", record);
        }
    } catch (Exception e) {
        uiModel.addAttribute("errorMsg", "出现异常,异常信息:" + e.getMessage());
        return ComNames.CLIENTFW_ERRORPAGE;
    }
    // 跳转客户端首页
    return "clientFW/index";
}
Also used : HttpSession(javax.servlet.http.HttpSession) AppBean(com.itrus.portal.entity.AppBean) Records(com.itrus.portal.entity.Records) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) ParseException(java.text.ParseException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) SigningServerException(com.itrus.cryptorole.SigningServerException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException)

Example 2 with AppBean

use of com.itrus.portal.entity.AppBean in project portal by ixinportal.

the class AppServiceImpl method getAppList.

/**
 * 根据项目id返回应用管理和增值应用的相关信息
 * @param id
 * @param type 类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
 * @return
 */
public List<AppBean> getAppList(Long id, String type) throws Exception {
    // 查询当前项目下的应用信息
    List<AppBean> appBeanList = new ArrayList<>();
    List<ExtraProduct> extraProductList = null;
    AppExample appExample = new AppExample();
    AppExample.Criteria ac = appExample.createCriteria();
    ac.andProjectEqualTo(id);
    if ("1".equals(type)) {
        ac.andPcEqualTo(true);
    } else if (("2".equals(type))) {
        ac.andWindowsEqualTo(true);
    } else if (("3".equals(type))) {
        // TODO 未区分app 默认为安卓
        ac.andAndroidEqualTo(true);
    }
    List<App> appList = sqlSession.selectList("com.itrus.portal.db.AppMapper.selectByExample", appExample);
    // 查询当前项目下增值应用信息
    List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(id, type);
    // 增值应用集合
    if (extraProductReleases != null) {
        extraProductList = extraProductService.getproductByEPR(extraProductReleases);
    }
    if (appList != null) {
        for (App app : appList) {
            AppBean appBean = new AppBean();
            appBean.setType("1");
            appBean.setName(app.getName());
            appBean.setAppId(app.getId());
            appBean.setUrl(app.getAppUrl());
            appBean.setOpenType(app.getOpenType());
            appBean.setShortName(app.getShortName());
            appBeanList.add(appBean);
        }
    }
    // }
    return appBeanList;
}
Also used : App(com.itrus.portal.db.App) ExtraProduct(com.itrus.portal.db.ExtraProduct) ExtraProductRelease(com.itrus.portal.db.ExtraProductRelease) ArrayList(java.util.ArrayList) AppBean(com.itrus.portal.entity.AppBean) AppExample(com.itrus.portal.db.AppExample)

Aggregations

AppBean (com.itrus.portal.entity.AppBean)2 SigningServerException (com.itrus.cryptorole.SigningServerException)1 App (com.itrus.portal.db.App)1 AppExample (com.itrus.portal.db.AppExample)1 ExtraProduct (com.itrus.portal.db.ExtraProduct)1 ExtraProductRelease (com.itrus.portal.db.ExtraProductRelease)1 Records (com.itrus.portal.entity.Records)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 IOException (java.io.IOException)1 CertificateException (java.security.cert.CertificateException)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 HttpSession (javax.servlet.http.HttpSession)1 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1