Procházet zdrojové kódy

Merge remote-tracking branch 'origin/V1' into V1

jz.kai před 5 roky
rodič
revize
b6047a1ac6

+ 10 - 0
common/src/main/resources/mapper/base/PersonDeviceLog.xml

@@ -86,6 +86,16 @@
                   and a.record_time <= #{searchParams.endTime}
                 ]]>
             </if>
+            <if test="searchParams.minTemperature != null">
+                <![CDATA[
+                  and a.temperature_ >= #{searchParams.minTemperature}
+                ]]>
+            </if>
+            <if test="searchParams.maxTemperature != null">
+                <![CDATA[
+                  and a.temperature_ <= #{searchParams.maxTemperature}
+                ]]>
+            </if>
         </where>
         <foreach item="sort" collection="sortList"  open="order by" separator=",">
             ${sort.name} ${sort.order}

+ 28 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/DeviceInfoController.java

@@ -7,6 +7,7 @@ import com.jpsoft.smart.modules.common.dto.Sort;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
 import com.jpsoft.smart.modules.base.service.DeviceInfoService;
+import com.jpsoft.smart.modules.lapi.service.ILapiService;
 import com.jpsoft.smart.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -34,6 +35,9 @@ public class DeviceInfoController {
     @Autowired
     private DataDictionaryService dataDictionaryService;
 
+    @Autowired
+    private ILapiService lapiService;
+
     @ApiOperation(value="添加设备")
     @PostMapping("add")
     public MessageResult<DeviceInfo> add(@RequestBody DeviceInfo deviceInfo,@RequestAttribute String subject){
@@ -245,4 +249,28 @@ public class DeviceInfoController {
 
         return msgResult;
     }
+
+
+    @ApiOperation(value="根据IP地址和端口号查找设备")
+    @PostMapping("getByIpAddressAndPort")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "ipAddress",value = "IP地址", paramType = "query"),
+            @ApiImplicitParam(name = "port",value = "端口号", paramType = "query")
+    })
+    public MessageResult<DeviceInfo> getByIpAddressAndPort( String ipAddress,String port,@RequestAttribute String subject) {
+        MessageResult<DeviceInfo> msgResult = new MessageResult<>();
+        try {
+            DeviceInfo device = lapiService.findByIpAddressAndPort(ipAddress, port);
+
+            msgResult.setResult(true);
+            msgResult.setData(device);
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+        return msgResult;
+    }
 }

+ 46 - 12
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonDeviceLogController.java

@@ -50,14 +50,14 @@ public class PersonDeviceLogController {
             @ApiImplicitParam(name = "deviceNo",value = "设备编号", paramType = "query"),
             @ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
             @ApiImplicitParam(name = "personName",value = "人员姓名", paramType = "query"),
-            @ApiImplicitParam(name = "matchStatus",value = "开门类型", paramType = "query"),
-            @ApiImplicitParam(name = "timeRanges",value = "时间范围", paramType = "query")
+            @ApiImplicitParam(name = "timeRanges",value = "时间范围", paramType = "query"),
+            @ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query")
 
     })
     public MessageResult<Map> pageList(
             String companyId,
             String deviceNo,String aliasName,String personName,
-            String matchStatus,String timeRanges,
+            String timeRanges,String temperatureRanges,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -84,9 +84,7 @@ public class PersonDeviceLogController {
         if(StringUtil.isNotEmpty(personName)){
             searchParams.put("personName","%"+personName+"%");
         }
-        if(StringUtil.isNotEmpty(matchStatus)){
-            searchParams.put("matchStatus",matchStatus);
-        }
+
 
         if(StringUtil.isNotEmpty(timeRanges)){
             String[] timeRangeArray = timeRanges.split(",");
@@ -104,6 +102,28 @@ public class PersonDeviceLogController {
             searchParams.put("endTime",endTime);
         }
 
+        if(StringUtil.isNotEmpty(temperatureRanges)){
+            String[] temperatureRangeArray = temperatureRanges.split(",");
+
+            String minTemperature = "";
+            String maxTemperature = "";
+
+            if(temperatureRangeArray.length == 1){
+                minTemperature = temperatureRangeArray[0];
+            }
+            if(temperatureRangeArray.length == 2){
+                minTemperature = temperatureRangeArray[0];
+                maxTemperature = temperatureRangeArray[1];
+            }
+
+            if(StringUtil.isNotEmpty(minTemperature)){
+                searchParams.put("minTemperature",minTemperature);
+            }
+            if(StringUtil.isNotEmpty(maxTemperature)){
+                searchParams.put("maxTemperature",maxTemperature);
+            }
+        }
+
         Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
         msgResult.setResult(true);
@@ -120,13 +140,13 @@ public class PersonDeviceLogController {
             @ApiImplicitParam(name = "deviceNo",value = "设备编号", paramType = "query"),
             @ApiImplicitParam(name = "aliasName",value = "设备别名", paramType = "query"),
             @ApiImplicitParam(name = "personName",value = "人员姓名", paramType = "query"),
-            @ApiImplicitParam(name = "matchStatus",value = "开门类型", paramType = "query"),
-            @ApiImplicitParam(name = "timeRanges",value = "时间范围", paramType = "query")
+            @ApiImplicitParam(name = "timeRanges",value = "时间范围", paramType = "query"),
+            @ApiImplicitParam(name = "temperatureRanges",value = "温度范围", paramType = "query")
     })
     public MessageResult<String> exportXls(
                                 String companyId,
                                 String deviceNo,String aliasName,String personName,
-                                String matchStatus,String timeRanges,
+                                String timeRanges,String temperatureRanges,
                                 @RequestAttribute String subject) {
         MessageResult<String> msgResult = new MessageResult<>();
 
@@ -170,9 +190,6 @@ public class PersonDeviceLogController {
             if(StringUtil.isNotEmpty(personName)){
                 searchParams.put("personName","%"+personName+"%");
             }
-            if(StringUtil.isNotEmpty(matchStatus)){
-                searchParams.put("matchStatus",matchStatus);
-            }
 
             if(StringUtil.isNotEmpty(timeRanges)){
                 String[] timeRangeArray = timeRanges.split(",");
@@ -190,6 +207,23 @@ public class PersonDeviceLogController {
                 searchParams.put("endTime",endTime);
             }
 
+            if(StringUtil.isNotEmpty(temperatureRanges)){
+                String[] temperatureRangeArray = temperatureRanges.split(",");
+
+                String minTemperature = "";
+                String maxTemperature = "";
+                if(temperatureRangeArray.length==1){
+                    minTemperature = temperatureRangeArray[0];
+                }
+                else if(temperatureRangeArray.length==2){
+                    minTemperature = temperatureRangeArray[0];
+                    maxTemperature = temperatureRangeArray[1];
+                }
+
+                searchParams.put("minTemperature",minTemperature);
+                searchParams.put("maxTemperature",maxTemperature);
+            }
+
             Page<PersonDeviceLog> page = personDeviceLogService.pageSearch(searchParams,1,10000,false,sortList);
 
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");