| | |
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | 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.OrderCountVO;
|
| | | import com.yeshi.fanli.vo.order.WeiQuanInfo;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private InviteOrderSubsidyService inviteOrderSubsidyService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
| | | @Override
|
| | | public List<CommonOrderVO> getOrderByUid(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type,
|
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source)
|
| | | throws CommonOrderException, Exception{
|
| | | throws CommonOrderException, Exception {
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 数据加工重新组织
|
| | | orderInfoFactory(acceptData, listOrder, listGoods, uid);
|
| | | //listDataFactory(acceptData, listOrder, listGoods, uid);
|
| | | orderVOFactory(acceptData, listOrder, listGoods, uid);
|
| | | |
| | | return listOrder;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 订单: 免单标识 奖励标识
|
| | | * |
| | | * @param order
|
| | | * @param hasRewardCoupon
|
| | | * @param hongBaoState
|
| | | * @param list
|
| | | * @param signList
|
| | | */
|
| | | public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon,
|
| | | Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList,
|
| | | AcceptData acceptData) {
|
| | |
|
| | | // 是否免单商品
|
| | | boolean freeOrder = false; |
| | | // 是否奖励成功
|
| | | boolean rewardSuccess = false;
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | for (UserSystemCouponRecord couponRecord : list) {
|
| | | // 订单号匹配
|
| | | if (order.getOrderNo().equals(couponRecord.getOrderNo())) {
|
| | | Integer state = couponRecord.getState();
|
| | | String systemCouponType = couponRecord.getCouponType();
|
| | | // 奖励订单: 且成功
|
| | | if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
|
| | | && UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | rewardSuccess = true;
|
| | | signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | |
|
| | | } 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;
|
| | | signList.add(PIC_FREE_ON);
|
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | // 免单成功
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_SUCCEED);
|
| | | } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state
|
| | | || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
|
| | | // 规则不匹配、退款
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_FAIL);
|
| | | }
|
| | | }
|
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 订单标识
|
| | | order.setSignList(signList);
|
| | |
|
| | | // 1.6.5 是否存在新兑换的券
|
| | | if (!hasRewardCoupon && exchangeCoupon) {
|
| | | try {
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-10");
|
| | | if (downOrderTime > limitDate)
|
| | | hasRewardCoupon = true;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | boolean rewardOrder = false;
|
| | | int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
|
| | | if (rewardSuccess) {
|
| | | if (!VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardOrder = true; //奖励成功 2.0.2 消失
|
| | | }
|
| | | } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
|
| | | && HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
|
| | | type = 2;
|
| | | rewardOrder = true;
|
| | | }
|
| | |
|
| | | if (rewardOrder) {
|
| | | try {
|
| | | boolean newEdition = false;
|
| | | String num = null;
|
| | | String unit = null;
|
| | | boolean canUse = false;
|
| | | |
| | | // 版本区分:2.0.2
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = Long.parseLong("1571760000000"); // TODO 日期待确定2019-11-10
|
| | | if (downOrderTime > limitDate) {
|
| | | newEdition = true;
|
| | | Date endDay = DateUtil.plusDayDate(4, thirdCreateTime);
|
| | | long currentTime = java.lang.System.currentTimeMillis();
|
| | | if (endDay.getTime() > currentTime) {
|
| | | DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime());
|
| | | if (dateInfo != null) {
|
| | | if (dateInfo.getDay() > 0) {
|
| | | canUse = true;
|
| | | unit = "天";
|
| | | num = dateInfo.getDay().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getHour() > 0) {
|
| | | canUse = true;
|
| | | unit = "小时";
|
| | | num = dateInfo.getHour().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getMinute() > 0) {
|
| | | canUse = true;
|
| | | unit = "分";
|
| | | num = dateInfo.getMinute().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getSecond() > 0) {
|
| | | canUse = true;
|
| | | unit = "秒";
|
| | | num = dateInfo.getSecond().toString();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (newEdition && !canUse) {
|
| | | // 新版不可使用
|
| | | } else {
|
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | if (!newEdition) {
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | rewardStyleVO.setContent("使用奖励券 >");
|
| | | } else {
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | }
|
| | | } else if (canUse) {
|
| | | rewardStyleVO.setContent("使用奖励券");
|
| | | |
| | | ClientTextStyleVO txt1 = new ClientTextStyleVO();
|
| | | txt1.setContent("剩");
|
| | | txt1.setColor("#666666");
|
| | | txt1.setBottomColor("#FFDCEA");
|
| | | |
| | | ClientTextStyleVO txt2 = new ClientTextStyleVO();
|
| | | txt2.setContent(num);
|
| | | txt2.setColor("#E5005C");
|
| | | txt2.setBottomColor("#FFDCEA");
|
| | | txt2.setFontSize("1.33");
|
| | | |
| | | ClientTextStyleVO txt3 = new ClientTextStyleVO();
|
| | | txt3.setContent(unit + "关闭 >");
|
| | | txt3.setColor("#666666");
|
| | | txt3.setBottomColor("#FFDCEA");
|
| | | |
| | | List<ClientTextStyleVO> ticking = new ArrayList<ClientTextStyleVO>();
|
| | | ticking.add(txt1);
|
| | | ticking.add(txt2);
|
| | | ticking.add(txt3);
|
| | | rewardMap.put("ticking", ticking);
|
| | | }
|
| | | 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", type);
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | rewardMap.put("jump", jump);
|
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | 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());
|
| | | if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 订单信息加工
|
| | | * |
| | | * @param acceptData
|
| | | * @param listOrder
|
| | | * @param listGoods
|
| | | * @param uid
|
| | | */
|
| | | public void orderInfoFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods,
|
| | | Long uid) throws Exception{
|
| | | private void orderVOFactory(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>();
|
| | |
| | | listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD);
|
| | | }
|
| | |
|
| | | // 需要查询是否为VIP的用户ID,只有邀请订单才需要查询
|
| | | List<Long> needSelectVIPUidList = new ArrayList<>();
|
| | |
|
| | | 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)
|
| | | needSelectVIPUidList.add(Long.parseLong(order.getUserId()));
|
| | | }
|
| | | Map<Long, Boolean> vipUserMap = userVIPInfoService.listByUids(needSelectVIPUidList);
|
| | |
|
| | | // 设置是否为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("订单来源:由超级会员的粉丝产生");
|
| | | }
|
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | | // 2019.8.1开始返回维权信息
|
| | | Date august = TimeUtil.parse("2019-08-01");
|
| | | |
| | | // 是否存在奖励券
|
| | | boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid);
|
| | | boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid);
|
| | |
|
| | | |
| | | for (CommonOrderVO order: listOrder) {
|
| | | // 当前用户是否VIP
|
| | | boolean vip = userVIPInfoService.isVIP(uid);
|
| | | // 是否存在奖励券
|
| | | boolean hasRewardCoupon = userSystemCouponService.getValidRebateCoupon(uid);
|
| | |
|
| | | for (CommonOrderVO order : listOrder) {
|
| | | String orderNo = order.getOrderNo();
|
| | | Integer sourceType = order.getSourceType();
|
| | | |
| | |
|
| | | // 商品信息组合
|
| | | for (CommonOrderVO commonOrder: listGoods) {
|
| | | 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);
|
| | | commonGoodsVO.setGoodsType(sourceType);
|
| | | |
| | |
|
| | | // 淘宝商品图片处理
|
| | | String picture = commonGoodsVO.getPicture();
|
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO && !StringUtil.isNullOrEmpty(picture) |
| | | 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);
|
| | | |
| | | |
| | |
|
| | | Integer hongBaoType = order.getHongBaoType();
|
| | | // 邀请订单信息保护
|
| | | if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | |
| | | commonGoodsVO.setGoodsTitle(titleMap);
|
| | | }
|
| | |
|
| | |
|
| | | // 订单类型为空时 已商品类为准
|
| | | Integer orderType = order.getOrderType();
|
| | | if (orderType == null) {
|
| | |
| | | order.setOrderType(2);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | order.getListOrderGoods().add(commonGoodsVO);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime));
|
| | |
| | | if (settleTime != null) {
|
| | | order.setReceiveTime("收货时间:" + format.format(settleTime));
|
| | | }
|
| | | |
| | |
|
| | | // 订单类型
|
| | | if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | Integer orderType = order.getOrderType();
|
| | |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
|
| | | order.setOrderType(4);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /* 订单状态 转换处理 */
|
| | | String orderStateContent = "";
|
| | | Map<String, String> orderStateMap = new HashMap<String, String>();
|
| | |
| | | } else if (CommonOrder.STATE_SX == orderState) {
|
| | | orderStateContent = "未付款/已退款";
|
| | | } else if (CommonOrder.STATE_WQ == orderState) {
|
| | | orderStateContent = "已维权";
|
| | | orderStateContent = "已售后";
|
| | | if (sourceType != null && sourceType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | /* 订单维权 判断是否全部维权 */
|
| | | List<TaoBaoWeiQuanOrder> listWQ = taoBaoWeiQuanOrderMapper
|
| | |
| | | } else {
|
| | | // 2019.8.1 返回维权信息
|
| | | if (settleTime != null && august != null && settleTime.getTime() > august.getTime()) {
|
| | | orderStateContent = "维权成功";
|
| | | orderStateContent = "售后成功";
|
| | | WeiQuanInfo weiQuanInfo = new WeiQuanInfo();
|
| | | weiQuanInfo.setOldHongBao("¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | weiQuanInfo.setWqHongBao("维权:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | weiQuanInfo
|
| | | .setWqHongBao("售后:-¥" + weiQuanMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBao = MoneyBigDecimalUtil.sub(hongBao, weiQuanMoney);
|
| | | order.setWeiQuanInfo(weiQuanInfo);
|
| | | }
|
| | |
| | | orderStateMap.put("content", orderStateContent);
|
| | | orderStateMap.put("fontColor", "#666666");
|
| | | order.setOrderState(orderStateMap);
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | String hongbaoInfo = "";
|
| | | // 订单标识
|
| | | List<String> signList = new ArrayList<String>();
|
| | |
| | | signList.add(CommonOrder.TYPE_SHARE);
|
| | |
|
| | | } else if (HongBaoV2.TYPE_SHARE_YIJI == hongBaoType || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | | // 下级的分享订单: 显示邀请
|
| | | // 下级的分享订单: 显示邀请
|
| | | hongbaoInfo = "奖金";
|
| | | order.setOrderOrigin("3");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | signList.add(CommonOrder.TYPE_INVITE);
|
| | |
|
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType) {
|
| | | // 邀请订单
|
| | |
| | | order.setOrderOrigin("3");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_INVITE);
|
| | | signList.add(CommonOrder.TYPE_INVITE);
|
| | | |
| | |
|
| | | // 版本区分:2-0-2
|
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid, order.getOrderNo(), sourceType);
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | InviteOrderSubsidy orderSubsidy = inviteOrderSubsidyService.getByOrderNoAndType(uid,
|
| | | order.getOrderNo(), sourceType);
|
| | | if (orderSubsidy != null) {
|
| | | ClientTextStyleVO subsidyInfo = new ClientTextStyleVO();
|
| | | subsidyInfo.setContent("(补贴¥" + orderSubsidy.getMoney() + ")");
|
| | |
| | | subsidyInfo.setColor("#888888");
|
| | | }
|
| | | order.setSubsidy(subsidyInfo);
|
| | | |
| | |
|
| | | // 解释信息(问号)
|
| | | List<String> subsidyList = new ArrayList<String>();
|
| | | subsidyList.add("额外补贴能否获得由系统算法自动判断,人为无法干涉;");
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | order.setSignList(signList);
|
| | | |
| | | String hongBaoDate = null;
|
| | | String hongBaoState_Str = "";
|
| | | String hongbaoInfoFontColor = "#E5005C";
|
| | |
| | | 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);
|
| | |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | |
|
| | | // 非自购的订单 不显示返利、免单详情
|
| | | if (HongBaoV2.TYPE_ZIGOU != hongBaoType) {
|
| | | order.setSignList(signList);
|
| | | } else {
|
| | | |
| | | // 显示返利、免单详情
|
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
|
| | | // 奖励订单、免单 使用记录
|
| | | if (sourceType == null) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null,
|
| | | signList, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordTB, signList, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordTB, uid, vip, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordJD, signList, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordJD, uid, vip, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
|
| | | setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType,
|
| | | listRecordPDD, signList, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordPDD, uid, vip, acceptData);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 订单: 免单标识 奖励标识
|
| | | * |
| | | * @param order
|
| | | * @param hasRewardCoupon
|
| | | * @param hongBaoState
|
| | | * @param list
|
| | | * @param signList
|
| | | */
|
| | | private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState,
|
| | | Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception{
|
| | |
|
| | | // 是否免单商品
|
| | | boolean freeOrder = false;
|
| | | // 是否奖励成功
|
| | | boolean rewardSuccess = false;
|
| | | boolean version2_1 = VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion());
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | for (UserSystemCouponRecord couponRecord : list) {
|
| | | int goodSource = couponRecord.getGoodSource();
|
| | | if (goodSource == 0)
|
| | | goodSource = 1;
|
| | | |
| | | if (order.getOrderNo().equals(couponRecord.getOrderNo()) && goodSource == order.getSourceType()) {
|
| | | Integer state = couponRecord.getState();
|
| | | String systemCouponType = couponRecord.getCouponType();
|
| | | if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
|
| | | && UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | rewardSuccess = true;
|
| | | if (!version2_1) {
|
| | | // 奖励成功
|
| | | order.getSignList().add(PIC_REWARD);
|
| | | }
|
| | | } 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());
|
| | | if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | 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");
|
| | | |
| | | if (version2_1) {
|
| | | rewardStyleVO.setContent("已使用奖励券 >");
|
| | | } else {
|
| | | 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);
|
| | | }
|
| | | |
| | | // 是否可使用奖励券
|
| | | if (!rewardSuccess && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType |
| | | && HongBaoV2.STATE_YILINGQU == hongBaoState && !vip && CommonOrder.STATE_WQ != order.getState()) {
|
| | | // 下单时间
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | // 到账时间
|
| | | Date accountTime = order.getAccountTime();
|
| | | if (thirdCreateTime == null || accountTime == null)
|
| | | return;
|
| | | |
| | | // 下单日期是否是符合上线日期
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = TimeUtil.parse(Constant.COUPON_REWARD_TIME).getTime();
|
| | | if (downOrderTime > limitDate) {
|
| | | // 2.1 开始新版
|
| | | rewardCounponLimitTime(order, accountTime);
|
| | | } else if (hasRewardCoupon) {
|
| | | // 在2.1新版上线之前订单-存在则显示奖励券可使用
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | |
| | | 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", 2); // 弹框
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void rewardCounponLimitTime(CommonOrderVO order,Date accountTime) throws Exception {
|
| | | // 倒计时验证
|
| | | Date endDay = DateUtil.plusDayDate(Constant.COUPON_REWARD_LIMIT_DAY, accountTime);
|
| | | long currentTime = java.lang.System.currentTimeMillis();
|
| | | if (endDay.getTime() <= currentTime)
|
| | | return;
|
| | | |
| | | String num = null;
|
| | | String unit = null;
|
| | | boolean canUse = false;
|
| | | DateInfo dateInfo = DateUtil.dateDiff3(currentTime, endDay.getTime());
|
| | |
|
| | | if (dateInfo.getDay() > 0) {
|
| | | canUse = true;
|
| | | unit = "天";
|
| | | num = dateInfo.getDay().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getHour() > 0) {
|
| | | canUse = true;
|
| | | unit = "小时";
|
| | | num = dateInfo.getHour().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getMinute() > 0) {
|
| | | canUse = true;
|
| | | unit = "分";
|
| | | num = dateInfo.getMinute().toString();
|
| | | }
|
| | |
|
| | | if (!canUse && dateInfo.getSecond() > 0) {
|
| | | canUse = true;
|
| | | unit = "秒";
|
| | | num = dateInfo.getSecond().toString();
|
| | | }
|
| | |
|
| | | // 已经超时
|
| | | if (!canUse) |
| | | return;
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | rewardStyleVO.setContent("使用奖励券");
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | |
| | | ClientTextStyleVO txt1 = new ClientTextStyleVO();
|
| | | txt1.setContent("剩");
|
| | | txt1.setColor("#666666");
|
| | | txt1.setBottomColor("#FFDCEA");
|
| | |
|
| | | ClientTextStyleVO txt2 = new ClientTextStyleVO();
|
| | | txt2.setContent(num);
|
| | | txt2.setColor("#E5005C");
|
| | | txt2.setBottomColor("#FFDCEA");
|
| | | txt2.setFontSize("1.33");
|
| | |
|
| | | ClientTextStyleVO txt3 = new ClientTextStyleVO();
|
| | | txt3.setContent(unit + "关闭 >");
|
| | | txt3.setColor("#666666");
|
| | | txt3.setBottomColor("#FFDCEA");
|
| | |
|
| | | List<ClientTextStyleVO> ticking = new ArrayList<ClientTextStyleVO>();
|
| | | ticking.add(txt1);
|
| | | ticking.add(txt2);
|
| | | ticking.add(txt3);
|
| | | rewardMap.put("ticking", ticking);
|
| | | 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", 2); // 弹出框使用券
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | rewardMap.put("jump", jump);
|
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
|
| | | return commonOrderMapper.countHistoryOrder(uid, day, source);
|
| | | }
|
| | | |
| | | @Override
|
| | | public OrderCountVO getOrderCount(Long uid, Integer day, Integer source) {
|
| | | return commonOrderMapper.getOrderCount(uid, day, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime,
|
| | | Integer day, Integer source, Integer state, Integer stateOrder) {
|
| | | public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime, Integer day,
|
| | | Integer source, Integer state, Integer stateOrder) {
|
| | | return commonOrderMapper.countUserOrderToApp(uid, type, startTime, endTime, day, source, state, stateOrder);
|
| | | }
|
| | |
|
| | |
| | | return weiQuanMoney;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId) {
|
| | | return commonOrderMapper.listBySourceTypeAndOrderNo(sourceType, orderId);
|
| | |
| | | commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
|
| | | return new CommonOrderAddResultDTO(commonOrder, CommonOrderAddResultDTO.TYPE_ADD);
|
| | | } else {// 修改
|
| | | // 已经结算,已经失效,状态未改变的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | // 非京东已经结算,已经失效,状态未改变的订单不处理
|
| | | if ((oldCommonOrder.getState() == CommonOrder.STATE_JS
|
| | | && oldCommonOrder.getSourceType() != Constant.SOURCE_TYPE_JD)
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_WQ
|
| | | || (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
|
| | | return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
|
| | |
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
|
| | | Integer type, Integer orderState, String startTime, String endTime, Integer source)
|
| | | throws CommonOrderException {
|
| | | Integer type, Integer orderState, String startTime, String endTime, Integer source, List<Long> listShopId,
|
| | | List<Long> listGoodsId, Date minTime, BigDecimal money) throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> list = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 搜索框无值或者按订单号搜索时都只搜索主订单
|
| | | list = commonOrderMapper.listQueryWithNoChild(start, count, keyType, key, state, type, orderState,
|
| | | startTime, endTime, source);
|
| | | } else
|
| | | } else {
|
| | | list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime,
|
| | | source);
|
| | | source, listShopId, listGoodsId, minTime, money);
|
| | | }
|
| | |
|
| | | if (list == null) {
|
| | | list = new ArrayList<CommonOrderVO>();
|
| | |
| | |
|
| | | @Override
|
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
|
| | | String startTime, String endTime, Integer source) throws CommonOrderException {
|
| | | String startTime, String endTime, Integer source, List<Long> listShopId, List<Long> listGoodsId,
|
| | | Date minTime, BigDecimal money) throws CommonOrderException {
|
| | | if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 搜索框无值或者按订单号搜索时都只搜索主订单
|
| | | return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime,
|
| | | source);
|
| | | } else
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source);
|
| | | } else {
|
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source,
|
| | | listShopId, listGoodsId, minTime, money);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", orderNo);
|
| | | jumpLink.put("goodsType", goodsType == null? goodsType: goodsType +"");
|
| | | jumpLink.put("goodsType", goodsType == null ? goodsType : goodsType + "");
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", 1);
|
| | |
| | | return commonOrderList.get(0);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public CommonOrderVO firstValidOrderByUid(Long uid) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, null, null);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public CommonOrderVO firstValidOrderByUidAndType(Long uid, Integer type) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, type, null);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public CommonOrderVO firstValidOrderTheMonthByUidAndType(Long uid, Integer type) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, type, 3);
|
| | | public CommonOrderVO firstValidOrderLastMonthByUidAndType(Long uid, Integer type) {
|
| | | return commonOrderMapper.firstValidOrderByUid(uid, type, 4);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public CommonOrder getFirstShareOrderByUid(Long uid) {
|
| | | return commonOrderMapper.getFirstShareOrderByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalRewardMoneyByOrderNoAndSourceType(String orderNo, Integer sourceType) {
|
| | | return commonOrderMapper.getTotalRewardMoneyByOrderNoAndSourceType(orderNo, sourceType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long count24HValidOrderByUid(Long uid, Date minTime) {
|
| | | return commonOrderMapper.count24HValidOrderByUid(uid, minTime);
|
| | | }
|
| | | }
|