Explorar el Código

배송업체관리 추가

gagamel hace 5 años
padre
commit
0a54bd1743

+ 25 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaBusinessDao.java

@@ -6,6 +6,7 @@ import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Aflink;
 import com.style24.persistence.domain.DeliveryLoc;
 import com.style24.persistence.domain.SellStore;
+import com.style24.persistence.domain.ShipCompany;
 import com.style24.persistence.domain.SupplyCompany;
 
 /**
@@ -101,4 +102,28 @@ public interface TsaBusinessDao {
 	 */
 	void deleteAflink(Aflink aflink);
 
+	/**
+	 * 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	Collection<ShipCompany> getShipCompanyList();
+
+	/**
+	 * 배송업체 저장
+	 * @param shipComp - 배송업체 정보
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	void saveShipCompany(ShipCompany shipComp);
+
+	/**
+	 * 배송업체 삭제
+	 * @param shipComp - 배송업체 정보
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	void deleteShipCompany(ShipCompany shipComp);
+
 }

+ 42 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaBusinessService.java

@@ -13,6 +13,7 @@ import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.Aflink;
 import com.style24.persistence.domain.DeliveryLoc;
 import com.style24.persistence.domain.SellStore;
+import com.style24.persistence.domain.ShipCompany;
 import com.style24.persistence.domain.SupplyCompany;
 
 import lombok.extern.slf4j.Slf4j;
@@ -150,4 +151,45 @@ public class TsaBusinessService {
 		}
 	}
 
+	/**
+	 * 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	public Collection<ShipCompany> getShipCompanyList() {
+		return businessDao.getShipCompanyList();
+	}
+
+	/**
+	 * 배송업체 목록 저장
+	 * @param shipCompList - 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void saveShipCompanyList(Collection<ShipCompany> shipCompList) {
+		for (ShipCompany shipComp : shipCompList) {
+			shipComp.setRegNo(TsaSession.getInfo().getUserNo());
+			shipComp.setUpdNo(TsaSession.getInfo().getUserNo());
+			businessDao.saveShipCompany(shipComp);
+		}
+	}
+
+	/**
+	 * 배송업체 목록 삭제
+	 * @param shipCompList - 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@Transactional("shopTxnManager")
+	public void deleteShipCompanyList(Collection<ShipCompany> shipCompList) {
+		for (ShipCompany shipComp : shipCompList) {
+			shipComp.setUpdNo(TsaSession.getInfo().getUserNo());
+			businessDao.deleteShipCompany(shipComp);
+		}
+	}
+
 }

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

@@ -20,6 +20,7 @@ import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.Aflink;
 import com.style24.persistence.domain.DeliveryLoc;
 import com.style24.persistence.domain.SellStore;
+import com.style24.persistence.domain.ShipCompany;
 import com.style24.persistence.domain.SupplyCompany;
 
 import lombok.extern.slf4j.Slf4j;
@@ -268,4 +269,67 @@ public class TsaBusinessController extends TsaBaseController {
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
 
+	/**
+	 * 배송업체관리 화면
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@GetMapping("/ship/company/form")
+	public ModelAndView deliveryCompanyForm() {
+		ModelAndView mav = new ModelAndView();
+
+		mav.setViewName("business/ShipCompanyForm");
+
+		return mav;
+	}
+
+	/**
+	 * 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@GetMapping("/ship/company/list")
+	@ResponseBody
+	public Collection<ShipCompany> getShipCompanyList() {
+		return businessService.getShipCompanyList();
+	}
+
+	/**
+	 * 배송업체 목록 저장
+	 * @param shipCompList - 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@PostMapping("/ship/company/list/save")
+	@ResponseBody
+	public GagaResponse saveShipCompanyList(@RequestBody Collection<ShipCompany> shipCompList) {
+		if (shipCompList == null || shipCompList.isEmpty()) {
+			throw new IllegalStateException(message.getMessage("FAIL_1001"));
+		}
+
+		businessService.saveShipCompanyList(shipCompList);
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
+	/**
+	 * 배송업체 목록 삭제
+	 * @param shipCompList - 배송업체 목록
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 20
+	 */
+	@PostMapping("/ship/company/list/delete")
+	@ResponseBody
+	public GagaResponse deleteShipCompanyList(@RequestBody Collection<ShipCompany> shipCompList) {
+		if (shipCompList == null || shipCompList.isEmpty()) {
+			throw new IllegalStateException(message.getMessage("FAIL_1004"));
+		}
+
+		businessService.deleteShipCompanyList(shipCompList);
+		return super.ok(message.getMessage("SUCC_0003"));
+	}
+
 }

