sowon4187 пре 5 година
родитељ
комит
e702acec00

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

@@ -271,4 +271,15 @@ public interface TsfPlanningDao {
 	 */
 	int getCustAnswerCount(Plan plan);
 	
+	/**
+	 * 설문조사 선착순 키운트
+	 *
+	 * @param poll
+	 * @return int
+	 * @author sowon
+	 * @date 2021. 4. 5
+	 */
+	int getCustAnswerPartiCount(Poll poll);
+	
+	
 }

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

@@ -418,6 +418,19 @@ public class TsfPlanningService {
 	public int getCustAnswerCount(Plan plan) {
 		return planningDao.getCustAnswerCount(plan);
 	}
+	
+	/**
+	 * 설문조사 중복카운트
+	 *
+	 * @param plan
+	 * @return int
+	 * @author sowon
+	 * @date 2021. 4. 5
+	 */
+	public int getCustAnswerPartiCount(Poll poll) {
+		return planningDao.getCustAnswerPartiCount(poll);
+	}
+
 
 
 }

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

@@ -358,6 +358,8 @@ public class TsfPlanningController extends TsfBaseController {
 		
 		poll = planningService.getPollQuestionInfo(plan);
 		String partYn = poll.getDupPartiYn(); 
+		String comYn = poll.getFstComYn();
+		int partiCnt = poll.getPartiCnt();
 		// 중복참여가 아닌경우
 		if(partYn.equals("N")) {
 			int count = planningService.getCustAnswerCount(plan);
@@ -366,6 +368,14 @@ public class TsfPlanningController extends TsfBaseController {
 				result.set("status","1");
 			}
 		}
+		else if (comYn.equals("Y")) {
+			int count = planningService.getCustAnswerPartiCount(poll);
+			if (count>=partiCnt) {
+				result.set("msg","선착순 응모가 마감되었습니다.");
+				result.set("status","2");
+			}
+			
+		}
 		return result;
 	}
 	

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

@@ -1041,4 +1041,13 @@
 		 AND NOW() BETWEEN P.DISP_STDT AND P.DISP_EDDT 
 		 AND NOW() BETWEEN TP.POLL_STDT AND TP.POLL_EDDT	
 	</select>
+	
+	<!-- 설문자 선착순 카운트 -->
+	<select id="getCustAnswerPartiCount" parameterType="Poll" resultType="int">
+		/* TsfPlanning.getCustAnswerPartiCount */
+		SELECT DISTINCT count(*) AS COUNT
+		FROM TB_POLL_ANSWER A INNER JOIN TB_POLL_QUESTION B ON A.POLL_QSQ = B.POLL_QSQ 
+		WHERE B.POLL_SQ = #{pollSq}
+		GROUP BY b.POLL_QSQ, B.POLL_SQ			
+	</select>
 </mapper>

+ 4 - 0
src/main/webapp/WEB-INF/views/web/planning/PlanningDetailFormWeb.html

@@ -645,6 +645,10 @@ var fnJoinConfirm = function () {
 				mcxDialog.alert(result.msg);
 				return;
 			}
+			if (result.status == "2") {
+				mcxDialog.alert(result.msg);
+				return;
+			}
 			document.pollListForm.submit();
 		}
 	})