|
@@ -43,6 +43,9 @@ public class JinyunController extends BaseController {
|
|
|
@Autowired
|
|
|
private AreaService areaService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StationService stationService;
|
|
|
+
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
public Object report() {
|
|
|
ModelAndView modelAndView = new ModelAndView();
|
|
@@ -56,7 +59,8 @@ public class JinyunController extends BaseController {
|
|
|
try {
|
|
|
List<Long> stationIdList = jinyunService.getStationIdList(areaId, category, getTargetTenantId());
|
|
|
List<DataDTO> list = jinyunService.getCount(stationIdList, field, getTargetTenantId());
|
|
|
- return AjaxResponse.success().put("list", list);
|
|
|
+ Integer total = list.stream().mapToInt(dto -> Integer.valueOf(String.valueOf(dto.getData()))).sum();
|
|
|
+ return AjaxResponse.success().put("list", list).put("total", total);
|
|
|
}catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
return AjaxResponse.fail(e.getMessage());
|
|
@@ -70,12 +74,21 @@ public class JinyunController extends BaseController {
|
|
|
Example example = new Example(Area.class);
|
|
|
example.createCriteria().andEqualTo("parentAreaId", areaId);
|
|
|
List<Area> areaList = areaService.selectByExample(example);
|
|
|
+ Area thisArea = areaService.selectByPrimaryKey(areaId);
|
|
|
+ areaList.add(thisArea);
|
|
|
List<DataDTO> result = new ArrayList<>();
|
|
|
Map<Long, Future<List<DataDTO>>> futureMap = new HashMap<>();
|
|
|
Long tenantId = getTargetTenantId();
|
|
|
for (Area area : areaList) {
|
|
|
Future<List<DataDTO>> future = ThreadUtil.submit(() -> {
|
|
|
- List<Long> stationIdList = jinyunService.getStationIdList(area.getAreaId(), category, tenantId);
|
|
|
+ List<Long> stationIdList;
|
|
|
+ if (areaId.equals(area.getAreaId())) {
|
|
|
+ Example example1 = new Example(Station.class);
|
|
|
+ example1.createCriteria().andEqualTo("areaId", areaId).andEqualTo("isDel", 1);
|
|
|
+ stationIdList = stationService.selectByEx(example1);
|
|
|
+ }else {
|
|
|
+ stationIdList = jinyunService.getStationIdList(area.getAreaId(), category, tenantId);
|
|
|
+ }
|
|
|
List<DataDTO> list = jinyunService.getCount(stationIdList, field, tenantId);
|
|
|
return list;
|
|
|
});
|
|
@@ -89,7 +102,12 @@ public class JinyunController extends BaseController {
|
|
|
result.add(dataDTO);
|
|
|
}
|
|
|
result = jinyunService.handlerChildSeries(result);
|
|
|
- return AjaxResponse.success().put("list", result);
|
|
|
+ Integer total = 0;
|
|
|
+ for (DataDTO dataDTO : result) {
|
|
|
+ List<DataDTO> list = (List) dataDTO.getData();
|
|
|
+ total += list.stream().mapToInt(dto -> Integer.valueOf(String.valueOf(dto.getData()))).sum();
|
|
|
+ }
|
|
|
+ return AjaxResponse.success().put("list", result).put("total", total);
|
|
|
}catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
return AjaxResponse.fail(e.getMessage());
|
|
@@ -103,7 +121,8 @@ public class JinyunController extends BaseController {
|
|
|
try {
|
|
|
List<Long> stationIdList = jinyunService.getStationIdList(areaId, category, getTargetTenantId());
|
|
|
List<DataDTO> list = jinyunService.getSum(stationIdList, field, sumField, getTargetTenantId());
|
|
|
- return AjaxResponse.success().put("list", list);
|
|
|
+ Integer total = list.stream().mapToInt(dto -> Integer.valueOf(String.valueOf(dto.getData()))).sum();
|
|
|
+ return AjaxResponse.success().put("list", list).put("total", total);
|
|
|
}catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
return AjaxResponse.fail(e.getMessage());
|
|
@@ -118,12 +137,21 @@ public class JinyunController extends BaseController {
|
|
|
Example example = new Example(Area.class);
|
|
|
example.createCriteria().andEqualTo("parentAreaId", areaId);
|
|
|
List<Area> areaList = areaService.selectByExample(example);
|
|
|
+ Area thisArea = areaService.selectByPrimaryKey(areaId);
|
|
|
+ areaList.add(thisArea);
|
|
|
List<DataDTO> result = new ArrayList<>();
|
|
|
Map<Long, Future<List<DataDTO>>> futureMap = new HashMap<>();
|
|
|
Long tenantId = getTargetTenantId();
|
|
|
for (Area area : areaList) {
|
|
|
Future<List<DataDTO>> future = ThreadUtil.submit(() -> {
|
|
|
- List<Long> stationIdList = jinyunService.getStationIdList(area.getAreaId(), category, tenantId);
|
|
|
+ List<Long> stationIdList;
|
|
|
+ if (areaId.equals(area.getAreaId())) {
|
|
|
+ Example example1 = new Example(Station.class);
|
|
|
+ example1.createCriteria().andEqualTo("areaId", areaId).andEqualTo("isDel", 1);
|
|
|
+ stationIdList = stationService.selectByEx(example1);
|
|
|
+ }else {
|
|
|
+ stationIdList = jinyunService.getStationIdList(area.getAreaId(), category, tenantId);
|
|
|
+ }
|
|
|
List<DataDTO> list = jinyunService.getSum(stationIdList, field, sumField, tenantId);
|
|
|
return list;
|
|
|
});
|
|
@@ -137,7 +165,12 @@ public class JinyunController extends BaseController {
|
|
|
result.add(dataDTO);
|
|
|
}
|
|
|
result = jinyunService.handlerChildSeries(result);
|
|
|
- return AjaxResponse.success().put("list", result);
|
|
|
+ Integer total = 0;
|
|
|
+ for (DataDTO dataDTO : result) {
|
|
|
+ List<DataDTO> list = (List) dataDTO.getData();
|
|
|
+ total += list.stream().mapToInt(dto -> Integer.valueOf(String.valueOf(dto.getData()))).sum();
|
|
|
+ }
|
|
|
+ return AjaxResponse.success().put("list", result).put("total", total);
|
|
|
}catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
return AjaxResponse.fail(e.getMessage());
|