| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aliyun.oss.ServiceException; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | 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.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import com.stylefeng.guns.modular.taxi.service.IPaymentRecordService; |
| | | import com.stylefeng.guns.modular.taxi.service.ITransactionDetailsService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | |
| | | @Autowired |
| | | private IUserCouponRecordService userCouponRecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserRedPacketRecordService userRedPacketRecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapElectricFenceUtil gdMapElectricFenceUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderPositionService orderPositionService; |
| | | |
| | |
| | | |
| | | /** |
| | | * 批量订单 |
| | | * |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil<BaseWarpper> saveOrderPrivateCars(String serverCarModel, Date travelTime, Integer reservation, Integer instead, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String endLon, String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer uid, Integer peopleNum) throws Exception { |
| | | public ResultUtil<BaseWarpper> saveOrderPrivateCars(String serverCarModel, Date travelTime, Integer reservation, Integer instead, String placementLon, String placementLat, String startLon, String startLat, String startAddress, String endLon, |
| | | String endLat, String endAddress, String name, String phone, Integer orderSource, Integer driverId, Integer uid, Integer peopleNum) throws Exception { |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | if (lock.tryLock()) { |
| | | try{ |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | if(travelTime.getTime() > (System.currentTimeMillis() + 600000)){ |
| | | reservation = 2; |
| | | } |
| | | |
| | | /** |
| | | * 1.出租车、专车、跨城有待支付的订单不能叫车 |
| | | try { |
| | | //如果出行时间大于当前10分钟则默认为预约单 |
| | | if (travelTime.getTime() > (System.currentTimeMillis() + 600000)) { |
| | | reservation = 2; |
| | | } |
| | | |
| | | /** |
| | | * 1.出租车、专车、跨城有待支付的订单不能叫车 |
| | | * 2.小件物流有未完成的订单可以下跨城、专车、出租车 |
| | | * 3.出租车、专车、跨城有预约单可以下即时单 |
| | | */ |
| | |
| | | paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, id, 1, 2, query.getMoney(), "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | if (userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()) { |
| | | return ResultUtil.error("余额不足,无法完成支付"); |
| | | } |
| | | resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); |
| | | if(resultUtil.getCode()==500){ |
| | | return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | } |
| | | // resultUtil= appOrderController.moneyPay(id,userInfo.getId(),query.getMoney()); |
| | | // if(resultUtil.getCode()==500){ |
| | | // return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | // } |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "快车取消订单", query.getMoney(), 2, 1, 1, 1, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | |
| | | //解除小号绑定 |
| | | if(orderPrivateCar.getBindId() != null){ |
| | | if (orderPrivateCar.getBindId() != null) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(), orderPrivateCar.getTelX(), (System.currentTimeMillis() + 600000)); |
| | | } |
| | | |
| | | |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCar.setTelX(""); |
| | | orderPrivateCar.setBindId(""); |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){ |
| | | map.put("redPacketMoney", null); |
| | | map.put("couponMoney", null); |
| | |
| | | } |
| | | Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司 |
| | | List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//获取需要推送的次数 |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | for(int i = 1; i <= querys.size()+5; i++){ |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(id); |
| | | if (null == orderPrivateCar || orderPrivateCar.getState() > 1) { |
| | | break; |
| | |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | return; |
| | | } |
| | | if (i == querys.size() && state == 1) { |
| | | if (i == querys.size()+5 && state == 1) { |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1); |
| | | orderIds.remove(orderPrivateCar.getId()); |
| | | } |
| | |
| | | endPushWarpper.setState(1); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, orderPrivateCar.getCompanyId());//获取需要推送的次数 |
| | | int time = 0; |
| | | for(int i = 1; i <= querys.size(); i++){ |
| | | for(int i = 1; i <= querys.size()+5; i++){ |
| | | PushOrder pushOrder = pushOrderService.querys(i, 2, orderPrivateCar.getCompanyId()).get(0); |
| | | time += pushOrder.getPushTime() * 1000; |
| | | } |
| | |
| | | resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_1_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); |
| | | paymentRecordService.saveData(3, uid, 1, orderId, 1, 2, money, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < money){ |
| | | if(payType == 3) {//余额支付 |
| | | if (userInfo.getBalance() == null || userInfo.getBalance() < money) { |
| | | return ResultUtil.error("余额不足,无法完成支付"); |
| | | } |
| | | resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); |
| | | if(resultUtil.getCode()==500){ |
| | | return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | } |
| | | // resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),money); |
| | | // if(resultUtil.getCode()==500){ |
| | | // return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | // } |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "快车订单-感谢费", money, 2, 1, 1, 1, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | |
| | | orderPrivateCar.setThankYouFee(money); |
| | | this.updateById(orderPrivateCar); |
| | | |
| | |
| | | public List<Map<String, Object>> queryOrderInfo2(Integer orderId, Integer state, String lon, String lat) { |
| | | return this.baseMapper.queryOrderInfo2(orderId,state,lon,lat); |
| | | } |
| | | |
| | | /** |
| | | * 获取专车未支付订单 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<UnPayOrderVO> getUnpayPrivateOrders(Integer uid) { |
| | | EntityWrapper<OrderPrivateCar> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("userId", uid); |
| | | wrapper.eq("state", 7); |
| | | //查出未支付订单 |
| | | List<OrderPrivateCar> orderPrivateCars = this.selectList(wrapper); |
| | | List<UnPayOrderVO> unPayOrderVOList = new ArrayList<>(); |
| | | for (OrderPrivateCar order : orderPrivateCars) { |
| | | UnPayOrderVO vo = new UnPayOrderVO(); |
| | | // 复制属性 |
| | | //添加司机信息 |
| | | DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper(); |
| | | Driver driver = driverService.selectById(order.getDriverId()); |
| | | BeanUtils.copyProperties(driver, driverInfoWarpper); |
| | | vo.setDriverInfoWarpper(driverInfoWarpper); |
| | | //其余信息 |
| | | BeanUtils.copyProperties(order, vo); |
| | | unPayOrderVOList.add(vo); |
| | | } |
| | | |
| | | return unPayOrderVOList; |
| | | } |
| | | |
| | | @Override |
| | | public void addAppeal(Integer uid, Integer orderId,String abnormalIntro, String abnormalImg) { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState()!=7 || orderPrivateCar.getAbnormalIntro()!=null){ |
| | | throw new RuntimeException("此订单无法申诉"); |
| | | } |
| | | orderPrivateCar.setAbnormalIntro(abnormalIntro); |
| | | orderPrivateCar.setAbnormalImg(abnormalImg); |
| | | orderPrivateCar.setAbnormal(1); |
| | | this.baseMapper.updateById(orderPrivateCar); |
| | | |
| | | } |
| | | } |