| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService; |
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | | import com.yeshi.fanli.service.manger.user.UserLevelManager; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | | import com.yeshi.fanli.vo.order.CommonOrderGoodsVO; |
| | | import com.yeshi.fanli.vo.order.CommonOrderVO; |
| | | import com.yeshi.fanli.vo.order.HongBaoCountVO; |
| | | import com.yeshi.fanli.vo.order.OrderCountVO; |
| | | import com.yeshi.fanli.vo.order.WeiQuanInfo; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | |
| | | @Resource |
| | | private UserInviteService userInviteService; |
| | | |
| | | @Resource |
| | | private UserLevelManager userLevelManager; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | |
| | | |
| | | // 数据加工重新组织 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | orderVOFactoryNew(acceptData, listOrder, listGoods, uid); |
| | | orderVOFactory21(acceptData, listOrder, listGoods, uid); |
| | | } else { |
| | | orderVOFactory(acceptData, listOrder, listGoods, uid); |
| | | } |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | |
| | | // 设置是否为vip订单 |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | |
| | | Date august = TimeUtil.parse("2019-08-01"); |
| | | |
| | | // 当前用户是否VIP |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | boolean vip = userInviteService.verifyVIP(uid); |
| | | |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | for (CommonOrderVO order : listOrder) { |
| | |
| | | totalSettlement = commonOrder.getTotalPayment(); |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | |
| | | return commonOrderMapper.countUserOrderToApp(uid, type, startTime, endTime, day, source, state, stateOrder); |
| | | } |
| | | |
| | | private BigDecimal getWeiQuanMoney(List<TaoBaoWeiQuanOrder> listWQ, int sourceType, Long uid) { |
| | | |
| | | @Override |
| | | public BigDecimal getWeiQuanMoney(List<TaoBaoWeiQuanOrder> listWQ, int sourceType, Long uid) { |
| | | BigDecimal weiQuanMoney = new BigDecimal(0); |
| | | if (listWQ != null && listWQ.size() > 0) { |
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : listWQ) { |
| | |
| | | if (oldCommonOrder == null)// 新增 |
| | | { |
| | | commonOrder.setCreateTime(new Date()); |
| | | UserLevelEnum userLevel = userLevelManager.getUserLevel(commonOrder.getUserInfo().getId(), |
| | | commonOrder.getThirdCreateTime()); |
| | | // 查询是否为vip |
| | | boolean isVIP = userVIPInfoService.isVIP(commonOrder.getUserInfo().getId()); |
| | | if (isVIP) |
| | | commonOrder.setUrank(100);// VIP订单 |
| | | if (userLevel != null) |
| | | commonOrder.setUrank(userLevel.getOrderRank());// VIP订单 |
| | | else { |
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(commonOrder.getUserInfo().getId()); |
| | | if (user != null) |
| | |
| | | return commonOrderMapper.countSearchOrderByUid(uid, list); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getMinSettleTimeAndUid() { |
| | | return commonOrderMapper.getMinSettleTimeAndUid(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> searchOrderByUid(AcceptData acceptData, int page, int size, Long uid, List<ESOrder> list) |
| | | throws Exception { |
| | |
| | | } |
| | | |
| | | // 数据加工重新组织 |
| | | orderVOFactoryNew(acceptData, listVO, listGoods, uid); |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | orderVOFactory21(acceptData, listVO, listGoods, uid); |
| | | } else { |
| | | orderVOFactory(acceptData, listVO, listGoods, uid); |
| | | } |
| | | |
| | | return listVO; |
| | | } |
| | |
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(2); |
| | | } |
| | | |
| | | |
| | | Integer goodsType = commonGoodsVO.getGoodsType(); |
| | | if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) { |
| | | order.setOrderType(Constant.SOURCE_TYPE_ELME); // 饿了么订单 |
| | |
| | | order.getListOrderGoods().add(commonGoodsVO); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 订单类型 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | Integer orderType = order.getOrderType(); |
| | |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | if (thirdCreateTime != null) { |
| | |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | | } |
| | | |
| | | |
| | | /* 订单状态 转换处理 */ |
| | | String orderStateContent = ""; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 2.1显示返利说明连接> 未失效-自购-分享 |
| | | // 2.1显示返利说明连接> 未失效-自购-分享 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (CommonOrder.STATE_SX != orderState && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME) |
| | | && ((HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) || HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) ) { |
| | | if (CommonOrder.STATE_SX != orderState |
| | | && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME) |
| | | && ((HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) |
| | | || HongBaoV2.TYPE_SHARE_GOODS == hongBaoType)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo + "&sourceType=" + sourceType); |
| | | } |
| | | } |
| | | |
| | | |
| | | BigDecimal hongBao = order.getHongBao(); |
| | | if (hongBao == null) { |
| | | hongBao = new BigDecimal(0); |
| | |
| | | return list.get(0).getThirdCreateTime(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, |
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | |
| | | // 订单信息为空 |
| | | if (listOrder == null || listOrder.size() == 0) { |
| | | listOrder = new ArrayList<CommonOrderVO>(); |
| | | return listOrder; |
| | | } |
| | | |
| | | // 商品信息 |
| | | List<CommonOrderVO> listGoods = commonOrderMapper.listOrderGoodsInfo(listOrder); |
| | | if (listGoods == null || listGoods.size() == 0) { |
| | | return listOrder; |
| | | } |
| | | |
| | | // 数据加工重新组织 |
| | | orderVOFactory21(acceptData, listOrder, listGoods, uid); |
| | | |
| | | return listOrder; |
| | | } |
| | | |
| | | @Override |
| | | public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource) throws CommonOrderException { |
| | | return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, |
| | | listSource); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订单信息加工 |
| | | * |
| | | * @param acceptData |
| | | * @param listOrder |
| | | * @param listGoods |
| | | * @param uid |
| | | */ |
| | | private void orderVOFactory21(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, |
| | | Long uid) throws Exception { |
| | | List<String> listTB = new ArrayList<String>(); |
| | | List<String> listJD = new ArrayList<String>(); |
| | | List<String> listPDD = new ArrayList<String>(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) { |
| | | Integer urank = order.getUrank(); |
| | | if (urank != null) { |
| | | String levelName = UserLevelUtil.getLevelName(urank); |
| | | if (!StringUtil.isNullOrEmpty(levelName)) { |
| | | order.setOrderDesc("订单来源:" + levelName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer sourceType = order.getSourceType(); |
| | | if (sourceType == null) { |
| | | continue; |
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | listTB.add(order.getOrderNo()); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | listJD.add(order.getOrderNo()); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | listPDD.add(order.getOrderNo()); |
| | | } |
| | | } |
| | | |
| | | List<UserSystemCouponRecord> listRecordTB = null; |
| | | if (listTB.size() > 0) { |
| | | listRecordTB = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_TAOBAO, listTB); |
| | | } |
| | | |
| | | List<UserSystemCouponRecord> listRecordJD = null; |
| | | if (listJD.size() > 0) { |
| | | listRecordJD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_JD, listJD); |
| | | } |
| | | |
| | | List<UserSystemCouponRecord> listRecordPDD = null; |
| | | if (listPDD.size() > 0) { |
| | | listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD); |
| | | } |
| | | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); |
| | | // 是否存在奖励券 |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | | if (goods == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) { |
| | | CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO(); |
| | | PropertyUtils.copyProperties(commonGoodsVO, goods); |
| | | if (commonGoodsVO.getGoodsType() == null) { |
| | | commonGoodsVO.setGoodsType(sourceType); |
| | | } |
| | | |
| | | // 淘宝商品图片处理 |
| | | String picture = commonGoodsVO.getPicture(); |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO && !StringUtil.isNullOrEmpty(picture) |
| | | && !picture.contains("320x320")) { |
| | | commonGoodsVO.setPicture(TbImgUtil.getTBSize320Img(picture)); |
| | | } |
| | | |
| | | // 购买数量 |
| | | commonGoodsVO.setActualCount(commonOrder.getTotalCount() + "件"); |
| | | |
| | | // 实付款 |
| | | BigDecimal totalSettlement = commonOrder.getTotalSettlement(); |
| | | if (totalSettlement == null || totalSettlement.compareTo(new BigDecimal(0)) <= 0) { |
| | | totalSettlement = commonOrder.getTotalPayment(); |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) { |
| | | Map<String, String> titleMap = new HashMap<String, String>(); |
| | | titleMap.put("content", "为保障用户隐私,商品信息已隐藏!"); |
| | | titleMap.put("fontColor", "#888888"); |
| | | titleMap.put("bottomColor", "#E9E9E9"); |
| | | commonGoodsVO.setTitle(null); |
| | | commonGoodsVO.setGoodsTitle(titleMap); |
| | | } |
| | | |
| | | // 订单类型为空时 已商品类为准 |
| | | String shopType = commonGoodsVO.getShopType(); |
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(1); |
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(2); |
| | | } |
| | | |
| | | Integer goodsType = commonGoodsVO.getGoodsType(); |
| | | if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) { |
| | | order.setOrderType(Constant.SOURCE_TYPE_ELME); // 饿了么订单 |
| | | } |
| | | order.getListOrderGoods().add(commonGoodsVO); |
| | | } |
| | | } |
| | | |
| | | // 订单类型 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType == null) { |
| | | order.setOrderType(1); |
| | | } |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | order.setOrderType(3); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | if (thirdCreateTime != null) { |
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime)); |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | | } |
| | | |
| | | |
| | | Map<String, String> orderStateMap = new HashMap<String, String>(); |
| | | // 订单状态 |
| | | Integer orderState = order.getState(); |
| | | Integer stateWholeOrder = order.getStateWholeOrder(); |
| | | if (CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO == stateWholeOrder) { |
| | | // 整个订单部分失效:判断真实状态 订单、红包 |
| | | CommonOrderVO buFenOrder = commonOrderMapper.getBuFenOrderState(uid, order.getOrderNo()); |
| | | if (buFenOrder != null) { |
| | | // 有效的订单状态 |
| | | orderState = buFenOrder.getState(); |
| | | } |
| | | } |
| | | |
| | | // 显示返利说明连接> 未失效 |
| | | if (CommonOrder.STATE_SX != orderState |
| | | && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo + "&sourceType=" + sourceType); |
| | | } |
| | | |
| | | // 红包信息 |
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderService.listDetailByOrderIdAndSourceTypeAndUid(orderNo, sourceType, uid); |
| | | HongBaoCountVO hongBaoCountVO = hongBaoOrderService.getHongBaoCountVO(hongBaoOrderList); |
| | | BigDecimal hongBao = hongBaoCountVO.getValidMoney(); |
| | | Integer hongBaoState = hongBaoCountVO.getCurrentState(); |
| | | |
| | | |
| | | /* 订单状态 转换处理 */ |
| | | String orderStateContent = ""; |
| | | if (CommonOrder.STATE_FK == orderState) { |
| | | orderStateContent = "已付款"; |
| | | } else if (CommonOrder.STATE_JS == orderState) { |
| | | orderStateContent = "已收货"; |
| | | } else if (CommonOrder.STATE_SX == orderState) { |
| | | orderStateContent = "未付款/已退款"; |
| | | } else if (CommonOrder.STATE_WQ == orderState) { |
| | | orderStateContent = "已售后"; |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | /* 订单维权 判断是否全部维权 */ |
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); |
| | | BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); |
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney); |
| | | } |
| | | } |
| | | orderStateMap.put("content", orderStateContent); |
| | | orderStateMap.put("fontColor", "#666666"); |
| | | order.setOrderState(orderStateMap); |
| | | |
| | | String hongbaoInfo = ""; |
| | | // 订单标识 |
| | | List<String> signList = new ArrayList<String>(); |
| | | /* 订单返利类型 转换 */ |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType || 2 == hongBaoType) { |
| | | // 自购 |
| | | hongbaoInfo = "返利"; |
| | | order.setOrderOrigin("1"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_FANLI); |
| | | signList.add(CommonOrder.TYPE_FANLI); |
| | | |
| | | // 是否已使用奖励券、免单券情况 |
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | couponUseFactory(order, listRecordTB); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | couponUseFactory(order, listRecordJD); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponUseFactory(order, listRecordPDD); |
| | | } |
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) { |
| | | // 分享 |
| | | hongbaoInfo = "奖金"; |
| | | order.setOrderOrigin("2"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE); |
| | | signList.add(CommonOrder.TYPE_SHARE); |
| | | |
| | | } else if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType |
| | | || HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) { |
| | | // 邀请订单 |
| | | hongbaoInfo = "收益"; |
| | | order.setOrderOrigin("3"); |
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE); |
| | | signList.add(CommonOrder.TYPE_INVITE); |
| | | } |
| | | order.setSignList(signList); |
| | | |
| | | String hongBaoDate = null; |
| | | String hongBaoState_Str = ""; |
| | | String hongbaoInfoFontColor = "#E5005C"; |
| | | |
| | | /* 红包状态 转换 */ |
| | | String stateContent = ""; |
| | | String stateFontColor = "#E5005C"; |
| | | Integer orderHongBaoState = null; |
| | | if (HongBaoV2.STATE_KELINGQU == hongBaoState || HongBaoV2.STATE_BUKELINGQU == hongBaoState) { |
| | | orderHongBaoState = 1; |
| | | stateContent = "未到账"; |
| | | hongBaoState_Str = "预估"; |
| | | Date preAccountTime = order.getPreAccountTime(); |
| | | if (preAccountTime != null) { |
| | | hongBaoDate = "预计到账时间:" + formatday.format(preAccountTime); |
| | | } |
| | | } else if (HongBaoV2.STATE_YILINGQU == hongBaoState) { |
| | | orderHongBaoState = 3; |
| | | stateContent = "已到账"; |
| | | Date accountTime = order.getAccountTime(); |
| | | if (accountTime != null) { |
| | | hongBaoDate = "到账时间:" + formatday.format(accountTime); |
| | | } |
| | | } else if (HongBaoV2.STATE_SHIXIAO == hongBaoState) { |
| | | orderHongBaoState = 4; |
| | | stateContent = "已失效"; |
| | | hongbaoInfoFontColor = "#888888"; |
| | | } |
| | | order.setHongBaoState(orderHongBaoState); |
| | | order.setHongBaoDate(hongBaoDate); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(order.getStateDesc())) { |
| | | stateContent = stateContent + "-" + order.getStateDesc(); |
| | | } |
| | | |
| | | Map<String, String> stateMap = new HashMap<String, String>(); |
| | | stateMap.put("content", stateContent); |
| | | stateMap.put("fontColor", stateFontColor); |
| | | order.setAccountState(stateMap); |
| | | |
| | | hongbaoInfo = hongBaoState_Str + hongbaoInfo; |
| | | |
| | | Map<String, String> hongBaoMap = new HashMap<String, String>(); |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString()); |
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor); |
| | | order.setHongBaoInfo(hongBaoMap); |
| | | |
| | | // 分享、邀请 隐藏订单号 |
| | | if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType || HongBaoV2.TYPE_YAOQING == hongBaoType |
| | | || HongBaoV2.TYPE_YIJI == hongBaoType || HongBaoV2.TYPE_ERJI == hongBaoType |
| | | || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) { |
| | | order.setOrderNo(UserUtil.filterOrderId(order.getOrderNo())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 订单: 免单标识 奖励标识 |
| | | * |
| | | * @param order |
| | | * @param hasRewardCoupon |
| | | * @param hongBaoState |
| | | * @param list |
| | | * @param signList |
| | | */ |
| | | private void couponUseFactory(CommonOrderVO order, List<UserSystemCouponRecord> list) throws Exception { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // 是否免单商品 |
| | | boolean freeOrder = false; |
| | | // 是否奖励成功 |
| | | boolean rewardSuccess = false; |
| | | for (UserSystemCouponRecord couponRecord : list) { |
| | | int goodSource = couponRecord.getGoodSource(); |
| | | if (goodSource == 0) |
| | | goodSource = 1; |
| | | |
| | | String orderNo = couponRecord.getOrderNo(); |
| | | if (order.getOrderNo().equals(orderNo) && goodSource == order.getSourceType()) { |
| | | Integer state = couponRecord.getState(); |
| | | String systemCouponType = couponRecord.getCouponType(); |
| | | if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType) |
| | | && UserSystemCouponRecord.STATE_SUCCESS == state) { |
| | | // 已使用奖励券 |
| | | rewardSuccess = true; |
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType) |
| | | || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType) |
| | | || CouponTypeEnum.freeCouponBuy.name().equals(systemCouponType)) { |
| | | if (UserSystemCouponRecord.STATE_FREE_ON == state) { |
| | | // 免单中 |
| | | freeOrder = true; |
| | | order.getSignList().add(PIC_FREE_ON); |
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) { |
| | | // 免单成功 |
| | | freeOrder = true; |
| | | order.getSignList().add(PIC_FREE_SUCCEED); |
| | | } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state |
| | | || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) { |
| | | // 规则不匹配、退款 |
| | | freeOrder = true; |
| | | order.getSignList().add(PIC_FREE_FAIL); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 免单详情 |
| | | if (freeOrder) { |
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); |
| | | rewardStyleVO.setContent("免单详情 >"); |
| | | rewardStyleVO.setColor("#E5005C"); |
| | | rewardStyleVO.setBottomColor("#FFDCEA"); |
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String, Object>(); |
| | | jumpLink.put("orderNo", order.getOrderNo()); |
| | | jumpLink.put("goodsType", order.getSourceType() + ""); |
| | | |
| | | Map<String, Object> jump = new HashMap<String, Object>(); |
| | | jump.put("type", 1); // 页面跳转 |
| | | jump.put("params", jumpLink); |
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail")); |
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String, Object>(); |
| | | rewardMap.put("text", rewardStyleVO); |
| | | rewardMap.put("jump", jump); |
| | | order.setRewardDetail(rewardMap); |
| | | } |
| | | |
| | | // 已使用奖励券 |
| | | if (rewardSuccess) { |
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); |
| | | rewardStyleVO.setColor("#E5005C"); |
| | | rewardStyleVO.setBottomColor("#FFDCEA"); |
| | | rewardStyleVO.setContent("已使用奖励券 >"); |
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String, Object>(); |
| | | rewardMap.put("text", rewardStyleVO); |
| | | Map<String, Object> jumpLink = new HashMap<String, Object>(); |
| | | jumpLink.put("orderNo", order.getOrderNo()); |
| | | jumpLink.put("goodsType", order.getSourceType() + ""); |
| | | |
| | | Map<String, Object> jump = new HashMap<String, Object>(); |
| | | jump.put("type", 1); // 1 常规跳转页面 |
| | | jump.put("params", jumpLink); |
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail")); |
| | | rewardMap.put("jump", jump); |
| | | order.setRewardDetail(rewardMap); |
| | | } |
| | | } |
| | | } |