gagamel преди 5 години
родител
ревизия
6c6a212ef8

+ 18 - 0
style24.admin/src/main/java/com/style24/admin/biz/dao/TsaSystemDao.java

@@ -5,6 +5,7 @@ import java.util.Collection;
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Alarm;
 import com.style24.persistence.domain.AlarmReceiver;
+import com.style24.persistence.domain.Batch;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.Menu;
 import com.style24.persistence.domain.MenuAccessHst;
@@ -294,4 +295,21 @@ public interface TsaSystemDao {
 	 */
 	void deleteAlarmReceiver(AlarmReceiver alarmReceiver);
 
+	/**
+	 * 배치 목록
+	 * @param batch - 배치 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	Collection<Batch> getBatchList(Batch batch);
+
+	/**
+	 * 배치 생성
+	 * @param batch - 배치 정보
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	void saveBatch(Batch batch);
+
 }

+ 22 - 0
style24.admin/src/main/java/com/style24/admin/biz/service/TsaSystemService.java

@@ -12,6 +12,7 @@ import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.Alarm;
 import com.style24.persistence.domain.AlarmReceiver;
+import com.style24.persistence.domain.Batch;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.Menu;
 import com.style24.persistence.domain.MenuRole;
@@ -494,4 +495,25 @@ public class TsaSystemService {
 		}
 	}
 
+	/**
+	 * 배치 목록
+	 * @param batch - 배치 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	public Collection<Batch> getBatchList(Batch batch) {
+		return systemDao.getBatchList(batch);
+	}
+
+	/**
+	 * 배치 생성
+	 * @param batch - 배치 정보
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	public void saveBatch(Batch batch) {
+		systemDao.saveBatch(batch);
+	}
+
 }

+ 49 - 0
style24.admin/src/main/java/com/style24/admin/biz/web/TsaSystemController.java

@@ -22,6 +22,7 @@ import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.persistence.domain.Alarm;
 import com.style24.persistence.domain.AlarmReceiver;
+import com.style24.persistence.domain.Batch;
 import com.style24.persistence.domain.CommonCode;
 import com.style24.persistence.domain.Menu;
 import com.style24.persistence.domain.SampleFile;
@@ -520,4 +521,52 @@ public class TsaSystemController extends TsaBaseController {
 		return super.ok(message.getMessage("SUCC_0003"));
 	}
 
+	/**
+	 * 배치관리 화면
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	@GetMapping("/batch/form")
+	public ModelAndView batchForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 업무구분
+		mav.addObject("bizGbList", rendererService.getTopMenuList(""));
+
+		mav.setViewName("system/BatchForm");
+
+		return mav;
+	}
+
+	/**
+	 * 배치 목록
+	 * @param batch - 배치 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	@PostMapping("/batch/list")
+	@ResponseBody
+	public Collection<Batch> getBatchList(@RequestBody Batch batch) {
+		return systemService.getBatchList(batch);
+	}
+
+	/**
+	 * 배치 저장
+	 * @param batch - 배치 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 12. 2
+	 */
+	@PostMapping("/batch/save")
+	@ResponseBody
+	public GagaResponse saveBatch(@RequestBody Batch batch) {
+		batch.setRegNo(TsaSession.getInfo().getUserNo());
+		batch.setUpdNo(TsaSession.getInfo().getUserNo());
+		systemService.saveBatch(batch);
+
+		return super.ok(message.getMessage("SUCC_0001"));
+	}
+
 }

+ 28 - 0
style24.admin/src/main/java/com/style24/persistence/domain/Batch.java

@@ -0,0 +1,28 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 배치 Domain
+ *
+ * @author gagamel
+ * @since 2020. 12. 2
+ */
+@SuppressWarnings("serial")
+@Data
+public class Batch extends TscBaseDomain {
+
+	private String batchId;		// 배치ID
+	private String batchNm;		// 배치명
+	private String bizGb;		// 업무구분
+	private String batchFrq;	// 배치주기
+	private String batchDesc;	// 배치설명
+	private String useYn;		// 사용여부
+
+	// 배치 목록 검색조건
+	private String searchGb;
+	private String searchTxt;
+
+}

+ 61 - 0
style24.admin/src/main/java/com/style24/persistence/mybatis/shop/TsaSystem.xml

@@ -746,5 +746,66 @@
 		WHERE  ALARM_ID = #{alarmId}
 		AND    CELL_PHNNO = #{cellPhnno}
 	</delete>
