wuxw пре 1 година
родитељ
комит
b101ca19bb

+ 21 - 0
java110-core/src/main/java/com/java110/core/client/OutRestTemplate.java

@@ -22,6 +22,7 @@ import org.springframework.lang.Nullable;
 import org.springframework.web.client.HttpStatusCodeException;
 import org.springframework.web.client.RestClientException;
 
+import java.net.URI;
 import java.util.Date;
 
 /**
@@ -110,5 +111,25 @@ public class OutRestTemplate extends RestTemplate {
         return responseEntity;
     }
 
+    @Override
+    public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
+        String errMsg = "";
+        T resMsg;
+        Date startTime = DateUtil.getCurrentDate();
+        try {
+            logger.debug("请求信息:url:{},method:GET", url);
+             resMsg = super.getForObject(url, responseType,uriVariables);
+            logger.debug("返回信息:responseEntity:{}", resMsg);
+        } catch (HttpStatusCodeException e) {
+            errMsg = ExceptionUtil.getStackTrace(e);
+            throw e;
+        } finally {
+              ResponseEntity  tmpResponseEntity = new ResponseEntity(errMsg, HttpStatus.OK);
+            //  saveLog(url, "POST", null, tmpResponseEntity, DateUtil.getCurrentDate().getTime() - startTime.getTime());
+            LogFactory.saveOutLog(url, "POST", DateUtil.getCurrentDate().getTime() - startTime.getTime(), null, "", tmpResponseEntity);
+        }
+        return resMsg;
+    }
+
 
 }

+ 12 - 0
java110-core/src/main/java/com/java110/core/client/RestTemplate.java

@@ -6,10 +6,13 @@ import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 import org.springframework.lang.Nullable;
+import org.springframework.web.client.HttpMessageConverterExtractor;
 import org.springframework.web.client.RequestCallback;
 import org.springframework.web.client.ResponseExtractor;
 import org.springframework.web.client.RestClientException;
 
+import java.net.URI;
+
 /**
  * @author wux
  * @create 2019-02-02 下午8:28
@@ -54,4 +57,13 @@ public class RestTemplate extends org.springframework.web.client.RestTemplate {
         return responseEntity;
     }
 
+    @Override
+    public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
+
+        logger.debug("请求信息:url:{},method:GET", url);
+        T responseEntity = super.getForObject(url, responseType,uriVariables);
+        logger.debug("返回信息:responseEntity:{}", responseEntity);
+        return responseEntity;
+    }
+
 }

+ 2 - 1
service-job/src/main/java/com/java110/job/msgNotify/WechatTemplateImpl.java

@@ -10,6 +10,7 @@ import com.java110.utils.cache.CommonCache;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.constant.MappingConstant;
 import com.java110.utils.constant.WechatConstant;
+import com.java110.utils.util.ListUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
@@ -250,7 +251,7 @@ public class WechatTemplateImpl implements IWechatTemplate {
         smallWeChatDto.setObjId(communityId);
         List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
 
-        if (smallWeChatDtos == null || smallWeChatDtos.size() < 1) {
+        if (ListUtil.isNull(smallWeChatDtos)) {
             String appIdCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appId");
             String appSecretCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "appSecret");
             String mchIdCache = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "mchId");