use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class SecurityServiceWebController method securityCenter.
// 选出当前用户当前企业的所有证书和证书所绑定的用户信息
@RequestMapping("/securityCenter")
public String securityCenter(HttpSession session, Model uiModel) {
UserInfo userInfos = (UserInfo) session.getAttribute("webuserInfo");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == userInfos || null == enterprise) {
// 登录状态失效,跳转到注册页面
return "redirect:/userInfoWeb/denglu.html";
}
Map param = new HashMap();
param.put("userinfoid", userInfos.getId());
param.put("enterpriseid", enterprise.getId());
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());
}
}
}
}
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 "ixinweb/anquanfuwu";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class UserInfoController method updateUI.
/**
* 用户信息修改页面
*
* @param id
* @param uiModel
* @return
*/
@RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String updateUI(@PathVariable("id") Long id, Model uiModel) {
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", id);
// 判断修改的用户是否属于当前管理员所管理的范围
Long[] manageProjectIds = getProjectLongIdsOfAdmin();
// 默认不属于当前管理员管理范围
boolean flag = false;
for (Long projectId : manageProjectIds) {
if (userInfo.getProject() == projectId) {
flag = true;
}
}
if (!flag) {
// 没有管理权限
return "status403";
}
uiModel.addAttribute("userInfo", userInfo);
return "userInfo/update";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class UserInfoController method list.
/**
* 用户列表
*
* @param userSn
* 用户ID
* @param mPhone
* 手机号
* @param userPosition
* 所属岗位
* @param realName
* 真实姓名
* @param email
* 邮箱
* @param page
* @param size
* @param queryDate1
* @param queryDate2
* @param uiModel
* @return
*/
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "userSn", required = false) String userSn, @RequestParam(value = "mPhone", required = false) String mPhone, @RequestParam(value = "userPosition", required = false) String userPosition, @RequestParam(value = "realName", required = false) String realName, @RequestParam(value = "email", required = false) String email, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, Model uiModel) {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate1 = calendar.getTime();
}
uiModel.addAttribute("userSn", userSn);
uiModel.addAttribute("mPhone", mPhone);
uiModel.addAttribute("userPosition", userPosition);
uiModel.addAttribute("realName", realName);
uiModel.addAttribute("email", email);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 10;
}
// 只能查询当前管理员管理范围内的用户
Long[] manageProjectIds = getProjectLongIdsOfAdmin();
UserInfoExample userInfoExample = new UserInfoExample();
UserInfoExample.Criteria criteria = userInfoExample.or();
criteria.andProjectIn(Arrays.asList(manageProjectIds));
// userSn
if (StringUtils.isNotBlank(userSn)) {
criteria.andUniqueIdLike("%" + userSn + "%");
}
// mPone
if (StringUtils.isNotBlank(mPhone)) {
criteria.andMPhoneLike("%" + mPhone + "%");
}
// userPosition
if (StringUtils.isNotBlank(userPosition)) {
criteria.andUserPositionLike("%" + userPosition + "%");
}
// realName
if (StringUtils.isNotBlank(realName)) {
criteria.andRealNameLike("%" + realName + "%");
}
// email
if (StringUtils.isNotBlank(email)) {
criteria.andEmailLike("%" + email + "%");
}
// queryDate1
if (null != queryDate1) {
criteria.andCreateTimeGreaterThanOrEqualTo(queryDate1);
}
if (null != queryDate2) {
criteria.andCreateTimeLessThanOrEqualTo(queryDate2);
}
Integer count = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.countByExample", userInfoExample);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
Integer offset = size * (page - 1);
userInfoExample.setOffset(offset);
userInfoExample.setLimit(size);
userInfoExample.setOrderByClause("create_time desc");
List<UserInfo> userInfoall = sqlSession.selectList("com.itrus.portal.db.UserInfoMapper.selectByExample", userInfoExample);
uiModel.addAttribute("userInfoall", userInfoall);
uiModel.addAttribute("itemcount", userInfoall.size());
return "userInfo/list";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class CustomerServerClientController method onLineByJieSuoYiChang.
/**
* 解锁异常的的客服在线
* @param certSn
* @param keySn
* @param enterpriseName
* @param session
* @param uiModel
* @return
*/
@RequestMapping("/onLineByJieSuoYiChang")
public String onLineByJieSuoYiChang(@RequestParam(value = "certSn", required = true) String certSn, @RequestParam(value = "keySn", required = true) String keySn, HttpSession session, Model uiModel) {
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert || null == userCert.getUserinfo()) {
return ComNames.DENG_LU_CLIENT;
}
UserInfo userInfo = userInfoService.getUserInfoById(userCert.getUserinfo());
// 先根据key序列号取项目,若没有,则根据用户所属项目取项目信息
Project project = null;
if (StringUtils.isNotBlank(keySn) && StringUtils.isNotBlank(certSn)) {
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
uiModel.addAttribute("errorMsg", "无法识别的key序列号:" + keySn + ", 请联系系统管理员进行配置");
return ComNames.CLIENTFW_ERRORPAGE;
}
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 veryfyCodeZSJS.
/**
* 校验解锁码是否正确,正确则返回订单对应的解锁码
* @param certSn
* @param keySn
* @param enterpriseName
* @param mPhone
* @param code
* @param session
* @return
*/
@RequestMapping("/veryfyCodeZSJS")
@ResponseBody
public Map<String, Object> veryfyCodeZSJS(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, @RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "code", required = true) String code, HttpSession session) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
Bill bill = null;
UserInfo userInfo = null;
try {
// 发送验证码
if (!dynamicCodeService.verifyCode(mPhone, code)) {
retMap.put("retMsg", "动态码验证失败,请重新获取动态码");
return retMap;
}
session.setAttribute("verifyCodeZSJS", true);
bill = billService.getBill(billId);
userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
// 根据key序列号,获取证书
ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
if (null == projectKeyInfo) {
retMap.put("retMsg", "无法识别该序列号:" + keySn + ", 请联系系统管理进行配置");
return retMap;
}
// TODO 获取订单对应的解锁码,返回给客户端,可能会有解锁码过期 的问题,过期了则进行更新后在返回
session.setAttribute("verifyCodeZSJS", true);
KeyUnlock keyUnlock = keyUnlockService.getKeyUnlockByBillId(billId);
if (!keyUnlockService.isUnlockCodeValid(keyUnlock)) {
keyUnlock = unlockKeyService.generateUnlockCode(null, null, keyUnlock);
// 再次进行解锁校验
if (!keyUnlockService.isUnlockCodeValid(keyUnlock)) {
retMap.put("retMsg", "产生解锁码失败,请联系系统管理员进行处理!");
return retMap;
}
}
retMap.put("reqCode", keyUnlock.getReqCode());
retMap.put("repCode", keyUnlock.getRepCode());
// 若存在,则返回第二个解锁码
if (StringUtils.isNotBlank(keyUnlock.getRepCode2())) {
retMap.put("repCode2", keyUnlock.getRepCode2());
}
retMap.put("retCode", 1);
return retMap;
} catch (Exception e) {
retMap.put("retMsg", "校验解锁动态码出现异常,请联系系统管理员进行处理!");
LogUtil.userlog(sqlSession, bill.getProject(), "校验动态码", "校验出现异常,keySn:" + keySn + "异常信息:" + e.getMessage(), "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
return retMap;
}
}
Aggregations