作者 朱兆平

异常日志优化

@@ -58,25 +58,42 @@ public class Custom_Response_Processor { @@ -58,25 +58,42 @@ public class Custom_Response_Processor {
58 58
59 } 59 }
60 60
  61 + /**
  62 + * 通过总线消费服务获取回执数据
  63 + */
61 public void analysis(){ 64 public void analysis(){
  65 + try {
62 ResultJson<List<String>> listResultJson = kafkaReciveApi.recive(USER_NAME); 66 ResultJson<List<String>> listResultJson = kafkaReciveApi.recive(USER_NAME);
63 log.info("2-获取结果为:{},数量为:{}",listResultJson.toString(),listResultJson.getData().size()); 67 log.info("2-获取结果为:{},数量为:{}",listResultJson.toString(),listResultJson.getData().size());
64 - if ("200".equals(listResultJson.getCode()) && listResultJson.getData()!=null && listResultJson.getData().size()>0){ 68 + if ("200".equals(listResultJson.getCode()) && listResultJson.getData()!=null && !listResultJson.getData().isEmpty()){
  69 + responseResolve(listResultJson);
  70 + }else {
  71 + log.info("[CONSUMER-RESULT] - 未获取到消息,code:{},msg:{},data:{}",listResultJson.getCode(),listResultJson.getMsg(),listResultJson.getData());
  72 + }
  73 + } catch (Exception e) {
  74 + log.error("[CONSUMER-ERR]!!!获取消息异常,开始获取下一条消息!!!->{}",e.toString());
  75 + e.printStackTrace();
  76 + }
  77 + }
  78 +
  79 + /**
  80 + * 处理接收到的总线数据
  81 + * @param listResultJson
  82 + */
  83 + public void responseResolve(ResultJson<List<String>> listResultJson){
65 log.info("3-开始处理获取数据"); 84 log.info("3-开始处理获取数据");
66 List<String> dataList = listResultJson.getData(); 85 List<String> dataList = listResultJson.getData();
67 for (int i = 0; i <dataList.size() ; i++) { 86 for (int i = 0; i <dataList.size() ; i++) {
68 String msg = dataList.get(i); 87 String msg = dataList.get(i);
69 try{ 88 try{
  89 + log.info("3.1-开始解析数据-[{}]",msg);
70 analysisMessage(msg,i); 90 analysisMessage(msg,i);
71 }catch (Exception e){ 91 }catch (Exception e){
72 - log.error("[Analysis-ERR]!!!{}报文内容解析异常:{},开始处理下一条消息!!!",msg,e.toString()); 92 + log.error("[Resolve-ERR]!!!{}报文内容解析异常:{},开始处理下一条消息!!!",msg,e.toString());
73 e.printStackTrace(); 93 e.printStackTrace();
74 } 94 }
75 95
76 } 96 }
77 - }else {  
78 - log.info("[CONSUMER-RESULT] - 未获取到消息");  
79 - }  
80 } 97 }
81 98
82 public void analysisMessage(String msg,int i){ 99 public void analysisMessage(String msg,int i){