Search in sources :

Example 86 with UserInfo

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

the class DoUnlockKeyController method toUnlockFailPage.

@RequestMapping("/toUnlockFailPage/{billId}")
public String toUnlockFailPage(@PathVariable("billId") Long billId, Model uiModel) {
    Bill bill = billService.getBill(billId);
    UserInfo userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
    Proxy proxy = proxyService.getProxyByBillId(bill.getId());
    OnPayInfo onPayInfo = onPayInfoService.selectByPrimaryKey(bill.getOnPayInfo());
    UserCert userCert = userCertService.selectByPrimaryKey(bill.getUnlockUserCert());
    uiModel.addAttribute("mPhone", userInfo.getmPhone());
    uiModel.addAttribute("userCert", userCert);
    uiModel.addAttribute("bill", bill);
    uiModel.addAttribute("onPayInfo", onPayInfo);
    uiModel.addAttribute("proxy", proxy);
    uiModel.addAttribute("keySn", userCert.getKeySn());
    uiModel.addAttribute("certSn", userCert.getCertSn());
    return "clientFW/jiesuoyichang";
}
Also used : Proxy(com.itrus.portal.db.Proxy) OnPayInfo(com.itrus.portal.db.OnPayInfo) Bill(com.itrus.portal.db.Bill) UserInfo(com.itrus.portal.db.UserInfo) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 87 with UserInfo

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

the class DoUnlockKeyController method sendCodeByZSJS.

/**
 * 发送解锁授权码
 * @param mphone
 * @return
 */
@RequestMapping("/sendCodeByZSJS")
@ResponseBody
public Map<String, Object> sendCodeByZSJS(@RequestParam("mPhone") String mPhone, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    Project project = null;
    try {
        // 根据key序列号,获取证书
        ProjectKeyInfo projectKeyInfo = cacheCustomer.findProjectByKey(keySn);
        if (null == projectKeyInfo) {
            retMap.put("retMsg", "无法识别该序列号:" + keySn + ", 请联系系统管理进行配置");
            return retMap;
        }
        project = projectService.selectByPrimaryKey(projectKeyInfo.getProject());
        UserInfo userInfo = userInfoService.getUserInfoByMphone(mPhone);
        if (null == userInfo) {
            retMap.put("retMsg", "手机号对应的用户不存在,请检查手机号是否正确:" + mPhone);
            return retMap;
        }
        // ZSJS表示短信模版类型为‘证书解锁’。
        if (dynamicCodeService.sendCodeZSJS(mPhone, project.getId(), "ZSJS")) {
            retMap.put("retCode", 1);
            return retMap;
        }
    } catch (UserInfoServiceException e) {
        retMap.put("retMsg", e.getMessage());
        return retMap;
    } catch (Exception e) {
        retMap.put("retMsg", "发送证书解锁短信出现异常,请联系系统管理员");
        UserLog userLog = new UserLog();
        userLog.setCreateTime(new Date());
        userLog.setHostId("未知");
        userLog.setInfo(e.getMessage());
        userLog.setIp("未知");
        userLog.setProject(project.getId());
        userLog.setSn(null);
        userLog.setType("发送证书解锁短信");
        return retMap;
    }
    retMap.put("retMsg", "发送证书解锁短信失败,请联系系统管理员");
    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) UserLog(com.itrus.portal.db.UserLog) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 88 with UserInfo

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

the class DoUnlockKeyController method unlockResult.

/**
 * 解锁结果.
 * @param isUnlockSuccess,是否解锁成功.true解锁成功,false解锁失败
 * @param certSn
 * @param keySn
 * @param enterpriseName
 * @param newPassword
 * @param uiModel
 * @return
 */
