| | |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg; |
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo; |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | |
| | | import com.yeshi.fanli.entity.order.ESOrder; |
| | | import com.yeshi.fanli.entity.order.HongBaoOrder; |
| | | import com.yeshi.fanli.entity.order.InviteOrderSubsidy; |
| | | import com.yeshi.fanli.entity.order.SourceTypeEnum; |
| | | import com.yeshi.fanli.entity.pdd.PDDOrder; |
| | | import com.yeshi.fanli.entity.suning.SuningOrderInfo; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | 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.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | |
| | | List<Integer> listSource) throws CommonOrderException, Exception { |
| | | |
| | | int pageSize = Constant.PAGE_SIZE; |
| | | |
| | | |
| | | List<CommonOrderVO> listOrder = commonOrderMapper.listUserOrder((page - 1) * pageSize, pageSize, uid, state, |
| | | type, orderState, orderNo, startTime, endTime, dateType, listSource); |
| | | |
| | |
| | | return commonOrderList; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public List<CommonOrderAddResultDTO> addSuningOrder(List<SuningOrderInfo> suningOrderList, Long uid) |
| | | throws CommonOrderException { |
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>(); |
| | | // 判断所有的订单状态 |
| | | int invalidCount = 0; |
| | | for (SuningOrderInfo order : suningOrderList) { |
| | | if ("退款".equalsIgnoreCase(order.getOrderLineStatusDesc()) |
| | | || "订单已取消".equalsIgnoreCase(order.getOrderLineStatusDesc())) { |
| | | invalidCount++; |
| | | } |
| | | } |
| | | // 获取整体订单的状态 |
| | | int wholeOrderState = 0; |
| | | if (suningOrderList.size() == invalidCount) |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_SHIXIAO; |
| | | else if (invalidCount == 0) |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_YOUXIAO; |
| | | else |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO; |
| | | |
| | | for (SuningOrderInfo suningOrderInfo : suningOrderList) { |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(suningOrderInfo); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(suningOrderInfo.getGoodsNum() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_SUNING); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(wholeOrderState); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | SuningGoodsInfo pddGoods = null; |
| | | // TODO 需要获取 |
| | | pddGoods = SuningApiUtil.getGoodsDetail(suningOrderInfo.getGoodsNum(), "00000000"); |
| | | if (pddGoods != null) { |
| | | cog = CommonOrderGoodsFactory.create(pddGoods); |
| | | } |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } else { |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | | /** |
| | | * 添加订单 |
| | | * |
| | |
| | | List<Integer> listSource, boolean notBackSuVip) 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, notBackSuVip); |
| | | |
| | | // 订单信息为空 |
| | | 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, boolean notBackSuVip) |
| | | throws CommonOrderException { |
| | | return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, |
| | | listSource, notBackSuVip); |
| | | } |
| | |
| | | } else if (sourceType == Constant.SOURCE_TYPE_PDD) { |
| | | order.setOrderType(4); |
| | | } |
| | | |
| | | // 子来源类型 |
| | | ClientTextStyleVO shopStyleVO = new ClientTextStyleVO(); |
| | | SourceTypeEnum typeEnum = SourceTypeEnum.getByDesc(order.getChildSourceType()); |
| | | if (typeEnum == null) { |
| | | shopStyleVO.setContent("其他"); |
| | | shopStyleVO.setColor("#FF5000"); |
| | | shopStyleVO.setBorderColor("#FF5000"); |
| | | } else { |
| | | shopStyleVO.setContent(typeEnum.getDescShow()); |
| | | shopStyleVO.setColor(typeEnum.getFontColor()); |
| | | shopStyleVO.setBorderColor(typeEnum.getBorderColor()); |
| | | } |
| | | order.setShopType(shopStyleVO); |
| | | |
| | | |
| | | Date thirdCreateTime = order.getThirdCreateTime(); |
| | | if (thirdCreateTime != null) { |