| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.dy.DYOrder; |
| | | import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Service |
| | | public class CommonOrderServiceImpl implements CommonOrderService { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(CommonOrderService.class); |
| | | |
| | | |
| | | @Resource |
| | | private CommonOrderMapper commonOrderMapper; |
| | |
| | | } else { |
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + ""); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO); |
| | | cog.setTitle(taoBaoOrder.getTitle()); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | } |
| | | newCommonOrder.setStateWholeOrder(wholeOrderState); |
| | |
| | | taoBaoGoods.getRootCategoryName(), taoBaoGoods.getLeafName())); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), ""); |
| | | logger.warn("淘宝商品下架:{}", taoBaoOrder.getAuctionId(), e); |
| | | try { |
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId()); |
| | | // 记录商品分类 |
| | | |
| | | } catch (Exception e1) { |
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType( |
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO); |
| | |
| | | } |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | //覆盖原来的商品ID |
| | | cog.setGoodsId(newCommonOrder.getCommonOrderGoods().getGoodsId()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrderAddResultDTO> addDYOrder(DYOrder order, Long uid) throws CommonOrderException { |
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>(); |
| | | |
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(order); |
| | | CommonOrderGoods cog = new CommonOrderGoods(); |
| | | cog.setGoodsId(order.getProduct_id()); |
| | | cog.setGoodsType(Constant.SOURCE_TYPE_DY); |
| | | newCommonOrder.setCommonOrderGoods(cog); |
| | | newCommonOrder.setStateWholeOrder(newCommonOrder.getState()); |
| | | // 订单商品插入 |
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(), |
| | | cog.getGoodsType()); |
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品 |
| | | { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(order.getProduct_id())); |
| | | if (goods == null) { |
| | | goods = new DYGoodsDetail(); |
| | | goods.setTitle(order.getProduct_name()); |
| | | goods.setPrice(0); |
| | | goods.setProduct_id(Long.parseLong(order.getProduct_id())); |
| | | goods.setCover(order.getProduct_img()); |
| | | } |
| | | |
| | | if (goods != null) { |
| | | cog = CommonOrderGoodsFactory.create(goods); |
| | | } |
| | | |
| | | cog.setCreateTime(new Date()); |
| | | cog.setUpdateTime(new Date()); |
| | | commonOrderGoodsMapper.insertSelective(cog); |
| | | } else { |
| | | |
| | | } |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<CommonOrder> getByOrderNo(Long uid, String orderNO) { |
| | | return commonOrderMapper.getByOrderNo(uid, orderNO); |
| | | if(uid!=null) { |
| | | return commonOrderMapper.getByOrderNo(uid, orderNO); |
| | | }else{ |
| | | CommonOrderMapper.DaoQuery daoQuery=new CommonOrderMapper.DaoQuery(); |
| | | daoQuery.orderId = orderNO; |
| | | return commonOrderMapper.list(daoQuery,0,100); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonOrder> listPayStateOrder(int sourceType, Date minThirdCreateTime, Date maxThirdCreateTime) { |
| | | public List<CommonOrder> listPayStateOrder(Integer sourceType, Date minThirdCreateTime, Date maxThirdCreateTime,int page,int pageSize) { |
| | | CommonOrderMapper.DaoQuery daoQuery = new CommonOrderMapper.DaoQuery(); |
| | | daoQuery.minThirdCreateTime = minThirdCreateTime; |
| | | daoQuery.maxThirdCreateTime = maxThirdCreateTime; |
| | | daoQuery.state = CommonOrder.STATE_FK; |
| | | daoQuery.sourceType = sourceType; |
| | | daoQuery.sortList = Arrays.asList(new String[]{"co_third_create_time ASC"}); |
| | | return commonOrderMapper.list(daoQuery, 0, 200); |
| | | return commonOrderMapper.list(daoQuery, (page-1)*pageSize, pageSize); |
| | | } |
| | | |
| | | } |