Search in sources :

Example 1 with UdcDomainExample

use of com.itrus.portal.sql.UdcDomainExample in project portal by ixinportal.

the class ActivityCollectService method isNeedUpdateCertInfo.

/**
 * 判断是否需要更新用户所需证书信息
 *
 * @param uid
 * @param endTime
 * @return 当且仅当存在用户信息,并且主证书时间小于UKEY当前证书时间时,返回true
 */
private boolean isNeedUpdateCertInfo(String uid, long endTime) {
    boolean ret = false;
    if (StringUtils.isBlank(uid) || endTime <= 0)
        return ret;
    UdcDomainExample udcdExample = new UdcDomainExample();
    UdcDomainExample.Criteria udcdCriteria = udcdExample.or();
    udcdCriteria.andCertEqualToUdcUserCert();
    udcdCriteria.andUserEqualToUdcUser();
    udcdCriteria.andUserUniqueEqualTo(uid);
    udcdCriteria.andIsMasterEqualTo(true);
    udcdCriteria.andIsRevokedEqualTo(false);
    UserCert userCert = sqlSession.selectOne("com.itrus.ukey.sql.UdcDomainMapper.selectCertByExample", udcdExample);
    if (userCert != null && userCert.getCertEndTime().getTime() < endTime)
        ret = true;
    return ret;
}
Also used : UdcDomainExample(com.itrus.portal.sql.UdcDomainExample) UserCert(com.itrus.portal.db.UserCert)

Example 2 with UdcDomainExample

use of com.itrus.portal.sql.UdcDomainExample in project portal by ixinportal.

the class RecordHanderController method isNeedUpdateCertInfo.

/**
 * 判断是否需要更新用户所需证书信息
 *
 * @param uid
 * @param endTime
 * @return 当且仅当存在用户信息,并且主证书时间小于UKEY当前证书时间时,返回true
 */
private boolean isNeedUpdateCertInfo(String uid, long endTime) {
    boolean ret = false;
    if (StringUtils.isBlank(uid) || endTime <= 0)
        return ret;
    UdcDomainExample udcdExample = new UdcDomainExample();
    UdcDomainExample.Criteria udcdCriteria = udcdExample.or();
    udcdCriteria.andCertEqualToUdcUserCert();
    udcdCriteria.andUserEqualToUdcUser();
    udcdCriteria.andUserUniqueEqualTo(uid);
    udcdCriteria.andIsMasterEqualTo(true);
    udcdCriteria.andIsRevokedEqualTo(false);
    UserCert userCert = sqlSession.selectOne("com.itrus.portal.sql.UdcDomainMapper.selectCertByExample", udcdExample);
    if (userCert != null && userCert.getCertEndTime().getTime() < endTime)
        ret = true;
    return ret;
}
Also used : UdcDomainExample(com.itrus.portal.sql.UdcDomainExample)

Example 3 with UdcDomainExample

use of com.itrus.portal.sql.UdcDomainExample in project portal by ixinportal.

the class ActMsgCollectService method mMsgCollect.

public int mMsgCollect(MActivityCollectParam macParam) throws MobileHandlerServiceException {
    // 先根据certsn查询所属项目
    UdcDomainExample udcdExample = new UdcDomainExample();
    UdcDomainExample.Criteria udcdCriteria = udcdExample.or();
    udcdCriteria.andCertEqualToUdcUserCert();
    udcdCriteria.andUserEqualToUdcUser();
    udcdCriteria.andDeviceEqualToUdcDevice();
    udcdCriteria.andIsMasterEqualTo(false);
    udcdCriteria.andIsRevokedEqualTo(false);
    // 证书序列号采用统一方式存储,所以这里进行一次转换
    udcdCriteria.andCertSnEqualTo(CertUtilsOfUkey.getValidSerialNumber(macParam.getCertSn()));
    String runStatus = macParam.getRunStatus();
    if (StringUtils.isBlank(runStatus) || !runStatus.matches("[0,1,2]"))
        throw new MobileHandlerServiceException("错误的程序状态标识");
    UdcDomain udcDomain = sqlSession.selectOne("com.itrus.ukey.sql.UdcDomainMapper.selectUdcByExample", udcdExample);
    if (udcDomain == null || udcDomain.getProject() == null)
        throw new MobileHandlerServiceException("无法查询到关联项目");
    ActivityMsgTemp am = new ActivityMsgTemp();
    am.setProject(udcDomain.getProject());
    am.setUkeyVersion(macParam.getSoftVersion());
    am.setKeySn(macParam.getHostID());
    am.setCertCn(macParam.getCertCn());
    am.setThreadId(macParam.getRuningId());
    am.setOsType(macParam.getDeviceType().toLowerCase());
    try {
        setAmTimes(am, runStatus, macParam.getLifeTime());
        // 将活动信息添加到消息队列中
        queueThread.putObjectQueue(am);
    } catch (ServiceNullException e) {
    // TODO... 什么也不需要处理
    }
    return 0;
}
Also used : UdcDomainExample(com.itrus.portal.sql.UdcDomainExample) MobileHandlerServiceException(com.itrus.portal.exception.MobileHandlerServiceException) ActivityMsgTemp(com.itrus.portal.db.ActivityMsgTemp) UdcDomain(com.itrus.portal.sql.UdcDomain) ServiceNullException(com.itrus.portal.exception.ServiceNullException)

Aggregations

UdcDomainExample (com.itrus.portal.sql.UdcDomainExample)3 ActivityMsgTemp (com.itrus.portal.db.ActivityMsgTemp)1 UserCert (com.itrus.portal.db.UserCert)1 MobileHandlerServiceException (com.itrus.portal.exception.MobileHandlerServiceException)1 ServiceNullException (com.itrus.portal.exception.ServiceNullException)1 UdcDomain (com.itrus.portal.sql.UdcDomain)1