liujie
3 天以前 81f6d10bb745825437e0145c6d27bc3468ee281c
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -15,10 +15,7 @@
import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.RegionMapper;
import com.stylefeng.guns.modular.system.dao.SensitiveWordsMapper;
import com.stylefeng.guns.modular.system.dao.SysIntegralMapper;
import com.stylefeng.guns.modular.system.dao.UserActivityDiscount1Mapper;
import com.stylefeng.guns.modular.system.dao.*;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.model.vo.UnPayOrderVO;
import com.stylefeng.guns.modular.system.service.*;
@@ -149,9 +146,9 @@
   
   @Autowired
   private IDriverServiceService driverServiceService;
   @Autowired
   private GDFalconUtil gdFalconUtil;
   private TAbnormalPayOrderMapper abnormalPayOrderMapper;
   
   @Autowired
   private IOrderPrivateCarService orderPrivateCarService;
@@ -188,8 +185,10 @@
   
   @Value("${callbackPath}")
   private String callbackPath;
   @Autowired
   private TDriverPromotionActivityService driverPromotionActivityService;
   /**
    * 出租车下单操作
    *
@@ -1737,6 +1736,13 @@
      if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) {
         map.put("state", map.get("oldState"));
      }
      if(Integer.valueOf(String.valueOf(map.get("state"))) ==7 &&  (map.get("responsibilityType")==null || Integer.valueOf(String.valueOf(map.get("responsibilityType")))<4)){
         map.put("appealButton", 1);
      }
      if(map.get("abnormalIntro")!=null){
         map.put("appealStatus", 1);
      }
      String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId"));
      map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1);
      map.put("orderType", 2);
@@ -2287,4 +2293,68 @@
      
      return unPayOrderVOList;
   }
   @Override
   public void addAppeal(Integer uid, Integer orderId, String abnormalIntro, String abnormalImg) {
      OrderTaxi orderTaxi = this.selectById(orderId);
      if(orderTaxi.getState()!=7 || orderTaxi.getAbnormalIntro()!=null){
         throw new RuntimeException("此订单无法申诉");
      }
      orderTaxi.setAbnormalIntro(abnormalIntro);
      orderTaxi.setAbnormalImg(abnormalImg);
      orderTaxi.setAbnormal(2);
      this.baseMapper.updateById(orderTaxi);
   }
   @Override
   public void promotion(Integer orderId) {
      OrderTaxi orderTaxi = this.baseMapper.selectById(orderId);
      UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId());
      if(orderTaxi.getPromotionDriverId()!=null){
         String registAreaCode = userInfo.getRegistAreaCode();
         TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1"));
         if(tDriverPromotionActivity!=null){
            Double payMoney = orderTaxi.getPayMoney();
            BigDecimal bigDecimal = tDriverPromotionActivity.getCommissionRatio().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_UP);
            orderTaxi.setPromotionDriverId(userInfo.getBindDriverId());
            orderTaxi.setPromotionMoney(bigDecimal);
            orderTaxi.setPromotionActivityId(tDriverPromotionActivity.getId());
            this.baseMapper.updateById(orderTaxi);
         }
      }
      // 是否异常订单
      if (orderTaxi.getResponsibilityType() !=null && orderTaxi.getResponsibilityType() >2) {
         TAbnormalPayOrder tAbnormalPayOrder = abnormalPayOrderMapper.selectList(new EntityWrapper<TAbnormalPayOrder>().eq("type", 2).eq("orderNum", orderTaxi.getOrderNum())).stream().findFirst().orElse(null);
         if (tAbnormalPayOrder != null) {
            tAbnormalPayOrder.setPayStatus(2);
            tAbnormalPayOrder.setPayTime(new Date());
            abnormalPayOrderMapper.updateById(tAbnormalPayOrder);
         }
      }
   }
   @Override
   public List<Map<String, Object>> queryMyTripList(Integer uid, Integer pageNum, Integer size) throws Exception {
      pageNum = (pageNum - 1) * size;
      List<Map<String, Object>> maps = orderTaxiMapper.queryMyTripList(uid, pageNum, size);
      for (Map<String, Object> map : maps) {
         if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) {
            map.put("state", map.get("oldState"));
         }
      }
      return maps;
   }
   @Override
   public List<Map<String, Object>> queryMyTripListAll(Integer uid) throws Exception {
      List<Map<String, Object>> maps = orderTaxiMapper.queryMyTripListAll(uid);
      for (Map<String, Object> map : maps) {
         if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) {
            map.put("state", map.get("oldState"));
         }
      }
      return maps;
   }
}