Просмотр исходного кода

이용약관 및 개인정보 처리방침 추가

huiwon.seo 4 лет назад
Родитель
Сommit
50b2a7f343

+ 39 - 19
src/main/java/com/lemon/lifecenter/common/LifeCenterInterCeptor.java

@@ -30,6 +30,7 @@ public class LifeCenterInterCeptor extends HandlerInterceptorAdapter {
         Object groupIdx = request.getSession().getAttribute( "sesGroupIdx" );
         Object sesMId   = request.getSession().getAttribute( "sesMId" );
         Object sesPasswordChange = request.getSession().getAttribute( "sesPasswordChange" );
+        Object sesAcceptCheck = request.getSession().getAttribute( "sesAcceptCheck" );
         
         logger.info( "|------------------------------------------------------------------|" );
         logger.info( "|  URL : " + url + "  |  IP : " + LifeCenterFunction.getRemoteAddr(request) + "  |  Port : " + port );
@@ -68,32 +69,51 @@ public class LifeCenterInterCeptor extends HandlerInterceptorAdapter {
                 } else {
                     logger.info( "IP : " + LifeCenterFunction.getRemoteAddr( request ) + " ID : " + session.toString() + "  URL : " + url + " Port : " + port );
                     
-                    if( sesPasswordChange != null ) {
-                        if( sesPasswordChange.equals( "REQUIRED" ) ) {
+                    
+                    if( sesAcceptCheck != null && sesAcceptCheck.equals( "Y" ) ) {
+                        if( !url.equals( "/accept/list" ) ) {
+                            logger.info( "약관 동의 페이지로 이동" );
                             
-                            if( !url.equals( "/staff/myinfo" ) ) {
-                                logger.info( "비밀번호 변경 필요 -> 비밀번호 변경 페이지로 이동" );
+                            if( !url.equals( "/accept/insert" ) && !url.equals( "/login/logout" ) ) {
+                                LifeCenterFunction.scriptMessage( response, "location.href='/accept/list';" );
+                            }
+                        } else {
+//                            LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '약관 동의 후 서비스 이용이 가능합니다.', callBack : function(){  } });" );
+                        }
+                    } else {
+                        
+                        if( url.equals( "/accept/list" ) ) {
+                            response.sendRedirect( "/" );
+                        }
+                        
+                        if( sesPasswordChange != null ) {
+                            if( sesPasswordChange.equals( "REQUIRED" ) ) {
                                 
-                                if( !url.equals( "/common/passwordCheck" ) && !url.equals( "/staff/myinfo/update" ) && !url.equals( "/login/logout" ) ) {
-                                    LifeCenterFunction.scriptMessage( response, "location.href='/staff/myinfo';" );
+                                if( !url.equals( "/staff/myinfo" ) ) {
+                                    logger.info( "비밀번호 변경 필요 -> 비밀번호 변경 페이지로 이동" );
+                                    
+                                    if( !url.equals( "/common/passwordCheck" ) && !url.equals( "/staff/myinfo/update" ) && !url.equals( "/login/logout" ) ) {
+                                        LifeCenterFunction.scriptMessage( response, "location.href='/staff/myinfo';" );
+                                    }
+                                } else {
+                                    LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '비밀번호 보안 규정 변경으로 인하여 의무적으로 비밀번호 1회 변경 진행 후 서비스 이용이 가능합니다.', callBack : function(){  } });" );
                                 }
-                            } else {
-                                LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '비밀번호 보안 규정 변경으로 인하여 의무적으로 비밀번호 1회 변경 진행 후 서비스 이용이 가능합니다.', callBack : function(){  } });" );
-                            }
-                            
-                        } else if( sesPasswordChange.equals( "RESET" ) ) {
-                            
-                            if( !url.equals( "/staff/myinfo" ) ) {
-                                logger.info( "초기화 비밀번호로 로그인 -> 비밀번호 변경 페이지로 이동" );
                                 
-                                if( !url.equals( "/common/passwordCheck" ) && !url.equals( "/staff/myinfo/update" ) && !url.equals( "/login/logout" ) ) {
-                                    LifeCenterFunction.scriptMessage( response, "location.href='/staff/myinfo';" );
+                            } else if( sesPasswordChange.equals( "RESET" ) ) {
+                                
+                                if( !url.equals( "/staff/myinfo" ) ) {
+                                    logger.info( "초기화 비밀번호로 로그인 -> 비밀번호 변경 페이지로 이동" );
+                                    
+                                    if( !url.equals( "/common/passwordCheck" ) && !url.equals( "/staff/myinfo/update" ) && !url.equals( "/login/logout" ) ) {
+                                        LifeCenterFunction.scriptMessage( response, "location.href='/staff/myinfo';" );
+                                    }
+                                } else {
+                                    LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '초기화 비밀번호로 로그인시 비밀번호 변경 후 서비스 이용이 가능합니다.', callBack : function(){  } });" );
                                 }
-                            } else {
-                                LifeCenterFunction.scriptMessage( response, "alertBox({ txt: '초기화 비밀번호로 로그인시 비밀번호 변경 후 서비스 이용이 가능합니다.', callBack : function(){  } });" );
+                                
                             }
-                            
                         }
+                        
                     }
                     
                 }

