Forráskód Böngészése

增加日志记录参数

koul 4 éve
szülő
commit
4264c8ce82

+ 7 - 1
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -11,6 +11,8 @@ import com.uas.eis.sdk.entity.ApiResult;
 import com.uas.eis.sdk.resp.ApiResponse;
 import com.uas.eis.service.ERPService;
 import com.uas.eis.utils.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.stereotype.Service;
@@ -25,6 +27,8 @@ import java.util.Map;
  */
 @Service
 public class ERPServiceImpl implements ERPService {
+
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());
     private static Map<String,String> tokenConfig = TokenProperties.getAllProperty();
 
     @Autowired
@@ -87,8 +91,9 @@ public class ERPServiceImpl implements ERPService {
 
     private ApiResult<String> syncMES(String params,String url){
         try {
-            System.err.println(params);
+            logger.info("params:"+params);
             String post = PSHttpUtils.sendPost(tokenConfig.get("mesHttp") + url, params);
+            logger.info("post:"+post);
             JSONObject jsonObject = JSON.parseObject(post);
             int code = jsonObject.getIntValue("result");
             if (code==0){
@@ -99,6 +104,7 @@ public class ERPServiceImpl implements ERPService {
                 return ApiResponse.failRsp("102","接口调用异常,请联系MES处理!");
             }
         }catch (Exception e){
+            logger.info("异常信息:"+e.getMessage());
             return ApiResponse.failRsp("102","接口调用异常,请联系MES处理!");
         }
     }