Search in sources :

Example 6 with PersonInfo

use of com.itrus.portal.db.PersonInfo 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)

Example 7 with PersonInfo

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

the class IdCertificationController method loadImg3.

/**
 * 得到个人用户的身份证正面照-APP
 * @return
 */
@RequestMapping(value = "/app/front/img/{id}")
public String loadImg3(@PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    OutputStream os = null;
    FileInputStream fis = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        PersonInfo personinfo = personInfoService.getSelectById(id);
        if (personinfo == null) {
            return "status403";
        }
        img = personinfo.getFrontImg();
        File file = null;
        file = filePathUtils.getEnterpriseFile("personalAuth");
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : PersonInfo(com.itrus.portal.db.PersonInfo) OutputStream(java.io.OutputStream) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with PersonInfo

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

the class IdCertificationController method loadImg2.

/**
 * 得到个人用户的免冠照-APP
 * @return
 */
@RequestMapping(value = "/app/img/{id}")
public String loadImg2(@PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    OutputStream os = null;
    FileInputStream fis = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        PersonInfo personinfo = personInfoService.getSelectById(id);
        if (personinfo == null) {
            return "status403";
        }
        img = personinfo.getBareheadedImg();
        File file = null;
        file = filePathUtils.getEnterpriseFile("personalAuth");
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : PersonInfo(com.itrus.portal.db.PersonInfo) OutputStream(java.io.OutputStream) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with PersonInfo

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

the class IdCertificationController method create.

// 跳转shenfenrenzheng页面
@RequestMapping("/create/{productId}")
public String create(@PathVariable("productId") Long productId, HttpServletRequest request, Model uiModel) {
    // 得到当前个人用户信息
    HttpSession session = request.getSession();
    PersonInfo personInfo = (PersonInfo) session.getAttribute("webuserInfo");
    // PersonInfo personInfo =personInfoService.getSelectById(personId);
    // 得到对应的产品
    Product product = productService.getProductById(productId);
    // 得到对应的认证项
    Certification certification = certificationService.getSelectById(product.getAuthentication());
    uiModel.addAttribute("personInfo", personInfo);
    uiModel.addAttribute("product", product);
    uiModel.addAttribute("certification", certification);
    return "gerenrenzheng/shenfenrenzheng";
}
Also used : PersonInfo(com.itrus.portal.db.PersonInfo) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) Certification(com.itrus.portal.db.Certification) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with PersonInfo

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

the class IdCertificationController method loadImg4.

/**
 * 得到个人用户的背面照APP
 * @return
 */
@RequestMapping(value = "/app/back/img/{id}")
public String loadImg4(@PathVariable("id") Long id, HttpServletResponse response) {
    String img = null;
    OutputStream os = null;
    FileInputStream fis = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        PersonInfo personinfo = personInfoService.getSelectById(id);
        if (personinfo == null) {
            return "status403";
        }
        img = personinfo.getBackImg();
        File file = null;
        file = filePathUtils.getEnterpriseFile("personalAuth");
        if (!file.exists()) {
            file.mkdir();
        }
        File imgFile = new File(file, img);
        fis = new FileInputStream(imgFile);
        byte[] bb = IOUtils.toByteArray(fis);
        os = response.getOutputStream();
        os.write(bb);
        os.flush();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // 关闭流!
        try {
            if (null != fis) {
                fis.close();
            }
            if (null != os) {
                os.close();
            }
        } catch (IOException e) {
        }
    }
    return null;
}
Also used : PersonInfo(com.itrus.portal.db.PersonInfo) OutputStream(java.io.OutputStream) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PersonInfo (com.itrus.portal.db.PersonInfo)11 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 Product (com.itrus.portal.db.Product)6 File (java.io.File)6 IOException (java.io.IOException)6 FileInputStream (java.io.FileInputStream)5 OutputStream (java.io.OutputStream)5 HttpSession (javax.servlet.http.HttpSession)5 HashMap (java.util.HashMap)4 List (java.util.List)4 Map (java.util.Map)4 JSONObject (com.alibaba.fastjson.JSONObject)3 PersonalBill (com.itrus.portal.db.PersonalBill)3 Date (java.util.Date)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 BankcardInfo (com.itrus.portal.db.BankcardInfo)2 Certification (com.itrus.portal.db.Certification)2 ArrayList (java.util.ArrayList)2 BankcardInfoExample (com.itrus.portal.db.BankcardInfoExample)1 PersonalBillExample (com.itrus.portal.db.PersonalBillExample)1