+	
+	<!-- 배치 목록 -->
+	<select id="getBatchList" parameterType="Batch" resultType="Batch">
+		/* TsaSystem.getBatchList */
+		SELECT BATCH_ID
+		     , BATCH_NM
+		     , BIZ_GB
+		     , BATCH_FRQ
+		     , BATCH_DESC
+		     , USE_YN
+		FROM   TB_BATCH
+		WHERE  1 = 1
+		<if test="bizGb != null and bizGb != ''">
+		AND    BIZ_GB = #{bizGb}
+		</if>
+		<choose>
+		    <when test="searchGb == 'batchId'">
+		AND    LOWER(BATCH_ID) LIKE CONCAT('%',LOWER(#{searchTxt}),'%')
+		    </when>
+		    <when test="searchGb == 'batchNm'">
+		AND    LOWER(BATCH_NM) LIKE CONCAT('%',LOWER(#{searchTxt}),'%')
+		    </when>
+		</choose>
+	</select>
+	
+	<!-- 배치 생성 -->
+	<insert id="saveBatch" parameterType="Batch">
+		/* TsaSystem.saveBatch */
+		INSERT INTO TB_BATCH (
+		       BATCH_ID
+		     , BATCH_NM
+		     , BIZ_GB
+		     , BATCH_FRQ
+		     , BATCH_DESC
+		     , USE_YN
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		)
+		VALUES (
+		       #{batchId}
+		     , #{batchNm}
+		     , #{bizGb}
+		     , #{batchFrq}
+		     , #{batchDesc}
+		     , #{useYn}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+		ON DUPLICATE KEY UPDATE
+		       BATCH_NM = #{batchNm}
+		     , BIZ_GB = #{bizGb}
+		     , BATCH_FRQ = #{batchFrq}
+		     , BATCH_DESC = #{batchDesc}
+		     , USE_YN = #{useYn}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+	</insert>
 
 </mapper>

+ 244 - 0
style24.admin/src/main/webapp/WEB-INF/views/system/BatchForm.html

@@ -0,0 +1,244 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : BatchForm.html
+ * @desc    : 배치관리 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2020.12.02   gagamel     최초 작성
+ *******************************************************************************
+ -->
+	<div id="main">
+		<!-- 메인타이틀 영역 -->
+		<div class="main-title">
+		</div>
+		<!-- //메인타이틀 영역 -->
+		
+		<!-- 메뉴 설명 -->
+		<div class="infoBox menu-desc">
+		</div>
+		<!-- //메뉴 설명 -->
+
+		<!-- 검색조건 영역 -->
+		<div class="panelStyle">
+			<!-- Search -->
+			<form id="searchForm" name="searchForm" action="#" th:action="@{'/system/batch/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:40%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>업무구분</th>
+						<td>
+							<select name="bizGb" class="w150">
+								<option value="">[전체]</option>
+								<option th:if="${bizGbList}" th:each="oneData, status : ${bizGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>구분</th>
+						<td>
+							<select name="searchGb">
+								<option value="">[선택]</option>
+								<option value="batchId">배치ID</option>
+								<option value="batchNm">배치명</option>
+							</select>
+							<input type="text" class="w300" name="searchTxt" placeholder="" maxlength="50"/>
+						</td>
+					</tr>
+				</table>
+				
+				<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">
+			<div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+		
+		<!-- 등록/수정 영역 -->
+		<div class="panelStyle">
+			<form id="detailForm" name="detailForm" action="#" th:action="@{'/system/batch/save'}">
+				<input type="hidden" name="mode" value="N"/>
+				
+				<table class="frmStyle" aria-describedby="등록/수정 폼">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:40%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>배치ID<em class="required" title="필수"></em></th>
+						<td>
+							<input type="text" name="batchId" class="w300" placeholder="" required="required" maxlength="50" data-valid-name="배치ID"/>
+						</td>
+						<th>배치명<em class="required" title="필수"></em></th>
+						<td>
+							<input type="text" name="batchNm" placeholder="" maxlength="100" required="required" data-valid-name="배치명"/>
+						</td>
+					</tr>
+					<tr>
+						<th>업무구분<em class="required" title="필수"></em></th>
+						<td>
+							<select name="bizGb" class="w150" required="required" data-valid-name="업무구분">
+								<option value="">[선택]</option>
+								<option th:if="${bizGbList}" th:each="oneData, status : ${bizGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
+							</select>
+						</td>
+						<th>배치주기<em class="required" title="필수"></em></th>
+						<td>
+							<select name="batchFrq" required="required" data-valid-name="배치주기">
+								<option value="">[선택]</option>
+								<option value="H">[H] 시간배치</option>
+								<option value="D">[D] 일배치</option>
+								<option value="M">[M] 월배치</option>
+								<option value="Y">[Y] 연배치</option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th>배치설명</th>
+						<td colspan="3">
+							<textarea class="textareaR4" name="batchDesc"></textarea>
+						</td>
+					</tr>
+					<tr>
+						<th>사용여부<em class="required" title="필수"></em></th>
+						<td colspan="3">
+							<input type="hidden" name="useYn"/>
+							<label class="chkBox"><input type="checkbox" name="chkUseYn" value="Y" checked="checked" readonly="readonly"/>사용</label>
+						</td>
+					</tr>
+				</table>
+
+				<ul class="panelBar">
+					<li class="right">
+						<button type="button" class="btn btn-info btn-lg" id="btnNew">신규</button>
+						<button type="button" class="btn btn-success btn-lg" id="btnSave">저장</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+		<!-- //등록/수정 영역 -->
+	</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	var bizGbList = gagajf.convertToArray([[${bizGbList}]]);
+	
+	// specify the columns
+	var columnDefs = [
+		{
+			headerName: "배치ID", field: "batchId", width: 200,
+			cellRenderer: function(params) {
+				return '<a href="javascript:void(0);">' + params.value + '</a>';
+			}
+		},
+		{headerName: "배치명", field: "batchNm", width: 250},
+		{
+			headerName: "업무구분", field: "bizGb", width: 100, cellClass: 'text-center',
+			cellRenderer: function (params) { return gagaAgGrid.lookupValue(bizGbList, params.value); }
+		},
+		{
+			headerName: "배치주기", field: "batchFrq", width: 100, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				let batchFrqNm = '시간배치';
+				if (params.value == 'D') batchFrqNm = '일배치';
+				else if (params.value == 'M') batchFrqNm = '월배치';
+				else if (params.value == 'Y') batchFrqNm = '연배치';
+				return batchFrqNm;
+			}
+		},
+		{headerName: "배치설명", field: "batchDesc", width: 400, hide: true},
+		{headerName: "사용여부", field: "useYn", width: 100, cellClass: 'text-center'}
+	];
+
+	// Get GridOptions
+	var gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+	// Cell Click
+	gridOptions.onCellClicked = function(event) {
+		if (event.colDef.field != 'batchId')
+			return;
+
+		$('#detailForm input[name=mode]').val('U');
+		$('#detailForm input[name=batchId]').val(event.data.batchId);
+		$('#detailForm input[name=batchId]').attr('readonly', true);
+		$('#detailForm input[name=batchNm]').val(event.data.batchNm);
+		$('#detailForm select[name=bizGb]').val(event.data.bizGb);
+		$('#detailForm select[name=batchFrq]').val(event.data.batchFrq);
+		$('#detailForm textarea[name=batchDesc]').val(event.data.batchDesc);
+
+		if (event.data.useYn == 'Y') {
+			$("#detailForm input:checkbox[name=chkUseYn]").prop('checked', true);
+			$("#detailForm input:checkbox[name=chkUseYn]").parent().addClass('checked');
+		} else {
+			$("#detailForm input:checkbox[name=chkUseYn]").prop('checked', false);
+			$("#detailForm input:checkbox[name=chkUseYn]").parent().removeClass('checked');
+		}
+		
+		$('#detailForm input:checkbox[name=chkUseYn]').attr('readonly', false);
+	}
+
+	// 조회
+	$('#btnSearch').on('click', function() {
+		// Fetch data
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
+	});
+
+	// 신규
+	$('#btnNew').on('click', function() {
+		$('#detailForm')[0].reset();
+		$('#detailForm input[name=mode]').val('N');
+		$('#detailForm input[name=batchId]').attr('readonly', false);
+		$('#detailForm input:checkbox[name=chkUseYn]').prop('checked', true);
+		$('#detailForm input:checkbox[name=chkUseYn]').attr('readonly', true);
+		$('#detailForm input[name=batchId]').focus();
+	});
+
+	// 저장 처리
+	$('#btnSave').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation('#detailForm'))
+			return;
+
+		$('#detailForm input[name=useYn]').val($('#detailForm input:checkbox[name=chkUseYn]').is(":checked") ? 'Y' : 'N');
+
+		mcxDialog.confirm("저장하시겠습니까?", {
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				gagajf.ajaxFormSubmit($('#detailForm').prop('action')
+						, $('#detailForm')
+						, function() {
+							$('#btnNew').trigger('click');
+							$('#btnSearch').trigger('click');
+						}
+				);
+			}
+		});
+	});
+
+	$(document).ready(function() {
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+	});
+/*]]>*/
+</script>
+
+</html>