Bladeren bron

2021-09-25 토 1.베스트 상품 화면 추가

skyhopes 4 jaren geleden
bovenliggende
commit
7ffd2b09f7

+ 10 - 0
src/main/java/com/style24/admin/biz/dao/TsaStatisticsDao.java

@@ -2,6 +2,7 @@ package com.style24.admin.biz.dao;
 
 import java.util.Collection;
 
+import com.gagaframework.web.parameter.GagaMap;
 import com.style24.core.support.annotation.ShopDs;
 import com.style24.persistence.domain.Statistics;
 
@@ -97,4 +98,13 @@ public interface TsaStatisticsDao {
 	 */
 	Collection<Statistics> getClaimOrderList(Statistics statistics);
 
+	/**
+	 * 베스트 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 25.
+	 */
+	Collection<Statistics> getBestOrderList(Statistics statistics);
+	Collection<GagaMap> getBestOrderListMap(Statistics statistics);
+
 }

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

@@ -3095,7 +3095,7 @@ public class TsaGoodsService {
 			}
 			goods.setChDataYn("Y");
 		}
-		
+
 		// 상품상태
 		if (StringUtils.isBlank(goodsMass.getGoodsStatCd())) {
 			goods.setGoodsRegMsg("상품상태 오류");
@@ -3115,14 +3115,14 @@ public class TsaGoodsService {
 			}
 			goods.setChDataYn("Y");
 		}
-		
+
 		//판매가
 		if (StringUtils.isBlank(goodsMass.getCurrPrice())) {
 			goods.setGoodsRegMsg("판매가 오류");
 			goods.setGoodsStat("10");
 			return goods;
 		}
-		
+
 		int chkCurrPrice = 0;
 		int chkListPrice = 0;
 		if (UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice().trim())) {
@@ -3157,14 +3157,14 @@ public class TsaGoodsService {
 			}
 			chkListPrice = Integer.parseInt(GagaStringUtil.replace(goodsMass.getListPrice().trim(), ",", ""));
 		}
-		
+
 		if( !UPDATE_NO_PATTERN.equals(goodsMass.getListPrice().trim()) || !UPDATE_NO_PATTERN.equals(goodsMass.getCurrPrice().trim()) ) {
 			if (chkCurrPrice > chkListPrice) {
 				goods.setGoodsRegMsg("판매가 오류(정상가보다 높음)");
 				goods.setGoodsStat("10");
 				return goods;
 			}
-			
+
 			//금액 변경시
 			goods.setListPrice(chkListPrice); // 정상가
 			goods.setCurrPrice(chkCurrPrice); // 판매가
@@ -3203,10 +3203,10 @@ public class TsaGoodsService {
 				goods.setGoodsStat("10");
 				return goods;
 			}
-			
+
 			goods.setSellFeeRate(sellFeeRate); // 판매수수료율
 			goods.setChDataYn("Y");
-		
+
 
 		}
 

+ 85 - 0
src/main/java/com/style24/admin/biz/service/TsaStatisticsService.java

@@ -1,11 +1,23 @@
 package com.style24.admin.biz.service;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
+import java.util.Map;
 
+import org.apache.catalina.mapper.Mapper;
+import org.apache.commons.collections4.map.LinkedMap;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gagaframework.excel.GagaExcelUtil;
+import com.gagaframework.excel.env.GagaExcelConstants;
+import com.gagaframework.web.parameter.GagaMap;
 import com.style24.admin.biz.dao.TsaStatisticsDao;
+import com.style24.admin.support.env.TsaConstants;
 import com.style24.persistence.domain.Statistics;
 
 import lombok.extern.slf4j.Slf4j;
