Search in sources :

Example 36 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class BindCertWebController method sendCode.

/**
 * 绑定证书时发送验证码
 *
 * @param mPhone
 * @param project
 * @param certBase64
 * @return
 */
@RequestMapping("/sendCode")
@ResponseBody
public Map<String, Object> sendCode(@RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "project", required = true) Long project, @RequestParam(value = "certBase64", required = true) String certBase64, HttpSession session) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识发送验证码失败,1标识成功
    retMap.put("retCode", 0);
    // 是否登录
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        // 登录状态失效,跳转到注册页面
        // 2标识登录已经失效,需跳转到登录页面
        retMap.put("retCode", 2);
        retMap.put("retMsg", "登录已经失效");
        return retMap;
    }
    try {
        // 判断该证书是否已经绑定有用户
        UserInfo userInfo = userInfoService.getUserInfoByMphone(mPhone);
        // 0表示没有用户,1表示有用户
        retMap.put("hasUserInfo", 0);
        if (null != userInfo) {
            // 1表示有用户
            retMap.put("hasUserInfo", 1);
            // 判断是否和证书绑定
            if (userCertService.isBindCert(userInfo.getId(), certBase64)) {
                retMap.put("retMsg", "该证书已绑定过用户");
                return retMap;
            }
        }
        // 发送验证码
        // ZSBD表示短信模版类型为‘绑定证书’。
        dynamicCodeService.sendCode(mPhone, project, "ZSBD");
        retMap.put("retCode", 1);
    } catch (UserInfoServiceException e) {
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (CertificateException e) {
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (SigningServerException e) {
        retMap.put("retMsg", e.getMessage());
        return retMap;
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) Enterprise(com.itrus.portal.db.Enterprise) SigningServerException(com.itrus.cryptorole.SigningServerException) UserInfo(com.itrus.portal.db.UserInfo) CertificateException(java.security.cert.CertificateException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 37 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class ClientWebController method submitOrder.

// TODO 用户提交订单:确认订单页面,点击去支付
@RequestMapping("/submitOrder")
@ResponseBody
public Map<String, Object> submitOrder(@RequestParam(value = "projectId", required = true) Long projectId, @RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productNum", required = true) Integer productNum, @RequestParam(value = "productSpecId", required = true) Long productSpecId, @ModelAttribute("enterprise") Enterprise enterprise, @ModelAttribute("userInfo") UserInfo userInfo, @ModelAttribute("einvoice") Einvoice einvoice, @ModelAttribute("businessLicense") BusinessLicense businessLicense, @ModelAttribute("orgCode") OrgCode orgCode, @ModelAttribute("taxregisterCert") TaxRegisterCert taxregisterCert, @ModelAttribute("agent") Agent agent, @ModelAttribute("openBankInfo") OpenBankInfo openBankInfo, @ModelAttribute("identityCard") IdentityCard identityCard, HttpServletRequest request) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识失败,1标识成功
    retMap.put("retCode", 0);
    HttpSession session = request.getSession();
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        retMap.put("retMsg", "用户登录信息已失效,请重新登录");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
    if (null == product) {
        retMap.put("retMsg", "产品信息不存在,请重新选择产品");
        return retMap;
    }
    ExtraProductSpec productSpec = extraProductSpecService.selectByPrimaryKey(productSpecId);
    if (null == productSpec || productSpec.getIsValid().equals(false)) {
        retMap.put("retMsg", "规格信息不存在或已经失效,请重新选择规格");
        return retMap;
    }
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        // 保存发票信息(填写了发票信息才保存,未填写则不保存)
        if (StringUtils.isNotBlank(einvoice.getName()) && StringUtils.isNotBlank(einvoice.getIdNumber()) && null != einvoice.geteReiceipt())
            einvoice = EinvoiceService.saveEInvoice(webuserInfo.getId(), einvoice);
        // 计算订单价格
        Double billSum = null;
        billSum = productNum * productSpec.getPrice();
        // 生成订单
        ExtraBill bill = extraBillService.saveExtraBill(projectId, webuserInfo.getId(), webenterprise.getId(), productId, productSpecId, null != einvoice.getId() ? einvoice.getId() : null, productNum, billSum, ComNames.EXTRA_BILL_STATUS_1);
        // ""字符串判断,改为Null,避免覆盖数据库中的信息
        if (null != enterprise && StringUtils.isBlank(enterprise.getProvince())) {
            enterprise.setProvince(null);
        }
        if (null != enterprise && StringUtils.isBlank(enterprise.getCity())) {
            enterprise.setCity(null);
        }
        if (null != enterprise && StringUtils.isBlank(enterprise.getShortName())) {
            enterprise.setShortName(null);
        }
        // 更新用户信息和企业信息
        if (null != enterprise && null == enterprise.getId()) {
            enterprise.setId(webenterprise.getId());
        }
        if (null != userInfo && null == userInfo.getId()) {
            userInfo.setId(webuserInfo.getId());
        }
        enterprise = enterpriseService.updateByPrimaryKeySelective(enterprise);
        userInfo = userInfoService.updateByPrimaryKeySelective(userInfo);
        // 获取产品需要的附加信息项
        ExtraMessage extraMessage = extraMessageService.selectByPrimaryKey(product.getExtraMessage());
        // 是否有营业执照信息,默认false没有
        boolean hasBl = false;
        if (null != extraMessage) {
            // //企业信息 认证项(1.企业名称,2.统一社会信用代码/营业执照,3.组织机构代码,4.税务登记号)
            if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
                if (StringUtils.isNotBlank(extraMessage.getEnterpriseItems())) {
                    if (extraMessage.getEnterpriseItems().contains("1")) {
                    }
                    if (extraMessage.getEnterpriseItems().contains("2") && !webenterprise.getEnterpriseNature().equals(3)) {
                        // 事业单位不填写营业执照
                        hasBl = true;
                        // 需要统一社会信用代码/营业执照实名认证项,但是页面没有传递过来的时候,用老的
                        if (null == businessLicense || !StringUtils.isNotBlank(businessLicense.getImgFile())) {
                            List<BusinessLicense> businessLicenses = businessService.getBusinessLicensesNews(webenterprise.getId());
                            if (null != businessLicenses && !businessLicenses.isEmpty()) {
                                businessLicense = businessLicenses.get(0);
                                businessLicense.setImgFile(null);
                            }
                        }
                        businessLicense = businessService.saveBusinessExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), businessLicense, ComNames.ITEM_STATUS_2, null);
                    }
                    if (extraMessage.getEnterpriseItems().contains("3")) {
                        // 需要统一组织机构代码认证项,但是页面没有传递过来的时候,用老的
                        if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
                        1))) {
                            if (null == orgCode || !StringUtils.isNotBlank(orgCode.getImgFile())) {
                                List<OrgCode> orgCodes = orgCodeService.getOrgCodesNews(webenterprise.getId());
                                if (null != orgCodes && !orgCodes.isEmpty()) {
                                    orgCode = orgCodes.get(0);
                                    orgCode.setImgFile(null);
                                }
                            }
                            orgCode = orgCodeService.saveOrgCodeExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), orgCode, ComNames.ITEM_STATUS_2, null);
                        }
                    }
                    if (extraMessage.getEnterpriseItems().contains("4")) {
                        if (!(hasBl && businessLicense.getBusinessType().equals(// 五证合一企业不用提交组织机构代码、税务登记信息
                        1))) {
                            // 保存税务登记证
                            if (// 事业单位不填写税务登记信息
                            !webenterprise.getEnterpriseNature().equals(3)) {
                                // 需要税务登记实名认证项,但是页面没有传递过来的时候,用老的
                                if (null == taxregisterCert || !StringUtils.isNotBlank(taxregisterCert.getImgFile())) {
                                    List<TaxRegisterCert> taxRegisterCerts = taxCertService.getTaxRegisterCertsNews(webenterprise.getId());
                                    if (null != taxRegisterCerts && !taxRegisterCerts.isEmpty()) {
                                        taxregisterCert = taxRegisterCerts.get(0);
                                        taxregisterCert.setImgFile(null);
                                    }
                                }
                                taxregisterCert = taxCertService.saveTaxCertExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), taxregisterCert, ComNames.ITEM_STATUS_2, null);
                            }
                        }
                    }
                }
            }
            // field string --fieldName agentItems
            if (StringUtils.isNotBlank(extraMessage.getAgentItems())) {
                if (null == agent || StringUtils.isBlank(agent.getFrontImg())) {
                    List<Agent> agents = agentService.getAgentsNews(webenterprise.getId());
                    if (null != agents && !agents.isEmpty()) {
                        agent = agents.get(0);
                        agent.setFrontImg(null);
                        agent.setBackImg(null);
                    }
                }
                agent = agentService.saveAgentExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), agent, ComNames.ITEM_STATUS_2, null);
            }
            // field string --fieldName bankItems
            if (StringUtils.isNotBlank(extraMessage.getBankItems())) {
                if (null == openBankInfo || StringUtils.isBlank(openBankInfo.getBankNumber())) {
                    List<OpenBankInfo> openBankInfos = openBankInfoService.getOpenBankInfosNews(webenterprise.getId());
                    if (null != openBankInfos && !openBankInfos.isEmpty()) {
                        openBankInfo = openBankInfos.get(0);
                    }
                }
                openBankInfo = openBankInfoService.saveOpenBankInfoExtraBill(webenterprise.getId(), bill.getId(), webuserInfo.getId(), openBankInfo, ComNames.ITEM_STATUS_2, null);
            }
            // field string  --fieldName identityCardItems
            if (StringUtils.isNotBlank(extraMessage.getIdentityCardItems())) {
                if (null == identityCard || StringUtils.isBlank(identityCard.getFrontImg())) {
                    List<IdentityCard> identityCards = identityCardService.getIdentityCardsNews(webenterprise.getId());
                    if (null != identityCards && !identityCards.isEmpty()) {
                        identityCard = identityCards.get(0);
                        identityCard.setFrontImg(null);
                        identityCard.setBackImg(null);
                    }
                }
                identityCard = identityCardService.saveIdentityCardExtraBill(webenterprise.getId(), webenterprise.getEnterpriseSn(), bill.getId(), webuserInfo.getId(), identityCard, ComNames.ITEM_STATUS_2, null);
            }
        }
        transactionManager.commit(status);
        retMap.put("retCode", 1);
        retMap.put("billId", bill.getId());
        // 更新session用户和企业信息
        webenterprise = enterpriseService.getEnterpriseById(webenterprise.getId());
        webuserInfo = userInfoService.getUserInfoById(webuserInfo.getId());
        session.setAttribute("webenterprise", webenterprise);
        session.setAttribute("webuserInfo", webuserInfo);
        // 记录日志
        UserLog userlog = new UserLog();
        userlog.setProject(projectId);
        userlog.setType("购买增值产品");
        userlog.setInfo(webuserInfo.getmPhone() + "购买了" + product.getAppName());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        return retMap;
    } catch (UserInfoServiceException e) {
        if (!status.isCompleted()) {
            transactionManager.rollback(status);
        }
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        if (!status.isCompleted()) {
            transactionManager.rollback(status);
        }
        UserLog userlog = new UserLog();
        userlog.setProject(projectId);
        userlog.setType("购买增值产品");
        userlog.setInfo("url:submitOrder,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
        return retMap;
    } finally {
        if (!status.isCompleted()) {
            transactionManager.rollback(status);
        }
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) ExtraBill(com.itrus.portal.db.ExtraBill) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) IdentityCard(com.itrus.portal.db.IdentityCard) Agent(com.itrus.portal.db.Agent) HttpSession(javax.servlet.http.HttpSession) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserLog(com.itrus.portal.db.UserLog) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) ExtraMessage(com.itrus.portal.db.ExtraMessage) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 38 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class ClientWebController method submitOrderJYHSQ.

