Search in sources :

Example 6 with ServiceNullException

use of com.itrus.portal.exception.ServiceNullException in project portal by ixinportal.

the class ActMsgCollectService method recordMsg.

/**
 * PC端软件活动信息记录
 *
 * @param keySn
 * @param certSn
 * @param threadId
 * @param lifeTime
 * @param runStatus
 * @param activityParam
 * @return
 */
public void recordMsg(String keySn, String certSn, String threadId, String lifeTime, String runStatus, ActivityParam activityParam) {
    ProjectKeyInfo pkInfo = cacheCustomer.findProjectByKey(keySn.trim());
    // 若找不到相关项目信息,则使用默认项目
    ActivityMsgTemp am = new ActivityMsgTemp();
    if (null != pkInfo && !"".equals(certSn)) {
        am.setProject(pkInfo.getProject());
        am.setHostId(activityParam.getHostId());
        am.setUkeyVersion(activityParam.getUkeyVersion());
        am.setKeySn(keySn);
        am.setCertCn(certSn);
        am.setProcessId(activityParam.getProcessId());
        am.setThreadId(activityParam.getWinId());
        am.setOsType(ComNames.OS_WINDOWS);
    }
    try {
        setAmTimes(am, runStatus, Long.parseLong(lifeTime));
        // 将活动信息添加到消息队列中
        queueThread.putObjectQueue(am);
    } catch (ServiceNullException e) {
    }
}
Also used : ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) ActivityMsgTemp(com.itrus.portal.db.ActivityMsgTemp) ServiceNullException(com.itrus.portal.exception.ServiceNullException)

Example 7 with ServiceNullException

use of com.itrus.portal.exception.ServiceNullException in project portal by ixinportal.

the class RealNameAuthenticationController method update.

