|
@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.text.NumberFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -72,7 +74,7 @@ public class TDataDisplayController extends BaseController
|
|
|
@GetMapping("/count")
|
|
|
public AjaxResult count()
|
|
|
{
|
|
|
- return success(tShouhuanAlarmListService.selectTShouhuanAlarmListCount());
|
|
|
+ return success(userProfileService.selectuserAgeCount());
|
|
|
}
|
|
|
|
|
|
@GetMapping("/alarm")
|
|
@@ -139,6 +141,7 @@ public class TDataDisplayController extends BaseController
|
|
|
{
|
|
|
Integer total = userProfileService.selectuserAgeCount();
|
|
|
List<UserAgeDto> dtoList = userProfileService.selectuserAgeDto();
|
|
|
+ dtoList.removeIf(user -> StringUtils.isNull(user.getAge()));
|
|
|
AjaxResult ajax = new AjaxResult();
|
|
|
ajax.put("list",dtoList);
|
|
|
ajax.put("total", total);
|
|
@@ -197,6 +200,28 @@ public class TDataDisplayController extends BaseController
|
|
|
public AjaxResult addDevice()
|
|
|
{
|
|
|
List<AddDeviceDto> dtoList = tDeviceListService.selectAddDevice();
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ LocalDate lastMonthDate = currentDate.minusMonths(1);
|
|
|
+ int year= currentDate.getYear();
|
|
|
+ if (dtoList.size() == 2){
|
|
|
+ int lastMonth = lastMonthDate.getMonthValue()-1;
|
|
|
+ AddDeviceDto dto = new AddDeviceDto();
|
|
|
+ dto.setMonth(year + "-0" + lastMonth);
|
|
|
+ dto.setCount(0);
|
|
|
+ dtoList.add(dto);
|
|
|
+ }else if (dtoList.size() == 1){
|
|
|
+ int lastMonth = lastMonthDate.getMonthValue();
|
|
|
+ int lastlastMonth = lastMonthDate.getMonthValue()-1;
|
|
|
+ AddDeviceDto dto = new AddDeviceDto();
|
|
|
+ dto.setMonth(year + "-0" + lastMonth);
|
|
|
+ dto.setCount(0);
|
|
|
+ dtoList.add(dto);
|
|
|
+ AddDeviceDto dto1 = new AddDeviceDto();
|
|
|
+ dto1.setMonth(year + "-0" + lastlastMonth);
|
|
|
+ dto1.setCount(0);
|
|
|
+ dtoList.add(dto1);
|
|
|
+ }
|
|
|
+ dtoList = dtoList.stream().sorted(Comparator.comparing(AddDeviceDto::getMonth)).collect(Collectors.toList());
|
|
|
return success(dtoList);
|
|
|
}
|
|
|
|