Ver Fonte

출석체크 임시 커밋

sowon4187 há 5 anos atrás
pai
commit
95d62f6ce2

+ 28 - 0
src/main/java/com/style24/front/biz/dao/TsfPlanningDao.java

@@ -312,6 +312,34 @@ public interface TsfPlanningDao {
 	 */
 	Collection<Plan> getAttendMonth(Plan plan);
 	
+	/**
+	 * 출석체크 
+	 *
+	 * @param Plan
+	 * @return 
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	void saveAttendEntry(Plan plan);
+	
+	/**
+	 * 출석체크 확인
+	 *
+	 * @param Plan
+	 * @return int
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	int getAttendEntryCount(Plan plan);
 	
+	/**
+	 * 고객이 출석한 일 리스트
+	 *
+	 * @param Plan
+	 * @return Collection<Plan>
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	Collection<Plan> getCustAttendEntryList(Plan plan);
 	
 }

+ 41 - 0
src/main/java/com/style24/front/biz/service/TsfPlanningService.java

@@ -468,6 +468,47 @@ public class TsfPlanningService {
 		return planningDao.getAttendMonth(plan);
 	}
 	
+	/**
+	 * 출석체크 
+	 *
+	 * @param Plan
+	 * @return 
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	public void saveAttendEntry(Plan plan) {
+		int custNo = TsfSession.getInfo().getCustNo();
+		plan.setCustNo(custNo);
+		plan.setEntryCustNo(custNo);
+		plan.setEntryVal1("Y");
+		planningDao.saveAttendEntry(plan);
+	}
+
+	/**
+	 * 출석체크 확인
+	 *
+	 * @param Plan
+	 * @return int
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	public int getAttendEntryCount(Plan plan) {
+		plan.setCustNo(TsfSession.getInfo().getCustNo());
+		return planningDao.getAttendEntryCount(plan);
+	}
+	
+	/**
+	 * 고객이 출석한 일 리스트
+	 *
+	 * @param Plan
+	 * @return Collection<Plan>
+	 * @author sowon
+	 * @date 2021. 4. 7
+	 */
+	public Collection<Plan> getCustAttendEntryList(Plan plan){
+		plan.setCustNo(TsfSession.getInfo().getCustNo());
+		return planningDao.getCustAttendEntryList(plan);
+	}
 
 
 }

+ 27 - 0
src/main/java/com/style24/front/biz/web/TsfPlanningController.java

@@ -214,6 +214,9 @@ public class TsfPlanningController extends TsfBaseController {
 			mav.addObject("planList", planningService.getPlanEventList(plan));
 			mav.addObject("listSize", planningService.getPlanEventList(plan).size());
 			mav.addObject("month", planningService.getAttendMonth(planInfo));
+			if (TsfSession.isLogin()) {
+				mav.addObject("custAttendList",planningService.getCustAttendEntryList(plan));
+			}
 			mav.setViewName(super.getDeviceViewName("planning/PlanningEventAttendForm"));
 			return mav;
 		}
@@ -447,4 +450,28 @@ public class TsfPlanningController extends TsfBaseController {
 		result.set("shotYn", planningService.getCustAddrShotConfirm(recipZipcode));
 		return result;
 	}
+	
+	/**
+	 * 출석체크
+	 * 
+	 * @return
+	 * @author sowon
+	 * @since 2021. 4. 7
+	 */
+	@PostMapping("/event/attend/entry")
+	@ResponseBody
+	public GagaMap planningAttendEntry(@RequestBody Plan plan) throws Exception {
+		GagaMap result = new GagaMap();
+		int count = planningService.getAttendEntryCount(plan);
+		if (count > 0) {
+			result.set("msg", "이미 출석체크 되었습니다.");
+		}else {
+			planningService.saveAttendEntry(plan);
+			result.set("msg", "출석체크 되었습니다.");
+			result.set("custAttendList",planningService.getCustAttendEntryList(plan));
+			
+		}
+		
+		return result;
+	}
 }

+ 22 - 7
src/main/java/com/style24/persistence/domain/Plan.java

