Jelajahi Sumber

공급업체관리 오류 수정

gagamel 5 tahun lalu
induk
melakukan
fc950d43b2

+ 10 - 2
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaBusinessDao.java

@@ -24,11 +24,19 @@ public interface TsaBusinessDao {
 	Collection<SupplyCompany> getSupplyCompanyList(SupplyCompany supplyComp);
 
 	/**
-	 * 공급업체 저장 처리
+	 * 공급업체 생성
 	 * @param supplyComp - 공급업체 정보
 	 * @author gagamel
 	 * @since 2020. 10. 14
 	 */
-	void saveSupplyCompany(SupplyCompany supplyComp);
+	void createSupplyCompany(SupplyCompany supplyComp);
+
+	/**
+	 * 공급업체 수정
+	 * @param supplyComp - 공급업체 정보
+	 * @author gagamel
+	 * @since 2020. 10. 14
+	 */
+	void updateSupplyCompany(SupplyCompany supplyComp);
 
 }

+ 6 - 1
style24.admin/src/main/java/com/style24/admin/biz/service/TsaBusinessService.java

@@ -2,6 +2,7 @@ package com.style24.admin.biz.service;
 
 import java.util.Collection;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -45,7 +46,11 @@ public class TsaBusinessService {
 	 * @since 2020. 10. 14
 	 */
 	public void saveSupplyCompany(SupplyCompany supplyComp) {
-		businessDao.saveSupplyCompany(supplyComp);
+		if (StringUtils.isNotBlank(supplyComp.getSupplyCompCd())) {
+			businessDao.updateSupplyCompany(supplyComp);
+		} else {
+			businessDao.createSupplyCompany(supplyComp);
+		}
 	}
 
 }

+ 0 - 1
style24.admin/src/main/java/com/style24/admin/biz/web/TsaBusinessController.java

