swkim 4 лет назад
Родитель
Сommit
07dd655d0e

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

@@ -205,7 +205,7 @@ public class Statistics extends TscBaseDomain {
 	private int ordQty;
 	private int custCnt;
 	private int custCpnCnt;
-	private int ordRate;
+	private double ordRate;
 
 	private String planSq;
 	private String planNm;
@@ -266,4 +266,7 @@ public class Statistics extends TscBaseDomain {
 
 	private String custId;
 	private int custPoint;
+
+	private String distributionGbS;
+	private String distributionGbW;
 }

+ 17 - 28
src/main/java/com/style24/persistence/mybatis/shop/TsaStatistics.xml

@@ -1193,7 +1193,7 @@
 		    , CPN_NM -- 쿠폰명
 		    , BURDEN -- 자사분담율
 		    , DOWN_CNT
-		    , FLOOR(USE_CNT / DOWN_CNT * 100 * 10) / 10 AS USE_RATE -- 사용율
+			, ROUND((USE_CNT / DOWN_CNT) * 100 * 100) / 10 / 10 AS USE_RATE
 		    , USE_CNT -- 사용수
 		    , ORD_AMT -- 주문금액
 		    , CPN_AMT -- 쿠폰비용
@@ -1231,7 +1231,7 @@
 		    , Z.ORD_QTY
 		    , Z.CUST_CNT
 		    , X.CUST_CPN_CNT
-		    , FLOOR((X.CUST_CPN_CNT / Z.CUST_CNT * 100) / 10) * 10 AS ORD_RATE
+			, ROUND((X.CUST_CPN_CNT / Z.CUST_CNT * 100 * 100) / 10) / 10 AS ORD_RATE
 		FROM (
 		     SELECT
 		        A.BRAND_CD
@@ -1468,7 +1468,7 @@
 		GROUP BY A.BRAND_CD, B.BRAND_ENM, A.GOODS_CD
 	</select>
 
-	<!-- 사은품 주문조회 -->
+	<!-- 기획전 주문조회 -->
 	<select id="getPlanOrderList" parameterType="Statistics" resultType="Statistics">
 	    /* TsaStatistics.getPlanOrderList */
 		SELECT
@@ -1501,18 +1501,18 @@
 		      ]]>
 		      AND B.ORD_DTL_STAT NOT IN ('G013_00', 'G013_10', 'G013_98')               -- 주문접수,입금대기,입금전취소 제외
 		      AND B.ORD_QTY > B.CNCL_RTN_QTY
-	          <if test="multiDistributionGb != null">
-	              /* 물류구분 */
-	              <foreach collection="multiDistributionGb" item="item" index="index">
-	                  <if test="item == 'SCM'">
-	                      AND C.DISTRIBUTION_GB = 'G065_20' -- 입점
-	                  </if>
-	                  <if test="item == 'WMS'">
-		                  AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12') -- 위탁
-	                  </if>
-	              </foreach>
-	          </if>
-		      <if test="multiTmtbSq != null">
+		      <choose>
+				  <when test="distributionGbS != null and distributionGbS !='' and distributionGbW != null and distributionGbW !=''">
+					  AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12', 'G065_20')
+				  </when>
+				  <when test="distributionGbW != null and distributionGbW !=''">
+					  AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12')
+				  </when>
+				  <when test="distributionGbS != null and distributionGbS !=''">
+					  AND C.DISTRIBUTION_GB = 'G065_20'
+				  </when>
+			  </choose>
+		      <if test="multiPlanSq != null">
 		          /* 기획전번호  */
 		          <foreach collection="multiPlanSq" item="item" index="index"  open="AND E.PLAN_SQ IN (" close=")" separator=",">#{item}</foreach>
 		      </if>
@@ -1521,7 +1521,7 @@
 		GROUP BY DISTRIBUTION_GB, BRAND_ENM, PLAN_SQ
 	</select>
 
-	<!-- 사은품 주문상세 조회 -->
+	<!-- 기획전 주문상세 조회 -->
 	<select id="getPlanOrderDetailList" parameterType="Statistics" resultType="Statistics">
 	    /* TsaStatistics.getPlanOrderDetailList */
 		WITH TAB AS (
@@ -1556,7 +1556,7 @@
 		    , SUM(ORD_AMT) AS ORD_AMT
 		    , SUM(ORD_QTY) AS ORD_QTY
 		    , SUM(CUST_CNT) AS CUST_CNT
-		    , FLOOR((SUM(CUST_CNT) / (SELECT TOT_CUST_CNT FROM TAB) * 100) / 10) * 10 AS ORD_RATE
+		    , ROUND((SUM(CUST_CNT) / (SELECT TOT_CUST_CNT FROM TAB) * 100 * 100) / 10) / 10 AS ORD_RATE
 		FROM (
 		     SELECT C.DISTRIBUTION_GB
 		         , C.GOODS_CD
@@ -1581,17 +1581,6 @@
 		      ]]>
 		      AND B.ORD_DTL_STAT NOT IN ('G013_00', 'G013_10', 'G013_98')               -- 주문접수,입금대기,입금전취소 제외
 		      AND B.ORD_QTY > B.CNCL_RTN_QTY
