use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class CertificateServiceController method securityCenter.
// 选出当前用户当前企业的所有证书和证书所绑定的用户信息
@RequestMapping("/securityCenter")
public String securityCenter(@RequestParam(value = "certSn", required = false) String certSn, HttpSession session, Model uiModel) {
UserInfo userInfos = (UserInfo) session.getAttribute(ComNames.WEB_USER_INFO);
Enterprise enterprise = (Enterprise) session.getAttribute(ComNames.WEB_ENTERPRISE);
if (null == userInfos || null == enterprise) {
// 登录状态失效,跳转到注册页面
return ComNames.DENG_LU_CLIENT;
}
if (StringUtils.isNotBlank(certSn) && certSn.length() > 10) {
uiModel.addAttribute("certSn", certSn);
} else if (null != session.getAttribute(ComNames.WEB_USER_CERT_SN)) {
uiModel.addAttribute("certSn", session.getAttribute(ComNames.WEB_USER_CERT_SN));
}
Map param = new HashMap();
param.put("userinfoid", userInfos.getId());
param.put("enterpriseid", enterprise.getId());
uiModel.addAttribute("userInfos", userInfos);
uiModel.addAttribute("enterprise", enterprise);
List<Map<String, Object>> userCertList = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByUserInfoAndEnterprise", param);
if (null != userCertList && !userCertList.isEmpty()) {
for (int i = 0; i < userCertList.size(); i++) {
if (null != userCertList.get(i).get("bill_status") && (userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_8) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_7) || userCertList.get(i).get("bill_status").equals(ComNames.BILL_STATUS_6)) && userCertList.get(i).containsKey("renewBillId")) {
// 状态为已完成的订单并且订单包含旧证书id
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", userCertList.get(i).get("renewBillId"));
if (null != bill.getOldUserCert()) {
UserCert oldUserCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByPrimaryKey", bill.getOldUserCert());
userCertList.get(i).put("oldCertSn", oldUserCert.getCertSn());
}
}
}
}
Map<Long, List<Map<String, Object>>> userCertMap = new HashMap();
for (Map<String, Object> map : userCertList) {
Long key = (Long) map.get("product");
List<Map<String, Object>> list = null;
if (userCertMap.containsKey(key)) {
list = userCertMap.get(key);
} else {
list = new ArrayList<>();
}
list.add(map);
userCertMap.put(key, list);
}
uiModel.addAttribute("userCertMap", userCertMap);
try {
String usercertsString = jsonTool.writeValueAsString(userCertList);
uiModel.addAttribute("usercerts", usercertsString);
List<String> allIssUerDn = new ArrayList<String>();
allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
} catch (JsonGenerationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "clientFW/zhengshufuwu";
}
use of com.itrus.portal.db.UserInfo 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.UserInfo 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.UserInfo 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.UserInfo in project portal by ixinportal.
the class RenewUserCertClientController method reNewCertConfirm.
// 订单详情,待更新确认
@RequestMapping(value = "/reNewCertConfirm/{id}", produces = "text/html")
public String reNewCertConfirm(@PathVariable("id") Long id, 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;
}
// 审核记录
ReviewLog reviewLog = reviewLogService.getReviewLog(id);
if (reviewLog != null) {
uiModel.addAttribute("reviewLog", reviewLog);
}
Map param = new HashMap();
// 设置查询条件,选择属于当前用户,当前企业的订单
param.put("id", id);
// param.put("userinfoid", userInfo.getId());
// param.put("enterpriseid", enterprise.getId());
List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
if (0 == billAll.size()) {
return ComNames.DENG_LU_CLIENT;
}
uiModel.addAttribute("bills", billAll.get(0));
// 获取数字证书
Product product = productService.getProduct((Long) billAll.get(0).get("product"));
DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
// 获取订单在线支付方式
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);
Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
uiModel.addAttribute("opMap", opMap);
}
PayInfoExample payInfoex = new PayInfoExample();
Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
uiModel.addAttribute("payinfomap", payinfoMap);
// 获取产品规格
ProductSpec productSpec = null;
if (null != billAll.get(0).get("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
}
uiModel.addAttribute("productSpec", productSpec);
uiModel.addAttribute("digitalCert", digitalCert);
// 返回订单对应的老证书的base64
CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectCertBufByBillId", id);
if (null != certBuf) {
uiModel.addAttribute("oldCertB64", certBuf.getCertBuf().replaceAll("\n", ""));
}
// 判断是否有签章服务,有则显示授权
if (null != product.getMakeSealServer()) {
uiModel.addAttribute("makesealserver", product.getMakeSealServer());
uiModel.addAttribute("billId", billAll.get(0).get("id"));
// 签章服务配置
List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
if (!makeSealConfigs.isEmpty()) {
MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
try {
makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
} catch (EncDecException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
uiModel.addAttribute("makeSealConfig", makeSealConfig);
}
}
return "clientFW/dingdanxiangqing_gengxinqueren";
}
Aggregations