Pu Zhibing
4 天以前 0cc73a9ffcdd356e0b797e458b400acfb660da94
UserQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushUtil.java
@@ -10,6 +10,7 @@
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -31,9 +32,9 @@
    @Autowired
    private RestTemplate internalRestTemplate;
    @Autowired
    private RedisUtil redisUtil;
    private RedisTemplate redisTemplate;
    @Autowired
    private IOrderTaxiService orderTaxiService;
@@ -154,9 +155,9 @@
        JSONObject data = new JSONObject();
        data.put("id", userId);
        data.put("type", 1);
        String str = redisUtil.getValue(orderId + "_" + orderType);
        String str = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType);
        if(ToolUtil.isEmpty(str)){
            redisUtil.setStrValue(orderId + "_" + orderType, data.toJSONString());
            redisTemplate.opsForValue().set(orderId + "_" + orderType, data.toJSONString());
            createTask(orderId, orderType);
        }
    }
@@ -244,7 +245,7 @@
        }
        //计算预计距离和剩余时间
        String value = redisUtil.getValue("DRIVER" + String.valueOf(driverId));
        String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(driverId));
        if(null == value || "".equals(value)){
            return;
        }
@@ -303,7 +304,7 @@
        // 以表单的方式提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        //将请求头部和参数合成一个请求
        String value1 = redisUtil.getValue(orderId + "_" + orderType);
        String value1 = (String) redisTemplate.opsForValue().get(orderId + "_" + orderType);
        if(ToolUtil.isEmpty(value1)){
            this.removeTask(orderId, orderType);
            return;
@@ -399,7 +400,7 @@
        if (null != timer){
            timer.cancel();
            taskMap.remove(orderId + "_" + orderType);
            redisUtil.remove(orderId + "_" + orderType);
            redisTemplate.delete(orderId + "_" + orderType);
        }
    }
}