| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | |
| | | if(null == query){ |
| | | return ResultUtil.error("获取企业失败"); |
| | | } |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(warpper.getStartLon() + "," + warpper.getStartLat(), |
| | | warpper.getEndLon() + "," + warpper.getEndLat(), 1); |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(warpper.getStartLat() + "," + warpper.getStartLon() , |
| | | warpper.getEndLat() + "," + warpper.getEndLon(), 1); |
| | | if(null == distance){ |
| | | return ResultUtil.error("计算行驶距离失败"); |
| | | } |
| | | double d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | double amount = setMoney2(query.getId(), d, t); |
| | | if(warpper.getPayManner() == 2){//其他支付,不需要操作,直接完成订单 |
| | | amount = amount + (new BigDecimal(Math.random()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | map.put("balance", userInfo.getBalance()); |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | int i = userCouponRecordService.queryAvailable(uid, null, 1, 2, orderTaxi.getOrderMoney()); |
| | | i = i + userCouponRecordService.queryAvailable(uid, null, 1, 0, orderTaxi.getOrderMoney()); |
| | | map.put("coupon", i); |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Integer companyId = driver.getCompanyId(); |
| | | List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId)); |
| | | List<Map<String, Object>> cityCode = new ArrayList<>(); |
| | | List<Region> regions = regionMapper.selectList(null); |
| | | for (CompanyCity companyCity : companyCityList) { |
| | | Map<String, Object> city = new HashMap<>(); |
| | | if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getAreaCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getAreaCode())).findFirst().get().getName()); |
| | | }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getCityCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getCityCode())).findFirst().get().getName()); |
| | | }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getProvinceCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getProvinceCode())).findFirst().get().getName()); |
| | | } |
| | | cityCode.add(city); |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), null, null); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), null, null); |
| | | list.addAll(list1); |
| | | map.put("coupon", list.size()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Integer companyId = driver.getCompanyId(); |
| | | List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId)); |
| | | List<Map<String, Integer>> cityCode = new ArrayList<>(); |
| | | List<Map<String, Object>> cityCode = new ArrayList<>(); |
| | | List<Region> regions = regionMapper.selectList(null); |
| | | for (CompanyCity companyCity : companyCityList) { |
| | | Map<String, Integer> city = new HashMap<>(); |
| | | Map<String, Object> city = new HashMap<>(); |
| | | if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getAreaCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getAreaCode())).findFirst().get().getName()); |
| | | }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getCityCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getCityCode())).findFirst().get().getName()); |
| | | }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){ |
| | | city.put("code", Integer.valueOf(companyCity.getProvinceCode())); |
| | | city.put("name", regions.stream().filter(s->s.getCode().equals(companyCity.getProvinceCode())).findFirst().get().getName()); |
| | | } |
| | | cityCode.add(city); |
| | | } |
| | | List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), pageNum, size); |
| | | List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), pageNum, size); |
| | |
| | | }else{ |
| | | appletsOpenId = userInfo.getAppletsOpenId(); |
| | | } |
| | | Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId); |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId); |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, "", 1);//添加预支付数据 |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushSystemMessage(2, orderTaxi.getDriverId(), "用户已线上完成支付"); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString()); |
| | | } |
| | | systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1); |
| | | //添加司机消息提醒 |
| | | systemNoticeService.addSystemNotice(2, "用户已线上完成支付", driver.getId(), 1); |
| | | } |
| | | |
| | | this.updateAllColumnById(orderTaxi); |
| | |
| | | OrderServerWarpper orderServerWarpper = new OrderServerWarpper(); |
| | | orderServerWarpper.setOrderId(orderTaxi.getId()); |
| | | orderServerWarpper.setOrderType(2); |
| | | orderServerWarpper.setPayManner(orderTaxi.getPayManner()); |
| | | orderServerWarpper.setState(orderTaxi.getState()); |
| | | orderServerWarpper.setLon(null != value ? value.split(",")[1] : "0.0"); |
| | | orderServerWarpper.setLat(null != value ? value.split(",")[0] : "0.0"); |
| | |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | pushUtil.pushSystemMessage(2, orderTaxi.getDriverId(), "用户已线上完成支付"); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成出行订单支付,谢谢使用!", orderTaxi.getUserId(), 1); |
| | | //添加司机消息提醒 |
| | | systemNoticeService.addSystemNotice(2, "用户已线上完成支付", driver.getId(), 1); |
| | | //推送状态,让司机端播报语音 |
| | | pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0); |
| | | }else{ |
| | | System.err.println("预支付数据异常(orderId = " + id + ")"); |
| | | } |