@@ -23,6 +35,12 @@ public class TsaStatisticsService {
 	@Autowired
 	private TsaStatisticsDao statisticsDao;
 
+	@Autowired
+	private Environment env;
+
+	@Autowired
+	private ObjectMapper mapper;
+
 	/**
 	 * 일일거래내역
 	 * @param statistics - 통계 정보
@@ -126,4 +144,71 @@ public class TsaStatisticsService {
 		return statisticsDao.getClaimOrderList(statistics);
 	}
 
+	/**
+	 * 베스트 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 25.
+	 */
+	public Collection<Statistics> getBestOrderList(Statistics statistics) {
+		return statisticsDao.getBestOrderList(statistics);
+	}
+
+	/**
+	 * 베스트 주문 엑셀다운로드
+	 * author: 이명철
+	 * return: void
+	 * since: 2021. 9. 25.
+	 */
+	public void getBestGoodsExcelList(Statistics statistics, String excelFilenameWithPath) {
+
+		List<String> colInfoList = new ArrayList<String>();
+		String[] listTitles;
+		String[] cellNames;
+		String[] cellTypes;
+
+		if ("Y".equals(statistics.getImageViewYn())) {
+//			colInfoList.add("이미지|SYS_IMG_NM|"+ GagaExcelConstants.CellType.IMAGE.name());
+		}
+		colInfoList.add("브랜드명|BRAND_ENM|"+ GagaExcelConstants.CellType.CHAR_CENTER.name());
+		colInfoList.add("상품번호|GOODS_CD|"+ GagaExcelConstants.CellType.CHAR_CENTER.name());
+		colInfoList.add("상품명|GOODS_NM|"+ GagaExcelConstants.CellType.CHAR_LEFT.name());
+		colInfoList.add("구분|DISTRIBUTION_GB|"+ GagaExcelConstants.CellType.CHAR_CENTER.name());
+		colInfoList.add("판매가|CURR_PRICE|"+ GagaExcelConstants.CellType.CHAR_RIGHT.name());
+		colInfoList.add("판매수|SELL_QTY|"+ GagaExcelConstants.CellType.CHAR_RIGHT.name());
+		colInfoList.add("매출액|TOT_AMT|"+ GagaExcelConstants.CellType.CHAR_RIGHT.name());
+		colInfoList.add("현재고수량|STOCK_QTY|"+ GagaExcelConstants.CellType.CHAR_RIGHT.name());
+
+		listTitles = new String[colInfoList.size()];
+		cellNames = new String[colInfoList.size()];
+		cellTypes = new String[colInfoList.size()];
+
+		String[] temp;
+		int i = 0;
+		for (String colInfo : colInfoList) {
+			temp = colInfo.split("\\|");
+			listTitles[i] = temp[0];
+			cellNames[i] = temp[1];
+			cellTypes[i] = temp[2];
+			i++;
+		}
+
+		String targetPath = env.getProperty("upload.goods.view");
+		Collection<GagaMap> bestOrderList = statisticsDao.getBestOrderListMap(statistics); // map형식으로 조회
+		if (bestOrderList != null && !bestOrderList.isEmpty()) {
+			for (GagaMap gagaMap : bestOrderList) {
+				if (!StringUtils.isBlank(gagaMap.get("SYS_IMG_NM").toString())) {
+					gagaMap.set("SYS_IMG_NM", targetPath + '/' + gagaMap.get("SYS_IMG_NM").toString() + "?RS=60");
+				}
+			}
+		}
+
+		try {
+			GagaExcelUtil.createExcel(excelFilenameWithPath, bestOrderList, "주문 정보", listTitles, cellNames, cellTypes, TsaConstants.EXCEL_FOOTER_TITLE);
+		} catch (Exception e) {
+			throw new IllegalStateException(e);
+		}
+
+	}
+
 }

+ 81 - 27
src/main/java/com/style24/admin/biz/web/TsaStatisticsController.java

@@ -2,9 +2,13 @@ package com.style24.admin.biz.web;
 
 import java.util.Collection;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -14,10 +18,15 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gagaframework.web.util.GagaDateUtil;
+import com.gagaframework.web.util.GagaFileUtil;
 import com.style24.admin.biz.service.TsaRendererService;
 import com.style24.admin.biz.service.TsaStatisticsService;
 import com.style24.admin.support.controller.TsaBaseController;
