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) {
}
}
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";
}
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";
}
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";
}
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;
}
Aggregations