| | |
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | 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.vip.UserVIPInfoService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
| | |
|
| | | // 数据加工重新组织
|
| | | orderVOFactory(acceptData, listOrder, listGoods, uid);
|
| | | |
| | |
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 订单信息加工
|
| | |
| | | order.setVipOrder(false);
|
| | | } else
|
| | | order.setVipOrder(false);
|
| | | |
| | | if(order.isVipOrder())
|
| | |
|
| | | if (order.isVipOrder())
|
| | | order.setVipOrderDesc("订单来源:由超级会员的粉丝产生");
|
| | | }
|
| | | |
| | |
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | | // 2019.8.1开始返回维权信息
|
| | |
| | | }
|
| | | }
|
| | | order.setSignList(signList);
|
| | | |
| | |
|
| | | String hongBaoDate = null;
|
| | | String hongBaoState_Str = "";
|
| | | String hongbaoInfoFontColor = "#E5005C";
|
| | |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | | |
| | |
|
| | | // 显示返利、免单详情
|
| | | if (HongBaoV2.TYPE_ZIGOU == hongBaoType) {
|
| | | // 奖励订单、免单 使用记录
|
| | | if (sourceType == null) {
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordTB, uid, vip, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip,
|
| | | acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_JD) {
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordJD, uid, vip, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip,
|
| | | acceptData);
|
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) {
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType,
|
| | | listRecordPDD, uid, vip, acceptData);
|
| | | couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip,
|
| | | acceptData);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 订单: 免单标识 奖励标识
|
| | | *
|
| | |
| | | * @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{
|
| | | 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 (freeOrder) {
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | |
| | | 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("goodsType", order.getSourceType() + "");
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", 1); // 1 常规跳转页面 |
| | | 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 |
| | | 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) {
|
| | | long downOrderTime = thirdCreateTime.getTime(); |
| | | long limitDate = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
|
| | | if (downOrderTime > limitDate) { |
| | | // 2.1 开始新版
|
| | | rewardCounponLimitTime(order, accountTime);
|
| | | } else if (hasRewardCoupon) {
|
| | |
| | | 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);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void rewardCounponLimitTime(CommonOrderVO order,Date accountTime) throws Exception {
|
| | | 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;
|
| | |
| | | }
|
| | |
|
| | | // 已经超时
|
| | | if (!canUse) |
| | | 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");
|
| | |
| | | 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);
|
| | |
| | | if (oldCommonOrder == null)// 新增
|
| | | {
|
| | | commonOrder.setCreateTime(new Date());
|
| | | // 查询是否为vip
|
| | | boolean isVIP = userVIPInfoService.isVIP(commonOrder.getUserInfo().getId());
|
| | | if (isVIP)
|
| | | commonOrder.setUrank(100);// VIP订单
|
| | | else {
|
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(commonOrder.getUserInfo().getId());
|
| | | if (user != null)
|
| | | commonOrder.setUrank(user.getRank());
|
| | | }
|
| | |
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | | // 插入映射,保证交易ID的完整性
|
| | | commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
|
| | |
| | | JSONObject map = new JSONObject();
|
| | | // 订单标识
|
| | | List<String> signList = new ArrayList<String>();
|
| | | //signList.add(CommonOrder.TYPE_FANLI);
|
| | | //signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | // signList.add(CommonOrder.TYPE_FANLI);
|
| | | // signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | map.put("signList", signList);
|
| | |
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|