+import com.style24.admin.support.security.session.TsaSession;
 import com.style24.core.support.message.TscMessageByLocale;
+import com.style24.persistence.TscPageRequest;
+import com.style24.persistence.domain.GoodsSearch;
 import com.style24.persistence.domain.Statistics;
 
 import lombok.extern.slf4j.Slf4j;
@@ -202,10 +211,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getGoodsOrderList(statistics);
 	}
 
@@ -261,10 +266,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getExtmallOrderList(statistics);
 	}
 
@@ -319,10 +320,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getChannelOrderList(statistics);
 	}
 
@@ -377,10 +374,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getBrandOrderList(statistics);
 	}
 
@@ -436,10 +429,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getHourlyOrderList(statistics);
 	}
 
@@ -495,10 +484,6 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
-		}
-
 		return statisticsService.getCategoryOrderList(statistics);
 	}
 
@@ -565,11 +550,80 @@ public class TsaStatisticsController extends TsaBaseController {
 			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
 		}
 
-		if (!StringUtils.isBlank(statistics.getFormalGb())) {
-			statistics.setMultiFrontGb(statistics.getExtmallIdList().split(","));
+		return statisticsService.getClaimOrderList(statistics);
+	}
+
+
+	/**
+	 * 베스트 주문 화면
+	 * author: 이명철
+	 * return: ModelAndView
+	 * since: 2021. 9. 25.
+	 */
+	@GetMapping("/best/trading/form")
+	public ModelAndView bestTradingForm() {
+		ModelAndView mav = new ModelAndView();
+
+		// 정상이월구분
+		mav.addObject("formalGbList", rendererService.getAvailCommonCodeList("G009"));
+		mav.addObject("sexGbList", rendererService.getAvailCommonCodeList("G007"));
+
+		mav.setViewName("statistics/BestTradingForm");
+		return mav;
+	}
+
+	/**
+	 * 베스트 주문 조회
+	 * author: 이명철
+	 * return: Collection<Statistics>
+	 * since: 2021. 9. 25.
+	 */
+	@PostMapping("/best/order/list")
+	@ResponseBody
+	public Collection<Statistics> getBestOrderList(@RequestBody Statistics statistics) {
+
+		if (!StringUtils.isBlank(statistics.getExtmallIdList())) {
+			statistics.setMultiExtmallId(statistics.getExtmallIdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getSupplyCompCdList())) {
+			statistics.setMultiSupplyCompCd(statistics.getSupplyCompCdList().split(","));
 		}
 
-		return statisticsService.getClaimOrderList(statistics);
+		if (!StringUtils.isBlank(statistics.getAfLinkCdList())) {
+			statistics.setMultiAfLinkCd(statistics.getAfLinkCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getBrandCdList())) {
+			statistics.setMultiBrandCd(statistics.getBrandCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getItemkindCdList())) {
+			statistics.setMultiItemkindCd(statistics.getItemkindCdList().split(","));
+		}
+
+		if (!StringUtils.isBlank(statistics.getGoodsCd())) {
+			statistics.setMultiGoodsCd(statistics.getGoodsCd().split(System.lineSeparator()));
+		}
+
+		return statisticsService.getBestOrderList(statistics);
+	}
+
+
+	/**
+	 * 베스트상품 엑셀 다운로드
+	 * author: 이명철
+	 * return: ResponseEntity<InputStreamResource>
+	 * since: 2021. 9. 25.
+	 */
+	@GetMapping("/best/excel/down")
+	public ResponseEntity<InputStreamResource> downloadBestGoodsOrderList(HttpServletRequest request, Statistics statistics) throws Exception {
+		String excelfileName = "베스트상품 주문정보 " + GagaDateUtil.getTodayDateTime() + ".xlsx";
+		String excelFilenameWithPath = GagaFileUtil.getConcatenationPath(env.getProperty("download.path"), "excel", excelfileName);
+
+		statisticsService.getBestGoodsExcelList(statistics, excelFilenameWithPath);
+
+		return GagaFileUtil.writeFile(request, excelFilenameWithPath);
 	}
 
 }

