Browse Source

상품상세 - 육아용품 안전인증 필수 처리

eskim 4 years ago
parent
commit
5d543356b3

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

@@ -1087,6 +1087,16 @@ public class TsaGoodsService {
 
 		// 상품 정보고시 변경
 		this.saveGoodsNotiInfo(goods);
+		
+		// 안전인증정보
+		GoodsSafeNo goodsSafeNo = new GoodsSafeNo();
+		goodsSafeNo.setGoodsCd(goods.getGoodsCd());
+		goodsSafeNo.setCertFormGb(goods.getCertFormGb());
+		goodsSafeNo.setCertTargetGb(goods.getCertTargetGb());
+		goodsSafeNo.setCertType(goods.getCertType());
+		goodsSafeNo.setCertNum(goods.getCertNum());
+		log.info("goodsSafeNo ==>{}", goodsSafeNo);
+		this.saveGoodsDetailCertNum(goodsSafeNo);
 
 		// 상품 구매등급 적용
 		if (goods.getGoodsOrderGrade() != null && goods.getGoodsOrderGrade().length > 0) {

+ 15 - 0
src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -3100,4 +3100,19 @@ public class TsaGoodsController extends TsaBaseController {
 
 		return mav;
 	}
+		
+	/**
+	 * 품목 목록 - 단건 조회
+	 *
+	 * @param itemkind
+	 * @return
+	 * @author eskim
+	 * @since 2021. 06. 27
+	 */
+	@PostMapping("/itemkind/list")
+	@ResponseBody
+	public Collection<Itemkind> getItemkind(Itemkind itemkind) {
+		return goodsService.getItemkindList(itemkind);
+	}
+
 }

+ 4 - 0
src/main/java/com/style24/persistence/domain/Goods.java

@@ -144,6 +144,10 @@ public class Goods extends TscBaseDomain {
 //	private String sizeSoldoutYn;
 	private String siteCd;
 	private int sellDay15Qty;
+	
+	private String certTargetGb;
+	private String certFormGb;
+	private String certType;
 
 	private int goodsSq;
 	private String sizeGb;

+ 92 - 22
src/main/webapp/WEB-INF/views/goods/GoodsDetailForm.html

@@ -587,9 +587,9 @@
 										<th>인증대상</th>
 										<td colspan="5">
 											<label class="rdoBtn" th:if="${certTargetGbList}" th:each="oneData, status : ${certTargetGbList}">
-												<input type="radio" name="certTargetGb" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
+												<input type="radio" name="selCertTargetGb" th:value="${oneData.cd}" th:text="${oneData.cdNm}"/>
 											</label>
-											<input type="hidden" id="orgCertTargetGb" name="orgCertTargetGb"/>
+											<input type="hidden" id="certTargetGb" name="certTargetGb"/>
 										</td>
 									</tr>
 									<tr>	
@@ -599,7 +599,7 @@
 												<option value="">[선택]</option>
 												<option th:if="${certFormGbList}" th:each="oneData, status : ${certFormGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 											</select>
-											<input type="hidden" id="orgCertformGb" name="orgCertformGb"/>
+											<input type="hidden" id="certformGbOrg" name="certformGbOrg"/>
 										</td>
 										<th>인증타입</th>
 										<td>
@@ -607,7 +607,7 @@
 												<option value="">[선택]</option>
 												<option th:if="${certTypeList}" th:each="oneData, status : ${certTypeList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 											</select>
-											<input type="hidden" id="orgCertType" name="orgCertType"/>
+											<input type="hidden" id="certTypeOrg" name="certTypeOrg"/>
 										</td>
 										<th>인증번호</th>
 										<td>
@@ -1281,22 +1281,20 @@
 		if (result == null) return;
 			
 		if (result.certTargetGb == "G083_1"){
-			$("#goodsDetailForm input:radio[name=certTargetGb]:input[value='G083_1']").trigger('click');
+			$("#goodsDetailForm input:radio[name=selCertTargetGb]:input[value='G083_1']").trigger('click');
 		}else if (result.certTargetGb == "G083_2"){
-			$("#goodsDetailForm input:radio[name=certTargetGb]:input[value='G083_2']").trigger('click');
+			$("#goodsDetailForm input:radio[name=selCertTargetGb]:input[value='G083_2']").trigger('click');
 		}else if (result.certTargetGb == "G083_3"){
-			$("#goodsDetailForm input:radio[name=certTargetGb]:input[value='G083_3']").trigger('click');
+			$("#goodsDetailForm input:radio[name=selCertTargetGb]:input[value='G083_3']").trigger('click');
 		}
-		$("#goodsDetailForm input[name=orgCertTargetGb]").val(result.certTargetGb);
+		$("#goodsDetailForm input[name=certTargetGb]").val(result.certTargetGb);
 		$("#goodsDetailForm select[name=certFormGb]").val(result.certFormGb);
-		$("#goodsDetailForm input[name=orgCertFormGb]").val(result.certFormGb);
+		$("#goodsDetailForm input[name=certFormGbOrg]").val(result.certFormGb);
 		$("#goodsDetailForm select[name=certType]").val(result.certType);
-		$("#goodsDetailForm input[name=orgCertType]").val(result.certType);
+		$("#goodsDetailForm input[name=certTypeOrg]").val(result.certType);
 		$("#goodsDetailForm input[name=certNum]").val(result.certNum);
-		$("#goodsDetailForm input[name=orgCertNum]").val(result.certNum);
+		$("#goodsDetailForm input[name=certNumOrg]").val(result.certNum); 
 		$('#goodsDetailForm').find('#certStateTxt').html(result.certState);
-		$('#goodsDetailForm').find('#certTargetGbTxt').html(result.certTargetGb);
-		
 		$('#goodsDetailForm').find('#certOrganNameTxt').html(result.certOrganName);
 		$('#goodsDetailForm').find('#certDivTxt').html(result.certDiv);
 		$('#goodsDetailForm').find('#certDtTxt').html(!gagajf.isNull(result.certDt) ? result.certDt.toDate("YYYYMMDD").format("YYYY-MM-DD") : '');
@@ -1961,6 +1959,22 @@
 			return false;
 		}
 		
+		//안전인증관련
+		if (!fnGoodsSafetyCertNumCheck()) return false;
+		
+		//인증번호 있는데 인증작업 했는지 여부 확인
+		if (!gagajf.isNull($("#goodsDetailForm input[name=certNum]").val())){
+			if (gagajf.isNull($('#goodsDetailForm').find('#certStateTxt').text())){
+				mcxDialog.alert("안전인증작업을 하거나 인증번호를 확인해주세요.");
+				return false;
+			}
+		}
+		
+		if (!gagajf.isNull($("#goodsDetailForm input[name=certNum]").val()) && ($("#goodsDetailForm input[name=certNum]").val() != $("#goodsDetailForm input[name=certNumOrg]").val())){
+			mcxDialog.alert("안전인증작업을 하거나 인증번호를 확인해주세요.");
+			return false;
+		}
+		
 		var basicColor = $("#goodsDetailForm input[name=basicColor]:checked").val();
 		var dcRate = 0;
 		var listPrice = $("#goodsDetailForm input[name=listPrice]").val().removeComma();
@@ -2399,6 +2413,22 @@
 		});
 	});
 	
