marseyes лет назад: 2
Родитель
Сommit
1c38f94bde

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

@@ -23,7 +23,7 @@ public interface MainChartMapper {
23 23
 
24 24
     List<MainChartEntity> selectPrRankChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("prType") String prType) throws Exception;
25 25
 
26
-    MainChartEntity selectStlChart(@Param("brandId") String brandId, @Param("storeId") String storeId) throws Exception;
26
+    MainChartEntity selectStlChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("spplyId") String spplyId) throws Exception;
27 27
 
28 28
     List<MainChartEntity> selectSftStckChart(@Param("brandId") String brandId, @Param("storeId") String storeId) throws Exception;
29 29
 

+ 9 - 3
src/main/java/com/oqpo/api/service/oper/MainChartService.java

@@ -93,9 +93,15 @@ public class MainChartService extends CommonService {
93 93
         return result;
94 94
     }
95 95
 
96
-    public ChartResponse selectStlChart(String brandId, String storeId) throws Exception {
97
-        MainChartEntity entity = mainChartMapper.selectStlChart(brandId, storeId);
98
-
96
+    public ChartResponse selectStlChart(String brandId, String storeId, String spplyId) throws Exception {
97
+        MainChartEntity entity = null;
98
+        if (!StringUtil.isEmpty(spplyId)) {
99
+            entity = mainChartMapper.selectStlChart(null, null, spplyId);
100
+        } else if (!StringUtil.isEmpty(storeId)) {
101
+            entity = mainChartMapper.selectStlChart(null, storeId, null);
102
+        } else if (!StringUtil.isEmpty(brandId)) {
103
+            entity = mainChartMapper.selectStlChart(brandId, null, null);
104
+        }
99 105
         // String chartData = "[ [' ', '요청', '확인', '반려'], [' ', " + entity.getSt10Val() + " , " + entity.getSt20Val() + " , " + entity.getSt30Val() + "] ]";
100 106
         String chartData = "[ [' ', ' '], ['요청', " + entity.getSt10Val() + "], ['확인', " + entity.getSt20Val() + "], ['반려', " + entity.getSt30Val() + "] ]";
101 107
 

+ 5 - 4
src/main/java/com/oqpo/api/web/controller/oper/MainChartController.java

@@ -116,13 +116,14 @@ public class MainChartController {
116 116
     @ApiImplicitParams({
117 117
             @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
118 118
             @ApiImplicitParam(name = "brandId", value = "브랜드아이디", required = true, dataType = "String", paramType = "query"),
119
-            @ApiImplicitParam(name = "storeId", value = "매장아이디", required = true, dataType = "String", paramType = "query")
119
+            @ApiImplicitParam(name = "storeId", value = "매장아이디", required = true, dataType = "String", paramType = "query"),
120
+            @ApiImplicitParam(name = "spplyId", value = "공급사아이디", required = true, dataType = "String", paramType = "query")
120 121
     })
121 122
     @ApiOperation(value = "정산 차트")
122 123
     @GetMapping("/stl-chart")
123
-    public ResponseEntity<ChartResponse> stl_chart(@RequestParam(value = "brandId") String brandId,
124
-                                                   @RequestParam(value = "storeId") String storeId) throws Exception {
125
-        return ResponseEntity.ok(mainChartService.selectStlChart(brandId, storeId));
124
+    public ResponseEntity<ChartResponse> stl_chart(@RequestParam(value = "brandId") String brandId, @RequestParam(value = "storeId") String storeId,
125
+                                                   @RequestParam(value = "spplyId") String spplyId) throws Exception {
126
+        return ResponseEntity.ok(mainChartService.selectStlChart(brandId, storeId, spplyId));
126 127
     }
127 128
 
128 129
     /**

+ 8 - 2
src/main/resources/mybatis/sqlmaps/oper/MainChart.xml

@@ -150,14 +150,20 @@
150 150
             COUNT(CASE WHEN A.sttl_st_cd = 'ST20' THEN A.sttl_mgnt_unq_no END) AS st20_val,
151 151
             COUNT(CASE WHEN A.sttl_st_cd = 'ST30' THEN A.sttl_mgnt_unq_no END) AS st30_val
152 152
         FROM stl_mgnt_base_info A
153
-        WHERE A.sttl_target_cd = 'S0'
153
+        WHERE 1 = 1
154 154
         <if test="brandId != null and brandId != '' ">
155 155
             AND A.brand_id = #{brandId}
156
+            AND A.sttl_target_cd = 'S0'     /* 매장정산 */
156 157
         </if>
157 158
         <if test="storeId != null and storeId != '' ">
158 159
             AND A.store_id = #{storeId}
160
+            AND A.sttl_target_cd = 'S0'     /* 매장정산 */
161
+        </if>
162
+        <if test="spplyId != null and spplyId != '' ">
163
+            AND A.spply_id = #{spplyId}
164
+            AND A.sttl_target_cd = 'S1'     /* 공급사정산 */
159 165
         </if>
160
-        AND A.SYS_CHG_DTTM >= DATE(NOW())           /* 당일기준 - 수정일시로 비교 */
166
+        /* AND A.SYS_CHG_DTTM >= DATE(NOW()) */
161 167
     </select>
162 168
 
163 169
     <select id="selectPrRankChart" resultType="com.oqpo.api.entity.oper.MainChartEntity">