Search in sources :

Example 1 with Records

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

the class RecordController method month.

@RequestMapping("/month")
@ResponseBody
public String month(String enterpriseName, String keySn) {
    Map<String, Object> param = new HashMap<>();
    Calendar calendar = Calendar.getInstance();
    // 今天日期
    Date queryDate2 = calendar.getTime();
    // 当月第一天 的0时0分0秒
    calendar.add(Calendar.MONTH, 0);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    Date queryDate1 = calendar.getTime();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -6);
    // 前6个月
    Date queryDate = cal.getTime();
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    param.put("queryDate", queryDate);
    param.put("enterpriseName", enterpriseName);
    param.put("keySn", keySn);
    Records records = new Records();
    List<RecordData> recordData = new ArrayList<>();
    List<RecordData> srecordData = new ArrayList<>();
    // 处理安全在线数据
    dealOnLine(param, records, recordData, srecordData);
    // 处理签名记录数据
    dealSignature(param, records, recordData, srecordData);
    // 处理环境检测数据
    dealCondition(param, records, recordData, srecordData);
    records.setRecordData(recordData);
    records.setSrecordData(srecordData);
    return JSON.toJSON(records).toString();
}
Also used : RecordData(com.itrus.portal.entity.RecordData) Records(com.itrus.portal.entity.Records) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with Records

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

the class SignatureRecordService method getRecord.

/**
 * 传入企业名称获取相对应的安全在线、签名记录、环境检测信息
 * @param enterpriseName
 * @return
 */
public Records getRecord(Long enterpriseName) {
    Map<String, Object> param = new HashMap<>();
    Calendar calendar = Calendar.getInstance();
    // 今天日期
    Date queryDate2 = calendar.getTime();
    // 当月第一天
    calendar.add(Calendar.MONTH, 0);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    Date queryDate1 = calendar.getTime();
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MONTH, -6);
    // 前6个月
    Date queryDate = cal.getTime();
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    param.put("queryDate", queryDate);
    param.put("enterpriseName", enterpriseName);
    Records records = new Records();
    List<RecordData> recordData = new ArrayList<>();
    List<RecordData> srecordData = new ArrayList<>();
    dealOnLine(param, records, recordData, srecordData);
    dealSignature(param, records, recordData, srecordData);
    dealCondition(param, records, recordData, srecordData);
    records.setRecordData(recordData);
    records.setSrecordData(srecordData);
    return records;
}
Also used : RecordData(com.itrus.portal.entity.RecordData) Records(com.itrus.portal.entity.Records)

Example 3 with Records

use of com.itrus.portal.entity.Records 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)

Aggregations

Records (com.itrus.portal.entity.Records)3 RecordData (com.itrus.portal.entity.RecordData)2 SigningServerException (com.itrus.cryptorole.SigningServerException)1 AppBean (com.itrus.portal.entity.AppBean)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 IOException (java.io.IOException)1 CertificateException (java.security.cert.CertificateException)1 ParseException (java.text.ParseException)1 HttpSession (javax.servlet.http.HttpSession)1 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1