Search in sources :

Example 6 with EnterpriseQqExample

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

the class OnlineServiceImpl method selectByDefaultEnterpriseQq.

/**
 * 得到默认企业qq
 * @return
 */
public EnterpriseQq selectByDefaultEnterpriseQq() {
    EnterpriseQqExample qqExample = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qec = qqExample.createCriteria();
    qec.andEnterpriseQqStateEqualTo(0L);
    List<EnterpriseQq> enterpriseQqs = selectEnterpriseQqList(qqExample);
    if (enterpriseQqs.isEmpty()) {
        return null;
    }
    return enterpriseQqs.get(0);
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample)

Example 7 with EnterpriseQqExample

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

the class BillWebController method billList.

/**
 * 订单列表
 *
 * @param billStatus
 *            0未完成订单,1已完成订单
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping(produces = "text/html")
public String billList(@RequestParam(value = "billStatus", required = false) Integer billStatus, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    Boolean verifyCodeStatus = (Boolean) session.getAttribute("webverifyCodeStatus");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null == verifyCodeStatus || !verifyCodeStatus || null == userInfo) {
        // 登录状态失效,跳转到登录页面
        return "redirect:/userInfoWeb/denglu.html";
    }
    if (userInfo != null && enterprise == null) {
        // 登录未获取到企业信息,跳转到选择企业页面
        return "redirect:/userInfoWeb/choiceEnterprise";
    }
    uiModel.addAttribute("billStatus", billStatus);
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 5;
    }
    BillExample billExampl = new BillExample();
    BillExample.Criteria criteria = billExampl.or();
    // web页面不显示解锁的订单产品
    List<Long> keyUnlockProductIds = productService.getKeyUnlockProductIds();
    if (null != keyUnlockProductIds && !keyUnlockProductIds.isEmpty()) {
        criteria.andProductNotIn(keyUnlockProductIds);
    }
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria.andUniqueIdEqualTo(userInfo.getId());
    // 当前企业 v 76
    criteria.andEnterpriseEqualTo(enterprise.getId());
    if (null == billStatus || 0 == billStatus) {
        // 未完成订单:订单状态不为8
        criteria.andBillStatusNotEqualTo(ComNames.BILL_STATUS_8);
        criteria.andIsDeleteEqualTo(false);
    } else if (1 == billStatus) {
        // 订单状态为已完成
        criteria.andBillStatusEqualTo(ComNames.BILL_STATUS_8);
    }
    Integer count = sqlSession.selectOne("com.itrus.portal.db.BillMapper.countByExample", billExampl);
    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);
    Integer offset = size * (page - 1);
    billExampl.setOffset(offset);
    billExampl.setLimit(size);
    billExampl.setOrderByClause("create_time desc");
    List<Bill> billList = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectByExample", billExampl);
    uiModel.addAttribute("billList", billList);
    uiModel.addAttribute("itemcount", billList.size());
    Map<Long, Delivery> deliveryMap = sqlSession.selectMap("com.itrus.portal.db.DeliveryMapper.selectByExample", null, "id");
    uiModel.addAttribute("deliveryMap", deliveryMap);
    // 填写中订单
    if (page2 == null || page2 < 1) {
        page2 = 1;
    }
    if (size2 == null || size2 < 1) {
        size2 = 5;
    }
    EditBillExample ebEx = new EditBillExample();
    EditBillExample.Criteria criteria2 = ebEx.or();
    // 查询当前用户当前企业的订单
    // 当前用户
    criteria2.andUserInfoIdEqualTo(userInfo.getId());
    // 
    criteria2.andEnterpriseIdEqualTo(enterprise.getId());
    Integer count2 = sqlSession.selectOne("com.itrus.portal.db.EditBillMapper.countByExample", ebEx);
    if (page2 > 1 && size2 * (page2 - 1) >= count2) {
        page2 = (count2 + size2 - 1) / size2;
    }
    uiModel.addAttribute("count2", count2);
    uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    Integer offset2 = size2 * (page2 - 1);
    // 产品信息:
    /*Map<Long, Product> productMap = billService
				.getProductMapByUserInfoId(userInfo.getId());*/
    // if ((null == billStatus || billStatus.equals(2)) && count2 != 0) {
    Map<Long, Product> productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", "id");
    // }
    uiModel.addAttribute("productMap", productMap);
    // 获取产品关联的数字证书id
    Set<Long> certIds = productService.getDigitalCertIds(productMap);
    // 产品关联的数字证书:
    Map<Long, DigitalCert> digitalCertMap = digitalCertService.getDigitalCertByProductMap(certIds);
    uiModel.addAttribute("digitalCertMap", digitalCertMap);
    // 获取订单对应的产品规格
    Map<Long, ProductSpec> productSpecMap = productSpecService.getProductSpec(billList);
    uiModel.addAttribute("productSpecMap", productSpecMap);
    ebEx.setOffset(offset2);
    ebEx.setLimit(size2);
    ebEx.setOrderByClause("create_time desc");
    List<EditBill> editBillList = sqlSession.selectList("com.itrus.portal.db.EditBillMapper.selectByExample", ebEx);
    // 获取填写中订单对应的产品规格
    Map<Long, ProductSpec> editBill_productSpecMap = productSpecService.getEditBillProductSpec(editBillList);
    uiModel.addAttribute("editBill_productSpecMap", editBill_productSpecMap);
    uiModel.addAttribute("editBillList", editBillList);
    uiModel.addAttribute("itemcount2", editBillList.size());
    // 订单是否对应的pfx的用户下载证书.
    Map<Long, Long> pfxMap = billWebService.getPfxCertBufByBills(billList);
    uiModel.addAttribute("pfxmap", pfxMap);
    session.removeAttribute("sessionPlist");
    session.removeAttribute("enterpriseqqE");
    System.out.println(enterprise.getId());
    Map param = new HashMap();
    param.put("id", enterprise.getId());
    if (userInfo.getmPhone() != null) {
        param.put("phone", userInfo.getmPhone());
    }
    List<Map<String, Object>> plist = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectProjectId", param);
    Map<Long, EnterpriseQq> qqMap = new HashMap<Long, EnterpriseQq>();
    for (int i = 0; i < plist.size(); i++) {
        EnterpriseQqExample enterpriseQ = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterpriseQ.createCriteria();
        // System.out.println(plist.get(i));
        Long pid = Long.parseLong(plist.get(i).get("id").toString());
        // System.out.println(pid);
        qqEx.andProjectIdEqualTo(pid);
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterpriseQ);
        if (enterpriseqq != null) {
            // uiModel.addAttribute("eid", enterpriseqq.getId());
            qqMap.put(pid, enterpriseqq);
        // session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
        }
    }
    session.setAttribute("sessionqqMap", qqMap);
    session.setAttribute("sessionPlist", plist);
    return "ixinweb/zhanghuguanli_dingdanxinxi";
}
Also used : HashMap(java.util.HashMap) Product(com.itrus.portal.db.Product) UserInfo(com.itrus.portal.db.UserInfo) EditBillExample(com.itrus.portal.db.EditBillExample) DigitalCert(com.itrus.portal.db.DigitalCert) EditBillExample(com.itrus.portal.db.EditBillExample) BillExample(com.itrus.portal.db.BillExample) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) EditBill(com.itrus.portal.db.EditBill) HttpSession(javax.servlet.http.HttpSession) ProductSpec(com.itrus.portal.db.ProductSpec) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) Enterprise(com.itrus.portal.db.Enterprise) EditBill(com.itrus.portal.db.EditBill) Bill(com.itrus.portal.db.Bill) Delivery(com.itrus.portal.db.Delivery) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with EnterpriseQqExample

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

