Commit dbb6de2c511e7178b6364772eb716647105329dc
1 parent
132dce4f
地磁管理
Showing
2 changed files
with
98 additions
and
2 deletions
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/devicemanagement/GeomagneticManagementController.java
... | ... | @@ -5,16 +5,110 @@ package com.zteits.irain.portal.web.parkinglotcloudplatform.devicemanagement; |
5 | 5 | |
6 | 6 | import org.slf4j.Logger; |
7 | 7 | import org.slf4j.LoggerFactory; |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.beans.factory.annotation.Value; | |
10 | +import org.springframework.web.bind.annotation.PostMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestBody; | |
8 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | 13 | import org.springframework.web.bind.annotation.RestController; |
10 | 14 | |
15 | +import com.clouds.common.web.BizController; | |
16 | +import com.clouds.common.web.vo.BizResultVO; | |
17 | +import com.clouds.common.web.vo.EasyUIDataGridVO; | |
18 | +import com.zteits.clouds.api.apibase.bean.BizResult; | |
19 | +import com.zteits.clouds.api.apibase.bean.PageBean; | |
20 | +import com.zteits.clouds.api.apibase.constants.ErrorType; | |
21 | +import com.zteits.clouds.api.apibase.exception.BizException; | |
22 | +import com.zteits.clouds.api.dto.park.dto.GeomagneticManagementDTO; | |
23 | +import com.zteits.clouds.api.dto.park.param.GeomagneticManagementRequest; | |
24 | +import com.zteits.clouds.api.dto.park.param.NewGeomagneticRecRequest; | |
25 | +import com.zteits.clouds.api.service.park.GeomagneticManagementService; | |
26 | + | |
27 | +import io.swagger.annotations.ApiOperation; | |
28 | + | |
11 | 29 | /** |
12 | 30 | * @author hxz |
13 | 31 | * |
14 | 32 | */ |
15 | 33 | @RestController |
16 | 34 | @RequestMapping("/geomagnetic") |
17 | -public class GeomagneticManagementController { | |
35 | +public class GeomagneticManagementController extends BizController { | |
18 | 36 | private static final Logger logger = LoggerFactory.getLogger(GeomagneticManagementController.class); |
37 | + | |
38 | + @Value("${project.syscode}") | |
39 | + private String sysCode; | |
40 | + | |
41 | + @Autowired | |
42 | + private GeomagneticManagementService geoMngtSrvc; | |
43 | + | |
44 | + @ApiOperation("查询地磁管理记录") | |
45 | + @PostMapping("records") | |
46 | + public BizResultVO<EasyUIDataGridVO<GeomagneticManagementDTO>> queryGeomaneticManagementRecs ( | |
47 | + @RequestBody GeomagneticManagementRequest requestObject) | |
48 | + throws InstantiationException, IllegalAccessException { | |
49 | + | |
50 | + if (null == requestObject) { | |
51 | + logger.debug("请求参数为空!"); | |
52 | + throw new BizException(ErrorType.PARAMM_NULL, "请求参数为空"); | |
53 | + } | |
54 | + requestObject.setSysCode(sysCode); | |
55 | + | |
56 | + BizResult<PageBean<GeomagneticManagementDTO>> respondObject = geoMngtSrvc.queryGeomagneticManagementRecs(requestObject); | |
57 | + | |
58 | + return returnJqGridData(respondObject, GeomagneticManagementDTO.class); | |
59 | + } | |
60 | + | |
61 | + @ApiOperation("全部删除已查询到的记录") | |
62 | + @PostMapping("deleteall") | |
63 | + public BizResultVO<Boolean> deleteAllQueryedRecs (@RequestBody GeomagneticManagementRequest requestObject) { | |
64 | + BizResultVO<Boolean> bizResultVO = new BizResultVO<>(); | |
65 | + BizResult<Boolean> bizResult = null; | |
66 | + | |
67 | + requestObject.setSysCode(sysCode); | |
68 | + try { | |
69 | + bizResult = geoMngtSrvc.deleteAllQueryedRecs(requestObject); | |
70 | + } catch (Exception e) { | |
71 | + e.printStackTrace(); | |
72 | + logger.error(e.toString()); | |
73 | + return bizResultVO.setData(false); | |
74 | + } | |
75 | + | |
76 | + return bizResultVO.setData(bizResult.getData()); | |
77 | + } | |
78 | + | |
79 | + @ApiOperation("插入一条地磁场记录") | |
80 | + @PostMapping("insertone") | |
81 | + public BizResultVO<Long> insertGeomagneticRecord (@RequestBody NewGeomagneticRecRequest requestObject) { | |
82 | + BizResultVO<Long> bizResultVO = new BizResultVO<>(); | |
83 | + BizResult<Long> bizResult = null; | |
84 | + | |
85 | + requestObject.setSysCode(sysCode); | |
86 | + | |
87 | + try { | |
88 | + bizResult = geoMngtSrvc.insertGeomagneticRecord(requestObject); | |
89 | + } catch (Exception e) { | |
90 | + logger.error(e.toString()); | |
91 | + e.printStackTrace(); | |
92 | + bizResultVO.setData(new Long(-1)); | |
93 | + } | |
94 | + return bizResultVO.setData(bizResult.getData()); | |
95 | + } | |
96 | + | |
97 | + @ApiOperation("更新一条地磁场记录") | |
98 | + @PostMapping("updateone") | |
99 | + public BizResultVO<Boolean> updateGeomagneticRecord (@RequestBody NewGeomagneticRecRequest requestObject) { | |
100 | + BizResultVO<Boolean> bizResultVO = new BizResultVO<>(); | |
101 | + BizResult<Boolean> bizResult = null; | |
102 | + | |
103 | + requestObject.setSysCode(sysCode); | |
104 | + try { | |
105 | + bizResult = geoMngtSrvc.updateGeomagneticRecord(requestObject); | |
106 | + } catch (Exception e) { | |
107 | + e.printStackTrace(); | |
108 | + logger.error(e.toString()); | |
109 | + return bizResultVO.setData(false); | |
110 | + } | |
19 | 111 | |
112 | + return bizResultVO.setData(bizResult.getData()); | |
113 | + } | |
20 | 114 | } | ... | ... |
src/main/resources/dubbo/dubbo-park-consumer.xml
... | ... | @@ -166,5 +166,7 @@ |
166 | 166 | <dubbo:reference id="tpPTgsPassedcarService" interface="com.zteits.clouds.api.service.park.TpPTgsPassedcarService" |
167 | 167 | version="${spring.dubbo.provider.version}" |
168 | 168 | timeout="30000"/> |
169 | - | |
169 | + <!-- 地磁管理 --> | |
170 | + <dubbo:reference id="geomagneticManagementService" interface="com.zteits.clouds.api.service.park.GeomagneticManagementService" | |
171 | + version="${spring.dubbo.provider.version}" timeout="30000"/> | |
170 | 172 | </beans> |
171 | 173 | \ No newline at end of file | ... | ... |