Commit 68a67f360760778338ba090944003b5b18ae6591
1 parent
fddd4673
接口问题处理;
Showing
35 changed files
with
91 additions
and
277 deletions
.gitignore
pom.xml
@@ -117,7 +117,11 @@ | @@ -117,7 +117,11 @@ | ||
117 | <dependency> | 117 | <dependency> |
118 | <groupId>com.alibaba</groupId> | 118 | <groupId>com.alibaba</groupId> |
119 | <artifactId>fastjson</artifactId> | 119 | <artifactId>fastjson</artifactId> |
120 | - <version>1.2.54</version> | 120 | + <version>1.2.57</version> |
121 | + </dependency> | ||
122 | + <dependency> | ||
123 | + <groupId>commons-codec</groupId> | ||
124 | + <artifactId>commons-codec</artifactId> | ||
121 | </dependency> | 125 | </dependency> |
122 | <dependency> | 126 | <dependency> |
123 | <groupId>org.apache.httpcomponents</groupId> | 127 | <groupId>org.apache.httpcomponents</groupId> |
src/main/java/com/objecteye/VehicleApplication.java
@@ -10,10 +10,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; | @@ -10,10 +10,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; | ||
10 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; | 10 | import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; |
11 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; | 11 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
12 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | 12 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
13 | -import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
14 | 13 | ||
15 | @SpringBootApplication | 14 | @SpringBootApplication |
16 | -@EnableTransactionManagement | ||
17 | @EnableScheduling | 15 | @EnableScheduling |
18 | @EnableWebSecurity | 16 | @EnableWebSecurity |
19 | @EnableGlobalMethodSecurity(prePostEnabled = true) | 17 | @EnableGlobalMethodSecurity(prePostEnabled = true) |
src/main/java/com/objecteye/config/AuthenticationHeadFilter.java
@@ -40,6 +40,7 @@ public class AuthenticationHeadFilter extends OncePerRequestFilter { | @@ -40,6 +40,7 @@ public class AuthenticationHeadFilter extends OncePerRequestFilter { | ||
40 | String claims = jwt.getClaims(); | 40 | String claims = jwt.getClaims(); |
41 | user = JSON.parseObject(claims, TokenUser.class); | 41 | user = JSON.parseObject(claims, TokenUser.class); |
42 | } catch (Exception e) { | 42 | } catch (Exception e) { |
43 | + e.printStackTrace(); | ||
43 | httpServletResponse.setContentType("application/json;charset=UTF-8"); | 44 | httpServletResponse.setContentType("application/json;charset=UTF-8"); |
44 | httpServletResponse.getWriter().write("Useless token..."); | 45 | httpServletResponse.getWriter().write("Useless token..."); |
45 | return; | 46 | return; |
src/main/java/com/objecteye/controller/DeployController.java
@@ -155,7 +155,7 @@ public class DeployController { | @@ -155,7 +155,7 @@ public class DeployController { | ||
155 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 155 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
156 | public CommonResult delete(@RequestBody Map<String, Object> map) { | 156 | public CommonResult delete(@RequestBody Map<String, Object> map) { |
157 | try { | 157 | try { |
158 | - String[] ids = (String[]) map.get("ids"); | 158 | + List<String> ids = (List<String>) map.get("ids"); |
159 | deployService.delete(ids); | 159 | deployService.delete(ids); |
160 | return CommonResult.success("操作成功"); | 160 | return CommonResult.success("操作成功"); |
161 | } catch (Exception e) { | 161 | } catch (Exception e) { |
src/main/java/com/objecteye/controller/FeatureController.java
@@ -99,7 +99,7 @@ public class FeatureController { | @@ -99,7 +99,7 @@ public class FeatureController { | ||
99 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 99 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
100 | public CommonResult delete(@RequestBody Map<String, Object> map) { | 100 | public CommonResult delete(@RequestBody Map<String, Object> map) { |
101 | try { | 101 | try { |
102 | - String[] ids = (String[]) map.get("ids"); | 102 | + List<String> ids = (List<String>) map.get("ids"); |
103 | featureService.delete(ids); | 103 | featureService.delete(ids); |
104 | return CommonResult.success("操作成功"); | 104 | return CommonResult.success("操作成功"); |
105 | } catch (RuntimeException e) { | 105 | } catch (RuntimeException e) { |
src/main/java/com/objecteye/controller/PersonnelController.java
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
12 | import org.springframework.web.multipart.MultipartFile; | 12 | import org.springframework.web.multipart.MultipartFile; |
13 | 13 | ||
14 | +import java.util.List; | ||
14 | import java.util.Map; | 15 | import java.util.Map; |
15 | 16 | ||
16 | 17 | ||
@@ -98,7 +99,7 @@ public class PersonnelController { | @@ -98,7 +99,7 @@ public class PersonnelController { | ||
98 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 99 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
99 | public CommonResult delete(@RequestBody Map<String, Object> map) { | 100 | public CommonResult delete(@RequestBody Map<String, Object> map) { |
100 | try { | 101 | try { |
101 | - String[] ids = (String[]) map.get("ids"); | 102 | + List<String> ids = (List<String>) map.get("ids"); |
102 | personnelService.delete(ids); | 103 | personnelService.delete(ids); |
103 | return CommonResult.success("操作成功"); | 104 | return CommonResult.success("操作成功"); |
104 | } catch (Exception e) { | 105 | } catch (Exception e) { |
src/main/java/com/objecteye/controller/UploadFileController.java
1 | package com.objecteye.controller; | 1 | package com.objecteye.controller; |
2 | 2 | ||
3 | import com.objecteye.common.CommonResult; | 3 | import com.objecteye.common.CommonResult; |
4 | +import com.objecteye.service.IUploadFileService; | ||
4 | import com.objecteye.utils.GlobalUtil; | 5 | import com.objecteye.utils.GlobalUtil; |
5 | import io.swagger.annotations.Api; | 6 | import io.swagger.annotations.Api; |
6 | import io.swagger.annotations.ApiOperation; | 7 | import io.swagger.annotations.ApiOperation; |
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
8 | import org.springframework.web.multipart.MultipartFile; | 10 | import org.springframework.web.multipart.MultipartFile; |
9 | 11 | ||
12 | +import java.io.IOException; | ||
13 | + | ||
10 | @RestController | 14 | @RestController |
11 | @RequestMapping("uploadDbMongo") | 15 | @RequestMapping("uploadDbMongo") |
12 | @Api(value = "UploadFileController", description = "上传文件解析保存到mongo库,代替ftp") | 16 | @Api(value = "UploadFileController", description = "上传文件解析保存到mongo库,代替ftp") |
13 | @CrossOrigin | 17 | @CrossOrigin |
14 | -public class UploadFileController { | 18 | +public class UploadFileController extends BasicController { |
19 | + | ||
20 | + @Autowired | ||
21 | + private IUploadFileService iUploadFileService; | ||
15 | 22 | ||
16 | @ApiOperation("上传文件到mongo") | 23 | @ApiOperation("上传文件到mongo") |
17 | @RequestMapping(value = "uploadToMongo", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE) | 24 | @RequestMapping(value = "uploadToMongo", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE) |
18 | - public CommonResult uploadToMongo(@RequestParam MultipartFile multipartFile) { | ||
19 | - return CommonResult.success(""); | 25 | + public CommonResult uploadToMongo(@RequestParam MultipartFile multipartFile) throws IOException { |
26 | + return jsonObjectResultHandle(iUploadFileService.uploadFile2Mongo(multipartFile)); | ||
20 | } | 27 | } |
21 | } | 28 | } |
src/main/java/com/objecteye/controller/VehicleController.java
@@ -57,10 +57,9 @@ public class VehicleController { | @@ -57,10 +57,9 @@ public class VehicleController { | ||
57 | */ | 57 | */ |
58 | @ApiOperation("批量删除") | 58 | @ApiOperation("批量删除") |
59 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 59 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
60 | - public CommonResult delete(@RequestBody Map<String, String[]> map) { | 60 | + public CommonResult delete(@RequestBody Map<String, Object> map) { |
61 | try { | 61 | try { |
62 | - String[] ids = map.get("ids"); | ||
63 | - //int vehicleId= (int) map.get("vehicleId"); | 62 | + List<String> ids = (List<String>) map.get("ids"); |
64 | vehicleService.delete(ids); | 63 | vehicleService.delete(ids); |
65 | return CommonResult.success("操作成功"); | 64 | return CommonResult.success("操作成功"); |
66 | } catch (Exception e) { | 65 | } catch (Exception e) { |
src/main/java/com/objecteye/controller/VehicleDbController.java
@@ -99,7 +99,7 @@ public class VehicleDbController { | @@ -99,7 +99,7 @@ public class VehicleDbController { | ||
99 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 99 | @RequestMapping(value = "/delete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
100 | public CommonResult delete(@RequestBody Map<String, Object> map) { | 100 | public CommonResult delete(@RequestBody Map<String, Object> map) { |
101 | try { | 101 | try { |
102 | - String[] ids = (String[]) map.get("ids"); | 102 | + List<String> ids = (List<String>) map.get("ids"); |
103 | vehicleDbService.delete(ids); | 103 | vehicleDbService.delete(ids); |
104 | return CommonResult.success(""); | 104 | return CommonResult.success(""); |
105 | } catch (Exception e) { | 105 | } catch (Exception e) { |
src/main/java/com/objecteye/controller/VehicleViolationsController.java
@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation; | @@ -10,6 +10,7 @@ import io.swagger.annotations.ApiOperation; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
12 | 12 | ||
13 | +import java.util.List; | ||
13 | import java.util.Map; | 14 | import java.util.Map; |
14 | 15 | ||
15 | @CrossOrigin | 16 | @CrossOrigin |
@@ -85,8 +86,8 @@ public class VehicleViolationsController { | @@ -85,8 +86,8 @@ public class VehicleViolationsController { | ||
85 | */ | 86 | */ |
86 | @ApiOperation("禁行任务维护- 删除接口") | 87 | @ApiOperation("禁行任务维护- 删除接口") |
87 | @RequestMapping(value = "forbiddenTaskDelete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) | 88 | @RequestMapping(value = "forbiddenTaskDelete", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
88 | - public CommonResult forbiddenTaskDelete(@RequestBody Map<String, String[]> queryParams) { | ||
89 | - String[] ids = queryParams.get("ids"); | 89 | + public CommonResult forbiddenTaskDelete(@RequestBody Map<String, Object> queryParams) { |
90 | + List<String> ids = (List<String>) queryParams.get("ids"); | ||
90 | int resultStatus = vehicleViolationsService.forbiddenTaskDelete(ids); | 91 | int resultStatus = vehicleViolationsService.forbiddenTaskDelete(ids); |
91 | return resultStatus > 0 ? CommonResult.success("success") : CommonResult.success(201, "操作失败", 0); | 92 | return resultStatus > 0 ? CommonResult.success("success") : CommonResult.success(201, "操作失败", 0); |
92 | } | 93 | } |
src/main/java/com/objecteye/dao/MongoTemplates.java.old deleted
1 | -package com.objecteye.dao; | ||
2 | - | ||
3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
4 | -import org.springframework.data.mongodb.core.MongoTemplate; | ||
5 | -import org.springframework.data.mongodb.core.geo.GeoJson; | ||
6 | -import org.springframework.data.mongodb.core.query.Criteria; | ||
7 | -import org.springframework.stereotype.Component; | ||
8 | - | ||
9 | -import java.util.List; | ||
10 | - | ||
11 | -@Component | ||
12 | -public class MongoTemplates { | ||
13 | - @Autowired | ||
14 | - private MongoTemplate mongoTemplate; | ||
15 | - | ||
16 | - public void save(Polygon polygon){ | ||
17 | - mongoTemplate.save(polygon); | ||
18 | - } | ||
19 | - | ||
20 | - public void saveRegions(List<GisRegion> gisRegionList){ | ||
21 | - mongoTemplate.insert(gisRegionList,GisRegion.class); | ||
22 | - } | ||
23 | - | ||
24 | - public <T> T findById(Class<T> entityClass, String id) { | ||
25 | - return mongoTemplate.findById(id, entityClass); | ||
26 | - } | ||
27 | - | ||
28 | - public <T> List<T> findAll(Class<T> entityClass) { | ||
29 | - return mongoTemplate.findAll(entityClass); | ||
30 | - } | ||
31 | - | ||
32 | - public <T> void remove(T entity) { | ||
33 | - mongoTemplate.remove(entity); | ||
34 | - } | ||
35 | - | ||
36 | - public <T> void add(T entity) { | ||
37 | - mongoTemplate.insert(entity); | ||
38 | - } | ||
39 | - | ||
40 | - public <T> void addAll(List<T> entity) { | ||
41 | - mongoTemplate.insertAll(entity); | ||
42 | - } | ||
43 | - | ||
44 | - public <T> void saveOrUpdate(T entity) { | ||
45 | - mongoTemplate.save(entity); | ||
46 | - } | ||
47 | - | ||
48 | - public <T> T findOne(Class<T> entityClass) { | ||
49 | - return mongoTemplate.findOne(new Query(), entityClass); | ||
50 | - } | ||
51 | - | ||
52 | - public List<Polygon> findIntersective(GeoJson geoJson){ | ||
53 | - Query query=new Query(Criteria.where("geometry").intersects(geoJson)); | ||
54 | - List<Polygon> list=mongoTemplate.find(query,Polygon.class); | ||
55 | - return list; | ||
56 | - } | ||
57 | - | ||
58 | - public boolean isExistIntersective(GeoJson geoJson){ | ||
59 | - Query query=new Query(Criteria.where("geometry").intersects(geoJson).and("_id").is(100000)); | ||
60 | - boolean res=mongoTemplate.exists(query,GisRegion.class); | ||
61 | - return res; | ||
62 | - } | ||
63 | - | ||
64 | - /*public <T> T findBy(Class<T> entityClass, String id) { | ||
65 | - | ||
66 | - Criteria cri = new Criteria(); | ||
67 | - // 设置条件(注意:设置查询的值类型必须和mongodb中类型一致) | ||
68 | - cri.and("status").is("0"); // 类型为String,类似sql中 status = '0' | ||
69 | - cri.and("boolRelation").is(0D); // 类型为Double,类似sql中 boolRelation = 0 | ||
70 | - cri.and("enforType").regex("01.*"); // 正则表达匹配,类似右模糊查询,sql中 like '01%' | ||
71 | - | ||
72 | - // lt gt lte gte | ||
73 | - | ||
74 | - return null; | ||
75 | - }*/ | ||
76 | - | ||
77 | - //mongodb查询根据指定条件对象 | ||
78 | - /* public <T> T findQuery(Class<T> entityClass, BasicDBObject basicDBObject) { | ||
79 | - // 分、 排序、按时间查询 | ||
80 | - | ||
81 | - Query query = new Query(); | ||
82 | - //必须条件 | ||
83 | - // Criteria c = Criteria.where("VINID").is(Map.get(vin)); | ||
84 | - Criteria c = new Criteria(); | ||
85 | - //范围条件 | ||
86 | - if (!StringUtils.isEmpty(start) && StringUtils.isEmpty(end)) { | ||
87 | - c.and("TIME1").gte(GetTime1(start)); | ||
88 | - } else if (StringUtils.isEmpty(start) && !StringUtils.isEmpty(end)) { | ||
89 | - c.and("TIME1").lte(GetTime1(end)); | ||
90 | - } else if (!StringUtils.isEmpty(start) && !StringUtils.isEmpty(end)) { | ||
91 | - //对同一个属性加两次限制需这样操作 | ||
92 | - c.andOperator( | ||
93 | - c.where("TIME1").gte(GetTime1(start)), | ||
94 | - c.where("TIME1").lte(GetTime1(end)) | ||
95 | - ); | ||
96 | - } | ||
97 | - query.addCriteria(c); | ||
98 | - //总数 | ||
99 | - int num = (int) mongoTemplate.count(query, CarDataEx.class, "jmevTest"); | ||
100 | - System.out.println("总数:" + num); | ||
101 | - //分页 | ||
102 | - query.skip((page - 1) * rows).limit(rows); | ||
103 | - //排序 | ||
104 | - query.with(new Sort(Sort.Direction.DESC, "TIME1","TIME2")); | ||
105 | - //query.with(new Sort(properties)); | ||
106 | - List<T> jmevTest = (List<T>) mongoTemplate.find(query, CarDataEx.class, "jmevTest"); | ||
107 | - }*/ | ||
108 | - | ||
109 | -} |
src/main/java/com/objecteye/entity/SyDeploy.java
@@ -32,9 +32,6 @@ public class SyDeploy implements Serializable { | @@ -32,9 +32,6 @@ public class SyDeploy implements Serializable { | ||
32 | 32 | ||
33 | private String description; | 33 | private String description; |
34 | 34 | ||
35 | - @ApiModelProperty(value = "布控设备id以逗号分隔") | ||
36 | - private String deployEquip; | ||
37 | - | ||
38 | @ApiModelProperty(value = "布控库") | 35 | @ApiModelProperty(value = "布控库") |
39 | private String deployLib; | 36 | private String deployLib; |
40 | 37 | ||
@@ -54,10 +51,6 @@ public class SyDeploy implements Serializable { | @@ -54,10 +51,6 @@ public class SyDeploy implements Serializable { | ||
54 | 51 | ||
55 | @ApiModelProperty(value = "人像/车辆id") | 52 | @ApiModelProperty(value = "人像/车辆id") |
56 | private String singleId; | 53 | private String singleId; |
57 | - /** | ||
58 | - * 设备名称 | ||
59 | - */ | ||
60 | - private String areaName; | ||
61 | 54 | ||
62 | private static final long serialVersionUID = 1L; | 55 | private static final long serialVersionUID = 1L; |
63 | } | 56 | } |
64 | \ No newline at end of file | 57 | \ No newline at end of file |
src/main/java/com/objecteye/entity/SyVehicleForbidenTask.java
@@ -19,7 +19,7 @@ public class SyVehicleForbidenTask implements Serializable { | @@ -19,7 +19,7 @@ public class SyVehicleForbidenTask implements Serializable { | ||
19 | private static final long serialVersionUID = -8007441463935902798L; | 19 | private static final long serialVersionUID = -8007441463935902798L; |
20 | 20 | ||
21 | @ApiModelProperty(value = "任务id, 自增主键") | 21 | @ApiModelProperty(value = "任务id, 自增主键") |
22 | - private Integer id; | 22 | + private String id; |
23 | 23 | ||
24 | @ApiModelProperty(value = "任务名称") | 24 | @ApiModelProperty(value = "任务名称") |
25 | private String name; | 25 | private String name; |
src/main/java/com/objecteye/pojo/RabbitMqVehicleViolation.java
@@ -48,9 +48,5 @@ public class RabbitMqVehicleViolation implements Serializable { | @@ -48,9 +48,5 @@ public class RabbitMqVehicleViolation implements Serializable { | ||
48 | /** | 48 | /** |
49 | * 是否违规 | 49 | * 是否违规 |
50 | */ | 50 | */ |
51 | - private Integer taskId; | ||
52 | - /** | ||
53 | - * 设备名称 | ||
54 | - */ | ||
55 | - private String equipmentName; | 51 | + private String taskId; |
56 | } | 52 | } |
src/main/java/com/objecteye/service/DeployService.java
src/main/java/com/objecteye/service/FeatureService.java
src/main/java/com/objecteye/service/IVehicleViolationsService.java
@@ -5,6 +5,8 @@ import com.objecteye.entity.SyVehicleForbidenTask; | @@ -5,6 +5,8 @@ import com.objecteye.entity.SyVehicleForbidenTask; | ||
5 | import com.objecteye.entity.VehicleViolationsForbidenTaskQueryParams; | 5 | import com.objecteye.entity.VehicleViolationsForbidenTaskQueryParams; |
6 | import com.objecteye.pojo.RabbitMQVehicle; | 6 | import com.objecteye.pojo.RabbitMQVehicle; |
7 | 7 | ||
8 | +import java.util.List; | ||
9 | + | ||
8 | /** | 10 | /** |
9 | * 车辆违规模块 | 11 | * 车辆违规模块 |
10 | * | 12 | * |
@@ -52,7 +54,7 @@ public interface IVehicleViolationsService { | @@ -52,7 +54,7 @@ public interface IVehicleViolationsService { | ||
52 | * @param ids 请求参数 | 54 | * @param ids 请求参数 |
53 | * @return 结果集 | 55 | * @return 结果集 |
54 | */ | 56 | */ |
55 | - int forbiddenTaskDelete(String[] ids); | 57 | + int forbiddenTaskDelete(List<String> ids); |
56 | 58 | ||
57 | /** | 59 | /** |
58 | * 布控任务监控 | 60 | * 布控任务监控 |
src/main/java/com/objecteye/service/PersonnelService.java
src/main/java/com/objecteye/service/VehicleDbService.java
src/main/java/com/objecteye/service/VehicleService.java
@@ -20,7 +20,7 @@ public interface VehicleService { | @@ -20,7 +20,7 @@ public interface VehicleService { | ||
20 | */ | 20 | */ |
21 | PageResult findPage(int vehicleId, String picName, int pageNum, int pageSize); | 21 | PageResult findPage(int vehicleId, String picName, int pageNum, int pageSize); |
22 | 22 | ||
23 | - void delete(String[] ids); | 23 | + void delete(List<String> ids); |
24 | 24 | ||
25 | void update(UploadVehicleDbResult uploadVehicleDbResult); | 25 | void update(UploadVehicleDbResult uploadVehicleDbResult); |
26 | 26 |
src/main/java/com/objecteye/service/impl/DeployServiceImpl.java
@@ -19,10 +19,10 @@ import org.springframework.data.mongodb.core.aggregation.Aggregation; | @@ -19,10 +19,10 @@ import org.springframework.data.mongodb.core.aggregation.Aggregation; | ||
19 | import org.springframework.data.mongodb.core.aggregation.AggregationResults; | 19 | import org.springframework.data.mongodb.core.aggregation.AggregationResults; |
20 | import org.springframework.data.mongodb.core.query.Criteria; | 20 | import org.springframework.data.mongodb.core.query.Criteria; |
21 | import org.springframework.data.mongodb.core.query.Query; | 21 | import org.springframework.data.mongodb.core.query.Query; |
22 | +import org.springframework.data.mongodb.core.query.Update; | ||
22 | import org.springframework.data.redis.core.RedisTemplate; | 23 | import org.springframework.data.redis.core.RedisTemplate; |
23 | import org.springframework.scheduling.annotation.Scheduled; | 24 | import org.springframework.scheduling.annotation.Scheduled; |
24 | -import org.springframework.stereotype.Service; | ||
25 | -import org.springframework.transaction.annotation.Transactional; | 25 | +import org.springframework.stereotype.Component; |
26 | 26 | ||
27 | import java.math.BigDecimal; | 27 | import java.math.BigDecimal; |
28 | import java.math.RoundingMode; | 28 | import java.math.RoundingMode; |
@@ -35,7 +35,7 @@ import java.util.stream.Collectors; | @@ -35,7 +35,7 @@ import java.util.stream.Collectors; | ||
35 | * | 35 | * |
36 | * @author Administrator | 36 | * @author Administrator |
37 | */ | 37 | */ |
38 | -@Service | 38 | +@Component |
39 | @Slf4j | 39 | @Slf4j |
40 | public class DeployServiceImpl implements DeployService { | 40 | public class DeployServiceImpl implements DeployService { |
41 | @Autowired | 41 | @Autowired |
@@ -60,6 +60,9 @@ public class DeployServiceImpl implements DeployService { | @@ -60,6 +60,9 @@ public class DeployServiceImpl implements DeployService { | ||
60 | @Override | 60 | @Override |
61 | public Integer cancelOrReNewDeployTask(int deployId) { | 61 | public Integer cancelOrReNewDeployTask(int deployId) { |
62 | SyDeploy syDeploy = mongoTemplate.findOne(Query.query(Criteria.where("id").is(deployId)), SyDeploy.class); | 62 | SyDeploy syDeploy = mongoTemplate.findOne(Query.query(Criteria.where("id").is(deployId)), SyDeploy.class); |
63 | + if (syDeploy == null) { | ||
64 | + throw new RuntimeException("未找到对应布控任务"); | ||
65 | + } | ||
63 | Integer status = syDeploy.getStatus(); | 66 | Integer status = syDeploy.getStatus(); |
64 | if (status == 0) { | 67 | if (status == 0) { |
65 | syDeploy.setStatus(1); | 68 | syDeploy.setStatus(1); |
@@ -196,7 +199,6 @@ public class DeployServiceImpl implements DeployService { | @@ -196,7 +199,6 @@ public class DeployServiceImpl implements DeployService { | ||
196 | * | 199 | * |
197 | * @param syDeploy | 200 | * @param syDeploy |
198 | */ | 201 | */ |
199 | - @Transactional(rollbackFor = Exception.class) | ||
200 | @Override | 202 | @Override |
201 | public void add(SyDeploy syDeploy) { | 203 | public void add(SyDeploy syDeploy) { |
202 | // 处理前端传递的时间戳 | 204 | // 处理前端传递的时间戳 |
@@ -220,7 +222,6 @@ public class DeployServiceImpl implements DeployService { | @@ -220,7 +222,6 @@ public class DeployServiceImpl implements DeployService { | ||
220 | 222 | ||
221 | syDeploy.setDeployLib(featureIds); | 223 | syDeploy.setDeployLib(featureIds); |
222 | 224 | ||
223 | - syDeploy.setSingleId(syDeploy.getDeployEquip()); | ||
224 | mongoTemplate.insert(syDeploy); | 225 | mongoTemplate.insert(syDeploy); |
225 | String deployId = syDeploy.getId(); | 226 | String deployId = syDeploy.getId(); |
226 | // 布控库中每一条数据都放到redis中 | 227 | // 布控库中每一条数据都放到redis中 |
@@ -275,7 +276,6 @@ public class DeployServiceImpl implements DeployService { | @@ -275,7 +276,6 @@ public class DeployServiceImpl implements DeployService { | ||
275 | } | 276 | } |
276 | 277 | ||
277 | @Override | 278 | @Override |
278 | - @Transactional(rollbackFor = Exception.class) | ||
279 | public void update(SyDeploy deploy) { | 279 | public void update(SyDeploy deploy) { |
280 | // 处理前端传递的时间戳 | 280 | // 处理前端传递的时间戳 |
281 | makeTimeLongToTimeStr(deploy); | 281 | makeTimeLongToTimeStr(deploy); |
@@ -304,7 +304,7 @@ public class DeployServiceImpl implements DeployService { | @@ -304,7 +304,7 @@ public class DeployServiceImpl implements DeployService { | ||
304 | redisTemplate.opsForHash().put(GlobalUtil.DEPLOY_TYPE, deployId, deployType); | 304 | redisTemplate.opsForHash().put(GlobalUtil.DEPLOY_TYPE, deployId, deployType); |
305 | redisTemplate.opsForHash().put(GlobalUtil.DEPLOYIDANDENDTIME, deployId, endTime); | 305 | redisTemplate.opsForHash().put(GlobalUtil.DEPLOYIDANDENDTIME, deployId, endTime); |
306 | 306 | ||
307 | - mongoTemplate.save(deploy, "syDeploy"); | 307 | + mongoTemplate.save(deploy); |
308 | } | 308 | } |
309 | 309 | ||
310 | /** | 310 | /** |
@@ -350,12 +350,10 @@ public class DeployServiceImpl implements DeployService { | @@ -350,12 +350,10 @@ public class DeployServiceImpl implements DeployService { | ||
350 | * @param ids | 350 | * @param ids |
351 | */ | 351 | */ |
352 | @Override | 352 | @Override |
353 | - public void delete(String[] ids) { | 353 | + public void delete(List<String> ids) { |
354 | for (String id : ids) { | 354 | for (String id : ids) { |
355 | - SyDeploy syDeploy = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), SyDeploy.class); | ||
356 | - syDeploy.setIsDelete(1); | ||
357 | deleteRedisWhenUpdateDeploy(id); | 355 | deleteRedisWhenUpdateDeploy(id); |
358 | - mongoTemplate.save(syDeploy); | 356 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").is(id)), Update.update("isDelete", 1), SyDeploy.class); |
359 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOY_LIB, id); | 357 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOY_LIB, id); |
360 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOY_TYPE, id); | 358 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOY_TYPE, id); |
361 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOYIDANDENDTIME, id); | 359 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOYIDANDENDTIME, id); |
@@ -534,12 +532,7 @@ public class DeployServiceImpl implements DeployService { | @@ -534,12 +532,7 @@ public class DeployServiceImpl implements DeployService { | ||
534 | mongoTemplate.save(syDeploy); | 532 | mongoTemplate.save(syDeploy); |
535 | } | 533 | } |
536 | } else if (currentTimeStamp > deployEndTimeStamp) { | 534 | } else if (currentTimeStamp > deployEndTimeStamp) { |
537 | - SyDeploy syDeploy = mongoTemplate.findOne(Query.query(Criteria.where("id").is(integer)), SyDeploy.class); | ||
538 | - if (syDeploy == null) { | ||
539 | - return; | ||
540 | - } | ||
541 | - syDeploy.setStatus(1); | ||
542 | - mongoTemplate.save(syDeploy); | 535 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").is(integer)), Update.update("status", 1), SyDeploy.class); |
543 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOYID_STATRTIME, integer); | 536 | redisTemplate.opsForHash().delete(GlobalUtil.DEPLOYID_STATRTIME, integer); |
544 | } | 537 | } |
545 | } | 538 | } |
@@ -738,7 +731,7 @@ public class DeployServiceImpl implements DeployService { | @@ -738,7 +731,7 @@ public class DeployServiceImpl implements DeployService { | ||
738 | */ | 731 | */ |
739 | private void plateAlarmMsgProducer(PlateAlarmMsg plateAlarmMsg) { | 732 | private void plateAlarmMsgProducer(PlateAlarmMsg plateAlarmMsg) { |
740 | if (plateAlarmMsg != null) { | 733 | if (plateAlarmMsg != null) { |
741 | - PlateAlarmMsg save = mongoTemplate.save(plateAlarmMsg); | 734 | + PlateAlarmMsg save = mongoTemplate.insert(plateAlarmMsg); |
742 | String s = JSON.toJSONString(save); | 735 | String s = JSON.toJSONString(save); |
743 | redisTemplate.opsForList().leftPush("ALARM", s); | 736 | redisTemplate.opsForList().leftPush("ALARM", s); |
744 | } | 737 | } |
src/main/java/com/objecteye/service/impl/FeatureServiceImpl.java
@@ -11,13 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -11,13 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.data.mongodb.core.MongoTemplate; | 11 | import org.springframework.data.mongodb.core.MongoTemplate; |
12 | import org.springframework.data.mongodb.core.query.Criteria; | 12 | import org.springframework.data.mongodb.core.query.Criteria; |
13 | import org.springframework.data.mongodb.core.query.Query; | 13 | import org.springframework.data.mongodb.core.query.Query; |
14 | +import org.springframework.data.mongodb.core.query.Update; | ||
14 | import org.springframework.data.redis.core.RedisTemplate; | 15 | import org.springframework.data.redis.core.RedisTemplate; |
15 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
16 | 17 | ||
17 | -import java.util.ArrayList; | ||
18 | -import java.util.HashMap; | ||
19 | -import java.util.List; | ||
20 | -import java.util.Map; | 18 | +import java.util.*; |
21 | 19 | ||
22 | /** | 20 | /** |
23 | * 服务实现层 | 21 | * 服务实现层 |
@@ -108,16 +106,13 @@ public class FeatureServiceImpl implements FeatureService { | @@ -108,16 +106,13 @@ public class FeatureServiceImpl implements FeatureService { | ||
108 | * @param ids | 106 | * @param ids |
109 | */ | 107 | */ |
110 | @Override | 108 | @Override |
111 | - public void delete(String[] ids) { | 109 | + public void delete(List<String> ids) { |
112 | for (String id : ids) { | 110 | for (String id : ids) { |
113 | List<String> deployList = deployService.getDeployListByLibAndDeployType(id, 2); | 111 | List<String> deployList = deployService.getDeployListByLibAndDeployType(id, 2); |
114 | - SyFeature syFeature = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), SyFeature.class); | ||
115 | - syFeature.setIsDelete(1); | ||
116 | List<SyPersonnel> syPersonnels = mongoTemplate.find(Query.query(Criteria.where("fid").is(id)), SyPersonnel.class); | 112 | List<SyPersonnel> syPersonnels = mongoTemplate.find(Query.query(Criteria.where("fid").is(id)), SyPersonnel.class); |
113 | + mongoTemplate.updateMulti(Query.query(Criteria.where("fid").is(id)), Update.update("status", 1), SyPersonnel.class); | ||
117 | if (syPersonnels.size() > 0) { | 114 | if (syPersonnels.size() > 0) { |
118 | for (SyPersonnel syPersonnel : syPersonnels) { | 115 | for (SyPersonnel syPersonnel : syPersonnels) { |
119 | - syPersonnel.setStatus(1); | ||
120 | - mongoTemplate.save(syPersonnel); | ||
121 | redisTemplate.opsForHash().delete("personUrl", syPersonnel.getId()); | 116 | redisTemplate.opsForHash().delete("personUrl", syPersonnel.getId()); |
122 | } | 117 | } |
123 | } | 118 | } |
@@ -126,11 +121,11 @@ public class FeatureServiceImpl implements FeatureService { | @@ -126,11 +121,11 @@ public class FeatureServiceImpl implements FeatureService { | ||
126 | String key = deployId + "|" + id; | 121 | String key = deployId + "|" + id; |
127 | redisTemplate.opsForHash().delete(key); | 122 | redisTemplate.opsForHash().delete(key); |
128 | String[] deploy = {deployId}; | 123 | String[] deploy = {deployId}; |
129 | - deployService.delete(deploy); | 124 | + deployService.delete(Arrays.asList(deploy)); |
130 | } | 125 | } |
131 | } | 126 | } |
132 | - mongoTemplate.save(syFeature); | ||
133 | } | 127 | } |
128 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").in(ids)), Update.update("isDelete", 1), SyFeature.class); | ||
134 | } | 129 | } |
135 | 130 | ||
136 | 131 |
src/main/java/com/objecteye/service/impl/LocusOrbitServiceImpl.java
@@ -71,7 +71,8 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | @@ -71,7 +71,8 @@ public class LocusOrbitServiceImpl implements ILocusOrbitService { | ||
71 | @Override | 71 | @Override |
72 | public List<LocusOrbitResultParams> locusOrbitByPlateNumber(int gcxh, LocusOrbitQueryParams locusOrbitQueryParams, MultipartFile multipartFile) { | 72 | public List<LocusOrbitResultParams> locusOrbitByPlateNumber(int gcxh, LocusOrbitQueryParams locusOrbitQueryParams, MultipartFile multipartFile) { |
73 | String fileName = multipartFile.getOriginalFilename(); | 73 | String fileName = multipartFile.getOriginalFilename(); |
74 | - String picPath = GlobalUtil.dbPath1() + File.separator + "picture" + File.separator + fileName; | 74 | + String picPath = GlobalUtil.dbPath1() + File.separator + "export" + File.separator + "vehicleProject" |
75 | + + File.separator + "picture" + File.separator + fileName; | ||
75 | File newFile = new File(picPath); | 76 | File newFile = new File(picPath); |
76 | try { | 77 | try { |
77 | multipartFile.transferTo(newFile); | 78 | multipartFile.transferTo(newFile); |
src/main/java/com/objecteye/service/impl/PersonnelServiceImpl.java
@@ -17,9 +17,9 @@ import org.springframework.beans.factory.annotation.Value; | @@ -17,9 +17,9 @@ import org.springframework.beans.factory.annotation.Value; | ||
17 | import org.springframework.data.mongodb.core.MongoTemplate; | 17 | import org.springframework.data.mongodb.core.MongoTemplate; |
18 | import org.springframework.data.mongodb.core.query.Criteria; | 18 | import org.springframework.data.mongodb.core.query.Criteria; |
19 | import org.springframework.data.mongodb.core.query.Query; | 19 | import org.springframework.data.mongodb.core.query.Query; |
20 | +import org.springframework.data.mongodb.core.query.Update; | ||
20 | import org.springframework.data.redis.core.RedisTemplate; | 21 | import org.springframework.data.redis.core.RedisTemplate; |
21 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
22 | -import org.springframework.transaction.annotation.Transactional; | ||
23 | import org.springframework.web.multipart.MultipartFile; | 23 | import org.springframework.web.multipart.MultipartFile; |
24 | 24 | ||
25 | import java.io.File; | 25 | import java.io.File; |
@@ -129,17 +129,16 @@ public class PersonnelServiceImpl implements PersonnelService { | @@ -129,17 +129,16 @@ public class PersonnelServiceImpl implements PersonnelService { | ||
129 | */ | 129 | */ |
130 | 130 | ||
131 | @Override | 131 | @Override |
132 | - @Transactional(rollbackFor = Exception.class) | ||
133 | - public void delete(String[] ids) { | 132 | + public void delete(List<String> ids) { |
134 | for (String id : ids) { | 133 | for (String id : ids) { |
135 | SyPersonnel syPersonnel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), SyPersonnel.class); | 134 | SyPersonnel syPersonnel = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), SyPersonnel.class); |
136 | - syPersonnel.setStatus(1); | ||
137 | - mongoTemplate.save(syPersonnel); | 135 | + if (syPersonnel == null) { |
136 | + continue; | ||
137 | + } | ||
138 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").is(id)), Update.update("status", 1), SyPersonnel.class); | ||
138 | String fid = syPersonnel.getFid(); | 139 | String fid = syPersonnel.getFid(); |
139 | - long personCountByFid = findPersonCountByFid(fid); | ||
140 | - SyFeature syFeature = mongoTemplate.findOne(Query.query(Criteria.where("id").is(fid)), SyFeature.class); | ||
141 | - syFeature.setCount((int) personCountByFid); | ||
142 | - mongoTemplate.save(syFeature); | 140 | + int personCountByFid = (int) findPersonCountByFid(fid); |
141 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").is(fid)), Update.update("count", personCountByFid), SyFeature.class); | ||
143 | List<String> deployListByLibAndDeployType = deployService.getDeployListByLibAndDeployType(fid, 2); | 142 | List<String> deployListByLibAndDeployType = deployService.getDeployListByLibAndDeployType(fid, 2); |
144 | if (deployListByLibAndDeployType != null && deployListByLibAndDeployType.size() > 0) { | 143 | if (deployListByLibAndDeployType != null && deployListByLibAndDeployType.size() > 0) { |
145 | for (String s : deployListByLibAndDeployType) { | 144 | for (String s : deployListByLibAndDeployType) { |
@@ -207,7 +206,6 @@ public class PersonnelServiceImpl implements PersonnelService { | @@ -207,7 +206,6 @@ public class PersonnelServiceImpl implements PersonnelService { | ||
207 | * @return | 206 | * @return |
208 | */ | 207 | */ |
209 | @Override | 208 | @Override |
210 | - @Transactional(rollbackFor = Exception.class) | ||
211 | public String uploadFiles(MultipartFile[] uploadFiles, String featureId) { | 209 | public String uploadFiles(MultipartFile[] uploadFiles, String featureId) { |
212 | int count = 0; | 210 | int count = 0; |
213 | SyFeature one = featureService.findOne(featureId); | 211 | SyFeature one = featureService.findOne(featureId); |
src/main/java/com/objecteye/service/impl/UploadFileServiceImpl.java
@@ -42,7 +42,8 @@ public class UploadFileServiceImpl implements IUploadFileService { | @@ -42,7 +42,8 @@ public class UploadFileServiceImpl implements IUploadFileService { | ||
42 | public JSONObject uploadFile2Mongo(MultipartFile multipartFile) throws IOException { | 42 | public JSONObject uploadFile2Mongo(MultipartFile multipartFile) throws IOException { |
43 | // 格式化文件名由format开头, e.g. format-15321354564-12.12654_15.156567.jpg | 43 | // 格式化文件名由format开头, e.g. format-15321354564-12.12654_15.156567.jpg |
44 | String fileName = multipartFile.getOriginalFilename(); | 44 | String fileName = multipartFile.getOriginalFilename(); |
45 | - String picPath = GlobalUtil.dbPath1() + File.separator + "picture" + File.separator + fileName; | 45 | + String picPath = GlobalUtil.dbPath1() + File.separator + "export" + File.separator + "vehicleProject" |
46 | + + File.separator + "picture" + File.separator + fileName; | ||
46 | File newFile = new File(picPath); | 47 | File newFile = new File(picPath); |
47 | multipartFile.transferTo(newFile); | 48 | multipartFile.transferTo(newFile); |
48 | 49 | ||
@@ -75,8 +76,6 @@ public class UploadFileServiceImpl implements IUploadFileService { | @@ -75,8 +76,6 @@ public class UploadFileServiceImpl implements IUploadFileService { | ||
75 | String s = JSON.toJSONString(uploadVehicleResult); | 76 | String s = JSON.toJSONString(uploadVehicleResult); |
76 | rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_TOPICS_INFORM, "inform.store", s); | 77 | rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_TOPICS_INFORM, "inform.store", s); |
77 | } | 78 | } |
78 | - | ||
79 | - | ||
80 | - return null; | 79 | + return new JSONObject(); |
81 | } | 80 | } |
82 | } | 81 | } |
src/main/java/com/objecteye/service/impl/VehicleDbServiceImpl.java
@@ -10,13 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -10,13 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.data.mongodb.core.MongoTemplate; | 10 | import org.springframework.data.mongodb.core.MongoTemplate; |
11 | import org.springframework.data.mongodb.core.query.Criteria; | 11 | import org.springframework.data.mongodb.core.query.Criteria; |
12 | import org.springframework.data.mongodb.core.query.Query; | 12 | import org.springframework.data.mongodb.core.query.Query; |
13 | +import org.springframework.data.mongodb.core.query.Update; | ||
13 | import org.springframework.data.redis.core.RedisTemplate; | 14 | import org.springframework.data.redis.core.RedisTemplate; |
14 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
15 | 16 | ||
16 | -import java.util.ArrayList; | ||
17 | -import java.util.HashMap; | ||
18 | -import java.util.List; | ||
19 | -import java.util.Map; | 17 | +import java.util.*; |
20 | 18 | ||
21 | /** | 19 | /** |
22 | * 服务实现层 | 20 | * 服务实现层 |
@@ -95,7 +93,7 @@ public class VehicleDbServiceImpl implements VehicleDbService { | @@ -95,7 +93,7 @@ public class VehicleDbServiceImpl implements VehicleDbService { | ||
95 | * @param ids | 93 | * @param ids |
96 | */ | 94 | */ |
97 | @Override | 95 | @Override |
98 | - public void delete(String[] ids) { | 96 | + public void delete(List<String> ids) { |
99 | for (String id : ids) { | 97 | for (String id : ids) { |
100 | List<String> deployList = deployService.getDeployListByLibAndDeployType(id, 2); | 98 | List<String> deployList = deployService.getDeployListByLibAndDeployType(id, 2); |
101 | UploadVehicleDbResult uploadVehicleDbResult = mongoTemplate.findOne(Query.query(new Criteria("id").is(id)), UploadVehicleDbResult.class); | 99 | UploadVehicleDbResult uploadVehicleDbResult = mongoTemplate.findOne(Query.query(new Criteria("id").is(id)), UploadVehicleDbResult.class); |
@@ -114,13 +112,11 @@ public class VehicleDbServiceImpl implements VehicleDbService { | @@ -114,13 +112,11 @@ public class VehicleDbServiceImpl implements VehicleDbService { | ||
114 | for (int i = 0; i < size; i++) { | 112 | for (int i = 0; i < size; i++) { |
115 | String deployId = deployList.get(i); | 113 | String deployId = deployList.get(i); |
116 | String[] deploy = {deployId}; | 114 | String[] deploy = {deployId}; |
117 | - deployService.delete(deploy); | 115 | + deployService.delete(Arrays.asList(deploy)); |
118 | } | 116 | } |
119 | } | 117 | } |
120 | } | 118 | } |
121 | - SyVehicleDb syVehicleDb = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), SyVehicleDb.class); | ||
122 | - syVehicleDb.setIsDelete(1); | ||
123 | - mongoTemplate.save(syVehicleDb); | 119 | + mongoTemplate.updateMulti(Query.query(Criteria.where("id").is(id)), Update.update("isDelete", 1), SyVehicleDb.class); |
124 | } | 120 | } |
125 | } | 121 | } |
126 | 122 |
src/main/java/com/objecteye/service/impl/VehicleFileServiceImpl.java
@@ -324,7 +324,8 @@ public class VehicleFileServiceImpl implements IVehicleFileService { | @@ -324,7 +324,8 @@ public class VehicleFileServiceImpl implements IVehicleFileService { | ||
324 | @Override | 324 | @Override |
325 | public VvehicleFilePicQueryResult picQuery(int gcxh, MultipartFile multipartFile) { | 325 | public VvehicleFilePicQueryResult picQuery(int gcxh, MultipartFile multipartFile) { |
326 | String fileName = multipartFile.getOriginalFilename(); | 326 | String fileName = multipartFile.getOriginalFilename(); |
327 | - String picPath = GlobalUtil.dbPath1() + File.separator + "picture" + File.separator + fileName; | 327 | + String picPath = GlobalUtil.dbPath1() + File.separator + "export" + File.separator + "vehicleProject" |
328 | + + File.separator + "picture" + File.separator + fileName; | ||
328 | File newFile = new File(picPath); | 329 | File newFile = new File(picPath); |
329 | try { | 330 | try { |
330 | multipartFile.transferTo(newFile); | 331 | multipartFile.transferTo(newFile); |
src/main/java/com/objecteye/service/impl/VehicleServiceImpl.java
@@ -79,11 +79,10 @@ public class VehicleServiceImpl implements VehicleService { | @@ -79,11 +79,10 @@ public class VehicleServiceImpl implements VehicleService { | ||
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | - public void delete(String[] ids) { | ||
83 | - int length = ids.length; | 82 | + public void delete(List<String> ids) { |
83 | + int length = ids.size(); | ||
84 | String vehicleId = null; | 84 | String vehicleId = null; |
85 | - for (int i = 0; i < length; i++) { | ||
86 | - String id = ids[i]; | 85 | + for (String id : ids) { |
87 | UploadVehicleDbResult uploadVehicleDbResult = mongoTemplate.findOne(Query.query(new Criteria("id").is(id)), UploadVehicleDbResult.class); | 86 | UploadVehicleDbResult uploadVehicleDbResult = mongoTemplate.findOne(Query.query(new Criteria("id").is(id)), UploadVehicleDbResult.class); |
88 | vehicleId = uploadVehicleDbResult.getVehicleId(); | 87 | vehicleId = uploadVehicleDbResult.getVehicleId(); |
89 | String plateNum = uploadVehicleDbResult.getPlateNum(); | 88 | String plateNum = uploadVehicleDbResult.getPlateNum(); |
src/main/java/com/objecteye/service/impl/VehicleViolationsServiceImpl.java
@@ -95,7 +95,7 @@ public class VehicleViolationsServiceImpl implements IVehicleViolationsService { | @@ -95,7 +95,7 @@ public class VehicleViolationsServiceImpl implements IVehicleViolationsService { | ||
95 | continue; | 95 | continue; |
96 | } | 96 | } |
97 | SyVehicleForbiddenTaskOutput output = new SyVehicleForbiddenTaskOutput(); | 97 | SyVehicleForbiddenTaskOutput output = new SyVehicleForbiddenTaskOutput(); |
98 | - output.setId(String.valueOf(forbiddenTask.getId())); | 98 | + output.setId(forbiddenTask.getId()); |
99 | output.setName(forbiddenTask.getName()); | 99 | output.setName(forbiddenTask.getName()); |
100 | output.setDescription(forbiddenTask.getDescription()); | 100 | output.setDescription(forbiddenTask.getDescription()); |
101 | output.setStatus(null != forbiddenTask.getStatus() && 1 == forbiddenTask.getStatus() ? "工作中" : "已撤销"); | 101 | output.setStatus(null != forbiddenTask.getStatus() && 1 == forbiddenTask.getStatus() ? "工作中" : "已撤销"); |
@@ -164,7 +164,7 @@ public class VehicleViolationsServiceImpl implements IVehicleViolationsService { | @@ -164,7 +164,7 @@ public class VehicleViolationsServiceImpl implements IVehicleViolationsService { | ||
164 | * @return 结果集 | 164 | * @return 结果集 |
165 | */ | 165 | */ |
166 | @Override | 166 | @Override |
167 | - public int forbiddenTaskDelete(String[] ids) { | 167 | + public int forbiddenTaskDelete(List<String> ids) { |
168 | int effectNum = 0; | 168 | int effectNum = 0; |
169 | for (String id : ids) { | 169 | for (String id : ids) { |
170 | if (null == id || "".equals(id)) { | 170 | if (null == id || "".equals(id)) { |
src/main/java/com/objecteye/utils/FtpUtil.java deleted
1 | -package com.objecteye.utils; | ||
2 | - | ||
3 | -import org.apache.commons.net.ftp.FTP; | ||
4 | -import org.apache.commons.net.ftp.FTPClient; | ||
5 | -import org.slf4j.Logger; | ||
6 | -import org.slf4j.LoggerFactory; | ||
7 | -import org.springframework.beans.factory.annotation.Value; | ||
8 | -import org.springframework.stereotype.Component; | ||
9 | - | ||
10 | -import java.io.IOException; | ||
11 | -import java.net.SocketException; | ||
12 | -import java.nio.charset.Charset; | ||
13 | - | ||
14 | -@Component | ||
15 | -public class FtpUtil { | ||
16 | - | ||
17 | - private static final Logger log = LoggerFactory.getLogger(FtpUtil.class); | ||
18 | - | ||
19 | - @Value("${ftp.username}") | ||
20 | - private String userName; | ||
21 | - | ||
22 | - @Value("${ftp.password}") | ||
23 | - private String passWord; | ||
24 | - | ||
25 | - @Value("${ftp.host}") | ||
26 | - private String ip; | ||
27 | - | ||
28 | - @Value("${ftp.port}") | ||
29 | - private int port; | ||
30 | - | ||
31 | - private FTPClient ftpClient = new FTPClient(); | ||
32 | - | ||
33 | - | ||
34 | - public FTPClient connect() { | ||
35 | - try { | ||
36 | - if (!ftpClient.isConnected()) { | ||
37 | - | ||
38 | - ftpClient.connect(ip, port); | ||
39 | - ftpClient.login(userName, passWord); | ||
40 | - ftpClient.setCharset(Charset.forName("UTF-8")); | ||
41 | - ftpClient.setControlEncoding("UTF-8"); | ||
42 | - ftpClient.setFileType(FTP.BINARY_FILE_TYPE); | ||
43 | - } | ||
44 | - return ftpClient; | ||
45 | - } catch (SocketException e) { | ||
46 | - e.printStackTrace(); | ||
47 | - } catch (IOException e) { | ||
48 | - e.printStackTrace(); | ||
49 | - } | ||
50 | - return null; | ||
51 | - } | ||
52 | -} |
src/main/java/com/objecteye/utils/GlobalUtil.java
@@ -438,9 +438,8 @@ public class GlobalUtil { | @@ -438,9 +438,8 @@ public class GlobalUtil { | ||
438 | if (imgStr == null) { | 438 | if (imgStr == null) { |
439 | return false; | 439 | return false; |
440 | } | 440 | } |
441 | - BASE64Decoder decoder = new BASE64Decoder(); | ||
442 | try { | 441 | try { |
443 | - byte[] bytes = decoder.decodeBuffer(imgStr); | 442 | + byte[] bytes = org.apache.commons.codec.binary.Base64.decodeBase64(imgStr); |
444 | for (int i = 0; i < bytes.length; ++i) { | 443 | for (int i = 0; i < bytes.length; ++i) { |
445 | if (bytes[i] < 0) { | 444 | if (bytes[i] < 0) { |
446 | bytes[i] += 256; | 445 | bytes[i] += 256; |
src/main/java/com/objecteye/utils/HttpClientUtils.java
1 | package com.objecteye.utils; | 1 | package com.objecteye.utils; |
2 | 2 | ||
3 | +import org.apache.commons.codec.binary.Base64; | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
4 | import org.springframework.beans.factory.annotation.Value; | 5 | import org.springframework.beans.factory.annotation.Value; |
5 | import org.springframework.http.ResponseEntity; | 6 | import org.springframework.http.ResponseEntity; |
@@ -7,7 +8,6 @@ import org.springframework.stereotype.Component; | @@ -7,7 +8,6 @@ import org.springframework.stereotype.Component; | ||
7 | import org.springframework.web.client.RestTemplate; | 8 | import org.springframework.web.client.RestTemplate; |
8 | import org.springframework.web.multipart.MultipartFile; | 9 | import org.springframework.web.multipart.MultipartFile; |
9 | import sun.misc.BASE64Decoder; | 10 | import sun.misc.BASE64Decoder; |
10 | -import sun.misc.BASE64Encoder; | ||
11 | 11 | ||
12 | import javax.imageio.ImageIO; | 12 | import javax.imageio.ImageIO; |
13 | import java.awt.image.BufferedImage; | 13 | import java.awt.image.BufferedImage; |
@@ -85,12 +85,10 @@ public class HttpClientUtils { | @@ -85,12 +85,10 @@ public class HttpClientUtils { | ||
85 | } | 85 | } |
86 | 86 | ||
87 | public String MultipartFileToBase64(MultipartFile file) throws Exception { | 87 | public String MultipartFileToBase64(MultipartFile file) throws Exception { |
88 | - BASE64Encoder base64Encoder = new BASE64Encoder(); | ||
89 | - String base64EncoderImg = file.getOriginalFilename() + "," + base64Encoder.encode(file.getBytes()); | 88 | + String base64EncoderImg = file.getOriginalFilename() + "," + Base64.encodeBase64String(file.getBytes()); |
90 | String[] split = base64EncoderImg.split(","); | 89 | String[] split = base64EncoderImg.split(","); |
91 | String split1 = split[1]; | 90 | String split1 = split[1]; |
92 | - String base64Value = split1.replaceAll("\r\n|\r|\n", ""); | ||
93 | - return base64Value; | 91 | + return split1.replaceAll("\r\n|\r|\n", ""); |
94 | } | 92 | } |
95 | 93 | ||
96 | //将multipart文件转成车型对象 | 94 | //将multipart文件转成车型对象 |
src/main/java/com/objecteye/utils/RabbitMQVehicleTools.java
@@ -112,7 +112,7 @@ public class RabbitMQVehicleTools { | @@ -112,7 +112,7 @@ public class RabbitMQVehicleTools { | ||
112 | GlobalUtil.generateImage(mattingData, path); | 112 | GlobalUtil.generateImage(mattingData, path); |
113 | 113 | ||
114 | PersonMsg personMsg = new PersonMsg(null, snapshoturl, captureTime, null, null, null, url, retrieveKey, fea); | 114 | PersonMsg personMsg = new PersonMsg(null, snapshoturl, captureTime, null, null, null, url, retrieveKey, fea); |
115 | - PersonMsg save = mongoTemplate.save(personMsg); | 115 | + PersonMsg save = mongoTemplate.insert(personMsg); |
116 | String s = JSON.toJSONString(save); | 116 | String s = JSON.toJSONString(save); |
117 | rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_TOPICS_INFORM, "inform.person", s); | 117 | rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_TOPICS_INFORM, "inform.person", s); |
118 | } | 118 | } |
src/main/resources/application.yml
@@ -32,23 +32,16 @@ logging: | @@ -32,23 +32,16 @@ logging: | ||
32 | # file: demo_log.log #配置日志生成路径 | 32 | # file: demo_log.log #配置日志生成路径 |
33 | # path: /var/logs #配置日志文件名称 | 33 | # path: /var/logs #配置日志文件名称 |
34 | picture: | 34 | picture: |
35 | - url: http://192.168.10.153:8880/ | ||
36 | - storePath: /ftpTest | ||
37 | - http: http://192.168.10.153:8880/ | ||
38 | - snapshotPath: /home/hexy/picture/snapshot/ | 35 | + url: http://192.168.10.117:32112/ |
36 | + storePath: /home/liuhaoyu/export/vehicleProject/picture/ | ||
37 | + http: http://192.168.10.117:32112/ | ||
38 | + snapshotPath: /home/liuhaoyu/export/vehicleProject/picture/snapshot/ | ||
39 | 39 | ||
40 | -snapshotPrefix: http://192.168.10.153:8880/snapshot/ | 40 | +snapshotPrefix: http://192.168.10.117:32112/snapshot/ |
41 | 41 | ||
42 | server: | 42 | server: |
43 | - port: 8080 | ||
44 | - address: 127.0.0.1 | ||
45 | - | ||
46 | -ftp: | ||
47 | - username: officer | ||
48 | - password: 334554321123211 | ||
49 | - host: 192.168.10.39 | ||
50 | - port: 21 | ||
51 | - | 43 | + port: 8845 |
44 | + address: 192.168.10.117 | ||
52 | 45 | ||
53 | #调用引擎url | 46 | #调用引擎url |
54 | requestFile: http://192.168.10.4:10002/vps/analysisFile | 47 | requestFile: http://192.168.10.4:10002/vps/analysisFile |