Search in sources :

Example 41 with Project

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

Example 42 with Project

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

the class UnlockKeyBillController method submitUnlockBill.

/**
 * 提交解锁订单
 * @param productId,购买产品的id
 * @param certSn
 * @param keySn
 * @param einvoice
 * @param proxy
 * @param request
 * @return
 */
@RequestMapping("/submitUnlockBill")
@ResponseBody
public Map<String, Object> submitUnlockBill(@RequestParam("productId") Long productId, @RequestParam("certSn") String certSn, @RequestParam("keySn") String keySn, @RequestParam("keyType") String keyType, @RequestParam("enterpriseName") String enterpriseName, @RequestParam("reqCode") String reqCode, @ModelAttribute("einvoice") Einvoice einvoice, @ModelAttribute("userInfo") UserInfo userInfo, @ModelAttribute("enterprise") Enterprise enterprise, @ModelAttribute("proxy") Proxy proxy, HttpServletRequest request) {
    Map<String, Object> retMap = new HashMap<String, Object>();
    retMap.put("retCode", 0);
    HttpSession session = request.getSession();
    UserCert userCert = userCertService.getUserCertByCertSn(certSn);
    if (StringUtils.isBlank(keySn)) {
        retMap.put("retMsg", "key序列号不能为空");
        return retMap;
    }
    if (StringUtils.isBlank(reqCode)) {
        retMap.put("retMsg", "解锁请求码不能为空");
        return retMap;
    }
    if (null == userCert) {
        retMap.put("retMsg", "该证书未注册,请您先注册");
        return retMap;
    }
    if (StringUtils.isBlank(userCert.getKeySn()) || !keySn.equals(userCert.getKeySn())) {
        userCert.setKeySn(keySn);
        userCertService.updateByPrimaryKeySelective(userCert);
    }
    UserInfo webUserInfo = null;
    if (null == userInfo || StringUtils.isBlank(userInfo.getmPhone())) {
        retMap.put("retMsg", "用户信息不完整,请重新提交");
        return retMap;
    } else {
        webUserInfo = userInfoService.getUserInfoByMphone(userInfo.getmPhone());
    }
    if (null == webUserInfo) {
        retMap.put("retMsg", "手机号:" + userInfo.getmPhone() + ", 尚未注册或者校验通过,请检查您输入的手机号是否正确!");
        return retMap;
    }
    Enterprise enterpriseByName = enterpriseService.getEntByName(enterpriseName);
    if (null == enterpriseByName) {
        // 若新提交的企业信息为null或者信息不全,则提示
        if (null == enterprise || StringUtils.isBlank(enterprise.getEnterpriseName()) || null == enterprise.getEnterpriseNature() || StringUtils.isBlank(enterprise.getEnterpriseSn())) {
            retMap.put("retMsg", "企业信息不完整,请重新提交");
            return retMap;
        } else {
            // 保存新增的企业信息
            enterprise = enterpriseService.saveOrUpdateEnterprise(enterprise);
            // 添加企业-代理人关联关系
            UserinfoEnterprise userinfoEnterprise = userInfoEnterpriseServiceImpl.selectOne(enterprise.getId(), webUserInfo.getId());
            if (null == userinfoEnterprise) {
                userInfoEnterpriseServiceImpl.saveUserInfoEnterprise(webUserInfo.getId(), enterprise.getId());
            }
        }
    } else {
        enterprise = enterpriseByName;
    }
    Product product = productService.getProduct(productId);
    if (null == product) {
        retMap.put("retMsg", "您选择的产品不存在");
        return retMap;
    }
    if (null == product.getKeyUnlockType()) {
        retMap.put("retMsg", "您选择的产品不属于解锁产品,请重新选择");
        return retMap;
    }
    if (null == userCert.getUserinfo() && product.getKeyUnlockType().equals(ComNames.KEY_UNLOCK_TYPE_1)) {
        retMap.put("retMsg", "未绑定用户的证书,不能购买自助解锁产品");
        return retMap;
    }
    Bill billOld = billService.getBillWaitingForUnlock(userCert.getId());
    if (null != billOld) {
        retMap.put("retMsg", "当前证书尚有未解锁的订单,请先在原订单解锁,订单号:" + billOld.getBillId());
        return retMap;
    }
    Project project = projectService.selectByPrimaryKey(product.getProject());
    DefaultTransactionDefinition dtd = new DefaultTransactionDefinition();
    dtd.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus status = transactionManager.getTransaction(dtd);
    try {
        if (StringUtils.isNotBlank(userInfo.getEmail()) && StringUtils.isBlank(webUserInfo.getEmail())) {
            webUserInfo.setEmail(userInfo.getEmail());
            userInfoService.updateUserInfo(webUserInfo);
        }
        if (StringUtils.isNotBlank(einvoice.getName()) && null != einvoice.geteReiceipt()) {
            einvoice = EinvoiceService.saveEInvoice(webUserInfo.getId(), einvoice);
        }
        Bill bill = null;
        // 生成订单
        double billSum = product.getPrice();
        bill = billService.saveBill(webUserInfo.getId(), enterprise.getId(), product.getId(), null, null, null == einvoice.getId() ? null : einvoice.getId(), null, product.getProject(), 1, billSum, webUserInfo.getId(), ComNames.BILL_STATUS_1);
        bill.setBillId(UniqueIDUtils.genBilUID(bill));
        bill.setUnlockUserCert(userCert.getId());
        sqlSession.update("com.itrus.portal.db.BillMapper.updateByPrimaryKey", bill);
        keyUnlockService.insert(bill.getId(), project.getId(), keySn, certSn, enterpriseName, keyType, "ENROLL", product.getKeyUnlockType() == 1 ? 1 : 2, reqCode);
        sqlSession.flushStatements();
        if (null != proxy && StringUtils.isNotBlank(proxy.getImgFile())) {
            // 保存授权书
            proxy = proxyService.saveProxy(enterprise.getId(), webUserInfo.getUniqueId(), bill.getId(), webUserInfo.getId(), proxy, project);
        }
        transactionManager.commit(status);
        retMap.put("billId", bill.getId());
        retMap.put("retCode", 1);
        // 将用户信息放入session中,避免支付出错
        session.setAttribute(ComNames.WEB_USER_INFO, webUserInfo);
        // 记录日志
        LogUtil.userlog(sqlSession, project.getId(), "购买解锁产品", webUserInfo.getmPhone() + "购买了" + product.getName(), "未知", "", null == webUserInfo.getUniqueId() ? null : webUserInfo.getUniqueId());
        return retMap;
    } catch (Exception e) {
        if (!status.isCompleted())
            transactionManager.rollback(status);
        UserLog userlog = new UserLog();
        userlog.setProject(project.getId());
        userlog.setType("购买解锁产品");
        userlog.setInfo("url:submitUnlockBill,详细错误:" + 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) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) TransactionStatus(org.springframework.transaction.TransactionStatus) UserInfo(com.itrus.portal.db.UserInfo) UserLog(com.itrus.portal.db.UserLog) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IOException(java.io.IOException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) Project(com.itrus.portal.db.Project) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) Enterprise(com.itrus.portal.db.Enterprise) UserinfoEnterprise(com.itrus.portal.db.UserinfoEnterprise) 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 43 with Project

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

