|
@@ -1,11 +1,13 @@
|
|
|
package com.jpsoft.smart.modules.base.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.smart.modules.base.entity.AlarmInfo;
|
|
|
import com.jpsoft.smart.modules.base.entity.CompanyDeviceRelation;
|
|
|
import com.jpsoft.smart.modules.base.service.CompanyDeviceRelationService;
|
|
|
+import com.jpsoft.smart.modules.common.utils.LApiUtil;
|
|
|
import com.jpsoft.smart.modules.common.utils.PojoUtils;
|
|
|
import com.jpsoft.smart.modules.common.dto.Sort;
|
|
|
import com.jpsoft.smart.modules.common.dto.MessageResult;
|
|
@@ -24,6 +26,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
+import org.junit.Test;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -32,6 +35,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -450,4 +454,75 @@ public class DeviceInfoController {
|
|
|
}
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="获取设备验证规则列表")
|
|
|
+ @PostMapping("getDeviceRule")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "deviceId",value = "设备编号", paramType = "query")
|
|
|
+ })
|
|
|
+ public MessageResult<Map<String,Object>> getDeviceRule(String deviceId,@RequestAttribute String subject) {
|
|
|
+ MessageResult<Map<String,Object>> msgResult = new MessageResult<>();
|
|
|
+ try {
|
|
|
+ Map<String,Object> ruleMap = lapiService.getDeviceRule(deviceId);
|
|
|
+ ruleMap.get("RuleList");//规则状态列表
|
|
|
+ //Mode 0安全帽,1口罩,2测温
|
|
|
+ //Enabled 是否启用 0否,1是
|
|
|
+ ruleMap.get("TemperatureRule");//温度设置
|
|
|
+ //Type -> 1 手腕1,额头0
|
|
|
+ //Minimum -> 30
|
|
|
+ //Maximum -> 45
|
|
|
+ //PreAlarmOffset -> 0.300000
|
|
|
+ //AlarmThreshold -> 37.3000000
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(ruleMap);
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="更新设备验证规则")
|
|
|
+ @PostMapping("saveDeviceRule")
|
|
|
+ /**
|
|
|
+ * @param deviceInfoId 设备id
|
|
|
+ * @param needCap 安全帽验证 (0:不验证,1:验证)
|
|
|
+ * @param needMask 口罩验证 (0:不验证,1:验证)
|
|
|
+ * @param measureTemperature 测试验证 (0:不验证,1:验证)
|
|
|
+ * @param type 测试验证类型 (0:测额温,1:测腕温)
|
|
|
+ * @param minTemper 温度下限
|
|
|
+ * @param maxTemper 温度上限
|
|
|
+ * @param alarmThreshold 报警温度
|
|
|
+ **/
|
|
|
+ public MessageResult<DeviceInfo> saveDeviceRule(
|
|
|
+ String deviceInfoId,
|
|
|
+ Integer needCap,
|
|
|
+ Integer needMask,
|
|
|
+ Integer measureTemperature,
|
|
|
+ Integer type,
|
|
|
+ BigDecimal minTemper,
|
|
|
+ BigDecimal maxTemper,
|
|
|
+ BigDecimal alarmThreshold,
|
|
|
+ @RequestAttribute String subject){
|
|
|
+ MessageResult<DeviceInfo> msgResult = new MessageResult<>();
|
|
|
+ Boolean result = false;
|
|
|
+ try {
|
|
|
+ result = lapiService.setDeviceRule(deviceInfoId,needCap,needMask,measureTemperature,
|
|
|
+ type,minTemper,maxTemper,alarmThreshold);
|
|
|
+ msgResult.setResult(result);
|
|
|
+ msgResult.setMessage("");
|
|
|
+ }
|
|
|
+ catch(Exception ex){
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ msgResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|