@@ -245,13 +245,28 @@ public class Plan extends TscBaseDomain {
 
 	private String sysImgNm;			// 상품 이미지
 	
-	private String sun;
-	private String mon;
-	private String tue;
-	private String wed;
-	private String thu;
-	private String fri;
-	private String sat;
+	
+	// 출석체크 주
+	private String sun;			//일요일
+	private String mon;			//월요일
+	private String tue;			//화요일
+	private String wed;			//수요일
+	private String thu;			//목요일
+	private String fri;			//금요일
+	private String sat;			//토요일
+	
+	// 이벤트 참여
+	private Integer entryCustNo;		//참여자 고객번호
+	private String entryDt;				//참여일시
+	private String entryVal1;			//참여값1
+	private String entryVal2;			//참여값2
+	private String entryVal3;			//참여값3
+	private String entryVal4;			//참여값4
+	private String entryVal5;			//참여값5
+	private String entryVal6;			//참여값6
+	private String entryVal7;			//참여값7
+	private String entryVal8;			//참여값8
+	
 	
 	
 	

+ 64 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfPlanning.xml

@@ -1103,6 +1103,7 @@
 	
 	<!-- 달력 출력 -->
 	<select id="getAttendMonth" resultType="Plan" parameterType="Plan">
+		/* TsfPlanning.getAttendMonth" */
 		SELECT
 		      MIN(CASE WHEN WEEKDAY = '1' THEN DAY END ) AS 'sun'
 		      ,MIN(CASE WHEN WEEKDAY = '2' THEN DAY END )AS 'mon'
@@ -1136,4 +1137,67 @@
 		)AS TEMP2
 		GROUP BY WEEK
 	</select>