+ 12 - 0
src/main/java/com/style24/persistence/domain/Statistics.java

@@ -91,6 +91,12 @@ public class Statistics extends TscBaseDomain {
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] dtGb;	// 날짜구분
 
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiSexGb;	// 성별구분
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiAgeGb;	// 나이구분
+
 	// 일일거래내역
 	private Integer ordNo;				// 주문번호
 	private Integer ordDtlNo;			// 주문상세번호
@@ -164,6 +170,12 @@ public class Statistics extends TscBaseDomain {
 	private long rtnAmt;      //반품금액
 	private int chgQty;       //교환수량
 	private long chgDelvFee;  //교환금액
+	private int currPrice;    //판매가
+
+	private String imageViewYn;
+	private String sysImgUrl;
+	private String sysImgNm;
+	private boolean isMap;
 
 
 

+ 71 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaStatistics.xml

@@ -1031,4 +1031,75 @@
 		GROUP BY DATE_FORMAT(DAY, '%m-%d')
 	</select>
 
+	<!-- 베스트 상품 조회 -->
+	<sql id="getBestOrderListSql">
+        /* TsaStatistics.getBestOrderList */
+        SELECT
+            (SELECT SUBSTRING_INDEX(SYS_IMG_NM , '/', 2) FROM TB_GOODS_IMG X WHERE X.GOODS_CD = B.GOODS_CD AND X.DEFAULT_IMG_YN = 'Y' LIMIT 1) AS SYS_IMG_NM /*상품이미지*/
+            , C.BRAND_ENM /*브랜드명*/
+            , A.GOODS_CD /*상품코드*/
+            , B.GOODS_NM /*상품명*/
+            , CASE WHEN A.DISTRIBUTION_GB = 'WMS' THEN '위탁' ELSE '입점' END AS DISTRIBUTION_GB /*구분*/
+            , B.CURR_PRICE /*판매가*/
+            , SUM(A.SELL_QTY - A.CNCL_QTY - A.RTN_QTY) AS SELL_QTY /*판매수*/
+            , SUM(A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /*매출액*/
+            , SUM(D.STOCK_QTY) AS STOCK_QTY /*현재고수량*/
+        FROM TB_STAT_ORD_DAY A, TB_GOODS B, TB_BRAND C, TB_GOODS_STOCK D
+        WHERE A.GOODS_CD = B.GOODS_CD
+            AND A.BRAND_CD = C.BRAND_CD
+            AND A.GOODS_CD = D.GOODS_CD
+            <![CDATA[
+            /* 직접선택 */
+            AND A.DAY >= DATE_FORMAT(#{startDt}, '%Y%m%d')
+            AND A.DAY <  DATE_ADD(DATE_FORMAT(#{endDt}, '%Y%m%d'), INTERVAL 1 DAY)
+            ]]>
+            <if test="multiFrontGb != null">
+                /* 디바이스 */
+                <foreach collection="multiFrontGb" item="item" index="index"  open="AND A.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiExtmallId != null">
+                /* 제휴몰 */
+                <foreach collection="multiExtmallId" item="item" index="index"  open="AND A.EXTMALL_ID IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiDistributionGb != null">
+                /* 물류구분 */
+                <foreach collection="multiDistributionGb" item="item" index="index"  open="AND A.DISTRIBUTION_GB IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiFormalGb != null">
+                /* 정상/이월구분 */
+                <foreach collection="multiFormalGb" item="item" index="index"  open="AND A.FORMAL_GB IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiSexGb != null">
+                /* 성별구분 */
+                <foreach collection="multiSexGb" item="item" index="index"  open="AND A.SEX_GB IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiAgeGb != null">
+                /* 성별구분 */
+                <foreach collection="multiAgeGb" item="item" index="index"  open="AND A.AGE IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiBrandCd != null">
+                /* 브랜드 */
+                <foreach collection="multiBrandCd" item="item" index="index"  open="AND A.BRAND_CD IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiItemkindCd != null">
+                /* 품목 */
+                <foreach collection="multiItemkindCd" item="item" index="index"  open="AND A.ITEMKIND_CD IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+            <if test="multiAfLinkCd != null">
+                /* 채널 */
+                <foreach collection="multiAfLinkCd" item="item" index="index"  open="AND A.AF_LINK_CD IN (" close=")" separator=",">#{item}</foreach>
+            </if>
+        GROUP BY C.BRAND_ENM, A.GOODS_CD, B.GOODS_NM, A.DISTRIBUTION_GB, B.CURR_PRICE
+        ORDER BY TOT_AMT DESC
+	</sql>
+
+	<!-- 베스트 주문조회 -->
+	<select id="getBestOrderList" parameterType="Statistics" resultType="Statistics">
+		<include refid="getBestOrderListSql"></include>
+	</select>
+	<!-- 베스트 주문조회 -->
+	<select id="getBestOrderListMap" parameterType="Statistics" resultType="paramMap">
+		<include refid="getBestOrderListSql"></include>
+	</select>
+
 </mapper>

+ 402 - 0
src/main/webapp/WEB-INF/views/statistics/BestTradingForm.html

@@ -0,0 +1,402 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org">
+<!--
+ *******************************************************************************
+ * @source  : BestTradingForm.html
+ * @desc    : 베스트주문 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2020 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021-09-25 토   lmc        최초 작성
+ *******************************************************************************
+ -->
+	<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="@{'/statistics/best/order/list'}" onsubmit="$('#btnSearch').trigger('click'); return false;">
+				<input type="hidden" name="dayGb" value="D"/>
+				<input type="hidden" name="imageViewYn" value="Y"/>
+                <a href="javascript:void(0);" id="excelList" style="display: none;"></a>
+
+				<table class="frmStyle" aria-describedby="검색조건">
+					<colgroup>
+						<col style="width:10%;"/>
+						<col style="width:25%;"/>
+						<col style="width:10%;"/>
+						<col/>
+					</colgroup>
+					<tr>
+						<th>기간<i class="required" title="필수" aria-hidden="true"></i></th>
+						<td colspan="3" id="terms"></td>
+					</tr>
+					<tr>
+						<th>디바이스</th>
+						<td>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="P" checked="checked"/>PC웹</label>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="M" checked="checked"/>모바일웹</label>
+							<label class="chkBox checked"><input type="checkbox" name="multiFrontGb" value="A" checked="checked"/>APP</label>
+						</td>
+						<th>제휴몰</th>
+						<td>
+							<input type="text" class="w100" name="extmallIdSearchTxt" id="extmallIdSearchTxt" maxlength="20"/>
+							<button type="button" class="btn icn" onclick="cfnOpenExtmallListPopup('fnSetExtmallInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="extmallIdTxt"></span>
+							<input type="hidden" name="extmallIdList"/>
+						</td>
+					</tr>
+                    <tr>
+                        <th>물류구분</th>
+                        <td>
+                            <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="SCM" checked="checked"/>입점</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiDistributionGb" value="WMS" checked="checked"/>위탁</label>
+                        </td>
+                        <th>정상/이월구분</th>
+                        <td>
+                            <label th:if="${formalGbList}" th:each="oneData, status : ${formalGbList}" class="chkBox checked"><input type="checkbox" name="multiFormalGb" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}" checked="checked"/></label>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>성별</th>
+                        <td>
+                            <label th:if="${sexGbList}" th:each="oneData, status : ${sexGbList}" class="chkBox checked"><input type="checkbox" name="multiSexGb" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}" checked="checked"/></label>
+                        </td>
+                        <th>연령별</th>
+                        <td>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="10" checked="checked"/>10대</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="20" checked="checked"/>20대</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="20" checked="checked"/>30대</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="30" checked="checked"/>40대</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="X" checked="checked"/>기타/미상</label>
+                        </td>
+                    </tr>
+					<tr>
+						<th>브랜드</th>
+						<td>
+							<input type="text" class="w100" name="brandCdSearchTxt" id="brandCdSearchTxt" maxlength="20" />
+							<button type="button" class="btn icn" onclick="cfnOpenBrandListPopup('fnSetBrandInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="brandCdTxt"></span>
+							<input type="hidden" name="brandCdList"/>
+						</td>
+						<th>품목</th>
+						<td>
+							<input type="text" class="w100" name="itemkindCdSearchTxt" id="itemkindCdSearchTxt" maxlength="20" />
+							<button type="button" class="btn icn" onclick="cfnOpenItemkindListPopup('fnSetItemkindInfo', 'M');"><i class="fa fa-search"></i></button>
+							<span id="itemkindTxt"></span>
+							<input type="hidden" name="itemkindCdList"/>
+						</td>
+					</tr>
+					<tr>
+                        <th>제휴채널</th>
+                        <td>
+                            <input type="text" class="w100" name="afLinkCdSearchTxt" id="afLinkCdSearchTxt" maxlength="20" />
+                            <button type="button" class="btn icn" onclick="cfnOpenAfLinkListPopup('fnSetAfLinkInfo', 'M');"><i class="fa fa-search"></i></button>
+                            <span id="afLinkCdTxt"></span>
+                            <input type="hidden" name="afLinkCdList"/>
+                        </td>
+					</tr>
+				</table>
+
+				<ul class="panelBar">
+					<li class="center">
+						<button type="button" class="btn btn-base btn-lg" id="btnSearch">조회</button>
+						<button type="button" class="btn btn-gray btn-lg" id="btnInit">초기화</button>
+					</li>
+				</ul>
+			</form>
+		</div>
+		<!-- 검색조건 영역 -->
+
+		<!-- 리스트 영역 -->
+		<div class="panelStyle">
+			<ul class="panelBar">
+				<li>
+					<button type="button" class="btn btn-default btn-lg" onclick="fnExcelDownLoad();">엑셀다운로드</button>
+				</li>
+			</ul>
+			<div id="gridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
+		</div>
+		<!-- //리스트 영역 -->
+	</div>
+
+
+<style>
+.ag-header-group-text{
+	margin-left: calc(50% - 25px);
+}
+</style>
+<script th:inline="javascript">
+/*<![CDATA[*/
+	let columnDefs = [
+		{ headerName: "No", field: "day", width: 100, cellClass: 'text-center', valueGetter: "node.rowIndex + 1" },
+		{ headerName: "이미지", field: "sysImgUrl", width: 100, height: 60, cellClass: 'text-center'
+            ,cellRenderer: function(params) {
+                return '<img width="60" src="'+ _goodsUrl+ "/" + params.value + '?RS=60" alt="" onclick="cfnOpenImagePreViewPopup(\'goodsImgView\', \''+ _goodsUrl+ "/" + params.value +'\')" onerror="this.src=\'/image/no.png\';"/>';
+            }
+        },
+        { headerName: "브랜드", field: "brandEnm", width: 100, cellClass: 'text-center'},
+        { headerName: "상품번호", field: "goodsCd", width: 100, cellClass: 'text-center'},
+        { headerName: "구분", field: "distributionGb", width: 100, cellClass: 'text-center'},
+        { headerName: "상품명", field: "goodsNm", width: 400, cellClass: 'text-left'},
+        { headerName: "판매가", field: "currPrice", width: 100, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+        },
+        { headerName: "판매갯수", field: "sellQty", width: 100, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+        },
+        { headerName: "매출액", field: "totAmt", width: 100, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+        },
+        { headerName: "현재고", field: "stockQty", width: 100, cellClass: 'text-right',
+            cellRenderer: function(params) {
+                return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+            }
+        },
+	];
+
+	let gridOptions = gagaAgGrid.getGridOptions(columnDefs);
+
+    // 중복 선택 가능
+    gridOptions.rowSelection = 'multiple';
+    gridOptions.suppressRowClickSelection = true;
+    gridOptions.rowHeight = 60; //이미지가 있을경우 높이 지정해야함.
+
+	// Row Click
+	gridOptions.onCellClicked = function(event) {
+		var goodsCd = event.data.goodsCd;
+		if (event.colDef.field == "goodsCd"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
+		if (event.colDef.field == "goodsNm"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
+	}
+
+    gridOptions.excelStyles = [
+        {
+            id: 'text-center',
+            dataType: 'string',
+			font: {size : 10, bold: false}
+        },
+        {
+            id: 'text-left',
+            dataType: 'string',
+			font: {size : 10, bold: false}
+        },
+        {
+            id: 'text-right',
+            dataType: 'number',
+			font: {size : 10, bold: false}
+        }
+    ];
+
+    var fnExcelDownLoad = function(){
+
+        var formId = '#searchForm';
+        if (gridOptions.api.getDisplayedRowCount() <= 0){
+            mcxDialog.alert("조회된 데이터가 없습니다.<br/>다시 조회 후 다운로드 받으세요.");
+            return;
+        }
+        $("#searchForm input[name=imageViewYn]").val('Y');
+
+        $('#excelList').attr({ href : '/statistics/best/excel/down?' + $("#searchForm").serialize() }).get(0).click();
+
+//     	var totalRows = gridOptions.api.getDisplayedRowCount();
+// 		if(totalRows==0){
+// 			mcxDialog.alert('조회된 내역이 없습니다.');
+// 			return;
+// 		}
+
+//     	var date = new Date().format("YYYYMMDDHHmmss");
+// 		var params = {
+// 						fileName : "베스트상품 주문목록_"+ date,
+// 						sheetName: "DATA"
+// 					 };
+
+// 		gridOptions.api.exportDataAsExcel(params);
+    }
+
+	// 제휴몰 조회 팝업에서 호출
+	var fnSetExtmallInfo = function(result) {
+		var arrExtmallId = [];
+		var extmallIdTxt = "";
+		var sIndex = 0;
+		$('#extmallIdTxt').html('');
+		$('#searchForm input[name=extmallIdSearchTxt]').val('');
+
+		result.forEach(function(extmall) {
+			sIndex++;
+			arrExtmallId.push(extmall.extmallId);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=extmallIdSearchTxt]').val(arrExtmallId[0]);
+		} else {
+			extmallIdTxt = sIndex + " 개";
+			$('#extmallIdTxt').html(extmallIdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrExtmallId);
+		$("#searchForm input[name=extmallIdList]").val(arrExtmallId.join(','));
+	}
+
+	// 업체 조회 팝업에서 호출
+	var fnSetSupplyCompInfo = function(result) {
+		var arrSupplyCompCd = [];
+		var supplyCompCdTxt = "";
+		var sIndex = 0;
+		$('#supplyCompCdTxt').html('');
+		$('#searchForm input[name=supplyCompCdSearchTxt]').val('');
+
+		result.forEach(function(supplyComp) {
+			sIndex++;
+			arrSupplyCompCd.push(supplyComp.supplyCompCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=supplyCompCdSearchTxt]').val(arrSupplyCompCd[0]);
+		} else {
+			supplyCompCdTxt = sIndex + " 개";
+			$('#supplyCompCdTxt').html(supplyCompCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrSupplyCompCd);
+		$("#searchForm input[name=supplyCompCdList]").val(arrSupplyCompCd.join(','));
+	}
+
+	// 제휴채널 조회 팝업에서 호출
+	var fnSetAfLinkInfo = function(result) {
+		var arrAfLinkCd = [];
+		var afLinkCdTxt = "";
+		var sIndex = 0;
+		$('#afLinkCdTxt').html('');
+		$('#searchForm input[name=afLinkCdSearchTxt]').val('');
+
+		result.forEach(function(afLink) {
+			sIndex++;
+			arrAfLinkCd.push(afLink.afLinkCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (sIndex == 1) {
+			$('#searchForm input[name=afLinkCdSearchTxt]').val(arrAfLinkCd[0]);
+		} else {
+			afLinkCdTxt = sIndex + " 개";
+			$('#afLinkCdTxt').html(afLinkCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrAfLinkCd);
+		$("#searchForm input[name=afLinkCdList]").val(arrAfLinkCd.join(","));
+	}
+
+	// 브랜드 조회 팝업에서 호출
+	var fnSetBrandInfo = function(result) {
+		var arrBrandCd = [];
+		var brandCdTxt = "";
+		var bIndex = 0;
+		$('#brandCdTxt').html('');
+		$('#searchForm input[name=brandCdSearchTxt]').val('');
+
+		result.forEach(function(brand){
+			bIndex++;
+			arrBrandCd.push(brand.brandCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (bIndex == 1) {
+			$('#searchForm input[name=brandCdSearchTxt]').val(arrBrandCd[0]);
+		} else {
+			brandCdTxt = bIndex + " 개";
+			$('#brandCdTxt').html(brandCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrBrandCd);
+		$("#searchForm input[name=brandCdList]").val(arrBrandCd.join(","));
+	}
+
+	// 품목 조회 팝업에서 호출
+	var fnSetItemkindInfo = function(result) {
+		var arrItemkindCd = [];
+		var itemkindCdTxt = "";
+		var bIndex = 0;
+		$('#itemkindCdTxt').html('');
+		$('#searchForm input[name=itemkindCdSearchTxt]').val('');
+
+		result.forEach(function(itemkind){
+			bIndex++;
+			arrItemkindCd.push(itemkind.itemkindCd);
+		});
+
+		// 조회 값이 하나일 경우 화면에 코드 노출. 그 외는 갯수 처리
+		if (bIndex == 1) {
+			$('#searchForm input[name=itemkindCdSearchTxt]').val(arrItemkindCd[0]);
+		} else {
+			itemkindCdTxt = bIndex + " 개";
+			$('#itemkindCdTxt').html(itemkindCdTxt);
+		}
+
+		var jsonData = JSON.stringify(arrItemkindCd);
+		$("#searchForm input[name=itemkindCdList]").val(arrItemkindCd.join(','));
+	}
+
+	// 검색
+	$('#btnSearch').on('click', function() {
+		// 입력 값 체크
+		if (!gagajf.validation($('#searchForm')))
+			return false;
+
+		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
+	});
+
+	// 초기화 클릭시
+	$('#btnInit').on('click', function() {
+		$('#searchForm')[0].reset();
+
+		$('#extmallIdTxt').html('');
+		$('#searchForm input[name=extmallIdList]').val('');
+		$('#supplyCompCdTxt').html('');
+		$('#searchForm input[name=supplyCompCdList]').val('');
+		$('#afLinkCdTxt').html('');
+		$('#searchForm input[name=afLinkCdList]').val('');
+		$('#brandCdTxt').html('');
+		$('#searchForm input[name=brandCdList]').val('');
+		$('#itemkindCdTxt').html('');
+		$('#searchForm input[name=itemkindCdList]').val('');
+	});
+
+	// 엑셀다운로드
+	$('#btnExcel').on('click', function() {
+		gagaAgGrid.exportToExcel('일자별주문 목록', gridOptions);
+	});
+
+	$(document).ready(function() {
+		cfnCreateCalendar('#terms', 'startDt', 'endDt', true, '주문', undefined, ['btnToday']);
+		$('.btnYesterday').trigger('click');
+
+		// Create a agGrid
+		gagaAgGrid.createGrid('gridList', gridOptions);
+
+	});
+/*]]>*/
+</script>
+
+</html>