Quellcode durchsuchen

1:1문의관리 상담사 할당 기능 추가 및 답변상태 로직 변경

gagamel vor 4 Jahren
Ursprung
Commit
1dd55d5d96

+ 19 - 4
src/main/java/com/style24/admin/biz/dao/TsaCounselDao.java

@@ -2,9 +2,10 @@ package com.style24.admin.biz.dao;
 
 import java.util.Collection;
 
+import org.springframework.stereotype.Repository;
+
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Counsel;
-import org.springframework.stereotype.Repository;
 
 /**
  * 상담(1:1문의) Dao
@@ -24,7 +25,14 @@ public interface TsaCounselDao {
 	 * @since 2020. 12. 24
 	 */
 	Collection<Counsel> getOneToOneQnaList(Counsel counsel);
-	
+
+	/**
+	 * 1:1문의 상담사 할당 Update
+	 * @param counsel - 상담정보
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	void updateOneToOneQnaCounselor(Counsel counsel);
 
 	/**
 	 * 1:1문의 전체 카운트
@@ -35,7 +43,6 @@ public interface TsaCounselDao {
 	 */
 	int getOneToOneQnaListCount(Counsel counsel);
 
-
 	/**
 	 * 1:1문의 상세
 	 * @param counsel - 상담정보
@@ -45,6 +52,14 @@ public interface TsaCounselDao {
 	 */
 	Counsel getOneToOneQna(Counsel counsel);
 
+	/**
+	 * 문의 답변 임시 저장
+	 * @param counsel - 상담정보
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	void updateQnaAnswerTemp(Counsel counsel);
+
 	/**
 	 * 문의 답변 저장
 	 * @param counsel - 상담정보
@@ -61,7 +76,7 @@ public interface TsaCounselDao {
 	 * @since 2020. 12. 24
 	 */
 	Collection<Counsel> getGoodsQnaList(Counsel counsel);
-	
+
 	/**
 	 * 상품문의 목록 카운트
 	 * @param counsel -상담정보

+ 8 - 0
src/main/java/com/style24/admin/biz/dao/TsaRendererDao.java

@@ -315,4 +315,12 @@ public interface TsaRendererDao {
 	 */
 	Collection<CommonCode> getSupplyVendorList(SupplyCompany supplyComp);
 
