...
|
...
|
@@ -2,6 +2,7 @@ package com.yoho.rfid.controller; |
|
|
|
|
|
import JW.UHF.JWReader;
|
|
|
import com.yoho.rfid.model.RfidClient;
|
|
|
import com.yoho.rfid.model.SkuInfo;
|
|
|
import com.yoho.rfid.model.SkuResult;
|
|
|
import com.yoho.rfid.service.RfidConfig;
|
|
|
import com.yoho.rfid.service.RfidInit;
|
...
|
...
|
@@ -47,25 +48,20 @@ public class RfidController { |
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message("query leave sku").data(null).build();
|
|
|
}
|
|
|
long currentTime = System.currentTimeMillis();
|
|
|
// List<String> skuList = new ArrayList<String>();
|
|
|
// for(Map.Entry<String, Long> entry : skuMap.entrySet()){
|
|
|
// // sku离开时间 >1.5s <30min
|
|
|
// if(System.currentTimeMillis()-entry.getValue() < SocketConstant.SKU_NOTBELONG_TIMEOUT){
|
|
|
// skuList.add(entry.getKey());
|
|
|
// skuNewMap.put()
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
Iterator<Map.Entry<String, Long>> it = skuMap.entrySet().iterator();
|
|
|
while(it.hasNext()){
|
|
|
Map.Entry<String, Long> skuEntry=it.next();
|
|
|
if(currentTime-skuEntry.getValue() > SocketConstant.SKU_NOTBELONG_TIMEOUT){
|
|
|
it.remove();
|
|
|
List<SkuInfo> skuList = new ArrayList<SkuInfo>();
|
|
|
for(Map.Entry<String, Long> entry : skuMap.entrySet()){
|
|
|
// sku离开时间 >1.5s <30min
|
|
|
if(System.currentTimeMillis()-entry.getValue() < SocketConstant.SKU_NOTBELONG_TIMEOUT){
|
|
|
SkuInfo skuInfo = new SkuInfo();
|
|
|
skuInfo.setSku(entry.getKey());
|
|
|
skuInfo.setTime(entry.getValue());
|
|
|
skuList.add(skuInfo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
SkuResult skuResult = new SkuResult();
|
|
|
skuResult.setSkuMap(skuMap);
|
|
|
skuResult.setSkuInfo(skuList);
|
|
|
skuResult.setCurrentTime(currentTime);
|
|
|
logger.info("out RfidController.queryLeaveSku. ip is: {}, skuResult is: {}, count is:{}", ip, skuResult, skuMap.size());
|
|
|
//组织返回
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message("query leave sku").data(skuResult).build();
|
...
|
...
|
|