use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class DownLoadCertWebController method toPages.
/**
* 跳转到下载成功或失败页面 2016年11月3日 下午4:52:36
*
* @param id
* 订单id
* @param ret
* 参数 1 成功, 0失败
* @return 逻辑视图
*/
@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("webuserInfo");
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == userInfo || null == enterprise) {
return "redirect:/userInfoWeb/denglu.html";
}
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()) {
return "redirect:/userInfoWeb/denglu.html";
}
// 审核记录
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) {
OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", billAll.get(0).get("on_pay_info"));
uiModel.addAttribute("onPayInfo", onPayInfo);
} else if (billAll.get(0).get("pay_info") != null) {
PayInfo payInfo = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", billAll.get(0).get("pay_info"));
uiModel.addAttribute("payInfo", payInfo);
}
UserCertExample uce = new UserCertExample();
UserCertExample.Criteria ucec = uce.or();
ucec.andBillEqualTo(id);
List<String> certStatus = new ArrayList<String>();
List<UserCert> certs = userCertService.getUserCertByBill(id, certStatus);
certStatus.add(ComNames.CERT_STATUS_1);
certStatus.add(ComNames.CERT_STATUS_2);
if (ret == 1) {
// 下载成功页面
if (certs != null && certs.size() > 0) {
UserCert userCert = certs.get(0);
uiModel.addAttribute("doneTime", userCert.getCertStartTime());
}
return "ixinweb/dingdanxiangqing_xiazaichenggong";
} else {
// 下载失败页面
return "ixinweb/dingdanxiangqing_xiazaishibai";
}
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class DownLoadCertWebController method downLoadCert.
@RequestMapping("/{id}")
@ResponseBody
public Map<String, Object> downLoadCert(@PathVariable(value = "id") Long id, @RequestParam(value = "uidIdx", required = true) Integer uidIdx, @RequestParam(value = "csr", required = true) String csr, @RequestParam(value = "keySn", required = false) String keySn, HttpSession session) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
if (null == webuserInfo || null == webenterprise) {
// 2标识登录已经失效,需跳转到登录页面
retMap.put("retCode", 2);
retMap.put("retMsg", "登录状态失效");
return retMap;
}
Bill bill = billService.getBill(id);
if (null == bill) {
retMap.put("retMsg", "该订单不存在");
return retMap;
}
// 订单是否为当前用户当前企业
if (!webuserInfo.getId().equals(bill.getUniqueId()) || !webenterprise.getId().equals(bill.getEnterprise())) {
retMap.put("retMsg", "您不能操作该订单");
return retMap;
}
// 判断该订单状态是否为待下载,是否已经关联了证书
List<String> certStatus = new ArrayList<String>();
certStatus.add(ComNames.CERT_STATUS_1);
certStatus.add(ComNames.CERT_STATUS_2);
List<UserCert> userCerts = userCertService.getUserCertByBill(bill.getId(), certStatus);
if (!bill.getBillStatus().equals(ComNames.BILL_STATUS_13) || !userCerts.isEmpty()) {
retMap.put("retMsg", "该证书状态为已下载或订单还未审核");
return retMap;
}
Product product = productService.getProduct(bill.getProduct());
DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
RaAccount ra = raAccountService.getRaAccount(product.getRa());
// 下载证书
String autoidType = "";
Integer autoidValue = 0;
try {
// 下载证书
CertInfo racertinfo = downLoadCertService.downLoadCert(product, ra, bill, digitalCert, uidIdx, csr, autoidType, autoidValue);
// 保存证书
downLoadCertService.saveCertInfo(racertinfo, bill, ra.getId(), uidIdx, keySn, autoidType, autoidValue);
// 返回数字证书
retMap.put("retCode", 1);
retMap.put("certChain", racertinfo.getCertSignBufP7());
retMap.put("certSn", racertinfo.getCertSerialNumber());
retMap.put("certSignBuf", racertinfo.getCertSignBuf());
retMap.put("certKmcRep1", racertinfo.getCertKmcRep1());
retMap.put("certKmcRep2", racertinfo.getCertKmcRep2());
// 加密证书
retMap.put("encUserCert", racertinfo.getCertSignBufKmc());
// 记录日志
UserLog userlog = new UserLog();
userlog.setProject(webuserInfo.getProject());
userlog.setType("用户下载证书");
userlog.setInfo(webenterprise.getEnterpriseName() + "下载证书成功");
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} catch (Exception e) {
e.printStackTrace();
retMap.put("retMsg", e.getMessage());
// 记录日志
UserLog userlog = new UserLog();
userlog.setProject(webuserInfo.getProject());
userlog.setType("用户下载证书");
userlog.setInfo("url:downLoadCert,详细错误:" + e.getMessage());
userlog.setHostId("未知");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillWebController method billList.
/**
* 订单列表
*
* @param billStatus
* 0未完成订单,1已完成订单
* @param request
* @param uiModel
* @return
* @throws Exception
*/
@RequestMapping(produces = "text/html")
public String billList(@RequestParam(value = "billStatus", required = false) Integer billStatus, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, HttpServletRequest request, Model uiModel) throws Exception {
HttpSession session = request.getSession();
Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
if (userInfo != null && enterprise == null) {
// 登录未获取到企业信息,跳转到选择企业页面
return "redirect:/userInfoWeb/choiceEnterprise";
}
uiModel.addAttribute("billStatus", billStatus);
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 5;
}
// 获取仅用户授权产品,不返回该类型产品的订单
List<Long> productOpenTypes = extraProductService.getProductOpenType(ComNames.PRODUCT_OPEN_TYPE_1);
ExtraBillExample billExampl0 = new ExtraBillExample();
ExtraBillExample.Criteria criteria0 = billExampl0.or();
// 查询当前用户当前企业的订单
// 当前用户
criteria0.andUniqueIdEqualTo(userInfo.getId());
// 当前企业
criteria0.andEnterpriseEqualTo(enterprise.getId());
criteria0.andIsDeleteNotEqualTo(true);
ExtraBillExample billExampl1 = new ExtraBillExample();
ExtraBillExample.Criteria criteria1 = billExampl1.or();
// 查询当前用户当前企业的订单
// 当前用户
criteria1.andUniqueIdEqualTo(userInfo.getId());
// 当前企业
criteria1.andEnterpriseEqualTo(enterprise.getId());
criteria1.andIsDeleteNotEqualTo(true);
if (null != productOpenTypes && !productOpenTypes.isEmpty()) {
criteria0.andExtraProductNotIn(productOpenTypes);
criteria1.andExtraProductNotIn(productOpenTypes);
}
// if (null == billStatus || 0 == billStatus) {
// // 未完成订单:订单状态不为7
// criteria.andBillStatusNotEqualTo(ComNames.EXTRA_BILL_STATUS_7);
// criteria.andIsDeleteEqualTo(false);
// } else if (1 == billStatus) {
// criteria.andBillStatusEqualTo(ComNames.EXTRA_BILL_STATUS_7);// 订单状态为已完成
// }
// 未完成订单:订单状态不为7
criteria0.andBillStatusNotEqualTo(ComNames.EXTRA_BILL_STATUS_7);
criteria0.andIsDeleteEqualTo(false);
// 订单状态为已完成
criteria1.andBillStatusEqualTo(ComNames.EXTRA_BILL_STATUS_7);
// Integer count = extraBillService.countByExample(billExampl);
// 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);
//
// billExampl.setOffset(offset);
// billExampl.setLimit(size);
billExampl0.setOrderByClause("create_time desc");
List<ExtraBill> billList0 = extraBillService.selectByExample(billExampl0);
uiModel.addAttribute("billList0", billList0);
// uiModel.addAttribute("itemcount", billList.size());
// 获取订单对应的产品规格
Map<Long, ExtraProductSpec> productSpecMap0 = extraProductSpecService.getProductSpec(billList0);
uiModel.addAttribute("productSpecMap0", productSpecMap0);
List<ExtraBill> billList1 = extraBillService.selectByExample(billExampl1);
uiModel.addAttribute("billList1", billList1);
// uiModel.addAttribute("itemcount", billList.size());
// 获取订单对应的产品规格
Map<Long, ExtraProductSpec> productSpecMap1 = extraProductSpecService.getProductSpec(billList1);
uiModel.addAttribute("productSpecMap1", productSpecMap1);
// 增值产品信息:
Map<Long, ExtraProduct> productMap = sqlSession.selectMap("com.itrus.portal.db.ExtraProductMapper.selectByExample", "id");
uiModel.addAttribute("productMap", productMap);
// 返回订单列表
return "client/dingdanliebiao";
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class ExtraBillWebController method sendEmailToUserByExtraBillId.
@RequestMapping("/sendemailbw")
@ResponseBody
public Map<String, Object> sendEmailToUserByExtraBillId(@RequestParam(value = "billId", required = true) Long BillId, HttpServletRequest request) {
Map<String, Object> retMap = new HashMap<>();
retMap.put("retCode", 0);
HttpSession session = request.getSession();
Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
if (null == webenterprise || null == webuserInfo) {
retMap.put("retMsg", "登录失效");
return retMap;
}
ExtraBill bill = extraBillService.selectByPrimaryKey(BillId);
if (null == bill) {
retMap.put("errorMsg", "未找到该订单");
return retMap;
}
if (!bill.getUniqueId().equals(webuserInfo.getId())) {
retMap.put("errorMsg", "您无权操作该订单");
return retMap;
}
try {
retMap = baiWangEmailService.sendEmailToUser(bill);
retMap.put("email", webuserInfo.getEmail());
UserLog userlog = new UserLog();
userlog.setCreateTime(new Date());
userlog.setHostId("未知");
userlog.setInfo("订单号:" + bill.getBillId() + ",用户手机号:" + webuserInfo.getmPhone());
userlog.setProject(bill.getProject());
userlog.setType("发送邮件_百旺单机");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
} catch (Exception e) {
UserLog userlog = new UserLog();
userlog.setCreateTime(new Date());
userlog.setHostId("未知");
userlog.setInfo("出现异常,订单号:" + bill.getBillId() + "异常信息:" + e.getMessage());
userlog.setProject(bill.getProject());
userlog.setType("发送邮件_百旺单机");
userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
log.error(e.getMessage());
retMap.put("retMsg", "服务端出现异常,请联系系统管理员,异常信息:" + e.getMessage());
retMap.put("retCode", 0);
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.UserInfo in project portal by ixinportal.
the class UnlockKeyBillController method reSubmitUnlockBill.
/**
* 解锁订单重新提交授权书,注意授权书的id不能为null
* @param billId
* @param certSn
* @param keySn
* @param proxy
* @param request
* @return
*/
@RequestMapping("/reSubmitUnlockBill")
@ResponseBody
public Map<String, Object> reSubmitUnlockBill(@RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @ModelAttribute("proxy") Proxy proxy, HttpServletRequest request) {
Map<String, Object> retMap = new HashMap<String, Object>();
retMap.put("retCode", 0);
UserInfo webUserInfo = null;
Project project = null;
// 校验证书和证书所绑定的用户和企业
UserCert userCert = userCertService.getUserCertByCertSn(certSn);
if (null == userCert) {
retMap.put("retMsg", "该证书未注册,请您先注册");
return retMap;
}
// if(null == userCert.getUserinfo()){
// retMap.put("retMsg", "该证书未绑定用户,请检查您插入的key是否正确");
// return retMap;
// }
// 校验订单和证书所对应的用户与企业
Bill bill = billService.getBill(billId);
if (null == bill) {
retMap.put("retMsg", "订单不存在");
return retMap;
}
webUserInfo = userInfoService.selectByPrimaryKey(bill.getUniqueId());
if (null == webUserInfo) {
retMap.put("retMsg", "订单所对应的用户不存在,请检查");
return retMap;
}
if (!(bill.getBillStatus().equals(ComNames.BILL_STATUS_1) || bill.getBillStatus().equals(ComNames.BILL_STATUS_2) || bill.getBillStatus().equals(ComNames.BILL_STATUS_15))) {
retMap.put("errorMsg", "该订单不处于可以重新提交的状态");
return retMap;
}
if (!bill.getUnlockUserCert().equals(userCert.getId())) {
retMap.put("errorMsg", "您无权操作该订单");
return retMap;
}
Product product = productService.getProduct(bill.getProduct());
if (null == product.getKeyUnlockType()) {
retMap.put("retMsg", "您选择的产品不属于解锁产品,请重新选择");
return retMap;
}
project = projectService.selectByPrimaryKey(product.getProject());
DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
TransactionStatus status = transactionManager.getTransaction(dtd);
try {
if (null != proxy && (StringUtils.isNotBlank(proxy.getImgFile()) || null != proxy.getId())) {
// 保存授权书
Proxy oldProxy = null;
if (null != proxy.getId()) {
oldProxy = new Proxy();
oldProxy.setId(proxy.getId());
proxy.setId(null);
}
proxy = proxyService.saveProxy1(bill.getEnterprise(), webUserInfo.getUniqueId(), bill.getId(), bill.getUniqueId(), proxy, oldProxy, project);
}
// 审核拒绝后的订单,重新提交,则修改订单状态和审核拒绝的短信发送
if (bill.getBillStatus().equals(ComNames.BILL_STATUS_15)) {
bill.setBillStatus(ComNames.BILL_STATUS_14);
bill.setIsSms(false);
billService.updateBill(bill);
}
transactionManager.commit(status);
LogUtil.userlog(sqlSession, project.getId(), "重新提交解锁订单", webUserInfo.getmPhone() + "重新提交解锁订单:" + bill.getBillId(), "未知", "", null == webUserInfo.getUniqueId() ? null : webUserInfo.getUniqueId());
retMap.put("retCode", 1);
return retMap;
} catch (Exception e) {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
UserLog userlog = new UserLog();
userlog.setProject(project.getId());
userlog.setType("重新提交解锁订单");
userlog.setInfo("url:reSubmitUnlockBill,详细错误:" + e.getMessage() + ",订单号" + bill.getBillId());
userlog.setHostId("未知");
userlog.setSn(null == webUserInfo.getUniqueId() ? null : webUserInfo.getUniqueId());
LogUtil.userlog(sqlSession, userlog);
retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
return retMap;
} finally {
if (!status.isCompleted()) {
transactionManager.rollback(status);
}
}
}
Aggregations