+	
+	<!-- 출석체크 insert -->
+	<insert id="saveAttendEntry" parameterType="Plan">
+		/* TsfPlanning.saveAttendEntry */	
+		INSERT INTO TB_PLAN_ENTRY
+		        (PLAN_SQ
+		        , ENTRY_CUST_NO
+		        , ENTRY_DT
+		        , ENTRY_VAL1
+		        , ENTRY_VAL2
+		        , ENTRY_VAL3
+		        , ENTRY_VAL4
+		        , ENTRY_VAL5
+		        , ENTRY_VAL6
+		        , ENTRY_VAL7
+		        , ENTRY_VAL8
+		        , REG_NO
+		        , REG_DT
+		        , UPD_NO
+		        , UPD_DT
+		        )
+		VALUES
+		        ( #{planSq}
+		        , #{custNo}
+		        , CURRENT_TIMESTAMP
+		        , #{entryVal1}
+		        , #{entryVal2}
+		        , #{entryVal3}
+		        , #{entryVal4}
+		        , #{entryVal5}
+		        , #{entryVal6}
+		        , #{entryVal7}
+		        , #{entryVal8}
+		        , #{custNo}
+		        , CURRENT_TIMESTAMP
+		        , #{custNo}
+		        , CURRENT_TIMESTAMP
+		        )
+	</insert>
+	
+	<!-- 출석 여부 -->
+	<select id="getAttendEntryCount" resultType="int" parameterType="Plan">
+		/* TsfPlanning.getAttendEntryCount */	
+		SELECT COUNT(*) AS COUNT
+		FROM TB_PLAN_ENTRY
+		WHERE 1=1 
+		 AND PLAN_SQ = #{planSq}
+		 AND DATE_FORMAT(ENTRY_DT, '%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+		 AND ENTRY_CUST_NO = #{custNo}
+	</select>
+	
+	<!-- 출석한 리스트 -->
+	<select id="getCustAttendEntryList" resultType="Plan" parameterType="Plan">
+		/* TsfPlanning.getCustAttendEntryList */	
+		SELECT PLAN_ENTRY_SQ 
+		      ,PLAN_SQ 
+		      ,ENTRY_CUST_NO 
+		      ,DATE_FORMAT(ENTRY_DT,'%e') AS ENTRY_DT 
+		FROM TB_PLAN_ENTRY
+		WHERE 1=1 
+		AND PLAN_SQ = #{planSq}
+		AND ENTRY_CUST_NO = #{custNo}
+	</select>
 </mapper>

+ 104 - 54
src/main/webapp/WEB-INF/views/web/planning/PlanningEventAttendFormWeb.html

@@ -131,7 +131,7 @@
 									</table>
 								</div>
 							</div>
-							<button type="button" class="btn btn_primary"><span>출석 체크</span></button>
+							<button type="button" class="btn btn_primary" onclick="fnAttendEntry()"><span>출석 체크</span></button>
 						</div>
                         <div class="event_benefit">
                             <p class="title">출석 일수에 따라 달라지는 혜택</p>
@@ -170,23 +170,24 @@
                 <div class="cont_head">
                     <div>
                         <h4>다른 이벤트 보기</h4>
-                        <a href="">전체보기</a>
+                        <a href="javascript:void(0);" th:if="${planInfo.planGb == 'E'}" onclick="cfnGoToPage(_PAGE_EVENT_MAIN);">전체보기</a>
                     </div>
                 </div>
                 <div class="cont_body">
                     <div class="swiper-container">
                         <div class="swiper-wrapper">
+                           <th:block th:each="PlanData, PlanStat : ${planList}">
                             <div class="swiper-slide">                   
-                                <a href="">
+                                <a th:onclick="cfnGoToPlanDetail([[${PlanData.planSq}]])">
                                     <div class="thumb">
-                                        <img src="/images/pc/thumb/ev_list_img06.jpg" alt="스타일24만의 스타일로, tbj 하이 스타일링">
+                                        <img th:src="${@environment.getProperty('upload.image.view')+PlanData.mainImg}" alt="${PlanData.planNm}">
                                     </div>
                                     <div class="txt">
-                                        <span class="brand">BUCKAROO</span>
-                                        <p class="tit">스타일24만의 스타일로, TBJ 하이 스타일링</p>
+                                        <p class="tit" th:text="${PlanData.planNm}"></p>
                                     </div>
                                 </a>
                             </div>
+                            </th:block>   
                         </div>
                     </div>
                     <div class="swiper-button-prev"></div>
@@ -199,85 +200,134 @@
 </div>
 <script th:inline="javascript">
 let today = new Date();   
+let year = today.getFullYear();
 let date = today.getDate();
-let month = [[${month}]];
-
+let month =today.getMonth()+1;
+let calendar = [[${month}]];
+let planInfo = [[${planInfo}]];
+var custAttendList = [[${custAttendList}]];
 var appendHtml = function () {
-	$.each(month, function(idx, item)  { 
-		html = '';
-		html += '<tr>';
+	$("#monthTbody").html('');
+	$.each(calendar, function(idx, item)  { 
+		
+		html = '<tr>\n';
 		
 		if (item.sun!=null && item.sun!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.sun+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.sun+'">\n';
+			html += '		<div class="date" id="'+item.sun+'">'+item.sun+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
+		
 		if (item.mon!=null && item.mon!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.mon+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.mon+'">\n';
+			html += '		<div class="date" id="'+item.mon+'">'+item.mon+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
 		if (item.tue!=null && item.tue!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.tue+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.tue+'">\n';
+			html += '		<div class="date"  id="'+item.tue+'">'+item.tue+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
 		if (item.wed!=null && item.wed!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.wed+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.wed+'">\n';
+			html += '		<div class="date" id="'+item.wed+'">'+item.wed+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
 		if (item.thu!=null && item.thu!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.thu+'</div>';
-			html += '	</td>	';
+			if (item.thu == item1.entryDt) {
+			html += '	<td id="td_'+item.thu+'">\n';
+			html += '		<div class="date" id="'+item.thu+'">'+item.thu+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
 		if (item.fri!=null && item.fri!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.fri+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.fri+'">\n';
+			html += '		<div class="date" id="'+item.fri+'">'+item.fri+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date" ></div>\n';
+			html += '	</td>\n	';
 		}
 		if (item.sat!=null && item.sat!='') {
-			html += '	<td>';
-			html += '		<div class="date">'+item.sat+'</div>';
-			html += '	</td>	';
+			html += '	<td id="td_'+item.sat+'">\n';
+			html += '		<div class="date" id="'+item.sat+'">'+item.sat+'</div>\n';
+			html += '	</td>\n	';
 		}else{
-			html += '	<td>';
-			html += '		<div class="date"></div>';
-			html += '	</td>	';
+			html += '	<td>\n';
+			html += '		<div class="date"></div>\n';
+			html += '	</td>\n	';
 		}
 		
-		html += '</tr>'
+		html += '</tr>\n'
 		$("#monthTbody").append(html);
+	
 	})    
 } 
+
+
+var fnAttendEntry = function () {
+	if (!cfCheckLogin()) {
+		mcxDialog.alert("로그인 후 참여 가능합니다.");
+		return false;
+	}
+	
+	let data = {planSq : planInfo.planSq};
+	let jsonData = JSON.stringify(data);
+	gagajf.ajaxJsonSubmit('/planning/event/attend/entry', jsonData, fnInfoConfirmCallBack);
+	
+}
+
+var fnInfoConfirmCallBack = function(result) {
+	mcxDialog.alert(result.msg);
+	custAttendList = result.custAttendList; 
+	
+	$.each(custAttendList, function(idx, item)  {
+		if(item.entryDt == date){
+			$("#td_"+date).attr("class","complete");
+		}else{
+			
+		}
+	}) 
+	
+	appendHtml();
+};
+
 $(document).ready(function() {
+	if (!cfCheckLogin()) {
+		$(".day").html("<span>0</span>일");
+	}
 	 
 	appendHtml();
+	$("#td_"+date).attr("class","today");
+	$.each(custAttendList, function(idx, item)  {
+		if(item.entryDt == date){
+			$("#td_"+date).attr("class","complete");
+		}else{
+			
+		}
+	}) 
+	
+	$(".title").html("<strong>"+month+"월</strong> 출석체크");
 	
 	//공유 버튼 토글 
 	$("button[data-name=openShare]").on("click", function(){