use of com.itrus.portal.db.UserCert in project portal by ixinportal.
the class CustomerServerClientController method onLine.
/**
* 用户登录后的客服在线
* @param certSn
* @param keySn
* @param enterpriseName
* @param session
* @param uiModel
* @return
*/
@RequestMapping("/online")
public String onLine(@RequestParam(value = "certSn", required = false) String certSn, @RequestParam(value = "keySn", required = false) String keySn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, HttpSession session, Model uiModel) {
// TODO
Boolean verifyCodeStatus = (Boolean) session.getAttribute(ComNames.WEB_VERIFY_CODE_STATUS);
Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
UserInfo userInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
if (null == verifyCodeStatus || !verifyCodeStatus || null == userInfo) {
// 登录状态失效,跳转到登录页面
return ComNames.DENG_LU_CLIENT;
}
// 先根据key序列号取项目,若没有,则根据用户所属项目取项目信息
Project project = null;
if (StringUtils.isNotBlank(keySn)) {
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别的key序列号:" + keySn + ", 请联系系统管理员进行配置");
return ComNames.CLIENTFW_ERRORPAGE;
}
project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
}
// 若项目为Null,而certsn不为null,则尝试从数据库获取keysn,查找项目
if (null == project && StringUtils.isNotBlank(certSn)) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null != userCert && StringUtils.isNotBlank(userCert.getKeySn())) {
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(userCert.getKeySn());
if (null != projectKeyInfo) {
project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
}
}
}
if (null == project) {
project = projectService.selectByPrimaryKey(userInfo.getProject());
}
Map<String, String> map = questionService.auth(project.getId());
if (map != null && !map.isEmpty()) {
uiModel.addAttribute("qq", map.get("qq"));
uiModel.addAttribute("phone", map.get("phone"));
uiModel.addAttribute("questionUrl", map.get("questionUrl"));
uiModel.addAttribute("downloadUrl", map.get("downloadUrl"));
}
return "clientFW/kefuzaixian";
}
use of com.itrus.portal.db.UserCert in project portal by ixinportal.
the class DoUnlockKeyController method toDoUnlockPage.
/**
* 执行证书解锁的页面
*
* @param billId
* @param uiModel
* @return
*/
@RequestMapping("/toDoUnlockPage")
public String toDoUnlockPage(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "无法识别该证书,请检查您插入的key是否正确!");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null == userCert.getUserinfo() || null == userCert.getEnterprise()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户或企业");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
Bill bill = billService.getBill(billId);
if (null == bill) {
uiModel.addAttribute("errorMsg", "不存在解锁订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
if (!bill.getUnlockUserCert().equals(userCert.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
Proxy proxy = proxyService.getProxyByBillId(bill.getId());
Product product = productService.getProduct(bill.getProduct());
UserInfo userInfo = userInfoService.selectByPrimaryKey(bill.getUniqueId());
uiModel.addAttribute("mPhone", userInfo.getmPhone());
uiModel.addAttribute("userCert", userCert);
uiModel.addAttribute("product", product);
uiModel.addAttribute("bill", bill);
if (null != proxy) {
// 授权书不一定有
uiModel.addAttribute("proxy", proxy);
}
// TODO 解锁订单信息页面
return "clientFW/zhengshujiesuo";
}
use of com.itrus.portal.db.UserCert in project portal by ixinportal.
the class DoUnlockKeyController method toUnlockKeyPage.
/**
* key已经申请了解锁订单,跳转解锁页面
* 1.订单处于未支付,则跳转支付页面
* 2.订单处于已支付,待解锁审批,则跳转查询页面
* 3.订单为审批拒绝,跳转审核拒绝重新提交页面
* 4.订单为审批通过,待解锁,跳转解锁页面
* 5.订单为解锁异常,则跳转解锁异常页面
* 6.订单为解锁完成,则跳转解锁完成页面
* @param certSn
* @param keySn
* @param enterpriseName
* @param uiModel
* @return
*/
@RequestMapping("/toUnlockKeyPage")
public String toUnlockKeyPage(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel, HttpSession session) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "无法识别该证书,请检查您插入的key是否正确!");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null== userCert.getUserinfo() || null == userCert.getEnterprise()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户或企业");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
Bill bill = billService.getBill(billId);
if (null == bill) {
uiModel.addAttribute("errorMsg", "不存在解锁订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
if (!bill.getUnlockUserCert().equals(userCert.getId())) {
uiModel.addAttribute("errorMsg", "您无权操作该订单");
return ComNames.CLIENTFW_ERRORPAGE;
}
Proxy proxy = proxyService.getProxyByBillId(bill.getId());
Product product = productService.getProduct(bill.getProduct());
UserInfo userInfo = userInfoService.selectByPrimaryKey(bill.getUniqueId());
OnPayInfo onPayInfo = onPayInfoService.selectByPrimaryKey(bill.getOnPayInfo());
Enterprise enterprise = enterpriseService.getEnterpriseById(bill.getEnterprise());
// UserInfo webUserInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
if (null == session.getAttribute(ComNames.WEB_USER_INFO)) {
session.setAttribute(ComNames.WEB_USER_INFO, userInfo);
}
uiModel.addAttribute("mPhone", userInfo.getmPhone());
uiModel.addAttribute("userCert", userCert);
uiModel.addAttribute("keySn", userCert.getKeySn());
uiModel.addAttribute("certSn", userCert.getCertSn());
uiModel.addAttribute("product", product);
uiModel.addAttribute("bill", bill);
uiModel.addAttribute("onPayInfo", onPayInfo);
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("enterpriseName", enterprise != null ? enterprise.getEnterpriseName() : "");
if (null != proxy) {
// 授权书不一定有
uiModel.addAttribute("proxy", proxy);
}
if (bill.getBillStatus().equals(ComNames.BILL_STATUS_1)) {
// * 1.订单处于未支付,则跳转支付页面 OK
return "redirect:/unlockKeyBill/zhifu/" + billId;
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_14)) {
// * 2.订单处于已支付,待解锁审批,则跳转查询页面,
return "clientFW/dengdaishenhe_unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_15)) {
// * 3.订单为审批拒绝,跳转审核拒绝重新提交页面
return "clientFW/dengdaishenhe_unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_16)) {
// * 4.订单为审批通过,待解锁,跳转解锁页面
return "clientFW/unlock";
} else if (bill.getBillStatus().equals(ComNames.BILL_STATUS_17)) {
// * 5.订单为解锁异常,则跳转解锁异常页面
return "redirect:/doUnlockKey/toUnlockFailPage/" + billId;
} else {
uiModel.addAttribute("errorMsg", "订单不处于解锁状态");
return ComNames.CLIENTFW_ERRORPAGE;
}
}
use of com.itrus.portal.db.UserCert in project portal by ixinportal.
the class RenewUserCertClientController method toPages.
/**
* 跳转到更新成功页面或是更新失败页面 certs为新证书,若不为空则更新成功,若为空则更新失败 szy 2016年9月7日 上午9:49:15
*
* @param id
* 订单编号
*/
@RequestMapping(value = "/toPages/{id}", produces = "text/html")
public String toPages(@PathVariable("id") Long id, @RequestParam(value = "ret", required = false) int ret, HttpServletRequest request, Model uiModel) {
HttpSession session = request.getSession();
UserInfo userInfo = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
if (null == userInfo || null == enterprise) {
return ComNames.DENG_LU_CLIENT;
}
Map<String, Object> param = new HashMap<String, Object>();
// 设置查询条件,选择属于当前用户,当前企业的订单
param.put("id", id);
List<Map<String, Object>> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
if (0 == billAll.size()) {
uiModel.addAttribute("errorMsg", "更新订单不存在");
return ComNames.CLIENTFW_ERRORPAGE;
}
// 审核记录
ReviewLog reviewLog = reviewLogService.getReviewLog(id);
if (reviewLog != null) {
uiModel.addAttribute("reviewLog", reviewLog);
}
uiModel.addAttribute("bills", billAll.get(0));
if (billAll.get(0).get("on_pay_info") != null) {
Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
uiModel.addAttribute("opiMap", opiMap);
}
PayInfoExample payInfoex = new PayInfoExample();
Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
uiModel.addAttribute("payinfomap", payinfoMap);
UserCertExample uce = new UserCertExample();
UserCertExample.Criteria ucec = uce.or();
ucec.andBillEqualTo(id);
List<UserCert> certs = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", uce);
if (ret == 1) {
// 更新成功页面
UserCert userCert = certs.get(0);
uiModel.addAttribute("doneTime", userCert.getCertStartTime());
try {
// 将客户端更新后的证书绑定给当前用户
userCert.setUserinfo(userInfo.getId());
userCertService.updateByPrimaryKeySelective(userCert);
} catch (Exception e) {
// TODO: handle exception
}
// 刷新session中的当前证书
session.setAttribute(ComNames.WEB_USER_CERT_SN, userCert.getCertSn());
return "clientFW/dingdanxiangqing_gengxinchenggong";
} else {
// 更新失败页面
return "clientFW/dingdanxiangqing_gengxinshibai";
}
}
use of com.itrus.portal.db.UserCert in project portal by ixinportal.
the class ApplicationInfoController method update.
// 修改处理
@RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String update(@Valid ApplicationInfo applicationInfo, Long isupdate, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
uiModel.addAttribute("applicationInfo", applicationInfo);
return "applicationinfo/update";
}
ApplicationInfo applicationInfo0 = applicationInfoService.selectById(applicationInfo.getId());
applicationInfo.setAppId(applicationInfo0.getAppId());
applicationInfo.setSecretKey(applicationInfo0.getSecretKey());
applicationInfo.setAppServiceItems(applicationInfo0.getAppServiceItems());
applicationInfo.setCreator(applicationInfo0.getCreator());
applicationInfo.setCreateTime(applicationInfo0.getCreateTime());
applicationInfo.setModifier(getAdmin().getId());
applicationInfo.setModifyTime(new Date());
applicationInfo.setAppId2(applicationInfo0.getAppId2());
applicationInfo.setSecretKey2(applicationInfo0.getSecretKey2());
// applicationInfo.setCallback(applicationInfo0.getCallback());
EvidenceCert cert = new EvidenceCert();
if (isupdate == null) {
if (!"applicationinfo.certBase64".equals(applicationInfo.getCertBase64())) {
String result = null;
try {
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
byte[] bt = decoder.decodeBuffer(applicationInfo.getCertBase64());
result = new String(bt, "utf-8");
UserCert userCert = CertUtil.getCertFromBase64(result);
cert.setCreateTime(new Date());
result = result.replaceAll("-----BEGIN CERTIFICATE-----", "").replaceAll("-----END CERTIFICATE-----", "").replaceAll("\r", "").replaceAll("\n", "");
cert.setCertBase64(result);
cert.setStartTime(userCert.getCertStartTime());
cert.setEndTime(userCert.getCertEndTime());
cert.setCertSerialnumber(userCert.getCertSn());
cert.setIssuerdn(userCert.getIssuerDn());
cert.setSubjectdn(userCert.getCertDn());
/*if(userCert.getCertBuf()!=null){
cert.setEvidenceBuf(userCert.getCertBuf().toString());
}*/
sqlSession.insert("com.itrus.portal.db.EvidenceCertMapper.insert", cert);
String certDn = userCert.getCertDn();
// applicationInfo.setCertBase64(cert.getId().toString());
applicationInfo.setCertBase64(cert.getId().toString());
applicationInfo.setCertDn(certDn);
applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));
// applicationInfo.setCertBase64(result);
/*UserCert userCert = CertUtil.getCertFromBase64(result);
String certDn = userCert.getCertDn();
applicationInfo.setCertDn(certDn);
applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));*/
} 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 {
applicationInfo.setCertBase64(null);
}
applicationInfoService.updateByApplicationInfo(applicationInfo);
} else {
applicationInfo.setCertBase64(applicationInfo0.getCertBase64());
applicationInfo.setCertDn(applicationInfo0.getCertDn());
applicationInfo.setCertCn(applicationInfo0.getCertCn());
applicationInfoService.updateByApplicationInfo(applicationInfo);
}
/*else if(isupdate==1){
try {
applicationInfo.setCertBase64(applicationInfo0.getCertBase64());
UserCert userCert = CertUtil.getCertFromBase64(applicationInfo0.getCertBase64());
String certDn = userCert.getCertDn();
applicationInfo.setCertDn(certDn);
applicationInfo.setCertCn(EvidenceSaveServiceApi.getCertCn(certDn));
} catch (CertificateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SigningServerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
String oper = "修改应用";
String info = "应用名称: " + applicationInfo.getName();
LogUtil.adminlog(sqlSession, oper, info);
return "redirect:applicationinfo/" + applicationInfo.getId();
}
Aggregations