Procházet zdrojové kódy

메인화면 수주내역

marseyes před 2 roky
rodič
revize
c2b71a61a8

+ 3 - 2
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
 
@@ -21,6 +22,6 @@ public interface MainChartMapper {
21 22
     List<MainChartEntity> selectSftStckChart(@Param("brandId") String brandId, @Param("storeId") String storeId) throws Exception;
22 23
 
23 24
     MainChartEntity selectDeliChart(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("spplyId") String spplyId,
24
-                                    @Param("deliType") String deliType, @Param("dlvStCd") String dlvStCd) throws Exception;
25
+                                    @Param("deliType") String deliType, @Param("dlvStCd") String dlvStCd, @Param("dateColumn") String dateColumn) throws Exception;
25 26
 
26 27
 }

+ 16 - 7
src/main/java/com/oqpo/api/service/oper/MainChartService.java

@@ -30,11 +30,20 @@ public class MainChartService extends CommonService {
30 30
         return result;
31 31
     }
32 32
 
33
-    public ChartResponse selectPchOdrChart(String brandId, String storeId, String poType) throws Exception {
34
-        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;
35 35
 
36
-        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"); // 납품서생성 (납품서생성/납품생성일자 비교)
37 44
 
45
+            chartData = "[ [' ', '수주대상', '납품서생성'], [' ', " + entity.getPo20Val() + " , " + deliEntity.getDlvVal() + "] ]";
46
+        }
38 47
         ChartResponse result = new ChartResponse();
39 48
         result.setChartData(chartData);
40 49
         return result;
@@ -91,16 +100,16 @@ public class MainChartService extends CommonService {
91 100
         String chartData = null;
92 101
         if (!StringUtil.isEmpty(storeId)) {
93 102
             // 매장 입고
94
-            MainChartEntity entity1 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV0"); // 대기 (납품서생성/납품예정일자 비교)
95
-            MainChartEntity entity2 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV1"); // 확인 (납품서완료/납품완료일자 비교)
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"); // 확인 (납품서완료/납품완료일자 비교)
96 105
 
97 106
             chartData = "[ [' ', '대기', '확인'], [' ', " + entity1.getDlvVal() + " , " + entity2.getDlvVal() + "] ]";
98 107
         } else if (!StringUtil.isEmpty(spplyId)) {
99 108
             // 공급사 출고
100 109
             // 출고 대상 : 납품서생성, 납품예정일자 비교
101 110
             // 출고 확인 : 납품서완료, 납품완료일자 비교
102
-            MainChartEntity entity1 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV0"); // 대기 (납품서생성/납품예정일자 비교)
103
-            MainChartEntity entity2 = mainChartMapper.selectDeliChart(brandId, storeId, spplyId, deliType, "DLV1"); // 확인 (납품서완료/납품완료일자 비교)
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"); // 확인 (납품서완료/납품완료일자 비교)
104 113
 
105 114
             chartData = "[ [' ', '대상', '확인'], [' ', " + entity1.getDlvVal() + " , " + entity2.getDlvVal() + "] ]";
106 115
         }

+ 5 - 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
     /**

+ 11 - 20
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>
@@ -144,29 +147,17 @@
144 147
         <if test="spplyId != null and spplyId != '' ">
145 148
             AND A.spply_id = #{spplyId}
146 149
         </if>
147
-        <if test='"A".equals(deliType) and "DLV0".equals(dlvStCd)'>
148
-            AND A.dlv_sch_dt = DATE_FORMAT(NOW(), '%Y%m%d')         /* 납품예정일자 */
149
-        </if>
150
-        <if test='"A".equals(deliType) and "DLV1".equals(dlvStCd)'>
151
-            AND A.dlv_cmplt_dt = DATE_FORMAT(NOW(), '%Y%m%d')       /* 납품완료일자 */
152
-        </if>
153
-        <if test='"B".equals(deliType) and "DLV0".equals(dlvStCd)'>
154
-            AND A.dlv_sch_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 7 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
155
-        </if>
156
-        <if test='"B".equals(deliType) and "DLV1".equals(dlvStCd)'>
157
-            AND A.dlv_cmplt_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 7 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
158
-        </if>
159
-        <if test='"C".equals(deliType) and "DLV0".equals(dlvStCd)'>
160
-            AND A.dlv_sch_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 15 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
150
+        <if test='"A".equals(deliType)'>
151
+            AND A.${dateColumn} = DATE_FORMAT(NOW(), '%Y%m%d')
161 152
         </if>
162
-        <if test='"C".equals(deliType) and "DLV1".equals(dlvStCd)'>
163
-            AND A.dlv_cmplt_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 15 DAY), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
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')
164 155
         </if>
165
-        <if test='"D".equals(deliType) and "DLV0".equals(dlvStCd)'>
166
-            AND A.dlv_sch_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 MONTH), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
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')
167 158
         </if>
168
-        <if test='"D".equals(deliType) and "DLV1".equals(dlvStCd)'>
169
-            AND A.dlv_cmplt_dt BETWEEN DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 1 MONTH), '%Y%m%d') AND DATE_FORMAT(NOW(), '%Y%m%d')
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')
170 161
         </if>
171 162
     </select>
172 163