Commit 6937be2be83abcfa640debdb70af4322c3370017

Authored by llw
2 parents 71aba268 90155add

Merge branch 'branch_0808' of http://192.168.1.195:9998/ZTEITS-Developers/zteits…

…-bcp-portal.git into branch_0808
src/main/java/com/zteits/irain/portal/vo/fangle/BerthStateRequest.java deleted
1   -package com.zteits.irain.portal.vo.fangle;
2   -
3   -import com.zteits.clouds.api.apibase.bean.BaseRequest;
4   -
5   -public class BerthStateRequest extends BaseRequest{
6   -
7   - private static final long serialVersionUID = 1L;
8   -
9   - /**记录编号*/
10   - private String log_id;
11   -
12   - /**泊位编码*/
13   - private String berthcode;
14   -
15   - /**状态变更时间*/
16   - private String changetime;
17   -
18   - /**泊位状态*/
19   - private String berthstatus;
20   -
21   - /**电量*/
22   - private String electricity;
23   -
24   - /**电压值*/
25   - private String voltage;
26   -
27   - public String getLog_id() {
28   - return log_id;
29   - }
30   -
31   - public void setLog_id(String log_id) {
32   - this.log_id = log_id;
33   - }
34   -
35   - public String getBerthcode() {
36   - return berthcode;
37   - }
38   -
39   - public void setBerthcode(String berthcode) {
40   - this.berthcode = berthcode;
41   - }
42   -
43   - public String getChangetime() {
44   - return changetime;
45   - }
46   -
47   - public void setChangetime(String changetime) {
48   - this.changetime = changetime;
49   - }
50   -
51   - public String getBerthstatus() {
52   - return berthstatus;
53   - }
54   -
55   - public void setBerthstatus(String berthstatus) {
56   - this.berthstatus = berthstatus;
57   - }
58   -
59   - public String getElectricity() {
60   - return electricity;
61   - }
62   -
63   - public void setElectricity(String electricity) {
64   - this.electricity = electricity;
65   - }
66   -
67   - public String getVoltage() {
68   - return voltage;
69   - }
70   -
71   - public void setVoltage(String voltage) {
72   - this.voltage = voltage;
73   - }
74   -
75   - @Override
76   - public String toString() {
77   - return "BerthStateRequest [log_id=" + log_id + ", berthcode=" + berthcode + ", changetime=" + changetime
78   - + ", berthstatus=" + berthstatus + ", electricity=" + electricity + ", voltage=" + voltage + "]";
79   - }
80   -
81   -
82   -}
src/main/java/com/zteits/irain/portal/vo/fangle/EqpHeartBeatRequest.java deleted
1   -package com.zteits.irain.portal.vo.fangle;
2   -
3   -import com.zteits.clouds.api.apibase.bean.BaseRequest;
4   -
5   -public class EqpHeartBeatRequest extends BaseRequest{
6   -
7   - private static final long serialVersionUID = 1L;
8   -
9   - /**设备类型*/
10   - private String EquipmentType;
11   -
12   - /**设备编号*/
13   - private String EquipmentCode;
14   -
15   - /**设备状态*/
16   - private String EquipmentStatus;
17   -
18   - /**推送时间*/
19   - private String PushTime;
20   -
21   - public String getEquipmentType() {
22   - return EquipmentType;
23   - }
24   -
25   - public void setEquipmentType(String equipmentType) {
26   - EquipmentType = equipmentType;
27   - }
28   -
29   - public String getEquipmentCode() {
30   - return EquipmentCode;
31   - }
32   -
33   - public void setEquipmentCode(String equipmentCode) {
34   - EquipmentCode = equipmentCode;
35   - }
36   -
37   - public String getEquipmentStatus() {
38   - return EquipmentStatus;
39   - }
40   -
41   - public void setEquipmentStatus(String equipmentStatus) {
42   - EquipmentStatus = equipmentStatus;
43   - }
44   -
45   - public String getPushTime() {
46   - return PushTime;
47   - }
48   -
49   - public void setPushTime(String pushTime) {
50   - PushTime = pushTime;
51   - }
52   -
53   - @Override
54   - public String toString() {
55   - return "EqpHeartBeatRequest [EquipmentType=" + EquipmentType + ", EquipmentCode=" + EquipmentCode
56   - + ", EquipmentStatus=" + EquipmentStatus + ", PushTime=" + PushTime + "]";
57   - }
58   -
59   -
60   -}
src/main/java/com/zteits/irain/portal/web/fangle/FangleEqpController.java deleted
1   -package com.zteits.irain.portal.web.fangle;
2   -
3   -import java.text.ParseException;
4   -import java.text.SimpleDateFormat;
5   -import java.util.Date;
6   -import java.util.Map;
7   -
8   -import org.slf4j.Logger;
9   -import org.slf4j.LoggerFactory;
10   -import org.springframework.beans.BeanUtils;
11   -import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.beans.factory.annotation.Value;
13   -import org.springframework.web.bind.annotation.RequestBody;
14   -import org.springframework.web.bind.annotation.RequestMapping;
15   -import org.springframework.web.bind.annotation.RequestMethod;
16   -import org.springframework.web.bind.annotation.RestController;
17   -
18   -import com.alibaba.fastjson.JSON;
19   -import com.alibaba.fastjson.JSONArray;
20   -import com.alibaba.fastjson.JSONObject;
21   -import com.clouds.common.web.BizController;
22   -import com.zteits.clouds.api.apibase.bean.BaseInfo;
23   -import com.zteits.clouds.api.apibase.bean.BizResult;
24   -import com.zteits.clouds.api.dto.park.param.EqpLogRequest;
25   -import com.zteits.clouds.api.service.park.EqpBerthsService;
26   -import com.zteits.irain.portal.vo.fangle.BerthStateRequest;
27   -import com.zteits.irain.portal.vo.fangle.EqpHeartBeatRequest;
28   -
29   -import io.swagger.annotations.Api;
30   -import io.swagger.annotations.ApiOperation;
31   -
32   -/**
33   - * Copyright: Copyright (c) 2017 ZTE-ITS
34   - *
35   - * @ClassName: FangleEqpController.java
36   - * @Description:方格尔设备同步
37   - * @version: v1.0.0
38   - * @author: wangfei
39   - * @date: 2017年4月20日 下午17:51:45
40   - * Modification History:
41   - * Date Author Version Description
42   - *---------------------------------------------------------*
43   - * 2017年8月21日 wangfei v1.0.0 创建
44   - */
45   -@Api(value="方格尔设备同步",description="方格尔设备同步")
46   -@RestController
47   -@RequestMapping("/fangle")
48   -public class FangleEqpController extends BizController{
49   -
50   -
51   - private static final Logger logger = LoggerFactory.getLogger(FangleEqpController.class);
52   - @Value("${project.syscode}")
53   - private String sysCode;
54   - @Autowired
55   - private EqpBerthsService eqpBerthsService;
56   -
57   - @ApiOperation("泊位信息同步")
58   - @RequestMapping(value = "/synBerthInfo",method = RequestMethod.POST)
59   - public BizResult<Map<String, String>> synBerthInfo(@RequestBody String param){
60   - logger.info("同步入参:" + param);
61   -
62   - JSONObject jsonObject = JSONObject.parseObject(param);
63   - String reqList = jsonObject.getString("pushdata");
64   - JSONArray jsonArray = JSON.parseArray(reqList);
65   - BerthStateRequest request = JSON.parseObject(jsonArray.getString(0),BerthStateRequest.class);
66   - BaseInfo info = new BaseInfo();
67   - request.setBaseRequest(info);
68   - request.setSysCode(sysCode);
69   - //数据转换
70   - EqpLogRequest eqpLogRequest = new EqpLogRequest();
71   - BeanUtils.copyProperties(request, eqpLogRequest);
72   - eqpLogRequest.setBerthOutNo(request.getBerthcode());
73   - eqpLogRequest.setEqpType(1);//地磁
74   - if(request.getBerthstatus().equals("1") || request.getBerthstatus().equals("2")){
75   - eqpLogRequest.setEqpStatus("1");//设备状态 1-正常
76   - }
77   - if(request.getBerthstatus().equals("3")){
78   - eqpLogRequest.setEqpStatus("0");//设备状态 0-故障
79   - }
80   - if(request.getBerthstatus().equals("2")){
81   - eqpLogRequest.setBerthState("0");//泊位状态 0-空闲
82   - }
83   - if(request.getBerthstatus().equals("1")){
84   - eqpLogRequest.setBerthState("1");//泊位状态 1- 占用
85   - }
86   - eqpLogRequest.setElectricity(request.getElectricity());
87   - eqpLogRequest.setVoltag(request.getVoltage());
88   -
89   - BizResult<Map<String, String>> result = eqpBerthsService.synEqpInfo(eqpLogRequest);
90   - return result;
91   - }
92   -
93   - @ApiOperation("设备心跳信息同步")
94   - @RequestMapping(value = "/synEqpHeartBeatInfo",method = RequestMethod.POST)
95   - public BizResult<Map<String, String>> synEqpHeartBeatInfo(@RequestBody String param){
96   - logger.info("同步入参:" + param);
97   -
98   - JSONObject jsonObject = JSONObject.parseObject(param);
99   - String reqList = jsonObject.getString("pushdata");
100   - JSONArray jsonArray = JSON.parseArray(reqList);
101   - EqpHeartBeatRequest request = JSON.parseObject(jsonArray.getString(0),EqpHeartBeatRequest.class);
102   - BaseInfo info = new BaseInfo();
103   - request.setBaseRequest(info);
104   - request.setSysCode(sysCode);
105   -
106   - //数据转换
107   - EqpLogRequest eqpLogRequest = new EqpLogRequest();
108   - BeanUtils.copyProperties(request, eqpLogRequest);
109   - eqpLogRequest.setEqpNo(request.getEquipmentCode());
110   - if(request.getEquipmentType().equals("1")){
111   - eqpLogRequest.setEqpType(4);//设备类型 4-车检器
112   - }
113   - if(request.getEquipmentType().equals("2")){
114   - eqpLogRequest.setEqpType(5);//设备类型 5-网关
115   - }
116   - if(request.getEquipmentType().equals("3")){
117   - eqpLogRequest.setEqpType(6);//设备类型 6-中继器
118   - }
119   - if(request.getEquipmentStatus().equals("1")){
120   - eqpLogRequest.setEqpStatus("1");//设备状态 1-正常
121   - }
122   - if(request.getEquipmentStatus().equals("2")){
123   - eqpLogRequest.setEqpStatus("0");//设备状态 0-故障
124   - }
125   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
126   - Date date;
127   - try {
128   - date = sdf.parse(request.getPushTime());
129   - eqpLogRequest.setHeartbeatTime(date);
130   - } catch (ParseException e) {
131   - e.printStackTrace();
132   - }
133   - BizResult<Map<String, String>> result = eqpBerthsService.synEqpInfo(eqpLogRequest);
134   - return result;
135   - }
136   -
137   -}