-              <if test="multiDistributionGb != null">
-                  /* 물류구분 */
-                  <foreach collection="multiDistributionGb" item="item" index="index">
-                      <if test="item == 'SCM'">
-                          AND C.DISTRIBUTION_GB = 'G065_20' -- 입점
-                      </if>
-                      <if test="item == 'WMS'">
-                          AND C.DISTRIBUTION_GB IN ('G065_10', 'G065_11', 'G065_12') -- 위탁
-                      </if>
-                  </foreach>
-              </if>
 		      AND E.PLAN_SQ = #{planSq}
 		    GROUP BY C.DISTRIBUTION_GB, C.GOODS_CD, C.GOODS_NM, A.CUST_NO
 		) X

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

@@ -75,6 +75,7 @@
 			<ul class="panelBar">
 				<li>
 					<button type="button" class="btn btn-default btn-lg" onclick="fnDetailExcelDownLoad();">엑셀다운로드</button>
+					<span id="couponNmTxt" style="text-align: left"></span>
 				</li>
 			</ul>
 			<div id="detailGridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
@@ -176,6 +177,7 @@
 			$("#detailSearchForm input[name=startDt]").val($("#searchForm input[name=startDt]").val());
 			$("#detailSearchForm input[name=endDt]").val($("#searchForm input[name=endDt]").val());
 			$("#detailSearchForm input[name=cpnId]").val(params.cpnId);
+			$("#couponNmTxt").text(params.cpnNm);
 			gagaAgGrid.fetch($('#detailSearchForm').prop('action'), detailGridOptions, '#detailSearchForm', fnDetailCreateTotal);
 		}
 	}

+ 14 - 6
src/main/webapp/WEB-INF/views/statistics/PlanTradingForm.html

@@ -43,8 +43,8 @@
 					<tr>
 					   <th>물류구분</th>
 					   <td colspan="2">
-                            <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>
+                            <label class="chkBox checked"><input type="checkbox" name="distributionGbS" value="SCM" checked="checked"/>입점</label>
+                            <label class="chkBox checked"><input type="checkbox" name="distributionGbW" value="WMS" checked="checked"/>위탁</label>
 					   </td>
 					</tr>
 				</table>
@@ -76,6 +76,7 @@
 			<ul class="panelBar">
 				<li>
 					<button type="button" class="btn btn-default btn-lg" onclick="fnDetailExcelDownLoad();">엑셀다운로드</button>
+					<span id="planNmTxt" style="text-align: left"></span>
 				</li>
 			</ul>
 			<div id="detailGridList" style="width: 100%; height: 470px" class="ag-theme-balham"></div>
@@ -139,9 +140,9 @@
 				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
 			}
 		},
-		{ headerName: "구매율", field: "custCnt", width: 150, cellClass: 'text-right',
+		{ headerName: "구매율", field: "ordRate", width: 150, cellClass: 'text-right',
 			cellRenderer: function(params) {
-				return !gagajf.isNull(params.value) ? params.value.addComma() : '0';
+				return params.value + '%';
 			}
 		},
 	];
@@ -162,6 +163,7 @@
 			$("#detailSearchForm input[name=startDt]").val($("#searchForm input[name=startDt]").val());
 			$("#detailSearchForm input[name=endDt]").val($("#searchForm input[name=endDt]").val());
 			$("#detailSearchForm input[name=planSq]").val(params.planSq);
+			$("#planNmTxt").text(params.planNm);
 			gagaAgGrid.fetch($('#detailSearchForm').prop('action'), detailGridOptions, '#detailSearchForm', fnDetailCreateTotal);
 		}
 	}
@@ -170,10 +172,10 @@
 	detailGridOptions.onCellClicked = function(event) {
 		var params = event.data;
 		if (event.colDef.field == "goodsCd"){
-			cfnOpenGoodsDetailPopup('U',goodsCd);
+			cfnOpenGoodsDetailPopup('U',params.goodsCd);
 		}
 		else if (event.colDef.field == "goodsNm"){
-			cfnOpenGoodsDetailPopup('U',goodsCd);
+			cfnOpenGoodsDetailPopup('U',params.goodsCd);
 		}
 	}
 
@@ -270,15 +272,21 @@
 		totInfo.ordAmt   = 0;
 		totInfo.ordQty   = 0;
 		totInfo.custCnt  = 0;
+		totInfo.ordRate = 0;
+
+		let len = 0;
 
 		detailGridOptions.api.forEachNode(function(rowNode, index) {
 			if (!rowNode.group) {
 				if( typeof rowNode.data.ordAmt        == 'number') { totInfo.ordAmt         += rowNode.data.ordAmt        ; }
 				if( typeof rowNode.data.ordQty        == 'number') { totInfo.ordQty         += rowNode.data.ordQty        ; }
 				if( typeof rowNode.data.custCnt       == 'number') { totInfo.custCnt        += rowNode.data.custCnt       ; }
+				if( typeof rowNode.data.ordRate       == 'number') { totInfo.ordRate        += rowNode.data.ordRate       ; if (rowNode.data.ordRate > 0) len++;}
 			}
 		});
 
+		totInfo.ordRate = Math.floor(totInfo.ordRate / len);
+
 		gagaAgGrid.setPinnedRowData(detailGridOptions, totInfo, 'top');
 	}