@RequestMapping("/unlockResult")
@ResponseBody
public Map<String, Object> unlockResult(@RequestParam("isUnlockSuccess") Boolean isUnlockSuccess, @RequestParam("billId") Long billId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam(value = "enterpriseName", required = false) String enterpriseName, @RequestParam("newPassword") String newPassword, @RequestParam(value = "errorMsg", required = false) String errorMsg, Model uiModel, HttpSession session) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    boolean verifyCodeZSJS = (boolean) session.getAttribute("verifyCodeZSJS");
    if (!verifyCodeZSJS) {
        // 查看解锁短信验证是否成功
        retMap.put("retMsg", "短信验证失败");
        return retMap;
    }
    session.removeAttribute("verifyCodeZSJS");
    DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
    dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(dtd);
    UserInfo userInfo = null;
    Bill bill = null;
    try {
        bill = billService.getBill(billId);
        if (null == bill) {
            retMap.put("retMsg", "订单不存在");
            return retMap;
        }
        userInfo = userInfoService.getUserInfoById(bill.getUniqueId());
        KeyUnlock keyUnlock = keyUnlockService.getKeyUnlockByBillId(billId);
        if (null == keyUnlock) {
            retMap.put("retMsg", "解锁信息不存证");
            return retMap;
        }
        UserCert userCert = userCertService.getUserCertByCertSn(certSn);
        if (isUnlockSuccess) {
            // 解锁成功,若不需要开票,则直接完成
            if (null == bill.geteInvoice() && null == bill.getInvoice()) {
                bill.setBillStatus(ComNames.BILL_STATUS_8);
            } else {
                // 需要开票,校验是否已经开票了
                if (null != bill.getIsInvoiced() && bill.getIsInvoiced().equals(1)) {
                    bill.setBillStatus(ComNames.BILL_STATUS_8);
                } else {
                    bill.setBillStatus(ComNames.BILL_STATUS_18);
                }
            }
            keyUnlock.setUnlockTime(new Date());
            keyUnlock.setStatus("UNLOCK");
            // 审批解锁成功后,证书和手机号绑定成功,无需登录时再次绑定
            if (null == userCert.getUserinfo() || !userCert.getUserinfo().equals(userInfo.getId())) {
                userCert.setUserinfo(userInfo.getId());
                if (null == userCert.getEnterprise()) {
                    userCert.setEnterprise(bill.getEnterprise());
                }
                // 若进行管理员解锁,且订单用户与证书绑定用户不一致,则更换证书所绑定的用户为当前订单用户
                if (null != userCert.getUserinfo() && !userCert.getUserinfo().equals(userInfo.getId())) {
                    userCert.setUserinfo(userInfo.getId());
                }
                userCertService.updateByPrimaryKeySelective(userCert);
            }
        } else {
            // 解锁异常
            bill.setBillStatus(ComNames.BILL_STATUS_17);
        }
        billService.updateBill(bill);
        keyUnlockService.updateByPrimaryKey(keyUnlock);
        transactionManager.commit(status);
        if (isUnlockSuccess) {
            LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁成功,keySn:" + keySn, "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
        } else {
            LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁失败,keySn:" + keySn + ", 错误信息" + errorMsg, "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
        }
        retMap.put("retCode", 1);
    } catch (Exception e) {
        if (!status.isCompleted()) {
            transactionManager.rollback(status);
        }
        LogUtil.userlog(sqlSession, bill.getProject(), "证书解锁", "解锁异常,keySn:" + keySn + "异常信息:" + e.getMessage(), "未知", "", null == userInfo.getUniqueId() ? null : userInfo.getUniqueId());
        retMap.put("retMsg", "证书解锁出现异常,请联系系统管理员进行处理!");
    } finally {
        if (!status.isCompleted()) {
            transactionManager.rollback(status);
        }
    }
    return retMap;
}
Also used : KeyUnlock(com.itrus.portal.db.KeyUnlock) DefaultTransactionDefinition(org.springframework.transaction.support.DefaultTransactionDefinition) HashMap(java.util.HashMap) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Bill(com.itrus.portal.db.Bill) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 89 with UserInfo

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

the class MakeCertController method sendReNewInfo.

/**
 * 发送待更新短信通知
 *
 * @param id
 *            订单id
 * @return
 */
