ソースを参照

Merge branch 'sowon' into develop

sowon4187 4 年 前
コミット
63914104d5

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

@@ -282,6 +282,16 @@ public interface TsfPlanningDao {
 	 */
 	void savePollCustAnswer(Poll poll);
 	
+	/**
+	 * 설문조사 중복 인덱스
+	 *
+	 * @param poll
+	 * @return 
+	 * @author sowon
+	 * @date 2021. 6. 18
+	 */
+	int getPollCustAnswerIndex();
+	
 	/**
 	 * 설문조사 중복카운트
 	 *

+ 12 - 4
src/main/java/com/style24/front/biz/service/TsfPlanningService.java

@@ -394,6 +394,7 @@ public class TsfPlanningService {
 		poll.setCustNo(TsfSession.getInfo().getCustNo());
 		// 단수형
 		if(poll.getPollQsq_10()!=null && poll.getPollQsq_10()!="") {
+			int ansIndex = planningDao.getPollCustAnswerIndex();
 			String[] pollQsq_10 =poll.getPollQsq_10().split("/");
 			for (int i = 0; i < pollQsq_10.length; i++) {
 				String[] temp = pollQsq_10[i].split("-");
@@ -401,7 +402,8 @@ public class TsfPlanningService {
 					String pollQsq=temp[j].toString();
 					poll.setPollQsq(Integer.parseInt(pollQsq)); 
 					String dummy = temp[j+1].toString();        
-					poll.setDummy(dummy);                       
+					poll.setDummy(dummy);                      
+					poll.setAnsIndex(ansIndex);
 					planningDao.savePollCustAnswer(poll);
 					j++;
 				}
@@ -410,6 +412,7 @@ public class TsfPlanningService {
 		
 		//복수형
 		if(poll.getPollQsq_20()!=null && poll.getPollQsq_20()!="") {
+			int ansIndex = planningDao.getPollCustAnswerIndex();
 			String[] pollQsq_20 =poll.getPollQsq_20().split("/");
 			for (int i = 0; i < pollQsq_20.length; i++) {
 				String[] temp = pollQsq_20[i].split("-");
@@ -417,7 +420,8 @@ public class TsfPlanningService {
 					String pollQsq=temp[j].toString();
 					poll.setPollQsq(Integer.parseInt(pollQsq));
 					String dummy = temp[j+1].toString().replaceAll("[,]", "|");        
-					poll.setDummy(dummy);                       
+					poll.setDummy(dummy);           
+					poll.setAnsIndex(ansIndex);
 					planningDao.savePollCustAnswer(poll);
 					
 					j++;
@@ -427,6 +431,7 @@ public class TsfPlanningService {
 		
 		//단답형
 		if(poll.getPollQsq_30()!=null && poll.getPollQsq_30()!="") {
+			int ansIndex = planningDao.getPollCustAnswerIndex();
 			String[] pollQsq_30 =poll.getPollQsq_30().split("/");
 			for (int i = 0; i < pollQsq_30.length; i++) {
 				String[] temp = pollQsq_30[i].split("-");
@@ -434,7 +439,8 @@ public class TsfPlanningService {
 					String pollQsq=temp[j].toString();
 					poll.setPollQsq(Integer.parseInt(pollQsq)); 
 					String dummy = temp[j+1].toString();        
-					poll.setDummy(dummy);                       
+					poll.setDummy(dummy);   
+					poll.setAnsIndex(ansIndex);
 					planningDao.savePollCustAnswer(poll);
 					j++;
 				}
@@ -443,6 +449,7 @@ public class TsfPlanningService {
 		
 		//서룰형
 		if(poll.getPollQsq_40()!=null && poll.getPollQsq_40()!="") {
+			int ansIndex = planningDao.getPollCustAnswerIndex();
 			String[] pollQsq_40 =poll.getPollQsq_40().split("/");
 			for (int i = 0; i < pollQsq_40.length; i++) {
 				String[] temp = pollQsq_40[i].split("-");
@@ -450,7 +457,8 @@ public class TsfPlanningService {
 					String pollQsq=temp[j].toString();
 					poll.setPollQsq(Integer.parseInt(pollQsq)); 
 					String dummy = temp[j+1].toString();        
-					poll.setDummy(dummy);                       
+					poll.setDummy(dummy);       
+					poll.setAnsIndex(ansIndex);
 					planningDao.savePollCustAnswer(poll);
 					j++;
 				}

+ 1 - 0
src/main/java/com/style24/persistence/domain/Poll.java

@@ -50,6 +50,7 @@ public class Poll extends TscBaseDomain{
 	private int dispOrd;		// 표시 순서
 	private String pollQtypeNm;	// 문제유형 이름
 	private String planNm;			// 이벤트명
+	private int ansIndex;			// 중복답변 인덱스
 	//poll_answer
 	private Integer ansCustNo;		// 투표회원번호
 	private String dummy;			// 임시 (고객 답변)

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

@@ -1325,7 +1325,8 @@
 		       (POLL_QSQ
 		       , ANS_CUST_NO
 		       , POLL_QTYPE
-		       , DUMMY
+		       , DUMMY 
+		       , ANS_INDEX
 		       , REG_NO
 		       , REG_DT
 		       )
@@ -1334,11 +1335,18 @@
 		       , #{custNo}
 		       , (SELECT POLL_QTYPE FROM TB_POLL_QUESTION WHERE POLL_QSQ = #{pollQsq})
 		       , #{dummy}
+		       , #{ansIndex}
 		       , #{custNo}
 		       , CURRENT_TIMESTAMP
 		       )	
 	</insert>
 	
+	<select id="getPollCustAnswerIndex" parameterType="Plan" resultType="int">
+		/* TsfPlanning.getPollCustAnswerIndex */
+		SELECT MAX(ANS_INDEX)+1 AS ANS_INDEX 
+		FROM TB_POLL_ANSWER 
+	</select>
+	
 	<!-- 설문자 중복 카운트 -->
 	<select id="getCustAnswerCount" parameterType="Plan" resultType="int">
 		/* TsfPlanning.getCustAnswerCount */

+ 2 - 12
src/main/webapp/WEB-INF/views/web/mypage/MypageReviewCreateFormWeb.html

@@ -377,6 +377,7 @@
 				</div>
 			</div>
 <script type="text/javascript" src="/ux/plugins/gaga/gaga.kollus.js"></script>
+<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/exif-js"></script>
 <script src="/ux/plugins/gaga/gaga.paging.js"></script>
 <script th:inline="javascript">
 let reviewList = [[${reviewInfo}]];
@@ -573,7 +574,6 @@ var fnChooseFile = function(obj) {
 	// multiple 속성이 있으면 files에는 다수의 객체가 할당됨
 	var file = obj.files[0];
 	
-
 	if (!gagajf.isNull(file.name)) {
 		var extension = "\.(jpg|jpeg|png)$";
 		if ((new RegExp(extension, "i")).test(file.name)) {
@@ -593,6 +593,7 @@ var fnChooseFile = function(obj) {
 							// 업로드한 파일명 설정
 							$(".pics").children().eq(0).append("<input type='hidden' name='orgFileNmArr' id='orgFileNm"+(picLength+1)+"' value='"+result.oldFileName+"'>");
 							$(".pics").children().eq(0).append("<input type='hidden' name='sysFileNmArr' id='sysFileNm"+(picLength+1)+"' value='"+result.newFileName+"'>");
+
 						}
 				); 
 		}else if((new RegExp("mp4", "i")).test(file.name)){
@@ -622,18 +623,7 @@ var fnChooseFile = function(obj) {
 			return false;
 		}
 	}
-	// 이거 왜 안먹히지 
 
-	
-	// 파일 업로드
-/* 	 gagajf.ajaxFileUpload('/common/file/upload?subDir=/review'
-			, file
-			, function(result) {
-				// 업로드한 파일명 설정
-				$(".pics").children().eq(0).append("<input type='hidden' name='orgFileNmArr' id='orgFileNm"+(picLength+1)+"' value='"+result.oldFileName+"'>");
-				$(".pics").children().eq(0).append("<input type='hidden' name='sysFileNmArr' id='sysFileNm"+(picLength+1)+"' value='"+result.newFileName+"'>");
-			}
-	);   */
 }