From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 28 三月 2025 19:57:56 +0800 Subject: [PATCH] 修改bug --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 81 +++++++++++++++++++++++++++++++++++----- 1 files changed, 70 insertions(+), 11 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index ace0daa..fb2cd10 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -2,6 +2,8 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.mchange.util.FailSuppressedMessageLogger; +import com.stylefeng.guns.core.util.MD5Util; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; @@ -22,6 +24,8 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -30,7 +34,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.*; @@ -42,6 +49,8 @@ @RestController @RequestMapping("") public class DriverController { + + private Logger log = LoggerFactory.getLogger(DriverController.class); @Autowired private IDriverService driverService; @@ -96,6 +105,12 @@ @Autowired private FleetEngineUtil fleetEngineUtil; + + @Autowired + private IOrderCancelService orderCancelService; + + @Autowired + private RedisUtil redisUtil; @@ -623,6 +638,13 @@ if(null == uid){ return ResultUtil.tokenErr(); } + String format = String.format("uid=%s&type=%s", uid, type); + String key = MD5Util.encrypt(format); + String value = redisUtil.getValue(key); + if(ToolUtil.isNotEmpty(value) && (System.currentTimeMillis() - Long.valueOf(value)) <= 1000){ + return ResultUtil.error(language == 1 ? "请勿重复操作" : language == 2 ? "Don't repeat the operation" : "Ne répétez pas l’opération"); + } + redisUtil.setStrValue(key, System.currentTimeMillis() + "", 5); return driverService.work(uid, type, language); }catch (Exception e){ e.printStackTrace(); @@ -1205,6 +1227,7 @@ BaseWarpper baseWarpper = new BaseWarpper(); baseWarpper.setDay(String.valueOf(null != map.get("time") ? map.get("time") : "")); baseWarpper.setAmount(Double.valueOf(String.valueOf(null != map.get("money") ? map.get("money") : 0))); + baseWarpper.setType(Integer.valueOf(type)); if("2".equals(type)){ switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ case 1: @@ -1275,6 +1298,7 @@ continue; } List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4); + map1.put("travelMoney", orderLogistics != null ? orderLogistics.getOrderMoney() : 0);//行程费 map1.put("parkMoney", orderLogistics != null ? orderLogistics.getParkMoney() : 0);//停车费 map1.put("tipMoney", 0);//小费 map1.put("roadTollMoney", orderLogistics != null ? orderLogistics.getRoadTollMoney() : 0);//过路费 @@ -1287,9 +1311,9 @@ } List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5); map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getOrderMoney() : 0);//行程费 - map1.put("parkMoney", 0);//停车费 + map1.put("parkMoney", orderLogistics1 != null ? orderLogistics1.getParkMoney() : 0);//停车费 map1.put("tipMoney", 0);//小费 - map1.put("roadTollMoney", 0);//过路费 + map1.put("roadTollMoney", orderLogistics1 != null ? orderLogistics1.getRoadTollMoney() : 0);//过路费 map1.put("rakeMoney", incomes4.size() > 0 ? incomes4.get(0).getMoney() : 0);//抽成 break; } @@ -1314,9 +1338,12 @@ baseWarpper.setName(language == 1 ? "跨城小件物流" : language == 2 ? "Cross-city small parts logistics" : "Logistique des petites pièces à travers la ville"); break; } - baseWarpper.setName(language == 1 ? "取消订单费用" : language == 2 ? "Cancellation fee" : "Frais d'annulation"); List<Income> incomes = incomeService.queryData(1, 1, 3, Integer.valueOf(map.get("incomeId").toString()), Integer.valueOf(map.get("orderType").toString())); Map<String, Object> map1 = new HashMap<>(); + + OrderCancel orderCancel = orderCancelService.selectOne(new EntityWrapper<OrderCancel>().eq("orderType", map.get("orderType")) + .eq("orderId", map.get("incomeId")).eq("state", 2)); + map1.put("travelMoney", orderCancel.getMoney());//支付金额 map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成 baseWarpper.setData(map1); } @@ -1471,7 +1498,7 @@ return ResultUtil.tokenErr(); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - List<ActivityWarpper> activityWarppers = driverService.queryMyActivity(uid, sdf.parse(time), language); + List<ActivityWarpper> activityWarppers = driverService.queryHistoryList(uid, sdf.parse(time), language); return ResultUtil.success(activityWarppers); }catch (Exception e){ e.printStackTrace(); @@ -1790,14 +1817,21 @@ new Timer().schedule(new TimerTask() { @Override public void run() { - Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName + ".mp3"); - } catch (IOException e) { - throw new RuntimeException(e); - } - if (process != null) { - process.destroy(); + // 使用Runtime执行命令 + Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName + ".mp3"); + // 读取命令的输出 + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + System.out.println(line); + } + // 等待命令执行完成 + process.waitFor(); + // 关闭流 + reader.close(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); } } }, 30000); @@ -1821,4 +1855,29 @@ throw new RuntimeException(e); } } + + + + /** + * 短信回调通知 + * @param request + */ + @ResponseBody + @PostMapping("/base/sendCellulantMessageCallback") + public void sendCellulantMessageCallback(HttpServletRequest request){ + try { + StringBuilder sb = new StringBuilder(); + InputStream inputStream = request.getInputStream(); + String s; + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + while ((s = in.readLine()) != null) { + sb.append(s); + } + in.close(); + inputStream.close(); + log.info("短信通知回调:" + sb.toString()); + }catch (Exception e){ + e.printStackTrace(); + } + } } -- Gitblit v1.7.1