Search in sources :

Example 11 with Bill

use of com.itrus.portal.db.Bill 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";
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) IOException(java.io.IOException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) Enterprise(com.itrus.portal.db.Enterprise) Bill(com.itrus.portal.db.Bill) ArrayList(java.util.ArrayList) List(java.util.List) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) HashMap(java.util.HashMap) Map(java.util.Map) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with Bill

use of com.itrus.portal.db.Bill 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";
}
Also used : Proxy(com.itrus.portal.db.Proxy) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with Bill

use of com.itrus.portal.db.Bill 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;
    }
}
Also used : Proxy(com.itrus.portal.db.Proxy) OnPayInfo(com.itrus.portal.db.OnPayInfo) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with Bill

use of com.itrus.portal.db.Bill in project portal by ixinportal.

the class DoUnlockKeyController method toUnlockSuccessPage.

/**
 * 解锁成功之后,跳转的解锁成功页面
 * @param newPassword
 * @param uiModel
 * @return
 */
@RequestMapping("/toUnlockSuccessPage/{billId}")
public String toUnlockSuccessPage(@PathVariable("billId") Long billId, @RequestParam("newPassword") String newPassword, Model uiModel) {
    Bill bill = billService.getBill(billId);
    KeyUnlock keyUnlock = keyUnlockService.getKeyUnlockByBillId(billId);
    uiModel.addAttribute("bill", bill);
    uiModel.addAttribute("keyUnlock", keyUnlock);
    uiModel.addAttribute("newPassword", newPassword);
    return "clientFW/jiesuochenggong";
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) Bill(com.itrus.portal.db.Bill) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with Bill

use of com.itrus.portal.db.Bill in project portal by ixinportal.

the class PayController method update.

// 修改处理
@RequestMapping(value = "/update/{billid}/{id}", produces = "text/html")
public String update(@PathVariable("billid") Long billid, @PathVariable("id") Long id, @RequestParam(value = "status", required = false) Integer status, @Valid PayInfo payInfo, BindingResult bindingResult, Model uiModel) throws UnsupportedEncodingException {
    // DefaultTransactionDefinition def = new
    // DefaultTransactionDefinition();
    // def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    // TransactionStatus s = transactionManager.getTransaction(def);
    Bill bill = null;
    try {
        bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", billid);
        bill.setBillStatus(status);
        bill.setBillSum(payInfo.getPay());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
        PayInfo p = sqlSession.selectOne("com.itrus.portal.db.PayInfoMapper.selectByPrimaryKey", id);
        if (p != null) {
            p.setPay(payInfo.getPay());
            p.setName(payInfo.getName());
            p.setPayTime(payInfo.getPayTime());
            p.setComment(payInfo.getComment());
            if (status == 3) {
                p.setPayConfirmTime(new Date());
            }
            sqlSession.update("com.itrus.portal.db.PayInfoMapper.updateByPrimaryKeySelective", p);
        }
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款", "订单号" + bill.getBillId());
        } else {
            sendsms(billid, null, "ZFYC");
            LogUtil.adminlog(sqlSession, "订单支付异常", "订单号" + bill.getBillId());
        }
        // transactionManager.commit(s);
        // 产品
        Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
        // pfx流程判断begin
        DigitalCert digitalCert = null;
        if (null != product.getCert()) {
            digitalCert = digitalCertService.getDigitalCert(product.getCert());
            if (null != digitalCert && null != digitalCert.getCertType() && digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX)) {
                // 这个用户,这个企业,这个项目,有通过了实名认证的订单,则直接进入待下载,
                List<Bill> bills = billService.hasAuthticationLevel(bill.getUniqueId(), bill.getEnterprise(), product.getProject());
                if (null != bills && bills.size() > 0 && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2)) {
                    bill.setBillStatus(ComNames.BILL_STATUS_13);
                    // 新增审核通过的记录
                    reviewService.agreeBillReview(bill);
                    sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKeySelective", bill);
                }
            }
        }
        // 解锁订单流程判断begin
        if (null != product.getKeyUnlockType()) {
            if (null != status && status.equals(ComNames.BILL_STATUS_3)) {
                bill = unLockKeyBillService.updateBillStatusWhileHasPay(bill, product);
            }
        }
    // 解锁订单流程判断end
    } catch (Exception e) {
        if (status == 3) {
            LogUtil.adminlog(sqlSession, "订单确认到款-异常", e.toString() + ",订单号" + bill.getBillId());
        } else {
            LogUtil.adminlog(sqlSession, "订单支付异常-异常", e.toString() + ",订单号" + bill.getBillId());
        }
    }
    // }
    return "redirect:/pay";
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) OnPayInfo(com.itrus.portal.db.OnPayInfo) PayInfo(com.itrus.portal.db.PayInfo) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) Date(java.util.Date) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Bill (com.itrus.portal.db.Bill)74 HashMap (java.util.HashMap)45 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)42 Product (com.itrus.portal.db.Product)39 UserInfo (com.itrus.portal.db.UserInfo)32 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)27 Enterprise (com.itrus.portal.db.Enterprise)26 UserCert (com.itrus.portal.db.UserCert)22 JSONObject (com.alibaba.fastjson.JSONObject)21 Date (java.util.Date)20 ArrayList (java.util.ArrayList)19 BillExample (com.itrus.portal.db.BillExample)18 IOException (java.io.IOException)18 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)16 DigitalCert (com.itrus.portal.db.DigitalCert)15 Map (java.util.Map)12 TransactionStatus (org.springframework.transaction.TransactionStatus)10 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)10 OnPayInfo (com.itrus.portal.db.OnPayInfo)9 Proxy (com.itrus.portal.db.Proxy)9