Commit 8e622034fdda85d3e87247a464e5313d1327748d

Authored by Liu Haoyu
1 parent fe761a80

配置文件由39修改到117上;

Linux服务器监听运维功能.md
... ... @@ -494,3 +494,65 @@
494 494 }
495 495 ```
496 496  
  497 +## 3.5 sdk控制器
  498 +
  499 +| 调用方式 | 接口地址 |
  500 +| ------------ | :---------------------------------------------- |
  501 +| POST | http://ip:port/background/sdkController |
  502 +| Content-Type | application/json;charset=UTF-8 |
  503 +
  504 +| 请求参数 | | | | |
  505 +| -------------------------------------- | ---------------------------------------------------------- | ------ | ------ | --------------- |
  506 +| 参数项 | 名称 | 类型 | 必选 | 描述 |
  507 +| action | 操作功能 | string | 是 | 操作功能 |
  508 +| vehicle_car_win_detect_config | 是否启动车车窗检测 | int | 是 | 0:关闭 1:开启 |
  509 +| vehicle_recg_config | 是否启动车型识别 | int | 是 | 0:关闭 1:开启 |
  510 +| vehicle_plate_det_recg_config | 是否启动车牌检测识别 | int | 是 | 0:关闭 1:开启 |
  511 +| vehicle_color_config | 是否启动车辆颜色识别 | int | 是 | 0:关闭 1:开启 |
  512 +| vehicle_pendant_det_config | 是否启动车辆属性识别 | int | 是 | 0:关闭 1:开启 |
  513 +| vehicle_illegal_config | 是否启动车违规行为检测 | int | 是 | 0:关闭 1:开启 |
  514 +| vehicle_feature_config | 是否启动车辆特征提取 | long | 是 | 0:关闭 1:开启 |
  515 +| vehicle_special_config | 是否启动特殊品类车型识别 | int | 是 | 0:关闭 1:开启 |
  516 +| gpuId | 显卡号 | int | 显卡号 | 0:关闭 1:开启 |
  517 +| log | 日志 | int | 日志 | 0:关闭 1:开启 |
  518 +| vehicle_image_quality_config | 是否启动车辆图像清晰度识别 | int | 是 | 0:关闭 1:开启 |
  519 +| vehicle_motor_tricycle_analysis_config | 否启动摩托车是否载人/摩托车驾驶人是否戴头盔/农用车是否载人 | int | 是 | 0:关闭 1:开启 |
  520 +| port | 端口号 | int | 是 | 端口号 |
  521 +
  522 +```
  523 +请求示例
  524 +{
  525 + "vehicle_car_win_detect_config": 1,
  526 + "vehicle_recg_config": 1,
  527 + "vehicle_plate_det_recg_config": 1,
  528 + "vehicle_color_config": 1,
  529 + "vehicle_pendant_det_config": 1,
  530 + "vehicle_illegal_config": 1,
  531 + "vehicle_feature_config": 1,
  532 + "vehicle_special_config": 1,
  533 + "gpuId": 3,
  534 + "log": 1,
  535 + "vehicle_image_quality_config": 1,
  536 + "vehicle_motor_tricycle_analysis_config": 1,
  537 + "action": "start",
  538 + "port": 8080
  539 +}
  540 +```
  541 +
  542 +
  543 +| 返回结果 | | | |
  544 +| -------- | -------- | ------ | --------------------------------- |
  545 +| 参数项 | 名称 | 类型 | 描述 |
  546 +| code | 响应码 | int | 200为操作成功,其他code表示失败 |
  547 +| message | 提示信息 | string | 200为操作成功, 其他为对应错误信息 |
  548 +| data | 返回信息 | | |
  549 +
  550 +```
  551 +响应示例
  552 +{
  553 + "code": 200,
  554 + "message": "操作成功",
  555 + "data": null
  556 +}
  557 +```
  558 +
... ...
src/main/java/com/objecteye/controller/BackGroundController.java
... ... @@ -59,4 +59,14 @@ public class BackGroundController {
59 59 }
60 60 return CommonResult.success(syBasicResourceHistories);
61 61 }
  62 +
  63 + @ApiOperation("sdk控制器")
  64 + @RequestMapping(value = "sdkController", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
  65 + public CommonResult sdkController(@RequestBody Map<String, Object> requestMap) {
  66 + JSONObject resultObj = iBackGroundService.sdkController(requestMap);
  67 + if (resultObj.containsKey("error")) {
  68 + return CommonResult.success(201, resultObj.getString("error"), null);
  69 + }
  70 + return CommonResult.success(resultObj);
  71 + }
62 72 }
... ...
src/main/java/com/objecteye/service/IBackGroundService.java
... ... @@ -48,4 +48,12 @@ public interface IBackGroundService {
48 48 * @return 结果集
49 49 */
50 50 List<SyBasicResourceHistory> getModuleInfo(Map<String, Object> requestMap);
  51 +
  52 + /**
  53 + * sdk启动器
  54 + *
  55 + * @param requestMap 请求参数
  56 + * @return 结果集
  57 + */
  58 + JSONObject sdkController(Map<String, Object> requestMap);
51 59 }
... ...
src/main/java/com/objecteye/service/impl/BackGroundServiceImpl.java
... ... @@ -204,5 +204,41 @@ public class BackGroundServiceImpl implements IBackGroundService {
204 204 }
205 205 }
206 206  
207   -
  207 + /**
  208 + * sdk启动器
  209 + *
  210 + * @param requestMap 请求参数
  211 + * @return 结果集
  212 + */
  213 + @Override
  214 + public JSONObject sdkController(Map<String, Object> requestMap) {
  215 + String action = (String) requestMap.getOrDefault("action", "start");
  216 + // 参数校验
  217 + // 是否启动车车窗检测 0:关闭 1:开启
  218 + JSONObject resultObj = new JSONObject();
  219 + String params = "action," +
  220 + "vehicle_car_win_detect_config," +
  221 + "vehicle_recg_config," +
  222 + "vehicle_plate_det_recg_config," +
  223 + "vehicle_color_config," +
  224 + "vehicle_pendant_det_config," +
  225 + "vehicle_illegal_config," +
  226 + "vehicle_feature_config," +
  227 + "vehicle_special_config," +
  228 + "gpuId," +
  229 + "log," +
  230 + "vehicle_image_quality_config," +
  231 + "vehicle_motor_tricycle_analysis_config,port";
  232 + List<String> errorList = new ArrayList<>();
  233 + for (String param : params.split(",")) {
  234 + if (!requestMap.containsKey(param)) {
  235 + errorList.add(param + "参数不能为空");
  236 + }
  237 + }
  238 + if (errorList.size() > 0) {
  239 + resultObj.put("error", String.join(",", errorList));
  240 + return resultObj;
  241 + }
  242 + return resultObj;
  243 + }
208 244 }
... ...