Browse Source

Merge remote-tracking branch 'origin/dev_temp' into dev_temp

master
jianjun 4 years ago
parent
commit
09bd400822
  1. 34
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  2. 6
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java
  3. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

34
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.*;
@ -14,6 +15,9 @@ import javax.servlet.http.HttpServletRequest;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* 日志切面
@ -54,6 +58,8 @@ public abstract class BaseRequestLogAspect {
// transactionSerial = UUID.randomUUID().toString();
//}
Map<String, String> requestHeaders = getRequestHeaders(request);
// 将当前线程名称设置为事务流水号
if (!StringUtils.isEmpty(transactionSerial)) {
Thread.currentThread().setName(transactionSerial);
@ -64,7 +70,8 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs()));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{},请求头:{}",
transactionSerial, requestURI, method, objectsToString(args), requestHeaders);
result = point.proceed();
resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
} catch (RenException e) {
@ -91,6 +98,23 @@ public abstract class BaseRequestLogAspect {
return result;
}
/**
* @Description 获取请求头信息
* @return
* @author wxz
* @date 2021.03.31 13:59
*/
private Map<String, String> getRequestHeaders(HttpServletRequest request) {
Enumeration<String> headerNames = request.getHeaderNames();
HashMap<String, String> headerMap = new HashMap<>();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
headerMap.put(headerName, headerValue);
}
return headerMap;
}
/**
* info日志
* @param transactionSerial
@ -225,7 +249,13 @@ public abstract class BaseRequestLogAspect {
StringBuilder builder = new StringBuilder("[");
for (Object object : args) {
if (object != null) {
builder.append(object.toString());
try {
// 尝试作为json解析
String objectString = JSON.toJSONString(object);
builder.append(objectString);
} catch (Exception e) {
builder.append(object.toString());
}
builder.append(",");
}
}

6
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java

@ -102,10 +102,10 @@ public class ExitGroupServiceImpl implements ExitGroupService {
resiTopicDao.upTopicList(delIdList, formDTO.getOperateUserId());
//2-4.话题操作日志表批量新增记录
List<ResiTopicOperationEntity> list = new ArrayList<>();
ResiTopicOperationEntity entity = new ResiTopicOperationEntity();
entity.setOperationType("hidden");
entity.setOperationReason("组员删除,话题屏蔽");
delIdList.forEach(d->{
ResiTopicOperationEntity entity = new ResiTopicOperationEntity();
entity.setOperationType("hidden");
entity.setOperationReason("组员删除,话题屏蔽");
entity.setTopicId(d);
list.add(entity);
});

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -383,11 +383,10 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
result.setGender(StringUtils.isNotBlank(userMsg.getGender()) ? userMsg.getGender() : "");
//end
}else{
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,查询不到用户信息,用户Id:{}",param.getUserId());
return result;
logger.warn("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,user_base_info查询不到用户信息,用户Id:{}",param.getUserId());
}
if(null == currentGrid || StringUtils.isBlank(currentGrid.getGridId())){
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,查询不到用户最近访问的网格,用户Id:{}",param.getUserId());
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,grid_latest查询不到用户最近访问的网格,用户Id:{}",param.getUserId());
return result;
}
result.setCustomerId(currentGrid.getCustomerId());
@ -407,9 +406,9 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
Result<ExtUserInfoResultDTO> govOrgResult =
govOrgOpenFeignClient.userInfoExt(result);
if(govOrgResult.success() && null != govOrgResult.getData()){
return govOrgResult.getData();}
if (govOrgResult.success() && null != govOrgResult.getData()) {
return govOrgResult.getData();
}
return result;
}
}

Loading…
Cancel
Save