Pu Zhibing
7 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
@@ -3,6 +3,7 @@
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;
@@ -107,6 +108,9 @@
    
    @Autowired
    private IOrderCancelService orderCancelService;
    @Autowired
    private RedisUtil redisUtil;
@@ -634,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();
@@ -1216,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:
@@ -1326,7 +1338,6 @@
                            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<>();
    
@@ -1806,14 +1817,21 @@
            new Timer().schedule(new TimerTask() {
                @Override
                public void run() {
                    Process process = null;
                    try {
                        process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/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);