+	/**
+	 * 상담사 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	Collection<CommonCode> getCounselorList();
+
 }

+ 40 - 2
src/main/java/com/style24/admin/biz/service/TsaCounselService.java

@@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.style24.admin.biz.dao.TsaCounselDao;
+import com.style24.admin.support.security.session.TsaSession;
 import com.style24.persistence.domain.Counsel;
 
 import lombok.extern.slf4j.Slf4j;
@@ -34,7 +35,21 @@ public class TsaCounselService {
 	public Collection<Counsel> getOneToOneQnaList(Counsel counsel) {
 		return counselDao.getOneToOneQnaList(counsel);
 	}
-	
+
+	/**
+	 * 1:1문의 상담사 할당 Update
+	 * @param counselList - 상담사 목록
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@Transactional("shopTxnManager")
+	public void updateOneToOneQnaListCounselor(Collection<Counsel> counselList) {
+		for (Counsel counsel : counselList) {
+			counsel.setUpdNo(TsaSession.getInfo().getUserNo());
+			counselDao.updateOneToOneQnaCounselor(counsel);
+		}
+	}
+
 	/**
 	 * 1:1문의 목록 카운트
 	 * @param counsel -상담정보
@@ -59,6 +74,29 @@ public class TsaCounselService {
 		return counselDao.getOneToOneQna(counsel);
 	}
 
+	/**
+	 * 1:1문의 상담사 할당 Update
+	 * @param counselList - 상담사 목록
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@Transactional("shopTxnManager")
+	public void updateOneToOneQnaCounselor(Counsel counsel) {
+		counsel.setUpdNo(TsaSession.getInfo().getUserNo());
+		counselDao.updateOneToOneQnaCounselor(counsel);
+	}
+
+	/**
+	 * 문의 답변 임시 저장
+	 * @param counsel - 상담정보
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@Transactional("shopTxnManager")
+	public void updateQnaAnswerTemp(Counsel counsel) {
+		counselDao.updateQnaAnswerTemp(counsel);
+	}
+
 	/**
 	 * 문의 답변 저장
 	 * @param counsel - 상담정보
@@ -80,7 +118,7 @@ public class TsaCounselService {
 	public Collection<Counsel> getGoodsQnaList(Counsel counsel) {
 		return counselDao.getGoodsQnaList(counsel);
 	}
-	
+
 	/**
 	 * 상품문의 목록 카운트
 	 * @param counsel -상담정보

+ 10 - 0
src/main/java/com/style24/admin/biz/service/TsaRendererService.java

@@ -646,4 +646,14 @@ public class TsaRendererService {
 		return rendererDao.getSupplyVendorList(supplyComp);
 	}
 
+	/**
+	 * 상담사 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	public Collection<CommonCode> getCounselorList() {
+		return rendererDao.getCounselorList();
+	}
+
 }

+ 60 - 5
src/main/java/com/style24/admin/biz/web/TsaCustomerController.java

@@ -87,8 +87,8 @@ public class TsaCustomerController extends TsaBaseController {
 	public ModelAndView oneToOneQnaForm() {
 		ModelAndView mav = new ModelAndView();
 
-		// 사이트 목록
-		mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
+//		// 사이트 목록
+//		mav.addObject("siteList", rendererService.getAvailCommonCodeList("G000"));
 
 		// 상담분류
 		mav.addObject("counselClsfList", rendererService.getCommonCodeList("G059", "Y", new String[] {"G596"}));
@@ -96,6 +96,9 @@ public class TsaCustomerController extends TsaBaseController {
 		// 상담상태 목록
 		mav.addObject("ansStatList", rendererService.getAvailCommonCodeList("G060"));
 
+		// 상담사 목록
+		mav.addObject("counselorList", rendererService.getCounselorList());
+
 		mav.setViewName("customer/OneToOneQnaForm");
 
 		return mav;
@@ -124,6 +127,24 @@ public class TsaCustomerController extends TsaBaseController {
 		return result;
 	}
 
+	/**
+	 * 1:1문의 상담사 할당 처리
+	 * @param counselList - 상담사 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@PostMapping("/onetoone/qna/list/assign")
+	@ResponseBody
+	public GagaResponse assignOneToOneQnaList(@RequestBody Collection<Counsel> counselList) {
+		if (counselList == null || counselList.isEmpty())
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+
+		counselService.updateOneToOneQnaListCounselor(counselList);
+
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
+
 	/**
 	 * 1:1문의상세 화면
 	 * @param counselSq -상담일련번호
@@ -141,6 +162,9 @@ public class TsaCustomerController extends TsaBaseController {
 		// 문의용 답변문구
 		mav.addObject("ansPhaseList", rendererService.getQnaAnswerPhaseList("G061_20"));
 
+		// 상담사 목록
+		mav.addObject("counselorList", rendererService.getCounselorList());
+
 		mav.setViewName("customer/OneToOneQnaDetailForm");
 
 		return mav;
@@ -163,6 +187,38 @@ public class TsaCustomerController extends TsaBaseController {
 		return ansPhaseService.getQnaAnswerPhase(ansPhase);
 	}
 
+	/**
+	 * 1:1문의 상담사 할당 처리
+	 * @param counselList - 상담사 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@PostMapping("/onetoone/qna/assign")
+	@ResponseBody
+	public GagaResponse assignOneToOneQna(@RequestBody Counsel counsel) {
+		counselService.updateOneToOneQnaCounselor(counsel);
+		return super.ok(message.getMessage("SUCC_0004"));
+	}
+
+	/**
+	 * 문의 답변 임시 저장
+	 * @param counsel -상담정보
+	 * @return
+	 * @author gagamel
+	 * @since 2021. 9. 24
+	 */
+	@PostMapping("/qna/answer/temp/save")
+	@ResponseBody
+	public GagaResponse saveQnaAnswerTemp(@RequestBody Counsel counsel) {
+		counsel.setAnsNo(TsaSession.getInfo().getUserNo());
+		counsel.setUpdNo(TsaSession.getInfo().getUserNo());
+
+		counselService.updateQnaAnswerTemp(counsel);
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
 	/**
 	 * 문의 답변 저장
 	 * @param counsel -상담정보
@@ -356,7 +412,7 @@ public class TsaCustomerController extends TsaBaseController {
 		if (!"Y".equals(customerSearch.getCpnPubPopYn())) {
 			customerSearch.setCpnPubPopYn("N");
 		}
-		if("custId".equals(customerSearch.getSearchGb())) {
+		if ("custId".equals(customerSearch.getSearchGb())) {
 			customerSearch.setStDate(null);
 			customerSearch.setEdDate(null);
 		}
@@ -563,7 +619,6 @@ public class TsaCustomerController extends TsaBaseController {
 		return mav;
 	}
 
-
 	/**
 	 * 메시지 발송
 	 *
@@ -624,7 +679,7 @@ public class TsaCustomerController extends TsaBaseController {
 		//Customer custInfo = customerService.getCustomerInfo(customer.getCustNo());
 		//customer.setCustNm(custInfo.getCustNm());
 		//customer.setCustNo(custInfo.getCustNo());
-		log.info("sendLms3 {}"+customer);
+		log.info("sendLms3 {}" + customer);
 		if (StringUtils.isNotBlank(customer.getCellPhnno())) {
 			Integer userNo = TsaSession.getInfo().getUserNo();
 			kakaotalkService.sendBasicLms3(customer, userNo);

+ 4 - 1
src/main/java/com/style24/persistence/domain/Counsel.java

@@ -59,6 +59,9 @@ public class Counsel extends TscBaseDomain {
 	private String assignedCsNm;	// 할당된CS담당자명
 	private String assignedYmd;		// 할당된연월일
 	private String assignedHms;		// 할당된시분초
+	private Integer assignerNo;		// 할당자번호
+	private String assignerNm;		// 할당자명
+	private String assignedDt;		// 할당일시
 	private String ansTitle;		// 답변제목
 	private String ansContent;		// 답변내용
 	private Integer ansNo;			// 답변자번호
@@ -76,7 +79,7 @@ public class Counsel extends TscBaseDomain {
 	private String termGb;			// 기간구분
 	private String termStdt;		// 검색시작날짜
 	private String termEddt;		// 검색끝날짜
-	
+
 	// Pagination
 	private TscPageRequest pageable;
 	private int pageNo = 1;

+ 104 - 64
src/main/java/com/style24/persistence/mybatis/shop/TsaCounsel.xml

@@ -19,70 +19,77 @@
 	<!-- 1:1문의 목록 -->
 	<select id="getOneToOneQnaList" parameterType="Counsel" resultType="Counsel">
 		/* TsaCounsel.getOneToOneQnaList */
-		 SELECT Z.*
-		 FROM(
-		      SELECT @rownum := @rownum + 1 AS RNUM
-		            ,A.*
-		      FROM (
-		             SELECT A.COUNSEL_SQ                                                        /*상담일련번호*/
-		                  , A.SITE_CD                                                           /*사이트코드*/
-		                  , FN_GET_CODE_NM('G059',A.COUNSEL_CLSF)           AS COUNSEL_CLSF_NM  /*상담분류명*/
-		                  , FN_GET_CODE_NM(A.COUNSEL_CLSF,A.COUNSEL_DCLSF)  AS COUNSEL_DCLSF_NM /*상담상세분류명*/
-		                  , A.COUNSEL_DCLSF                                                     /*상담상세분류*/
-		                  , DATE_FORMAT(A.QUEST_DT,'%Y-%m-%d %H:%i:%S')     AS QUEST_DT         /*문의일시*/
-		                  , A.QUEST_TITLE                                                       /*문의제목*/
-		                  , A.CUST_NO                                                           /*고객번호*/
-		                  , B.CUST_ID                                                           /*고객ID*/
-		                  , B.CUST_NM                                                           /*고객명*/
-		                  , A.CELL_PHNNO                                                        /*휴대전화번호*/
-		                  , A.SMS_REQ_YN                                                        /*SMS요청여부*/
-		                  , A.SMS_SEND_YN                                                       /*SMS발송여부*/
-		                  , A.EMAIL                                                             /*이메일*/
-		                  , A.ANS_STAT                                                          /*답변상태*/
-		                  , DATE_FORMAT(A.ANS_DT, '%Y-%m-%d %H:%i:%S')      AS ANS_DT           /*답변일시*/
-		                  , A.ANS_NO                                                            /*답변자번호*/
-		                  , D.USER_NM                                       AS ANS_NM           /*답변자명*/
-		             FROM   TB_COUNSEL A
-		             INNER JOIN TB_CUSTOMER B ON A.CUST_NO = B.CUST_NO
-		             LEFT OUTER JOIN TB_USER D ON A.ANS_NO = D.USER_NO
-		             JOIN ( SELECT @rownum := 0) R
-		             WHERE  COUNSEL_TYPE = 'C' /*상담유형(1:1문의)*/
-		             <if test="siteCd != null and siteCd != ''">
-		             AND    A.SITE_CD = #{siteCd}
-		             </if>
-		             <if test="counselClsf != null and counselClsf != ''">
-		             AND    A.COUNSEL_CLSF = #{counselClsf}
-		             </if>
-		             <if test="counselDclsf != null and counselDclsf != ''">
-		             AND    A.COUNSEL_DCLSF = #{counselDclsf}
-		             </if>
-		             <if test="ansNo != null and ansNo != ''">
-		             AND    A.ANS_NO = #{ansNo}
-		             </if>
-		             <if test="delYn != null and delYn != ''">
-		             AND    A.DEL_YN = #{delYn}
-		             </if>
-		             <if test="condition != null and condition != ''">
-		                 <if test="custGb == 'custId'">
-		             AND    B.CUST_ID LIKE #{condition}||'%'
-		                 </if>
-		                 <if test="custGb == 'custNm'">
-		             AND    B.CUST_NM LIKE FN_ENC_AES(#{condition})||'%'
-		                 </if>
-		                 <if test="custGb == 'email'">
-		             AND    A.EMAIL LIKE FN_ENC_AES(#{condition})||'%'
-		                 </if>
-		             </if>
-		             <if test="termStdt != null and termStdt != ''">
-		             AND    A.QUEST_DT <![CDATA[>=]]> STR_TO_DATE(#{termStdt},'%Y-%m-%d')
-		             </if>
-		             <if test="termEddt != null and termEddt != ''">
-		             AND    A.QUEST_DT <![CDATA[<]]> DATE_ADD(STR_TO_DATE(#{termEddt},'%Y-%m-%d'),INTERVAL 1 DAY)
-		             </if>
-		             <if test="ansStat != null and ansStat != ''">
-		             AND    A.ANS_STAT = #{ansStat}
-		             </if>
-		             ORDER  BY A.QUEST_DT DESC
+		SELECT Z.*
+		FROM   (
+		        SELECT @rownum := @rownum + 1 AS RNUM
+		             , A.*
+		        FROM   (
+		                SELECT A.COUNSEL_SQ                                                        /*상담일련번호*/
+		                     , A.SITE_CD                                                           /*사이트코드*/
+		                     , FN_GET_CODE_NM('G059',A.COUNSEL_CLSF)           AS COUNSEL_CLSF_NM  /*상담분류명*/
+		                     , FN_GET_CODE_NM(A.COUNSEL_CLSF,A.COUNSEL_DCLSF)  AS COUNSEL_DCLSF_NM /*상담상세분류명*/
+		                     , A.COUNSEL_DCLSF                                                     /*상담상세분류*/
+		                     , DATE_FORMAT(A.QUEST_DT,'%Y-%m-%d %H:%i:%S')     AS QUEST_DT         /*문의일시*/
+		                     , A.QUEST_TITLE                                                       /*문의제목*/
+		                     , A.CUST_NO                                                           /*고객번호*/
+		                     , B.CUST_ID                                                           /*고객ID*/
+		                     , B.CUST_NM                                                           /*고객명*/
+		                     , A.CELL_PHNNO                                                        /*휴대전화번호*/
+		                     , A.SMS_REQ_YN                                                        /*SMS요청여부*/
+		                     , A.SMS_SEND_YN                                                       /*SMS발송여부*/
+		                     , A.EMAIL                                                             /*이메일*/
+		                     , A.ANS_STAT                                                          /*답변상태*/
+		                     , A.ASSIGNED_CS_NO                                                    /*할당된상담사번호*/
+		                     , (SELECT USER_NM
+		                        FROM   TB_USER
+		                        WHERE  USER_NO = A.ASSIGNED_CS_NO)             AS ASSIGNED_CS_NM   /*할당된상담사명*/
+		                     , DATE_FORMAT(A.ANS_DT, '%Y-%m-%d %H:%i:%S')      AS ANS_DT           /*답변일시*/
+		                     , A.ANS_NO                                                            /*답변자번호*/
+		                     , D.USER_NM                                       AS ANS_NM           /*답변자명*/
+		                FROM   TB_COUNSEL A
+		                INNER JOIN TB_CUSTOMER B ON A.CUST_NO = B.CUST_NO
+		                LEFT OUTER JOIN TB_USER D ON A.ANS_NO = D.USER_NO
+		                JOIN (SELECT @rownum := 0) R
+		                WHERE  COUNSEL_TYPE = 'C' /*상담유형(1:1문의)*/
+		                <if test="siteCd != null and siteCd != ''">
+		                AND    A.SITE_CD = #{siteCd}
+		                </if>
+		                <if test="counselClsf != null and counselClsf != ''">
+		                AND    A.COUNSEL_CLSF = #{counselClsf}
+		                </if>
+		                <if test="counselDclsf != null and counselDclsf != ''">
+		                AND    A.COUNSEL_DCLSF = #{counselDclsf}
+		                </if>
+		                <if test="ansNo != null and ansNo != ''">
+		                AND    A.ANS_NO = #{ansNo}
+		                </if>
+		                <if test="delYn != null and delYn != ''">
+		                AND    A.DEL_YN = #{delYn}
+		                </if>
+		                <if test="condition != null and condition != ''">
+		                    <if test="custGb == 'custId'">
+		                AND    B.CUST_ID LIKE #{condition}||'%'
+		                    </if>
+		                    <if test="custGb == 'custNm'">
+		                AND    B.CUST_NM LIKE FN_ENC_AES(#{condition})||'%'
+		                    </if>
+		                    <if test="custGb == 'email'">
+		                AND    A.EMAIL LIKE FN_ENC_AES(#{condition})||'%'
+		                    </if>
+		                </if>
+		                <if test="termStdt != null and termStdt != ''">
+		                AND    A.QUEST_DT <![CDATA[>=]]> STR_TO_DATE(#{termStdt},'%Y-%m-%d')
+		                </if>
+		                <if test="termEddt != null and termEddt != ''">
+		                AND    A.QUEST_DT <![CDATA[<]]> DATE_ADD(STR_TO_DATE(#{termEddt},'%Y-%m-%d'),INTERVAL 1 DAY)
+		                </if>
+		                <if test="ansStat != null and ansStat != ''">
+		                AND    A.ANS_STAT = #{ansStat}
+		                </if>
+		                <if test="assignedCsNo != null and assignedCsNo != ''">
+		                AND    A.ASSIGNED_CS_NO = #{assignedCsNo}
+		                </if>
+		                ORDER  BY A.QUEST_DT DESC
 		        <include refid="getListPagingCondition_sql"/>
 	</select>
 	
@@ -128,9 +135,26 @@
 		<if test="ansStat != null and ansStat != ''">
 		AND    A.ANS_STAT = #{ansStat}
 		</if>
+		<if test="assignedCsNo != null and assignedCsNo != ''">
+		AND    A.ASSIGNED_CS_NO = #{assignedCsNo}
+		</if>
 		ORDER  BY A.QUEST_DT DESC
 	</select>
 
+	<!--1:1문의 상담사 할당 Update -->
+	<update id="updateOneToOneQnaCounselor" parameterType="Counsel">
+		/* TsaCounsel.updateOneToOneQnaCounselor */
+		UPDATE TB_COUNSEL
+		SET    ASSIGNED_CS_NO = #{assignedCsNo}
+		     , ASSIGNED_YMD = DATE_FORMAT(NOW(),'%Y%m%d')
+		     , ASSIGNED_HMS = DATE_FORMAT(NOW(),'%H%i%S')
+		     , ASSIGNER_NO = #{updNo}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  COUNSEL_SQ = #{counselSq}
+		AND    ANS_STAT IN ('G060_00','G060_10') /*대기중,처리중*/
+	</update>
+
 	<!-- 1:1문의 상세 -->
 	<select id="getOneToOneQna" parameterType="Counsel" resultType="Counsel">
 		/* TsaCounsel.getOneToOneQna */
@@ -159,13 +183,29 @@
 		     , A.SYS_FILE_NM2                                                     /*시스템파일명2*/
 		     , A.ANS_STAT                                                         /*답변상태코드*/
 		     , FN_GET_CODE_NM('G060',A.ANS_STAT)              AS ANS_STAT_NM      /*답변상태명*/
+		     , A.ASSIGNED_CS_NO                                                   /*할당된상담사번호*/
+		     , D.USER_NM                                      AS ASSIGNER_NM      /*할당자명*/
+		     , DATE_FORMAT(CONCAT(A.ASSIGNED_YMD,A.ASSIGNED_HMS),'%Y-%m-%d %H:%i:%S') AS ASSIGNED_DT /*할당일시*/
 		FROM   TB_COUNSEL A
 		INNER JOIN TB_CUSTOMER B ON A.CUST_NO = B.CUST_NO
 		LEFT OUTER JOIN TB_USER C ON A.ANS_NO = C.USER_NO
+		LEFT OUTER JOIN TB_USER D ON A.ASSIGNER_NO = D.USER_NO
 		WHERE  A.COUNSEL_SQ = #{counselSq}
 		AND    A.COUNSEL_TYPE = 'C' /*상담유형(1:1문의)*/
 	</select>
 	
+	<!--문의 답변 임시 저장 -->
+	<update id="updateQnaAnswerTemp" parameterType="Counsel">
+		/* TsaCounsel.updateQnaAnswerTemp */
+		UPDATE TB_COUNSEL
+		SET    ANS_TITLE = #{ansTitle}
+		     , ANS_CONTENT = #{ansContent}
+		     , ANS_STAT = 'G060_10' /*처리중*/
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  COUNSEL_SQ = #{counselSq}
+	</update>
+	
 	<!--문의 답변 저장 -->
 	<update id="updateQnaAnswer" parameterType="Counsel">
 		/* TsaCounsel.updateQnaAnswer */

+ 11 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaRenderer.xml

@@ -508,4 +508,15 @@
 		ORDER  BY SUPPLY_VENDOR_NM
 	</select>
 	
+	<!-- 상담사 목록 -->
+	<select id="getCounselorList" resultType="CommonCode">
+		/* TsaRenderer.getCounselorList */
+		SELECT USER_NO                         AS CD
+		     , CONCAT(USER_NM,'(',USER_ID,')') AS CD_NM
+		FROM   TB_USER
+		WHERE  ROLE_CD IN ('G001_A300','G001_A301') /*CS관리자, CS상담사*/
+		AND    USE_YN = 'Y'
+		ORDER  BY USER_NM, USER_ID
+	</select>
+	
 </mapper>

+ 83 - 13
src/main/webapp/WEB-INF/views/customer/OneToOneQnaDetailForm.html

@@ -34,18 +34,18 @@
 				<table class="tableStyle" aria-describedby="상담정보">
 					<colgroup>
 						<col style="width:10%;"/>
-						<col style="width:10%;"/>
+<!-- 						<col style="width:10%;"/> -->
 						<col style="width:12%;"/>
 						<col style="width:15%;"/>
 						<col/>
 <!-- 						<col style="width:10%;"/> -->
 <!-- 						<col style="width:10%;"/> -->
-						<col style="width:25%;"/>
+						<col style="width:30%;"/>
 					</colgroup>
 					<thead>
 						<tr>
 							<th>상담일련번호</th>
-							<th>사이트</th>
+<!-- 							<th>사이트</th> -->
 							<th>상담분류</th>
 							<th>문의일시</th>
 							<th>고객정보</th>
@@ -57,13 +57,14 @@
 					<tbody>
 						<tr>
 							<td th:text="*{counselSq}"></td>
-							<td th:text="*{siteNm}"></td>
+<!-- 							<td th:text="*{siteNm}"></td> -->
 							<td th:utext="*{counselClsfNm}"></td>
 							<td th:text="*{questDt}"></td>
-							<td th:utext="*{maskingCustNm + ' / ' + maskingCellPhnno + '<br/>' + maskingEmail}"></td>
+<!-- 							<td><a href="javascript:void(0);" th:onclick="|cfnOpenCustDetailPopup(*{custNo});|"><span th:utext="*{maskingCustNm + ' / ' + maskingCellPhnno + ' / ' + maskingEmail}"></span></a></td> -->
+							<td th:utext="*{maskingCustNm + ' / ' + maskingCellPhnno + ' / ' + maskingEmail}"></td>
 <!-- 							<td th:text="*{relOrdNo}"></td> -->
 <!-- 							<td th:utext="*{ansTransYn == 'Y' ? ansTransDt + '<br/>' + ansCompNm : ''}"></td> -->
-							<td th:utext="*{ansStat == 'G060_20' ? ansStatNm + ' / ' + ansDt + '<br/>' + ansNm : ansStatNm}"></td>
+							<td th:utext="*{ansStat == 'G060_20' ? ansStatNm + ' / ' + ansDt + ' / ' + ansNm : ansStatNm}"></td>
 						</tr>
 					</tbody>
 				</table>
@@ -131,6 +132,31 @@
 						</tr>
 					</tbody>
 				</table>
+				
+				<h4>상담사 할당</h4>
+				<table class="frmStyle" aria-describedby="상담사 할당">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:40%;"/>
+						<col style="width:10%;"/>
+						<col style="width:40%;"/>
+					</colgroup>
+					<tbody>
+						<tr>
+							<th>상담사</th>
+							<td>
+								<select name="assignedCsNo" th:if="${sessionInfo.roleCd == 'G001_A300' or sessionInfo.roleCd == 'G001_0000' or sessionInfo.roleCd == 'G001_A000'}">
+									<option value="">[상담사 선택]</option>
+									<option th:if="${counselorList}" th:each="oneData, status : ${counselorList}" th:value="${oneData.cd}" th:text="|${oneData.cdNm}|" th:selected="${#strings.equals(counselInfo.assignedCsNo, oneData.cd)}"></option>
+								</select>
+								<button type="button" class="btn btn-warning btn-lg" id="btnAssignCounselor" th:if="${counselInfo.ansStat != 'G060_20' and (sessionInfo.roleCd == 'G001_A300' or sessionInfo.roleCd == 'G001_0000' or sessionInfo.roleCd == 'G001_A000')}">담당할당</button>
+							</td>
+							<th>할당자</th>
+							<td th:if="${counselInfo?.assignerNm != null}" th:utext="${counselInfo?.assignerNm + ' / ' + counselInfo?.assignedDt}" id="assignerNm"></td>
+							<td th:if="${counselInfo?.assignerNm == null}" id="assignerNm"></td>
+						</tr>
+					</tbody>
+				</table>
 			</form>
 		</div>
 		<!-- //CONTENT -->
@@ -138,27 +164,73 @@
 		<!-- 버튼 배치 영역 -->
 		<ul class="panelBar">
 			<li class="right">
-				<button type="button" class="btn btn-info btn-lg" id="btnSaveAnswer" th:if="${counselInfo.ansStat == 'G060_10'}">답변저장</button>
+				<button type="button" class="btn btn-gray btn-lg" id="btnSaveTemp" th:if="${counselInfo.ansStat != 'G060_20'}">임시저장</button>
+				<button type="button" class="btn btn-info btn-lg" id="btnSaveAnswer" th:if="${counselInfo.ansStat != 'G060_20'}">답변저장</button>
 			</li>
 		</ul>
 		<!-- //버튼 배치 영역 -->
 	</div>
 </div>
 
+<!-- 사용자 레이어팝업 : 등록 파일 출력 -->
 <div class="uPopupWrap off" id="layer_review_pic">
 	<div class="area reviewPic" style="width:700px; height:700px;">
 		<ul class="picList" th:object="${counselInfo}">
-			<li><div class="img"></div></li>
+<!-- 			<li><div class="img"></div></li> -->
+			<li th:if="${counselInfo.sysFileNm1 != null}"><div class="img" th:style="${'background-image:url(' + @environment.getProperty('domain.image') + '/' + counselInfo.sysFileNm1 + ');'}"></div></li>
+			<li th:if="${counselInfo.sysFileNm2 != null}"><div class="img" th:style="${'background-image:url(' + @environment.getProperty('domain.image') + '/' + counselInfo.sysFileNm2 + ');'}"></div></li>
 		</ul>
-		<!-- <button type="button" class="btnArr prev" onclick="fnPicPrev('layer_review_pic');">이전</button>
-		<button type="button" class="btnArr next" onclick="fnPicNext('layer_review_pic');">다음</button> -->
+		<button type="button" class="btnArr prev" onclick="fnPicPrev('layer_review_pic');">이전</button>
+		<button type="button" class="btnArr next" onclick="fnPicNext('layer_review_pic');">다음</button>
 		<button type="button" class="btnClose">닫기</button>
 	</div>
 </div>
-
+<!-- //사용자 레이어팝업 : 등록 파일 출력 -->
 
 <script th:inline="javascript">
 /*<![CDATA[*/
+	// 담당할당
+	$('#btnAssignCounselor').on('click', function() {
+		if (gagajf.isNull($('#qnaDetailForm select[name=assignedCsNo]').val())) {
+			mcxDialog.alertC('상담사를 선택해 주세요.', {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#qnaDetailForm select[name=assignedCsNo]').focus();
+				}
+			});
+			return;
+		}
+		
+		mcxDialog.confirm("담당을 할당하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				var jsonData = JSON.stringify({
+					counselSq : $('#qnaDetailForm input[name=counselSq]').val(),
+					assignedCsNo : $('#qnaDetailForm select[name=assignedCsNo]').val()
+				});
+				gagajf.ajaxJsonSubmit('/customer/onetoone/qna/assign', jsonData, function() {
+					let assignerNm = [[${sessionInfo.userNm}]] + ' / ' + new Date().format("YYYY-MM-DD HH:mm:ss");
+					$('#assignerNm').html(assignerNm);
+				});
+			}
+		});
+	});
+	
+	// 임시 저장
+	$('#btnSaveTemp').on('click', function() {
+		mcxDialog.confirm("임시로 저장하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				gagajf.ajaxFormSubmit('/customer/qna/answer/temp/save', '#qnaDetailForm', function() {
+					uifnPopupClose('popupOneToOneQnaDetail');
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	});
+	
 	// 답변 저장
 	$('#btnSaveAnswer').on('click', function() {
 		// 입력 값 체크
@@ -224,8 +296,6 @@
 	
 	$(document).ready(function() {
 		cfnGetTextLength($('textarea[name=ansContent]'), 4000, $('#dpLocAnsContent'));
-		
-		
 	});
 /*]]>*/
 </script>

+ 83 - 19
src/main/webapp/WEB-INF/views/customer/OneToOneQnaForm.html

@@ -34,23 +34,23 @@
 						<col style="width:10%;"/>
 						<col style="width:12%;"/>
 						<col style="width:10%;"/>
-						<col style="width:15%;"/>
-						<col style="width:10%;"/>
-						<col style="width:10%;"/>
+						<col style="width:12%;"/>
 						<col style="width:10%;"/>
 						<col/>
+						<col style="width:10%;"/>
+						<col style="width:12%;"/>
 					</colgroup>
 					<tr>
-						<th>사이트</th>
-						<td>
-							<select name="siteCd">
-								<option th:if="${siteList}" th:each="oneData, status : ${siteList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option>
-							</select>
-						</td>
+<!-- 						<th>사이트</th> -->
+<!-- 						<td> -->
+<!-- 							<select name="siteCd"> -->
+<!-- 								<option th:if="${siteList}" th:each="oneData, status : ${siteList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option> -->
+<!-- 							</select> -->
+<!-- 						</td> -->
 						<th>상담분류</th>
 						<td>
 							<select name="counselClsf">
-								<option value="">[선택]</option>
+								<option value="">[전체]</option>
 								<option th:if="${counselClsfList}" th:each="oneData, status : ${counselClsfList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 							</select>
 						</td>
@@ -71,6 +71,13 @@
 							</select>
 							<input type="text" name="condition" class="w200" maxlength="100"/>
 						</td>
+						<th>상담사</th>
+						<td>
+							<select name="assignedCsNo">
+								<option value="">[전체]</option>
+								<option th:if="${counselorList}" th:each="oneData, status : ${counselorList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
+							</select>
+						</td>
 					</tr>
 <!-- 					<tr> -->
 <!-- 						<th>답변자</th> -->
@@ -98,13 +105,17 @@
 		<div class="panelStyle">
 			<ul class="panelBar">
 				<li>
+					<select name="assignedCsNo2" id="assignedCsNo2" th:if="${sessionInfo.roleCd == 'G001_A300' or sessionInfo.roleCd == 'G001_0000' or sessionInfo.roleCd == 'G001_A000'}">
+						<option value="">[상담사 선택]</option>
+						<option th:if="${counselorList}" th:each="oneData, status : ${counselorList}" th:value="${oneData.cd}" th:text="${oneData.cdNm}"></option>
+					</select>
+					<button type="button" class="btn btn-warning btn-lg" id="btnAssign" th:if="${sessionInfo.roleCd == 'G001_A300' or sessionInfo.roleCd == 'G001_0000' or sessionInfo.roleCd == 'G001_A000'}">담당할당</button>
 					<button type="button" class="btn btn-default btn-lg" id="btnExcel">엑셀다운로드</button>
 				</li>
 				<li class="right">
 					검색결과 : <strong>
 					<span id="gridRowTotalCount">0</span> 건</strong>&nbsp; 쪽번호 <span id="pgNo">0</span>/
-					<strong id="endPgNo">0</strong>&nbsp;&nbsp; <select id="pageSize"
-					name="pageSize">
+					<strong id="endPgNo">0</strong>&nbsp;&nbsp; <select id="pageSize" name="pageSize">
 						<option value="50" selected="selected">50개씩 보기</option>
 						<option value="100">100개씩 보기</option>
 						<option value="500">500개씩 보기</option>
@@ -127,19 +138,25 @@
 <script type="text/javascript" src="/ux/plugins/gaga/gaga.paging.js"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
-	let siteList = gagajf.convertToArray([[${siteList}]]); // 사이트
+// 	let siteList = gagajf.convertToArray([[${siteList}]]); // 사이트
 	let ansStatList = gagajf.convertToArray([[${ansStatList}]]); // 답변상태
 	
 	// specify the columns
 	let columnDefs = [
 		{
-			headerName: "상담일련번호", field: "counselSq", width: 100, cellClass: 'text-center',
-			cellRenderer: function(params) { return '<a href="javascript:void(0);">' + params.value + '</a>'; }
+			width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false,
+			checkboxSelection: function (params) {
+				return (params.data.ansStat != 'G060_20') ? true : false;
+			}
 		},
 		{
-			headerName: "사이트", field: "siteCd", width: 100, cellClass: 'text-center',
-			valueGetter: function (params) { return gagaAgGrid.lookupValue(siteList, params.data.siteCd); }
+			headerName: "상담일련번호", field: "counselSq", width: 100, cellClass: 'text-center',
+			cellRenderer: function(params) { return '<a href="javascript:void(0);">' + params.value + '</a>'; }
 		},
+// 		{
+// 			headerName: "사이트", field: "siteCd", width: 100, cellClass: 'text-center',
+// 			valueGetter: function (params) { return gagaAgGrid.lookupValue(siteList, params.data.siteCd); }
+// 		},
 		{
 			headerName: "상담분류", field: "counselClsfNm", width: 150, cellClass: 'text-center'
 // 			valueFormatter: function (params) { return params.value + (gagajf.isNull(params.data.counselDclsfNm) ? "" : "-" + params.data.counselDclsfNm); }
@@ -148,7 +165,10 @@
 			headerName: "문의일시", field: "questDt", width: 150, cellClass: 'text-center',
 			cellRenderer: function (params) { return gagaAgGrid.toDateTimeFormat(params.value); }
 		},
-		{headerName: "문의 제목", field: "questTitle", width: 300},
+		{
+			headerName: "문의 제목", field: "questTitle", width: 300,
+			cellRenderer: function(params) { return '<a href="javascript:void(0);">' + params.value + '</a>'; }
+		},
 		{headerName: "고객번호", field: "custNo", width: 100, cellClass: 'text-center', hide: true},
 		{headerName: "고객ID", field: "maskingCustId", width: 100, cellClass: 'text-center', hide: true},
 		{
@@ -177,6 +197,8 @@
 			headerName: "답변상태", field: "ansStat", width: 100, cellClass: 'text-center',
 			valueGetter: function (params) { return gagaAgGrid.lookupValue(ansStatList, params.data.ansStat); }
 		},
+		{headerName: "상담사번호", field: "assignedCsNo", width: 100, cellClass: 'text-center', hide: true},
+		{headerName: "상담사명", field: "assignedCsNm", width: 100, cellClass: 'text-center'},
 		{headerName: "답변자번호", field: "ansNo", width: 100, cellClass: 'text-center', hide: true},
 		{headerName: "답변자명", field: "ansNm", width: 100, cellClass: 'text-center'},
 		{
@@ -188,9 +210,11 @@
 	// Get GridOptions
 	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
 	
+	gridOptions.rowSelection = 'multiple';
+	
 	// 셀 클릭 이벤트
 	gridOptions.onCellClicked = function(event) {
-		if (event.colDef.field == 'counselSq') {
+		if (event.colDef.field == 'counselSq' || event.colDef.field == 'questTitle') {
 			// 1:1문의 상세
 			cfnOpenOneToOneQnaDetailPopup(event.data.counselSq);
 		} else if (event.colDef.field == 'maskingCustNm') {
@@ -223,6 +247,46 @@
 		gagaPaging.createPagination(result.pageing.pageable);
 	}
 	
+	// 담당할당
+	$('#btnAssign').on('click', function() {
+		if (gagajf.isNull($('#assignedCsNo2').val())) {
+			mcxDialog.alertC('상담사를 선택해 주세요.', {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					$('#assignedCsNo2').focus();
+				}
+			});
+			return;
+		}
+		
+		var chooseData = gagaAgGrid.selectedRowData(gridOptions);
+		
+		if (chooseData.length == 0) {
+			mcxDialog.alert('선택된 행이 없습니다.');
+			return;
+		}
+		
+		mcxDialog.confirm("담당을 할당하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				var updatedData = [];
+				
+				$.each(chooseData, function(idx, item) {
+					item.assignedCsNo = $('#assignedCsNo2').val();
+					updatedData.push(item);
+				});
+				
+				var jsonData = JSON.stringify(updatedData);
+				gagajf.ajaxJsonSubmit('/customer/onetoone/qna/list/assign'
+						, jsonData
+						, function() {
+							$('#btnSearch').trigger('click');
+						});
+			}
+		});
+	});
+	
 	// 엑셀다운로드
 	$('#btnExcel').on('click', function() {
 		gagaAgGrid.exportToExcel('1:1문의 목록', gridOptions);