the class ClientWebController method zhifuPage.

/**
 * 进入增值订单支付页面,若未配置支付且订单价格为0,则不需要支付
 *
 * @param billId
 *            ,增值订单id
 * @param request
 * @param uiModel
 * @return
 */
@RequestMapping("/zhifu/{billId}")
public String zhifuPage(@PathVariable("billId") Long billId, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    String ip = request.getRemoteAddr();
    UserInfo currentUserInfo = (UserInfo) session.getAttribute("webuserInfo");
    uiModel.addAttribute("ip", ip);
    // 增值订单
    ExtraBill bill = extraBillService.selectByPrimaryKey(billId);
    if (null == bill || !currentUserInfo.getId().equals(bill.getUniqueId())) {
        return "resourceNotFound";
    }
    // 增值产品
    ExtraProduct product = extraProductService.selectByPrimaryKey(bill.getExtraProduct());
    if (null == product) {
        // 产品不存在
        uiModel.addAttribute("errorMsg", "您购买的产品不存在");
        return "client/errorpage";
    }
    // 未配置支付方式,或者订单价格为0,则不用支付
    if (StringUtils.isBlank(product.getBankPay()) && StringUtils.isBlank(product.getOnlinePay()) && (null == bill.getBillSum() || bill.getBillSum().equals(0))) {
        // 跳转到订单支付成功页面,并将订单状态设置为3已支付 待审核
        bill.setBillStatus(ComNames.EXTRA_BILL_STATUS_3);
        // TODO 跳转到支付成功或者订单列表页面
        return "client/zhifuchenggong";
    }
    // 获取产品对应的线上支付服务
    if (product.getOnlinePay() != null && product.getOnlinePay() != "") {
        List<Long> onlinepays = new ArrayList<Long>();
        String[] onpay = (product.getOnlinePay()).split(",");
        Map<Integer, String> map = new HashMap<Integer, String>();
        for (int i = 0; i < onpay.length; i++) {
            OnlinePay op = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.selectByPrimaryKey", onpay[i]);
            map.put(op.getSort(), onpay[i]);
        }
        Set<Integer> set = map.keySet();
        Object[] obj = set.toArray();
        Arrays.sort(obj);
        for (int i = (onpay.length - 1); i >= 0; i--) {
            String a = map.get(obj[i]);
            onlinepays.add(Long.parseLong(a));
        }
        Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
        uiModel.addAttribute("opMap", opMap);
        uiModel.addAttribute("onlinepays", onlinepays);
        Map<Long, PayConfig> pcMap = sqlSession.selectMap("com.itrus.portal.db.PayConfigMapper.selectByExample", "id");
        uiModel.addAttribute("pcMap", pcMap);
    }
    // 获取产品对应的银行汇款服务
    if (!StringUtils.isBlank(product.getBankPay())) {
        Transfer transfer = sqlSession.selectOne("com.itrus.portal.db.TransferMapper.selectByPrimaryKey", Long.parseLong(product.getBankPay()));
        uiModel.addAttribute("transfer", transfer);
    }
    if (null != product.getBankRemarks()) {
        product.setBankRemarks(product.getBankRemarks().replace("\r\n", "<br/><span ></span>"));
    }
    uiModel.addAttribute("product", product);
    session.setAttribute("webbill", bill);
    if (null != bill.getExtraProductSpec()) {
        uiModel.addAttribute("productSpec", extraProductSpecService.selectByPrimaryKey(bill.getExtraProductSpec()));
    }
    if (currentUserInfo != null) {
        currentUserInfo = userInfoService.getUserInfoById(currentUserInfo.getId());
        EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
        EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
        qqEx.andProjectIdEqualTo(currentUserInfo.getProject());
        EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterpriseE);
        if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
            uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
            session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
        }
    }
    // TODO 跳转到支付页面
    return "client/zhifu";
}
Also used : PayConfig(com.itrus.portal.db.PayConfig) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ExtraBill(com.itrus.portal.db.ExtraBill) ArrayList(java.util.ArrayList) UserInfo(com.itrus.portal.db.UserInfo) ExtraProduct(com.itrus.portal.db.ExtraProduct) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) Transfer(com.itrus.portal.db.Transfer) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with EnterpriseQqExample

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

