Bläddra i källkod

메인화면 - 정산

marseyes 2 år sedan
förälder
incheckning
6b45386dae

+ 4 - 0
src/main/java/com/oqpo/api/entity/oper/MainChartEntity.java

@@ -23,4 +23,8 @@ public class MainChartEntity implements Serializable {
23 23
     private String itemNm;
24 24
     private Integer itemCnt;
25 25
 
26
+    private Integer st10Val;
27
+    private Integer st20Val;
28
+    private Integer st30Val;
29
+
26 30
 }

+ 2 - 0
src/main/java/com/oqpo/api/mapper/oper/MainChartMapper.java

@@ -16,4 +16,6 @@ public interface MainChartMapper {
16 16
 
17 17
     List<MainChartEntity> selectPrRankChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("prType") String prType) throws Exception;
18 18
 
19
+    MainChartEntity selectStlChart(@Param("brandId") String brandId, @Param("storeId") String storeId) throws Exception;
20
+
19 21
 }

+ 11 - 0
src/main/java/com/oqpo/api/service/oper/MainChartService.java

@@ -61,4 +61,15 @@ public class MainChartService extends CommonService {
61 61
         return result;
62 62
     }
63 63
 
64
+    public ChartResponse selectStlChart(String brandId, String storeId) throws Exception {
65
+        MainChartEntity entity = mainChartMapper.selectStlChart(brandId, storeId);
66
+
67
+        // String chartData = "[ [' ', '요청', '확인', '반려'], [' ', " + entity.getSt10Val() + " , " + entity.getSt20Val() + " , " + entity.getSt30Val() + "] ]";
68
+        String chartData = "[ [' ', ' '], ['요청', " + entity.getSt10Val() + "], ['확인', " + entity.getSt20Val() + "], ['반려', " + entity.getSt30Val() + "] ]";
69
+
70
+        ChartResponse result = new ChartResponse();
71
+        result.setChartData(chartData);
72
+        return result;
73
+    }
74
+
64 75
 }

+ 20 - 1
src/main/java/com/oqpo/api/web/controller/oper/MainChartController.java

@@ -63,7 +63,7 @@ public class MainChartController {
63 63
     }
64 64
 
65 65
     /**
66
-     * 설명 : 구매발주 차트
66
+     * 설명 : 매출순위 차트
67 67
      *
68 68
      * @param brandId
69 69
      * @return
@@ -83,4 +83,23 @@ public class MainChartController {
83 83
         return ResponseEntity.ok(mainChartService.selectPrRankChart(brandId, storeId, prType));
84 84
     }
85 85
 
86
+    /**
87
+     * 설명 : 정산 차트
88
+     *
89
+     * @param brandId
90
+     * @return
91
+     * @throws Exception
92
+     */
93
+    @ApiImplicitParams({
94
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
95
+            @ApiImplicitParam(name = "brandId", value = "브랜드아이디", required = true, dataType = "String", paramType = "query"),
96
+            @ApiImplicitParam(name = "storeId", value = "매장아이디", required = true, dataType = "String", paramType = "query")
97
+    })
98
+    @ApiOperation(value = "정산 차트")
99
+    @GetMapping("/stl-chart")
100
+    public ResponseEntity<ChartResponse> stl_chart(@RequestParam(value = "brandId") String brandId,
101
+                                                   @RequestParam(value = "storeId") String storeId) throws Exception {
102
+        return ResponseEntity.ok(mainChartService.selectStlChart(brandId, storeId));
103
+    }
104
+
86 105
 }

+ 17 - 0
src/main/resources/mybatis/sqlmaps/oper/MainChart.xml

@@ -59,6 +59,23 @@
59 59
         </if>
60 60
     </select>
61 61
 
62
+    <select id="selectStlChart" resultType="com.oqpo.api.entity.oper.MainChartEntity">
63
+        /* MainChartMapper.selectStlChart */
64
+        SELECT
65
+            COUNT(CASE WHEN A.sttl_st_cd = 'ST10' THEN A.sttl_mgnt_unq_no END) AS st10_val,
66
+            COUNT(CASE WHEN A.sttl_st_cd = 'ST20' THEN A.sttl_mgnt_unq_no END) AS st20_val,
67
+            COUNT(CASE WHEN A.sttl_st_cd = 'ST30' THEN A.sttl_mgnt_unq_no END) AS st30_val
68
+        FROM stl_mgnt_base_info A
69
+        WHERE A.sttl_target_cd = 'S0'
70
+        <if test="brandId != null and brandId != '' ">
71
+            AND A.brand_id = #{brandId}
72
+        </if>
73
+        <if test="storeId != null and storeId != '' ">
74
+            AND A.store_id = #{storeId}
75
+        </if>
76
+        AND A.SYS_CHG_DTTM >= DATE(NOW())           /* 당일기준 - 수정일시로 비교 */
77
+    </select>
78
+
62 79
     <select id="selectPrRankChart" resultType="com.oqpo.api.entity.oper.MainChartEntity">
63 80
         /* MainChartMapper.selectPrRankChart */
64 81
         SELECT prdp.item_id, prdp.item_nm, COUNT(*) AS item_cnt