|
@@ -1,7 +1,6 @@
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.ruoyi.common.annotation.Excel;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
@@ -12,12 +11,15 @@ import com.ruoyi.system.domain.TEarlyWarning;
|
|
|
import com.ruoyi.system.domain.dto.*;
|
|
|
import com.ruoyi.system.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.text.NumberFormat;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -223,29 +225,7 @@ public class TDataDisplayController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/addDevice")
|
|
|
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());
|
|
|
+ List<AddDeviceDto> dtoList = tDeviceListService.selectAddDeviceV1();
|
|
|
return success(dtoList);
|
|
|
}
|
|
|
|