From 9eba8d0c7cbadb31c40e0fe1536b01d5392f1665 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期五, 04 十一月 2022 11:58:08 +0800 Subject: [PATCH] 驾驶舱接口修改 --- ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java | 32 +++++----- document/驾驶舱数据接口文档(ai物联和综合决策).docx | 0 ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java | 28 ++++---- ycl-common/src/main/java/com/ycl/vo/cockpit/CockpitVO.java | 45 ++++++++------ ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java | 20 +++--- ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java | 21 +++--- 6 files changed, 75 insertions(+), 71 deletions(-) diff --git "a/document/\351\251\276\351\251\266\350\210\261\346\225\260\346\215\256\346\216\245\345\217\243\346\226\207\346\241\243\357\274\210ai\347\211\251\350\201\224\345\222\214\347\273\274\345\220\210\345\206\263\347\255\226\357\274\211.docx" "b/document/\351\251\276\351\251\266\350\210\261\346\225\260\346\215\256\346\216\245\345\217\243\346\226\207\346\241\243\357\274\210ai\347\211\251\350\201\224\345\222\214\347\273\274\345\220\210\345\206\263\347\255\226\357\274\211.docx" new file mode 100644 index 0000000..2cc5275 --- /dev/null +++ "b/document/\351\251\276\351\251\266\350\210\261\346\225\260\346\215\256\346\216\245\345\217\243\346\226\207\346\241\243\357\274\210ai\347\211\251\350\201\224\345\222\214\347\273\274\345\220\210\345\206\263\347\255\226\357\274\211.docx" Binary files differ diff --git a/ycl-common/src/main/java/com/ycl/vo/cockpit/CockpitVO.java b/ycl-common/src/main/java/com/ycl/vo/cockpit/CockpitVO.java index 44ef16a..766923c 100644 --- a/ycl-common/src/main/java/com/ycl/vo/cockpit/CockpitVO.java +++ b/ycl-common/src/main/java/com/ycl/vo/cockpit/CockpitVO.java @@ -12,38 +12,43 @@ * @version 1.0 * @date 2022/10/26 */ +@Data +@ApiModel public class CockpitVO { - @Data - @ApiModel - public class Params1VO implements Serializable { - @ApiModelProperty(value = "appId", example = "1") +// @Data +// @ApiModel +// public class Params1VO implements Serializable { +// @ApiModelProperty(value = "appId", example = "1") // @NotBlank(message = "appId涓嶈兘涓虹┖") +// private String appId; +// @ApiModelProperty(value = "appKey", example = "1") +// @NotBlank(message = "appKey涓嶈兘涓虹┖") +// private String appKey; +// @ApiModelProperty(value = "sign", example = "sfagjgfjgfjdgfjsgdfgsa") +// @NotBlank(message = "sign涓嶈兘涓虹┖") +// private String sign; +// } +// +// @Data +// @ApiModel +// public class Params2VO implements Serializable { + @ApiModelProperty(value = "appId", example = "1") + @NotBlank(message = "appId涓嶈兘涓虹┖") private String appId; @ApiModelProperty(value = "appKey", example = "1") -// @NotBlank(message = "appKey涓嶈兘涓虹┖") + @NotBlank(message = "appKey涓嶈兘涓虹┖") private String appKey; @ApiModelProperty(value = "sign", example = "sfagjgfjgfjdgfjsgdfgsa") -// @NotBlank(message = "sign涓嶈兘涓虹┖") + @NotBlank(message = "sign涓嶈兘涓虹┖") private String sign; - } - @Data - @ApiModel - public class Params2VO implements Serializable { - @ApiModelProperty(value = "appId", example = "1") -// @NotBlank(message = "appId涓嶈兘涓虹┖") - private String appId; - @ApiModelProperty(value = "appKey", example = "1") -// @NotBlank(message = "appKey涓嶈兘涓虹┖") - private String appKey; - @ApiModelProperty(value = "sign", example = "sfagjgfjgfjdgfjsgdfgsa") -// @NotBlank(message = "sign涓嶈兘涓虹┖") - private String sign; + @ApiModelProperty(value = "streetId", example = "25") + private Integer streetId; @ApiModelProperty(value = "寮�濮嬫椂闂达紝鏍煎紡yyyy-MM-dd hh:mm:ss", example = "2022-10-22 13:22:22") // @NotBlank(message = "寮�濮嬫椂闂翠笉鑳戒负绌�") private String beginTime; @ApiModelProperty(value = "缁撴潫鏃堕棿锛屾牸寮弝yyy-MM-dd hh:mm:ss", example = "2022-10-23 13:22:22") // @NotBlank(message = "缁撴潫鏃堕棿涓嶈兘涓虹┖") private String endTime; - } +// } } diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java index 178c339..1393455 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/aiIot/AIIotController.java @@ -34,8 +34,8 @@ @ApiOperation(value = "鐩戞祴鏁版嵁") @GetMapping("/detection") - public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); + public CommonResult<AIIotVO.DetectionVO> detection(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); AIIotVO.DetectionVO detectionVO = new AIIotVO.DetectionVO(); detectionVO.setVideo(121); detectionVO.setIndividual(20); @@ -47,9 +47,8 @@ @ApiOperation(value = "瀹炴椂瑙嗛鐩戞帶") @GetMapping("/video") - @ApiImplicitParam(name = "regionId",value = "鍦板尯Id",required = true,dataType = "String") - public CommonResult<List<AIIotVO.VideoVO>> video(@Validated CockpitVO.Params1VO params, @RequestParam(required = true)String regionId) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,regionId); + public CommonResult<List<AIIotVO.VideoVO>> video(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<AIIotVO.VideoVO> videoVOS = new ArrayList<>(); AIIotVO.VideoVO a = null; for (int i = 0; i < 4; i++) { @@ -69,8 +68,8 @@ @ApiOperation(value = "AI绠楁硶鏁堣兘") @GetMapping("/efficiency") - public CommonResult<List<AIIotVO.EfficiencyVO>> efficiency(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<AIIotVO.EfficiencyVO>> efficiency(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<AIIotVO.EfficiencyVO> efficiencyVOS = new ArrayList<>(); AIIotVO.EfficiencyVO a = null; for (int i = 0; i < 4; i++) { @@ -85,8 +84,8 @@ @ApiOperation(value = "娓e湡鑱斿姩") @GetMapping("/slag_car") - public CommonResult<AIIotVO.SlagCarVO> slagCar(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null,null); + public CommonResult<AIIotVO.SlagCarVO> slagCar(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); AIIotVO.SlagCarVO slagCarVO = new AIIotVO.SlagCarVO(); slagCarVO.setCar(236); slagCarVO.setTeam(20); @@ -95,8 +94,8 @@ @ApiOperation(value = "AI浜嬩欢缁熻") @GetMapping("/event_statistics") - public CommonResult<List<AIIotVO.StatisticsVO>> statistics(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<AIIotVO.StatisticsVO>> statistics(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<AIIotVO.StatisticsVO> statisticsVOS = new ArrayList<>(); List<AIIotVO.Statistics1VO> statistics1VOS = new ArrayList<>(); AIIotVO.StatisticsVO a = null; diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java index fb20fd6..5c1624b 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/enforcementEvents/EnforcementEventsController.java @@ -33,8 +33,8 @@ @ApiOperation(value = "鎵ф硶浜嬩欢缁熻") @GetMapping("/statistics") - public CommonResult<Map<String, Object>> statistics(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<Map<String, Object>> statistics(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); Map<String, Object> map = new HashMap<>(); EnforcementEventsVO.StatisticsEventVO eventVO = new EnforcementEventsVO.StatisticsEventVO(); eventVO.setCount(10); @@ -48,8 +48,8 @@ @ApiOperation(value = "浜嬩欢绫诲瀷") @GetMapping("/type") - public CommonResult<EnforcementEventsVO.TypeAndSourceVO> type(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<EnforcementEventsVO.TypeAndSourceVO> type(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>(); EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO(); EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null; @@ -67,8 +67,8 @@ @ApiOperation(value = "瑙嗛鎶撴媿鍛婂彂鐐逛綅") @GetMapping("/video") - public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> video(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> video(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>(); EnforcementEventsVO.VideoAndAreaVO videoVO = null; for (int i = 0; i < 4; i++) { @@ -83,8 +83,8 @@ @ApiOperation(value = "浜嬩欢鏉ユ簮") @GetMapping("/source") - public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<EnforcementEventsVO.TypeAndSourceVO> source(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<EnforcementEventsVO.TypeAndSourceVO1> typeVO1s = new ArrayList<>(); EnforcementEventsVO.TypeAndSourceVO typeVO = new EnforcementEventsVO.TypeAndSourceVO(); EnforcementEventsVO.TypeAndSourceVO1 typeVO1 = null; @@ -102,8 +102,8 @@ @ApiOperation(value = "浜嬩欢鍖哄煙缁熻") @GetMapping("/area") - public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> area(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<EnforcementEventsVO.VideoAndAreaVO>> area(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<EnforcementEventsVO.VideoAndAreaVO> videoVOS = new ArrayList<>(); EnforcementEventsVO.VideoAndAreaVO videoVO = null; for (int i = 0; i < 4; i++) { @@ -117,8 +117,8 @@ @ApiOperation(value = "寤惰浜嬩欢") @GetMapping("/delay") - public CommonResult<List<EnforcementEventsVO.DelayVO>> delay(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<List<EnforcementEventsVO.DelayVO>> delay(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<EnforcementEventsVO.DelayVO> delayVOS = new ArrayList<>(); EnforcementEventsVO.DelayVO delayVO = null; for (int i = 0; i < 4; i++) { @@ -133,8 +133,8 @@ @ApiOperation(value = "浜嬩欢淇℃伅") @GetMapping("/info") - public CommonResult<EnforcementEventsVO.InfoVO> info(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(),null); + public CommonResult<EnforcementEventsVO.InfoVO> info(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); EnforcementEventsVO.InfoVO infoVO = new EnforcementEventsVO.InfoVO(); EnforcementEventsVO.EventVO eventVO = new EnforcementEventsVO.EventVO(); infoVO.setToday(5); diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java index 3762499..4a83fe3 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/statisticsEvents/StatisticsEventsController.java @@ -33,8 +33,8 @@ @ApiOperation(value = "鎵ф硶浜嬩欢") @GetMapping("/law_enforcement_event") - public CommonResult<List<StatisticsEventsVO.LawEnforcementEventVO>> detection(@Validated CockpitVO.Params2VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), params.getBeginTime(), params.getEndTime(), null); + public CommonResult<List<StatisticsEventsVO.LawEnforcementEventVO>> detection(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<StatisticsEventsVO.LawEnforcementEventVO> lawEnforcementEventVOS = new ArrayList<>(); StatisticsEventsVO.LawEnforcementEventVO a = null; for (int i = 0; i < 4; i++) { @@ -50,8 +50,8 @@ @ApiOperation(value = "鐗╄仈鎰熺煡") @GetMapping("/lot") - public CommonResult<List<StatisticsEventsVO.LotVO>> lot(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null, null); + public CommonResult<List<StatisticsEventsVO.LotVO>> lot(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<StatisticsEventsVO.LotVO> lotVOS = new ArrayList<>(); StatisticsEventsVO.LotVO a = null; for (int i = 0; i < 4; i++) { @@ -67,8 +67,8 @@ @ApiOperation(value = "鎵ф硶闃熶紞") @GetMapping("/team") - public CommonResult<StatisticsEventsVO.TeamVO> team(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null, null); + public CommonResult<StatisticsEventsVO.TeamVO> team(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); StatisticsEventsVO.TeamVO teamVO = new StatisticsEventsVO.TeamVO(); teamVO.setAll(30); teamVO.setAssistant(10); @@ -81,8 +81,8 @@ @ApiOperation(value = "缃戞牸鍛�") @GetMapping("/grid_member") - public CommonResult<List<StatisticsEventsVO.GridMemberVO>> gridMember(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null, null); + public CommonResult<List<StatisticsEventsVO.GridMemberVO>> gridMember(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); List<StatisticsEventsVO.GridMemberVO> gridMemberVOS = new ArrayList<>(); StatisticsEventsVO.GridMemberVO a = null; for (int i = 0; i < 4; i++) { @@ -97,8 +97,8 @@ @ApiOperation(value = "鎸囨暟浣撳緛") @GetMapping("/index_signs") - public CommonResult<StatisticsEventsVO.IndexSignsVO> indexSigns(@Validated CockpitVO.Params1VO params) { - checkApiUtil.cockpit(params.getAppId(), params.getAppKey(), params.getSign(), null, null, null); + public CommonResult<StatisticsEventsVO.IndexSignsVO> indexSigns(@Validated CockpitVO params) { + checkApiUtil.cockpit(params); StatisticsEventsVO.IndexSignsVO indexSignsVO = new StatisticsEventsVO.IndexSignsVO(); indexSignsVO.setEvent(1); indexSignsVO.setGridMember(20); diff --git a/ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java b/ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java index ccb60d5..ac78bc5 100644 --- a/ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java +++ b/ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java @@ -4,6 +4,7 @@ import com.ycl.exception.ApiException; import com.ycl.service.apiKey.IApiKeyService; import com.ycl.utils.MD5Util; +import com.ycl.vo.cockpit.CockpitVO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -23,28 +24,27 @@ /** * 椹鹃┒鑸� * - * @param appId appId - * @param appKey appKey - * @param sign sign - * @param beginTime 寮�濮嬫椂闂� - * @param endTime 缁撴潫鏃堕棿 - * @param regionId 鍖哄煙Id + * @param params */ - public void cockpit(String appId, String appKey, String sign, String beginTime, String endTime, String regionId) { - apiKeyService.checkIsExist(appId, appKey, "椹鹃┒浠�"); + public void cockpit(CockpitVO params) { + apiKeyService.checkIsExist(params.getAppId(), params.getAppKey(), "椹鹃┒浠�"); StringBuffer sb = new StringBuffer(); - sb.append(appId); - sb.append(appKey); + sb.append("appId="); + sb.append(params.getAppId()); + sb.append("&appKey="); + sb.append(params.getAppKey()); String result; - if (!StringUtils.isBlank(beginTime) && !StringUtils.isBlank(endTime)) { - sb.append(beginTime); - sb.append(endTime); + if (!StringUtils.isBlank(params.getBeginTime()) && !StringUtils.isBlank(params.getEndTime())) { + sb.append("&beginTime="); + sb.append(params.getBeginTime()); + sb.append("&endTime="); + sb.append(params.getEndTime()); } - if (!StringUtils.isBlank(regionId)) { - sb.append(regionId); + if (params.getStreetId() != null) { + sb.append(params.getStreetId()); } result = MD5Util.md5Encrypt32Lower(sb.toString()); - if (!sign.equals(result)) { + if (!params.getSign().equals(result)) { throw new ApiException(ResultCode.SIGN_ERROR); } } -- Gitblit v1.8.0