Search in sources :

Example 1 with KeyUnlock

use of com.itrus.portal.db.KeyUnlock 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 2 with KeyUnlock

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

the class UnLockKeyBillServiceImpl method updateBillStatusWhileHasPay.

/**
 * 解锁订单支付之后,进行订单状态修改
 * 如果是自助解锁,则产生解锁码
 * @param bill
 * @param product
 * @return
 */
public Bill updateBillStatusWhileHasPay(Bill bill, Product product) {
    if (product.getKeyUnlockType().equals(ComNames.KEY_UNLOCK_TYPE_1)) {
        bill.setBillStatus(ComNames.BILL_STATUS_16);
        try {
            KeyUnlock keyunlock = keyUnlockService.getKeyUnlockByBillId(bill.getId());
            keyunlock = unlockKeyService.generateUnlockCode(null, null, keyunlock);
            UserInfo userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
            if (dynamicCodeService.sendCodeZSJS(userInfo.getmPhone(), bill.getProject(), "ZSJS")) {
                bill.setIsSms(true);
                bill.setSendTime(new Date());
            }
        } catch (Exception e) {
            LogUtil.syslog(sqlSession, "自助生成解锁码异常", "异常信息:" + e.getMessage() + ",订单号:" + bill.getBillId());
        }
    } else {
        bill.setBillStatus(ComNames.BILL_STATUS_14);
    }
    return bill;
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date)

Example 3 with KeyUnlock

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

the class KeyUnlockServiceImpl method getKeyUnlockByBillId.

public KeyUnlock getKeyUnlockByBillId(Long billId) {
    KeyUnlock keyUnlock = null;
    KeyUnlockExample example = new KeyUnlockExample();
    example.or().andBillEqualTo(billId);
    keyUnlock = sqlSession.selectOne("com.itrus.portal.db.KeyUnlockMapper.selectByExample", example);
    return keyUnlock;
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) KeyUnlockExample(com.itrus.portal.db.KeyUnlockExample)

Example 4 with KeyUnlock

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

the class KeyUnlockServiceImpl method insert.

/**
 * 插入一条记录
 * @param billId
 * @param projectId
 * @param keySn
 * @param certSn
 * @param certCn
 * @param keyType
 * @param status
 * @param unlockType
 * @return
 */
public KeyUnlock insert(Long billId, Long projectId, String keySn, String certSn, String certCn, String keyType, String status, Integer unlockType, String reqCode) {
    KeyUnlock keyUnlock = new KeyUnlock();
    keyUnlock.setBill(billId);
    keyUnlock.setProject(projectId);
    keyUnlock.setKeySn(keySn);
    keyUnlock.setCertSn(certSn);
    keyUnlock.setCertCn(certCn);
    keyUnlock.setKeyType(keyType);
    keyUnlock.setStatus(status);
    keyUnlock.setUnlockType(unlockType);
    keyUnlock.setCreateTime(new Date());
    keyUnlock.setReqCode(reqCode);
    insert(keyUnlock);
    return keyUnlock;
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) Date(java.util.Date)

Example 5 with KeyUnlock

use of com.itrus.portal.db.KeyUnlock 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;
    }
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) HashMap(java.util.HashMap) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) Bill(com.itrus.portal.db.Bill) UserInfo(com.itrus.portal.db.UserInfo) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

KeyUnlock (com.itrus.portal.db.KeyUnlock)6 Bill (com.itrus.portal.db.Bill)3 UserInfo (com.itrus.portal.db.UserInfo)3 Date (java.util.Date)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)2 HashMap (java.util.HashMap)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 KeyUnlockExample (com.itrus.portal.db.KeyUnlockExample)1 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)1 UserCert (com.itrus.portal.db.UserCert)1 TransactionStatus (org.springframework.transaction.TransactionStatus)1 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)1