Skip to content

Commit

Permalink
Merge pull request #128 from in27sung/dashboard1
Browse files Browse the repository at this point in the history
Dashboard1
  • Loading branch information
BowWowBow authored Dec 11, 2024
2 parents 881d14e + c0ea2bc commit 6ca03fe
Show file tree
Hide file tree
Showing 15 changed files with 799 additions and 372 deletions.
141 changes: 106 additions & 35 deletions stockMate/src/main/java/com/stockm8/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ public class UserController {
// http://localhost:8088/user/signin (o)
// http://localhost:8088/user/main (o)
// http://localhost:8088/user/signup (o)
// http://localhost:8088/dashboard (o)
// http://localhost:8088/user/dashboard (o)
// http://localhost:8088/user/info1 (o)
// http://localhost:8088/user/info2 (o)
// http://localhost:8088/user/editinfo1 (o)
// http://localhost:8088/user/editinfo2 (o)
// http://localhost:8088/user/consultation (o)
// http://localhost:8088/user/changepassword1 (o)

// 회원가입 - 정보입력 / GET 방식
@RequestMapping(value = "/signup", method = RequestMethod.GET)
Expand All @@ -60,13 +62,13 @@ public String userSignUpPOST(/* @ModelAttribute */ UserVO user) throws Exception
logger.info("Role received: " + user.getRole());

// 전달정보 저장
// logger.info("vo :" + user);
logger.info("vo :" + user);

// userDAO객체가 필요 => 주입
// DB에 정보를 전달 - 회원가입동작 실행
// mdao.userJoin(vo); // => 잘못됨
// 서비스 -> DAO 호출
// userService.userJoin(user);
userService.userJoin(user);

// 로그인 페이지로 이동
return "redirect:/user/signin";
Expand Down Expand Up @@ -200,40 +202,109 @@ public String userInfo2GET(Model model, HttpSession session) throws Exception {
// }
//

// 회원정보 수정 - GET
// (기존정보를 가져와서 보여주고, 수정할 정보를 입력)
@RequestMapping(value = "/editinfo1", method = RequestMethod.GET)
public void userUpdateGET(@SessionAttribute("userId") Long userId, Model model) throws Exception {
logger.info(" userUpdateGET() 호출 ");

// 사용자의 ID정보를 가져오기(세션)
logger.info("userId : " + userId);

// 서비스 -> DAO 회원정보 가져오는 동작 호출
UserVO resultVO = userService.getUser(userId);

// 연결된 뷰페이지에 출력
// => model 객체에 정보 저장
model.addAttribute("resultVO", resultVO);
// /user/update.jsp 뷰페이지 연결
}

// 회원정보 수정 - POST
// (수정된 정보를 전달받아서 정보 수정)
@RequestMapping(value = "/editinfo2", method = RequestMethod.POST)
public String userUpdatePOST(UserVO user) throws Exception {
logger.info(" userUpdatePOST() ");

// 전달정보(수정정보) 저장
logger.info("vo : " + user);

// 서비스 -> DAO 호출 (회원정보 수정)
userService.updateUser(user);
// 회원정보 수정 - /user/info1 (GET)
@RequestMapping(value = "/editinfo1", method = RequestMethod.GET)
public String usereditinfo1GET(Model model, HttpSession session) throws Exception {
Long userId = (Long) session.getAttribute("id");
// if (id == null) {
// // 세션에 id가 없으면 에러 처리
// return "redirect:/user/main";
// }
UserVO resultVO = userService.getUser(userId);
model.addAttribute("resultVO", resultVO);
return "user/editinfo1";
}
// 회원정보 수정 - /user/info1 (GET)
@RequestMapping(value = "/editinfo2", method = RequestMethod.POST)
public String usereditinfo2GET(Model model, HttpSession session) throws Exception {


logger.info("ㅇㄻ니");
Long userId = (Long) session.getAttribute("id");
// if (id == null) {
// // 세션에 id가 없으면 에러 처리
// return "redirect:/user/main";
// }
UserVO resultVO = userService.getUser(userId);
model.addAttribute("resultVO", resultVO);
return "/user/editinfo2";
}



// 비밀번호 찾기 - get
@RequestMapping(value = "/findPassword", method = RequestMethod.GET)
public String findPasswordGet() {

// 수정완료시 메인페이지로 이동
return "redirect:/dashboard";
}
return "/user/findPassword";
}


// // 회원정보 수정 - GET
// // (기존정보를 가져와서 보여주고, 수정할 정보를 입력)
// @RequestMapping(value = "/editinfo1", method = RequestMethod.GET)
// public void userUpdateGET(@SessionAttribute("userId") Long userId, Model model) throws Exception {
// logger.info(" userUpdateGET() 호출 ");
//
// // 사용자의 ID정보를 가져오기(세션)
// logger.info("userId : " + userId);
//
// // 서비스 -> DAO 회원정보 가져오는 동작 호출
// UserVO resultVO = userService.getUser(userId);
//
// // 연결된 뷰페이지에 출력
// // => model 객체에 정보 저장
// model.addAttribute("resultVO", resultVO);
// // /user/update.jsp 뷰페이지 연결
// }
//
// // 회원정보 수정 - POST
// // (수정된 정보를 전달받아서 정보 수정)
// @RequestMapping(value = "/editinfo2", method = RequestMethod.POST)
// public String userUpdatePOST(UserVO user) throws Exception {
// logger.info(" userUpdatePOST() ");
//
// // 전달정보(수정정보) 저장
// logger.info("vo : " + user);
//
// // 서비스 -> DAO 호출 (회원정보 수정)
// userService.updateUser(user);
//
// // 수정완료시 메인페이지로 이동
// return "redirect:/dashboard";
// }

// 대시보드 사용법 - /user/consultation (GET)
@RequestMapping(value = "/consultation", method = RequestMethod.GET)
public String consultationGET(Model model, HttpSession session) throws Exception {
Long userId = (Long) session.getAttribute("id");
// if (id == null) {
// // 세션에 id가 없으면 에러 처리
// return "redirect:/user/main";
// }
UserVO resultVO = userService.getUser(userId);
model.addAttribute("resultVO", resultVO);
return "user/consultation";
}

// 비밀번호 변경 - /user/changepassword1 (GET)
@RequestMapping(value = "/changepassword1", method = RequestMethod.GET)
public String changepassword1GET(Model model, HttpSession session) throws Exception {
Long userId = (Long) session.getAttribute("id");
// if (id == null) {
// // 세션에 id가 없으면 에러 처리
// return "redirect:/user/main";
// }
UserVO resultVO = userService.getUser(userId);
model.addAttribute("resultVO", resultVO);
return "user/changepassword1";
}






// 회원정보 삭제 - 비밀번호 입력 (GET)
@RequestMapping(value = "/delete", method = RequestMethod.GET)
public String userDeleteGET() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ public List<UserVO> getUserList() {
}

@Override
public int getIsDeleted(Long user) throws Exception{
public int getIsDeleted(Long userId) throws Exception{

logger.info("getIsDeleted(Long userId) 실행");

return sqlSession.selectOne(NAMESPACE + "getIsDeleted", user);
return sqlSession.selectOne(NAMESPACE + "getIsDeleted", userId);
}

@Override
public UserVO getUserById(Long user) throws Exception {
return sqlSession.selectOne(NAMESPACE + "getUserById", user);
public UserVO getUserById(Long userId) throws Exception {
return sqlSession.selectOne(NAMESPACE + "getUserById", userId);
}

}
34 changes: 29 additions & 5 deletions stockMate/src/main/resources/mappers/userMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,42 @@
<!-- UserResultMap 정의 -->
<resultMap id="UserResultMap" type="com.stockm8.domain.vo.UserVO">
<result property="userId" column="user_id" />
<result property="password" column="password" />
<result property="name" column="name" />
<result property="telNumber" column="tel_number" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="status" column="status" />
<result property="businessId" column="business_id" />
<result property="email" column="email" />
<result property="name" column="name" />
<result property="role" column="role" />
<result property="isDeleted" column="is_deleted" />
</resultMap>

<!-- 회원가입 -->
<insert id="insertUser">
INSERT INTO test_users (email, password, name, role, tel_number)
VALUES (#{email}, #{password}, #{name}, #{role}, #{telNumber})
</insert>
<insert id="insertUser" parameterType="com.stockm8.domain.vo.UserVO" useGeneratedKeys="true" keyProperty="userId">
INSERT INTO test_users (
email,
password,
name,
role,
tel_number,
created_at,
status,
is_deleted
)
VALUES (
#{email},
#{password},
#{name},
#{role},
#{telNumber},
NOW(),
'PENDING',
0
)
</insert>

<!-- 로그인 체크 -->
<select id="loginCheck" parameterType="com.stockm8.domain.vo.UserVO" resultMap="UserResultMap">
Expand Down
132 changes: 132 additions & 0 deletions stockMate/src/main/webapp/WEB-INF/views/user/Howtouse.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>상담문의</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}
.content {
width: 60%;
margin-bottom: 20px;
background-color: #005bac;
color: white;
padding: 10px;
border-radius: 8px;
}
.content h1 {
color: white;
text-align: center;
}
.content h3 {
text-align: center;
}
.content p {
margin: 8px 0;
line-height: 1.4;
text-align: center;
}
.form-container {
width: 25%;
background-color: #005bac;
color: white;
padding: 10px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.form-container h2 {
color: white;
text-align: center;
margin-bottom: 10px;
}
.form-container input, .form-container textarea, .form-container button {
width: 95.3%;
margin-bottom: 8px;
padding: 8px;
border: none;
border-radius: 5px;
}
.form-container input[type="radio"] {
width: auto;
}
.form-container button {
background-color: #ffcc00;
color: black;
font-weight: bold;
cursor: pointer;
}
.form-container button:hover {
background-color: #ffaa00;
}
.footer {
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<h1>상담을 통해 궁금한 점을 즉시 해결하세요.</h1>

<h3>궁금한 점을 빠르게 확인할 수 있습니다.</h3>
<p>
• 연락처를 남겨주시면 영업 시간 기준 1일~2일 이내에 연락 드립니다.<br>
• 전문가와의 상담을 통해 문의사항을 빠르고 정확하게 해결하세요.
</p>

<h3>효과적인 시스템을 느껴보세요</h3>
<p>
• 우리 회사의 업무에 어떻게 적용할 수 있을지 확인할 수 있습니다.<br>
• 프로그램 도입 여부를 빠르게 판단할 수 있습니다.
</p>
</div>

<div class="form-container">
<h2>상담문의</h2>
<form action="main" method="post">
<input type="text" name="company" placeholder="회사명" required>
<input type="text" name="name" placeholder="이름" required>
<input type="text" name="contact" placeholder="연락처" required>
<input type="email" name="email" placeholder="E-mail" required>
<div>
<label><input type="radio" name="contactMethod" value="전화" required> 전화</label>
<label><input type="radio" name="contactMethod" value="이메일"> 이메일</label>
</div>
<textarea name="message" placeholder="문의내용" rows="5" required></textarea>
<div>
<input type="checkbox" name="privacyConsent" required> 개인정보 수집에 동의함 (필수)
</div>
<button type="submit">상담신청</button>
</form>

<div class="footer">
궁금한 점이 있다면 지금 확인하세요!<br>
<strong>1588-2929</strong>
</div>
</div>
</div>
</body>
</html>
Loading

0 comments on commit 6ca03fe

Please sign in to comment.