the class RegisterController method register.

@RequestMapping(value = "/s/{name}")
public String register(@PathVariable("name") String name, @RequestParam(value = "login", required = false) String login, HttpSession session, Model uiModel) {
    ProductExample productExample = new ProductExample();
    ProductExample.Criteria pe = productExample.createCriteria();
    pe.andProNameEqualTo(name);
    Product product = sqlSession.selectOne("com.itrus.portal.db.ProductMapper.selectByExample", productExample);
    // return
    // "forward:/userInfoWeb/zhuce.html?projectId="+product.getProject()+"&productId="+product.getId();
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", product.getProject());
    uiModel.addAttribute("projectId", product.getProject());
    uiModel.addAttribute("productId", product.getId());
    uiModel.addAttribute("productName", product.getName());
    uiModel.addAttribute("projectName", project.getName());
    if (StringUtils.isNotBlank(login) && login.equals("1")) {
        List<String> allIssUerDn = new ArrayList<String>();
        allIssUerDn = sqlSession.selectList("com.itrus.portal.db.CrlContextMapper.selectAllIssUerDn");
        try {
            uiModel.addAttribute("allIssUerDn", jsonTool.writeValueAsString(allIssUerDn));
            // 返回随机数
            String random = UniqueIDUtils.genUUID();
            uiModel.addAttribute("random", random);
            session.setAttribute("webrandom", random);
        } catch (JsonGenerationException e) {
            e.printStackTrace();
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "ixinweb/denglu2";
    }
    if (null != product.getIsBan() && product.getIsBan() == true) {
        EnterpriseQqExample enterprise1 = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterprise1.createCriteria();
        qqEx.andProjectIdEqualTo(product.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise1);
        if (enterpriseqq != null && enterpriseqq.getEnterpriseQq() != null) {
            uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
        }
        // 产品已经下架
        return "ixinweb/chanpinxiajia";
    }
    return "ixinweb/zhuce";
}
Also used : ProductExample(com.itrus.portal.db.ProductExample) Product(com.itrus.portal.db.Product) IOException(java.io.IOException) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 44 with Project

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

the class PersonInfoController method detail.

/**
 * 查看个人用户详情
 * @param id
 * 				个人用户id
 * @param item
 * 				个人用户关联的项(0认证、1订单)
 * @param page
 * @param size
 * @param uiModel
 * @return
 */
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    PersonInfo personinfo = personInfoService.getSelectById(id);
    uiModel.addAttribute("personinfo", personinfo);
    // 得到属于个人的认证等级
    Map prama = new HashMap();
    prama.put("type", 1);
    List certificationList = certificationService.getCertificationList(prama);
    uiModel.addAttribute("certificationList", certificationList);
    // page,size
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    Integer offset = size * (page - 1);
    // 总记录数
    Integer count = 0;
    // 当前页记录数
    Integer itemcount = 0;
    if (null == item || 0 == item) {
        // 得到用户关联的银行卡信息
        BankcardInfoExample bankcardInfoExample = new BankcardInfoExample();
        BankcardInfoExample.Criteria be = bankcardInfoExample.createCriteria();
        be.andUniqueIdEqualTo(id);
        bankcardInfoExample.setOrderByClause("create_time desc");
        bankcardInfoExample.setOffset(offset);
        bankcardInfoExample.setLimit(size);
        List bankcardInfoList = bankcardInfoService.getSelectByExample(bankcardInfoExample);
        count = bankcardInfoService.getSelectCountByExample(bankcardInfoExample);
        uiModel.addAttribute("bankcardInfoList", bankcardInfoList);
    } else if (1 == item) {
        // 得到用户关联的订单
        PersonalBillExample personalBillExample = new PersonalBillExample();
        PersonalBillExample.Criteria pe = personalBillExample.createCriteria();
        pe.andUniqueIdEqualTo(id);
        personalBillExample.setOrderByClause("create_time desc");
        personalBillExample.setOffset(offset);
        personalBillExample.setLimit(size);
        List personalBillList = personalBillBillService.getSelectByExample(personalBillExample);
        count = personalBillBillService.getSelectCountByExample(personalBillExample);
        uiModel.addAttribute("personalBillList", personalBillList);
        Map<Long, List<Product>> productMap = productService.getProductByMap();
        Map<Long, List<Project>> projectMap = projectService.getProjectByMap();
        uiModel.addAttribute("productMap", productMap);
        uiModel.addAttribute("projectMap", projectMap);
    }
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("item", item);
    return "personinfo/detail";
}
Also used : Project(com.itrus.portal.db.Project) PersonInfo(com.itrus.portal.db.PersonInfo) BankcardInfoExample(com.itrus.portal.db.BankcardInfoExample) PersonalBillExample(com.itrus.portal.db.PersonalBillExample) HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 45 with Project

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

