/** * 展示修改人数. * * @param ordOrder */ public void showTotalQuantity(List<OrdOrderItemMeta> orderItemMetas) { long child = 0; long adult = 0; long totalPrice = 0; OrdOrder ordOrder = orderServiceProxy.queryOrdOrderByOrderId(orderItemMetas.get(0).getOrderId()); for (OrdOrderItemMeta orderItemMeta : orderItemMetas) { adult += orderItemMeta.getTotalAdultQuantity(); child += orderItemMeta.getTotalChildQuantity(); long price = 0; for (OrdOrderItemProd ordOrderItemProd : ordOrder.getOrdOrderItemProds()) { if (ordOrderItemProd.getOrderItemProdId().equals(orderItemMeta.getOrderItemId())) { price = ordOrderItemProd.getPrice(); break; } } totalPrice += price * orderItemMeta.getQuantity(); } showTotalQuantity.setValue( "总人数:" + (child + adult) + " (成人" + adult + " 儿童" + child + ")"); passPortInfo.setAdult(adult); passPortInfo.setChild(child); passPortInfo.setPrice(totalPrice); passPortInfo.setPriceYuan(String.valueOf((totalPrice / 100))); this.showTotalPrice.setValue(passPortInfo.getPriceYuan()); }
/** * 添加履行信息 * * @param orderId * @param targetId * @param adultQuantity * @param childQuantity */ private boolean addPerform(Long orderId, Long targetId, Long adultQuantity, Long childQuantity) { boolean flag = false; CompositeQuery compositeQuery = new CompositeQuery(); compositeQuery.getMetaPerformRelate().setOrderId(orderId); compositeQuery.getMetaPerformRelate().setTargetId(String.valueOf(targetId)); compositeQuery.getPageIndex().setBeginIndex(0); compositeQuery.getPageIndex().setEndIndex(1000000000); List<OrdOrderItemMeta> orderItemMetas = orderServiceProxy.compositeQueryOrdOrderItemMetaByMetaPerformRelate(compositeQuery); int size = orderItemMetas.size(); if (size > 1) { flag = orderServiceProxy.insertOrdPerform( targetId, orderId, ORDER, adultQuantity, childQuantity); } else { Long orderItemMetaId = orderItemMetas.get(0).getOrderItemMetaId(); flag = orderServiceProxy.insertOrdPerform( targetId, orderItemMetaId, ORDER_ITEM, adultQuantity, childQuantity); } if (flag) { for (int i = 0; i < orderItemMetas.size(); i++) { OrdOrderItemMeta o = orderItemMetas.get(i); PassPortLog passPortLog = new PassPortLog(); passPortLog.setContent("通过E景通通关预警管理通关"); passPortLog.setCreateDate(new Date()); passPortLog.setOrderId(passPortInfo.getOrderId()); passPortLog.setOrderItemMetaId(o.getOrderItemMetaId()); passPortLog.setPassPortUserId(this.getUser().getPassPortUserId()); eplaceService.addPassPortLog(passPortLog); } } return flag; }
private void singleSmsInMerged(PassCode passCode, boolean mergeCertificateSMS) { List<OrdOrderItemMeta> ordItemMetaList = null; OrdOrderItemMeta itemMeta = null; if (passCode.isForOrder()) { ordItemMetaList = orderServiceProxy.queryOrdOrderItemMetaByOrderId(passCode.getOrderId()); itemMeta = ordItemMetaList.get(0); } else { itemMeta = orderServiceProxy.queryOrdOrderItemMetaBy(passCode.getObjectId()); } OrdOrderItemProd ordItemProd = orderServiceProxy.queryOrdOrderItemProdById(itemMeta.getOrderItemId()); ProdProductBranch prodProductBranch = prodProductBranchDAO.selectByPrimaryKey(ordItemProd.getProdBranchId()); // 凭证短信合并发送,并且是各子子项独立申码 if (mergeCertificateSMS && passCode.isForOrderItemMeta() && generateSMS) { // 【${销售类别} 取票码 ${code},辅助码xxxx ,含${adult} ${chaild}】 String formatString = "【%s %s,%s,%s】"; String branchName = prodProductBranch.getBranchName(); String code = ""; if (!"BASE64".equalsIgnoreCase(passCode.getCode())) { code = "取票码 " + passCode.getCode(); } String addCode = passCode.getAddCode(); if (StringUtils.isNotEmpty(addCode)) { addCode = "辅助码 " + addCode; } else { addCode = ""; } long adult = ordItemProd.getQuantity() * prodProductBranch.getAdultQuantity(); long child = ordItemProd.getQuantity() * prodProductBranch.getChildQuantity(); StringBuilder quantity = new StringBuilder(); if (itemMeta.isStudent()) { quantity.append("学生人数:" + (adult + child)); } else { quantity.append("含"); if (adult > 0) { quantity.append(adult + "成人 "); } if (child > 0) { quantity.append(child + "儿童"); } } String smsContent = String.format(formatString, branchName, code, addCode, quantity); log.info("=====singleSmsInMerged smsContent===========" + smsContent); PassCode temp = new PassCode(); temp.setCodeId(passCode.getCodeId()); temp.setSmsContent(smsContent); passCodeService.updatePassCode(temp); } }
/** * 初始OrdOrderItemMeta相关信息 * * @param ordOrderItemMateMap * @param branchItem */ private void initOrdOrderItemMeta( Map<Long, OrdOrderItemMeta> ordOrderItemMateMap, ProdProductBranchItem branchItem, Date visitTime) { TimePrice timePrice = metaTimePriceDAO.getMetaTimePriceByIdAndDate(branchItem.getMetaBranchId(), visitTime); OrdOrderItemMeta ordOrderItemMeta = new OrdOrderItemMeta(); ordOrderItemMeta.setSettlementPrice(timePrice.getSettlementPrice()); ordOrderItemMateMap.put(branchItem.getMetaProductId(), ordOrderItemMeta); }
/** * 初始化机票相关信息 * * @param ordOrderItemMateMap * @param branchItem */ private void initFlightInfo( Map<Long, OrdOrderItemMeta> ordOrderItemMateMap, ProdProductBranchItem branchItem, Date visitTime) { MetaProduct metaProduct = metaProductDAO.getMetaProductByPk(branchItem.getMetaProductId()); if (Constant.PRODUCT_TYPE.TRAFFIC.name().equals(metaProduct.getProductType())) { // 交通 if (Constant.SUB_PRODUCT_TYPE.FLIGHT.name().equals(metaProduct.getSubProductType())) { // 机票 MetaProductTraffic metaProductTraffic = (MetaProductTraffic) metaProductDAO.getMetaProduct( branchItem.getMetaProductId(), Constant.PRODUCT_TYPE.TRAFFIC.name()); if (null != metaProductTraffic) { OrdOrderItemMeta ordOrderItemMeta = new OrdOrderItemMeta(); ordOrderItemMeta.setVisitTime(visitTime); ordOrderItemMeta.setDirection(metaProductTraffic.getDirection()); PlaceFlight placeFlight = placeFlightService.queryPlaceFlight(metaProductTraffic.getGoFlight()); if (null != placeFlight) { ordOrderItemMeta.setGoFlightCode(placeFlight.getFlightNo()); if (StringUtils.isNotBlank(placeFlight.getStartTime())) { // 去的航班时间=(去玩的日期+起飞时间) String time = ordOrderItemMeta.getVisitTimeDay() + " " + placeFlight.getStartTime(); ordOrderItemMeta.setGoFlightTime(DateUtil.getDateByStr(time, "yyyy-MM-dd HH:mm")); } } if (Constant.TRAFFIC_DIRECTION.ROUND.name().equals(metaProductTraffic.getDirection()) && null != metaProductTraffic.getBackFlight()) { // 往返 placeFlight = placeFlightService.queryPlaceFlight(metaProductTraffic.getBackFlight()); if (null != placeFlight) { ordOrderItemMeta.setBackFlightCode(placeFlight.getFlightNo()); if (StringUtils.isNotBlank(placeFlight.getStartTime())) { // 返回的航班时间=(去玩的日期+玩的天数)+起飞时间-1天 Date temp = DateUtil.dsDay_Date( ordOrderItemMeta.getVisitTime(), metaProductTraffic.getDays().intValue() - 1); String time = DateUtil.getDateTime("yyyy-MM-dd", temp) + " " + placeFlight.getStartTime(); ordOrderItemMeta.setBackFlightTime(DateUtil.getDateByStr(time, "yyyy-MM-dd HH:mm")); } } } ordOrderItemMateMap.put(branchItem.getMetaProductId(), ordOrderItemMeta); } } } }
private String getProductName(PassCode passCode) { List<OrdOrderItemMeta> ordItemMetaList = null; OrdOrderItemMeta itemMeta = null; if (passCode.isForOrder()) { ordItemMetaList = orderServiceProxy.queryOrdOrderItemMetaByOrderId(passCode.getOrderId()); itemMeta = ordItemMetaList.get(0); } else { itemMeta = orderServiceProxy.queryOrdOrderItemMetaBy(passCode.getObjectId()); } OrdOrderItemProd ordItemProd = orderServiceProxy.queryOrdOrderItemProdById(itemMeta.getOrderItemId()); ProdProductBranch prodProductBranch = prodProductBranchDAO.selectByPrimaryKey(ordItemProd.getProdBranchId()); ProdProduct product = prodProductService.getProdProduct(prodProductBranch.getProductId()); return product.getProductName(); }