Pu Zhibing
6 天以前 2c5957854caea8b0fc0f7c957a946979e2e5554a
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -1269,7 +1269,7 @@
         return ResultUtil.error("订单不在待支付状态,不允许支付", "");
      }
      Integer uid = orderTaxi.getUserId();
      Double orderMoney = orderTaxi.getOrderMoney();
      Double orderMoney = (2 == orderTaxi.getAbnormal() && 2 == orderTaxi.getAbnormalStatus() ? orderTaxi.getResponsibilityMoney().doubleValue() : orderTaxi.getOrderMoney());
      UserInfo userInfo = userInfoService.selectById(uid);
      ResultUtil resultUtil = ResultUtil.success(new Object());
      orderTaxi.setCouponMoney(0D);//初始化历史数据
@@ -1403,7 +1403,7 @@
         return ResultUtil.error("订单不在待支付状态,不允许支付", "");
      }
      Integer uid = orderTaxi.getUserId();
      Double orderMoney = (1 == orderTaxi.getAbnormal() ? orderTaxi.getOrderMoney() : orderTaxi.getResponsibilityMoney().doubleValue());
      Double orderMoney = (2 == orderTaxi.getAbnormal() && 2 == orderTaxi.getAbnormalStatus() ? orderTaxi.getResponsibilityMoney().doubleValue() : orderTaxi.getOrderMoney());
      UserInfo userInfo = userInfoService.selectById(uid);
      ResultUtil resultUtil = ResultUtil.success(new Object());
      orderTaxi.setCouponMoney(0D);//初始化历史数据
@@ -1608,9 +1608,9 @@
            tradeOrderCreateData.setTreatShopId(driver.getEmpId().toString());
            //追缴单不要分账
            if(0 == orderTaxi.getRecoveryOrder()){
               tradeOrderCreateData.setField1("{\"profitSharing\":\"1\",\"isPromote\":\"" + (orderTaxi.getPromotion() == 2 ? 1 : 0) + "\"}");
               tradeOrderCreateData.setField1("{\"profitSharing\":\"1\",\"isCompensate\":\"0\",\"isPromote\":\"" + (orderTaxi.getPromotion() == 2 ? 1 : 0) + "\"}");
            }else{
               tradeOrderCreateData.setField1("{\"profitSharing\":\"0\",\"isPromote\":\"0\"}");
               tradeOrderCreateData.setField1("{\"profitSharing\":\"0\",\"isCompensate\":\"1\",\"isPromote\":\"0\"}");
            }
            tradeOrderCreateData.setCharge(new BigDecimal(orderMoney));
            tradeOrderCreateData.setOrderId(orderTaxi.getTravelId());
@@ -1716,11 +1716,21 @@
            query.setEndTime(new Date());
            userRedPacketRecordService.updateById(query);
         }
         //添加收入
         Map<String, Object> map = incomeService.saveIncome(orderTaxi.getId(), 2, orderTaxi.getOrderMoney());
         orderTaxi.setSplitAllocation(JSON.toJSONString(map));
         //非追缴单才添加收入记录
         if(0 == orderTaxi.getRecoveryOrder()){
            //添加收入
            Double orderMoney1 = (2 == orderTaxi.getAbnormal() && 2 == orderTaxi.getAbnormalStatus() ? orderTaxi.getResponsibilityMoney().doubleValue() : orderTaxi.getOrderMoney());
            Map<String, Object> map = incomeService.saveIncome(orderTaxi.getId(), 2, orderTaxi.getOrderMoney());
            orderTaxi.setSplitAllocation(JSON.toJSONString(map));
         }
         //待审核的异常单修改状态为已关闭
         if(2 == orderTaxi.getAbnormal() && 1 == orderTaxi.getAbnormalStatus()){
            orderTaxi.setAbnormalStatus(3);
            orderTaxi.setResponsibilityMoney(new BigDecimal(orderTaxi.getOrderMoney()));
            orderTaxi.setResponsibilityType(3);
            orderTaxi.setAbnormalRemark("乘客已支付订单,申诉已自动关闭");
         }
         this.updateAllColumnById(orderTaxi);
         promotion(orderTaxi.getId());
         
@@ -1892,10 +1902,8 @@
      if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) {
         map.put("state", map.get("oldState"));
      }
      if (map.get("abnormalIntro") != null) {
         map.put("appealStatus", 1);
      }
      //出租车不需要申诉
      map.put("appealStatus", 0);
      String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId"));
      map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1);
      map.put("orderType", 2);
@@ -2146,8 +2154,10 @@
         UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId());
         OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString());
         SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
         userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
         userInfoService.updateById(userInfo);
         if(null != query1){
            userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
            userInfoService.updateById(userInfo);
         }
         
         //处理优惠券和红包
         if (null != orderTaxi.getCouponId()) {
@@ -2177,9 +2187,22 @@
         query.setCode(order_id);
         paymentRecordService.updateById(query);
         
         //添加收入
         Map<String, Object> map = incomeService.saveIncome(orderTaxi.getId(), 2, orderTaxi.getOrderMoney());
         orderTaxi.setSplitAllocation(JSON.toJSONString(map));
         //非追缴单才添加收入记录
         if(0 == orderTaxi.getRecoveryOrder()){
            //添加收入
            Double orderMoney1 = (2 == orderTaxi.getAbnormal() && 2 == orderTaxi.getAbnormalStatus() ? orderTaxi.getResponsibilityMoney().doubleValue() : orderTaxi.getOrderMoney());
            Map<String, Object> map = incomeService.saveIncome(orderTaxi.getId(), 2, orderMoney1);
            orderTaxi.setSplitAllocation(JSON.toJSONString(map));
         }
         //待审核的异常单修改状态为已关闭
         if(2 == orderTaxi.getAbnormal() && 1 == orderTaxi.getAbnormalStatus()){
            orderTaxi.setAbnormalStatus(3);
            orderTaxi.setResponsibilityMoney(new BigDecimal(orderTaxi.getOrderMoney()));
            orderTaxi.setResponsibilityType(3);
            orderTaxi.setAbnormalRemark("乘客已支付订单,申诉已自动关闭");
         }
         this.updateById(orderTaxi);
         
         // TODO: 2020/5/24 这里需要给司机和用户推送订单状态