|
|
@@ -529,7 +529,7 @@ public class WxxcxIndexController<AesException extends Throwable> {
|
|
|
*/
|
|
|
@GetMapping("/devListWithTimes")
|
|
|
@ApiOperation(value = "查询设备列表")
|
|
|
- public R devListWithTimes(String user_openid, String keyword, Integer zt) throws IOException {
|
|
|
+ public R devListWithTimes(String user_openid, String keyword, Integer zt, String time) throws IOException {
|
|
|
R r = JSONUtil.getSuccessMsg(null);
|
|
|
String con = "";
|
|
|
if (StringUtils.isNotEmpty(keyword)) {
|
|
|
@@ -556,15 +556,18 @@ public class WxxcxIndexController<AesException extends Throwable> {
|
|
|
|
|
|
Map beanMap = objectMapper.convertValue(dev, Map.class);
|
|
|
|
|
|
- LocalDate previousDate = LocalDate.now().minusDays(1);
|
|
|
- String previousDateStr = previousDate.toString();
|
|
|
+ LocalDate inputDate = LocalDate.now();
|
|
|
+ if (StringUtils.isNotEmpty(time)) {
|
|
|
+ inputDate = LocalDate.parse(time);
|
|
|
+ }
|
|
|
+ String inputDateStr = inputDate.toString();
|
|
|
// 判断查询结果并返回
|
|
|
- List<AlarmEvent> stayTimes = null;
|
|
|
+ List<StayTime> stayTimes = null;
|
|
|
try {
|
|
|
stayTimes = jdbcTemplate.query(
|
|
|
- "SELECT * FROM alarm_event WHERE dev_id = ? AND DATE(create_time) = ?",
|
|
|
- new Object[]{dev.getDev_id(), previousDateStr},
|
|
|
- new BeanPropertyRowMapper<>(AlarmEvent.class)
|
|
|
+ "SELECT * FROM stay_time WHERE dev_id = ? AND DATE(leave_time) = ? and type = 0 order by leave_time",
|
|
|
+ new Object[]{dev.getDev_id(), inputDateStr},
|
|
|
+ new BeanPropertyRowMapper<>(StayTime.class)
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -1918,13 +1921,12 @@ public class WxxcxIndexController<AesException extends Throwable> {
|
|
|
public R getWcTimes(String dev_id, String time) {
|
|
|
R r = JSONUtil.getSuccessMsg(null);
|
|
|
LocalDate inputDate = LocalDate.parse(time);
|
|
|
- LocalDate previousDate = inputDate.minusDays(1);
|
|
|
- String previousDateStr = previousDate.toString();
|
|
|
+ String previousDateStr = inputDate.toString();
|
|
|
// 判断查询结果并返回
|
|
|
List<StayTime> stayTimes = null;
|
|
|
try {
|
|
|
stayTimes = jdbcTemplate.query(
|
|
|
- "SELECT * FROM stay_time WHERE dev_id = ? AND DATE(leave_time) = ? and type = '0' order by leave_time",
|
|
|
+ "SELECT * FROM stay_time WHERE dev_id = ? AND DATE(leave_time) = ? and type = 0 order by leave_time",
|
|
|
new Object[]{dev_id, previousDateStr},
|
|
|
new BeanPropertyRowMapper<>(StayTime.class)
|
|
|
);
|
|
|
@@ -1967,8 +1969,8 @@ public class WxxcxIndexController<AesException extends Throwable> {
|
|
|
}
|
|
|
if (Objects.nonNull(stayTimes) && stayTimes.size() > 0) {
|
|
|
|
|
|
- List<StayTime> roomList = stayTimes.stream().filter(stayTime -> ("0").equals(stayTime.getType())).collect(Collectors.toList());
|
|
|
- List<StayTime> toiletList = stayTimes.stream().filter(stayTime -> ("1").equals(stayTime.getType())).collect(Collectors.toList());
|
|
|
+ List<StayTime> roomList = stayTimes.stream().filter(stayTime -> 0 == (stayTime.getType())).collect(Collectors.toList());
|
|
|
+ List<StayTime> toiletList = stayTimes.stream().filter(stayTime -> 1 == stayTime.getType()).collect(Collectors.toList());
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(roomList)) {
|
|
|
for (StayTime stayTime : roomList) {
|