swkim 4 vuotta sitten
vanhempi
commit
ca34e21458

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

@@ -158,7 +158,7 @@ public class Statistics extends TscBaseDomain {
 	private String hour;                //시간
 	private int ordAmt;                 //주문금액
 	private int ordCust;                //주문자수
-	private int cplRate;                //달성율
+	private double cplRate;                //달성율
 	private long custPrice;             //고객단가
 	private long compOrdAmt;            //비교
 

+ 87 - 42
src/main/java/com/style24/persistence/mybatis/shop/TsaStatistics.xml

@@ -364,6 +364,7 @@
 		    , SUM(C.STOCK_QTY) AS STOCK_QTY                 -- 현재고수량
 		    , SUM(A.SELL_QTY) AS SELL_QTY                   -- 판매수량
 		    , SUM(A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.GOODS_CPN_AMT - A.TMTB_AMT - A.CART_CPN_AMT) AS PAY_AMT -- 상품당결제액
+			, SUM(A.ORD_AMT) AS ORD_AMT -- 매출액
 		    , SUM(A.GOODS_CPN_AMT) AS GOODS_CPN_AMT         -- 즉시/주문상품쿠폰
 		    , SUM(A.TMTB_AMT) AS TMTB_AMT                   -- 다다익선
 		    , SUM(A.CART_CPN_AMT) AS CART_CPN_AMT           -- 장바구니쿠폰
@@ -800,8 +801,8 @@
 						<if test="item == 'COMPARE_TERMS'">
 					        <![CDATA[
 					        /* 직전동기간 */
-					        AND A.DAY_TIME >= DATE_ADD(DATE_FORMAT(#{compStDt},'%Y-%m-%d'), INTERVAL (DATE_FORMAT(#{compStDt}, '%Y%m%d') - DATE_FORMAT(#{compEdDt}, '%Y%m%d')) -1  DAY)
-					        AND A.DAY_TIME < DATE_ADD(DATE_FORMAT(#{compEdDt}, '%Y%m%d'), INTERVAL (DATE_FORMAT(#{compStDt}, '%Y%m%d') - DATE_ADD(DATE_FORMAT(#{compEdDt}, '%Y%m%d'), INTERVAL 1 DAY)) * -1 DAY)
+					        AND A.DAY_TIME >= DATE_ADD(DATE_FORMAT(#{startDt},'%Y-%m-%d'), INTERVAL (DATE_FORMAT(#{startDt}, '%Y%m%d') - DATE_FORMAT(#{endDt}, '%Y%m%d')) DAY)
+					        AND A.DAY_TIME < DATE_FORMAT(#{startDt}, '%Y%m%d')
 					        ]]>
 						</if>
 						<if test="item == 'YOY'">
@@ -811,15 +812,15 @@
 					        AND A.DAY_TIME < DATE_ADD(DATE_ADD(DATE_FORMAT(#{endDt}, '%Y%m%d'), INTERVAL 1 DAY), INTERVAL -1 YEAR )
 					        ]]>
 						</if>
+						<if test="item == 'DIY'">
+							<![CDATA[
+							/* 직접선택 */
+							AND A.DAY_TIME >= DATE_FORMAT(#{compStDt}, '%Y%m%d')
+							AND A.DAY_TIME <  DATE_ADD(DATE_FORMAT(#{compEdDt}, '%Y%m%d'), INTERVAL 1 DAY)
+							]]>
+						</if>
 					</foreach>
 				</if>
-				<if test="dtGb == null">
-				        <![CDATA[
-				        /* 직접선택 */
-				        AND A.DAY_TIME >= DATE_FORMAT(#{compStDt}, '%Y%m%d')
-				        AND A.DAY_TIME <  DATE_ADD(DATE_FORMAT(#{compEdDt}, '%Y%m%d'), INTERVAL 1 DAY)
-				        ]]>
-				</if>
 				<if test="multiFrontGb != null">
 					/* 디바이스 */
 					<foreach collection="multiFrontGb" item="item" index="index"  open="AND A.FRONT_GB IN (" close=")" separator=",">#{item}</foreach>
@@ -859,7 +860,7 @@
 		    A.HOUR
 		    , A.ORD_AMT /*매출*/
 		    , B.ORD_AMT AS COMP_ORD_AMT /*비교*/
-		    , ROUND(FLOOR(A.ORD_AMT / B.ORD_AMT * 100 * 100) / 100, 2) AS CPL_RATE /*달성율*/
+		    , ROUND(FLOOR(A.ORD_AMT / (CASE WHEN B.ORD_AMT IS NULL OR B.ORD_AMT = 0 THEN 1 ELSE B.ORD_AMT END) * 100 * 100) / 100, 2) AS CPL_RATE /*달성율*/
 		    , A.ORD_CUST /*주문자수*/
 		    , A.ORD_CNT /*주문수*/
 		    , A.SELL_QTY /*판매수*/
@@ -924,39 +925,83 @@
 	<!-- 카테고리별 주문 조회 -->
 	<select id="getCategoryOrderList" parameterType="Statistics" resultType="Statistics">
 		/* TsaStatistics.getCategoryOrderList */
-		SELECT A.ITEMKIND_CD
-		    , SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 1) AS CATE_NM1 /* 대분류 */
-		    , SUBSTRING_INDEX(SUBSTRING(T4.FULL_CATE_NM, INSTR(SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 2), ' > ') + 3), ' > ', 1) AS CATE_NM2 /* 중분류 */
-		    , SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', -1) AS CATE_NM3 -- 소분류
-		    , SUM(A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS TOT_AMT /*총매출*/
-		    , SUM(A.SELF_AMT + A.CHANNEL_AMT) AS SELFMALL_AMT /*자사몰매출*/
-		    , SUM(A.EXTMALL_AMT) AS EXTMALL_AMT /*제휴몰매출*/
-		FROM TB_STAT_ORD_DAY A, TB_ITEMKIND_CATE TC, TB_CATE_4SRCH T4
+		SELECT
+			A.ITEMKIND_CD
+			, SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 1) AS CATE_NM1 /* 대분류 */
+			, SUBSTRING_INDEX(SUBSTRING(T4.FULL_CATE_NM, INSTR(SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', 2), ' > ') + 3), ' > ', 1) AS CATE_NM2 /* 중분류 */
+			, SUBSTRING_INDEX(T4.FULL_CATE_NM, ' > ', -1) AS CATE_NM3 -- 소분류
+			, (A.SELFMALL_AMT + A.EXTMALL_AMT) AS TOT_AMT /*총매출*/
+			, SELFMALL_AMT /*자사몰매출*/
+			, EXTMALL_AMT /*제휴몰매출*/
+		FROM (
+			SELECT
+			A.ITEMKIND_CD
+			, SUM(CASE WHEN GB = '1' THEN AMT ELSE 0 END ) AS SELFMALL_AMT
+			, SUM(CASE WHEN GB = '2' THEN AMT ELSE 0 END ) AS EXTMALL_AMT
+			FROM (
+				SELECT
+					A.ITEMKIND_CD
+					, SUM(A.SELF_AMT + A.CHANNEL_AMT - A.CNCL_AMT - A.RTN_AMT) AS AMT
+					, '1' AS GB
+				FROM TB_STAT_ORD_DAY A
+				WHERE EXTMALL_ID IS NULL
+				<![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="multiSupplyCompCd != null">
+					/* 공급처 */
+					<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND A.SUPPLY_COMP_CD 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>
+				GROUP BY A.ITEMKIND_CD
+				UNION ALL
+				SELECT
+					A.ITEMKIND_CD
+					, SUM(A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) AS AMT
+					, '2' AS GB
+				FROM TB_STAT_ORD_DAY A
+				WHERE EXTMALL_ID IS NOT NULL
+				<![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="multiSupplyCompCd != null">
+					/* 공급처 */
+					<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND A.SUPPLY_COMP_CD 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>
+				GROUP BY A.ITEMKIND_CD
+			) A
+			GROUP BY A.ITEMKIND_CD
+		) A, TB_ITEMKIND_CATE TC, TB_CATE_4SRCH T4
 		WHERE A.ITEMKIND_CD = TC.ITEMKIND_CD
-		    AND TC.CATE_NO = T4.LEAF_CATE_NO
-		    AND (A.SELF_AMT + A.CHANNEL_AMT + A.EXTMALL_AMT - A.CNCL_AMT - A.RTN_AMT) > 0
-	        <![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="multiSupplyCompCd != null">
-				/* 공급처 */
-				<foreach collection="multiSupplyCompCd" item="item" index="index"  open="AND A.SUPPLY_COMP_CD 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>
-		GROUP BY A.ITEMKIND_CD, T4.FULL_CATE_NM
+			AND TC.CATE_NO = T4.LEAF_CATE_NO
+			AND (A.SELFMALL_AMT + A.EXTMALL_AMT) > 0
 	</select>
 
 	<!-- 카테고리 상세 조회 -->

+ 18 - 7
src/main/webapp/WEB-INF/views/statistics/BestTradingForm.html

@@ -64,20 +64,20 @@
                         </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>
+                            <label th:if="${formalGbList}" th:each="oneData, status : ${formalGbList}" class="chkBox checked"><input type="checkbox" name="multiFormalGb" th:value="${oneData.cd}" th:text="${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>
+                            <label th:if="${sexGbList}" th:each="oneData, status : ${sexGbList}" class="chkBox checked"><input type="checkbox" name="multiSexGb" th:value="${oneData.cd}" th:text="${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="30" checked="checked"/>30대</label>
+                            <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="40" checked="checked"/>40대</label>
                             <label class="chkBox checked"><input type="checkbox" name="multiAgeGb" value="X" checked="checked"/>기타/미상</label>
                         </td>
                     </tr>
@@ -142,13 +142,21 @@
 		{ 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\';"/>';
+                return '<img width="60" src="'+ _goodsUrl+ "/" + params.value + '?RS=60" alt="" onerror="this.src=\'/image/no.png\';"/>';
             }
         },
         { headerName: "브랜드", field: "brandEnm", width: 100, cellClass: 'text-center'},
-        { headerName: "상품번호", field: "goodsCd", width: 100, cellClass: 'text-center'},
+        { headerName: "상품번호", field: "goodsCd", width: 100, cellClass: 'text-center',
+			cellRenderer: function(params) {
+				return '<a href="javascript:void(0);">' + params.value + '</a>';
+			}
+		},
         { headerName: "구분", field: "distributionGb", width: 100, cellClass: 'text-center'},
-        { headerName: "상품명", field: "goodsNm", width: 400, cellClass: 'text-left'},
+        { headerName: "상품명", field: "goodsNm", width: 400, cellClass: 'text-left',
+			cellRenderer: function(params) {
+				return '<a href="javascript:void(0);">' + params.value + '</a>';
+			}
+		},
         { headerName: "판매가", field: "currPrice", width: 100, cellClass: 'text-right',
             cellRenderer: function(params) {
                 return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
@@ -187,6 +195,9 @@
 		if (event.colDef.field == "goodsNm"){
 			cfnOpenGoodsDetailPopup('U',goodsCd);
 		}
+		if (event.colDef.field == "sysImgUrl"){
+			cfnOpenGoodsDetailPopup('U',goodsCd);
+		}
 	}
 
     gridOptions.excelStyles = [

+ 1 - 3
src/main/webapp/WEB-INF/views/statistics/BrandTradingForm.html

@@ -56,12 +56,10 @@
 					</tr>
 					<tr>
 						<th>물류구분</th>
-						<td>
+						<td colspan="3">
 							<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></td>
 					</tr>
 					<tr>
 						<th>공급업체</th>

+ 3 - 5
src/main/webapp/WEB-INF/views/statistics/ChannelTradingForm.html

@@ -42,13 +42,11 @@
 					</tr>
 					<tr>
 						<th>디바이스</th>
-						<td>
+						<td colspan="3">
 							<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></td>
 					</tr>
 					<tr>
 						<th>물류구분</th>
@@ -123,12 +121,12 @@
 						return params.value +'%';
 					}
 				},
-				{headerName: "판매수", field: "sellCnt", width: 120, cellClass: 'text-right',
+				{headerName: "판매수", field: "sellQty", width: 120, cellClass: 'text-right',
 					cellRenderer: function (params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
 				},
-				{headerName: "매출액(A)", field: "payAmt", width: 120, cellClass: 'text-right',
+				{headerName: "매출액(A)", field: "totAmt", width: 120, cellClass: 'text-right',
 					cellRenderer: function (params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}

+ 1 - 1
src/main/webapp/WEB-INF/views/statistics/ClaimTradingForm.html

@@ -178,7 +178,7 @@
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
 				},
-				{headerName: "교환", field: "chgDelvFee", width: 120, cellClass: 'text-right',
+				{headerName: "교환배송비", field: "chgDelvFee", width: 120, cellClass: 'text-right',
 					cellRenderer: function (params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}

+ 12 - 2
src/main/webapp/WEB-INF/views/statistics/GoodsTradingForm.html

@@ -156,7 +156,15 @@
 				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 			}
 		},
-		{ headerName: "판매수", field: "sellQty", width: 100, cellClass: 'text-right' },
+		{ headerName: "상품당결제액", field: "", width: 150, cellClass: 'text-center',
+			children: [
+				{headerName: "", field: "payAmt", width: 150, cellClass: 'text-right',
+					cellRenderer: function (params) {
+						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+					}
+				}
+			]
+		},
 		{ headerName: "매출액(A)", field: "", width: 100, cellClass: 'text-center',
 			children: [
 				{headerName: "판매수", field: "sellQty", width: 120, cellClass: 'text-right',
@@ -164,7 +172,7 @@
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
 				},
-				{headerName: "매출액(판매가*수량)", field: "payAmt", width: 150, cellClass: 'text-right',
+				{headerName: "매출액(판매가*수량)", field: "ordAmt", width: 150, cellClass: 'text-right',
 					cellRenderer: function (params) {
 						return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 					}
@@ -402,6 +410,7 @@
 		let totInfo = {};
 		totInfo.stockQty        = 0;
 		totInfo.sellQty         = 0;
+		totInfo.ordAmt          = 0;
 		totInfo.payAmt          = 0;
 		totInfo.goodsCpnAmt     = 0;
 		totInfo.tmtbAmt         = 0;
@@ -417,6 +426,7 @@
 			if (!rowNode.group) {
 				if( typeof rowNode.data.stockQty    == 'number') { totInfo.stockQty     += rowNode.data.stockQty    ; }
 				if( typeof rowNode.data.sellQty     == 'number') { totInfo.sellQty      += rowNode.data.sellQty     ; }
+				if( typeof rowNode.data.ordAmt      == 'number') { totInfo.ordAmt       += rowNode.data.ordAmt      ; }
 				if( typeof rowNode.data.payAmt      == 'number') { totInfo.payAmt       += rowNode.data.payAmt      ; }
 				if( typeof rowNode.data.goodsCpnAmt == 'number') { totInfo.goodsCpnAmt  += rowNode.data.goodsCpnAmt ; }
 				if( typeof rowNode.data.tmtbAmt     == 'number') { totInfo.tmtbAmt      += rowNode.data.tmtbAmt     ; }

+ 2 - 0
src/main/webapp/WEB-INF/views/statistics/HourlyTradingForm.html

@@ -44,6 +44,8 @@
 						<td colspan="3">
 							<label class="chkBox checked"><input type="checkbox" name="dtGb" value="COMPARE_TERMS"/>직전 동일 기간 비교</label>
 							<label class="chkBox checked"><input type="checkbox" name="dtGb" value="YOY"/>전년 비교</label>
+							<label class="chkBox checked"><input type="checkbox" name="dtGb" value="DIY" checked />직접선택</label>
+							<span>직접선택</span>
 							<span id="compTerms"></span>
 						</td>
 					</tr>