This commit is contained in:
wuweida 2022-07-15 17:29:21 +08:00
parent 2837e1e7a3
commit 6d519a2e6e
5 changed files with 16 additions and 11 deletions

View File

@ -7,11 +7,11 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@Configuration @Configuration
//所有的定时任务都放在一个线程池中定时任务启动时使用不同线程 //所有的定时任务都放在一个线程池中定时任务启动时使用不同线程
public class ScheduleConfig implements SchedulingConfigurer { public class ScheduleConfig implements SchedulingConfigurer {
@Override @Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
//设定一个长度20的定时任务线程池 //设定一个长度10的定时任务线程池
scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(20)); scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(10));
} }
} }

View File

@ -6,6 +6,7 @@ import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.mapper.KeyAreaMapper; import com.hisense.monitormanage.mapper.KeyAreaMapper;
import com.hisense.monitormanage.mapper.PassengerFlowMapper; import com.hisense.monitormanage.mapper.PassengerFlowMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -24,11 +25,17 @@ public class KeyAreaController {
@Autowired @Autowired
private PassengerFlowMapper passengerFlowMapper; private PassengerFlowMapper passengerFlowMapper;
@GetMapping("seelctKeyAreaList") /**
public Result seelctKeyAreaList(String type){ * 根据区域类型查询区域的最新时间的人数
* @param type
* @return
*/
@GetMapping("selectKeyAreaList")
@ApiOperation("根据区域类型查询区域的最新时间的人数")
public Result selectKeyAreaList(String type){
PassengerFlow maxId = passengerFlowMapper.getByMaxId(); PassengerFlow maxId = passengerFlowMapper.getByMaxId();
String timeId = maxId.getTimeId(); String timeId = maxId.getTimeId();
List<KeyAreaDto> keyAreaDtos = keyAreaMapper.seelctKeyAreaList(type,timeId); List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectKeyAreaList(type,timeId);
keyAreaDtos.forEach(keyAreaDto -> { keyAreaDtos.forEach(keyAreaDto -> {
keyAreaDto.setTimeId(timeId); keyAreaDto.setTimeId(timeId);
}); });

View File

@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020303541317325034' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" ) @Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020300001310016759' AND channel_code > '183_37028352001328635450' ORDER BY channel_code DESC" )
List<CameraChannel> selectCameraChannel(); List<CameraChannel> selectCameraChannel();
} }

View File

@ -13,8 +13,6 @@ import java.util.List;
public interface KeyAreaMapper extends BaseMapper<KeyArea> { public interface KeyAreaMapper extends BaseMapper<KeyArea> {
@Select("select ka.type,ka.area_name,ka.location,ss.allNums from t_key_area ka LEFT JOIN (select pt.area_name,SUM(pf.all_nums) as allNums from t_passenger_flow pf JOIN t_passenger_test pt ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type = #{type} GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type = #{type}") @Select("select ka.type,ka.area_name,ka.location,ss.allNums from t_key_area ka LEFT JOIN (select pt.area_name,SUM(pf.all_nums) as allNums from t_passenger_flow pf JOIN t_passenger_test pt ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type = #{type} GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type = #{type}")
List<KeyAreaDto> seelctKeyAreaList(@Param("type") String type,@Param("timeId") String timeId); List<KeyAreaDto> selectKeyAreaList(@Param("type") String type,@Param("timeId") String timeId);
} }

View File

@ -8,6 +8,7 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
@ -252,7 +253,6 @@ public class QidiService {
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return yestDay.format(formatter); return yestDay.format(formatter);
} }
} }