Blame view

src/main/java/com/objecteye/controller/SpecialtyVehicleController.java 4.31 KB
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  package com.objecteye.controller;
  
  import com.alibaba.fastjson.JSONObject;
  import com.objecteye.dao.MongoTemplates;
  import com.objecteye.pojo.VehicleCondition;
  import com.objecteye.service.SpecialtyServices;
  import com.objecteye.utils.CustomAssert;
  import com.objecteye.utils.CustomParamCollections;
  import com.objecteye.utils.VehicleEngine;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.*;
  import org.springframework.web.multipart.MultipartFile;
  
  import java.util.Map;
  
  @CrossOrigin
  @RestController
  @RequestMapping("/vehicle")
  public class SpecialtyVehicleController {
      @Autowired
      private MongoTemplates mongoTemplates;
      @Autowired
      private SpecialtyServices specialtyServices;
      @Autowired
      private VehicleEngine vehicleEngine;
  
      /**
       * 通过车牌(支持模糊)、多条件查询车辆信息(平铺)
       *
       * @param vehicleCondition
       * @return
       */
      @RequestMapping("/slagCar/findByCondition")
      public JSONObject findByCondition(@RequestBody VehicleCondition vehicleCondition) {
          //渣土车查询
46d1c007   Liu Haoyu   sun.misc.BASE64De...
36
          return mongoTemplates.findBy(vehicleCondition, 2);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
37
38
39
40
41
42
43
44
45
46
47
48
      }
  
  
      /**
       * 通过图片返回各种车的坐标
       *
       * @param picfile
       * @return
       */
      @RequestMapping("/slagCar/findCoordinateByPic")
      public JSONObject siteByPic(@RequestParam("picfile") MultipartFile picfile, Integer vehicle_special_type_number) {
          //渣土车坐标  vehicle_special_type_number
46d1c007   Liu Haoyu   sun.misc.BASE64De...
49
          return specialtyServices.findCoordinateByPic(picfile, vehicle_special_type_number);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
50
51
52
53
54
55
56
57
58
59
60
61
  
  
      }
  
      /**
       * 通过车辆特征码、时间、地点范围进行搜索
       *
       * @return
       */
      @RequestMapping("/slagCar/findByPic")
      public JSONObject findByPic(@RequestParam int number, @RequestParam double threshold, @RequestParam int currentpage,
                                  @RequestParam int pagevolume, MultipartFile picfile, @RequestParam Long starttime,
fddd4673   Liu Haoyu   去掉设备相关内容;
62
63
                                  @RequestParam Long endtime) throws InterruptedException {
          return specialtyServices.findByPic(number, threshold, currentpage, pagevolume, picfile, starttime, endtime, 2);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
64
65
66
67
68
69
70
71
72
      }
  
      /**
       * 通过id搜索相关车辆
       *
       * @return
       */
      @RequestMapping("/slagCar/findById")
      public JSONObject findById(@RequestBody Map<String, String> map) {
46d1c007   Liu Haoyu   sun.misc.BASE64De...
73
          return specialtyServices.findById(map.get("id"));
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
74
75
76
77
78
79
80
81
82
      }
  
      /**
       * 通过过车序号搜索相关车辆
       *
       * @return
       */
      @RequestMapping("/slagCar/findByGcxh")
      public JSONObject findByGcxh(int gcxh, MultipartFile picfile) {
46d1c007   Liu Haoyu   sun.misc.BASE64De...
83
          return specialtyServices.findByGcxh(gcxh, picfile);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
84
85
      }
  
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
86
87
88
89
90
91
92
93
94
      /**
       * 危化品车
       * 通过车牌(支持模糊)、多条件查询车辆信息(平铺)
       *
       * @return
       */
      @RequestMapping("/chemistryCar/findByCondition")
      public JSONObject chemistryFindByCondition(@RequestBody VehicleCondition vehicleCondition) {
          //危化品车查询
46d1c007   Liu Haoyu   sun.misc.BASE64De...
95
          return mongoTemplates.findBy(vehicleCondition, 1);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
96
97
98
99
100
101
102
103
104
105
106
      }
  
      /**
       * 危化品车
       * 通通过车辆特征码、时间、地点范围进行搜索
       *
       * @return
       */
      @RequestMapping("/chemistryCar/findByPic")
      public JSONObject chemistryFindByPic(@RequestParam int number, @RequestParam Double threshold, @RequestParam int currentpage,
                                           @RequestParam int pagevolume, MultipartFile picfile, @RequestParam Long starttime,
fddd4673   Liu Haoyu   去掉设备相关内容;
107
108
                                           @RequestParam Long endtime) throws InterruptedException {
          return specialtyServices.findByPic(number, threshold, currentpage, pagevolume, picfile, starttime, endtime, 1);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
109
110
111
  
      }
  
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
112
113
114
115
116
117
118
119
120
      /**
       * 测试
       *
       * @return
       */
      @RequestMapping("/chemistryCar/test")
      public JSONObject test(Integer gcxh, @RequestParam("picfile") MultipartFile picfile) {
  
  
46d1c007   Liu Haoyu   sun.misc.BASE64De...
121
          return specialtyServices.findByGcxh(gcxh, picfile);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
122
123
124
  
      }
  
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
125
126
127
128
129
130
131
      /**
       * 测试
       *
       * @return
       */
      @RequestMapping("/getResult")
      public Object getResult(@RequestBody Map<String, Object> body) {
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
132
133
          CustomAssert.checkField(body, CustomParamCollections.VEHICLE_SINGLE_PARAM);
          CustomAssert.checkSimpleMapParam(body, CustomParamCollections.VEHICLE_SINGLE_PARAM);
46d1c007   Liu Haoyu   sun.misc.BASE64De...
134
          return specialtyServices.getColorAndBrand(body);
c83b5b39   Liu Haoyu   项目创建, 集成spring-se...
135
136
      }
  }