| | |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | |
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.CommonOrderFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> listGroupOrderNoByUid(long start, int count, Long uid, Integer state, Integer type,
|
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType)
|
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source)
|
| | | throws CommonOrderException {
|
| | | return commonOrderMapper.listUserOrder(start, count, uid, state, type, orderState, orderNo, startTime, endTime,
|
| | | dateType);
|
| | | dateType, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countGroupOrderNoByUid(Long uid, Integer state, Integer type, Integer orderState, String orderNo,
|
| | | String startTime, String endTime, Integer dateType) throws CommonOrderException {
|
| | | return commonOrderMapper.countUserOrder(uid, state, type, orderState, orderNo, startTime, endTime, dateType);
|
| | | String startTime, String endTime, Integer dateType, Integer source) throws CommonOrderException {
|
| | | return commonOrderMapper.countUserOrder(uid, state, type, orderState, orderNo, startTime, endTime, dateType, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> getOrderByUid(Integer page, Long uid, Integer state, Integer type, Integer orderState,
|
| | | String orderNo, String startTime, String endTime, Integer dateType) throws CommonOrderException {
|
| | | public List<CommonOrderVO> getOrderByUid(AcceptData acceptData,Integer page, Long uid, Integer state, Integer type, Integer orderState,
|
| | | String orderNo, String startTime, String endTime, Integer dateType, Integer source) throws CommonOrderException {
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<CommonOrderVO> listOrder = listGroupOrderNoByUid((page - 1) * pageSize, pageSize, uid, state, type,
|
| | | orderState, orderNo, startTime, endTime, dateType);
|
| | | orderState, orderNo, startTime, endTime, dateType, source);
|
| | |
|
| | | // 订单信息为空
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | |
| | | }
|
| | |
|
| | | // 数据加工重新组织
|
| | | listDataFactory(listOrder, listGoods, uid);
|
| | | listDataFactory(acceptData, listOrder, listGoods, uid);
|
| | |
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day) {
|
| | | return commonOrderMapper.countHistoryOrder(uid, day);
|
| | | public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) {
|
| | | return commonOrderMapper.countHistoryOrder(uid, day, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countBonusOrderNumber(Long uid, Integer type, Integer day, String startTime, String endTime) {
|
| | | return commonOrderMapper.countBonusOrderNumber(uid, type, day, startTime, endTime);
|
| | | public long countBonusOrderNumber(Long uid, Integer type, Integer day, String startTime, String endTime, Integer source) {
|
| | | return commonOrderMapper.countBonusOrderNumber(uid, type, day, startTime, endTime, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countBonusOrderMoney(Long uid, Integer type, Integer day, String startTime, String endTime) {
|
| | | return commonOrderMapper.countBonusOrderMoney(uid, type, day, startTime, endTime);
|
| | | public BigDecimal countBonusOrderMoney(Long uid, Integer type, Integer day, String startTime, String endTime, Integer source) {
|
| | | return commonOrderMapper.countBonusOrderMoney(uid, type, day, startTime, endTime, source);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime, String endTime,
|
| | | Integer day) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day);
|
| | | Integer day, Integer source) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day, source);
|
| | | }
|
| | |
|
| | | public void listDataFactory(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) {
|
| | | public void listDataFactory(AcceptData acceptData, List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) {
|
| | |
|
| | | List<String> listNo = new ArrayList<String>();
|
| | | for (CommonOrderVO commonOrderVO : listOrder) {
|
| | |
| | |
|
| | | listOrderGoods.add(commonGoodsVO);
|
| | |
|
| | | Integer orderType = commonOrder.getOrderType();
|
| | | Integer orderType = order.getOrderType();
|
| | | if (orderType == null) {
|
| | | String shopType = commonGoodsVO.getShopType();
|
| | | if (CommonOrderGoodsVO.TYPE_TAOBAO.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(1);
|
| | | order.setOrderType(1);
|
| | | } else if (CommonOrderGoodsVO.TYPE_TMALL.equalsIgnoreCase(shopType)) {
|
| | | commonOrder.setOrderType(2);
|
| | | order.setOrderType(2);
|
| | | } |
| | | |
| | | if (Constant.SOURCE_TYPE_JD == sourceType2) {
|
| | | order.setOrderType(3);
|
| | | } else if (Constant.SOURCE_TYPE_PDD == sourceType2) {
|
| | | order.setOrderType(4);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return commonOrderList;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | |
| | | return commonOrder;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | return oldCommonOrder;
|
| | | }
|
| | | // 交易ID一致才修改
|
| | |
| | | return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrderVO getInfoByOrderNo(Long uid, String orderNo) throws CommonOrderException {
|
| | | List<CommonOrderVO> list = getOrderByUid(1, uid, null, null, null, orderNo, null, null, null);
|
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | | } else {
|
| | | return list.get(0);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState)
|
| | |
| | | return commonOrderVO;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer hongBaoState, String orderNo)
|
| | | throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getCouponHongbaoByOrderNo(uid, hongBaoState, orderNo);
|
| | |
|
| | | // 订单信息为空
|
| | | if (listOrder == null || listOrder.size() == 0) {
|
| | | listOrder = new ArrayList<CommonOrderVO>();
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | // 商品信息
|
| | | List<CommonOrderVO> listGoods = commonOrderMapper.listOrderGoodsInfo(listOrder);
|
| | | // 订单商品为空
|
| | | if (listGoods == null || listGoods.size() == 0) {
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | // 数据加工重新组织
|
| | | listDataFactory(listOrder, listGoods, uid);
|
| | |
|
| | | return listOrder;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public JSONObject getRewardJumpInfo(String orderNo) {
|
| | |
| | | return commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteErrorCommonOrder(Long coId) {
|
| | | // 查询是否返利到账
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService.selectDetailByCommonOrderId(coId);
|
| | | if (hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU)
|
| | | return;
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Service.listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | boolean canDelete = true;
|
| | | for (HongBaoV2 child : hongBaoList)
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU) {
|
| | | canDelete = false;
|
| | | break;
|
| | | }
|
| | | // 不能删除
|
| | | if (!canDelete)
|
| | | return;
|
| | |
|
| | | // 删除child
|
| | | for (HongBaoV2 child : hongBaoList)
|
| | | hongBaoV2Service.deleteByPrimaryKey(child.getId());
|
| | | // 删除主红包
|
| | | hongBaoV2Service.deleteByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
|
| | | // 删除hongbaoOrder
|
| | | hongBaoOrderService.deleteByPrimaryKey(hongBaoOrder.getId());
|
| | | // 删除CommonOrder
|
| | | commonOrderMapper.deleteByPrimaryKey(hongBaoOrder.getCommonOrder().getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrder> listBySourceTypeAndTradeId(int sourceType, String tradeId) {
|
| | | return commonOrderMapper.listBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | }
|