Selaa lähdekoodia

위시리스트 마스터 저장

dwkim 2 vuotta sitten
vanhempi
commit
52db1182b9

+ 12 - 5
src/main/java/com/oqpo/api/service/pomng/PchReqService.java

@@ -541,16 +541,23 @@ public class PchReqService extends CommonService {
541 541
  
542 542
     /* 위시리스트 마스터 저장 */
543 543
     @Transactional
544
-    public String saveWishListRequest(String userId, String wishlistMgntNo, String wishlistNm, String storeId, String delYn) throws Exception {
545
-        try { 
544
+    public WishMasterSaveResponse saveWishListMaster(String userId, String wishlistMgntNo, String wishlistNm, String storeId, String delYn) throws Exception {
545
+        try { //PchWishListEntity
546 546
             
547
-            if (wishlistMgntNo == null || "".equals(wishlistMgntNo)) { 
548
-                wishlistMgntNo = pchReqMapper.selectWishListMgntNo();
547
+            if (wishlistMgntNo == null || "".equals(wishlistMgntNo)) {
548
+                wishlistMgntNo = fnGetDealNo(37,"");
549 549
                 System.out.println("saveWishListRequest wishlistMgntNo=="+wishlistMgntNo+" wishlistNm=="+wishlistNm+" storeId="+storeId);
550 550
                 pchReqMapper.saveWishListRequest(userId, wishlistMgntNo, wishlistNm, storeId, delYn);
551 551
             } else {
552 552
                 pchReqMapper.updateWishListRequest(userId, wishlistMgntNo, wishlistNm, storeId, delYn);
553 553
             }
554
+
555
+            PchWishListEntity entity = new PchWishListEntity();
556
+            entity.setWishlistMgntNo(wishlistMgntNo);
557
+            entity.setWishlistNm(wishlistNm);
558
+
559
+            return WishMasterSaveResponse.toDTO(entity );
560
+
554 561
         } catch (GlobalException e) {
555 562
             e.getStackTrace();
556 563
             throw new GlobalException(e.getSystemMessageCode());
@@ -558,7 +565,7 @@ public class PchReqService extends CommonService {
558 565
             e.getStackTrace();
559 566
             throw new RuntimeException();
560 567
         }
561
-        return wishlistMgntNo;
568
+
562 569
     }
563 570
 
564 571
     /* 위시리시트 품목 저장 */

+ 10 - 8
src/main/java/com/oqpo/api/web/controller/pomng/PchReqController.java

@@ -10,6 +10,7 @@ import com.oqpo.api.web.dto.response.SelectResponse;
10 10
 import com.oqpo.api.web.dto.response.pomng.pchReq.PchReqInfoResponse;
11 11
 import com.oqpo.api.web.dto.response.pomng.pchReq.PchReqInitInfoResponse;
12 12
 import com.oqpo.api.web.dto.response.pomng.pchReq.PchReqRejectTargetResponse;
13
+import com.oqpo.api.web.dto.response.pomng.pchReq.WishMasterSaveResponse;
13 14
 import io.swagger.annotations.Api;
14 15
 import io.swagger.annotations.ApiImplicitParam;
15 16
 import io.swagger.annotations.ApiImplicitParams;
@@ -193,20 +194,21 @@ public class PchReqController {
193 194
             @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
194 195
             @ApiImplicitParam(name = "wishlistMgntNo", value = "위시리스트번호", required = false, dataType = "String", paramType = "query"),
195 196
             @ApiImplicitParam(name = "wishlistNm", value = "위시리스트명", required = true, dataType = "String", paramType = "query"),
196
-            @ApiImplicitParam(name = "storeId", value = "매장코드", required = true, dataType = "String", paramType = "query") 
197
+            @ApiImplicitParam(name = "storeId", value = "매장코드", required = true, dataType = "String", paramType = "query"),
198
+            @ApiImplicitParam(name = "delYn", value = "삭제여부", required = true, dataType = "String", paramType = "query")
197 199
     })
198 200
     @ApiOperation(value = "위시리스트 마스터 저장")
199 201
     @PostMapping("/save-wishlist")
200
-    public ResponseEntity<MessageResponse> saveWishListRequest(@ApiIgnore String userId, 
201
-        @RequestParam(value = "wishlistMgntNo", required = false) String wishlistMgntNo,
202
-        @RequestParam(value = "wishlistNm") String wishlistNm, 
203
-        @RequestParam(value = "storeId") String storeId,
204
-        @RequestParam(value = "delYn") String delYn
202
+    public ResponseEntity<WishMasterSaveResponse> saveWishListRequest(@ApiIgnore String userId,
203
+                                      @RequestParam(value = "wishlistMgntNo", required = false) String wishlistMgntNo,
204
+                                      @RequestParam(value = "wishlistNm") String wishlistNm,
205
+                                      @RequestParam(value = "storeId") String storeId,
206
+                                      @RequestParam(value = "delYn") String delYn
205 207
     ) throws Exception {
206
-        String result = pchReqService.saveWishListRequest(userId, wishlistMgntNo, wishlistNm, storeId, delYn );
207
-        return ResponseEntity.ok(MessageResponse.toDTO("ok",result));
208
+        return ResponseEntity.ok(pchReqService.saveWishListMaster(userId, wishlistMgntNo, wishlistNm, storeId, delYn ));
208 209
     }
209 210
 
211
+
210 212
     
211 213
     /**
212 214
      * 설명 : 위시리스트 품목조회

+ 37 - 0
src/main/java/com/oqpo/api/web/dto/response/pomng/pchReq/WishMasterSaveResponse.java

@@ -0,0 +1,37 @@
1
+package com.oqpo.api.web.dto.response.pomng.pchReq;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
5
+import com.oqpo.api.entity.oper.UserMngEntity;
6
+import com.oqpo.api.entity.pomng.PchReqBaseInfoEntity;
7
+import com.oqpo.api.entity.pomng.PchReqDtlPtclEntity;
8
+import com.oqpo.api.entity.pomng.PchWishListEntity;
9
+import com.oqpo.api.entity.stinfo.BrandEntity;
10
+import io.swagger.annotations.ApiModelProperty;
11
+import lombok.*;
12
+
13
+import java.util.List;
14
+import java.util.stream.Collectors;
15
+
16
+
17
+@Getter
18
+@Setter
19
+@Builder
20
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
21
+@JsonInclude(JsonInclude.Include.ALWAYS)
22
+public class WishMasterSaveResponse {
23
+
24
+    @ApiModelProperty(value = "위시리스트번호") private String wishlistMgntNo;
25
+    @ApiModelProperty(value = "위시리스트명") private String wishlistNm;
26
+
27
+
28
+    public static WishMasterSaveResponse toDTO( PchWishListEntity entity ) {
29
+        if (entity == null) return null;
30
+        return WishMasterSaveResponse.builder()
31
+                .wishlistMgntNo(entity.getWishlistMgntNo())
32
+                .wishlistNm(entity.getWishlistNm() == null ? "" :entity.getWishlistNm())
33
+                .build();
34
+    }
35
+
36
+
37
+}