Search in sources :

Example 36 with Product

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

the class BillServiceImpl method getProductMapByBills.

/**
 * 根据订单list获取对应产品Map
 *
 * @param bills
 * @return
 */
public Map<Long, Product> getProductMapByBills(List<Bill> bills) {
    Map<Long, Product> productMap = new HashMap<Long, Product>();
    List<Long> productIds = new ArrayList<Long>();
    for (Bill bill : bills) {
        productIds.add(bill.getProduct());
    }
    if (!productIds.isEmpty()) {
        ProductExample example = new ProductExample();
        ProductExample.Criteria criteria = example.or();
        criteria.andIdIn(productIds);
        productMap = sqlSession.selectMap("com.itrus.portal.db.ProductMapper.selectByExample", example, "id");
    }
    return productMap;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Bill(com.itrus.portal.db.Bill) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 37 with Product

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

the class BillWebServiceImpl method getPfxCertBufByBills.

/**
 * 根据订单.判断订单是否该显示下载证书的按钮
 * @param bills
 * @return Map<Long, Long>,键为bill.id,值为certBuf.id;
 */
public Map<Long, Long> getPfxCertBufByBills(List<Bill> bills) {
    Map<Long, Long> map = new HashMap<Long, Long>();
    if (null == bills || bills.isEmpty()) {
        return map;
    }
    Date date = new Date();
    for (Bill bill : bills) {
        Product product = productService.getProduct(bill.getProduct());
        if (null == product.getCert()) {
            continue;
        }
        DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
        Integer billStatus = bill.getBillStatus();
        // 判断订单是pfx类型的用户下载证书,且订单状态是678.
        boolean pfx_download = null != digitalCert && null != digitalCert.getCertType() && null != digitalCert.getInitBuy() && digitalCert.getCertType().equals(ComNames.DIGITALCERT_CERTTYPE_PFX) && digitalCert.getInitBuy().equals(ComNames.DIGITALCERT_INITBUYS_2) && (billStatus == ComNames.BILL_STATUS_6 || billStatus == ComNames.BILL_STATUS_7 || billStatus == ComNames.BILL_STATUS_8);
        if (pfx_download) {
            // 根据订单号,找到订单对应的证书信息
            CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectPfxCertByBillId", bill.getId());
            // 获取证书第一次下载时间和当前时间比较,如果超过了十五天,则不允许下载
            int day = DateUtils.daysOfTwo(date, certBuf.getCreateTime());
            if (day < 16) {
                map.put(bill.getId(), certBuf.getId());
            }
        }
    }
    return map;
}
Also used : DigitalCert(com.itrus.portal.db.DigitalCert) HashMap(java.util.HashMap) Bill(com.itrus.portal.db.Bill) CertBuf(com.itrus.portal.db.CertBuf) Product(com.itrus.portal.db.Product) Date(java.util.Date)

Example 38 with Product

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

the class ProductServiceImpl method getKeyUnlockProductIds.

/**
 * 获取所有的解锁产品的ID
 * @return
 */
public List<Long> getKeyUnlockProductIds() {
    List<Long> list = new ArrayList<>();
    List<Product> products = new ArrayList<>();
    ProductExample example = new ProductExample();
    ProductExample.Criteria criteria = example.or();
    criteria.andKeyUnlockTypeIsNotNull();
    products = sqlSession.selectList("com.itrus.portal.db.ProductMapper.selectByExample", example);
    if (null == products || products.isEmpty()) {
        return null;
    }
    for (Product product : products) {
        list.add(product.getId());
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) Product(com.itrus.portal.db.Product) ProductExample(com.itrus.portal.db.ProductExample)

Example 39 with Product

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

the class BillWebController method reNewCertConfirm.

// 订单详情,待更新确认
@RequestMapping(value = "/reNewCertConfirm/{id}", produces = "text/html")
public String reNewCertConfirm(@PathVariable("id") Long id, HttpServletRequest request, Model uiModel) {
    HttpSession session = request.getSession();
    UserInfo userInfo = (UserInfo) session.getAttribute("webuserInfo");
    Enterprise enterprise = (Enterprise) session.getAttribute("webenterprise");
    if (null == userInfo || null == enterprise) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    // 审核记录
    ReviewLog reviewLog = reviewLogService.getReviewLog(id);
    if (reviewLog != null) {
        uiModel.addAttribute("reviewLog", reviewLog);
    }
    Map param = new HashMap();
    // 设置查询条件,选择属于当前用户,当前企业的订单
    param.put("id", id);
    // param.put("userinfoid", userInfo.getId());
    // param.put("enterpriseid", enterprise.getId());
    List<Map> billAll = sqlSession.selectList("com.itrus.portal.db.BillMapper.selectProductBillCertById", param);
    log.error("--------获取订单数量-------" + billAll.size() + "*****获取订单信息***" + billAll);
    log.error("------获取订单id--------" + billAll.get(0).get("id"));
    log.error("========获取订单编号=========" + billAll.get(0).get("bill_id"));
    if (0 == billAll.size()) {
        return "redirect:/userInfoWeb/denglu.html";
    }
    uiModel.addAttribute("bills", billAll.get(0));
    // 获取数字证书
    Product product = productService.getProduct((Long) billAll.get(0).get("product"));
    log.error("****获取产品id*****" + product.getId());
    DigitalCert digitalCert = digitalCertService.getDigitalCert(product.getCert());
    // 获取订单在线支付方式
    if (billAll.get(0).get("on_pay_info") != null) {
        Map<Long, OnPayInfo> opiMap = sqlSession.selectMap("com.itrus.portal.db.OnPayInfoMapper.selectByExample", "id");
        uiModel.addAttribute("opiMap", opiMap);
        Map<Long, OnlinePay> opMap = sqlSession.selectMap("com.itrus.portal.db.OnlinePayMapper.selectByExample", "id");
        uiModel.addAttribute("opMap", opMap);
    }
    PayInfoExample payInfoex = new PayInfoExample();
    Map<Long, PayInfo> payinfoMap = sqlSession.selectMap("com.itrus.portal.db.PayInfoMapper.selectByExample", payInfoex, "id");
    uiModel.addAttribute("payinfomap", payinfoMap);
    // 获取产品规格
    ProductSpec productSpec = null;
    if (null != billAll.get(0).get("product_spec") && !"0".equals(billAll.get(0).get("product_spec"))) {
        productSpec = productSpecService.getProductSpec((Long) billAll.get(0).get("product_spec"));
    }
    uiModel.addAttribute("productSpec", productSpec);
    uiModel.addAttribute("digitalCert", digitalCert);
    // 返回订单对应的老证书的base64
    CertBuf certBuf = sqlSession.selectOne("com.itrus.portal.db.CertBufMapper.selectCertBufByBillId", id);
    if (null != certBuf) {
        uiModel.addAttribute("oldCertB64", certBuf.getCertBuf().replaceAll("\n", ""));
    }
    log.error("*********签章服务******" + product.getMakeSealServer());
    // 判断是否有签章服务,有则显示授权
    if (null != product.getMakeSealServer()) {
        uiModel.addAttribute("makesealserver", product.getMakeSealServer());
        uiModel.addAttribute("billId", billAll.get(0).get("id"));
        // 签章服务配置
        List<MakeSealConfig> makeSealConfigs = sqlSession.selectList("com.itrus.portal.db.MakeSealConfigMapper.selectByExample");
        if (!makeSealConfigs.isEmpty()) {
            MakeSealConfig makeSealConfig = makeSealConfigs.get(0);
            try {
                makeSealConfig.setAddressKey(AESencrp.decrypt(makeSealConfig.getAddressKey(), dbEncKey));
            } catch (EncDecException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            uiModel.addAttribute("makeSealConfig", makeSealConfig);
        }
    }
    return "ixinweb/dingdanxiangqing_gengxinqueren";
}
Also used : PayInfoExample(com.itrus.portal.db.PayInfoExample) HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) Product(com.itrus.portal.db.Product) EncDecException(com.itrus.portal.exception.EncDecException) UserInfo(com.itrus.portal.db.UserInfo) ProductSpec(com.itrus.portal.db.ProductSpec) IOException(java.io.IOException) JsonGenerationException(org.codehaus.jackson.JsonGenerationException) EncDecException(com.itrus.portal.exception.EncDecException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) UserInfoServiceException(com.itrus.portal.exception.UserInfoServiceException) DigitalCert(com.itrus.portal.db.DigitalCert) MakeSealConfig(com.itrus.portal.db.MakeSealConfig) PayInfo(com.itrus.portal.db.PayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) OnPayInfo(com.itrus.portal.db.OnPayInfo) Enterprise(com.itrus.portal.db.Enterprise) ReviewLog(com.itrus.portal.db.ReviewLog) CertBuf(com.itrus.portal.db.CertBuf) Map(java.util.Map) HashMap(java.util.HashMap) OnlinePay(com.itrus.portal.db.OnlinePay) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 40 with Product

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

Aggregations

Product (com.itrus.portal.db.Product)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)43 HashMap (java.util.HashMap)42 Bill (com.itrus.portal.db.Bill)39 Enterprise (com.itrus.portal.db.Enterprise)27 UserInfo (com.itrus.portal.db.UserInfo)27 DigitalCert (com.itrus.portal.db.DigitalCert)24 JSONObject (com.alibaba.fastjson.JSONObject)19 UserCert (com.itrus.portal.db.UserCert)19 ArrayList (java.util.ArrayList)19 IOException (java.io.IOException)18 Map (java.util.Map)17 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)17 ProductExample (com.itrus.portal.db.ProductExample)15 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)15 Date (java.util.Date)15 List (java.util.List)14 HttpSession (javax.servlet.http.HttpSession)14 BillExample (com.itrus.portal.db.BillExample)10 Project (com.itrus.portal.db.Project)10