From dfb1f5ab2e8dc03cf2f497ce3327f6ce58700766 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 23 十月 2025 11:35:55 +0800
Subject: [PATCH] 修改bug
---
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 152 +++++++++++++++++++++++++++++++-------------------
1 files changed, 93 insertions(+), 59 deletions(-)
diff --git a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index 1400a46..e410adc 100644
--- a/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -18,16 +18,19 @@
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
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.BaseWarpper;
import com.stylefeng.guns.modular.system.warpper.CouponsListVo;
+import com.stylefeng.guns.modular.system.warpper.DriverInfoWarpper;
import com.stylefeng.guns.modular.system.warpper.PreferentialDataVo;
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.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;
@@ -91,28 +94,28 @@
@Autowired
private ICompanyService companyService;
-
+
@Autowired
private IIncomeService incomeService;
-
+
@Autowired
private IOrderCancelService orderCancelService;
-
+
@Autowired
private IOrderLogisticsSpreadService orderLogisticsSpreadService;
- @Autowired
- private RedisTemplate redisTemplate;
-
+ @Resource
+ private RedisTemplate<String, Object> redisTemplate;
+
@Resource
private RegionMapper regionMapper;
-
+
@Autowired
private GDMapElectricFenceUtil gdMapElectricFenceUtil;
-
+
@Autowired
private PayMoneyUtil payMoneyUtil;
-
+
@Resource
private OrderPrivateCarMapper orderPrivateCarMapper;
@@ -191,7 +194,7 @@
Double price1 = 0D;
Double price2 = 0D;
if(type == 4){//同城
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null);
if(null == query1){
return ResultUtil.error("请先完善价格设定");
}
@@ -200,7 +203,7 @@
price1 = jsonObject.getDouble("num2");
price2 = jsonObject.getDouble("num13");
}else{
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null);
if(null == query1){
return ResultUtil.error("请先完善价格设定");
}
@@ -395,7 +398,7 @@
// TODO: 2023/11/4 无法修改
Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLon + "," + startLat, location, 1);
double distance1 = new BigDecimal(distance.get("distance")).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null);
if(null != query1){
if(type == 4){
JSONObject jsonObject = JSON.parseObject(query1.get("content").toString());
@@ -493,7 +496,7 @@
Double price1 = 0D;
Double price2 = 0D;
if(type == 4){//同城
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null);
// TODO: 2023/11/4 已优化
if(null == dist){
Map<String, String> distance = gdMapElectricFenceUtil.getDistance(startLon + "," + startLat, endLon + "," + endLat, 1);
@@ -536,7 +539,7 @@
price2 = jsonObject.getDouble("num22");
}
}else{
- Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null);
+ Map<String, Object> query1 = systemPriceMapper.query(query.getId(), type, null, null);
String content = String.valueOf(query1.get("content"));
JSONObject jsonObject = JSON.parseObject(content);
price1 = jsonObject.getDouble("num1");
@@ -567,14 +570,15 @@
if(ToolUtil.isNotEmpty(vehicle)){
integers = JSON.parseArray(vehicle).toJavaList(Integer.class);
}
- Company query = companyCityService.query(String.valueOf(orderLogistics.getStartLon()), String.valueOf(orderLogistics.getStartLat()));//获取起点所属分公司
- List<PushOrder> querys = pushOrderService.querys(null, 1, query.getId());//用专车的推单配置
- for(int i = 1; i <= querys.size(); i++){
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ List<PushOrder> querys = pushOrderService.querys(null, 1, openCity.getId());//用专车的推单配置
+ for(int i = 1; i <= querys.size() + 15; i++){
// OrderLogistics orderLogistics = orderLogisticsMapper.selectById(id);
// if (null == orderLogistics || orderLogistics.getState() > 1) {
// break;
// }
- PushOrder pushOrder = pushOrderService.querys(i, 1, query.getId()).get(0);
+ int finalI = i;
+ PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null);
int i2 = pushOrder.getPushTime() / 10;
if(i2==0){
@@ -612,7 +616,7 @@
orderIds.remove(orderLogistics.getId());
return;
}
- if (i == querys.size() && state == 1) {
+ if (i == querys.size() + 15 && state == 1) {
orderIds.remove(orderLogistics.getId());
}
}
@@ -661,8 +665,9 @@
}
userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
-
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
//添加交易明细
@@ -774,24 +779,25 @@
paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 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(orderLogistics.getCompanyId());
+
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
-
+
//添加交易明细
transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流下单", orderMoney, 2, 1, 1, 4, orderId);
userInfoService.updateById(userInfo);
-
+
orderLogistics.setState(1);//小件物流先支付后司机抢单
orderLogistics.setPayType(3);
orderLogistics.setPayMoney(orderMoney);
@@ -863,24 +869,25 @@
resultUtil = payMoneyUtil.alipay("小件物流补差价", "小件物流补差价", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/aliPayOrderLogisticsSpread");
paymentRecordService.saveData(1, orderLogistics.getUserId(), 1, orderId, orderLogistics.getType(), 2, orderMoney, "", 1);//添加预支付数据
}
- if(payType == 3){//余额支付
- if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
+ if(payType == 3) {//余额支付
+ if (userInfo.getBalance() == null || userInfo.getBalance() < orderMoney) {
return ResultUtil.error("余额不足,无法完成支付");
}
- resultUtil= appOrderController.moneyPay(orderId,userInfo.getId(),orderMoney);
- if(resultUtil.getCode()==500){
- return ResultUtil.error("电子余额不足,无法完成支付");
- }
-
+// 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(orderLogistics.getCompanyId());
+
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
-
+
//添加交易明细
transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城" : "跨城") + "小件物流补差价", orderMoney, 2, 1, 1, 4, orderId);
userInfoService.updateById(userInfo);
-
+
orderLogistics.setState(12);//已支付差价
this.updateById(orderLogistics);
@@ -957,7 +964,8 @@
this.updateById(orderLogistics);
UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
userInfoService.updateById(userInfo);
@@ -1021,7 +1029,8 @@
orderLogisticsSpreadService.updateById(orderLogisticsSpread);
UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
userInfoService.updateById(userInfo);
@@ -1140,7 +1149,7 @@
return ResultUtil.error("取消订单失败,订单信息有误");
}
if(orderLogistics.getState() >= 5 && orderLogistics.getState() != 7 && orderLogistics.getState() != 8 && orderLogistics.getState() != 11){
- return ResultUtil.error("取消订单失败,不合法的操作");
+ return ResultUtil.error("订单已取消,请刷新页面");
}
if(orderLogistics.getState() == 7){
@@ -1614,24 +1623,25 @@
resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_" + orderLogistics.getType() + "_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee");
paymentRecordService.saveData(1, uid, 1, orderId, orderLogistics.getType(), 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(orderLogistics.getCompanyId());
+
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (money.intValue() * query1.getIntegral()));//积分
-
+
//添加交易明细
transactionDetailsService.saveData(uid, (orderLogistics.getType() == 4 ? "同城小件物流-" : "跨城小件物流-") + "感谢费", money, 2, 1, 1, orderLogistics.getType(), orderId);
userInfoService.updateById(userInfo);
-
+
orderLogistics.setThankYouFee(money);
this.updateById(orderLogistics);
@@ -1662,8 +1672,9 @@
query.setState(2);
query.setCode(order_id);
paymentRecordService.updateById(query);
-
- SysIntegral query1 = sysIntegralMapper.query(orderLogistics.getCompanyId());
+
+ OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
+ SysIntegral query1 = sysIntegralMapper.query(openCity.getId());
userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
//添加交易明细
@@ -1682,4 +1693,27 @@
driverService.updateById(driver);
systemNoticeService.addSystemNotice(1, "您已使用" + (payType == 1 ? "微信" : (payType==2?"支付宝":"云闪付")) + "成功完成感谢费支付,谢谢使用!", userInfo.getId(), 1);
}
+
+ @Override
+ public List<UnPayOrderVO> getUnpayLogisticsOrders(Integer uid) {
+ EntityWrapper<OrderLogistics> wrapper = new EntityWrapper<>();
+ wrapper.eq("userId", uid);
+ wrapper.eq("state", 7);
+ List<OrderLogistics> orderLogisticsList = this.selectList(wrapper);
+ List<UnPayOrderVO> unPayOrderVOList = new ArrayList<>();
+ for (OrderLogistics orderLogistics:orderLogisticsList) {
+
+ UnPayOrderVO unPayOrderVO = new UnPayOrderVO();
+ //添加司机信息
+ DriverInfoWarpper driverInfoWarpper = new DriverInfoWarpper();
+ Driver driver = driverService.selectById(orderLogistics.getDriverId());
+ BeanUtils.copyProperties(driver, driverInfoWarpper); unPayOrderVO.setDriverInfoWarpper(driverInfoWarpper);
+ //其余信息
+ BeanUtils.copyProperties(orderLogistics, unPayOrderVO);
+ unPayOrderVOList.add(unPayOrderVO);
+
+ }
+ return unPayOrderVOList;
+
+ }
}
--
Gitblit v1.7.1