use of com.itrus.portal.db.ProjectKeyInfo in project portal by ixinportal.
the class ClientWebController method getProductInfoFromClient.
/**
* 接收新服务型客户端传递的项目信息,用户信息,企业信息
* @param type,类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
* @param keySn
* @param certSn
* @param enterpriseName
* @param session
* @param uiModel
* @return
*/
@RequestMapping("/getProductInfoFromClient")
public String getProductInfoFromClient(@RequestParam(value = "type", required = true) String type, @RequestParam(value = "keySn", required = false) String keySn, @RequestParam(value = "certSn", required = false) String certSn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, HttpSession session, Model uiModel) {
try {
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;
}
UserCert userCert = null;
if (StringUtils.isNotBlank(certSn)) {
userCert = userCertService.getUserCertByCertSn(certSn);
} else if (null != session.getAttribute(ComNames.WEB_USER_CERT_SN)) {
String certSnInSession = (String) session.getAttribute(ComNames.WEB_USER_CERT_SN);
userCert = userCertService.getUserCertByCertSn(certSnInSession);
}
if (null != userCert) {
uiModel.addAttribute("userCert", userCert);
}
Project project = null;
if (StringUtils.isNotBlank(keySn)) {
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
} else {
project = projectService.selectByPrimaryKey(userInfo.getProject());
}
if (null == project) {
uiModel.addAttribute("errorMsg", "无法识别当前登录用户所属的项目,请重新登录!");
return "client/errorpage";
}
// 返回增值产品信息
List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(project.getId(), type);
// 获取项目下所有的发布产品
List<ExtraProduct> extraProducts = extraProductService.getproductByEPR(extraProductReleases);
uiModel.addAttribute("webExtraProducts", extraProducts);
// 增值产品的类型
Set<Object> productTypeSet = new LinkedHashSet<>();
for (ExtraProduct ep : extraProducts) {
productTypeSet.add(ep.getAppType());
}
uiModel.addAttribute("webProductTypes", productTypeSet);
session.setAttribute("isregister", 1);
} catch (Exception e) {
uiModel.addAttribute("errorMsg", "出现异常,异常信息:" + e.getMessage());
return "client/errorpage";
}
return "client/yingyongzhanshi";
}
use of com.itrus.portal.db.ProjectKeyInfo in project portal by ixinportal.
the class UnlockKeyBillController method getUnlockProducts.
/**
* 返回key对应的解锁产品列表
* 1.证书有绑定的用户,用户选择自助解锁,不需要进行短信码校验,直接提交
* 2.证书有绑定的用户,用户选择人工解锁(因为之前绑定的手机号可能没有了),进行短信校验后提交
* 3.证书没有绑定的用户,用户只能选择人工解锁(后台不返回自助解锁的产品了),进行短信码校验后,直接提交
* @param CertSn
* @param keySn
* @param uiModel
* @param request
* @return
*/
@RequestMapping("/getUnlockProducts")
public String getUnlockProducts(@RequestParam(value = "certBase64", required = true) String certBase64, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("enterpriseName") String enterpriseName, Model uiModel, HttpServletRequest request) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
return ComNames.CLIENTFW_ERRORPAGE;
}
// if (null == userCert.getUserinfo()) {
// uiModel.addAttribute("errorMsg", "该证书尚未绑定用户,请先绑定后再使用");
// return ComNames.CLIENTFW_ERRORPAGE;
// }
UserInfo webUserInfo = null;
uiModel.addAttribute("has_userInfo", 0);
if (null != userCert.getUserinfo()) {
webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
uiModel.addAttribute("userInfo", webUserInfo);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
uiModel.addAttribute("has_userInfo", 1);
}
Enterprise enterprise = enterpriseService.getEntByName(enterpriseName);
uiModel.addAttribute("has_enterpriseInfo", 0);
if (null != enterprise) {
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("has_enterpriseInfo", 1);
}
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
return ComNames.CLIENTFW_ERRORPAGE;
}
Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
if (null == products || products.isEmpty()) {
uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
return ComNames.CLIENTFW_ERRORPAGE;
}
uiModel.addAttribute("products", products);
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
if (null == products.get(0).geteBill()) {
uiModel.addAttribute("ereceiptMapSize", 0);
}
uiModel.addAttribute("ereceiptMap", ereceiptMap);
return "clientFW/unlock_out";
}
use of com.itrus.portal.db.ProjectKeyInfo in project portal by ixinportal.
the class UnlockKeyBillController method getUnlockProductsByLogin.
/**
* 用户登录后点击解锁,返回key对应的解锁产品列表
* @param CertSn
* @param keySn
* @param uiModel
* @param request
* @return
*/
@RequestMapping(value = "/getUnlockProductsByLogin")
public String getUnlockProductsByLogin(@RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, Model uiModel, HttpServletRequest request) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
uiModel.addAttribute("errorMsg", "该证书尚未注册,请先注册后在使用");
return ComNames.CLIENTFW_ERRORPAGE;
}
UserInfo webUserInfo = (UserInfo) request.getSession().getAttribute(ComNames.WEB_USER_INFO);
if (null == webUserInfo) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return ComNames.CLIENTFW_ERRORPAGE;
}
Enterprise enterprise = (Enterprise) request.getSession().getAttribute(ComNames.WEB_ENTERPRISE);
if (null == enterprise) {
uiModel.addAttribute("errorMsg", "登录已经失效,请重新登录");
return ComNames.CLIENTFW_ERRORPAGE;
}
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别该key:" + keySn + ", 请联系系统管理员");
return ComNames.CLIENTFW_ERRORPAGE;
}
HttpSession session = request.getSession();
Integer has_enterpriseInfoInsession = (Integer) session.getAttribute("has_enterpriseInfo");
Integer hhas_userInfoInsession = (Integer) session.getAttribute("has_userInfo");
if (null == hhas_userInfoInsession) {
uiModel.addAttribute("has_userInfo", 0);
if (null != userCert.getUserinfo()) {
webUserInfo = userInfoService.selectByPrimaryKey(userCert.getUserinfo());
uiModel.addAttribute("userInfo", webUserInfo);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
uiModel.addAttribute("has_userInfo", 1);
}
}
if (null == has_enterpriseInfoInsession) {
uiModel.addAttribute("has_enterpriseInfo", 0);
if (null != enterprise) {
uiModel.addAttribute("enterprise", enterprise);
uiModel.addAttribute("has_enterpriseInfo", 1);
}
}
Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
List<Product> products = productService.getKeyUnlockProducts(project.getId(), userCert.getUserinfo());
if (null == products || products.isEmpty()) {
uiModel.addAttribute("errorMsg", "key序列号为:" + keySn + " 对应的解锁产品不存在, 请联系系统管理员进行处理");
return ComNames.CLIENTFW_ERRORPAGE;
}
uiModel.addAttribute("products", products);
uiModel.addAttribute("mPhone", webUserInfo.getmPhone());
// 电子开票服务
Long[] ereceiptIds = StringTools.getLong(products.get(0).geteBill());
Map<Long, Ereceipt> ereceiptMap = ereceiptService.getEreceiptMap(ereceiptIds);
if (null == products.get(0).geteBill()) {
uiModel.addAttribute("ereceiptMapSize", 0);
}
uiModel.addAttribute("ereceiptMap", ereceiptMap);
return "clientFW/unlock_out";
}
use of com.itrus.portal.db.ProjectKeyInfo 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.ProjectKeyInfo in project portal by ixinportal.
the class ProjectKeyInfoController method listjson.
// 列表所有信息
@RequestMapping(value = "/listjson", method = RequestMethod.GET)
@ResponseBody
public Map listjson() {
ProjectKeyInfoExample projectkeyinfoex = new ProjectKeyInfoExample();
List<ProjectKeyInfo> projectkeyinfoall = sqlSession.selectList("com.itrus.portal.db.ProjectKeyInfoMapper.selectByExample", projectkeyinfoex);
ProjectExample projectex = new ProjectExample();
Map projectmap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectex, "id");
return projectmap;
}
Aggregations