@RequestMapping("/sendReNewInfo")
@ResponseBody
public Map<String, Object> sendReNewInfo(@RequestParam(value = "billId") Long id) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    // 0标识发送验证码失败,1标识成功
    retMap.put("retCode", 0);
    Bill bill = sqlSession.selectOne("com.itrus.portal.db.BillMapper.selectByPrimaryKey", id);
    if (null != bill.getRenewSms() && bill.getRenewSms() == true) {
        retMap.put("message", "该用户已经发送过短信通知了,不能重复发送");
        return retMap;
    }
    // 获取订单对应的产品信息
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByPrimaryKey", bill.getProduct());
    String productName = product.getName();
    // 发送短信所需要的信息
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    UserCertExample userCertExample = new UserCertExample();
    UserCertExample.Criteria criteria = userCertExample.or();
    criteria.andIdEqualTo(bill.getOldUserCert());
    UserCert userCert = sqlSession.selectOne("com.itrus.portal.db.UserCertMapper.selectByExample", userCertExample);
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    Long projectId = bill.getProject();
    String mPhone = userInfo.getmPhone();
    String keySn = userCert.getKeySn();
    if (null == keySn) {
        keySn = "该证书未绑定key";
    }
    String enterpriseName = enterprise.getEnterpriseName();
    Date endTime = userCert.getCertEndTime();
    // 执行发送
    try {
        makeCerServiceImpl.sendReNewInfo(bill, mPhone, projectId, "ZSGX", keySn, enterpriseName, endTime, productName);
        retMap.put("retCode", 1);
        retMap.put("message", "发送更新通知短信成功");
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
        retMap.put("message", "发送短信失败,请联系管理员");
        String type = "发送更新证书通知失败";
        String info = "用户电话:" + mPhone + "错误信息:" + e.getMessage();
        LogUtil.syslog(sqlSession, type, info);
    }
    return retMap;
}
Also used : HashMap(java.util.HashMap) UserCertExample(com.itrus.portal.db.UserCertExample) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) Date(java.util.Date) EncDecException(com.itrus.portal.exception.EncDecException) IOException(java.io.IOException) RaServiceUnavailable_Exception(cn.topca.tca.ra.service.RaServiceUnavailable_Exception) Bill(com.itrus.portal.db.Bill) Enterprise(com.itrus.portal.db.Enterprise) JSONObject(com.alibaba.fastjson.JSONObject) UserCert(com.itrus.portal.db.UserCert) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 90 with UserInfo

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

