Browse Source

参数验证

develop
wangsixiang 3 months ago
parent
commit
5ba4d317a8
  1. 12
      zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java
  2. 12
      zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

12
zc-business/src/main/java/com/zc/business/controller/DcSdhsEventController.java

@ -114,24 +114,36 @@ public class DcSdhsEventController {
@ApiOperation("查询事故多发路段分析")
@PostMapping("/sectionAnalysis")
public AjaxResult sectionAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getStartTime()==null||dcSdhsEventQuery.getEndTime()==null){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(dcSdhsEventService.accidentSectionAnalysis(dcSdhsEventQuery));
}
//事故类型分析
@ApiOperation("查询事故类型分析")
@PostMapping("/typeAnalysis")
public AjaxResult accidentTypeAnalysis(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getStartTime()==null||dcSdhsEventQuery.getEndTime()==null){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(dcSdhsEventService.accidentTypeAnalysis(dcSdhsEventQuery));
}
//事故拥堵时间
@ApiOperation("查询事故拥堵时间分析")
@PostMapping("/congestedTime")
public AjaxResult accidentCongestedTime(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getStartTime()==null||dcSdhsEventQuery.getEndTime()==null){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(dcSdhsEventService.accidentCongestedTime(dcSdhsEventQuery));
}
//事故拥堵地点
@ApiOperation("查询事故拥堵地点分析")
@PostMapping("/congestedLocation")
public AjaxResult accidentCongestedLocation(@RequestBody DcSdhsEventQuery dcSdhsEventQuery){
if (dcSdhsEventQuery.getStartTime()==null||dcSdhsEventQuery.getEndTime()==null){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(dcSdhsEventService.accidentCongestedLocation(dcSdhsEventQuery));
}

12
zc-business/src/main/java/com/zc/business/service/impl/DcSdhsEventServiceImpl.java

@ -188,6 +188,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public Map<String, Integer> accidentSectionAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
if (cacheList == null || cacheList.size() == 0) {
return null;
}
Map<String, Integer> groupCountMap = new HashMap<>();
try {
long startTimeMillis = dcSdhsEventQuery.getStartTime().getTime();
@ -252,6 +255,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public Map<String, Integer> accidentTypeAnalysis(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
if (cacheList == null || cacheList.size() == 0) {
return null;
}
Map<String, Integer> groupCountMap = new HashMap<>();
try {
long startTimeMillis = dcSdhsEventQuery.getStartTime().getTime();
@ -282,6 +288,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public Map<String, Integer> accidentCongestedLocation(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
if (cacheList == null || cacheList.size() == 0) {
return null;
}
Map<String, Integer> groupCountMap = new HashMap<>();
try {
long startTimeMillis = dcSdhsEventQuery.getStartTime().getTime();
@ -318,6 +327,9 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService {
@Override
public Map<String, String> accidentCongestedTime(DcSdhsEventQuery dcSdhsEventQuery) {
List<DcSdhsEvent> cacheList = redisCache.getCacheList(RedisKeyConstants.SDHS_EVENT);
if (cacheList == null || cacheList.size() == 0) {
return null;
}
Map<String, Integer> averageMap = new HashMap<>();
Map<String, Integer> map = new HashMap<>();
Map<String, String> groupCountMap = new HashMap<>();

Loading…
Cancel
Save