正在显示
11 个修改的文件
包含
19 行增加
和
16 行删除
| 1 | package com.zhonglai.luhui.device.analysis.comm.dto; | 1 | package com.zhonglai.luhui.device.analysis.comm.dto; |
| 2 | 2 | ||
| 3 | import com.zhonglai.luhui.device.analysis.dto.Message; | 3 | import com.zhonglai.luhui.device.analysis.dto.Message; |
| 4 | +import com.zhonglai.luhui.device.analysis.dto.MessageCode; | ||
| 5 | +import com.zhonglai.luhui.device.analysis.dto.MessageCodeType; | ||
| 4 | 6 | ||
| 5 | /** | 7 | /** |
| 6 | * 回复给前端的消息 | 8 | * 回复给前端的消息 |
| 7 | */ | 9 | */ |
| 8 | public class ApiClientRePlyDto { | 10 | public class ApiClientRePlyDto { |
| 9 | - private int code; | 11 | + private MessageCodeType code; |
| 10 | private String message; | 12 | private String message; |
| 11 | private Object data; | 13 | private Object data; |
| 12 | 14 | ||
| 13 | - public int getCode() { | 15 | + public MessageCodeType getCode() { |
| 14 | return code; | 16 | return code; |
| 15 | } | 17 | } |
| 16 | 18 | ||
| 17 | - public void setCode(int code) { | 19 | + public void setCode(MessageCodeType code) { |
| 18 | this.code = code; | 20 | this.code = code; |
| 19 | } | 21 | } |
| 20 | 22 | ||
| @@ -36,7 +38,7 @@ public class ApiClientRePlyDto { | @@ -36,7 +38,7 @@ public class ApiClientRePlyDto { | ||
| 36 | 38 | ||
| 37 | public void setReplyMessage(Message message) | 39 | public void setReplyMessage(Message message) |
| 38 | { | 40 | { |
| 39 | - message.setData(this.code); | 41 | + message.setCode(this.code); |
| 40 | message.setMessage(this.message); | 42 | message.setMessage(this.message); |
| 41 | message.setData(this.data); | 43 | message.setData(this.data); |
| 42 | } | 44 | } |
| @@ -18,7 +18,7 @@ public class PutReq { | @@ -18,7 +18,7 @@ public class PutReq { | ||
| 18 | ApiClientRePlyDto noticeMessage = new ApiClientRePlyDto(); | 18 | ApiClientRePlyDto noticeMessage = new ApiClientRePlyDto(); |
| 19 | if(jsonObject.has("code") && "1".equals(jsonObject.get("code").getAsString())) | 19 | if(jsonObject.has("code") && "1".equals(jsonObject.get("code").getAsString())) |
| 20 | { | 20 | { |
| 21 | - noticeMessage.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 21 | + noticeMessage.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 22 | noticeMessage.setMessage("操作成功"); | 22 | noticeMessage.setMessage("操作成功"); |
| 23 | } | 23 | } |
| 24 | return new AnalysisResult(false, true, jsonObject, noticeMessage); | 24 | return new AnalysisResult(false, true, jsonObject, noticeMessage); |
| @@ -29,7 +29,7 @@ public class ReadReq { | @@ -29,7 +29,7 @@ public class ReadReq { | ||
| 29 | { | 29 | { |
| 30 | noticeMessage.setData(GsonConstructor.get().fromJson(jsonObject.getAsJsonObject("data").toString(), HashMap.class)); | 30 | noticeMessage.setData(GsonConstructor.get().fromJson(jsonObject.getAsJsonObject("data").toString(), HashMap.class)); |
| 31 | } | 31 | } |
| 32 | - noticeMessage.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 32 | + noticeMessage.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 33 | noticeMessage.setMessage("操作成功"); | 33 | noticeMessage.setMessage("操作成功"); |
| 34 | } | 34 | } |
| 35 | return new AnalysisResult(false, true, rJsonObject, noticeMessage); | 35 | return new AnalysisResult(false, true, rJsonObject, noticeMessage); |
| @@ -25,7 +25,7 @@ public class PutReq { | @@ -25,7 +25,7 @@ public class PutReq { | ||
| 25 | { | 25 | { |
| 26 | message.setData(GsonConstructor.get().fromJson(jsonObject.getAsJsonObject("data"), HashMap.class)); | 26 | message.setData(GsonConstructor.get().fromJson(jsonObject.getAsJsonObject("data"), HashMap.class)); |
| 27 | } | 27 | } |
| 28 | - message.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 28 | + message.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 29 | message.setMessage("操作成功"); | 29 | message.setMessage("操作成功"); |
| 30 | } | 30 | } |
| 31 | return new AnalysisResult(false, true, jsonObject, message); | 31 | return new AnalysisResult(false, true, jsonObject, message); |
| @@ -57,7 +57,7 @@ public class PLC004ProtocolParserFactoryImpl implements ProtocolParserFactory { | @@ -57,7 +57,7 @@ public class PLC004ProtocolParserFactoryImpl implements ProtocolParserFactory { | ||
| 57 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); | 57 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); |
| 58 | if(jsonObject.has("result") && "1".equals(jsonObject.get("result").getAsString())) | 58 | if(jsonObject.has("result") && "1".equals(jsonObject.get("result").getAsString())) |
| 59 | { | 59 | { |
| 60 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 60 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 61 | apiClientRePlyDto.setMessage("操作成功"); | 61 | apiClientRePlyDto.setMessage("操作成功"); |
| 62 | } | 62 | } |
| 63 | return new AnalysisResult(false, true, data, apiClientRePlyDto); | 63 | return new AnalysisResult(false, true, data, apiClientRePlyDto); |
| @@ -31,7 +31,7 @@ public class CkaDtSndR { | @@ -31,7 +31,7 @@ public class CkaDtSndR { | ||
| 31 | Map<String,Object> wmap = new HashMap<>(); | 31 | Map<String,Object> wmap = new HashMap<>(); |
| 32 | wmap.put("1",map); | 32 | wmap.put("1",map); |
| 33 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); | 33 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); |
| 34 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 34 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 35 | apiClientRePlyDto.setData(wmap); | 35 | apiClientRePlyDto.setData(wmap); |
| 36 | return new AnalysisResult(false, true, jsonObject, apiClientRePlyDto); | 36 | return new AnalysisResult(false, true, jsonObject, apiClientRePlyDto); |
| 37 | } | 37 | } |
| @@ -93,7 +93,7 @@ public class CkaDtSndS { | @@ -93,7 +93,7 @@ public class CkaDtSndS { | ||
| 93 | if(DeviceCommandListenService.hasClienConnection(clientid)) | 93 | if(DeviceCommandListenService.hasClienConnection(clientid)) |
| 94 | { | 94 | { |
| 95 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); | 95 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); |
| 96 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 96 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 97 | apiClientRePlyDto.setData(JSONObject.parseObject(jsonObject.toString(),HashMap.class)); | 97 | apiClientRePlyDto.setData(JSONObject.parseObject(jsonObject.toString(),HashMap.class)); |
| 98 | return new AnalysisResult(true,true,jsonObject, apiClientRePlyDto); | 98 | return new AnalysisResult(true,true,jsonObject, apiClientRePlyDto); |
| 99 | } | 99 | } |
| @@ -105,5 +105,6 @@ public class DeviceProductProtocol { | @@ -105,5 +105,6 @@ public class DeviceProductProtocol { | ||
| 105 | deviceDataWriteConfigList.add(new DeviceDataConfig(72,"YC_AUTO_P002",PLCType.排污,PLCDataType.控制器状态码,"41","远程自动按钮",null,"01")); | 105 | deviceDataWriteConfigList.add(new DeviceDataConfig(72,"YC_AUTO_P002",PLCType.排污,PLCDataType.控制器状态码,"41","远程自动按钮",null,"01")); |
| 106 | deviceDataWriteConfigList.add(new DeviceDataConfig(74,"SYS_REST",PLCType.推水机,PLCDataType.复位,"01","设备故障复位",null,"1")); | 106 | deviceDataWriteConfigList.add(new DeviceDataConfig(74,"SYS_REST",PLCType.推水机,PLCDataType.复位,"01","设备故障复位",null,"1")); |
| 107 | 107 | ||
| 108 | + | ||
| 108 | } | 109 | } |
| 109 | } | 110 | } |
| @@ -24,12 +24,12 @@ public class PutReqTopic implements BusinessAgreement<PutReqDto> { | @@ -24,12 +24,12 @@ public class PutReqTopic implements BusinessAgreement<PutReqDto> { | ||
| 24 | public ServerDto analysis(Topic topic, PutReqDto data) throws Exception { | 24 | public ServerDto analysis(Topic topic, PutReqDto data) throws Exception { |
| 25 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); | 25 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); |
| 26 | apiClientRePlyDto.setData(data.getTime()); | 26 | apiClientRePlyDto.setData(data.getTime()); |
| 27 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE.code); | 27 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE); |
| 28 | apiClientRePlyDto.setMessage(data.getMsg()); | 28 | apiClientRePlyDto.setMessage(data.getMsg()); |
| 29 | switch (data.getResult()) | 29 | switch (data.getResult()) |
| 30 | { | 30 | { |
| 31 | case "1": | 31 | case "1": |
| 32 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 32 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 33 | apiClientRePlyDto.setMessage("成功"); | 33 | apiClientRePlyDto.setMessage("成功"); |
| 34 | break; | 34 | break; |
| 35 | } | 35 | } |
| @@ -25,12 +25,12 @@ public class PutReqTopic implements BusinessAgreement<PutReqDto> { | @@ -25,12 +25,12 @@ public class PutReqTopic implements BusinessAgreement<PutReqDto> { | ||
| 25 | data.setMessageid(topic.getMessageid()); | 25 | data.setMessageid(topic.getMessageid()); |
| 26 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); | 26 | ApiClientRePlyDto apiClientRePlyDto = new ApiClientRePlyDto(); |
| 27 | apiClientRePlyDto.setData(data.getData()); | 27 | apiClientRePlyDto.setData(data.getData()); |
| 28 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 28 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 29 | apiClientRePlyDto.setMessage("成功"); | 29 | apiClientRePlyDto.setMessage("成功"); |
| 30 | switch (data.getCode()) | 30 | switch (data.getCode()) |
| 31 | { | 31 | { |
| 32 | case 0: | 32 | case 0: |
| 33 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE.code); | 33 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE); |
| 34 | apiClientRePlyDto.setMessage("失败"); | 34 | apiClientRePlyDto.setMessage("失败"); |
| 35 | break; | 35 | break; |
| 36 | } | 36 | } |
| @@ -104,7 +104,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { | @@ -104,7 +104,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { | ||
| 104 | { | 104 | { |
| 105 | apiClientRePlyDto.setData(JSONObject.parseObject(data.getData().toJSONString(), HashMap.class)); | 105 | apiClientRePlyDto.setData(JSONObject.parseObject(data.getData().toJSONString(), HashMap.class)); |
| 106 | } | 106 | } |
| 107 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE.code); | 107 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_SUCCESS_CODE); |
| 108 | apiClientRePlyDto.setMessage("成功"); | 108 | apiClientRePlyDto.setMessage("成功"); |
| 109 | 109 | ||
| 110 | clienNoticeService.replySendMessage(topic, apiClientRePlyDto); | 110 | clienNoticeService.replySendMessage(topic, apiClientRePlyDto); |
| @@ -116,7 +116,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { | @@ -116,7 +116,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { | ||
| 116 | { | 116 | { |
| 117 | apiClientRePlyDto.setData(JSONObject.parseObject(data.getData().toJSONString(), HashMap.class)); | 117 | apiClientRePlyDto.setData(JSONObject.parseObject(data.getData().toJSONString(), HashMap.class)); |
| 118 | } | 118 | } |
| 119 | - apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE.code); | 119 | + apiClientRePlyDto.setCode(MessageCode.DEFAULT_FAIL_CODE); |
| 120 | apiClientRePlyDto.setMessage("失败"); | 120 | apiClientRePlyDto.setMessage("失败"); |
| 121 | clienNoticeService.replySendMessage(topic,apiClientRePlyDto); | 121 | clienNoticeService.replySendMessage(topic,apiClientRePlyDto); |
| 122 | return null; | 122 | return null; |
-
请 注册 或 登录 后发表评论