|
|
@@ -4,12 +4,17 @@ import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.tmzn.devicelinkykc.constant.RedisConstant;
|
|
|
import com.tmzn.devicelinkykc.entity.BillingModel;
|
|
|
import com.tmzn.devicelinkykc.entity.param.dto.BillingModelDTO;
|
|
|
import com.tmzn.devicelinkykc.mapstruct.BillingModelMapping;
|
|
|
+import com.tmzn.devicelinkykc.message.DeviceMsgHandle;
|
|
|
+import com.tmzn.devicelinkykc.redis.RedisCache;
|
|
|
import com.tmzn.devicelinkykc.service.BillingModelService;
|
|
|
import com.tmzn.devicelinkykc.service.DeviceControlerService;
|
|
|
import com.tmzn.devicelinkykc.transdata.entity.DeviceParam;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@@ -18,6 +23,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.ScheduledExecutorService;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* @author xp
|
|
|
@@ -36,6 +44,9 @@ public class TestController {
|
|
|
@Value("${billingInterface}")
|
|
|
private String url;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
+
|
|
|
@GetMapping("/test")
|
|
|
public String test(@RequestParam("method") String method, @RequestParam("imei") String imei) {
|
|
|
|
|
|
@@ -59,6 +70,52 @@ public class TestController {
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(DeviceMsgHandle.class);
|
|
|
+
|
|
|
+ @GetMapping("/test2")
|
|
|
+ public String test2(@RequestParam("pileCode") String pileCode) {
|
|
|
+ //调用重启
|
|
|
+
|
|
|
+ // redisCache.setCacheMapValue(RedisConstant.PILE_GUN_PAY_TIME, pileCode+"_"+1,System.currentTimeMillis());
|
|
|
+
|
|
|
+// return "ok";
|
|
|
+// //标记最后订单时间 5分钟内不上报空闲状态 避免刚下单状态还没更新就被freeTask任务给顶掉了
|
|
|
+
|
|
|
+
|
|
|
+ new Thread(() -> {
|
|
|
+ try {
|
|
|
+ Thread.sleep(5000); // 延迟 5 秒
|
|
|
+ DeviceParam dataParam = new DeviceParam();
|
|
|
+ dataParam.setDeviceId("123456");
|
|
|
+ dataParam.setCcid("123456");
|
|
|
+// deviceControlerService.sendPortDetailCmd(dataParam);
|
|
|
+ logger.info(":主动下发103消息");
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info(":主动下发103消息异常" + e.getMessage());
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// try{
|
|
|
+// long ts = redisCache.getCacheMapValue(RedisConstant.PILE_GUN_PAY_TIME, pileCode+"_1");
|
|
|
+// if(ts!=0){
|
|
|
+// long ts1 = System.currentTimeMillis();
|
|
|
+// if((ts1-ts)<300*1000){
|
|
|
+// return "ok";
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }catch (Exception e){
|
|
|
+// return "error";
|
|
|
+// }
|
|
|
+
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@GetMapping("/test1")
|
|
|
public String test1(@RequestParam("pileCode") String pileCode) {
|