From aa774af6df16ef11e1e34ac5aeed9aae0cb3e8e2 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 09 四月 2020 16:25:03 +0800 Subject: [PATCH] 团队分红完善 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 86 ++++++++++++++++++++++++------------------ 1 files changed, 49 insertions(+), 37 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java index b4e7db2..25c333b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java @@ -31,6 +31,7 @@ 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; @@ -65,6 +66,7 @@ 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; @@ -136,9 +138,12 @@ @Resource private UserInfoService userInfoService; - + @Resource private UserInviteService userInviteService; + + @Resource + private UserLevelManager userLevelManager; @Resource(name = "producer") private Producer orderProducer; @@ -285,7 +290,6 @@ } Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList); - // 璁剧疆鏄惁涓簐ip璁㈠崟 for (CommonOrderVO order : listOrder) { if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI @@ -345,7 +349,6 @@ totalSettlement = commonOrder.getTotalPayment(); } commonGoodsVO.setActualPay("浠樻閲戦锛毬�" + totalSettlement); - // 閭�璇疯鍗曚俊鎭繚鎶� if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType @@ -920,9 +923,18 @@ 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(), @@ -930,22 +942,25 @@ 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) { @@ -958,6 +973,7 @@ newCommonOrder.setUserInfo(new UserInfo(uid)); commonOrderList.add(addCommonOrder(newCommonOrder)); } + addConfirmMQMsg(commonOrderList); return commonOrderList; } @@ -1119,6 +1135,7 @@ newCommonOrder.setUserInfo(new UserInfo(uid)); commonOrderList.add(addCommonOrder(newCommonOrder)); } + addConfirmMQMsg(commonOrderList); return commonOrderList; } @@ -1167,10 +1184,11 @@ if (oldCommonOrder == null)// 鏂板 { commonOrder.setCreateTime(new Date()); + UserLevelEnum userLevel = userLevelManager.getUserLevel(commonOrder.getUserInfo().getId(), + commonOrder.getThirdCreateTime()); // 鏌ヨ鏄惁涓簐ip - 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) @@ -1734,14 +1752,11 @@ 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 { @@ -1896,7 +1911,7 @@ } 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); // 楗夸簡涔堣鍗� @@ -1905,8 +1920,7 @@ order.getListOrderGoods().add(commonGoodsVO); } } - - + // 璁㈠崟绫诲瀷 if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { Integer orderType = order.getOrderType(); @@ -1918,7 +1932,6 @@ } else if (sourceType == Constant.SOURCE_TYPE_PDD) { order.setOrderType(4); } - Date thirdCreateTime = order.getThirdCreateTime(); if (thirdCreateTime != null) { @@ -1930,7 +1943,6 @@ if (settleTime != null) { order.setReceiveTime("鏀惰揣鏃堕棿锛�" + format.format(settleTime)); } - /* 璁㈠崟鐘舵�� 杞崲澶勭悊 */ String orderStateContent = ""; @@ -1952,17 +1964,17 @@ } } - - // 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)) { + 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); -- Gitblit v1.8.0