+ 19 - 0
src/main/java/com/lemon/lifecenter/controller/AcceptController.java

@@ -48,11 +48,26 @@ public class AcceptController extends LifeCenterController {
         return mv;
     }
     
+    @RequestMapping( "/info" )
+    public ModelAndView acceptInfo() {
+        
+        ModelAndView mv = setMV( "accept/info" );
+        
+        AcceptDTO dto = new AcceptDTO();
+        
+        List<AcceptDTO> acceptList = acceptService.selectAcceptList(dto);
+        
+        mv.addObject( "acceptList", acceptList );
+        
+        return mv;
+    }
+    
     
     @RequestMapping( value="/insert", method=RequestMethod.POST)
     public String acceptInsert( @RequestParam(value="acceptIdx", required=false, defaultValue="") String[] acceptIdx,
             HttpServletRequest request,HttpServletResponse response ) {
         String sesId  = LifeCenterSessionController.getSession( request, "sesId" );
+        Object sesAcceptCheck = request.getSession().getAttribute( "sesAcceptCheck" );
         
         AcceptDTO adto = new AcceptDTO();
         List<AcceptDTO> acceptList = acceptService.selectAcceptList( adto );
@@ -86,6 +101,10 @@ public class AcceptController extends LifeCenterController {
             if( acceptService.selectMemberLogCheck( dto ) == 0 ) {
                 //select_member_log 테이블에 해당 약관동의 데이터가 없는경우에만 insert
                 acceptService.insertAcceptMemberLog( dto );
+                
+                if( sesAcceptCheck != null && sesAcceptCheck.equals( "Y" ) ) {
+                    LifeCenterSessionController.setSession( request, "sesAcceptCheck", "N" );
+                }
             }
         }
         

+ 17 - 4
src/main/java/com/lemon/lifecenter/controller/LoginController.java

@@ -20,7 +20,9 @@ import com.lemon.lifecenter.common.LifeCenterConfigVO;
 import com.lemon.lifecenter.common.LifeCenterController;
 import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.common.LifeCenterSessionController;
+import com.lemon.lifecenter.dto.AcceptDTO;
 import com.lemon.lifecenter.dto.LoginDTO;
+import com.lemon.lifecenter.service.AcceptService;
 import com.lemon.lifecenter.service.LoginService;
 
 @Controller
@@ -34,6 +36,9 @@ public class LoginController extends LifeCenterController {
     @Autowired
     LoginService loginService;
     
+    @Autowired
+    AcceptService acceptService;
+    
     @RequestMapping("/admin")
     public ModelAndView adminLogin() {
         ModelAndView mv = setMV("login/admin");
@@ -133,8 +138,12 @@ public class LoginController extends LifeCenterController {
                 LifeCenterSessionController.setSession( request, "sesGroupIdx", String.valueOf( memberData.getGroupIdx() ) );
                 LifeCenterSessionController.setSession( request, "sesPhoneNumber", String.valueOf( memberData.getPhoneNumber() ) );
                 
+                AcceptDTO acceptDTO = new AcceptDTO();
+                acceptDTO.setId( memberData.getId() );
+                int acceptTotal = acceptService.selectMemberLogTotal( acceptDTO );
                 
                 url = "/patient/list";
+                
                 if( memberData.getGroupIdx() == 1 ) {
                     url = "/center/list";
                 }
@@ -142,16 +151,20 @@ public class LoginController extends LifeCenterController {
                 // member 테이블 pw_change_req 컬럼 값이 Y 인경우 비밀번호 변경 필요
                 if( memberData.getPwChangeReq().equals( "Y" ) ) {
                     LifeCenterSessionController.setSession( request, "sesPasswordChange", "REQUIRED" );
-                    url = "/staff/myinfo";
-                    
                 } else {
                     // 로그인시 초기화 비밀번호일 경우 비밀번호 변경 페이지로 이동
                     if( passwordVal.equals( config.staffResetPw ) || passwordVal.equals( config.centerResetPw ) ) {
                         LifeCenterSessionController.setSession( request, "sesPasswordChange", "RESET" );
-                        url = "/staff/myinfo";
-                        
                     }
                 }
+                
+                // 동의하지않은 필수약관 갯수가 0이상일 경우
+                if( acceptTotal > 0 ) {
+                    LifeCenterSessionController.setSession( request, "sesAcceptCheck", "Y" );
+                    url = "/accept/list";
+                } else {
+                    LifeCenterSessionController.setSession( request, "sesAcceptCheck", "N" );
+                }
             }
         }
         

+ 1 - 0
src/main/java/com/lemon/lifecenter/mapper/AcceptMapper.java

@@ -14,4 +14,5 @@ public interface AcceptMapper {
     public void insertAcceptMemberLog( AcceptDTO dto );
     public void insertAcceptPatientLog( AcceptDTO dto );
     public int selectMemberLogCheck( AcceptDTO dto );
+    public int selectMemberLogTotal( AcceptDTO dto );
 }

+ 3 - 0
src/main/java/com/lemon/lifecenter/service/AcceptService.java

@@ -25,4 +25,7 @@ public class AcceptService {
     public int selectMemberLogCheck( AcceptDTO dto ) {
         return mapper.selectMemberLogCheck(dto);
     }
+    public int selectMemberLogTotal( AcceptDTO dto ) {
+        return mapper.selectMemberLogTotal(dto);
+    }
 }

+ 14 - 0
src/main/resources/mybatis/mapper/accept/accept.xml

@@ -36,11 +36,25 @@
         ]]>
     </insert>
     
+    <!-- 해당약관을 이미 동의 및 저장했는지 체크 / 체크 후 Insert하려고 씀 -->
     <select id="selectMemberLogCheck" parameterType="AcceptDTO" resultType="int">
         <![CDATA[
             SELECT COUNT(*) total
               FROM accept_member_log
              WHERE accept_idx = #{acceptIdx}
+               AND id = #{id}
+        ]]>
+    </select>
+    
+    <!-- 동의하지않은 필수약관 갯수 체크 -->
+    <select id="selectMemberLogTotal" parameterType="AcceptDTO" resultType="int">
+        <![CDATA[
+            SELECT COUNT(*) total
+              FROM accept_list AL
+              LEFT JOIN accept_member_log AM
+                ON AM.accept_idx = AL.accept_idx
+               AND AM.id = #{id}
+             WHERE AM.id IS NULL
         ]]>
     </select>
 </mapper>

+ 115 - 0
src/main/webapp/WEB-INF/jsp/accept/info.jsp

@@ -0,0 +1,115 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+<jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
+<script>
+$( function(){
+    $( "#accept-all" ).click( function(){
+        if( $( this ).is( ":checked" ) == true ) {
+            console.log(  $( this ).is( ":checked" ) );
+            $( ".accept-checkbox" ).prop( "checked", true );
+        } else {
+            $( ".accept-checkbox" ).prop( "checked", false );
+        }
+    });
+    
+    $( "#acceptForm" ).validate({
+        submitHandler: function(form) {
+            if( $( ".accept-checkbox[accessKey='required']" ).not(':checked').length > 0 ){
+                alertBox({ txt : "서비스를 이용하시려면 필수 약관에 모두 동의해주세요" });
+            } else {
+                form.submit();
+            }
+        }
+    });
+})
+</script>
+<style>
+<!--
+ /* Font Definitions */
+ @font-face    {font-family:"Cambria Math";    panose-1:2 4 5 3 5 4 6 3 2 4;}
+ @font-face    {font-family:"Arial Unicode MS";    panose-1:2 11 6 4 2 2 2 2 2 4;}
+@font-face    {font-family:"Malgun Gothic";    panose-1:2 11 5 3 2 0 0 2 0 4;}
+@font-face    {font-family:함초롬바탕;    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:함초롬돋움;    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:휴먼명조;    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:HYGothic-Medium;    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:"\@Malgun Gothic";}
+@font-face    {font-family:"\@Arial Unicode MS";    panose-1:2 11 6 4 2 2 2 2 2 4;}
+@font-face    {font-family:"\@휴먼명조";    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:"\@HYGothic-Medium";    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:"\@함초롬바탕";    panose-1:0 0 0 0 0 0 0 0 0 0;}
+@font-face    {font-family:"\@함초롬돋움";    panose-1:0 0 0 0 0 0 0 0 0 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal{margin:0in;text-autospace:none;word-break:break-all;font-size:11.0pt;font-family:"Malgun Gothic",sans-serif;}
+p.a, li.a, div.a{mso-style-name:바탕글; margin:0in;text-align:justify;text-justify:inter-ideograph;line-height:103%;text-autospace:none;  word-break:break-all;font-size:10.0pt;font-family:"함초롬바탕",serif;color:black;}
+.MsoChpDefault    {font-family:"Malgun Gothic",sans-serif;}
+ /* Page Definitions */
+ @page WordSection1    {size:595.25pt 841.85pt;    margin:99.2pt 85.0pt 85.0pt 85.0pt;}
+div.WordSection1    {page:WordSection1;}
+ /* List Definitions */
+ ol    {margin-bottom:0in;}
+ul    {margin-bottom:0in;}
+-->
+</style>
+</head>
+<body>
+    <div class="main">
+        <div class="mt-0 ml-6 mr-6 mb-6">
+            <div class="text-center">
+                <a class="sidebar-brand" href="javascript:;"> 
+                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-box align-middle"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path><polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline><line x1="12" y1="22.08" x2="12" y2="12"></line></svg>
+                    <span class="align-middle text-dark">생활치료센터 의료진 시스템</span>
+                </a>
+                <h1 class="mt-2">생활치료센터 의료진 시스템 이용약관</h1>
+            </div>
+            
+            <hr class="my-4">
+            
+            <main class="content">
+                <div class="container-fluid p-0">
+                    <div class="row">
+                        <div class="col-12">
+                            <div class="card">
+                                <form action="/accept/insert" method="post" id="acceptForm">
+                                    <div class="card-body">
+                                        <c:forEach var="al" items="${acceptList}" varStatus="lStatus">
+                                            <div class="row mb-3 mt-3">
+                                                <div class="col-12">
+                                                    <h4 class="">${lStatus.index + 1}. <c:out value="${al.title}"/>
+                                                        <c:if test="${al.necessaryYn eq 'Y'}">(필수)</c:if>
+                                                        <c:if test="${al.necessaryYn ne 'Y'}">(선택)</c:if>
+                                                    </h4>
+                                                </div>
+                                            </div>
+                                            
+                                            <div style="width:100%;height:400px;overflow-y:auto;padding:20px;background:#e9ecef;border:1px solid #ced4da;">
+                                                <c:out value="${al.content}" escapeXml="false"/>
+                                            </div>
+                                            
+                                        </c:forEach>
+                                        
+                                        <hr class="my-4">
+                                        
+                                        <div class="row mt-3">
+                                            <div class="col-12">
+                                                <div class="text-center">
+                                                    <button type="button" class="btn btn-info btn-lg" onclick="history.back();">뒤로가기</button>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </main>
+        </div>
+        
+        <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
+    </div>
+</body>
+</html>

+ 1 - 1
src/main/webapp/WEB-INF/jsp/accept/list.jsp

@@ -119,7 +119,7 @@ ul    {margin-bottom:0in;}
                                             <div class="col-12">
                                                 <div class="text-center">
                                                     <button type="submit" class="btn btn-primary  btn-lg">동의합니다</button>
-                                                    <button type="button" class="btn btn-warning  btn-lg" onclick="location.href='./list';">동의하지 않습니다</button>
+                                                    <button type="button" class="btn btn-warning  btn-lg" onclick="location.href='/login/logout';">동의하지 않습니다</button>
                                                 </div>
                                             </div>
                                         </div>

+ 2 - 1
src/main/webapp/WEB-INF/jsp/include/footer.jsp

@@ -7,7 +7,8 @@
     <div class="row text-muted">
       <div class="col-12 text-right">
         <p class="mb-0">
-          &copy; 2020 - <a href="index.html" class="text-muted">생활치료센터 의료진 시스템</a>
+          <a href="/accept/info" class="text-muted mr-3">이용약관 및 개인정보 처리방침</a>
+          &copy; 2020 - <a href="/" class="text-muted">생활치료센터 의료진 시스템</a>
         </p>
       </div>
     </div>