From 6e0bccef16f74b5aa80eb51d7792a36ed7e20c38 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期六, 26 七月 2025 17:43:06 +0800 Subject: [PATCH] 开发车型列表及下单等模块相关逻辑 --- UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 72 ++++++++++++++++++++++++++--------- 1 files changed, 53 insertions(+), 19 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 41f1961..b916a87 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; @@ -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() + 5; 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() + 5 && 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()));//积分 //添加交易明细 @@ -785,7 +790,8 @@ // } 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()));//积分 //添加交易明细 @@ -874,7 +880,8 @@ 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()));//积分 //添加交易明细 @@ -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); @@ -1625,7 +1634,8 @@ 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()));//积分 //添加交易明细 @@ -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