the class ExtraBillReceiptController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    List<Long> projectsOfAdminList = Arrays.asList(projectsOfAdmin);
    ExtraBillExample billExample = new ExtraBillExample();
    ExtraBillExample.Criteria criteria = billExample.or();
    criteria.andIdEqualTo(id);
    criteria.andProjectIn(projectsOfAdminList);
    ExtraBill bill = sqlSession.selectOne("com.itrus.portal.db.ExtraBillMapper.selectByExample", billExample);
    if (null == bill) {
        uiModel.addAttribute("errorMsg", "未找到该订单");
        return "status403";
    }
    uiModel.addAttribute("bill", bill);
    // 项目
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", bill.getProject());
    uiModel.addAttribute("project", project);
    // 企业
    Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByPrimaryKey", bill.getEnterprise());
    uiModel.addAttribute("enterprise", enterprise);
    // 产品
    ExtraProduct product = sqlSession.selectOne("com.itrus.portal.db.ExtraProductMapper.selectByPrimaryKey", bill.getExtraProduct());
    uiModel.addAttribute("product", product);
    // 规格
    ExtraProductSpec productSpec = sqlSession.selectOne("com.itrus.portal.db.ExtraProductSpecMapper.selectByPrimaryKey", bill.getExtraProductSpec());
    uiModel.addAttribute("productSpec", productSpec);
    // 服务商
    ServiceProvider serviceProvider = serviceProviderService.selectByPrimaryKey(product.getServiceProvider());
    uiModel.addAttribute("serviceProvider", serviceProvider);
    // 用户
    UserInfo userInfo = sqlSession.selectOne("com.itrus.portal.db.UserInfoMapper.selectByPrimaryKey", bill.getUniqueId());
    uiModel.addAttribute("userInfo", userInfo);
    // 第三方支付信息
    OnPayInfo onPayInfo = sqlSession.selectOne("com.itrus.portal.db.OnPayInfoMapper.selectByPrimaryKey", bill.getOnPayInfo());
    uiModel.addAttribute("onPayInfo", onPayInfo);
    // 电子发票
    Einvoice einvoice = sqlSession.selectOne("com.itrus.portal.db.EinvoiceMapper.selectByPrimaryKey", bill.geteInvoice());
    uiModel.addAttribute("einvoice", einvoice);
    if (einvoice != null && einvoice.geteReiceipt() != null) {
        // 电子发票类型
        Ereceipt ereceipt = sqlSession.selectOne("com.itrus.portal.db.EreceiptMapper.selectByPrimaryKey", einvoice.geteReiceipt());
        uiModel.addAttribute("ereceipt", ereceipt);
    }
    // 其他附加信息
    // 营业执照
    BusinessLicense businessLicense = businessService.getBusinessByExtraBillId(id, null);
    uiModel.addAttribute("businessLicense", businessLicense);
    // 税务登记
    TaxRegisterCert taxRegisterCert = taxCertService.getTaxRegisterCertByExtraBillId(id, null);
    uiModel.addAttribute("taxRegisterCert", taxRegisterCert);
    // 组织机构代码
    OrgCode orgCode = orgCodeService.getOrgCodeByExtraBillId(id, null);
    uiModel.addAttribute("orgCode", orgCode);
    // 代理人
    Agent agent = agentService.getAgentByExtraBillId(id, null);
    uiModel.addAttribute("agent", agent);
    // 开户行信息
    OpenBankInfo openBankInfo = openBankInfoService.getOpenBankInfoByExtraBillId(id, null);
    uiModel.addAttribute("openBankInfo", openBankInfo);
    // 法人信息
    IdentityCard identityCard = identityCardService.getIdentityCardByExtraBillId(id, null);
    uiModel.addAttribute("identityCard", identityCard);
    // TODO 还需要补充订单对应的附加信息和第三方回调信息
    return "extrabillreceipt/show";
}
Also used : Ereceipt(com.itrus.portal.db.Ereceipt) Agent(com.itrus.portal.db.Agent) ExtraBill(com.itrus.portal.db.ExtraBill) ExtraProductSpec(com.itrus.portal.db.ExtraProductSpec) UserInfo(com.itrus.portal.db.UserInfo) Einvoice(com.itrus.portal.db.Einvoice) ExtraBillExample(com.itrus.portal.db.ExtraBillExample) Project(com.itrus.portal.db.Project) ExtraProduct(com.itrus.portal.db.ExtraProduct) OrgCode(com.itrus.portal.db.OrgCode) BusinessLicense(com.itrus.portal.db.BusinessLicense) OnPayInfo(com.itrus.portal.db.OnPayInfo) OpenBankInfo(com.itrus.portal.db.OpenBankInfo) ServiceProvider(com.itrus.portal.db.ServiceProvider) Enterprise(com.itrus.portal.db.Enterprise) TaxRegisterCert(com.itrus.portal.db.TaxRegisterCert) IdentityCard(com.itrus.portal.db.IdentityCard) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UserInfo (com.itrus.portal.db.UserInfo)99 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)79 Enterprise (com.itrus.portal.db.Enterprise)68 HashMap (java.util.HashMap)52 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)40 IOException (java.io.IOException)39 HttpSession (javax.servlet.http.HttpSession)37 Bill (com.itrus.portal.db.Bill)31 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)31 Product (com.itrus.portal.db.Product)26 ExtraProduct (com.itrus.portal.db.ExtraProduct)24 Project (com.itrus.portal.db.Project)24 UserCert (com.itrus.portal.db.UserCert)24 BusinessLicense (com.itrus.portal.db.BusinessLicense)21 ExtraBill (com.itrus.portal.db.ExtraBill)20 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)20 UserLog (com.itrus.portal.db.UserLog)20 IdentityCard (com.itrus.portal.db.IdentityCard)19 OrgCode (com.itrus.portal.db.OrgCode)19 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)19