Пример #1
0
  public void logModifyUserBaseInfo(UserBaseInfo oldUser, UserBaseDTO newUser) throws Exception {
    BusiLogDTO busiLogDTO = new BusiLogDTO();
    busiLogDTO.setKeyWord(newUser.getUserId().toString());
    busiLogDTO.setKeyWordType(TypeEnum.KeyWordType.USER_ID.getKey());
    busiLogDTO.setBusiTypeCode(CommonEnum.BusiOperType.ModifyUserInfo.getKey());
    busiLogDTO.setOperId(newUser.getOperId());

    Map<String, Object> oldMap = new LinkedHashMap<String, Object>();
    Map<String, Object> newMap = new LinkedHashMap<String, Object>();

    if (null != newUser.getMobile()
        && !CommonValidationUtil.equals(oldUser.getMobile(), newUser.getMobile())) {
      oldMap.put("手机号", oldUser.getMobile());
      newMap.put("手机号", newUser.getMobile());
    }
    if (null != newUser.getPetName()
        && !CommonValidationUtil.equals(oldUser.getPetName(), newUser.getPetName())) {
      oldMap.put("呢称", oldUser.getPetName());
      newMap.put("呢称", newUser.getPetName());
    }
    if (null != newUser.getEmail()
        && !CommonValidationUtil.equals(oldUser.getEmail(), newUser.getEmail())) {
      oldMap.put("邮箱", oldUser.getEmail());
      newMap.put("邮箱", newUser.getEmail());
    }
    if (null != newUser.getUserLevel()
        && !CommonValidationUtil.equals(oldUser.getUserLevel(), newUser.getUserLevel())) {
      oldMap.put("用户等级", oldUser.getUserLevel());
      newMap.put("用户等级", newUser.getUserLevel());
    }
    if (null != newUser.getCustLevel()
        && !CommonValidationUtil.equals(oldUser.getCustLevel(), newUser.getCustLevel())) {
      oldMap.put("客户等级", oldUser.getCustLevel());
      newMap.put("客户等级", newUser.getCustLevel());
    }

    boolean bl = false;
    if (!oldMap.isEmpty()) {
      bl = true;
      busiLogDTO.setBeforeContent(jsonUtils.toJson(oldMap));
    }
    if (!newMap.isEmpty()) {
      bl = true;
      busiLogDTO.setAfterContent(jsonUtils.toJson(newMap));
    }
    if (bl) {
      logService.insertBusiLog(busiLogDTO);
    }
  }
Пример #2
0
  public void logModifyUserState(
      UserBaseInfo userBaseInfo, String busiOperType, String oldState, String newState)
      throws Exception {
    BusiLogDTO busiLogDTO = new BusiLogDTO();
    busiLogDTO.setKeyWord(userBaseInfo.getUserId().toString());
    busiLogDTO.setKeyWordType(TypeEnum.KeyWordType.USER_ID.getKey());
    busiLogDTO.setBusiTypeCode(busiOperType);
    busiLogDTO.setOperId(userBaseInfo.getOperId());

    Map<String, Object> map = new LinkedHashMap<String, Object>();
    map.put("用户状态", TypeEnum.UserState.getList().get(oldState));
    busiLogDTO.setBeforeContent(jsonUtils.toJson(map));

    map = new LinkedHashMap<String, Object>();
    map.put("用户状态", TypeEnum.UserState.getList().get(newState));

    busiLogDTO.setAfterContent(jsonUtils.toJson(map));
    logService.insertBusiLog(busiLogDTO);
  }