| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; |
| | | 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.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserInviteService userInviteService; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | 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) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | // 设置是否为vip订单 |
| | | 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) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | BigDecimal totalPay = new BigDecimal(0); |
| | | BigDecimal totalActual = new BigDecimal(0); |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods(); |
| | |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement); |
| | | |
| | | // 商品价格 |
| | | BigDecimal actualPrice = commonGoodsVO.getActualPrice(); |
| | | if (actualPrice != null) { |
| | | Integer totalCount = commonOrder.getTotalCount(); |
| | | totalActual = MoneyBigDecimalUtil.add(totalActual, |
| | | MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice)); |
| | | } |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime)); |
| | | order.setObtainTime(thirdCreateTime.getTime()); |
| | | |
| | | // 2.1分享订单和返利订单实付金额大于或者小于券后价的时候,订单页面 只显示3天 下单时间开始 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | | && DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime |
| | | && totalPay.compareTo(totalActual) != 0) { |
| | | order.setFanliDesc("由实付金额*返利比计算而来"); |
| | | order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey())); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | |
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrders) { |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(taoBaoOrder); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | |
| | | if ("饿了么".equalsIgnoreCase(taoBaoOrder.getOrderType())) { |
| | | cog.setGoodsId(taoBaoOrder.getTradeId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_ELME); |
| | | cog.setPicture("http://img.flqapp.com/resource/goods/elme_picture_demo.png"); |
| | | cog.setTitle(taoBaoOrder.getTitle()); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } else { |
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } |
| | | newCommonOrder.setStateWholeOrder(wholeOrderState); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | TaoBaoGoodsBrief taoBaoGoods = null; |
| | | try { |
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId()); |
| | | LogManager.getLogger(LogType.taobaoGoods).info(String.format("订单商品分类:%s#%s#%s", |
| | | taoBaoGoods.getAuctionId(), taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName())); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), ""); |
| | | if (cog.getGoodsType() != Constant.SOURCE_TYPE_ELME) { |
| | | try { |
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId()); |
| | | // 记录商品分类 |
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId()); |
| | | LogManager.getLogger(LogType.taobaoGoods) |
| | | .info(String.format("订单商品分类:%s#%s#%s", taoBaoGoods.getAuctionId(), |
| | | taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName())); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), ""); |
| | | try { |
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId()); |
| | | // 记录商品分类 |
| | | |
| | | } catch (Exception e1) { |
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType( |
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO); |
| | | if (commonGoods != null) |
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods); |
| | | } catch (Exception e1) { |
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType( |
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO); |
| | | if (commonGoods != null) |
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods); |
| | | } |
| | | } |
| | | } |
| | | if (taoBaoGoods != null) { |
| | |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | |
| | | 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 { |
| | |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_ERJI) |
| | | needSelectVIPUidList.add(Long.parseLong(order.getUserId())); |
| | | } |
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | 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); |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | // 设置是否为vip订单 |
| | | 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) { |
| | | if (vipUserMap.get(Long.parseLong(order.getUserId())) != null |
| | | && vipUserMap.get(Long.parseLong(order.getUserId())) == true) |
| | | order.setVipOrder(true); |
| | | else |
| | | order.setVipOrder(false); |
| | | } else |
| | | order.setVipOrder(false); |
| | | |
| | | if (order.isVipOrder()) |
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生"); |
| | | } |
| | | } |
| | | |
| | |
| | | // 2019.8.1开始返回维权信息 |
| | | Date august = TimeUtil.parse("2019-08-01"); |
| | | |
| | | // 当前用户是否VIP |
| | | boolean vip = userVIPInfoService.isVIP(uid); |
| | | // 当前用户是否可以使用奖励券 |
| | | boolean isvip = userInviteService.verifyVIP(uid); |
| | | // 是否存在奖励券 |
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid); |
| | | |
| | | long nowTime = java.lang.System.currentTimeMillis(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | String orderNo = order.getOrderNo(); |
| | | Integer sourceType = order.getSourceType(); |
| | | Integer hongBaoType = order.getHongBaoType(); |
| | | |
| | | BigDecimal totalPay = new BigDecimal(0); |
| | | BigDecimal totalActual = new BigDecimal(0); |
| | | |
| | | // 商品信息组合 |
| | | for (CommonOrderVO commonOrder : listGoods) { |
| | |
| | | if (sourceType.equals(commonOrder.getSourceType()) && orderNo.equals(commonOrder.getOrderNo())) { |
| | | CommonOrderGoodsVO commonGoodsVO = new CommonOrderGoodsVO(); |
| | | PropertyUtils.copyProperties(commonGoodsVO, goods); |
| | | commonGoodsVO.setGoodsType(sourceType); |
| | | if (commonGoodsVO.getGoodsType() == null) { |
| | | commonGoodsVO.setGoodsType(sourceType); |
| | | } |
| | | |
| | | // 淘宝商品图片处理 |
| | | String picture = commonGoodsVO.getPicture(); |
| | |
| | | } |
| | | commonGoodsVO.setActualPay("付款金额:¥" + totalSettlement); |
| | | |
| | | totalPay = MoneyBigDecimalUtil.add(totalPay, totalSettlement); |
| | | |
| | | // 商品价格 |
| | | BigDecimal actualPrice = commonGoodsVO.getActualPrice(); |
| | | if (actualPrice != null) { |
| | | Integer totalCount = commonOrder.getTotalCount(); |
| | | totalActual = MoneyBigDecimalUtil.add(totalActual, |
| | | MoneyBigDecimalUtil.mul(new BigDecimal(totalCount), actualPrice)); |
| | | } |
| | | |
| | | // 邀请订单信息保护 |
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType |
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType |
| | |
| | | } |
| | | |
| | | // 订单类型为空时 已商品类为准 |
| | | Integer orderType = order.getOrderType(); |
| | | if (orderType == null) { |
| | | String shopType = commonGoodsVO.getShopType(); |
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(1); |
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) { |
| | | order.setOrderType(2); |
| | | } |
| | | 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.setObtainTime(thirdCreateTime.getTime()); |
| | | } |
| | | |
| | | // 2.1分享订单和返利订单实付金额大于或者小于券后价的时候,订单页面 只显示3天 下单时间开始 |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType |
| | | && DateUtil.plusDayDate(3, thirdCreateTime).getTime() > nowTime |
| | | && totalPay.compareTo(totalActual) != 0) { |
| | | order.setFanliDesc("由实付金额*返利比计算而来"); |
| | | order.setFanliDescLink(configService.get(ConfigKeyEnum.shareOrderRebateDescLink.getKey())); |
| | | } |
| | | } |
| | | |
| | | Date settleTime = order.getSettleTime(); |
| | | if (settleTime != null) { |
| | | order.setReceiveTime("收货时间:" + format.format(settleTime)); |
| | | } |
| | | |
| | | // 订单类型 |
| | | 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); |
| | | } |
| | | |
| | | /* 订单状态 转换处理 */ |
| | | String orderStateContent = ""; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // 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) ) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo +"&sourceType=" + sourceType); |
| | | } |
| | | } |
| | | |
| | | BigDecimal hongBao = order.getHongBao(); |
| | | if (hongBao == null) { |
| | | hongBao = new BigDecimal(0); |
| | |
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper |
| | | .selectListByOrderIdAndState(order.getOrderNo(), "维权成功"); |
| | | |
| | | boolean isPart = false;// 默认失效 |
| | | BigDecimal weiQuanMoney = getWeiQuanMoney(listWQ, sourceType, uid); |
| | | if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) { |
| | | orderStateContent = "售后成功"; |
| | |
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) { |
| | | // 奖励订单、免单 使用记录 |
| | | if (sourceType == null) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, isvip); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip); |
| | | couponFactoryNew(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, isvip); |
| | | } |
| | | } |
| | | |