@@ -90,7 +90,6 @@ public class TsaBusinessController extends TsaBaseController {
 	public GagaResponse saveSupplyInfo(@RequestBody SupplyCompany supplyComp) {
 		supplyComp.setRegNo(TsaSession.getInfo().getUserNo());
 		supplyComp.setUpdNo(TsaSession.getInfo().getUserNo());
-		log.info("supplyComp: {}", supplyComp);
 
 		businessService.saveSupplyCompany(supplyComp);
 

+ 14 - 8
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -44,9 +44,9 @@
 		</if>
 	</select>
 	
-	<!-- 공급업체 저장 -->
-	<insert id="saveSupplyCompany" parameterType="SupplyCompany">
-		/* TsaBusiness.saveSupplyCompany */
+	<!-- 공급업체 생성 -->
+	<insert id="createSupplyCompany" parameterType="SupplyCompany">
+		/* TsaBusiness.createSupplyCompany */
 		INSERT INTO TB_SUPPLY_COMPANY (
 		       SUPPLY_COMP_CD
 		     , SUPPLY_COMP_NM
@@ -78,8 +78,8 @@
 		     , UPD_DT
 		)
 		VALUES (
-		       (SELECT 'S'||LPAD(SUBSTRING(MAX(SUPPLY_COMP_CD),2) + 1,4,'0')
-		        FROM   TB_SUPPLY_COMPANY
+		       (SELECT CONCAT('S',LPAD(SUBSTRING(MAX(SUPPLY_COMP_CD),2) + 1,4,'0'))
+		        FROM   TB_SUPPLY_COMPANY Z
 		        WHERE  SUPPLY_COMP_CD LIKE 'S%'
 		       )
 		     , #{supplyCompNm}
@@ -110,8 +110,13 @@
 		     , #{updNo}
 		     , NOW()
 		)
-		ON DUPLICATE KEY UPDATE
-		       SUPPLY_COMP_NM  = #{supplyCompNm}
+	</insert>
+	
+	<!-- 공급업체 수정 -->
+	<update id="updateSupplyCompany" parameterType="SupplyCompany">
+		/* TsaBusiness.updateSupplyCompany */
+		UPDATE TB_SUPPLY_COMPANY
+		SET    SUPPLY_COMP_NM  = #{supplyCompNm}
 		     , BIZ_GB          = #{bizGb}
 		     , BIZ_NO          = #{bizNo}
 		     , BIZ_KIND        = #{bizKind}
@@ -136,6 +141,7 @@
 		     , USE_YN          = #{useYn}
 		     , UPD_NO          = #{updNo}
 		     , UPD_DT          = NOW()
-	</insert>
+		WHERE  SUPPLY_COMP_CD = #{supplyCompCd}
+	</update>
 
 </mapper>

+ 22 - 22
style24.admin/src/main/webapp/WEB-INF/views/business/SupplyCompanyForm.html

@@ -95,7 +95,7 @@
 					<tr>
 						<th>업체코드</th>
 						<td>
-							<input type="text" class="w150" name="supplyCompCd" placeholder="자동생성" maxlength="5" data-valid-name="업체코드" disabled="disabled"/>
+							<input type="text" class="w150" name="supplyCompCd" placeholder="자동생성" maxlength="5" data-valid-name="업체코드" readonly="readonly"/>
 						</td>
 						<th>업체명<i class="required" title="필수"></i></th>
 						<td>
@@ -103,8 +103,8 @@
 						</td>
 						<th>사업자구분<i class="required" title="필수"></i></th>
 						<td>
-							<label class="rdoBtn"><input type="radio" name="bizGb" id="bizGb" value="C">법인<span></span></label>
-							<label class="rdoBtn"><input type="radio" name="bizGb" id="bizGb" value="P">개인<span></span></label>
+							<label class="rdoBtn"><input type="radio" name="bizGb" id="bizGb" value="C" checked="checked"/>법인<span></span></label>
+							<label class="rdoBtn"><input type="radio" name="bizGb" id="bizGb" value="P"/>개인<span></span></label>
 						</td>
 						<th>사업자등록번호<i class="required" title="필수"></i></th>
 						<td>
@@ -139,9 +139,9 @@
 							&nbsp;&nbsp;&nbsp;
 							<button type="button" class="btn btn-info btn-sm" onclick="cfnOpenPostFindPopup();">우편번호찾기</button>
 							<br>
-							<input type="text" name="bizBaseAddr" class="w300" required="required" data-valid-name="사업장주소" readonly="readonly"/>
+							<input type="text" name="bizBaseAddr" class="w300" maxlength="200" required="required" data-valid-name="사업장주소" readonly="readonly"/>
 							-
-							<input type="text" name="bizDtlAddr" class="w300" required="required" data-valid-name="사업장상세주소"/>
+							<input type="text" name="bizDtlAddr" class="w300" maxlength="200"/>
 						</td>
 						<th>홈페이지URL</th>
 						<td colspan="3">
@@ -182,7 +182,7 @@
 					<tr>
 						<th>정산일<i class="required" title="필수"></i></th>
 						<td>
-							매일&nbsp;<input type="text" name="settleDay" class="w100 aR" maxlength="2" required="required" data-valid-type="numeric" data-valid-name="정산일"/>일
+							매일&nbsp;<input type="text" name="settleDay" class="w100 aR" maxlength="2" data-valid-type="numeric"/>일
 						</td>
 						<th>거래은행</th>
 						<td>
@@ -235,7 +235,7 @@
 	let bankList = gagajf.convertToArray([[${bankList}]]);
 
 	let columnDefs = [
-		{headerName: "업체코드", field: "supplyCompCd", width: 100, cellClass: 'text-center' },
+		{ headerName: "업체코드", field: "supplyCompCd", width: 100, cellClass: 'text-center' },
 		{
 			headerName: "업체명", field: "supplyCompNm", width: 150, cellClass: 'text-center',
 			cellRenderer: function(params) {
@@ -246,22 +246,22 @@
 			headerName: "사업자구분", field: "bizGb", width: 100, cellClass: 'text-center',
 			valueGetter: function (params) { return params.data.bizGb == 'C' ? '법인' : '개인'; }
 		},
-		{headerName: "사업장자록번호", field: "bizNo", width: 120, cellClass: 'text-center' },
-		{headerName: "업종", field: "bizKind", width: 200 },
-		{headerName: "업태", field: "bizType", width: 200 },
+		{ headerName: "사업장자록번호", field: "bizNo", width: 120, cellClass: 'text-center' },
+		{ headerName: "업종", field: "bizKind", width: 200, cellClass: 'text-center' },
+		{ headerName: "업태", field: "bizType", width: 200, cellClass: 'text-center' },
 		{
 			headerName: "입점상태", field: "supplyStat", width: 100, cellClass: 'text-center',
 			valueGetter: function (params) {
 				return gagaAgGrid.lookupValue(supplyStatList, params.data.supplyStat);
 			}
 		},
-		{headerName: "대표자명", field: "ownerNm", width: 100, cellClass: 'text-center' },
-		{headerName: "우편번호", field: "bizZipcode", width: 80, cellClass: 'text-center' },
-		{headerName: "기본주소", field: "bizBaseAddr", width: 250 },
-		{headerName: "상세주소", field: "bizDtlAddr", width: 150 },
-		{headerName: "대표전화번호", field: "mainTelno", width: 120, cellClass: 'text-center' },
-		{headerName: "대표팩스번호", field: "mainFaxno", width: 120, cellClass: 'text-center' },
-		{headerName: "홈페이지URL", field: "homepageUrl", width: 200 },
+		{ headerName: "대표자명", field: "ownerNm", width: 100, cellClass: 'text-center' },
+		{ headerName: "우편번호", field: "bizZipcode", width: 80, cellClass: 'text-center' },
+		{ headerName: "기본주소", field: "bizBaseAddr", width: 250 },
+		{ headerName: "상세주소", field: "bizDtlAddr", width: 150 },
+		{ headerName: "대표전화번호", field: "mainTelno", width: 120, cellClass: 'text-center' },
+		{ headerName: "대표팩스번호", field: "mainFaxno", width: 120, cellClass: 'text-center' },
+		{ headerName: "홈페이지URL", field: "homepageUrl", width: 200 },
 		{
 			headerName: "유통구분", field: "distributionGb", width: 100, cellClass: 'text-center',
 			valueGetter: function (params) {
@@ -286,20 +286,20 @@
 				return params.data.sellFeeRate + '%';
 			}
 		},
-		{headerName: "정산일(매월)", field: "settleDay", width: 100, cellClass: 'text-center' },
+		{ headerName: "정산일(매월)", field: "settleDay", width: 100, cellClass: 'text-center' },
 		{
 			headerName: "은행명", field: "bankCd", width: 150, cellClass: 'text-center',
 			valueGetter: function (params) {
 				return gagaAgGrid.lookupValue(bankList, params.data.bankCd);
 			}
 		},
-		{headerName: "계좌번호", field: "accountNo", width: 150, cellClass: 'text-center' },
-		{headerName: "예금주명", field: "depositorNm", width: 100, cellClass: 'text-center' },
+		{ headerName: "계좌번호", field: "accountNo", width: 150, cellClass: 'text-center' },
+		{ headerName: "예금주명", field: "depositorNm", width: 100, cellClass: 'text-center' },
 		{
 			headerName: "사용여부", field: "useYn", width: 100, cellClass: 'text-center',
 			valueGetter: function (params) { return params.data.useYn == 'Y' ? 'Yes' : 'No'; }
 		},
-		{headerName: "비고", field: "remarks", width: 150, hide: true }
+		{ headerName: "비고", field: "remarks", width: 150, hide: true }
 	];
 
 	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
@@ -329,7 +329,7 @@
 		$('#detailForm input[name=settleDay]').val(event.data.settleDay);
 		$('#detailForm input[name=minOrdAmt]').val(Number(event.data.minOrdAmt).addComma());
 		$('#detailForm input[name=delvFee]').val(Number(event.data.delvFee).addComma());
-		$('#detailForm select[name=bankNm]').val(event.data.bankNm);
+		$('#detailForm select[name=bankCd]').val(event.data.bankCd);
 		$('#detailForm input[name=accountNo]').val(event.data.accountNo);
 		$('#detailForm input[name=depositorNm]').val(event.data.depositorNm);
 		$('#detailForm textarea[name=remarks]').val(event.data.remarks);