/**
 * 仅用户授权产品订单提交接口
 * @param projectId
 * @param productId
 * @param productNum
 * @param request
 * @return
 */
@RequestMapping("/submitOrder/jyhsq")
@ResponseBody
public Map<String, Object> submitOrderJYHSQ(@RequestParam(value = "projectId", required = true) Long projectId, @RequestParam(value = "productId", required = true) Long productId, @RequestParam(value = "productNum", required = true) Integer productNum, HttpServletRequest request) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识失败,1标识成功
    retMap.put("retCode", 0);
    HttpSession session = request.getSession();
    UserInfo webuserInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise webenterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == webuserInfo || null == webenterprise) {
        retMap.put("retMsg", "用户登录信息已失效,请重新登录");
        return retMap;
    }
    ExtraProduct product = extraProductService.selectByPrimaryKey(productId);
    if (null == product) {
        retMap.put("retMsg", "产品信息不存在,请重新选择产品");
        return retMap;
    }
    // 查询用户是否曾经买过了该产品对于的订单,如果买了,则提示只能购买一次
    List<ExtraBill> bills = extraBillService.getHasByExtraBill(webuserInfo.getId(), webenterprise.getId(), productId);
    if (null != bills && bills.size() > 0) {
        retMap.put("retMsg", "该产品每个用户仅需开通一次即可");
        retMap.put("retCode", 2);
        return retMap;
    }
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        // 计算订单价格
        Double billSum = null;
        billSum = 0d;
        // 生成订单
        ExtraBill bill = extraBillService.saveExtraBill(projectId, webuserInfo.getId(), webenterprise.getId(), productId, null, null, productNum, billSum, ComNames.EXTRA_BILL_STATUS_7);
        retMap.put("retCode", 1);
        retMap.put("billId", bill.getId());
        // 记录日志
        UserLog userlog = new UserLog();
        userlog.setProject(projectId);
        userlog.setType("购买增值产品");
        userlog.setInfo(webuserInfo.getmPhone() + "购买了" + product.getAppName());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        transactionManager.commit(status);
        return retMap;
    } catch (UserInfoServiceException e) {
        // TODO: handle exception
        if (!status.isCompleted())
            transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        if (!status.isCompleted())
            transactionManager.rollback(status);
        UserLog userlog = new UserLog();
        userlog.setProject(projectId);
        userlog.setType("购买增值产品");
        userlog.setInfo("url:submitOrder,详细错误:" + e.getMessage());
        userlog.setHostId("未知");
        userlog.setSn(null == webuserInfo.getUniqueId() ? null : webuserInfo.getUniqueId());
        LogUtil.userlog(sqlSession, userlog);
        retMap.put("retMsg", "服务端出现未知错误,请联系管理员");
        return retMap;
    }
}
Also used : DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) ExtraProduct(com.itrus.portal.db.ExtraProduct) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 39 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class UnlockKeyBillController method verifyAndRegister.

