/** * 购买商品-生成订单 * * @author zhliu * @date 2015年6月19日 * @parm * @param request * @param response * @param packageId : 套餐ID * @param count * @return */ @RequestMapping("/buyProdOrder") public String buyProdOrder(HttpServletRequest request, RequestBookingOrder bookingOrder) { Order order = new Order(); try { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); bookingOrder.setUserId(user.getObjectId()); bookingOrder.setOrderType(IBSConstants.ORDER_TYPE_POINT_BUY); // 年度福利 bookingOrder.setOrderSource(IBSConstants.ORDER_SOURCE_HR); // 企业HR端 bookingOrder.setOrderProductType( IBSConstants.ORDER_PRODUCT_TYPE_WELFARE); // 订单商品类型 1福利套餐,2体检套餐,3SKU商品,4生活服务 bookingOrder.setUserId(user.getObjectId()); logger.info("HR端购买福利 --购买商品---开始"); order = orderManager.createImmediateOrder(bookingOrder); logger.info("HR端购买福利 --购买商品---结束"); } catch (Exception e) { e.printStackTrace(); logger.error("HR端购买福利 --购买商品---失败"); logger.error(e.getMessage()); } return "redirect:" + "buyWelfareOrderSuc/" + order.getObjectId(); }
/** * 购买福利-生成订单 * * @author zhliu * @date 2015年6月19日 * @parm * @param request * @param response * @param packageId : 套餐ID * @param count * @return */ @RequestMapping("/buyWelfareOrder") public String buyWelfareOrder(HttpServletRequest request, RequestBookingOrder bookingOrder) { Order order = new Order(); try { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); bookingOrder.setUserId(user.getObjectId()); bookingOrder.setOrderType(IBSConstants.ORDER_TYPE_POINT_BUY); // 积分购买 bookingOrder.setOrderSource(IBSConstants.ORDER_SOURCE_HR); // 企业HR端 // bookingOrder.setOrderProductType(IBSConstants.ORDER_PRODUCT_TYPE_WELFARE);//订单商品类型 // 1福利套餐,2体检套餐,3SKU商品,4生活服务 bookingOrder.setUserId(user.getObjectId()); logger.info("HR端购买福利 --购买福利---开始"); order = orderManager.createImmediateOrder(bookingOrder); logger.info("HR端购买福利 --购买福利---结束"); } catch (Exception e) { logger.error("HR端购买福利 出错了,抛异常信息...", e); if (e.getMessage().equals("商品库存不足")) { request.setAttribute("msg", e.getMessage()); } else { request.setAttribute("msg", "预定失败"); } return HOME_DIR + "/bookOrderFail"; } return "redirect:" + "buyWelfareOrderSuc/" + order.getObjectId(); }
/** * 购买福利-生成订单 -- 根据子订单 ID 进行支付 * * @author zhliu * @date 2015年7月3日 * @parm * @param request * @param response * @param objectId : 子订单ID * @return */ @RequestMapping("/buyWelfareSubOrderSuc/{objectId}") public String buyWelfareSubOrderSuc(HttpServletRequest request, @PathVariable Long objectId) { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); SubOrder subOrder = new SubOrder(); double totalAmount = 0.0; // 应付总额 Double sumPoint = 0.0; // 员工 积分 Order order = new Order(); // 总订单 try { // 查询剩余积分 sumPoint = userManager.getUserBalance(user.getObjectId()); subOrder = subOrderManager.getByObjectId(objectId); order = orderManager.getByObjectId(subOrder.getGeneralOrderId()); totalAmount = subOrder.getPayableAmount(); request.setAttribute("sumPoint", sumPoint); request.setAttribute("subOrder", subOrder); request.setAttribute("totalAmount", totalAmount); if (order.getPaymentWay() != null && order.getPaymentWay() == 2) { return HOME_DIR + "/buyWelfareOrder"; } else { return HOME_DIR + "/buyWelfareOrderPayOffline"; } } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } return HOME_DIR + "/buyWelfareOrder"; }
@RequestMapping("listNotice") public String listNotice( HttpServletRequest request, HttpServletResponse response, Infomation infomation, Integer backPage) { infomationManager.updateValidateInfomation(); Long companyId = (Long) request.getSession().getAttribute(SecurityConstants.USER_COMPANY_ID); PageSearch page = PageUtils.preparePage(request, Infomation.class, true); User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); page.getFilters() .add(new PropertyFilter(Infomation.class.getName(), "EQL_companyId", companyId.toString())); if (IBSConstants.USER_TYPE_COMPANY_HR == user.getType()) { page.getFilters() .add( new PropertyFilter( Infomation.class.getName(), "EQL_createdBy", user.getObjectId().toString())); } String cp = request.getParameter("c_p"); Integer currPage = 1; if (cp != null && !("").equals(cp)) { currPage = Integer.parseInt(cp); } page.setSortOrder("asc"); page.setSortProperty("createdOn"); page.setCurrentPage(currPage); handleFind(page); List<Infomation> items = page.getList(); request.setAttribute("items", items); request.setAttribute("pageInfomation", page); return "info/listNotice"; }
/** * 积分发放记录 * * @author zhliu * @date 2015年6月15日 * @parm * @param request * @param response * @return */ @RequestMapping(value = "") public String index(HttpServletRequest request) { try { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); PageSearch page = preparePage(request); PageSearchInit.initcurrentPage(page, request); /** 查询发放名目 */ WelfareItem welfareItem = new WelfareItem(); welfareItem.setItemType(IBSConstants.WELFAREITEM_TYPE_WELFARE); welfareItem.setItemGrade(IBSConstants.WELFAREITEM_GRADE_CLASSIFY); List<WelfareItem> welfareItems = welfareManager.getBySample(welfareItem); List<ActivityItem> acItemList = exActivityManager.queryActivityItemList(user.getCompanyId(), null); if (!UserUtils.isCompanyAdmin()) { // 非企业管理员 page.getFilters() .add( new PropertyFilter( "PointDistrubute", "EQL_userId", String.valueOf(user.getObjectId()))); } page.getFilters() .add( new PropertyFilter( "PointDistrubute", "EQL_companyId", String.valueOf(user.getCompanyId()))); page.setSortProperty("createDate"); page.setSortOrder("desc"); page = pointDistrubuteManager.queryPointDistRelItem(page); // 查询发放对象字典信息 List<Dictionary> dictionaryList = dictionaryManager.getDictionariesByDictionaryId( IBSConstants.POINTS_GRANT_OBJECT_CONSTANT); // 查询发放对象字典信息 List<Dictionary> grantPointsStatusList = dictionaryManager.getDictionariesByDictionaryId(IBSConstants.GRANT_POINTS_STATUS); request.setAttribute("dictionaryList", dictionaryList); request.setAttribute("grantPointsStatusList", grantPointsStatusList); request.setAttribute("pageActivity", page); request.setAttribute("welfareItems", welfareItems); request.setAttribute("acItemList", acItemList); Date now = new Date(); for (PointDistrubute distrubute : (List<PointDistrubute>) page.getList()) { // 借用字段 distrubute.setUserId((long) distrubute.getDistributeDate().compareTo(now)); } } catch (Exception e) { logger.error("index", e); } return HOME_DIR + "/listpointsGrant"; }
/** * 积分支付 * * @author zhliu * @date 2015年6月30日 * @param request * @param response * @param subOrderNo:子订单号 * @param payWay :线上支付渠道(1:积分支付;2支付宝支付;3:混合支付) * @param password :支付密码 * @return */ @RequestMapping("integralPaySetPayment") public String integralPaySetPayment( HttpServletRequest request, String subOrderId, String subOrderNo, String payWay, String password, Long orderId) { try { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); // 更新 订单 实付金额 SubOrder subOrder = new SubOrder(); subOrder.setSubOrderNo(subOrderNo); subOrder = subOrderManager.getBySample(subOrder).get(0); if (payWay != null && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_INTEGRAL))) { // 积分支付 subOrder.setActuallyAmount(0.0); subOrder.setActuallyIntegral(subOrder.getPayableAmount()); } else if (payWay != null && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_ALIPAY))) { // 支付宝支付 subOrder.setActuallyAmount(subOrder.getPayableAmount()); subOrder.setActuallyIntegral(0.0); } else { return null; } subOrderManager.save(subOrder); // 积分支付 Map resultMap = orderManager.integralPay(subOrderId, user.getObjectId(), password); request.setAttribute("message", resultMap.get("message")); // 支付信息 /*if(orderId == null){//子订单ID return "redirect:"+"buyWelfareSubOrderSuc/"+subOrderId; }else{//总订单ID return "redirect:"+"buyWelfareOrderSuc/"+orderId; }*/ return "redirect:" + "buyWelfareSubOrderSuc/" + subOrderId; } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } return null; }
/** * 购买商品-填写收货信息 * * @author zhliu * @date 2015年6月19日 * @parm * @param request * @param response * @param prodId : 商品ID * @param count * @return */ @RequestMapping("/buyProdIndex") public String buyProdIndex( HttpServletRequest request, HttpServletResponse response, Long skuId, Long count) { List<GoodsReceiptAddr> receiptAddrList = new ArrayList<GoodsReceiptAddr>(); // 收货地址 User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); SkuPublish skuPublish = new SkuPublish(); ProductPublish productPublish = new ProductPublish(); int stockType = 1; // 实体兑换券 需要填写 收货地址(1:实体兑换券2:电子兑换券) try { receiptAddrList = goodsReceiptAddrManager.getAddrByUserId(user.getObjectId()); // 查询商品详细 skuPublish = skuPublishManager.getSkuPublishPrice( FrameworkContextUtils.getCurrentUser().getCompanyId(), skuId); productPublish = publishManager.getByObjectId(skuPublish.getProductId()); if (skuPublish.getType() == ProductConstants.PRODUCT_TYPE_MATERIAL_OBJECT || skuPublish.getType() == ProductConstants.PRODUCT_TYPE_MATERIAL_CARD) { stockType = 1; } else { stockType = 2; } // 初始化支付方式 List<Dictionary> payWays = dictionaryManager.getDictionariesByDictionaryId(1403); request.setAttribute("payWays", payWays); // 初始化省份信息 List<Area> provinces = areaManager.getRoot(); request.setAttribute("provinces", provinces); request.setAttribute("receiptAddrList", receiptAddrList); request.setAttribute("count", count); request.setAttribute("skuPublish", skuPublish); request.setAttribute("productPublish", productPublish); request.setAttribute("stockType", stockType); } catch (Exception e) { logger.error(e.getMessage()); e.printStackTrace(); } return HOME_DIR + "/buyProdIndex"; }
/** * 购买福利-填写收货信息 * * @author zhliu * @date 2015年6月19日 * @parm * @param request * @param response * @param packageId : 套餐ID * @param count * @return */ @RequestMapping("buyWelfareIndex") public String buyWelfareIndex( HttpServletRequest request, HttpServletResponse response, Long pakageId, Long count) { int stockType = 1; // 实体兑换券 需要填写 收货地址(1:实体兑换券2:电子兑换券) try { WelfarePackage welfarePackage = new WelfarePackage(); User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); List<GoodsReceiptAddr> receiptAddrList = goodsReceiptAddrManager.getAddrByUserId(user.getObjectId()); welfarePackage = welfarePackageManager.getPackagePrice( FrameworkContextUtils.getCurrentUser().getCompanyId(), pakageId); if (welfarePackage.getStockType() == IBSConstants.WELFARE_PACKAGE_WP_STOCK_TYPE_ELECTRON) { stockType = 2; } else { stockType = 1; } // 初始化支付方式 List<Dictionary> payWays = dictionaryManager.getDictionariesByDictionaryId(1403); request.setAttribute("payWays", payWays); // 初始化省份信息 List<Area> provinces = areaManager.getRoot(); request.setAttribute("provinces", provinces); request.setAttribute("receiptAddrList", receiptAddrList); request.setAttribute("welfarePackage", welfarePackage); request.setAttribute("count", count); request.setAttribute("stockType", stockType); } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } return HOME_DIR + "/buyWelfareIndex"; }
@RequestMapping("saveActivity") public String saveActivity( HttpServletRequest request, HttpServletResponse response, Infomation t) { User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER); t.setType(IBSConstants.HR_NOTICE); t.setCreatedOn(new Date()); t.setCreatedBy(user.getObjectId()); t.setCompanyId(user.getCompanyId()); if (IBSConstants.USER_TYPE_COMPANY_ADMIN != user.getType()) { t.setOrganizationId(user.getOrganizationId()); } t.setTitle(t.getTitle().trim()); t.setContent(UeditorUtils.convertSpace(t.getContent())); if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) { t.setFacePeople(IBSConstants.STATUS_YES); } else { t.setFacePeople(IBSConstants.STATUS_NO); } t = infomationManager.save(t); InfomationNotice delInfomationNotice = new InfomationNotice(); delInfomationNotice.setInfomationId(t.getObjectId()); infomationNoticeManager.deleteBySample(delInfomationNotice); if (IBSConstants.PLATFORM_NOTICE_ALL_USER.equals(t.getFaceMember())) { InfomationNotice infomationNotice = new InfomationNotice(); infomationNotice.setInfomationId(t.getObjectId()); infomationNotice.setAllUser(IBSConstants.PLATFORM_NOTICE_ALL_USER); infomationNotice.setCompanyId(user.getCompanyId()); infomationNoticeManager.save(infomationNotice); } else { String[] members = request.getParameterValues("userId"); for (String memberId : members) { InfomationNotice infomationNotice = new InfomationNotice(); infomationNotice.setUserId(Long.parseLong(memberId)); infomationNotice.setInfomationId(t.getObjectId()); infomationNotice.setCompanyId(user.getCompanyId()); infomationNoticeManager.save(infomationNotice); } } return "redirect:listNotice"; }