+ 22 - 0
style24.admin/src/main/java/com/style24/persistence/domain/ShipCompany.java

@@ -0,0 +1,22 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TsaBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 배송업체 Domain
+ *
+ * @author gagamel
+ * @since 2020. 10. 20
+ */
+@SuppressWarnings("serial")
+@Data
+public class ShipCompany extends TsaBaseDomain {
+
+	private String shipCompCd;	// 배송업체코드
+	private String shipCompNm;	// 배송업체명
+	private String trackingUrl;	// 배송추적URL
+	private String useYn;		// 사용여부
+
+}

+ 58 - 3
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -323,7 +323,8 @@
 	<insert id="saveSellStore" parameterType="SellStore">
 		/* TsaBusiness.saveSellStore */
 		INSERT INTO TB_SELL_STORE (
-		       SELL_STORE_CD
+		       SUPPLY_COMP_CD
+		     , SELL_STORE_CD
 		     , SELL_STORE_NM
 		     , USE_YN
 		     , REG_NO
@@ -332,7 +333,8 @@
 		     , UPD_DT
 		)
 		VALUES (
-		       #{sellStoreCd}
+		       #{supplyCompCd}
+		     , #{sellStoreCd}
 		     , #{sellStoreNm}
 		     , #{useYn}
 		     , #{regNo}
@@ -341,7 +343,8 @@
 		     , NOW()
 		)
 		ON DUPLICATE KEY UPDATE
-		       SELL_STORE_NM = #{sellStoreNm}
+		       SELL_STORE_CD = #{sellStoreCd}
+		     , SELL_STORE_NM = #{sellStoreNm}
 		     , USE_YN = #{useYn}
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()
@@ -405,5 +408,57 @@
 		     , UPD_DT = NOW()
 		WHERE  AF_LINK_CD = #{afLinkCd}
 	</update>
