예제 #1
0
 /**
  * 根据身份证号码查询借款申请信息
  *
  * @return
  * @author: huangzlmf
  * @date: 2015年4月21日 10:14:18
  */
 @RequestMapping("/getByIdNoGroup")
 @ResponseBody
 public Map<String, Object> getByIdNoGroup(String idNo) {
   logger.info("----Start:getByIdNoGroup;idNo=" + idNo + ";");
   Map<String, Object> map = new HashMap<String, Object>();
   if (StringUtils.isBlank(idNo)) {
     map.put("error", true);
     map.put("message", "参数有误!");
     logger.info("----End:getByIdNoGroup;idNo=" + idNo + ";message=参数有误!");
     return map;
   }
   LoanDo loanDo = loanApplyService.getByIdNoGroup(idNo);
   if (loanDo == null) {
     map.put("error", true);
     map.put("message", "身份证号码不存在!");
     logger.info("----End:getByIdNoGroup;idNo=" + idNo + ";message=身份证号码不存在!");
     return map;
   }
   map.put("error", false);
   map.put("realName", loanDo.getRealName());
   map.put("loanStatus", loanDo.getLoanStatus());
   map.put("applyDate", DateFormatUtils.format(loanDo.getCreateTime(), "yyyy-MM-dd"));
   if (loanDo.getLoanStatus().equals(LoanStatus.SUBJECTED)
       || loanDo.getLoanStatus().equals(LoanStatus.REPAYING)) {
     map.put("auditDate", DateFormatUtils.format(loanDo.getUpdateTime(), "yyyy-MM-dd"));
   } else {
     map.put("auditDate", "");
   }
   if (loanDo.getLoanStatus().equals(LoanStatus.REPAYING)) {
     map.put("loanDate", DateFormatUtils.format(loanDo.getLoanTime(), "yyyy-MM-dd"));
   } else {
     map.put("loanDate", "");
   }
   logger.info("----End:getByIdNoGroup;idNo=" + idNo + ";");
   return map;
 }
예제 #2
0
  /**
   * 新增借款申请信息
   *
   * @return
   * @author: huangzlmf
   * @date: 2015年4月21日 21:09:54
   */
  @RequestMapping(value = "/addLoanDetailGroup", method = RequestMethod.POST)
  public String addLoanDetailGroup(
      LoanDo loanDetailDo, String idNo, double income, ModelMap map, HttpSession session) {
    logger.info("----Start:addLoanDetailGroup;loanDetailDo=" + loanDetailDo + ";");
    String isSuccess = "F";
    //		AccountUserDo userDo =(AccountUserDo) session.getAttribute("user");
    String mobile = loanDetailDo.getMobile();
    String realName = loanDetailDo.getRealName();
    //		if(null==userDo || null==userDo.getId()){
    IResult<AccountUserDo> result =
        userService.register(
            -1, "", mobile, DigestUtils.md5Hex(mobile + WebConstants.PASS_KEY), 100, -1);
    AccountUserDo userDo = result.getModel();
    //	        session.setAttribute("user",  userDo );
    if (result.isSuccess()) {
      userService.updatePerson(userDo, realName, idNo, mobile);
    }
    //			isSuccess="N";
    //			return "redirect:/toSuccessGroup?isSuccess="+isSuccess;
    //		}
    String remarkTemp = loanDetailDo.getRemark() == null ? "" : loanDetailDo.getRemark().trim();
    String groupName = "";
    if (remarkTemp != null && remarkTemp.length() > 0) {
      String[] caddressArray = remarkTemp.split(":");
      if (caddressArray != null && caddressArray.length >= 2) {
        groupName = caddressArray[0].trim();
      }
    }
    LoanDo loanDo = new LoanDo();
    int loanPeriod = loanDetailDo.getLoanPeriod();
    loanDo.setLoanPeriod(loanPeriod);
    loanDo.setUserId(userDo.getId());
    loanDo.setApplyAmount(loanDetailDo.getLoanAmount());
    loanDo.setLoanType(1);
    loanDo.setLoanUsage("集团贷");
    loanDo.setChannelId(getGroupNo(groupName));
    /*
    loanDo.setAnnualRate(loanPeriod == 3 ? 8.4 : 9.0);
    */
    loanDo.setAnnualRate(18.0);
    // 2015-05-26 集团贷统一基准利率是18/年

    loanDo.setProductCode("D01");
    loanDo.setOrderCode(commonService.generateOrderCode("D01"));
    loanDo.setLoanStatus(com.hehenian.biz.common.loan.dataobject.LoanDo.LoanStatus.PENDING);
    loanDo.setSchemeId(5l);

    LoanPersonDo loanPersonDo = new LoanPersonDo();
    loanPersonDo.setRealName(realName);

    loanPersonDo.setIdNo(idNo);
    loanPersonDo.setMobile(mobile);
    loanPersonDo.setAge(IdCardUtils.getAgeByIdCard(idNo));
    String sexString = IdCardUtils.getGenderByIdCard(idNo);
    loanPersonDo.setSex(sexString.equals("M") ? LoanPersonDo.Sex.MALE : LoanPersonDo.Sex.FEMALE);

    JobDo jobDo = new JobDo();
    jobDo.setJobIncome(income);
    jobDo.setCompanyName(remarkTemp);
    jobDo.setPosition("3");
    jobDo.setJobYear(0);
    jobDo.setCompanyPhone("未知");
    jobDo.setJobType(JobType.SALARYMAN);

    loanPersonDo.setJobDo(jobDo);
    loanDo.setLoanPersonDo(loanPersonDo);

    Long res = loanApplyService.saveLoan(loanDo);

    if (res != null && res.longValue() > 0) {
      String smsTemp =
          loanDo.getLoanPersonDo().getRealName()
              + ",手机号码:"
              + loanDo.getLoanPersonDo().getMobile()
              + ",申请贷 款金额:"
              + loanDo.getApplyAmount()
              + "元,申请时间:"
              + new SimpleDateFormat("yyyy年MM月dd日").format(new Date())
              + "";
      String smsStr = "集团贷 新的贷 款申请订单:贷 款人:" + smsTemp;
      NotifyDo nd = new LoanSMSNotifyDo(smsStr, getMobileArr(""), "mail_template_default.ftl");
      smsNotifyService.send(nd);

      smsStr = "贷 款申请提交成功,正在受理:贷 款人:" + smsTemp;
      nd =
          new LoanSMSNotifyDo(
              smsStr, loanDo.getLoanPersonDo().getMobile(), "mail_template_default.ftl");
      smsNotifyService.send(nd);
      isSuccess = "T";
    }
    logger.info("----End:addLoanDetailGroup;loanDetailDo=" + loanDetailDo + ";");
    return "redirect:/toSuccessGroup?isSuccess=" + isSuccess;
  }