|
@@ -9,6 +9,7 @@ import com.wsm.admin.service.IDeviceService;
|
|
|
import com.wsm.common.api.BaseController;
|
|
|
import com.wsm.common.constant.ConstantType;
|
|
|
import com.wsm.common.util.AjaxJson;
|
|
|
+import com.wsm.common.util.FileUtils;
|
|
|
import com.wsm.common.util.PasswordUtils;
|
|
|
import com.wsm.common.util.RedisUtil;
|
|
|
import org.slf4j.Logger;
|
|
@@ -46,14 +47,15 @@ public class ApiDeviceController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 获取所有的设备信息
|
|
|
+ * 提供给产品展示页用
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = {"/list"})
|
|
|
public AjaxJson list() {
|
|
|
List<Device> list = (List) redisTemplate.opsForValue().get(MsgCode.REDIS_CYCLE_DEVICE_LIST);
|
|
|
if (list == null) {
|
|
|
- logger.info("list size: ");
|
|
|
list = deviceService.findAll();
|
|
|
+ logger.info("list size: {}", list.size());
|
|
|
redisTemplate.opsForValue().set(MsgCode.REDIS_CYCLE_DEVICE_LIST, list, 24, TimeUnit.HOURS);
|
|
|
|
|
|
}
|
|
@@ -126,7 +128,7 @@ public class ApiDeviceController extends BaseController {
|
|
|
|
|
|
JSONObject reportedJaon = jsonObject.getJSONObject("reported");
|
|
|
String batteryPower = reportedJaon.getString("batteryPower");
|
|
|
- String replace = batteryPower.replace(batteryPower, "%");
|
|
|
+ String replace = batteryPower.replace("%", "");
|
|
|
Integer power = Integer.valueOf(replace);
|
|
|
|
|
|
|
|
@@ -246,4 +248,6 @@ public class ApiDeviceController extends BaseController {
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|