사이트관리 > 사용자관리 로그 삽입 구문 추가.
parent
ee6b850bc4
commit
71e513dd68
|
|
@ -57,6 +57,25 @@ function UserInfoModal({savedInfo, reloadFunction}){
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function modalOpen(){
|
||||||
|
EgovNet.requestFetch(
|
||||||
|
'/admin/users/info?userId='+savedInfo?.userId,
|
||||||
|
{
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
'Content-type': 'application/json'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(resp) => {
|
||||||
|
debugger
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
modalOpen();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
||||||
private static final long serialVersionUID = -3779821913760046011L;
|
private static final long serialVersionUID = -3779821913760046011L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "upl_seq")
|
@Column(name = "upl_seq")
|
||||||
private Long uplSeq;
|
private Long uplSeq;
|
||||||
|
|
||||||
|
|
@ -46,4 +47,7 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
||||||
@Column(name = "access_dt")
|
@Column(name = "access_dt")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate accessDt;
|
private LocalDate accessDt;
|
||||||
|
|
||||||
|
@Column(name = "session_id")
|
||||||
|
private String sessionId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -33,4 +35,15 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void insertPrivacyLog(String userId, String ipAddress, String accessType, String targetUserId){
|
||||||
|
ThPrivacyLog log = new ThPrivacyLog();
|
||||||
|
log.setUserId(userId);
|
||||||
|
log.setAccessDt(LocalDate.now());
|
||||||
|
log.setIpAddress(ipAddress);
|
||||||
|
log.setAccessType(accessType);
|
||||||
|
log.setTargetUserId(targetUserId);
|
||||||
|
privacyLogsRepository.save(log);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dbnt.kcscbackend.admin.users;
|
package com.dbnt.kcscbackend.admin.users;
|
||||||
|
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||||
import com.dbnt.kcscbackend.admin.users.service.AdminUsersService;
|
import com.dbnt.kcscbackend.admin.users.service.AdminUsersService;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
|
|
@ -8,6 +9,7 @@ import com.dbnt.kcscbackend.commonCode.service.CommonCodeService;
|
||||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
|
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
|
@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -33,6 +36,7 @@ import java.util.Map;
|
||||||
public class AdminUsersController extends BaseController {
|
public class AdminUsersController extends BaseController {
|
||||||
|
|
||||||
private final AdminUsersService adminUsersService;
|
private final AdminUsersService adminUsersService;
|
||||||
|
private final AdminLogsService adminLogsService;
|
||||||
private final CommonCodeService commonCodeService;
|
private final CommonCodeService commonCodeService;
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
|
|
@ -45,7 +49,8 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/list")
|
@RequestMapping(method = RequestMethod.GET, value = "/list")
|
||||||
public ResultVO getUserList(UserInfo params) throws Exception{
|
public ResultVO getUserList(UserInfo params, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||||
|
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_LIST", null);
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
params.setQueryInfo();
|
params.setQueryInfo();
|
||||||
|
|
@ -68,11 +73,12 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/info")
|
@RequestMapping(method = RequestMethod.GET, value = "/info")
|
||||||
public ResultVO getUserInfo(UserInfo params) throws Exception{
|
public ResultVO getUserInfo(UserInfo params, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||||
|
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_VIEW", params.getUserId());
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
/*resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
||||||
resultVO.setResult(resultMap);
|
resultVO.setResult(resultMap);*/
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,7 +92,8 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/info")
|
@RequestMapping(method = RequestMethod.PUT, value = "/info")
|
||||||
public ResultVO modifyUserInfo(@RequestBody @Valid UserInfo info, Errors errors, @AuthenticationPrincipal LoginVO user) throws Exception{
|
public ResultVO modifyUserInfo(@RequestBody @Valid UserInfo info, Errors errors, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||||
|
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_UPDT", info.getUserId());
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
if(errors.hasErrors()){
|
if(errors.hasErrors()){
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
|
|
@ -130,7 +137,8 @@ public class AdminUsersController extends BaseController {
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||||
})
|
})
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/info", consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.DELETE, value = "/info", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResultVO deleteUserInfo(@RequestBody UserInfo info) throws Exception{
|
public ResultVO deleteUserInfo(@RequestBody UserInfo info, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||||
|
adminLogsService.insertPrivacyLog(user.getId(), ClientUtils.getRemoteIP(request), "PRV_DLT", info.getUserId());
|
||||||
ResultVO resultVO = new ResultVO();
|
ResultVO resultVO = new ResultVO();
|
||||||
adminUsersService.deleteUserInfo(info.getUserSeq());
|
adminUsersService.deleteUserInfo(info.getUserSeq());
|
||||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.users.service;
|
package com.dbnt.kcscbackend.admin.users.service;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
||||||
import com.dbnt.kcscbackend.admin.users.mapper.AdminUsersMapper;
|
import com.dbnt.kcscbackend.admin.users.mapper.AdminUsersMapper;
|
||||||
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
import com.dbnt.kcscbackend.auth.entity.UserInfo;
|
||||||
import com.dbnt.kcscbackend.auth.repository.UserInfoRepository;
|
import com.dbnt.kcscbackend.auth.repository.UserInfoRepository;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue