| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | 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.crossCity.dao.LinePriceMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LineShiftDriverMapper; |
| | | import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.Line; |
| | | import com.stylefeng.guns.modular.crossCity.model.LineShiftDriver; |
| | | import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; |
| | | import com.stylefeng.guns.modular.crossCity.server.ILineService; |
| | | import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; |
| | | import com.stylefeng.guns.modular.crossCity.warpper.OrderCrossCityWarpper; |
| | | import com.stylefeng.guns.modular.smallLogistics.dao.OrderLogisticsMapper; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | 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.specialTrain.server.impl.OrderPrivateCarServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | 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.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.model.PaymentRecord; |
| | | import com.stylefeng.guns.modular.taxi.model.TransactionDetails; |
| | | 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; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.stylefeng.guns.modular.taxi.service.impl.OrderTaxiServiceImpl.orderIds; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | @Autowired |
| | | private DateUtil dateUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private ChinaMobileUtil chinaMobileUtil; |
| | | |
| | | |
| | | @Autowired |
| | | private GDFalconUtil gdFalconUtil; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private ICancleOrderService cancleOrderService; |
| | | |
| | | |
| | | @Autowired |
| | | private IOrderCancelService orderCancelService; |
| | | |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserActivityRedenvelopeService userActivityRedenvelopeService; |
| | | |
| | |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 2, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ |
| | | if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) { |
| | | return ResultUtil.error("余额不足,无法完成支付"); |
| | | } |
| | | if(orderMoney > 0){ |
| | | resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); |
| | | if(resultUtil.getCode()==500){ |
| | | return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // if(orderMoney > 0){ |
| | | // resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney); |
| | | // if(resultUtil.getCode()==500){ |
| | | // return ResultUtil.error("电子余额不足,无法完成支付"); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | |
| | | |
| | | SysIntegral query1 = sysIntegralMapper.query(orderCrossCity.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "跨城出行订单", orderMoney, 2, 1, 1, 3, orderId); |
| | | userInfoService.updateById(userInfo); |
| | |
| | | map.put("startCity", geocode.get("city")); |
| | | geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString()); |
| | | map.put("endCity", geocode.get("city")); |
| | | |
| | | String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); |
| | | |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 3); |
| | | return map; |
| | |
| | | CancleOrder query = cancleOrderService.query(1, 3, orderCrossCity.getCompanyId()); |
| | | if(null != query){ |
| | | if(payType == 1){//微信支付 |
| | | String value = redisUtil.getValue("appletOpenId"); |
| | | String value = (String) redisTemplate.opsForValue().get("appletOpenId"); |
| | | String appletsOpenId = null; |
| | | if(ToolUtil.isNotEmpty(value)){ |
| | | JSONObject jsonObject = JSON.parseObject(value); |
| | |
| | | // resultUtil = ResultUtil.error(map.get("msg"), ""); |
| | | // } |
| | | } |
| | | if(payType == 3){//余额支付 |
| | | if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){ |
| | | if(payType == 3) {//余额支付 |
| | | 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, 3, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | |
| | | //解除小号绑定 |
| | | if(orderCrossCity.getBindId() != null){ |
| | | if (orderCrossCity.getBindId() != null) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderCrossCity.getBindId(), orderCrossCity.getTelX(), (System.currentTimeMillis() + 600000)); |
| | | } |
| | | |
| | |
| | | public OrderServerWarpper queryOrderServer(Integer orderId, Integer uid) throws Exception { |
| | | OrderCrossCity orderCrossCity = this.selectById(orderId); |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(orderCrossCity.getDriverId())); |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderCrossCity.getDriverId())); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | |
| | | @Override |
| | | public void run() { |
| | | List<Map<String, Integer>> datas = list; |
| | | String vehicle = redisUtil.getValue("VEHICLE"); |
| | | String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | if(ToolUtil.isNotEmpty(vehicle)){ |
| | | integers = JSON.parseArray(vehicle).toJavaList(Integer.class); |
| | |
| | | resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); |
| | | paymentRecordService.saveData(1, uid, 1, orderId, 3, 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(orderCrossCity.getCompanyId()); |
| | | userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分 |
| | | |
| | | |
| | | //添加交易明细 |
| | | transactionDetailsService.saveData(uid, "跨城出行-感谢费", money, 2, 1, 1, 3, orderId); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | |
| | | orderCrossCity.setThankYouFee(money); |
| | | this.updateById(orderCrossCity); |
| | | |