From df7267e50d468304ea6e8a2475a26fe9777238d0 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 03 七月 2023 22:06:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java | 60 +++++++++++++++++++++++++++++++-----------------------------
1 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java
index 326a9cf..fe85d30 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/crossCity/server/impl/OrderCrossCityServiceImpl.java
@@ -23,6 +23,9 @@
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.system.util.GoogleMap.AddressComponentsVo;
+import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil;
+import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo;
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper;
import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper;
@@ -254,15 +257,15 @@
* @throws Exception
*/
@Override
- public ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception {
+ public ResultUtil payCrossCityOrder(Integer payType, Integer orderId, Integer couponId, Integer type, Integer language) throws Exception {
OrderCrossCity orderCrossCity = this.selectById(orderId);
if(orderCrossCity.getState() != 7){
- return ResultUtil.error("订单已完成支付,不允许重复支付", "");
+ return ResultUtil.error("订单已完成支付,不允许重复支付");
}
Integer uid = orderCrossCity.getUserId();
Double orderMoney = orderCrossCity.getOrderMoney();
UserInfo userInfo = userInfoService.selectById(uid);
- ResultUtil resultUtil = ResultUtil.success(new HashMap<>());
+ ResultUtil resultUtil = ResultUtil.success();
orderCrossCity.setCouponMoney(0D);//初始化历史数据
orderCrossCity.setCouponId(null);
@@ -271,19 +274,19 @@
if(null != couponId){
userCouponRecord = userCouponRecordService.selectById(couponId);
if(userCouponRecord.getCompanyId() != orderCrossCity.getCompanyId()){
- return ResultUtil.error("优惠券不能用于此订单", "");
+ return ResultUtil.error("优惠券不能用于此订单");
}
if(userCouponRecord.getState() == 2){
- return ResultUtil.error("优惠券已使用", "");
+ return ResultUtil.error("优惠券已使用");
}
if(userCouponRecord.getState() == 3){
- return ResultUtil.error("优惠券已过期", "");
+ return ResultUtil.error("优惠券已过期");
}
if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 3){
- return ResultUtil.error("优惠券不能用于此类型订单", "");
+ return ResultUtil.error("优惠券不能用于此类型订单");
}
if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
- return ResultUtil.error("优惠券不能用于此订单", "");
+ return ResultUtil.error("优惠券不能用于此订单");
}
orderMoney = orderMoney - userCouponRecord.getMoney();
orderCrossCity.setCouponMoney(userCouponRecord.getMoney());
@@ -316,7 +319,7 @@
paymentRecordService.saveData(1, null, null, orderId, 3, 1, orderMoney, null, 1);//添加预支付数据
resultUtil = resultUtil;
}else{
- resultUtil = ResultUtil.error("获取支付信息失败", "");
+ resultUtil = ResultUtil.error("获取支付信息失败");
}
}
if(payType == 2){//支付宝支付
@@ -325,12 +328,12 @@
paymentRecordService.saveData(1, null, null, orderId, 3, 2, orderMoney, null, 1);//添加预支付数据
resultUtil = resultUtil;
}else{
- resultUtil = ResultUtil.error("获取支付信息失败", "");
+ resultUtil = ResultUtil.error("获取支付信息失败");
}
}
if(payType == 3){//余额支付
if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
- return ResultUtil.error("余额不足,无法完成支付", "");
+ return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant");
}
userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -361,7 +364,7 @@
//添加已收入明细
Line line = lineService.selectById(orderCrossCity.getLineId());
Double speMoney = Double.valueOf(line.getRakeRate());
- BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入
+ BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));//企业收入
BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入
incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue());
incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue());
@@ -435,7 +438,7 @@
//添加已收入明细
Line line = lineService.selectById(orderCrossCity.getLineId());
Double speMoney = Double.valueOf(line.getRakeRate());
- BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);//企业收入
+ BigDecimal d = new BigDecimal(orderCrossCity.getOrderMoney()).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));//企业收入
BigDecimal c = new BigDecimal(orderCrossCity.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);//司机收入
incomeService.saveData(1, orderCrossCity.getCompanyId(), 2, orderCrossCity.getId(), 3, d.doubleValue());
incomeService.saveData(2, orderCrossCity.getDriverId(), 2, orderCrossCity.getId(), 3, c.doubleValue());
@@ -749,7 +752,7 @@
* @throws Exception
*/
@Override
- public ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type) throws Exception {
+ public ResultUtil cancleOrderCrossCity(Integer id, Integer payType, Integer cancleId, Integer type, Integer language) throws Exception {
OrderCrossCity orderCrossCity = this.selectById(id);
Integer uid = orderCrossCity.getUserId();
UserInfo userInfo = userInfoService.selectById(uid);
@@ -794,7 +797,7 @@
}
if(payType == 3){//余额支付
if(userInfo.getBalance() != null && userInfo.getBalance() < query.getMoney()){
- return ResultUtil.error("余额不足,无法完成支付", "");
+ return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient account balance" : "Solde de compte insuffisant");
}
userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(query.getMoney())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
@@ -1295,8 +1298,8 @@
if(null == distance){
System.err.println("查询距离出错了");
}else{
- d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString();
- t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + "";
+ d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString();
+ t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + "";
}
OrderServerWarpper orderServerWarpper = new OrderServerWarpper();
orderServerWarpper.setOrderId(orderCrossCity.getId());
@@ -1318,8 +1321,8 @@
if(null == distance){
System.err.println("查询距离出错了");
}else{
- d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).toString();
- t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60)).setScale(2, BigDecimal.ROUND_HALF_EVEN).intValue() + "";
+ d = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000), new MathContext(2, RoundingMode.HALF_EVEN)).toString();
+ t = new BigDecimal(distance.get("duration")).divide(new BigDecimal(60), new MathContext(2, RoundingMode.HALF_EVEN)).intValue() + "";
}
orderServerWarpper.setReservationMileage("0");
orderServerWarpper.setReservationTime("0");
@@ -1354,11 +1357,10 @@
if(ToolUtil.isEmpty(serverCarModelIds)){
return ResultUtil.error("请选择服务车型");
}
- Map<String, String> geocode = gdMapGeocodingUtil.geocode(startLon, startLat);
- boolean b = openCityService.openCity(geocode.get("districtCode"));
- if(!b){
- return ResultUtil.error("起点暂未开通");
- }
+// boolean b = openCityService.openCity(Double.valueOf(startLat), Double.valueOf(startLon));
+// if(!b){
+// return ResultUtil.error("起点暂未开通");
+// }
String[] split = serverCarModelIds.split(",");
List<Map<String, Integer>> list = new ArrayList<>();
@@ -1412,7 +1414,7 @@
//定义用户所属公司
OrderTaxi orderTaxi = new OrderTaxi();
UserInfo userInfo1 = userInfoService.selectById(uid);
- Company query = companyCityService.query(startLon, startLat);
+ Company query = companyCityService.query1(startLon, startLat);
if(null == query){
return ResultUtil.error("出发点暂未开通");
}
@@ -1466,7 +1468,7 @@
if(ToolUtil.isEmpty(userInfo.getPhone())){
return ResultUtil.error("请先绑定手机号码");
}
- orderTaxi.setPassengers(userInfo.getName());
+ orderTaxi.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName());
orderTaxi.setPassengersPhone(userInfo.getPhone());
}
orderTaxi.setState(1);//待接单
@@ -1538,7 +1540,7 @@
if(ToolUtil.isEmpty(userInfo.getPhone())){
return ResultUtil.error("请先绑定手机号码");
}
- orderPrivateCar.setPassengers(userInfo.getName());
+ orderPrivateCar.setPassengers(userInfo.getFirstName() + "." + userInfo.getLastName());
orderPrivateCar.setPassengersPhone(userInfo.getPhone());
}
orderPrivateCar.setState(1);
@@ -1582,7 +1584,7 @@
if(orderType == 1){//专车
OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId);
OrderPrivateCarServiceImpl.orderIds.add(orderPrivateCar.getId());//添加记录,防止调用接口重复提醒无人接单
- Company query = companyCityService.query(String.valueOf(orderPrivateCar.getStartLon()), String.valueOf(orderPrivateCar.getStartLat()));//获取起点所属分公司
+ Company query = companyCityService.query1(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++){
//订单被抢后的处理
@@ -1651,7 +1653,7 @@
if(orderType == 2){//出租车
OrderTaxi orderTaxi = orderTaxiMapper.selectById(orderId);
OrderTaxiServiceImpl.orderIds.add(orderTaxi.getId());//添加记录,防止调用接口重复提醒无人接单
- Company query = companyCityService.query(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司
+ Company query = companyCityService.query1(String.valueOf(orderTaxi.getStartLon()), String.valueOf(orderTaxi.getStartLat()));//获取起点所属分公司
List<PushOrder> querys = pushOrderService.querys(null, 2, query.getId());//获取需要推送的次数
for(int i = 1; i <= querys.size(); i++){
//处理订单被抢
--
Gitblit v1.7.1