| | |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
|
| | | 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.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | 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.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countByUidAndOrderState(Long uid, Integer type, String startTime, String endTime,
|
| | | Integer day, Integer source) {
|
| | | return commonOrderMapper.countByUidAndOrderState(uid, type, startTime, endTime, day, source);
|
| | | public Long countUserOrderToApp(Long uid, Integer type, String startTime, String endTime,
|
| | | Integer day, Integer source, Integer state, Integer stateOrder) {
|
| | | return commonOrderMapper.countUserOrderToApp(uid, type, startTime, endTime, day, source, state, stateOrder);
|
| | | }
|
| | |
|
| | | private BigDecimal getWeiQuanMoney(List<TaoBaoWeiQuanOrder> listWQ, int sourceType, Long uid) {
|
| | |
| | | // 1.6.5 是否存在新兑换的券
|
| | | if (!hasRewardCoupon && exchangeCoupon) {
|
| | | try {
|
| | | String downTime = order.getDownTime();
|
| | | if (!StringUtil.isNullOrEmpty(downTime)) {
|
| | | long downOrderTime = TimeUtil.convertDateToTemp2(downTime);
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | long downOrderTime = thirdCreateTime.getTime();
|
| | | long limitDate = TimeUtil.convertDateToTemp("2019-09-05");
|
| | | if (downOrderTime > limitDate)
|
| | | hasRewardCoupon = true;
|
| | |
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | jumpLink.put("goodsType", order.getSourceType());
|
| | | jumpLink.put("goodsType", order.getSourceType()+"");
|
| | | }
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | |
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | if (VersionUtil.greaterThan_1_6_0(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | jumpLink.put("goodsType", order.getSourceType());
|
| | | jumpLink.put("goodsType", order.getSourceType()+"");
|
| | | }
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | public List<CommonOrderAddResultDTO> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid)
|
| | | throws CommonOrderException {
|
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
|
| | | // 判断所有的订单状态
|
| | | int invalidCount = 0;
|
| | | for (TaoBaoOrder tb : taoBaoOrders) {
|
| | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public List<CommonOrder> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | public List<CommonOrderAddResultDTO> addPDDOrder(List<PDDOrder> pddOrderList, Long uid)
|
| | | throws CommonOrderException {
|
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
|
| | | // 判断所有的订单状态
|
| | | int invalidCount = 0;
|
| | | for (PDDOrder order : pddOrderList) {
|
| | |
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | public List<CommonOrderAddResultDTO> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
|
| | | List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
|
| | | // 判断所有的订单状态
|
| | | int invalidCount = 0;
|
| | | for (JDOrderItem tb : jdOrder.getOrderItemList()) {
|
| | |
| | | * @param commonOrder
|
| | | */
|
| | | @Transactional
|
| | | private CommonOrder addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
|
| | | private CommonOrderAddResultDTO addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
|
| | | // 判断商品是否存在
|
| | | if (commonOrder == null)
|
| | | throw new CommonOrderException(1, "订单为空");
|
| | |
| | | // 插入映射,保证交易ID的完整性
|
| | | commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
|
| | | commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
|
| | | return commonOrder;
|
| | | return new CommonOrderAddResultDTO(commonOrder, CommonOrderAddResultDTO.TYPE_ADD);
|
| | | } else {// 修改
|
| | | // 已经结算,已经失效,状态未改变的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX
|
| | | || oldCommonOrder.getState() == CommonOrder.STATE_WQ
|
| | | || (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
|
| | | return oldCommonOrder;
|
| | | return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
|
| | | }
|
| | | // 交易ID一致才修改
|
| | | if (commonOrder.getTradeId() != null
|
| | |
| | | updateCommonOrder.setUpdateTime(new Date());
|
| | | updateCommonOrder.setTradeId(commonOrder.getTradeId());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
|
| | | return commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId());
|
| | | return new CommonOrderAddResultDTO(commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId()),
|
| | | CommonOrderAddResultDTO.TYPE_UPDATE);
|
| | | } else
|
| | | return oldCommonOrder;
|
| | | return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public JSONObject getRewardJumpInfo(String orderNo) {
|
| | | public JSONObject getRewardJumpInfo(String orderNo, Integer goodsType) {
|
| | |
|
| | | JSONObject map = new JSONObject();
|
| | | // 订单标识
|
| | |
| | |
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", orderNo);
|
| | | jumpLink.put("goodsType", goodsType == null? goodsType: goodsType +"");
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", 1);
|
| | |
| | | return commonOrderMapper.getByOrderNo(uid, orderNO);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrder selectLatestValidByUid(Long uid) {
|
| | | List<Integer> stateList = new ArrayList<>();
|
| | | stateList.add(CommonOrder.STATE_FK);
|
| | | stateList.add(CommonOrder.STATE_JS);
|
| | | List<CommonOrder> commonOrderList = commonOrderMapper.listByUid(uid, stateList, 0, 1);
|
| | | if (commonOrderList == null || commonOrderList.size() == 0)
|
| | | return null;
|
| | | return commonOrderList.get(0);
|
| | | }
|
| | |
|
| | | }
|