From 68e750bf109efb0469704e54e48a29649512358c Mon Sep 17 00:00:00 2001 From: cjl <276999030@qq.com> Date: Mon, 18 Dec 2023 13:31:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into cjl --- screen-api/src/main/java/com/moral/api/controller/HeatMapController.java | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/controller/HeatMapController.java b/screen-api/src/main/java/com/moral/api/controller/HeatMapController.java index 9c74b97..2b149c1 100644 --- a/screen-api/src/main/java/com/moral/api/controller/HeatMapController.java +++ b/screen-api/src/main/java/com/moral/api/controller/HeatMapController.java @@ -8,21 +8,15 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; - import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; -import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; - +import com.moral.api.pojo.dto.dataDisplay.HeatMapDTO; import com.moral.api.service.DataDisplayService; import com.moral.api.vo.HeatMapVo; import com.moral.api.vo.TimeHourVo; @@ -53,7 +47,7 @@ @RequestParam @ApiParam(value = "startTime",name = "������������") String startTime, @RequestParam @ApiParam(value = "type",name= "������������") String type, @RequestParam @ApiParam(value = "form",name= "������������") String form){ - ArrayList<Map<String, Object>> heatMapData = dataDisplayService.getHeatMapData(code, startTime, type, form); + List<HeatMapDTO> heatMapData = dataDisplayService.getHeatMapData(code, startTime, type, form); return ResultMessage.ok(ObjectUtils.isEmpty(heatMapData)?"0":heatMapData); } @GetMapping("queryTime") @@ -81,8 +75,11 @@ ArrayList<TimeHourVo> timeHourVos = new ArrayList<>(); String[] splitStart = startTime.split("-"); String[] splitEnd = endTime.split("-"); + //��������������������������� + + int monthDay = DateUtils.getMonthDay(DateUtils.getDate(endTime,DateUtils.yyyy_MM_EN)); LocalDate startDate = LocalDate.of(Integer.parseInt(splitStart[0]), Integer.parseInt(splitStart[1]),1); - LocalDate endDate = LocalDate.of(Integer.parseInt(splitEnd[0]), Integer.parseInt(splitEnd[1]),30); + LocalDate endDate = LocalDate.of(Integer.parseInt(splitEnd[0]), Integer.parseInt(splitEnd[1]),monthDay); long daysBetween = ChronoUnit.DAYS.between(startDate, endDate); for (int i = 0; i <= daysBetween; i++) { HeatMapVo heatMapVo = new HeatMapVo(); @@ -117,6 +114,8 @@ if(ksTime.equals(endTime)){ heatMapVo.setHourListTime(hourListTime); heatMapVos.add(heatMapVo); + idHour++; + break; } }else { id++; @@ -133,6 +132,7 @@ heatMapVo.setName(nameEndTime); heatMapVo.setHourListTime(hourListTime); heatMapVos.add(heatMapVo); + break; }else { name = nameEndTime; heatMapVo.setHourListTime(hourListTime); @@ -148,11 +148,8 @@ if(CollectionUtils.isNotEmpty(heatMapVos)){ heatMapVos.get(0).setIdLength(idHour); } -/* - - - String[] splitStart = startTime.split("-"); +/* String[] splitStart = startTime.split("-"); String[] s1 = splitStart[2].split(" "); String[] splitEnd = endTime.split("-"); String[] s2 = splitEnd[2].split(" "); @@ -169,24 +166,28 @@ hourList.add(currentDateTime.toString()); currentDateTime = currentDateTime.plusHours(1); } + int length=0; for (int i = 0; i <= daysBetween; i++) { - - ArrayList<Map<String,Object>> list = new ArrayList<>(); + ArrayList<TimeHourVo> timeHourVos = new ArrayList<>(); HeatMapVo heatMapVo = new HeatMapVo(); LocalDate date = startDate.plusDays(i); heatMapVo.setId(i); heatMapVo.setName(date.toString()); for (int i1 = 0; i1 < hourList.size(); i1++) { - HashMap<String, Object> map = new HashMap<>(); - if (hourList.get(i).contains(date.toString())){ - map.put("name",hourList.get(i).substring(11,16)); - list.add(map); + if (hourList.get(i1).contains(date.toString())){ + TimeHourVo hourVo = new TimeHourVo(); + hourVo.setName(hourList.get(i1).substring(11,13)); + hourVo.setId(length); + timeHourVos.add(hourVo); + hourList.remove(i1); + i1--; + length++; } } - heatMapVo.setHourList(list); + heatMapVo.setHourListTime(timeHourVos); heatMapVos.add(heatMapVo); - }*/ - + } + heatMapVos.get(0).setIdLength(length);*/ } return ResultMessage.ok(ObjectUtils.isEmpty(heatMapVos)?"0":heatMapVos); -- Gitblit v1.8.0