Przeglądaj źródła

매장 단가관리 - 오더퀸 연동 개발중

marseyes 2 lat temu
rodzic
commit
585b99def2

+ 59 - 63
src/main/java/com/oqpo/api/service/stinfo/ItemUnitService.java

@@ -1,6 +1,7 @@
1 1
 package com.oqpo.api.service.stinfo;
2 2
 
3 3
 
4
+import com.oqpo.api.client.oqlink.OqlinkClient;
4 5
 import com.oqpo.api.entity.CodeEntity;
5 6
 import com.oqpo.api.entity.oper.FileEntity;
6 7
 import com.oqpo.api.entity.oper.UserMngEntity;
@@ -48,27 +49,29 @@ public class ItemUnitService extends CommonService {
48 49
     @Autowired
49 50
     private StoreItemUnitMapper storeItemUnitMapper;
50 51
 
51
-
52 52
     @Autowired
53 53
     private FileMapper fileMapper;
54 54
 
55
-
56 55
     @Autowired
57 56
     private UserMngMapper userMngMapper;
57
+
58
+    @Autowired
59
+    private OqlinkClient oqlinkClient;
60
+
58 61
     /*
59 62
       브랜드 공급사 단가 리스트 조회
60 63
 
61 64
      */
62
-    public GridResponse selectItemUnitGridList(String sBrandId, String fromDt, String toDt,String sUnitStCd, String sSpplyId, String sClass1, String sClass2, String sClass3, String sClass4, String sItemNm,   GridRequest gridRequest) throws Exception {
65
+    public GridResponse selectItemUnitGridList(String sBrandId, String fromDt, String toDt, String sUnitStCd, String sSpplyId, String sClass1, String sClass2, String sClass3, String sClass4, String sItemNm, GridRequest gridRequest) throws Exception {
63 66
         int gridPage = gridRequest.getGridPage();
64 67
         int gridSize = gridRequest.getGridSize();
65 68
 
66 69
         fromDt = fromDt == null ? null : fromDt.replace(".", "");
67 70
         toDt = toDt == null ? null : toDt.replace(".", "");
68 71
 
69
-        int gridRecords = itemUnitMapper.selectItemUnitGridCnt( sBrandId, fromDt,  toDt, sUnitStCd, sSpplyId, sClass1, sClass2, sClass3, sClass4,sItemNm );
72
+        int gridRecords = itemUnitMapper.selectItemUnitGridCnt(sBrandId, fromDt, toDt, sUnitStCd, sSpplyId, sClass1, sClass2, sClass3, sClass4, sItemNm);
70 73
         int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
71
-        List<ItemUnitEntity> entities = itemUnitMapper.selectItemUnitGridList(sBrandId, fromDt,  toDt, sUnitStCd, sSpplyId, sClass1, sClass2, sClass3, sClass4,sItemNm, gridRequest);
74
+        List<ItemUnitEntity> entities = itemUnitMapper.selectItemUnitGridList(sBrandId, fromDt, toDt, sUnitStCd, sSpplyId, sClass1, sClass2, sClass3, sClass4, sItemNm, gridRequest);
72 75
         List<Object> gridRows = entities.stream()
73 76
                 .map(m -> ItemUnitSearchResponse.builder()
74 77
                         .viewCd("R")
@@ -78,18 +81,18 @@ public class ItemUnitService extends CommonService {
78 81
                         .itemNm(m.getItemNm())
79 82
                         .spplyId(m.getSpplyId())
80 83
                         .spplyNm(m.getSpplyNm())
81
-                        .contSttDt(m.getContSttDt() == null ? "" :m.getContSttDt())
82
-                        .contEndDt(m.getContEndDt() == null ? "" :m.getContEndDt())
83
-                        .curr(m.getCurr() == null ? "" :m.getCurr())
84
-                        .currNm(m.getCurrNm() == null ? "" :m.getCurrNm() )
85
-                        .unit(m.getUnit() == null ? "" :m.getUnit())
86
-                        .unitNm(m.getUnitNm() == null ? "" :m.getUnitNm())
87
-                        .unitAmt(m.getUnitAmt() == null ? 0 :m.getUnitAmt())
88
-                        .leadTime(m.getLeadTime() == null ? 0 :m.getLeadTime())
89
-                        .spplyItemId(m.getSpplyItemId() == null ? "" :m.getSpplyItemId())
90
-                        .unitStCd(m.getUnitStCd() == null ? "" :m.getUnitStCd())
91
-                        .unitStNm(m.getUnitStNm() == null ? "" :m.getUnitStNm())
92
-                        .stddQty(m.getStddQty() == null ? 0 :m.getStddQty() )
84
+                        .contSttDt(m.getContSttDt() == null ? "" : m.getContSttDt())
85
+                        .contEndDt(m.getContEndDt() == null ? "" : m.getContEndDt())
86
+                        .curr(m.getCurr() == null ? "" : m.getCurr())
87
+                        .currNm(m.getCurrNm() == null ? "" : m.getCurrNm())
88
+                        .unit(m.getUnit() == null ? "" : m.getUnit())
89
+                        .unitNm(m.getUnitNm() == null ? "" : m.getUnitNm())
90
+                        .unitAmt(m.getUnitAmt() == null ? 0 : m.getUnitAmt())
91
+                        .leadTime(m.getLeadTime() == null ? 0 : m.getLeadTime())
92
+                        .spplyItemId(m.getSpplyItemId() == null ? "" : m.getSpplyItemId())
93
+                        .unitStCd(m.getUnitStCd() == null ? "" : m.getUnitStCd())
94
+                        .unitStNm(m.getUnitStNm() == null ? "" : m.getUnitStNm())
95
+                        .stddQty(m.getStddQty() == null ? 0 : m.getStddQty())
93 96
                         .build())
94 97
                 .collect(Collectors.toList());
95 98
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
@@ -99,16 +102,16 @@ public class ItemUnitService extends CommonService {
99 102
       공급사단가 리스트 조회
100 103
 
101 104
      */
102
-    public GridResponse selectSpplyItemUnitGridList(String sBrandId, String fromDt, String toDt,String sUnitStCd, String sSpplyId, String sItemNm, GridRequest gridRequest) throws Exception {
105
+    public GridResponse selectSpplyItemUnitGridList(String sBrandId, String fromDt, String toDt, String sUnitStCd, String sSpplyId, String sItemNm, GridRequest gridRequest) throws Exception {
103 106
         int gridPage = gridRequest.getGridPage();
104 107
         int gridSize = gridRequest.getGridSize();
105 108
 
106 109
         fromDt = fromDt == null ? null : fromDt.replace(".", "");
107 110
         toDt = toDt == null ? null : toDt.replace(".", "");
108 111
 
109
-        int gridRecords = itemUnitMapper.selectItemUnitGridCnt( sBrandId, fromDt,  toDt, sUnitStCd, sSpplyId, "", "", "", "",sItemNm );
112
+        int gridRecords = itemUnitMapper.selectItemUnitGridCnt(sBrandId, fromDt, toDt, sUnitStCd, sSpplyId, "", "", "", "", sItemNm);
110 113
         int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
111
-        List<ItemUnitEntity> entities = itemUnitMapper.selectItemUnitGridList(sBrandId, fromDt,  toDt, sUnitStCd, sSpplyId, "", "", "", "",sItemNm, gridRequest);
114
+        List<ItemUnitEntity> entities = itemUnitMapper.selectItemUnitGridList(sBrandId, fromDt, toDt, sUnitStCd, sSpplyId, "", "", "", "", sItemNm, gridRequest);
112 115
         List<Object> gridRows = entities.stream()
113 116
                 .map(m -> ItemUnitSearchResponse.builder()
114 117
                         .viewCd("R")
@@ -118,38 +121,37 @@ public class ItemUnitService extends CommonService {
118 121
                         .itemNm(m.getItemNm())
119 122
                         .spplyId(m.getSpplyId())
120 123
                         .spplyNm(m.getSpplyNm())
121
-                        .contSttDt(m.getContSttDt() == null ? "" :m.getContSttDt())
122
-                        .contEndDt(m.getContEndDt() == null ? "" :m.getContEndDt())
123
-                        .curr(m.getCurr() == null ? "" :m.getCurr())
124
-                        .currNm(m.getCurrNm() == null ? "" :m.getCurrNm() )
125
-                        .unit(m.getUnit() == null ? "" :m.getUnit())
126
-                        .unitNm(m.getUnitNm() == null ? "" :m.getUnitNm())
127
-                        .unitAmt(m.getUnitAmt() == null ? 0 :m.getUnitAmt())
128
-                        .leadTime(m.getLeadTime() == null ? 0 :m.getLeadTime())
129
-                        .spplyItemId(m.getSpplyItemId() == null ? "" :m.getSpplyItemId())
130
-                        .unitStCd(m.getUnitStCd() == null ? "" :m.getUnitStCd())
131
-                        .unitStNm(m.getUnitStNm() == null ? "" :m.getUnitStNm())
132
-                        .stddQty(m.getStddQty() == null ? 0 :m.getStddQty() )
124
+                        .contSttDt(m.getContSttDt() == null ? "" : m.getContSttDt())
125
+                        .contEndDt(m.getContEndDt() == null ? "" : m.getContEndDt())
126
+                        .curr(m.getCurr() == null ? "" : m.getCurr())
127
+                        .currNm(m.getCurrNm() == null ? "" : m.getCurrNm())
128
+                        .unit(m.getUnit() == null ? "" : m.getUnit())
129
+                        .unitNm(m.getUnitNm() == null ? "" : m.getUnitNm())
130
+                        .unitAmt(m.getUnitAmt() == null ? 0 : m.getUnitAmt())
131
+                        .leadTime(m.getLeadTime() == null ? 0 : m.getLeadTime())
132
+                        .spplyItemId(m.getSpplyItemId() == null ? "" : m.getSpplyItemId())
133
+                        .unitStCd(m.getUnitStCd() == null ? "" : m.getUnitStCd())
134
+                        .unitStNm(m.getUnitStNm() == null ? "" : m.getUnitStNm())
135
+                        .stddQty(m.getStddQty() == null ? 0 : m.getStddQty())
133 136
                         .build())
134 137
                 .collect(Collectors.toList());
135 138
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
136 139
     }
137 140
 
138 141
 
139
-
140 142
     /* 공급사 단가 정보 */
141 143
     public ItemUnitInfoResponse selectItemUnitInfo(String brandId, String brandUnitUnqNo) throws Exception {
142 144
 
143
-        ItemUnitEntity entity = itemUnitMapper.selectItemUnitInfo( brandId, brandUnitUnqNo);
145
+        ItemUnitEntity entity = itemUnitMapper.selectItemUnitInfo(brandId, brandUnitUnqNo);
144 146
         List<FileEntity> fileContInfoList = null;
145 147
 
146 148
         if (!"".equals(entity.getShortContFileNo())) {
147
-            fileContInfoList = fileMapper.selectFileList(entity.getShortContFileNo()) ;
149
+            fileContInfoList = fileMapper.selectFileList(entity.getShortContFileNo());
148 150
         } else {
149 151
             fileContInfoList = new ArrayList<FileEntity>();
150 152
         }
151 153
 
152
-        return ItemUnitInfoResponse.toDTO(entity,fileContInfoList );
154
+        return ItemUnitInfoResponse.toDTO(entity, fileContInfoList);
153 155
 
154 156
     }
155 157
 
@@ -166,8 +168,8 @@ public class ItemUnitService extends CommonService {
166 168
             entity.setItemNm(saveItemUnitInfolRequest.getItemNm());
167 169
             entity.setSpplyId(saveItemUnitInfolRequest.getSpplyId());
168 170
             entity.setSpplyNm(saveItemUnitInfolRequest.getSpplyNm());
169
-            entity.setContSttDt(saveItemUnitInfolRequest.getContSttDt().replaceAll("\\.",""));
170
-            entity.setContEndDt(saveItemUnitInfolRequest.getContEndDt().replaceAll("\\.",""));
171
+            entity.setContSttDt(saveItemUnitInfolRequest.getContSttDt().replaceAll("\\.", ""));
172
+            entity.setContEndDt(saveItemUnitInfolRequest.getContEndDt().replaceAll("\\.", ""));
171 173
             entity.setCurr(saveItemUnitInfolRequest.getCurr());
172 174
             entity.setUnit(saveItemUnitInfolRequest.getUnit());
173 175
             entity.setUnitAmt(saveItemUnitInfolRequest.getUnitAmt());
@@ -189,7 +191,7 @@ public class ItemUnitService extends CommonService {
189 191
                     throw new GlobalException(SystemMessageCode.ERR_EXISTUNIT);
190 192
                 }
191 193
             } else {
192
-                String passChk = itemUnitMapper.selectItemUnitChaPass(entity.getBrandUnitUnqNo(),entity.getContSttDt());
194
+                String passChk = itemUnitMapper.selectItemUnitChaPass(entity.getBrandUnitUnqNo(), entity.getContSttDt());
193 195
 
194 196
                 if ("N".equals(passChk)) {
195 197
                     // 시작일은 변경 불가
@@ -217,7 +219,7 @@ public class ItemUnitService extends CommonService {
217 219
     /*
218 220
       브랜드 매장 단가 리스트 조회
219 221
      */
220
-    public GridResponse selectStoreItemUnitGridList(String userId, String sBrandId, String sStoreId,  String sStoreNm,  GridRequest gridRequest) throws Exception {
222
+    public GridResponse selectStoreItemUnitGridList(String userId, String sBrandId, String sStoreId, String sStoreNm, GridRequest gridRequest) throws Exception {
221 223
         int gridPage = gridRequest.getGridPage();
222 224
         int gridSize = gridRequest.getGridSize();
223 225
 
@@ -235,7 +237,7 @@ public class ItemUnitService extends CommonService {
235 237
         }
236 238
 
237 239
 
238
-        int gridRecords = storeItemUnitMapper.selectStoreItemUnitGridCnt( sBrandId, sStoreId, sStoreNm );
240
+        int gridRecords = storeItemUnitMapper.selectStoreItemUnitGridCnt(sBrandId, sStoreId, sStoreNm);
239 241
         int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
240 242
         List<StoreItemUnitEntity> entities = storeItemUnitMapper.selectStoreItemUnitGridList(sBrandId, sStoreId, sStoreNm, gridRequest);
241 243
         List<Object> gridRows = entities.stream()
@@ -287,7 +289,7 @@ public class ItemUnitService extends CommonService {
287 289
     /* 매장 단가 정보 */
288 290
     public StoreItemUnitInfoResponse selectStoreNewItemUnitInfo(String brandId) throws Exception {
289 291
 
290
-        List<StoreItemUnitEntity> entities = storeItemUnitMapper.selectStoreNewItemUnitInfo( brandId);
292
+        List<StoreItemUnitEntity> entities = storeItemUnitMapper.selectStoreNewItemUnitInfo(brandId);
291 293
         return StoreItemUnitInfoResponse.toDTO(entities);
292 294
 
293 295
     }
@@ -310,31 +312,29 @@ public class ItemUnitService extends CommonService {
310 312
         }
311 313
 
312 314
 
313
-        String brandId  = storeItemUnitInfolRequest.getBrandId();
314
-        String storeId  = storeItemUnitInfolRequest.getStoreId();
315
+        String brandId = storeItemUnitInfolRequest.getBrandId();
316
+        String storeId = storeItemUnitInfolRequest.getStoreId();
315 317
         String contSttDt = storeItemUnitInfolRequest.getContSttDt();
316 318
         String contEndDt = storeItemUnitInfolRequest.getContEndDt();
317 319
 
318 320
         contSttDt = contSttDt == null ? null : contSttDt.replace(".", "");
319 321
         contEndDt = contEndDt == null ? null : contEndDt.replace(".", "");
320 322
 
321
-        List<StoreItemUnitEntity> entities = storeItemUnitMapper.selectStoreItemUnitInfo( brandId, storeId, contSttDt, contEndDt);
323
+        List<StoreItemUnitEntity> entities = storeItemUnitMapper.selectStoreItemUnitInfo(brandId, storeId, contSttDt, contEndDt);
322 324
         return StoreItemUnitInfoResponse.toDTO(entities);
323 325
 
324 326
     }
325 327
 
326
-
327 328
     /* 매장 단가 저장 */
328 329
     @Transactional
329 330
     public void saveStroeItemUnitInfo(String userId, SaveStoreItemUnitInfolRequest saveStoreItemUnitInfolRequest) throws Exception {
330 331
         try {
331
-
332 332
             StoreItemUnitEntity entity = new StoreItemUnitEntity();
333 333
             entity.setBrandId(saveStoreItemUnitInfolRequest.getBrandId());
334 334
             entity.setStoreId(saveStoreItemUnitInfolRequest.getStoreId());
335 335
 
336
-            entity.setContSttDt(saveStoreItemUnitInfolRequest.getContSttDt().replaceAll("\\.",""));
337
-            entity.setContEndDt(saveStoreItemUnitInfolRequest.getContEndDt().replaceAll("\\.",""));
336
+            entity.setContSttDt(saveStoreItemUnitInfolRequest.getContSttDt().replaceAll("\\.", ""));
337
+            entity.setContEndDt(saveStoreItemUnitInfolRequest.getContEndDt().replaceAll("\\.", ""));
338 338
 
339 339
             //신규
340 340
             // 종료일짜 변경 여부 확인
@@ -350,23 +350,22 @@ public class ItemUnitService extends CommonService {
350 350
             List<StoreItemUnitEntity> gridUpdateData = saveStoreItemUnitInfolRequest.toCodeEntities(saveStoreItemUnitInfolRequest.getGridUpdateData());
351 351
             List<StoreItemUnitEntity> gridInsertData = saveStoreItemUnitInfolRequest.toCodeEntities(saveStoreItemUnitInfolRequest.getGridInsertData());
352 352
 
353
-
354 353
             if (gridInsertData.size() > 0) {
355 354
                 for (int k = 0; k < gridInsertData.size(); k++) {
356 355
                     if ("C".toString().equals(saveStoreItemUnitInfolRequest.getViewCd())) {
357 356
                         gridInsertData.get(k).setContSttDt(entity.getContSttDt());
358 357
                         gridInsertData.get(k).setContEndDt(entity.getContEndDt());
359 358
                     } else {
360
-                        gridInsertData.get(k).setContSttDt(gridInsertData.get(k).getContSttDt().replaceAll("\\.",""));
361
-                        gridInsertData.get(k).setContEndDt(gridInsertData.get(k).getContEndDt().replaceAll("\\.",""));
359
+                        gridInsertData.get(k).setContSttDt(gridInsertData.get(k).getContSttDt().replaceAll("\\.", ""));
360
+                        gridInsertData.get(k).setContEndDt(gridInsertData.get(k).getContEndDt().replaceAll("\\.", ""));
362 361
                     }
363 362
                 }
364 363
             }
365 364
 
366 365
             if (gridUpdateData.size() > 0) {
367 366
                 for (int k = 0; k < gridUpdateData.size(); k++) {
368
-                    gridUpdateData.get(k).setContSttDt(gridUpdateData.get(k).getContSttDt().replaceAll("\\.",""));
369
-                    gridUpdateData.get(k).setContEndDt(gridUpdateData.get(k).getContEndDt().replaceAll("\\.",""));
367
+                    gridUpdateData.get(k).setContSttDt(gridUpdateData.get(k).getContSttDt().replaceAll("\\.", ""));
368
+                    gridUpdateData.get(k).setContEndDt(gridUpdateData.get(k).getContEndDt().replaceAll("\\.", ""));
370 369
                 }
371 370
             }
372 371
 
@@ -383,11 +382,8 @@ public class ItemUnitService extends CommonService {
383 382
 
384 383
                 StoreItemUnitEntity dtEntity = storeItemUnitMapper.selectStoreItemUnitContDtInfo(entity.getBrandId(), entity.getStoreId());
385 384
 
386
-
387 385
                 if (dtEntity.getContSttDt() != null && !dtEntity.getContSttDt().equals("")) {
388 386
                     // 서로 상이하면 기존 종료일자는 전송시작일보다 클경우 오류
389
-
390
-
391 387
                     // 문자열 -> Date
392 388
                     Date dtEnddate = formatter.parse(dtEntity.getContEndDt());
393 389
                     Date sttdate = formatter.parse(entity.getContSttDt());
@@ -401,26 +397,26 @@ public class ItemUnitService extends CommonService {
401 397
             }
402 398
 
403 399
             if (gridInsertData.size() > 0) {
404
-                storeItemUnitMapper.insertStoreItemUnitInfo(userId, entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(),entity.getContEndDt(), gridInsertData) ;
400
+                storeItemUnitMapper.insertStoreItemUnitInfo(userId, entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(), entity.getContEndDt(), gridInsertData);
405 401
             }
406 402
 
407 403
             if (gridUpdateData.size() > 0) {
408
-
409
-                storeItemUnitMapper.updateStoreItemUnitInfo(userId, entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(),entity.getContEndDt(), gridUpdateData) ;
404
+                storeItemUnitMapper.updateStoreItemUnitInfo(userId, entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(), entity.getContEndDt(), gridUpdateData);
410 405
             }
411 406
 
412
-
413 407
             // 수정에 대해 날짜 변동시 전체 변동처리함
414 408
             if ("Y".toString().equals(chgEndDtYn)) {
415
-                storeItemUnitMapper.updateStoreItemUnitChgContEnd(entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(), entity.getContEndDt() );
409
+                storeItemUnitMapper.updateStoreItemUnitChgContEnd(entity.getBrandId(), entity.getStoreId(), entity.getContSttDt(), entity.getContEndDt());
416 410
             }
417 411
 
418 412
             //selectStoreItemUnitEndDtInfo  , updateStoreItemUnitChgContEnd
413
+
414
+            // TODO 오더퀸 연동
415
+
419 416
         } catch (GlobalException e) {
420 417
             e.getStackTrace();
421 418
             throw new GlobalException(e.getSystemMessageCode());
422 419
         } catch (Exception e) {
423
-//            e.getStackTrace();
424 420
             e.printStackTrace();
425 421
             throw new RuntimeException();
426 422
         }

Plik diff jest za duży
+ 3 - 6
src/main/java/com/oqpo/api/web/controller/stinfo/ItemUnitController.java