|
|
@@ -6,10 +6,7 @@ import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.tmzn.devicelinkykc.constant.ykc.StatusConstant;
|
|
|
-import com.tmzn.devicelinkykc.entity.BillingModel;
|
|
|
-import com.tmzn.devicelinkykc.entity.Device;
|
|
|
-import com.tmzn.devicelinkykc.entity.DeviceStatus;
|
|
|
-import com.tmzn.devicelinkykc.entity.OrderStatus;
|
|
|
+import com.tmzn.devicelinkykc.entity.*;
|
|
|
import com.tmzn.devicelinkykc.entity.param.AjaxResult;
|
|
|
import com.tmzn.devicelinkykc.entity.param.dto.BillingModelDTO;
|
|
|
import com.tmzn.devicelinkykc.frameMsg.DataConversion;
|
|
|
@@ -22,10 +19,7 @@ import com.tmzn.devicelinkykc.mapstruct.BillingModelMapping;
|
|
|
import com.tmzn.devicelinkykc.message.DeviceMsgHandle;
|
|
|
import com.tmzn.devicelinkykc.msgEnum.DeviceSendYkc;
|
|
|
import com.tmzn.devicelinkykc.redis.RedisCache;
|
|
|
-import com.tmzn.devicelinkykc.service.BillingModelService;
|
|
|
-import com.tmzn.devicelinkykc.service.DeviceControlerService;
|
|
|
-import com.tmzn.devicelinkykc.service.DeviceStatusService;
|
|
|
-import com.tmzn.devicelinkykc.service.OrderStatusService;
|
|
|
+import com.tmzn.devicelinkykc.service.*;
|
|
|
import com.tmzn.devicelinkykc.socket.DeviceConnectionMsg;
|
|
|
import com.tmzn.devicelinkykc.socket.SocketHandle;
|
|
|
import com.tmzn.devicelinkykc.transdata.entity.DeviceParam;
|
|
|
@@ -49,6 +43,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.net.Socket;
|
|
|
+import java.time.Instant;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -74,6 +69,9 @@ public class TestController {
|
|
|
@Value("${billingInterface}")
|
|
|
private String url;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ShoppingGoodsService shoppingGoodsService ;
|
|
|
+
|
|
|
@Autowired
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
@@ -97,11 +95,28 @@ public class TestController {
|
|
|
@PostMapping("/msg")
|
|
|
public String testMsg() {
|
|
|
try {
|
|
|
-
|
|
|
+ boolean temp = false;
|
|
|
+ int result = 0x00; //失败
|
|
|
+ int reason = 0x00; //无
|
|
|
+
|
|
|
+ //检查流量费是否过期
|
|
|
+ QueryWrapper<ShoppingGoods> goodsQueryWrapper = new QueryWrapper<>();
|
|
|
+
|
|
|
+ goodsQueryWrapper.eq("sn", "GD1B406633");
|
|
|
+ goodsQueryWrapper.last("limit 1");
|
|
|
+ ShoppingGoods shoppingGoods = shoppingGoodsService.getOne(goodsQueryWrapper);
|
|
|
+ //检查流量费是否过期
|
|
|
+ long currentTime = Instant.now().getEpochSecond();
|
|
|
+ if(shoppingGoods!=null && shoppingGoods.getDuetime()<currentTime){
|
|
|
+ temp = true;
|
|
|
+ reason=0x00;
|
|
|
+ System.out.println("流量费已过期");
|
|
|
+ }else{
|
|
|
+ System.out.println("ok");
|
|
|
+ }
|
|
|
//集测
|
|
|
- try {
|
|
|
|
|
|
- socketHandle.addDeviceConnection("119.36.5.9", 30561,"1111", "222","333", "1.6",1);
|
|
|
+ // socketHandle.addDeviceConnection("119.36.5.9", 30561,"1111", "222","333", "1.6",1);
|
|
|
|
|
|
|
|
|
// Socket socket = new Socket();
|
|
|
@@ -109,29 +124,25 @@ public class TestController {
|
|
|
// socket.setKeepAlive(true);
|
|
|
|
|
|
// DeviceConnectionMsg deviceConnectionMsg = new DeviceConnectionMsg(socket, deviceId,imei,deviceSn,ver,isDc);
|
|
|
- //每个设备连接后开启监听接收消息
|
|
|
- System.out.println("成功");
|
|
|
- // ykcMsgHandle.startListening(deviceConnectionMsg);
|
|
|
- //并将连接信息等保存再Map中
|
|
|
- // deviceConnectionMsgMap.put(deviceId, deviceConnectionMsg);
|
|
|
- } catch (IOException e) {
|
|
|
- // 连接失败,捕获IOException异常
|
|
|
- log.info("{}-{}-{}连接失败: " + e.getMessage());
|
|
|
- }
|
|
|
+ //每个设备连接后开启监听接收消息
|
|
|
+ System.out.println("成功");
|
|
|
+ // ykcMsgHandle.startListening(deviceConnectionMsg);
|
|
|
+ //并将连接信息等保存再Map中
|
|
|
+ // deviceConnectionMsgMap.put(deviceId, deviceConnectionMsg);
|
|
|
|
|
|
System.out.println(1111);
|
|
|
|
|
|
// realTimeStatusPushFrame.upStatusDevice(null,);
|
|
|
|
|
|
- String pileCode = "51220002000016";
|
|
|
- QueryWrapper<BillingModel> billWapper = new QueryWrapper<>();
|
|
|
- billWapper.eq("pile_code", pileCode);
|
|
|
- BillingModel b = billingModelService.getOne(billWapper);
|
|
|
+// String pileCode = "51220002000016";
|
|
|
+// QueryWrapper<BillingModel> billWapper = new QueryWrapper<>();
|
|
|
+// billWapper.eq("pile_code", pileCode);
|
|
|
+// BillingModel b = billingModelService.getOne(billWapper);
|
|
|
|
|
|
|
|
|
- //查找所有充电中的订单
|
|
|
- QueryWrapper<OrderStatus> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("id", 57303); //充电中状态上报
|
|
|
+// //查找所有充电中的订单
|
|
|
+// QueryWrapper<OrderStatus> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("id", 57303); //充电中状态上报
|
|
|
|
|
|
|
|
|
|