Search in sources :

Example 1 with MobileCertificate

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

the class MobileCertificateService method revokeCert.

public MobileCertificate revokeCert(Long mobileCerId) throws MalformedURLException, RaServiceUnavailable_Exception, RaServiceUnavailable {
    Integer statu = 1;
    MobileCertificate certificate = sqlSession.selectOne("com.itrus.portal.db.MobileCertificateMapper.selectByPrimaryKey", mobileCerId);
    Long applyConfigId = certificate.getApplyConfigId();
    MobileApplyConfigManage applyConfigManage = sqlSession.selectOne("com.itrus.portal.db.MobileApplyConfigManageMapper.selectByPrimaryKey", applyConfigId);
    RaAccount account = sqlSession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByPrimaryKey", applyConfigManage.getRaaccountId());
    if (certificate.getLoseefficacyTime().before(new Date()) || statu == certificate.getCertificateStatus()) {
    // 不需要吊销
    } else if (ComNames.RA_PROTOCOL_API.equals(account.getRaProtocol())) {
        revokeCertByApi(account, certificate);
    } else if (ComNames.RA_PROTOCOL_WS.equals(account.getRaProtocol())) {
        revokeCertByWs(account, certificate);
    }
    certificate.setCertificateStatus(1);
    sqlSession.update("com.itrus.portal.db.MobileCertificateMapper.updateByPrimaryKeySelective", certificate);
    return certificate;
}
Also used : MobileCertificate(com.itrus.portal.db.MobileCertificate) RaAccount(com.itrus.portal.db.RaAccount) Date(java.util.Date) MobileApplyConfigManage(com.itrus.portal.db.MobileApplyConfigManage)

Example 2 with MobileCertificate

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

the class MobileCertificateController method debLock.

// 解锁证书
@RequestMapping(value = "/deblocking/{id}", produces = "text/html")
@ResponseBody
public String debLock(@PathVariable("id") Long id, @PathVariable("id") Long eid, RedirectAttributes model, Model uiModel) {
    MobileCertificateExample certificateExample = new MobileCertificateExample();
    MobileCertificateExample.Criteria criteria = certificateExample.createCriteria();
    // if(id!=null){
    criteria.andIdEqualTo(id);
    // }
    MobileCertificate certificate = mobileCertificateService.selectByExample(certificateExample);
    if (certificate != null) {
        // certificate.setId(id);
        certificate.setLockStatus(0);
        certificate.setDeblockingTime(new Date());
        mobileCertificateService.updateCertificate(certificate);
        // model.addFlashAttribute("info","解锁成功");
        return null;
    }
    return null;
}
Also used : MobileCertificate(com.itrus.portal.db.MobileCertificate) MobileCertificateExample(com.itrus.portal.db.MobileCertificateExample) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with MobileCertificate

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

the class MobileCertificateController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    MobileCertificate certificate = mobileCertificateService.selectById(id);
    uiModel.addAttribute("certificate", certificate);
    if (certificate.getAppId() != null) {
        ApplicationInfo app = mobileCertificateService.selectByAppId(certificate.getAppId());
        uiModel.addAttribute("app", app);
    }
    if (certificate.getUserId() != null) {
        MobileUser mobileUser = mobileCertificateService.selectByUserId(certificate.getUserId());
        uiModel.addAttribute("mobileUser", mobileUser);
    }
    if (certificate.getApplyConfigId() != null) {
        MobileApplyConfigManage applyConfigManage = mobileCertificateService.selectByMobileApplyConfigId(certificate.getApplyConfigId());
        uiModel.addAttribute("applyConfigManage", applyConfigManage);
    }
    return "mobilecertificate/show";
}
Also used : MobileCertificate(com.itrus.portal.db.MobileCertificate) ApplicationInfo(com.itrus.portal.db.ApplicationInfo) MobileUser(com.itrus.portal.db.MobileUser) MobileApplyConfigManage(com.itrus.portal.db.MobileApplyConfigManage) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with MobileCertificate

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

the class MobileCertificateController method list.

