Selaa lähdekoodia

Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-api

dwkim 2 vuotta sitten
vanhempi
commit
9a6bceeea5

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

@@ -29,4 +29,5 @@ public class MainChartEntity implements Serializable {
29 29
     private Integer st20Val;
30 30
     private Integer st30Val;
31 31
 
32
+    private Integer dlvVal;
32 33
 }

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

@@ -12,7 +12,8 @@ public interface MainChartMapper {
12 12
 
13 13
     MainChartEntity selectPchReqChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("prType") String prType) throws Exception;
14 14
 
15
-    MainChartEntity selectPchOdrChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("poType") String poType) throws Exception;
15
+    MainChartEntity selectPchOdrChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("spplyId") String spplyId,
16
+                                      @Param("poType") String poType) throws Exception;
16 17
 
17 18
     List<MainChartEntity> selectPrRankChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("prType") String prType) throws Exception;
18 19
 
@@ -20,4 +21,7 @@ public interface MainChartMapper {
20 21
 
21 22
     List<MainChartEntity> selectSftStckChart(@Param("brandId") String brandId, @Param("storeId") String storeId) throws Exception;
22 23
 
24
+    MainChartEntity selectDeliChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("spplyId") String spplyId,
25
+                                    @Param("deliType") String deliType, @Param("dlvStCd") String dlvStCd, @Param("dateColumn") String dateColumn) throws Exception;
26
+
23 27
 }

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

@@ -4,6 +4,7 @@ package com.oqpo.api.service.oper;
4 4
 import com.oqpo.api.entity.oper.MainChartEntity;
5 5
 import com.oqpo.api.mapper.oper.MainChartMapper;
6 6
 import com.oqpo.api.service.CommonService;
7
+import com.oqpo.api.util.StringUtil;
7 8
 import com.oqpo.api.web.dto.response.oper.mainchart.ChartResponse;
8 9
 import lombok.extern.slf4j.Slf4j;
9 10
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,11 +30,20 @@ public class MainChartService extends CommonService {
29 30
         return result;
30 31
     }
31 32
 
32
-    public ChartResponse selectPchOdrChart(String brandId, String storeId, String poType) throws Exception {
33
-        MainChartEntity entity = mainChartMapper.selectPchOdrChart(brandId, storeId, poType);
33
+    public ChartResponse selectPchOdrChart(String brandId, String storeId, String spplyId, String poType) throws Exception {
34
+        String chartData = null;
34 35
 
35
-        String chartData = "[ [' ', '요청', '진행', '취소'], [' ', " + entity.getPo20Val() + " , " + entity.getPo30Val() + " , " + entity.getPo99Val() + "] ]";
36
+        if (StringUtil.isEmpty(spplyId)) {
37
+            // 브랜드/매장
38
+            MainChartEntity entity = mainChartMapper.selectPchOdrChart(brandId, storeId, spplyId, poType);
39
+            chartData = "[ [' ', '요청', '진행', '취소'], [' ', " + entity.getPo20Val() + " , " + entity.getPo30Val() + " , " + entity.getPo99Val() + "] ]";
40
+        } else {
41
+            // 공급사
42
+            MainChartEntity entity = mainChartMapper.selectPchOdrChart(brandId, storeId, spplyId, poType); // 수주대상
43
+            MainChartEntity deliEntity = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, poType, "DLV0", "dlv_reg_dt"); // 납품서생성 (납품서생성/납품생성일자 비교)
36 44
 
45
+            chartData = "[ [' ', '수주대상', '납품서생성'], [' ', " + entity.getPo20Val() + " , " + deliEntity.getDlvVal() + "] ]";
46
+        }
37 47
         ChartResponse result = new ChartResponse();
38 48
         result.setChartData(chartData);
39 49
         return result;
@@ -85,4 +95,27 @@ public class MainChartService extends CommonService {
85 95
         return result;
86 96
     }
87 97
 
98
+    public ChartResponse selectDeliChart(String brandId, String storeId, String spplyId, String deliType) throws Exception {
99
+
100
+        String chartData = null;
101
+        if (!StringUtil.isEmpty(storeId)) {
102
+            // 매장 입고
103
+            MainChartEntity entity1 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV0", "dlv_sch_dt"); // 대기 (납품서생성/납품예정일자 비교)
104
+            MainChartEntity entity2 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV1", "dlv_cmplt_dt"); // 확인 (납품서완료/납품완료일자 비교)
105
+
106
+            chartData = "[ [' ', '대기', '확인'], [' ', " + entity1.getDlvVal() + " , " + entity2.getDlvVal() + "] ]";
107
+        } else if (!StringUtil.isEmpty(spplyId)) {
108
+            // 공급사 출고
109
+            // 출고 대상 : 납품서생성, 납품예정일자 비교
110
+            // 출고 확인 : 납품서완료, 납품완료일자 비교
111
+            MainChartEntity entity1 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV0", "dlv_sch_dt"); // 대기 (납품서생성/납품예정일자 비교)
112
+            MainChartEntity entity2 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV1", "dlv_cmplt_dt"); // 확인 (납품서완료/납품완료일자 비교)
113
+
114
+            chartData = "[ [' ', '대상', '확인'], [' ', " + entity1.getDlvVal() + " , " + entity2.getDlvVal() + "] ]";
115
+        }
116
+        ChartResponse result = new ChartResponse();
117
+        result.setChartData(chartData);
118
+        return result;
119
+    }
120
+
88 121
 }

