Browse Source

日志之前逻辑加 新字段

dev
zxc 3 years ago
parent
commit
67b47a5b29
  1. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java
  2. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java
  3. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java
  4. 16
      epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java
  5. 2
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java
  6. 2
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/LoginMQMsg.java
  7. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  8. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/entity/LogOperationEntity.java

@ -79,6 +79,8 @@ public class LogOperationEntity extends BaseEpmetEntity {
* 操作人手机号 * 操作人手机号
*/ */
private String operatorMobile; private String operatorMobile;
private String orgId;
private String orgIdPath;
/** /**
* 操作时间,该时间不是插入数据的时间而是操作发生的真实时间 * 操作时间,该时间不是插入数据的时间而是操作发生的真实时间

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/AuthOperationLogListener.java

@ -78,6 +78,8 @@ public class AuthOperationLogListener implements MessageListenerConcurrently {
logEntity.setOperatorMobile(operatorInfo.getMobile()); logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatingTime(msgObj.getLoginTime()); logEntity.setOperatingTime(msgObj.getLoginTime());
logEntity.setContent("成功登录系统"); logEntity.setContent("成功登录系统");
logEntity.setOrgIdPath(msgObj.getOrgIdPath());
logEntity.setOrgId(msgObj.getOrgId());
DistributedLock distributedLock = null; DistributedLock distributedLock = null;
RLock lock = null; RLock lock = null;

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/listener/CheckAndExportOperationLogListener.java

@ -76,6 +76,8 @@ public class CheckAndExportOperationLogListener implements MessageListenerConcur
logEntity.setOperatorMobile(operatorInfo.getMobile()); logEntity.setOperatorMobile(operatorInfo.getMobile());
logEntity.setOperatingTime(msgObj.getOperateTime()); logEntity.setOperatingTime(msgObj.getOperateTime());
logEntity.setContent(msgObj.getContent()); logEntity.setContent(msgObj.getContent());
logEntity.setOrgId(msgObj.getOrgId());
logEntity.setOrgIdPath(msgObj.getOrgIdPath());
DistributedLock distributedLock = null; DistributedLock distributedLock = null;
RLock lock = null; RLock lock = null;

16
epmet-auth/src/main/java/com/epmet/service/impl/IcLoginServiceImpl.java

@ -5,11 +5,14 @@ import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.commons.rocketmq.messages.LoginMQMsg; import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.IcTokenDto; import com.epmet.commons.tools.security.dto.IcTokenDto;
import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.IpUtils; import com.epmet.commons.tools.utils.IpUtils;
@ -23,6 +26,7 @@ import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils; import com.epmet.jwt.JwtTokenUtils;
import com.epmet.service.IcLoginService; import com.epmet.service.IcLoginService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
@ -78,7 +82,7 @@ public class IcLoginServiceImpl implements IcLoginService, ResultDataResolver {
//7.发送登录事件 //7.发送登录事件
try { try {
sendLoginEvent(staffId, app, client); sendLoginEvent(staffId, app, client,agencyInfo.getCustomerId());
} catch (RenException e) { } catch (RenException e) {
log.error(e.getInternalMsg()); log.error(e.getInternalMsg());
} catch (Exception e) { } catch (Exception e) {
@ -113,16 +117,20 @@ public class IcLoginServiceImpl implements IcLoginService, ResultDataResolver {
* @author wxz * @author wxz
* @date 2021.10.26 13:45:59 * @date 2021.10.26 13:45:59
*/ */
private void sendLoginEvent(String userId, String fromApp, String fromClient) { private void sendLoginEvent(String userId, String fromApp, String fromClient, String customerId) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if (null == staffInfo){
throw new EpmetException("未查询到工作人员信息:"+userId);
}
LoginMQMsg loginMQMsg = new LoginMQMsg(); LoginMQMsg loginMQMsg = new LoginMQMsg();
loginMQMsg.setUserId(userId); loginMQMsg.setUserId(userId);
loginMQMsg.setLoginTime(new Date()); loginMQMsg.setLoginTime(new Date());
loginMQMsg.setIp(IpUtils.getIpAddr(request)); loginMQMsg.setIp(IpUtils.getIpAddr(request));
loginMQMsg.setFromApp(fromApp); loginMQMsg.setFromApp(fromApp);
loginMQMsg.setFromClient(fromClient); loginMQMsg.setFromClient(fromClient);
loginMQMsg.setOrgId(staffInfo.getAgencyId());
loginMQMsg.setOrgIdPath(StringUtils.isBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds().concat(":").concat(staffInfo.getAgencyId()));
SystemMsgFormDTO form = new SystemMsgFormDTO(); SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(AuthOperationConstants.LOGIN); form.setMessageType(AuthOperationConstants.LOGIN);
form.setContent(loginMQMsg); form.setContent(loginMQMsg);

2
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CheckMQMsg.java

@ -27,5 +27,7 @@ public class CheckMQMsg {
private String fromApp; private String fromApp;
private String fromClient; private String fromClient;
private String orgId;
private String orgIdPath;
} }

2
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/LoginMQMsg.java

@ -22,5 +22,7 @@ public class LoginMQMsg {
private String fromApp; private String fromApp;
private String fromClient; private String fromClient;
private String orgId;
private String orgIdPath;
} }

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -997,7 +997,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
String customerId = tokenDto.getCustomerId(); String customerId = tokenDto.getCustomerId();
String userId = tokenDto.getUserId(); String userId = tokenDto.getUserId();
CheckMQMsg msg = new CheckMQMsg(); CheckMQMsg msg = new CheckMQMsg();
if (formDTO.getType().equals(NeighborhoodConstant.HOUSE)){ if (formDTO.getType().equals(NeighborhoodConstant.CHECK_HOUSE)){
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(customerId, formDTO.getId()); HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(customerId, formDTO.getId());
if (null == houseInfo){ if (null == houseInfo){
throw new EpmetException("查询房屋信息失败:"+formDTO.getId()); throw new EpmetException("查询房屋信息失败:"+formDTO.getId());
@ -1005,7 +1005,7 @@ public class EpmetUserServiceImpl implements EpmetUserService {
result.setMobile(houseInfo.getOwnerPhone()); result.setMobile(houseInfo.getOwnerPhone());
result.setIdCard(houseInfo.getOwnerIdCard()); result.setIdCard(houseInfo.getOwnerIdCard());
msg.setContent("查看"+houseInfo.getAllName()+"房屋的敏感信息"); msg.setContent("查看"+houseInfo.getAllName()+"房屋的敏感信息");
}else if (formDTO.getType().equals(NeighborhoodConstant.IC_RESI_USER)){ }else if (formDTO.getType().equals(NeighborhoodConstant.CHECK_IC_RESI_USER)){
IcResiUserInfoCache icResiUserInfo = CustomerResiUserRedis.getIcResiUserInfo(formDTO.getId()); IcResiUserInfoCache icResiUserInfo = CustomerResiUserRedis.getIcResiUserInfo(formDTO.getId());
if (null == icResiUserInfo){ if (null == icResiUserInfo){
throw new EpmetException("查询icResiUser失败:"+formDTO.getId()); throw new EpmetException("查询icResiUser失败:"+formDTO.getId());
@ -1084,6 +1084,12 @@ public class EpmetUserServiceImpl implements EpmetUserService {
msg.setType(formDTO.getType()); msg.setType(formDTO.getType());
msg.setTypeDisplay(msg.getContent()); msg.setTypeDisplay(msg.getContent());
msg.setUserId(userId); msg.setUserId(userId);
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId);
if(null == staffInfo){
throw new EpmetException("未查询到工作人员信息:"+userId);
}
msg.setOrgId(staffInfo.getAgencyId());
msg.setOrgIdPath(StringUtils.isBlank(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds().concat(":").concat(staffInfo.getAgencyId()));
msg.setFromApp(tokenDto.getApp()); msg.setFromApp(tokenDto.getApp());
msg.setIp(IpUtils.getIpAddr(request)); msg.setIp(IpUtils.getIpAddr(request));
msg.setFromClient(tokenDto.getClient()); msg.setFromClient(tokenDto.getClient());

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/constant/NeighborhoodConstant.java

@ -15,11 +15,13 @@ public interface NeighborhoodConstant {
String NEIGHBOR_HOOD= "neighbourHood"; String NEIGHBOR_HOOD= "neighbourHood";
String BUILDING = "building"; String BUILDING = "building";
String HOUSE = "house"; String HOUSE = "house";
String CHECK_HOUSE = "checkHouse";
/** /**
* ic居民 * ic居民
*/ */
String IC_RESI_USER = "icResiUser"; String IC_RESI_USER = "icResiUser";
String CHECK_IC_RESI_USER = "checkIcResiUser";
/** /**
* 居民防疫信息 * 居民防疫信息

Loading…
Cancel
Save