1.修改调用uce接口响应结果
Showing
3 changed files
with
14 additions
and
7 deletions
... | @@ -126,8 +126,8 @@ public class UcEventBusIptv2ManagementUcEngine { | ... | @@ -126,8 +126,8 @@ public class UcEventBusIptv2ManagementUcEngine { |
126 | JSONObject jsonObject = JSONObject.parseObject(msgData, JSONObject.class); | 126 | JSONObject jsonObject = JSONObject.parseObject(msgData, JSONObject.class); |
127 | Object platformAccount = jsonObject.get("platformAccount"); | 127 | Object platformAccount = jsonObject.get("platformAccount"); |
128 | if (Objects.nonNull(platformAccount)) { | 128 | if (Objects.nonNull(platformAccount)) { |
129 | JSONObject response = this.restTemplateClient.dealTask(playContent); | 129 | boolean response = this.restTemplateClient.dealTask(playContent); |
130 | if (Objects.isNull(response)) { | 130 | if (!response) { |
131 | log.error("uc-engine响应超时,请检查uc-engine服务"); | 131 | log.error("uc-engine响应超时,请检查uc-engine服务"); |
132 | throw new BadRequestException("uc-engine响应超时"); | 132 | throw new BadRequestException("uc-engine响应超时"); |
133 | } | 133 | } | ... | ... |
... | @@ -53,8 +53,8 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -53,8 +53,8 @@ public class UcGatewayIptv2IptvConsumer { |
53 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); | 53 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); |
54 | 54 | ||
55 | if (Objects.nonNull(dataSyncMsg)) { | 55 | if (Objects.nonNull(dataSyncMsg)) { |
56 | JSONObject jsonObject = this.restTemplateClient.dealTask(dataSyncMsg); | 56 | boolean jsonObject = this.restTemplateClient.dealTask(dataSyncMsg); |
57 | if (Objects.isNull(jsonObject)) { | 57 | if (!jsonObject) { |
58 | throw new BadRequestException("uce处理任务响应超时"); | 58 | throw new BadRequestException("uce处理任务响应超时"); |
59 | } | 59 | } |
60 | } | 60 | } | ... | ... |
... | @@ -41,7 +41,7 @@ public class RestTemplateClient { | ... | @@ -41,7 +41,7 @@ public class RestTemplateClient { |
41 | restTemplate = new RestTemplate(factory); | 41 | restTemplate = new RestTemplate(factory); |
42 | } | 42 | } |
43 | 43 | ||
44 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { | 44 | public boolean dealTask(DataSyncMsg dataSyncMsg) { |
45 | try { | 45 | try { |
46 | String url = BASE_URL + "/uce/taskOperation/dealTask"; | 46 | String url = BASE_URL + "/uce/taskOperation/dealTask"; |
47 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); | 47 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
... | @@ -50,13 +50,20 @@ public class RestTemplateClient { | ... | @@ -50,13 +50,20 @@ public class RestTemplateClient { |
50 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); | 50 | log.info("request url is ==>> {} || param is ==>> {} ", url, objectObjectHashMap); |
51 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 51 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
52 | log.info("response ==>> {}", responseEntity); | 52 | log.info("response ==>> {}", responseEntity); |
53 | return getParseResponseResult(responseEntity); | 53 | |
54 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | ||
55 | String entityBody = responseEntity.getBody(); | ||
56 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
57 | if (jsonObject.getInteger("businessCode").equals(ResponseStatus.OK)) { | ||
58 | return true; | ||
59 | } | ||
60 | } | ||
54 | 61 | ||
55 | } catch (Exception e) { | 62 | } catch (Exception e) { |
56 | log.error("处理普通权益任务(ApiUti.dealTask)信息时出现异常,cause ==>> {}", e.getMessage()); | 63 | log.error("处理普通权益任务(ApiUti.dealTask)信息时出现异常,cause ==>> {}", e.getMessage()); |
57 | } | 64 | } |
58 | 65 | ||
59 | return null; | 66 | return false; |
60 | } | 67 | } |
61 | 68 | ||
62 | public Boolean unsubscribe(SubscribeBean subscribeBean) { | 69 | public Boolean unsubscribe(SubscribeBean subscribeBean) { | ... | ... |
-
Please register or sign in to post a comment