use of com.itrus.portal.db.UserCertExample 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.UserCertExample in project portal by ixinportal.
the class MakeCertController method sendReNewInfo.
/**
* 发送待更新短信通知
*
* @param id
* 订单id
* @return
*/
@RequestMapping("/sendReNewInfo")
@ResponseBody
public Map<String, Object> sendReNewInfo(@RequestParam(value = "billId") Long id) {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识发送验证码失败,1标识成功
retMap.put("retCode", 0);
Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
if (null != bill.getRenewSms() && bill.getRenewSms() == true) {
retMap.put("message", "该用户已经发送过短信通知了,不能重复发送");
return retMap;
}
// 获取订单对应的产品信息
Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
String productName = product.getName();
// 发送短信所需要的信息
UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
UserCertExample userCertExample = new UserCertExample();
UserCertExample.Criteria criteria = userCertExample.or();
criteria.andIdEqualTo(bill.getOldUserCert());
UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
Long projectId = bill.getProject();
String mPhone = userInfo.getmPhone();
String keySn = userCert.getKeySn();
if (null == keySn) {
keySn = "该证书未绑定key";
}
String enterpriseName = enterprise.getEnterpriseName();
Date endTime = userCert.getCertEndTime();
// 执行发送
try {
makeCerServiceImpl.sendReNewInfo(bill, mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
retMap.put("retCode", 1);
retMap.put("message", "发送更新通知短信成功");
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
retMap.put("message", "发送短信失败,请联系管理员");
String type = "发送更新证书通知失败";
String info = "用户电话:" + mPhone + "错误信息:" + e.getMessage();
LogUtil.syslog(sqlSession, type, info);
}
return retMap;
}
use of com.itrus.portal.db.UserCertExample in project portal by ixinportal.
the class MakeCertController method updateBillStatus.
/**
* 修改订单状态:1、订单关联的证书数量大于或等于订单购买的产品数量;2、假如该产品配了签章服务,则判断该订单关联的所有证书,是否都已经签章并且授权,
* 假如都已经签章授权,则改变订单状态。
*
* @param bill
* @param product
*/
private void updateBillStatus(Bill bill, Product product) {
// 查询userCert中,该bill的记录数目,如果数据 大于等于 bill 里面的购买数量,则修改该bill为制证完成
UserCertExample example = new UserCertExample();
UserCertExample.Criteria criteria = example.or();
criteria.andCertStatusNotEqualTo("0");
criteria.andBillEqualTo(bill.getId());
List<UserCert> usercertall = sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", example);
Product p = productService.getProductById(bill.getProduct());
Integer num1 = 0;
Integer num2 = 0;
Integer num3 = 0;
if (null != bill.getProductNum1()) {
num1 = bill.getProductNum1();
}
if (null != bill.getProductNum2()) {
num2 = bill.getProductNum2();
}
if (null != bill.getProductNum3()) {
num3 = bill.getProductNum3();
}
Integer pSum = num1 + num2 + num3;
// 新添:组合产品判断
if ((usercertall.size() >= bill.getProductNum() && null == p.getIsCombined()) || (usercertall.size() >= bill.getProductNum() && null != p.getIsCombined() && p.getIsCombined() != 1) || (usercertall.size() >= pSum && null != p.getIsCombined() && p.getIsCombined() == 1)) {
// 判断产品是否配置了签章服务
if (null != product.getMakeSealServer() && product.getMakeSealServer() > 0) {
// 查看证书是否都已经完成了签章,授权
for (UserCert userCert : usercertall) {
if (null == userCert.getMakeSealmstatus() || "0".equals(userCert.getMakeSealmstatus().toString()) || null == userCert.getMakeSealastatus() || "0".equals(userCert.getMakeSealastatus().toString())) {
// 未签章或者未授权,则直接返回,不修改订单状态
return;
}
}
}
if (bill.getIsenterprisecert() != null && bill.getIsenterprisecert()) {
// 判断友互通是否自动制证
if (bill.getIscertinfo() != null && bill.getIscertinfo() == 1) {
// 判断友互通自动制证是否已制证
bill.setBillStatus(ComNames.BILL_STATUS_6);
if (null == bill.getDelivery()) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
} else if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
bill.setBillStatus(ComNames.BILL_STATUS_7);
}
// 当订单价格是0的时候,又不需要开票,设置为已开票代配送
if (0 == bill.getBillSum() && null == bill.getInvoice() && null == bill.geteInvoice()) {
bill.setBillStatus(ComNames.BILL_STATUS_7);
if (null == bill.getDelivery()) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
}
}
} else {
// 友互通管理员制证已制证
bill.setIscertinfo(3);
}
} else {
bill.setIscertinfo(4);
bill.setBillStatus(ComNames.BILL_STATUS_6);
if (null == bill.getDelivery()) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
} else if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
bill.setBillStatus(ComNames.BILL_STATUS_7);
}
// 当订单价格是0的时候,又不需要开票,设置为已开票代配送
if (0 == bill.getBillSum() && null == bill.getInvoice() && null == bill.geteInvoice()) {
bill.setBillStatus(ComNames.BILL_STATUS_7);
if (null == bill.getDelivery()) {
bill.setBillStatus(ComNames.BILL_STATUS_8);
}
}
}
sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
}
}
use of com.itrus.portal.db.UserCertExample in project portal by ixinportal.
the class UserCertService method getUserCertByBill.
/**
* 获取订单关联的证书
*
* @param billId
* @param certStatus
* @return
*/
public List<UserCert> getUserCertByBill(Long billId, List<String> certStatus) {
UserCertExample example = new UserCertExample();
UserCertExample.Criteria criteria = example.or();
criteria.andBillEqualTo(billId);
if (null != certStatus && !certStatus.isEmpty()) {
criteria.andCertStatusIn(certStatus);
}
example.setOrderByClause("cert_start_time desc");
return sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", example);
}
use of com.itrus.portal.db.UserCertExample in project portal by ixinportal.
the class UserCertService method getUserCertBycertSns.
/**
* 根据证书序列号,获取用户证书
* @param certSns
* @return
*/
public List<UserCert> getUserCertBycertSns(List<String> certSns) {
if (null == certSns || certSns.isEmpty()) {
return null;
}
UserCertExample example = new UserCertExample();
UserCertExample.Criteria criteria = example.or();
criteria.andCertSnIn(certSns);
example.setOrderByClause("cert_start_time desc");
return sqlSession.selectList("com.itrus.portal.db.UserCertMapper.selectByExample", example);
}
Aggregations