Search in sources :

Example 1 with BankcardInfo

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

the class BankCertificationController method verifyCode.

/**
 * 验证动态码/银行卡认证处理
 *
 * @param mPhone
 * @param code
 * @param request
 * @return
 */
@RequestMapping(value = "/verifyCode")
@ResponseBody
public Map<String, Object> verifyCode(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "personId", required = false) Long personId, @RequestParam(value = "productId", required = false) Long productId, @RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "code", required = true) String code, @RequestParam(value = "personName", required = true) String personName, @RequestParam(value = "personNo", required = true) String personNo, @RequestParam(value = "bankNo", required = true) String bankNo, HttpServletRequest request) {
    // 得到当前个人用户信息
    HttpSession session = request.getSession();
    PersonInfo personInfo = (PersonInfo) session.getAttribute("webuserInfo");
    // PersonInfo personInfo =personInfoService.getSelectById(personId);
    // 得到当前产品信息
    Product product = productService.getProductById(productId);
    // 判断是否已经存在订单
    List list = personalBillService.selectPersonalBillByPersonId(2, personId, productId, 8);
    PersonalBill personalBill = null;
    if (list.size() == 0) {
        // 产生新订单
        personalBill = personalBillService.saveBill(personId, personInfo.getmPhone(), productId, 2, product.getProject(), 1, product.getPrice(), personId, 3);
    } else {
        personalBill = (PersonalBill) list.get(0);
    }
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识处理失败,1标识成功
    retMap.put("retCode", 0);
    try {
        // 验证动态码,
        if (!dynamicCodeService.verifyCode(mPhone, code)) {
            // if(false){
            // 验证码不通过
            retMap.put("retMsg", "动态码验证失败");
            return retMap;
        } else {
            // 调用银行卡认证
            String str = pbankrealtestsms(authHmac, personName, personNo, bankNo, mPhone, "1");
            retMap.put("retCode", 1);
            JSONObject jasonObject = JSONObject.parseObject(str);
            Map map = (Map) jasonObject;
            String status = (String) map.get("status");
            PersonInfo personInfo1 = personInfoService.getSelectById(personInfo.getId());
            if ("200".equals(status)) {
                retMap.put("retCode", 1);
                // 添加银行卡信息
                BankcardInfo bank = bankcardInfoService.saveBankcardInfo(personName, mPhone, personNo, bankNo, personId, null);
                // 认证成功修改订单信息
                personalBill.setReservedPhone(mPhone);
                personalBill.setBankNo(bankNo);
                personalBill.setRealName(personName);
                personalBill.setIdCode(personNo);
                personalBill.setBillStatus(8);
                personalBill.setCheckTime(new Date());
                personalBillService.updateByPersonalBill(personalBill);
                // 修改个人用户信息
                personInfo1.setRealName(personName);
                personInfo1.setPersonName(personName);
                personInfo1.setIdCode(personNo);
                personInfoService.updateByPersonInfo(personInfo1);
                // 生成认证记录
                personalReviewLogService.saveReviewLog(1, null, 1, null, personalBill.getId(), personId, bank.getId());
                // 添加系统日志
                LogUtil.syslog(sqlSession, "银行卡认证送审成功", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
            } else {
                if ("201".equals(status)) {
                    retMap.put("retMsg", map.get("message"));
                } else if ("205".equals(status)) {
                    retMap.put("retMsg", map.get("error"));
                }
                // 认证失败修改订单状态
                personalBill.setBillStatus(4);
                personalBillService.updateByPersonalBill(personalBill);
                // 生成认证记录
                personalReviewLogService.saveReviewLog(1, null, 2, map.get("error").toString(), personalBill.getId(), personId, null);
                // 添加系统日志
                LogUtil.syslog(sqlSession, "银行卡认证送审失败", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
            }
        }
    } catch (Exception e) {
        retMap.put("retMsg", "出现未知异常,请联系管理员处理");
        String info = mPhone + "认证失败,原因:" + e.getMessage();
        LogUtil.syslog(sqlSession, "银行卡认证", info);
        return retMap;
    }
    return retMap;
}
Also used : BankcardInfo(com.itrus.portal.db.BankcardInfo) PersonInfo(com.itrus.portal.db.PersonInfo) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) Date(java.util.Date) PersonalBill(com.itrus.portal.db.PersonalBill) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with BankcardInfo

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

the class BankcardInfoServiceImpl method saveBankcardInfo.

/**
 * 生成银行卡信息
 * @return
 */
public BankcardInfo saveBankcardInfo(String personName, String phone, String personNo, String bankNo, Long personId, String bankName) {
    BankcardInfo bank = new BankcardInfo();
    bank.setPersonName(personName);
    bank.setPhone(phone);
    bank.setPersonNo(personNo);
    bank.setBankNo(bankNo);
    bank.setUniqueId(personId);
    bank.setCheckTime(new Date());
    bank.setCreateTime(new Date());
    bank.setCreator(personId);
    bank.setBankName(bankName);
    sqlSession.insert("com.itrus.portal.db.BankcardInfoMapper.insert", bank);
    sqlSession.flushStatements();
    return bank;
}
Also used : BankcardInfo(com.itrus.portal.db.BankcardInfo) Date(java.util.Date)

Example 3 with BankcardInfo

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

the class BankCertificationController method pbankrealtestsms.

// 个人银行卡认证接口(三要素)
@RequestMapping("/verify")
@ResponseBody
public Map<String, Object> pbankrealtestsms(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "personId", required = false) Long personId, @RequestParam(value = "productId", required = false) Long productId, @RequestParam(value = "personName", required = true) String personName, @RequestParam(value = "personNo", required = true) String personNo, @RequestParam(value = "bankNo", required = true) String bankNo, HttpServletRequest request) throws Exception {
    // 得到当前个人用户信息
    HttpSession session = request.getSession();
    PersonInfo personInfo = (PersonInfo) session.getAttribute("webuserInfo");
    // 得到当前产品信息
    Product product = productService.getProductById(productId);
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识发送验证码失败,1标识成功
    retMap.put("retCode", 0);
    // 判断是否已经存在订单
    List list = personalBillService.selectPersonalBillByPersonId(2, personId, productId, 8);
    PersonalBill personalBill = null;
    try {
        if (list.size() == 0) {
            // 产生新订单
            personalBill = personalBillService.saveBill(personId, personInfo.getmPhone(), productId, 2, product.getProject(), 1, product.getPrice(), personId, 3);
        } else {
            personalBill = (PersonalBill) list.get(0);
        }
        // 调用银行卡认证接口
        String appId = sysconfigService.getPersonAppid();
        String personUrl = sysconfigService.getPersonUrl();
        String str = personalService.pbankreal(authHmac, appId, personName, personNo, bankNo, personUrl);
        JSONObject jasonObject = JSONObject.parseObject(str);
        Map map = (Map) jasonObject;
        String status = (String) map.get("status");
        PersonInfo personInfo1 = personInfoService.getSelectById(personInfo.getId());
        if ("200".equals(status)) {
            retMap.put("retCode", 1);
            // 添加银行卡信息
            BankcardInfo bank = bankcardInfoService.saveBankcardInfo(personName, null, personNo, bankNo, personId, null);
            // 认证成功修改订单信息
            personalBill.setBankNo(bankNo);
            personalBill.setRealName(personName);
            personalBill.setBillStatus(8);
            personalBill.setIdCode(personNo);
            personalBill.setCheckTime(new Date());
            personalBillService.updateByPersonalBill(personalBill);
            // 修改个人用户信息
            personInfo1.setRealName(personName);
            personInfo1.setPersonName(personName);
            personInfo1.setIdCode(personNo);
            personInfoService.updateByPersonInfo(personInfo1);
            // 生成认证记录
            personalReviewLogService.saveReviewLog(1, null, 1, null, personalBill.getId(), personId, bank.getId());
            // 添加系统日志
            LogUtil.syslog(sqlSession, "银行卡认证送审成功", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
        } else {
            if ("201".equals(status)) {
                retMap.put("retMsg", map.get("message"));
            } else if ("205".equals(status)) {
                retMap.put("retMsg", map.get("error"));
            }
            // 添加系统日志
            LogUtil.syslog(sqlSession, "银行卡认证送审失败", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
            // 认证失败修改订单状态
            personalBill.setBillStatus(4);
            personalBillService.updateByPersonalBill(personalBill);
            // 生成认证记录
            personalReviewLogService.saveReviewLog(1, null, 2, map.get("message").toString(), personalBill.getId(), personId, null);
        }
    } catch (Exception e) {
        // TODO: handle exception
        retMap.put("retMsg", "出现未知异常,请联系管理员处理");
        String info = personName + "认证失败,原因:" + e.getMessage();
        LogUtil.syslog(sqlSession, "银行卡认证", info);
        return retMap;
    }
    return retMap;
}
Also used : BankcardInfo(com.itrus.portal.db.BankcardInfo) PersonInfo(com.itrus.portal.db.PersonInfo) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) Date(java.util.Date) PersonalBill(com.itrus.portal.db.PersonalBill) JSONObject(com.alibaba.fastjson.JSONObject) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

BankcardInfo (com.itrus.portal.db.BankcardInfo)3 Date (java.util.Date)3 JSONObject (com.alibaba.fastjson.JSONObject)2 PersonInfo (com.itrus.portal.db.PersonInfo)2 PersonalBill (com.itrus.portal.db.PersonalBill)2 Product (com.itrus.portal.db.Product)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 HttpSession (javax.servlet.http.HttpSession)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2