浏览代码

新增设备列表接口

yanliming 5 年之前
父节点
当前提交
1c8808f2be

+ 12 - 0
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/IndividualLogApiController.java

@@ -0,0 +1,12 @@
+package com.jpsoft.smart.modules.mobile.controller;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@RequestMapping("/mobile/IndividualLogApi")
+public class IndividualLogApiController {
+
+}

+ 32 - 8
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonDeviceLogApiController.java

@@ -3,14 +3,8 @@ package com.jpsoft.smart.modules.mobile.controller;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.util.StringUtil;
 import com.google.common.collect.Lists;
-import com.jpsoft.smart.modules.base.entity.CompanyInfo;
-import com.jpsoft.smart.modules.base.entity.PersonDeviceFilterLog;
-import com.jpsoft.smart.modules.base.entity.PersonDeviceLog;
-import com.jpsoft.smart.modules.base.entity.PersonInfo;
-import com.jpsoft.smart.modules.base.service.CompanyInfoService;
-import com.jpsoft.smart.modules.base.service.PersonDeviceFilterLogService;
-import com.jpsoft.smart.modules.base.service.PersonDeviceLogService;
-import com.jpsoft.smart.modules.base.service.PersonInfoService;
+import com.jpsoft.smart.modules.base.entity.*;
+import com.jpsoft.smart.modules.base.service.*;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.common.dto.Sort;
 import com.jpsoft.smart.modules.common.utils.PojoUtils;
@@ -46,6 +40,9 @@ public class PersonDeviceLogApiController {
     @Autowired
     private CompanyInfoService companyInfoService;
 
+    @Autowired
+    private DeviceInfoService deviceInfoService;
+
     @PostMapping("queryTemperatureRawRecordList")
     @ApiOperation(value="根据实时数据查看企业人员温度数据")
     @ApiImplicitParams({
@@ -567,4 +564,31 @@ public class PersonDeviceLogApiController {
         return msgResult;
     }
 
+
+    @ApiOperation(value="获取设备列表")
+    @RequestMapping(value = "getDeviceList",method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
+            @ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
+    })
+    public MessageResult<List<DeviceInfo>> getDeviceList(String token, @RequestAttribute String subject) {
+        MessageResult<List<DeviceInfo>> msgResult = new MessageResult<>();
+
+        try{
+            PersonInfo person = personInfoService.get(Long.valueOf(subject));
+
+            String companyId = person.getCompanyId();
+
+            List<DeviceInfo> DeviceInfoList = deviceInfoService.findByCompanyId(companyId);
+
+            msgResult.setResult(true);
+            msgResult.setData(DeviceInfoList);
+        }
+        catch (Exception ex){
+            msgResult.setMessage(ex.getMessage());
+            msgResult.setResult(false);
+        }
+
+        return msgResult;
+    }
 }