唯品会订单bug修复,APP端佣金比例展示错误bug修复
| | |
| | | root.put("count", 1000);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("获取出错"));
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.vipshop.VipShopQueryOrderResultDTO;
|
| | | import com.yeshi.fanli.entity.vipshop.VipShopOrder;
|
| | | import com.yeshi.fanli.exception.vipshop.VipShopOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.vipshop.VipShopOrderService;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.VIPShopOrder, order.getOrderSn() + "");
|
| | | String result = redisManager.getCommonString(key);
|
| | | // 判断
|
| | | if (StringUtil.isNullOrEmpty(result)) {
|
| | | // if (StringUtil.isNullOrEmpty(result)) {
|
| | | VipShopOrderCMQManager.getInstance().addVipShopOrder(order.getOrderSn() + "");
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 2小时内不再更新
|
| | | }
|
| | | LogHelper.test("唯品会订单消息发送成功");
|
| | | // }else{
|
| | | // LogHelper.test("唯品会订单频率限制");
|
| | | // }
|
| | | } catch (VipShopOrderException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | */
|
| | | @XxlJob("updateVipShopOrderHandler")
|
| | | public ReturnT<String> updateVipShopSoonOrder(String param) throws Exception {
|
| | | LogHelper.test("updateVipShopOrderHandler:"+param);
|
| | | long endTime = System.currentTimeMillis();
|
| | | if ("1hour".equalsIgnoreCase(param)) {// 更新1小时内的订单
|
| | | updateByOrderTime(endTime - 1000 * 60 * 60 * 1L, endTime);
|
| | |
| | | { |
| | | SuningGoodsInfo pddGoods = null; |
| | | // TODO 需要获取 |
| | | pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), "00000000"); |
| | | pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), suningOrderInfo.getSellerCode()); |
| | | if (pddGoods != null) { |
| | | cog = CommonOrderGoodsFactory.create(pddGoods); |
| | | } |
| | |
| | |
|
| | | @Override
|
| | | public void processVipShopOrder(VipShopOrder order) {
|
| | | |
| | | if (order == null || order.getDetailList() == null || order.getDetailList().size() == 0)
|
| | | return;
|
| | |
|
| | |
|
| | | // 根据ext1与subUnionId跟单
|
| | | String channelTag = order.getChannelTag();
|
| | |
|
| | |
| | | PDDOrder old = pddOrderMapper.selectByOrderSN(order.getOrderSn());
|
| | | if (old != null) {
|
| | | // 更新订单信息
|
| | | if (order.getOrderStatus().intValue() != old.getOrderStatus()) {// 状态改变了才更改订单信息
|
| | | if ((order.getOrderStatus().intValue() != old.getOrderStatus())||(old.getOrderStatus()==2 && old.getOrderReceiveTime()==null)) {// 状态改变了才更改订单信息
|
| | | PDDOrder update = new PDDOrder();
|
| | | update.setId(old.getId());
|
| | | update.setOrderStatus(order.getOrderStatus());
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<VipShopOrder> listDetailByOrderSn(String orderSn) {
|
| | | List<VipShopOrder> list = new ArrayList<>();
|
| | | VipShopOrder order = vipShopOrderMapper.selectByOrderSn(orderSn);
|
| | | if (order == null)
|
| | | return null;
|
| | | order = selectDetailByPrimaryKey(order.getId());
|
| | | list.add(order);
|
| | | return list;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public VipShopOrder selectDetailByPrimaryKey(Long orderId) {
|
| | | VipShopOrder order = vipShopOrderMapper.selectByPrimaryKey(orderId);
|
| | | if (order == null)
|
| | |
| | | * @return
|
| | | */
|
| | | public List<VipShopOrder> listByOrderSn(String orderSn);
|
| | | |
| | | /**
|
| | | * 根据订单号查询
|
| | | * @Title: listDetailByOrderSn
|
| | | * @Description: |
| | | * @param orderSn
|
| | | * @return |
| | | * List<VipShopOrder> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<VipShopOrder> listDetailByOrderSn(String orderSn);
|
| | |
|
| | | /**
|
| | | * 根据主键查询(包含子订单)
|
| | |
| | | BigDecimal money = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo()) || goods.getCouponInfo().trim().equalsIgnoreCase("无")) {
|
| | | BigDecimal price = goods.getPrice();
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()), new BigDecimal("0.01")),
|
| | | .mul(MoneyBigDecimalUtil.mul(price, goods.getRate()), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | |
|
| | | } else// 有券
|
| | | {
|
| | | List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | if (goods.getGoodsType() == Constant.SOURCE_TYPE_VIP) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(goods.getCouponStartPrice(), goods.getRate()), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | }
|
| | |
|
| | | // 京东商品特殊处理
|
| | | if (goods.getGoodsType() == Constant.SOURCE_TYPE_JD)
|
| | | return BigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(money, new BigDecimal("0.9")));
|
| | |
| | | String key = its.next();
|
| | | try {
|
| | | String orderId = map.get(key);
|
| | | LogHelper.test("唯品会订单消费:"+orderId);
|
| | | if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | List<VipShopOrder> orderList = vipShopOrderService.listByOrderSn(orderId);
|
| | | List<VipShopOrder> orderList = vipShopOrderService.listDetailByOrderSn(orderId);
|
| | | if (orderList != null)
|
| | | for (VipShopOrder order : orderList)
|
| | | orderProcessService.processVipShopOrder(order);
|
| | |
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("唯品会订单:" + e.getMessage());
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("苏宁订单:" + e.getMessage());
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (goods.getCommodityInfo().getPictureUrl().size() > 0)
|
| | | goodsInfo.setPicUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl()); // 缩略图
|
| | |
|
| | | |
| | | String commodityPrice = goods.getCommodityInfo().getCommodityPrice();
|
| | | if (StringUtil.isNullOrEmpty(commodityPrice)) {
|
| | | commodityPrice = goods.getCommodityInfo().getSnPrice();
|
| | |
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
|
| | | CouponInfoVO coupon = new CouponInfoVO();
|
| | | coupon.setAmount(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) {
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | } else
|
| | | coupon.setStartFee(new BigDecimal(goods.getCouponInfo().getBounsLimit()));
|
| | |
|
| | | if (goods.getCouponInfo().getCouponStartTime() != null) {
|
| | |
| | | BigDecimal afterUseCouponPrice = new BigDecimal(commodityPrice);
|
| | | if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {
|
| | | // 有券
|
| | | BigDecimal startPrice = new BigDecimal(goods.getCouponInfo().getBounsLimit());
|
| | | BigDecimal startPrice = null;
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo().getBounsLimit())) {
|
| | | startPrice = new BigDecimal(goods.getCouponInfo().getCouponValue());
|
| | | } else
|
| | | startPrice = new BigDecimal(goods.getCouponInfo().getBounsLimit());
|
| | | if (afterUseCouponPrice.compareTo(startPrice) >= 0) {
|
| | | afterUseCouponPrice = afterUseCouponPrice.subtract(startPrice);
|
| | | afterUseCouponPrice = afterUseCouponPrice.subtract(new BigDecimal(goods.getCouponInfo().getCouponValue()));
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.div(
|
| | | afterUseCouponPrice.multiply(new BigDecimal(goods.getCommodityInfo().getRate())), new BigDecimal(100)),
|
| | | BigDecimal commission=MoneyBigDecimalUtil.mul(afterUseCouponPrice,MoneyBigDecimalUtil.div(new BigDecimal(goods.getCommodityInfo().getRate()), new BigDecimal(100),5));
|
| | |
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(commission,
|
| | | rate);
|
| | | return BigDecimalUtil.getWithNoZera(money).setScale(2);
|
| | | }
|