+
+	//품목코드변경시
+	$('#goodsDetailForm select[name=itemkindCd]').on('change', function() {
+		var itemkindCd = $("#goodsDetailForm select[name=itemkindCd]").val();
+		var params = new Object();
+		params.itemkindCd = itemkindCd;
+		cfnAjaxSubmit("/goods/itemkind/list", "json", fnItemkindCallback, params);
+		
+	});	
+	
+	var fnItemkindCallback = function(result){
+		if (result == null) return;
+		$("#goodsDetailForm input[name=niClsfCd]").val(result[0].niClsfCd)
+	}
+
+	
 	// 안전인증
 	$("#btnGoodsSafetyCertNum").on("click", function(){
 		
@@ -2409,7 +2439,7 @@
 			sureBtnText: "확인",
 			sureBtnClick: function(){
 				var data = {  goodsCd : $('#goodsDetailForm input[name=goodsCd]').val()
-							, certTargetGb : $("#goodsDetailForm input[name=certTargetGb]:checked").val()
+							, certTargetGb : $("#goodsDetailForm input[name=selCertTargetGb]:checked").val()
 							, certFormGb : $("#goodsDetailForm select[name=certFormGb]").val()
 							, certType : $("#goodsDetailForm select[name=certType]").val()
 							, certNum : $("#goodsDetailForm input[name=certNum]").val()
@@ -2422,18 +2452,56 @@
 	
 	var fnGoodsSafetyCertNumCheck = function(){
 		
-		if(gagajf.isNull($("#goodsDetailForm input[name=certTargetGb]:checked").val())){
-			mcxDialog.alert("인증대상을 선택해 주세요.");
-			return false;
+		// 유아용품 확인  
+		if ("G004_23" == $("#goodsDetailForm input[name=niClsfCd]").val()){
+			if (gagajf.isNull($("#goodsDetailForm input[name=selCertTargetGb]:checked").val())){
+				mcxDialog.alert("안전인증대상을 선택해 주세요.");
+				return false;	
+			}
+		}else{
+			if ((!gagajf.isNull($("#goodsDetailForm input[name=selCertTargetGb]:checked").val()) && "G083_1" != $("#goodsDetailForm input[name=selCertTargetGb]:checked").val())){
+				
+			}else{
+				if ((!gagajf.isNull($("#goodsDetailForm input[name=selCertTargetGb]:checked").val()) && "G083_1" == $("#goodsDetailForm input[name=selCertTargetGb]:checked").val())||
+					!gagajf.isNull($("#goodsDetailForm select[name=certFormGb]").val()) ||
+					!gagajf.isNull($("#goodsDetailForm select[name=certType]").val()) ||
+					!gagajf.isNull($("#goodsDetailForm input[name=certNum]").val())){
+					mcxDialog.alert("인즌대상이 아닌 상품은 인증대상아님을 선택해주세요");
+					return false;	
+				}else{
+					return true;
+				}	
+			}
+			
+		}
+			
+		if(gagajf.isNull($("#goodsDetailForm input[name=selCertTargetGb]:checked").val())){
+			
+			if (!gagajf.isNull($("#goodsDetailForm select[name=certFormGb]").val()) ||
+				!gagajf.isNull($("#goodsDetailForm select[name=certType]").val()) ||
+				!gagajf.isNull($("#goodsDetailForm input[name=certNum]").val())){
+				mcxDialog.alert("안전인증대상을 선택해 주세요.");
+				return false;	
+			}
+			
 		}
 		
 		// 인증대상이 아니면 스킵
 		if ("G083_1" != $("#goodsDetailForm input[name=selCertTargetGb]:checked").val()){
-			return true;
+			
+			if (!gagajf.isNull($("#goodsDetailForm select[name=certFormGb]").val()) ||
+				!gagajf.isNull($("#goodsDetailForm select[name=certType]").val()) ||
+				!gagajf.isNull($("#goodsDetailForm input[name=certNum]").val())){
+				mcxDialog.alert("인즌대상이 아닐경우 정보를 입력하지 마세요.");
+				return false;	
+			}else{
+				$("#goodsDetailForm input[name=certTargetGb]").val($("#goodsDetailForm input[name=selCertTargetGb]:checked").val());
+				return true;	
+			}
 		}
 		
 		if(gagajf.isNull($("#goodsDetailForm select[name=certFormGb]").val())){
-			mcxDialog.alertC("인증형태를 선택해 주세요.", {
+			mcxDialog.alertC("안전인증형태를 선택해 주세요.", {
 				sureBtnText: "확인",
 				sureBtnClick: function() {
 					$("#goodsDetailForm select[name=certFormGb]").focus();
@@ -2443,7 +2511,7 @@
 		}
 		
 		if(gagajf.isNull($("#goodsDetailForm select[name=certType]").val())){
-			mcxDialog.alertC("인증타입를 선택해 주세요.", {
+			mcxDialog.alertC("안전인증타입를 선택해 주세요.", {
 				sureBtnText: "확인",
 				sureBtnClick: function() {
 					$("#goodsDetailForm select[name=certType]").focus();
@@ -2453,9 +2521,9 @@
 		}
 		
 		//인증타입이 공급자적합성일 경우 인증번호 미입력
-		if( "G081_3" != $("#goodsDetailForm select[name=certType]").val()){
+		if( "G081_1" == $("#goodsDetailForm select[name=certType]").val() || "G081_2" == $("#goodsDetailForm select[name=certType]").val()){
 			if(gagajf.isNull($("#goodsDetailForm input[name=certNum]").val())){
-				mcxDialog.alertC("인증번호를 선택해 주세요.", {
+				mcxDialog.alertC("안전인증번호를 입력해 주세요.", {
 					sureBtnText: "확인",
 					sureBtnClick: function() {
 						$("#goodsDetailForm input[name=certNum]").focus();
@@ -2465,6 +2533,8 @@
 			}
 		}
 		
+		$("#goodsDetailForm input[name=certTargetGb]").val($("#goodsDetailForm input[name=selCertTargetGb]:checked").val());
+		
 		return true;
 	}