// 修改处理
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String update(RealNameAuthentication realName, @RequestParam(value = "status", required = false) Integer status, Model uiModel) {
    if (realName.getId() == null) {
        realName.setType(status);
        try {
            realnameauthent.addRealName(realName);
        } catch (ServiceNullException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        if (realName != null && realName.getCertificate() != null) {
            if (!"realName.certificate".equals(realName.getCertificate())) {
                String result = null;
                try {
                    sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
                    byte[] bt = decoder.decodeBuffer(realName.getCertificate());
                    result = new String(bt, "utf-8");
                    result = result.replaceAll("-----BEGIN CERTIFICATE-----", "").replaceAll("-----END CERTIFICATE-----", "").replaceAll("\r", "").replaceAll("\n", "");
                    // System.out.println(result);
                    realName.setCertificate(result);
                    UserCert usercert = CertUtil.getCertFromBase64(result);
                    ;
                    String certDn = usercert.getCertDn();
                    EvidenceCert evidenceCert = new EvidenceCert();
                    evidenceCert.setCertBase64(result);
                    evidenceCert.setCertSerialnumber(usercert.getCertSn());
                    evidenceCert.setCreateTime(new Date());
                    evidenceCert.setEndTime(usercert.getCertEndTime());
                    if (usercert.getCertBuf() != null) {
                        evidenceCert.setEvidenceBuf(usercert.getCertBuf().toString());
                    }
                    evidenceCert.setIssuerdn(usercert.getIssuerDn());
                    evidenceCert.setStartTime(usercert.getCertStartTime());
                    evidenceCert.setSubjectdn(usercert.getCertDn());
                    sqlSession.insert("com.itrus.portal.db.EvidenceCertMapper.insertSelective", evidenceCert);
                    if (evidenceCert.getId() != null) {
                        realName.setCertificateCn(evidenceCert.getId().toString());
                    }
                } catch (CertificateException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (SigningServerException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } else {
                realName.setCertificate(null);
            }
        }
        try {
            realnameauthent.updateRealName(realName);
        } catch (ServiceNullException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    // 通知其他机器,加载缓存
    EvidenceCertificationChargingHandler cch = new EvidenceCertificationChargingHandler();
    cch.setType(2);
    QueueThread.buildCertificationTask(cch);
    cacheCustomer.initEvidence(2);
    return "redirect:/realname";
}
Also used : UnsupportedEncodingException(java.io.UnsupportedEncodingException) CertificateException(java.security.cert.CertificateException) EvidenceCertificationChargingHandler(com.itrus.portal.evidence.service.EvidenceCertificationChargingHandler) ServiceNullException(com.itrus.portal.exception.ServiceNullException) IOException(java.io.IOException) ServiceNullException(com.itrus.portal.exception.ServiceNullException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) SigningServerException(com.itrus.cryptorole.SigningServerException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Date(java.util.Date) EvidenceCert(com.itrus.portal.db.EvidenceCert) SigningServerException(com.itrus.cryptorole.SigningServerException) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ServiceNullException

use of com.itrus.portal.exception.ServiceNullException in project portal by ixinportal.

the class ReceiptConfigController method update.

// 修改/新建处理
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String update(ReceiptConfig receiptconfig, Model uiModel) {
    try {
        if (receiptconfig.getId() == null) {
            if (receiptconfig == null) {
                throw new ServiceNullException("要添加第三方开票配置为空");
            }
            receiptconfig.setCreateTime(new Date());
            sqlSession.insert("com.itrus.portal.db.ReceiptConfigMapper.insert", receiptconfig);
        } else {
            if (receiptconfig == null || receiptconfig.getId() == null)
                throw new ServiceNullException("要更新第三方开票配置为空");
            ReceiptConfig receiptconfig1 = sqlSession.selectOne("com.itrus.portal.db.ReceiptConfigMapper.selectByPrimaryKey", receiptconfig.getId());
            if (receiptconfig1 == null)
                throw new ServiceNullException("要更新第三方开票配置不存在");
            sqlSession.update("com.itrus.portal.db.ReceiptConfigMapper.updateByPrimaryKeySelective", receiptconfig);
        }
    } catch (Exception e) {
        uiModel.addAttribute("errMsg", e.getMessage());
    }
    String oper = "添加第三方开票配置";
    String info = "第三方开票配置名称: " + receiptconfig.getPlatformName();
    LogUtil.adminlog(sqlSession, oper, info);
    return "redirect:/receiptconfig";
}
Also used : ServiceNullException(com.itrus.portal.exception.ServiceNullException) Date(java.util.Date) ServiceNullException(com.itrus.portal.exception.ServiceNullException) ReceiptConfig(com.itrus.portal.db.ReceiptConfig)

Example 9 with ServiceNullException

use of com.itrus.portal.exception.ServiceNullException in project portal by ixinportal.

the class SmsGateController method create.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String create(@RequestParam(value = "id", required = false) Long id, Model uiModel) {
    if (id == null) {
        return "smsgate/create";
    }
    try {
        SmsGate smsGate = smsGateService.getSmsGateById(id);
        uiModel.addAttribute("smsgate", smsGate);
    } catch (ServiceNullException e) {
        uiModel.addAttribute("errMsg", e.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        uiModel.addAttribute("errMsg", "解密密码失败");
    }
    return "smsgate/create";
}
Also used : ServiceNullException(com.itrus.portal.exception.ServiceNullException) ServiceNullException(com.itrus.portal.exception.ServiceNullException) SmsGate(com.itrus.portal.db.SmsGate) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with ServiceNullException

use of com.itrus.portal.exception.ServiceNullException 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

ServiceNullException (com.itrus.portal.exception.ServiceNullException)15 Date (java.util.Date)7 ActivityMsgTemp (com.itrus.portal.db.ActivityMsgTemp)3 File (java.io.File)3 IOException (java.io.IOException)3 SmsGate (com.itrus.portal.db.SmsGate)2 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)2 FileOutputStream (java.io.FileOutputStream)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 MultipartFile (org.springframework.web.multipart.MultipartFile)2 SigningServerException (com.itrus.cryptorole.SigningServerException)1 ActivityMsgTempExample (com.itrus.portal.db.ActivityMsgTempExample)1 EditBill (com.itrus.portal.db.EditBill)1 EmailServer (com.itrus.portal.db.EmailServer)1 EvidenceCert (com.itrus.portal.db.EvidenceCert)1 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)1 RealNameAuthentication (com.itrus.portal.db.RealNameAuthentication)1 ReceiptConfig (com.itrus.portal.db.ReceiptConfig)1 SysRegion (com.itrus.portal.db.SysRegion)1 SysRegionExample (com.itrus.portal.db.SysRegionExample)1