@RequestMapping(produces = "text/html")
public String list(// ("info") String info,
@ModelAttribute("info") String info, // @RequestParam(value = "message", required = false) Integer message,
@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "appName", required = false) String appName, @RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "sequenceNumber", required = false) String sequenceNumber, @RequestParam(value = "certificateCn", required = false) String certificateCn, @RequestParam(value = "passType", required = false) String passType, @RequestParam(value = "lockStatus", required = false) Integer lockStatus, @RequestParam(value = "certificateStatus", required = false) Integer certificateStatus, @RequestParam(value = "queryDate11", required = false) Date queryDate11, @RequestParam(value = "queryDate12", required = false) Date queryDate12, @RequestParam(value = "queryDate21", required = false) Date queryDate21, @RequestParam(value = "queryDate22", required = false) Date queryDate22, // HttpServletRequest httpServletRequest,
Model uiModel) {
    if (queryDate11 == null && queryDate12 == 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);
        queryDate12 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate11 = calendar.getTime();
    }
    /*if(queryDate21==null&&queryDate22==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);
			queryDate22 = calendar.getTime();
			calendar.add(Calendar.MILLISECOND, 1);
			calendar.add(Calendar.MONTH, -1);
			queryDate21 = calendar.getTime();   
		}*/
    // 返回搜索条件
    // uiModel.addAttribute("eid1",eid1);
    // uiModel.addAttribute("eid",                    eid);
    uiModel.addAttribute("appName", appName);
    uiModel.addAttribute("userId", userId);
    uiModel.addAttribute("passType", passType);
    uiModel.addAttribute("lockStatus", lockStatus);
    uiModel.addAttribute("queryDate12", queryDate12);
    uiModel.addAttribute("queryDate11", queryDate11);
    uiModel.addAttribute("queryDate22", queryDate22);
    uiModel.addAttribute("queryDate21", queryDate21);
    uiModel.addAttribute("sequenceNumber", sequenceNumber);
    uiModel.addAttribute("certificateCn", certificateCn);
    uiModel.addAttribute("certificateStatus", certificateStatus);
    Map<String, Object> param = new HashMap<String, Object>();
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    if (StringUtils.isNotEmpty(userId)) {
        param.put("userId", "%" + userId + "%");
    }
    if (StringUtils.isNotEmpty(appName)) {
        param.put("appName", "%" + appName + "%");
    }
    if (StringUtils.isNotEmpty(sequenceNumber)) {
        param.put("sequenceNumber", "%" + sequenceNumber + "%");
    }
    if (StringUtils.isNotEmpty(certificateCn)) {
        param.put("certificateCn", "%" + certificateCn + "%");
    }
    if (StringUtils.isNotEmpty(passType)) {
        param.put("passType", passType);
    }
    if (lockStatus != null) {
        param.put("lockStatus", lockStatus);
    }
    if (certificateStatus != null) {
        param.put("certificateStatus", certificateStatus);
    }
    if (queryDate11 != null) {
        param.put("queryDate11", queryDate11);
    }
    if (queryDate12 != null) {
        param.put("queryDate12", queryDate12);
    }
    if (queryDate21 != null) {
        param.put("queryDate21", queryDate21);
    }
    if (queryDate22 != null) {
        param.put("queryDate22", queryDate22);
    }
    Map param1 = new HashMap();
    MobileCertificate mobileCertificate = new MobileCertificate();
    mobileCertificate.setCertificateStatus(1);
    param1.put("record", mobileCertificate);
    param1.put("_parameter", 1);
    MobileCertificateExample example = new MobileCertificateExample();
    MobileCertificateExample.Criteria criteria = example.createCriteria();
    criteria.andLoseefficacyTimeLessThan(new Date());
    param1.put("example", example);
    mobileCertificateService.update(param1);
    // sqlSession.update("com.itrus.portal.db.MobileCertificateMapper.updateByExampleSelective", param1);
    Integer count = sqlSession.selectOne("com.itrus.portal.db.MobileCertificateMapper.selectCount", param);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    Integer offset = size * (page - 1);
    param.put("offset", offset);
    param.put("limit", size);
    param.put("desc", "desc");
    List certificates = sqlSession.selectList("com.itrus.portal.db.MobileCertificateMapper.MobileCertificateList", param);
    uiModel.addAttribute("certificates", certificates);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("lockError", info);
    // uiModel.addAttribute("lockError",message==null?"":"该证书没有应用配置");
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    return "mobilecertificate/list";
}
Also used : HashMap(java.util.HashMap) MobileCertificate(com.itrus.portal.db.MobileCertificate) Calendar(java.util.Calendar) MobileCertificateExample(com.itrus.portal.db.MobileCertificateExample) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with MobileCertificate

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

the class EquipmentManagementController method debLock.

// 解锁证书
@RequestMapping(value = "/deblocking/{id}", produces = "text/html")
@ResponseBody
public String debLock(@PathVariable("id") Long id, @PathVariable("id") Long eid, RedirectAttributes model, Model uiModel) {
    MobileCertificateExample certificateExample = new MobileCertificateExample();
    MobileCertificateExample.Criteria criteria = certificateExample.createCriteria();
    // if(id!=null){
    criteria.andIdEqualTo(id);
    // }
    MobileCertificate certificate = mobileCertificateService.selectByExample(certificateExample);
    if (certificate != null) {
        // certificate.setId(id);
        certificate.setLockStatus(0);
        certificate.setDeblockingTime(new Date());
        mobileCertificateService.updateCertificate(certificate);
        // model.addFlashAttribute("info","解锁成功");
        return null;
    }
    return null;
}
Also used : MobileCertificate(com.itrus.portal.db.MobileCertificate) MobileCertificateExample(com.itrus.portal.db.MobileCertificateExample) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

MobileCertificate (com.itrus.portal.db.MobileCertificate)12 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 MobileCertificateExample (com.itrus.portal.db.MobileCertificateExample)7 Date (java.util.Date)7 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 MobileUser (com.itrus.portal.db.MobileUser)3 MobileApplyConfigManage (com.itrus.portal.db.MobileApplyConfigManage)2 Calendar (java.util.Calendar)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 JSONObject (com.alibaba.fastjson.JSONObject)1 ApplicationInfo (com.itrus.portal.db.ApplicationInfo)1 MobileRiskStatisticsLog (com.itrus.portal.db.MobileRiskStatisticsLog)1 RaAccount (com.itrus.portal.db.RaAccount)1 MobileService (com.itrus.portal.mobile.service.MobileService)1 ArrayList (java.util.ArrayList)1