use of com.itrus.portal.db.PersonInfo 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;
}
use of com.itrus.portal.db.PersonInfo in project portal by ixinportal.
the class IdCertificationController method loadImg.
/**
* 得到个人用户的免冠照
* @return
*/
@RequestMapping(value = "/img/{id}")
public String loadImg(@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("personaltestsms");
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;
}
use of com.itrus.portal.db.PersonInfo in project portal by ixinportal.
the class IdCertificationController method personaltestsms.
// 测试人像识别接口
@RequestMapping(value = "/personaltestsms")
@ResponseBody
public Map<String, Object> personaltestsms(@RequestHeader("Content-Signature") String authHmac, @RequestParam(value = "personId", required = false) Long personId, @RequestParam(value = "productId", required = false) Long productId, @RequestParam(value = "personName", required = false) String personName, @RequestParam(value = "personNo", required = false) String personNo, @RequestParam(value = "frontPhoto", required = false) String frontPhoto, HttpServletRequest request, Model uiModel) throws Exception {
Map<String, Object> retMap = new HashMap<String, Object>();
// 0标识发送验证码失败,1标识成功
retMap.put("retCode", 0);
// 得到当前个人用户信息
HttpSession session = request.getSession();
PersonInfo personInfo = (PersonInfo) session.getAttribute("webuserInfo");
// PersonInfo personInfo =personInfoService.getSelectById(personId);
// 得到当前产品信息
Product product = productService.getProductById(productId);
// 判断是否已经存在订单
List list = personalBillService.selectPersonalBillByPersonId(1, personId, productId, 8);
PersonalBill personalBill = null;
if (list.size() == 0) {
// 产生新订单
personalBill = personalBillService.saveBill(personId, personInfo.getmPhone(), productId, 1, product.getProject(), 1, product.getPrice(), personId, 3);
} else {
personalBill = (PersonalBill) list.get(0);
}
// 保存图片
// System.out.println(frontPhoto);
File frontImg = personInfoService.saveBareheadedImg(frontPhoto);
// 调用人像认证接口
String appId = sysconfigService.getPersonAppid();
String personUrl = sysconfigService.getPersonUrl();
String str = personalService.personal(authHmac, appId, personName, personNo, frontPhoto, personUrl);
JSONObject jasonObject = JSONObject.parseObject(str);
Map map = (Map) jasonObject;
String status = (String) map.get("status");
PersonInfo personInfo1 = personInfoService.getSelectById(personInfo.getId());
try {
// 判断认证是否成功; 200:成功 ,201:失败 , 205:系统错误
if ("200".equals(status)) {
retMap.put("retCode", 1);
retMap.put("retMsg", map.get("message"));
// 修改个人用户信息
if (frontImg != null && frontImg.isFile()) {
personInfo1.setBareheadedImg(frontImg.getName());
personInfo1.setBareheadedImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
}
personInfo1.setRealName(personName);
personInfo1.setPersonName(personName);
personInfo1.setIdCode(personNo);
personInfoService.updateByPersonInfo(personInfo1);
// 修改订单信息
personalBill.setIdCode(personNo);
personalBill.setRealName(personName);
if (frontImg != null && frontImg.isFile()) {
personalBill.setBareheadedImg(frontImg.getName());
personalBill.setBareheadedImgHash(HMACSHA1.genSha1HashOfFile(frontImg));
}
personalBill.setBillStatus(8);
personalBill.setCheckTime(new Date());
personalBillService.updateByPersonalBill(personalBill);
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 1, null, personalBill.getId(), personId, null);
// 添加系统日志
LogUtil.syslog(sqlSession, "个人实名认证认证通过", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
} else {
if ("201".equals(status)) {
retMap.put("retMsg", map.get("message"));
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 2, map.get("message").toString(), personalBill.getId(), personId, null);
} else if ("205".equals(status)) {
retMap.put("retMsg", map.get("error"));
// 生成认证记录
personalReviewLogService.saveReviewLog(1, null, 2, map.get("error").toString(), personalBill.getId(), personId, null);
}
// 认证失败修改订单状态
personalBill.setBillStatus(4);
personalBillService.updateByPersonalBill(personalBill);
// 添加系统日志
LogUtil.syslog(sqlSession, "个人实名认证认证失败", "产品ID" + personalBill.getProduct() + "订单ID:" + personalBill.getBillId());
}
} catch (Exception e) {
// TODO: handle exception
retMap.put("retMsg", "出现未知异常,请联系管理员处理");
String info = personName + "认证失败,原因:" + e.getMessage();
LogUtil.syslog(sqlSession, "个人实名认证", info);
return retMap;
}
return retMap;
}
use of com.itrus.portal.db.PersonInfo in project portal by ixinportal.
the class PersonInfoController method loadImg.
/**
* 得到个人用户的免冠照
* @return
*/
@RequestMapping(value = "/img/{id}")
public String loadImg(@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("personaltestsms");
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;
}
use of com.itrus.portal.db.PersonInfo in project portal by ixinportal.
the class BankCertificationController method create.
// 跳转yinhangkarenzheng页面
@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("product", product);
uiModel.addAttribute("personInfo", personInfo);
uiModel.addAttribute("certification", certification);
return "gerenrenzheng/yinhangkarenzheng";
}
Aggregations