+	
+	<!-- 배송업체관리 목록 -->
+	<select id="getShipCompanyList" resultType="ShipCompany">
+		/* TsaBusiness.getShipCompanyList */
+		SELECT SHIP_COMP_CD
+		     , SHIP_COMP_NM
+		     , TRACKING_URL
+		     , USE_YN
+		FROM   TB_SHIP_COMPANY
+		ORDER  BY SHIP_COMP_CD
+	</select>
+
+	<!-- 배송업체관리 저장 -->
+	<insert id="saveShipCompany" parameterType="ShipCompany">
+		/* TsaBusiness.saveShipCompany */
+		INSERT INTO TB_SHIP_COMPANY (
+		       SHIP_COMP_CD
+		     , SHIP_COMP_NM
+		     , TRACKING_URL
+		     , USE_YN
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{shipCompCd}
+		     , #{shipCompNm}
+		     , #{trackingUrl}
+		     , #{useYn}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+		ON DUPLICATE KEY UPDATE
+		       SHIP_COMP_NM = #{shipCompNm}
+		     , TRACKING_URL = #{trackingUrl}
+		     , USE_YN = #{useYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+	</insert>
+	
+	<!-- 배송업체관리 삭제 -->
+	<update id="deleteShipCompany" parameterType="ShipCompany">
+		/* TsaBusiness.updateShipCompany */
+		UPDATE TB_SHIP_COMPANY
+		SET    USE_YN = 'N'
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  SHIP_COMP_CD=  #{shipCompCd}
+	</update>
 
 </mapper>

+ 172 - 0
style24.admin/src/main/webapp/WEB-INF/views/business/ShipCompanyForm.html

@@ -0,0 +1,172 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : ShipCompanyForm.html
+ * @desc    : 배송업체관리 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.10.20   gagamel     최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+		
+		<!-- 검색조건 영역 -->
+		<div class="panelStyle">
+			<form id="searchForm" name="searchForm" action="#" th:action="@{'/business/ship/company/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+		<!-- 검색조건 영역 -->
+
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<!-- 버튼 배치 영역 -->
+			<ul class="panelBar">
+				<li class="left">
+					<button type="button" class="btn btn-warning btn-lg" id="btnAddRow">행추가</button>
+					<button type="button" class="btn btn-danger btn-lg" id="btnDeleteRow">행삭제</button>
+				</li>
+				<li class="right">
+					<button type="button" class="btn btn-info btn-lg" id="btnSave">저장</button>
+					<button type="button" class="btn btn-default btn-lg" id="btnExcel">엑셀다운로드</button>
+				</li>
+			</ul>
+			<!-- //버튼 배치 영역 -->
+			
+			<div id="gridList" style="width: 100%; height: 570px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	let useYnList = { "Y":"Yes", "N":"No" };
+
+	let columnDefs = [
+		{width: 40, minWidth: 40, cellClass: 'text-center', headerCheckboxSelection: true, checkboxSelection: true, filter: false},
+		{
+			headerName: "배송업체코드", field: "shipCompCd", width: 100, cellClass: 'text-center',
+			editable: function(params) { return params.data.crud == 'C' ? true : false; },
+			cellEditorParams: { required: true },
+		},
+		{
+			headerName: "배송업체명", field: "shipCompNm", width: 150, cellClass: 'text-center',
+			editable: true,
+			cellEditorParams: { required: true },
+		},
+		{headerName: "배송추적URL", field: "trackingUrl", width: 800, editable: true},
+		{
+			headerName: "사용여부", field: "useYn", width: 80, cellClass: 'text-center',
+			editable: true,
+			cellEditor: 'agRichSelectCellEditor',
+			cellEditorParams: { values: gagaAgGrid.extractValues(useYnList), required: true },
+			valueFormatter: function (params) { return gagaAgGrid.lookupValue(useYnList, params.value); },
+			valueParser: function (params) { return gagaAgGrid.lookupKey(useYnList, params.newValue); }
+		}
+	];
+
+	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// 다중 선택
+	gridOptions.rowSelection = 'multiple';
+	
+	// 조회
+	$('#btnSearch').on('click', function() {
+		let actionUrl = $('#searchForm').prop('action') + '?' + $('#searchForm').serialize();
+		
+		// Fetch data
+		gagaAgGrid.fetch(actionUrl, gridOptions);
+	});
+
+	// 행추가
+	$('#btnAddRow').on('click', function() {
+		var data = { };
+		gagaAgGrid.addRowData(gridOptions, data, "shipCompCd");
+	});
+	
+	// 행삭제
+	$('#btnDeleteRow').on('click', function() {
+		var removedData = gagaAgGrid.removeRowData(gridOptions);
+		
+		if (removedData.length == 0) {
+			mcxDialog.alert('선택된 행이 없습니다.');
+			return;
+		}
+		
+		mcxDialog.confirm("삭제하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				// delete 대신 update 처리해야 하므로 다음과 같이 useYn 값을 변환
+				var updatedData = [];
+				
+				$.each(removedData, function(idx, item) {
+					item.useYn = 'N';
+					updatedData.push(item);
+				});
+				
+				var jsonData = JSON.stringify(updatedData);
+				gagajf.ajaxJsonSubmit('/business/ship/company/list/delete', jsonData, function() {
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	});
+	
+	// 저장
+	$("#btnSave").on("click", function() {
+		var changeData = gagaAgGrid.getChangedData(gridOptions);
+
+		if (changeData.length < 1) {
+			mcxDialog.alert('변경된 데이터가 없습니다.');
+			return;
+		}
+
+		// Validation
+		if (!gagaAgGrid.validation(gridOptions, changeData))
+			return;
+
+		mcxDialog.confirm('저장하시겠습니까?', {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function(){
+				var jsonData = JSON.stringify(changeData);
+				gagajf.ajaxJsonSubmit('/business/ship/company/list/save', jsonData, function() {
+					$('#btnSearch').trigger('click');
+				});
+			}
+		});
+	});
+	
+	// 엑셀다운로드
+	$('#btnExcel').on('click', function() {
+		gagaAgGrid.exportToExcel('배송업체 목록', gridOptions);
+	});
+	
+	$(document).ready(function() {
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+	});
+/*]]>*/
+</script>
+
+</html>