/**
 * 解锁订单提交,用户输入手机号时进行校验
 * @param has_userInfo
 * @param mPhone
 * @param code
 * @param password
 * @param keySn
 * @param enterprise
 * @param session
 * @return
 */
@RequestMapping("/verifyAndRegister")
@ResponseBody
public Map<String, Object> verifyAndRegister(@RequestParam(value = "has_userInfo", required = true) Integer has_userInfo, @RequestParam(value = "keySn", required = true) String keySn, @RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "code", required = true) String code, @RequestParam(value = "password", required = false) String password, HttpSession session) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 错误
    retMap.put("retCode", 0);
    ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
    if (null == projectKeyInfo) {
        retMap.put("retMsg", "无法识别Key序列号:" + keySn + ",所属的项目,请联系系统管理员配置");
        return retMap;
    }
    Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
    // 验证动态码,
    if (!dynamicCodeService.verifyCode(mPhone, code)) {
        retMap.put("retMsg", "动态码验证失败");
        return retMap;
    }
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(def);
    try {
        UserInfo userInfo = userInfoService.getUserInfoByMphone(mPhone);
        if (null != has_userInfo && has_userInfo.equals(0)) {
            // 绑定用户和证书
            if (null == userInfo) {
                if (StringUtils.isBlank(password)) {
                    retMap.put("retMsg", "请先设置登录口令");
                    return retMap;
                }
                if (project != null) {
                    // 先自动创建用户
                    userInfo = userInfoService.registerUserInfo(mPhone, password, project.getId());
                    // 记录系统日志
                    String info = mPhone + "注册成功";
                    LogUtil.syslog(sqlSession, "注册用户", info);
                }
            }
        }
        // // 获取证书
        // UserCert userCert = userCertService.getUserCert(certBase64);
        // // key序列号
        // if (StringUtils.isNotBlank(keySn)){
        // userCert.setKeySn(keySn);
        // }
        transactionManager.commit(status);
        // 返回绑定成功
        retMap.put("retCode", 1);
    } catch (UserInfoServiceException e) {
        if (!status.isCompleted())
            transactionManager.rollback(status);
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        if (!status.isCompleted())
            transactionManager.rollback(status);
        retMap.put("retMsg", "服务端出现未知异常,请联系管理员");
        String info = mPhone + "校验和注册用户失败,原因:" + e.getMessage();
        LogUtil.syslog(sqlSession, "解锁校验", info);
        return retMap;
    } finally {
        if (!status.isCompleted())
            transactionManager.rollback(status);
    }
    return retMap;
}
Also used : Project(com.itrus.portal.db.Project) DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 40 with UserInfoServiceException

