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 | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 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 197f3fe..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 @@ -194,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("请先完善价格设定"); } @@ -203,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("请先完善价格设定"); } @@ -398,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()); @@ -496,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); @@ -539,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"); @@ -570,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){ @@ -615,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()); } } @@ -664,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()));//积分 //添加交易明细 @@ -788,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()));//积分 //添加交易明细 @@ -877,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()));//积分 //添加交易明细 @@ -960,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); @@ -1024,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); @@ -1628,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()));//积分 //添加交易明细 @@ -1665,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()));//积分 //添加交易明细 -- Gitblit v1.7.1