Commit 6022f8e5 authored by wangsong's avatar wangsong

add business log

parent ee6634a3
package com.chineseall.eden.authcenter.log.service.impl; package com.chineseall.eden.authcenter.log.service.impl;
import cn.sh.chineseall.framework.core.util.CollectionUtils; import cn.sh.chineseall.framework.core.util.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.chineseall.eden.authcenter.log.dao.AuthLogDao; import com.chineseall.eden.authcenter.log.dao.AuthLogDao;
import com.chineseall.eden.authcenter.log.model.AuthLog; import com.chineseall.eden.authcenter.log.model.AuthLog;
import com.chineseall.eden.authcenter.log.model.AuthLogHourCount; import com.chineseall.eden.authcenter.log.model.AuthLogHourCount;
import com.chineseall.eden.authcenter.log.service.AuthLogService; import com.chineseall.eden.authcenter.log.service.AuthLogService;
import com.chineseall.eden.authcenter.log.util.BusinessLogUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -26,10 +28,12 @@ public class AuthLogServiceImpl implements AuthLogService { ...@@ -26,10 +28,12 @@ public class AuthLogServiceImpl implements AuthLogService {
if(authLog.getId() != null){ if(authLog.getId() != null){
authLog.setUpdateTime(new Date()); authLog.setUpdateTime(new Date());
authLogDao.replace(authLog); authLogDao.replace(authLog);
BusinessLogUtils.info(JSON.toJSONString(authLog));
} else{ } else{
authLog.setId(UUID.randomUUID().toString()); authLog.setId(UUID.randomUUID().toString());
authLog.setCreateTime(new Date()); authLog.setCreateTime(new Date());
authLogDao.insert(authLog); authLogDao.insert(authLog);
BusinessLogUtils.info(JSON.toJSONString(authLog));
} }
} }
......
package com.chineseall.eden.authcenter.log.util; package com.chineseall.eden.authcenter.log.util;
import cn.sh.chineseall.framework.core.util.MapUtils; import cn.sh.chineseall.framework.core.util.MapUtils;
import cn.sh.chineseall.framework.core.util.StringUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -17,4 +18,11 @@ public class BusinessLogUtils { ...@@ -17,4 +18,11 @@ public class BusinessLogUtils {
} }
logger.info(JSON.toJSONString(data)); logger.info(JSON.toJSONString(data));
} }
public static void info(String jsonData){
if(StringUtils.isBlank(jsonData)){
return;
}
logger.info(jsonData);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment