사이트관리 > 사용자관리 로그 삽입 구문 추가.
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 (
|
||||
<>
|
||||
<Modal.Header closeButton>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
|||
private static final long serialVersionUID = -3779821913760046011L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "upl_seq")
|
||||
private Long uplSeq;
|
||||
|
||||
|
|
@ -46,4 +47,7 @@ public class ThPrivacyLog extends BoardParams implements Serializable {
|
|||
@Column(name = "access_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
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 org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -33,4 +35,15 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
|||
|
||||
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;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||
import com.dbnt.kcscbackend.admin.users.service.AdminUsersService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
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.ResponseCode;
|
||||
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.responses.ApiResponse;
|
||||
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.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -33,6 +36,7 @@ import java.util.Map;
|
|||
public class AdminUsersController extends BaseController {
|
||||
|
||||
private final AdminUsersService adminUsersService;
|
||||
private final AdminLogsService adminLogsService;
|
||||
private final CommonCodeService commonCodeService;
|
||||
|
||||
@Operation(
|
||||
|
|
@ -45,7 +49,8 @@ public class AdminUsersController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@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();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
params.setQueryInfo();
|
||||
|
|
@ -68,11 +73,12 @@ public class AdminUsersController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@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();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
||||
resultVO.setResult(resultMap);
|
||||
/*resultMap.put("userInfo", adminUsersService.selectUserInfo(params.getUserSeq()));
|
||||
resultVO.setResult(resultMap);*/
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +92,8 @@ public class AdminUsersController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@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();
|
||||
if(errors.hasErrors()){
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
|
@ -130,7 +137,8 @@ public class AdminUsersController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@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();
|
||||
adminUsersService.deleteUserInfo(info.getUserSeq());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
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.auth.entity.UserInfo;
|
||||
import com.dbnt.kcscbackend.auth.repository.UserInfoRepository;
|
||||
|
|
|
|||
Loading…
Reference in New Issue