+ 28 - 3
src/main/java/com/oqpo/api/web/controller/oper/MainChartController.java

@@ -52,14 +52,16 @@ public class MainChartController {
52 52
             @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
53 53
             @ApiImplicitParam(name = "brandId", value = "브랜드아이디", required = true, dataType = "String", paramType = "query"),
54 54
             @ApiImplicitParam(name = "storeId", value = "매장아이디", required = true, dataType = "String", paramType = "query"),
55
+            @ApiImplicitParam(name = "spplyId", value = "공급사아이디", required = true, dataType = "String", paramType = "query"),
55 56
             @ApiImplicitParam(name = "poType", value = "구매발주타입", required = true, dataType = "String", paramType = "query")
56 57
     })
57
-    @ApiOperation(value = "구매요청 차트")
58
+    @ApiOperation(value = "구매발주 차트")
58 59
     @GetMapping("/pch-odr-chart")
59 60
     public ResponseEntity<ChartResponse> pch_odr_chart(@RequestParam(value = "brandId") String brandId,
60
-                                                       @RequestParam(value = "storeId") String storeId,
61
+                                                       @RequestParam(value = "storeId", required = false) String storeId,
62
+                                                       @RequestParam(value = "spplyId", required = false) String spplyId,
61 63
                                                        @RequestParam(value = "poType") String poType) throws Exception {
62
-        return ResponseEntity.ok(mainChartService.selectPchOdrChart(brandId, storeId, poType));
64
+        return ResponseEntity.ok(mainChartService.selectPchOdrChart(brandId, storeId, spplyId, poType));
63 65
     }
64 66
 
65 67
     /**
@@ -121,4 +123,27 @@ public class MainChartController {
121 123
         return ResponseEntity.ok(mainChartService.selectSftStckChart(brandId, storeId));
122 124
     }
123 125
 
126
+    /**
127
+     * 설명 : 입고 차트 (매장)
128
+     *
129
+     * @param brandId
130
+     * @return
131
+     * @throws Exception
132
+     */
133
+    @ApiImplicitParams({
134
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
135
+            @ApiImplicitParam(name = "brandId", value = "브랜드아이디", required = true, dataType = "String", paramType = "query"),
136
+            @ApiImplicitParam(name = "storeId", value = "매장아이디", required = false, dataType = "String", paramType = "query"),
137
+            @ApiImplicitParam(name = "spplyId", value = "공급사아이디", required = false, dataType = "String", paramType = "query"),
138
+            @ApiImplicitParam(name = "deliType", value = "입고조회타입(당일,1주일,15일,1개월)", required = true, dataType = "String", paramType = "query")
139
+    })
140
+    @ApiOperation(value = "입고/출고 차트")
141
+    @GetMapping("/deli-chart")
142
+    public ResponseEntity<ChartResponse> deli_chart(@RequestParam(value = "brandId") String brandId,
143
+                                                    @RequestParam(value = "storeId", required = false) String storeId,
144
+                                                    @RequestParam(value = "spplyId", required = false) String spplyId,
145
+                                                    @RequestParam(value = "deliType") String deliType) throws Exception {
146
+        return ResponseEntity.ok(mainChartService.selectDeliChart(brandId, storeId, spplyId, deliType));
147
+    }
148
+
124 149
 }

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

@@ -45,6 +45,9 @@
45 45
         <if test="storeId != null and storeId != '' ">
46 46
             AND A.store_id = #{storeId}
47 47
         </if>
48
+        <if test="spplyId != null and spplyId != '' ">
49
+            AND A.spply_id = #{spplyId}
50
+        </if>
48 51
         <if test='"A".equals(poType)'>
49 52
             AND A.podr_dt = DATE_FORMAT(NOW(), '%Y%m%d')
50 53
         </if>
@@ -130,4 +133,32 @@
130 133
         LIMIT 10
131 134
     </select>
132 135
 
136
+    <select id="selectDeliChart" resultType="com.oqpo.api.entity.oper.MainChartEntity">
137
+        /* MainChartMapper.selectDeliChart */
138
+        SELECT COUNT(*) AS dlv_val
139
+        FROM deli_info_mgnt A
140
+        WHERE A.dlv_st_cd = #{dlvStCd}
141
+        <if test="brandId != null and brandId != '' ">
142
+            AND A.brand_id = #{brandId}
143
+        </if>
144
+        <if test="storeId != null and storeId != '' ">
145
+            AND A.store_id = #{storeId}
146
+        </if>
147
+        <if test="spplyId != null and spplyId != '' ">
148
+            AND A.spply_id = #{spplyId}
149
+        </if>
150
+        <if test='"A".equals(deliType)'>
151
+            AND A.${dateColumn} = DATE_FORMAT(NOW(), '%Y%m%d')
152
+        </if>
153
+        <if test='"B".equals(deliType)'>
154
+            AND A.${dateColumn} BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 7 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
155
+        </if>
156
+        <if test='"C".equals(deliType)'>
157
+            AND A.${dateColumn} BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 15 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
158
+        </if>
159
+        <if test='"D".equals(deliType)'>
160
+            AND A.${dateColumn} BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 MONTH), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
161
+        </if>
162
+    </select>
163
+
133 164
 </mapper>