use of com.itrus.portal.evidence.service.EvidenceCertificationChargingHandler in project portal by ixinportal.
the class ServiceConfigurationController method save.
// 添加/修改处理
@RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String save(EvidenceServiceConfiguration serviceconfig, Model uiModel) throws Exception {
// uiModel.addAttribute("projects", getProjectMapOfAdmin().values());
if (null == serviceconfig.getId()) {
// 添加
sqlSession.insert("com.itrus.portal.db.EvidenceServiceConfigurationMapper.insert", serviceconfig);
Long sid = Long.valueOf(serviceconfig.getSignatureCertificate().toString());
Long eid = Long.valueOf(serviceconfig.getEncryptionCertificate().toString());
EvidenceCertificate scertif = certificateService.selectById(sid);
scertif.setIsCertificate(1);
certificateService.update(scertif);
EvidenceCertificate ecertif = certificateService.selectById(eid);
ecertif.setIsCertificate(1);
certificateService.update(ecertif);
} else {
// 修改
sqlSession.update("com.itrus.portal.db.EvidenceServiceConfigurationMapper.updateByPrimaryKeySelective", serviceconfig);
Long sid = Long.valueOf(serviceconfig.getSignatureCertificate().toString());
Long eid = Long.valueOf(serviceconfig.getEncryptionCertificate().toString());
EvidenceCertificate scertif = certificateService.selectById(sid);
scertif.setIsCertificate(1);
certificateService.update(scertif);
EvidenceCertificate ecertif = certificateService.selectById(eid);
ecertif.setIsCertificate(1);
certificateService.update(ecertif);
}
// 通知其他机器,加载缓存
EvidenceCertificationChargingHandler cch = new EvidenceCertificationChargingHandler();
cch.setType(1);
QueueThread.buildCertificationTask(cch);
cacheCustomer.initEvidence(1);
return "redirect:/serviceconfiguration";
}
use of com.itrus.portal.evidence.service.EvidenceCertificationChargingHandler 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.evidence.service.EvidenceCertificationChargingHandler in project portal by ixinportal.
the class ServiceConfigurationController method create.
// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String create(@RequestParam(value = "id", required = false) Long id, Model uiModel) {
if (id == null) {
List<EvidenceCertificate> configuration = sqlSession.selectList("com.itrus.portal.db.EvidenceCertificateMapper.selectByExample");
// System.out.println(configuration.size());
uiModel.addAttribute("configuration", configuration);
return "serviceconfiguration/create";
}
try {
List<EvidenceCertificate> configuration = sqlSession.selectList("com.itrus.portal.db.EvidenceCertificateMapper.selectByExample");
uiModel.addAttribute("configuration", configuration);
EvidenceServiceConfiguration serviceconfig = sqlSession.selectOne("com.itrus.portal.db.EvidenceServiceConfigurationMapper.selectByPrimaryKey", id);
uiModel.addAttribute("serviceconfig", serviceconfig);
} catch (Exception e) {
e.printStackTrace();
}
// 通知其他机器,加载缓存
EvidenceCertificationChargingHandler cch = new EvidenceCertificationChargingHandler();
cch.setType(1);
QueueThread.buildCertificationTask(cch);
cacheCustomer.initEvidence(1);
return "serviceconfiguration/create";
}
Aggregations