Prechádzať zdrojové kódy

약관 동의 페이지 개발중

huiwon.seo 4 rokov pred
rodič
commit
6c07bbe3ad

+ 0 - 9
src/main/java/com/lemon/lifecenter/common/CommonController.java

@@ -10,15 +10,6 @@ import org.springframework.web.servlet.ModelAndView;
 @Controller
 @RequestMapping("/common")
 public class CommonController extends LifeCenterController {
-    // 이용 약관 및 개인정보 활용 동의
-    @RequestMapping( value="/accept" )
-    public ModelAndView accept() {
-        
-        ModelAndView mv = setMV( "common/accept" );
-        
-        return mv;
-    }
-    
     // 패스워드 규칙 체크
     @RequestMapping( value="/passwordCheck", method=RequestMethod.POST )
     @ResponseBody

+ 0 - 2
src/main/java/com/lemon/lifecenter/common/LifeCenterInterCeptor.java

@@ -68,8 +68,6 @@ 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" ) ) {
                             

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

@@ -0,0 +1,94 @@
+package com.lemon.lifecenter.controller;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+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.service.AcceptService;
+
+/*
+ * [웹 서비스 이용 약관 및 개인정보 활용 동의]
+ *  - 약관 동의 하지않은 사용자에 대해 필수항목 동의 전까지 서비스 이용 불가능 하도록 처리 -> interceptor에서 체크할것
+ *  - 약관 동의 제출 시 accept_member_log 테이블에 데이터 저장
+ *  
+ * 사용 테이블 : accept_list,
+ *          accept_member_log
+ * */
+
+@Controller
+@RequestMapping( "/accept" )
+public class AcceptController extends LifeCenterController {
+    
+    @Autowired
+    private AcceptService acceptService;
+    
+    @RequestMapping( "/list" )
+    public ModelAndView acceptList() {
+        
+        ModelAndView mv = setMV( "accept/list" );
+        
+        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" );
+        
+        AcceptDTO adto = new AcceptDTO();
+        List<AcceptDTO> acceptList = acceptService.selectAcceptList( adto );
+        
+        
+        for( AcceptDTO d : acceptList ) {
+            if( d.getNecessaryYn().equals( "Y" ) ) {
+                boolean flag = false;
+                
+                for( int i = 0; i < acceptIdx.length; i ++ ) {
+                    if( d.getAcceptIdx() == Integer.valueOf( acceptIdx[i] ) ) {
+                        flag = true;
+                    }
+                }
+                
+                if( flag == false ) {
+                    LifeCenterFunction.scriptMessage( response, "alertBox({ txt : '비정상적인 접근입니다 필수입력값을 확인하세요.', callBack : function(){ location.href='/accept/list'; } });" );
+                     return "/common/blank";
+                }
+            }
+            
+        }
+        
+        
+        for( int i = 0; i < acceptIdx.length; i ++ ) {
+            AcceptDTO dto = new AcceptDTO();
+            
+            dto.setId( sesId );
+            dto.setAcceptIdx( Integer.valueOf( acceptIdx[i] ) );
+            
+            if( acceptService.selectMemberLogCheck( dto ) == 0 ) {
+                //select_member_log 테이블에 해당 약관동의 데이터가 없는경우에만 insert
+                acceptService.insertAcceptMemberLog( dto );
+            }
+        }
+        
+        return "redirect:/login/staff";
+    }
+}

+ 14 - 0
src/main/java/com/lemon/lifecenter/controller/RoleController.java

@@ -21,6 +21,20 @@ import com.lemon.lifecenter.common.LifeCenterFunction;
 import com.lemon.lifecenter.dto.RoleDTO;
 import com.lemon.lifecenter.service.RoleService;
 
+/*
+ * [메뉴별 접근 권한 관리]
+ * 
+ * 사용테이블 : sys_menu_list, 
+ *          sys_menu_role
+ * 
+ *  권한체크가 필요한 컨트롤러의 mapping 값은 
+ *  sys_menu_list 테이블에 등록되어있어야함
+ *  등록되어있지않는경우는 권한 체크 하지않음
+ *  
+ *  sys_menu_role 테이블에서는 각 부모메뉴코드의 C,R,U,D 값을 가지고있음
+ *  LifeCenterController에서 현재 URL에 해당하는 MENU_CODE 조회후 현재메뉴의 C,R,U,D 값을 담아줌
+ * */
+
 @Controller
 @RequestMapping("/role")
 public class RoleController extends LifeCenterController {

+ 79 - 0
src/main/java/com/lemon/lifecenter/dto/AcceptDTO.java

@@ -0,0 +1,79 @@
+package com.lemon.lifecenter.dto;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class AcceptDTO {
+    private int acceptIdx;
+    private String createDate;
+    private String title;
+    private String content;
+    private int sortOrder;
+    private String necessaryYn;
+    private String useYn;
+    private String acceptType;
+    
+    private String id;
+    private String acceptDate;
+    
+    public int getAcceptIdx() {
+        return acceptIdx;
+    }
+    public void setAcceptIdx(int acceptIdx) {
+        this.acceptIdx = acceptIdx;
+    }
+    public String getCreateDate() {
+        return createDate;
+    }
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+    public String getTitle() {
+        return title;
+    }
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    public String getContent() {
+        return content;
+    }
+    public void setContent(String content) {
+        this.content = content;
+    }
+    public int getSortOrder() {
+        return sortOrder;
+    }
+    public void setSortOrder(int sortOrder) {
+        this.sortOrder = sortOrder;
+    }
+    public String getNecessaryYn() {
+        return necessaryYn;
+    }
+    public void setNecessaryYn(String necessaryYn) {
+        this.necessaryYn = necessaryYn;
+    }
+    public String getUseYn() {
+        return useYn;
+    }
+    public void setUseYn(String useYn) {
+        this.useYn = useYn;
+    }
+    public String getAcceptType() {
+        return acceptType;
+    }
+    public void setAcceptType(String acceptType) {
+        this.acceptType = acceptType;
+    }
+    public String getId() {
+        return id;
+    }
+    public void setId(String id) {
+        this.id = id;
+    }
+    public String getAcceptDate() {
+        return acceptDate;
+    }
+    public void setAcceptDate(String acceptDate) {
+        this.acceptDate = acceptDate;
+    }
+}

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

@@ -0,0 +1,17 @@
+package com.lemon.lifecenter.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+import com.lemon.lifecenter.dto.AcceptDTO;
+
+@Repository
+@Mapper
+public interface AcceptMapper {
+    public List<AcceptDTO> selectAcceptList( AcceptDTO dto );
+    public void insertAcceptMemberLog( AcceptDTO dto );
+    public void insertAcceptPatientLog( AcceptDTO dto );
+    public int selectMemberLogCheck( AcceptDTO dto );
+}

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

@@ -0,0 +1,28 @@
+package com.lemon.lifecenter.service;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.lemon.lifecenter.dto.AcceptDTO;
+import com.lemon.lifecenter.mapper.AcceptMapper;
+
+@Service
+public class AcceptService {
+    @Autowired
+    private AcceptMapper mapper;
+    
+    public List<AcceptDTO> selectAcceptList( AcceptDTO dto ) {
+        return mapper.selectAcceptList(dto);
+    }
+    public void insertAcceptMemberLog( AcceptDTO dto ) {
+        mapper.insertAcceptMemberLog(dto);
+    }
+    public void insertAcceptPatientLog( AcceptDTO dto ) {
+        mapper.insertAcceptPatientLog(dto);
+    }
+    public int selectMemberLogCheck( AcceptDTO dto ) {
+        return mapper.selectMemberLogCheck(dto);
+    }
+}

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -98,7 +98,7 @@
    </appender>
    <!-- root레벨 설정 -->
    <root level="${LOG_LEVEL}">
-<!--       <appender-ref ref="CONSOLE" /> -->
+      <appender-ref ref="CONSOLE" />
       <appender-ref ref="FILE_SAVE" />
       <appender-ref ref="Error" />
    </root>

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

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.lemon.lifecenter.mapper.AcceptMapper">
+    <select id="selectAcceptList" parameterType="AcceptDTO" resultType="AcceptDTO">
+        <![CDATA[
+            SELECT accept_idx   AS acceptIdx,
+                   create_date  AS createDate,
+                   title        AS title,
+                   content      AS content,
+                   sort_order   AS sortOrder,
+                   necessary_yn AS necessaryYn,
+                   use_yn       AS useYn,
+                   accept_type  AS acceptType
+              FROM accept_list
+             WHERE use_yn = 'Y'
+             ORDER BY sort_order ASC
+        ]]>
+    </select>
+    
+    <insert id="insertAcceptMemberLog" parameterType="AcceptDTO">
+        <![CDATA[
+            INSERT 
+              INTO accept_member_log
+                   ( id,    accept_idx,   accept_date )
+            VALUES ( #{id}, #{acceptIdx}, NOW() );
+        ]]>
+    </insert>
+    
+    <insert id="insertAcceptPatientLog" parameterType="AcceptDTO">
+        <![CDATA[
+            INSERT 
+              INTO accept_member_log
+                   ( patientIdx,    accept_idx,   accept_date )
+            VALUES ( #{patientIdx}, #{acceptIdx}, NOW() );
+        ]]>
+    </insert>
+    
+    <select id="selectMemberLogCheck" parameterType="AcceptDTO" resultType="int">
+        <![CDATA[
+            SELECT COUNT(*) total
+              FROM accept_member_log
+             WHERE accept_idx = #{acceptIdx}
+        ]]>
+    </select>
+</mapper>

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

@@ -0,0 +1,138 @@
+<%@ 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-8 col-lg-8">
+                            <h1 class="h3 mb-3">※ 관리자 및 의료진용 서비스 이용을 위한 약관 및 개인정보활용 동의해주세요</h1>
+                        </div>
+                        <div class="col-4 col-lg-4 text-right">
+                            <h4 class="text-info">
+                                <input type="checkbox" id="accept-all" />
+                                <label for="accept-all">아래 전체 약관에 동의합니다.</label>
+                            </h4>
+                        </div>
+                    </div>
+                    <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">
+                                                <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:300px;overflow-y:auto;padding:20px;background:#e9ecef;border:1px solid #ced4da;">
+                                                <c:out value="${al.content}" escapeXml="false"/>
+                                            </div>
+                                            
+                                            <div class="row mt-3">
+                                                <div class="col-12">
+                                                    <div class="text-right">
+                                                        <h4 class="text-info">
+                                                            <input type="checkbox" name="acceptIdx" value="${al.acceptIdx}" class="accept-checkbox" id="accept${lStatus.index}" <c:if test="${al.necessaryYn eq 'Y'}">accessKey="required"</c:if>>
+                                                            <label for="accept${lStatus.index}">위의 약관에 동의합니다.</label>
+                                                        </h4>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        </c:forEach>
+                                        
+                                        
+                                        <hr class="my-4">
+                                        
+                                        <div class="row mt-3">
+                                            <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>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </main>
+        </div>
+        
+        <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
+    </div>
+</body>
+</html>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 201
src/main/webapp/WEB-INF/jsp/common/accept.jsp