the class PayWebController method returnUrl1.

@RequestMapping(value = "/returnUrl1")
public String returnUrl1(HttpServletRequest request, Model uiModel, HttpServletResponse response) {
    // 动态qq在线咨询
    HttpSession session = request.getSession();
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    if (null != userInfo) {
        userInfo = userInfoService.getUserInfoById(userInfo.getId());
        session.setAttribute("webuserInfo", userInfo);
        if (null != userInfo.getProject()) {
            EnterpriseQqExample enterprise = new EnterpriseQqExample();
            EnterpriseQqExample.Criteria qqEx = enterprise.createCriteria();
            qqEx.andProjectIdEqualTo(userInfo.getProject());
            EnterpriseQq enterpriseqq = sqlSession.selectOne("com.itrus.portal.db.EnterpriseQqMapper.selectByExample", enterprise);
            if (enterpriseqq != null && enterpriseqq.getEnterpriseQqLinks() != null) {
                uiModel.addAttribute("enterpriseqq", enterpriseqq.getEnterpriseQqLinks());
                session.setAttribute("enterpriseqqE", enterpriseqq.getEnterpriseQqLinks());
            }
        }
    }
    return "ixinweb/chongfuzhifu";
}
Also used : EnterpriseQq(com.itrus.portal.db.EnterpriseQq) HttpSession(javax.servlet.http.HttpSession) UserInfo(com.itrus.portal.db.UserInfo) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with EnterpriseQqExample

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

Aggregations

EnterpriseQq (com.itrus.portal.db.EnterpriseQq)15 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)15 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 HashMap (java.util.HashMap)7 HttpSession (javax.servlet.http.HttpSession)7 UserInfo (com.itrus.portal.db.UserInfo)6 Product (com.itrus.portal.db.Product)5 ArrayList (java.util.ArrayList)5 CustomerService (com.itrus.portal.db.CustomerService)4 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)4 Project (com.itrus.portal.db.Project)4 Map (java.util.Map)4 ProjectExample (com.itrus.portal.db.ProjectExample)3 IOException (java.io.IOException)3 List (java.util.List)3 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)3 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Bill (com.itrus.portal.db.Bill)2 DigitalCert (com.itrus.portal.db.DigitalCert)2