use of com.itrus.portal.exception.UserInfoServiceException in project portal by ixinportal.

the class UnlockKeyBillController method sendCodeJSSQYZ.

/**
 * 获取:解锁申请验证码
 * 需要先判断用户输入的手机号是否已经存在了,如果已经存在了,则只需要验证验证码即可然后跳转首页, 如果不存在,则需要输入密码
 * retMap.put("hasUserInfo", 1);// 0表示没有用户,1表示有用户
 * @param mPhone
 * @param project
 * @param certBase64
 * @return
 */
@RequestMapping("/sendCode")
@ResponseBody
public Map<String, Object> sendCodeJSSQYZ(@RequestParam(value = "mPhone", required = true) String mPhone, @RequestParam(value = "certBase64", required = true) String certBase64, @RequestParam(value = "keySn", required = true) String keySn, HttpSession session) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识发送验证码失败,1标识成功
    retMap.put("retCode", 0);
    // 根据key序列号,获取证书
    ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
    if (null == projectKeyInfo) {
        retMap.put("retMsg", "无法识别该序列号:" + keySn + ", 请联系系统管理进行配置");
        return retMap;
    }
    Project project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
    try {
        // 判断该证书是否已经绑定有用户
        UserInfo userInfo = userInfoService.getUserInfoByMphone(mPhone);
        // 0表示没有用户,1表示有用户
        retMap.put("has_userInfo", 0);
        if (null != userInfo) {
            retMap.put("has_userInfo", 1);
            retMap.put("eMail", userInfo.getEmail());
        }
        // 发送验证码,JSSQYZ
        dynamicCodeService.sendCodeJSSQYZ(mPhone, project.getId(), "JSSQYZ");
        retMap.put("retCode", 1);
    } catch (UserInfoServiceException e) {
        retMap.put("retMsg", e.getMessage());
        return retMap;
    }
    return retMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectKeyInfo(com.itrus.portal.db.ProjectKeyInfo) 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

UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)73 Date (java.util.Date)39 HashMap (java.util.HashMap)31 File (java.io.File)26 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)22 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)21 Enterprise (com.itrus.portal.db.Enterprise)19 IOException (java.io.IOException)19 UserInfo (com.itrus.portal.db.UserInfo)17 TransactionStatus (org.springframework.transaction.TransactionStatus)14 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)14 SigningServerException (com.itrus.cryptorole.SigningServerException)11 IdentityCard (com.itrus.portal.db.IdentityCard)11 CertificateException (java.security.cert.CertificateException)11 BusinessLicense (com.itrus.portal.db.BusinessLicense)10 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)10 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)10 Agent (com.itrus.portal.db.Agent)9 OrgCode (com.itrus.portal.db.OrgCode)9 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)9