jinpengyong
2023-12-15 2e1d289a38cf4e0dfe0f1c7301b7a365cda8d395
screen-api/src/main/java/com/moral/api/controller/HeatMapController.java
@@ -8,21 +8,17 @@
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 +49,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 +77,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();