the class ProjectController method show.

// 显示详情
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", id);
    uiModel.addAttribute("project", project);
    if (project.getRaAccount() != null && project.getRaAccount() != 0) {
        RaAccount raAccount = sqlSession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByPrimaryKey", project.getRaAccount());
        uiModel.addAttribute("raaccount", raAccount);
    }
    // orgCode
    uiModel.addAttribute("orgCode", project.getOrgCode());
    return "projects/show";
}
Also used : Project(com.itrus.portal.db.Project) RaAccount(com.itrus.portal.db.RaAccount) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Project (com.itrus.portal.db.Project)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 HashMap (java.util.HashMap)32 UserInfo (com.itrus.portal.db.UserInfo)24 Enterprise (com.itrus.portal.db.Enterprise)20 ExtraProduct (com.itrus.portal.db.ExtraProduct)17 ProjectExample (com.itrus.portal.db.ProjectExample)16 ArrayList (java.util.ArrayList)15 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 Product (com.itrus.portal.db.Product)10 Date (java.util.Date)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)9 BusinessLicense (com.itrus.portal.db.BusinessLicense)8 IdentityCard (com.itrus.portal.db.IdentityCard)8 OrgCode (com.itrus.portal.db.OrgCode)8 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)8 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)8 List (java.util.List)8 Map (java.util.Map)8