|
@@ -5,6 +5,7 @@ import cn.efunbox.audio.entity.Device;
|
|
|
import cn.efunbox.audio.service.ChannelService;
|
|
|
import cn.efunbox.audio.service.DeviceService;
|
|
|
import cn.efunbox.audio.utils.ApiCode;
|
|
|
+import cn.efunbox.audio.utils.HttpUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -83,4 +86,33 @@ public class DeviceController {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 搜索已注册的设备
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/search" ,method = RequestMethod.POST)
|
|
|
+ public void Search(HttpServletRequest request, HttpServletResponse response){
|
|
|
+ String did = request.getParameter("did");
|
|
|
+ String cid = request.getParameter("cid");
|
|
|
+ if(did==null || did.length()==0)
|
|
|
+ did = "0";
|
|
|
+ if(cid==null || cid.length()==0)
|
|
|
+ cid = "0";
|
|
|
+ List<Device> list = deviceService.Search(Long.valueOf(cid), Long.valueOf(did));
|
|
|
+
|
|
|
+ if(list==null || list.size()<1){
|
|
|
+ HttpUtil.responseApiCode(request, response, ApiCode.NOT_FOUND);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for(int i=0; i<list.size(); i++){
|
|
|
+ list.get(i).setTokenNew("");
|
|
|
+ list.get(i).setTokenOld("");
|
|
|
+ }
|
|
|
+
|
|
|
+ HttpUtil.responseOkData(request, response, list);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
}
|