| | |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | | import com.aliyun.openservices.ons.api.Message; |
| | | import com.aliyun.openservices.ons.api.Producer; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper; |
| | |
| | | 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.msg.RocketMQManager; |
| | | 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.rocketmq.MQMsgBodyFactory; |
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName; |
| | | import com.yeshi.fanli.util.suning.SuningApiUtil; |
| | | import com.yeshi.fanli.util.suning.SuningUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | |
| | | |
| | | @Service |
| | | public class CommonOrderServiceImpl implements CommonOrderService { |
| | | |
| | | |
| | | @Resource |
| | | private CommonOrderMapper commonOrderMapper; |
| | |
| | | @Resource |
| | | private TaoBaoOrderGoodsMapper taoBaoOrderGoodsMapper; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | | @Resource |
| | | private RocketMQManager rocketMQManager; |
| | | |
| | | // 奖励订单图片 |
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; |
| | |
| | | settlement, firstOrder.getUserInfo().getId(), placeDate, new Date()); |
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderConfirm, |
| | | mqMsg); |
| | | orderProducer.send(msg); |
| | | rocketMQManager.sendNormalMsg(msg, null); |
| | | } |
| | | } |
| | | } |
| | |
| | | return commonOrderMapper.getByOrderNo(uid, orderNO); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getByOrderNoAndSourceType(Long uid, String orderNO, int sourceType) { |
| | | return commonOrderMapper.getByOrderNoAndSourceType(uid, orderNO, sourceType); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public CommonOrder selectLatestValidByUid(Long uid) { |
| | | List<Integer> stateList = new ArrayList<>(); |
| | |
| | | @Override |
| | | public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, |
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, |
| | | List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException, Exception { |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource, notBackSuVip); |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | |
| | | // 订单信息为空 |
| | | if (listOrder == null || listOrder.size() == 0) { |
| | |
| | | |
| | | @Override |
| | | public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) |
| | | throws CommonOrderException { |
| | | String startTime, String endTime, Integer dateType, List<Integer> listSource) { |
| | | return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, |
| | | listSource, notBackSuVip); |
| | | listSource); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<String> listTB = new ArrayList<String>(); |
| | | List<String> listJD = new ArrayList<String>(); |
| | | List<String> listPDD = new ArrayList<String>(); |
| | | List<String> listVIP = new ArrayList<String>(); |
| | | List<String> listSuNing = new ArrayList<String>(); |
| | | for (CommonOrderVO order : listOrder) { |
| | | if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI |
| | | || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_YIJI |
| | |
| | | listJD.add(order.getOrderNo()); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | listPDD.add(order.getOrderNo()); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_VIP) { |
| | | listVIP.add(order.getOrderNo()); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_SUNING) { |
| | | listSuNing.add(order.getOrderNo()); |
| | | } |
| | | } |
| | | |
| | |
| | | listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD); |
| | | } |
| | | |
| | | List<UserSystemCouponRecord> listRecordVIP = null; |
| | | if (listVIP.size() > 0) { |
| | | listRecordVIP = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_VIP, listVIP); |
| | | } |
| | | |
| | | List<UserSystemCouponRecord> listRecordSuNing = null; |
| | | if (listSuNing.size() > 0) { |
| | | listRecordSuNing = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_SUNING, listSuNing); |
| | | } |
| | | |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); |
| | | // 是否存在奖励券 |
| | |
| | | Integer goodsType = commonGoodsVO.getGoodsType(); |
| | | if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) { |
| | | order.setOrderType(Constant.SOURCE_TYPE_ELME); // 饿了么订单 |
| | | commonGoodsVO.setGoodsId("0"); |
| | | } |
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_SUNING) { |
| | | commonGoodsVO.setGoodsId(SuningUtil.getConcatGoodsIId(commonGoodsVO.getShopId() +"", commonGoodsVO.getGoodsId())); |
| | | } |
| | | order.getListOrderGoods().add(commonGoodsVO); |
| | | } |
| | |
| | | // 显示返利说明连接> 未失效 |
| | | if (CommonOrder.STATE_SX != orderState |
| | | && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)) { |
| | | String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); |
| | | String rebateLink = configService.getValue(ConfigKeyEnum.orderRebateDescLink.getKey(),acceptData.getSystem()); |
| | | order.setRebateLink(rebateLink + "?orderNo=" + orderNo + "&sourceType=" + sourceType); |
| | | } |
| | | |
| | |
| | | couponUseFactory(order, listRecordJD); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | couponUseFactory(order, listRecordPDD); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_VIP) { |
| | | couponUseFactory(order, listRecordVIP); |
| | | } else if (sourceType == Constant.SOURCE_TYPE_SUNING) { |
| | | couponUseFactory(order, listRecordSuNing); |
| | | } |
| | | } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) { |
| | | // 分享 |
| | |
| | | return commonOrderMapper.listByOrderNo(orderNo); |
| | | } |
| | | |
| | | @Override |
| | | public CommonOrder getFirstOrder(Long uid) { |
| | | return commonOrderMapper.getFirstOrder(uid); |
| | | } |
| | | |
| | | } |