Pārlūkot izejas kodu

매장정보 인터페이스 생성 작업

dwkim 2 gadi atpakaļ
vecāks
revīzija
d27611335f

+ 3 - 0
src/main/java/com/oqpo/api/entity/stinfo/StoreBaseInfoEntity.java

@@ -58,6 +58,9 @@ public class StoreBaseInfoEntity implements Serializable {
58 58
     private String whsUseYn;
59 59
     private String owacNm;
60 60
 
61
+    private String code;
62
+    private String message;
63
+
61 64
     private LoanInfoEntity loanInfo ;
62 65
     private BrandEntity brandInfo;
63 66
 }

+ 44 - 0
src/main/java/com/oqpo/api/enums/IfCode.java

@@ -0,0 +1,44 @@
1
+package com.oqpo.api.enums;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+public enum IfCode {
7
+
8
+    S01("21000", "정상처리되었습니다."), //
9
+    ;
10
+
11
+    IfCode(String cd, String nm) {
12
+        this.cd = cd;
13
+        this.name = nm;
14
+    }
15
+
16
+    @Getter
17
+    @Setter
18
+    private String cd;
19
+
20
+    @Getter
21
+    @Setter
22
+    private String name;
23
+
24
+    public static String getCd(String nname) {
25
+        IfCode[] values = IfCode.values();
26
+        for (IfCode icd : values) {
27
+            if (icd.name.equals(nname)) {
28
+                return icd.cd;
29
+            }
30
+        }
31
+        return nname;
32
+    }
33
+
34
+    public static String getName(String ccd) {
35
+        IfCode[] values = IfCode.values();
36
+        for (IfCode icd : values) {
37
+            if (icd.cd.equals(ccd)) {
38
+                return icd.name;
39
+            }
40
+        }
41
+        return ccd;
42
+    }
43
+
44
+}

+ 3 - 0
src/main/java/com/oqpo/api/mapper/stinfo/StoreBaseInfoMapper.java

@@ -29,4 +29,7 @@ public interface StoreBaseInfoMapper {
29 29
 
30 30
     String selectStoreLoanMgntUnqNo( @Param("storeId") String storeId)throws Exception;
31 31
 
32
+    int updateBoStoreChgInfo(@Param("userId") String userId, StoreBaseInfoEntity entity) throws Exception;
33
+
34
+
32 35
 }

+ 144 - 0
src/main/java/com/oqpo/api/service/stinfo/StoreBaseInfoService.java

@@ -6,6 +6,7 @@ import com.oqpo.api.entity.oper.UserMngEntity;
6 6
 import com.oqpo.api.entity.stinfo.StoreBaseInfoEntity;
7 7
 import com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity;
8 8
 import com.oqpo.api.entity.stockmng.WhsMgntBaseLocEntity;
9
+import com.oqpo.api.enums.IfCode;
9 10
 import com.oqpo.api.exception.GlobalException;
10 11
 import com.oqpo.api.mapper.loan.LoanMgntMapper;
11 12
 import com.oqpo.api.mapper.oper.UserMngMapper;
@@ -14,9 +15,11 @@ import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
14 15
 import com.oqpo.api.service.CommonService;
15 16
 import com.oqpo.api.service.stockmng.WhsMngService;
16 17
 import com.oqpo.api.web.dto.request.GridRequest;
18
+import com.oqpo.api.web.dto.request.ifmng.BoStoreChgInfoRequest;
17 19
 import com.oqpo.api.web.dto.request.stinfo.store.SaveStoreInfolRequest;
18 20
 import com.oqpo.api.web.dto.request.stockmng.SaveWhsInfoRequest;
19 21
 import com.oqpo.api.web.dto.response.GridResponse;
22
+import com.oqpo.api.web.dto.response.ifmng.BoStoreChgInfoResponse;
20 23
 import com.oqpo.api.web.dto.response.stinfo.store.StoreInfoResponse;
21 24
 import com.oqpo.api.web.dto.response.stinfo.store.StorePopSearchResponse;
22 25
 import com.oqpo.api.web.dto.response.stinfo.store.StoreSearchListResponse;
@@ -419,4 +422,145 @@ public class StoreBaseInfoService extends CommonService {
419 422
         }
420 423
     }
421 424
 
425
+
426
+    /*
427
+   오피스 매장변경 정보 수신
428
+   */
429
+    @Transactional
430
+    public BoStoreChgInfoResponse ifBoSaveChgStore(String userId, BoStoreChgInfoRequest boStoreChgInfoRequest) throws Exception {
431
+        // 매장 변경정보 저장
432
+        try {
433
+            StoreBaseInfoEntity storeChgInfo = new StoreBaseInfoEntity();
434
+
435
+            StoreBaseInfoEntity oldStoreInfo = storeBaseInfoMapper.selectStoreInfo(boStoreChgInfoRequest.getBrandId(), boStoreChgInfoRequest.getStoreId()) ;
436
+
437
+            if ("1".toString().equals(boStoreChgInfoRequest.getStoreType())) {
438
+                storeChgInfo.setStoreDvsn("S01");
439
+            } else if ("2".toString().equals(boStoreChgInfoRequest.getStoreType())) {
440
+                storeChgInfo.setStoreDvsn("S02");
441
+            } else if ("3".toString().equals(boStoreChgInfoRequest.getStoreType())) {
442
+                storeChgInfo.setStoreDvsn("S03");
443
+            }
444
+            String chgStatus = "N";  // Y 사용으로 변경
445
+
446
+
447
+            if ("1".toString().equals(boStoreChgInfoRequest.getStoreStatus())) {
448
+                if ("ST02".equals(oldStoreInfo.getStoreStCd())) {
449
+                    storeChgInfo.setStoreStCd("ST01");
450
+                    chgStatus = "Y";
451
+                } else if ("ST03".equals(oldStoreInfo.getStoreStCd())) {
452
+                    storeChgInfo.setStoreStCd("ST01");
453
+                    chgStatus = "Y";
454
+                } else {
455
+                    storeChgInfo.setStoreStCd("ST01");
456
+                    chgStatus = "N"; // 수정안함
457
+                }
458
+            } else if ("2".toString().equals(boStoreChgInfoRequest.getStoreStatus())) {
459
+                if ("ST01".equals(oldStoreInfo.getStoreStCd())) {
460
+                    storeChgInfo.setStoreStCd("ST02");
461
+                    chgStatus = "Y";
462
+                    // 사용자상태값만 보류처리
463
+                } else if ("ST03".equals(oldStoreInfo.getStoreStCd())) {
464
+                    storeChgInfo.setStoreStCd("ST02");
465
+                    chgStatus = "Y";
466
+                    // 사용자상태값은 보류처리
467
+                } else {
468
+                    storeChgInfo.setStoreStCd("ST02");
469
+                    chgStatus = "N"; // 수정안함
470
+                    // 수정안함
471
+                }
472
+            } else if ("9".toString().equals(boStoreChgInfoRequest.getStoreStatus())) {
473
+                if ("ST01".equals(oldStoreInfo.getStoreStCd())) {
474
+                    storeChgInfo.setStoreStCd("ST03");
475
+                    chgStatus = "Y";
476
+                    // 사용자상태값만 보류처리
477
+                } else if ("ST02".equals(oldStoreInfo.getStoreStCd())) {
478
+                    storeChgInfo.setStoreStCd("ST03");
479
+                    chgStatus = "Y";
480
+                    // 사용자상태값은 보류처리
481
+                } else {
482
+                    storeChgInfo.setStoreStCd("ST03");
483
+                    chgStatus = "N";
484
+                    // 수정안함
485
+                }
486
+            }
487
+
488
+            storeChgInfo.setStoreNm(boStoreChgInfoRequest.getStoreNm() );
489
+            storeChgInfo.setBsnsRegNo(boStoreChgInfoRequest.getBizNo() );
490
+            storeChgInfo.setBsnsCndt(boStoreChgInfoRequest.getBizCat() );
491
+            storeChgInfo.setCtgrBsns(boStoreChgInfoRequest.getBizCon() );
492
+            storeChgInfo.setOwnerNm(boStoreChgInfoRequest.getOwnerNm() );
493
+            storeChgInfo.setTelNo(boStoreChgInfoRequest.getTel().replaceAll("\\-",""));
494
+            storeChgInfo.setMblNo(boStoreChgInfoRequest.getCell().replaceAll("\\-",""));
495
+            storeChgInfo.setFaxNo(boStoreChgInfoRequest.getFax().replaceAll("\\-",""));
496
+            storeChgInfo.setEmalAddr(boStoreChgInfoRequest.getEmail() );
497
+            storeChgInfo.setZipNo(boStoreChgInfoRequest.getZipNo() );
498
+            storeChgInfo.setAddr1(boStoreChgInfoRequest.getAddr1() );
499
+            storeChgInfo.setAddr2(boStoreChgInfoRequest.getAddr2() );
500
+            storeChgInfo.setAreaCd(boStoreChgInfoRequest.getAreaCd() );
501
+            storeChgInfo.setOpenDt(boStoreChgInfoRequest.getOpenDate().replaceAll("\\.",""));
502
+            if (boStoreChgInfoRequest.getCloseDate() != null && !"".equals(boStoreChgInfoRequest.getCloseDate())) {
503
+                storeChgInfo.setCloseDt(boStoreChgInfoRequest.getCloseDate().replaceAll("\\.",""));
504
+            } else  {
505
+                storeChgInfo.setCloseDt(null);
506
+            }
507
+            storeChgInfo.setDelYn("Y".toString().equals(boStoreChgInfoRequest.getUseYn()) ? "N" : "Y");
508
+            storeChgInfo.setOqBrandId(boStoreChgInfoRequest.getBrandCd() );
509
+            storeChgInfo.setOqStoreId(boStoreChgInfoRequest.getStoreNo() );
510
+            storeChgInfo.setBrandId(boStoreChgInfoRequest.getBrandId() );
511
+            storeChgInfo.setStoreId(boStoreChgInfoRequest.getStoreId() );
512
+
513
+            storeBaseInfoMapper.updateBoStoreChgInfo(userId,storeChgInfo );
514
+
515
+            if ("Y".toString().equals(chgStatus)) {
516
+                //사용자정보
517
+                UserMngEntity userUEntity = new UserMngEntity();
518
+                userUEntity.setUserId(storeChgInfo.getStoreId());
519
+                userUEntity.setTelNo(storeChgInfo.getMblNo());
520
+                userUEntity.setEmail(storeChgInfo.getEmalAddr());
521
+                userUEntity.setUserNm(storeChgInfo.getOwnerNm());
522
+
523
+                if ("ST01".equals(storeChgInfo.getStoreStCd())) {
524
+                    userUEntity.setUserStatCd("10");
525
+                } else if ("ST02".equals(storeChgInfo.getStoreStCd())) {
526
+                    userUEntity.setUserStatCd("30");
527
+                } else if ("ST03".equals(storeChgInfo.getStoreStCd())) {
528
+                    userUEntity.setUserStatCd("90");
529
+                }
530
+                userMngMapper.updateUserInfo(userId, userUEntity);
531
+
532
+
533
+                // 창고정보 변동 처리  whs_use_yn
534
+                String whsStCd = "";
535
+                String locStCd = "";
536
+
537
+                if ("ST03".equals(storeChgInfo.getStoreStCd())) {
538
+                    // 매장 폐점  == > 매장창고 폐점 처리함
539
+                    whsStCd = "W003";
540
+                    locStCd = "LOC003";
541
+                } else if ("ST01".equals(storeChgInfo.getStoreStCd())) {
542
+                    whsStCd = "W001";
543
+                    locStCd = "LOC001";
544
+                } else if ("ST02".equals(storeChgInfo.getStoreStCd())) {
545
+                    whsStCd = "W002";
546
+                    locStCd = "LOC002";
547
+                }
548
+
549
+                whsMngService.chgStatusStoreWhsInfo(userId, storeChgInfo.getBrandId(), storeChgInfo.getStoreId(), whsStCd, locStCd);
550
+
551
+            }  //DpstStCd.DPST_REQ.getCd()
552
+            storeChgInfo.setCode(IfCode.S01.getCd());
553
+            storeChgInfo.setMessage(IfCode.S01.getName());
554
+
555
+
556
+            return BoStoreChgInfoResponse.toDTO(storeChgInfo);
557
+        } catch (GlobalException e) {
558
+            e.getStackTrace();
559
+            throw new GlobalException(e.getSystemMessageCode());
560
+        } catch (Exception e) {
561
+            e.getStackTrace();
562
+            throw new RuntimeException();
563
+        }
564
+    }
565
+
422 566
 }

+ 51 - 0
src/main/java/com/oqpo/api/web/controller/ifmng/IfMngController.java

@@ -0,0 +1,51 @@
1
+package com.oqpo.api.web.controller.ifmng;
2
+
3
+import com.oqpo.api.enums.SystemMessageCode;
4
+import com.oqpo.api.service.stinfo.StoreBaseInfoService;
5
+import com.oqpo.api.web.dto.request.ifmng.BoStoreChgInfoRequest;
6
+import com.oqpo.api.web.dto.request.stinfo.store.SaveStoreInfolRequest;
7
+import com.oqpo.api.web.dto.request.stinfo.store.StorePopGridRequest;
8
+import com.oqpo.api.web.dto.request.stinfo.store.StoreSearchGridRequest;
9
+import com.oqpo.api.web.dto.response.GridResponse;
10
+import com.oqpo.api.web.dto.response.SaveResponse;
11
+import com.oqpo.api.web.dto.response.ifmng.BoStoreChgInfoResponse;
12
+import com.oqpo.api.web.dto.response.stinfo.store.StoreInfoResponse;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import lombok.extern.slf4j.Slf4j;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.http.ResponseEntity;
20
+import org.springframework.web.bind.annotation.*;
21
+import springfox.documentation.annotations.ApiIgnore;
22
+
23
+import javax.validation.Valid;
24
+
25
+@Slf4j
26
+@RestController
27
+@RequestMapping("/api/interface")
28
+@Api(tags = {"인터페이스 관리 (StoreController)"})
29
+public class IfMngController {
30
+    @Autowired
31
+    private StoreBaseInfoService storeBaseInfoService;
32
+
33
+    /**
34
+     * 설명 : 백오피스 매장변경 정보 수신
35
+     *
36
+     * @param boStoreChgInfoRequest
37
+     * @return
38
+     * @throws Exception
39
+     */
40
+    @ApiImplicitParams({
41
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
42
+    })
43
+    @ApiOperation(value = "오피스 매장변경 정보 수신")
44
+    @PostMapping("/save-item")
45
+    public ResponseEntity<BoStoreChgInfoResponse> saveStore(@ApiIgnore String userId, @RequestBody @Valid BoStoreChgInfoRequest boStoreChgInfoRequest) throws Exception {
46
+        return ResponseEntity.ok(storeBaseInfoService.ifBoSaveChgStore(userId, boStoreChgInfoRequest));
47
+    }
48
+
49
+
50
+
51
+}

+ 1 - 1
src/main/java/com/oqpo/api/web/controller/stinfo/StoreController.java

@@ -29,7 +29,7 @@ import javax.validation.Valid;
29 29
 @Slf4j
30 30
 @RestController
31 31
 @RequestMapping("/api/store")
32
-@Api(tags = {"매장 관리 (StoreController) -- 완료"})
32
+@Api(tags = {"매장 관리 (StoreController)"})
33 33
 public class StoreController {
34 34
     @Autowired
35 35
     private StoreBaseInfoService storeBaseInfoService;

+ 82 - 0
src/main/java/com/oqpo/api/web/dto/request/ifmng/BoStoreChgInfoRequest.java

@@ -0,0 +1,82 @@
1
+package com.oqpo.api.web.dto.request.ifmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.Setter;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+
9
+@Getter
10
+@Setter
11
+public class BoStoreChgInfoRequest {
12
+
13
+    @NotBlank
14
+    @ApiModelProperty(value = "브랜드아이디")
15
+    private String brandCd;
16
+
17
+    @NotBlank
18
+    @ApiModelProperty(value = "매장아이디")
19
+    private String storeNo;
20
+
21
+    @NotBlank
22
+    @ApiModelProperty(value = "수발주 브랜드아이디")
23
+    private String brandId;
24
+
25
+    @NotBlank
26
+    @ApiModelProperty(value = "수발주 매장아이디")
27
+    private String storeId;
28
+
29
+    @ApiModelProperty(value = "매장형태 (1:체인직영,2:체인가맹,3:단독매장)")
30
+    private String storeType;
31
+
32
+    @ApiModelProperty(value = "매장상태 (1:오픈,2:보류,9:폐점)")
33
+    private String storeStatus;
34
+
35
+    @ApiModelProperty(value = "매장명")
36
+    private String storeNm;
37
+
38
+    @ApiModelProperty(value = "사업자번호")
39
+    private String bizNo;
40
+
41
+    @ApiModelProperty(value = "업태")
42
+    private String bizCat;
43
+
44
+    @ApiModelProperty(value = "업종")
45
+    private String bizCon;
46
+
47
+    @ApiModelProperty(value = "대표자")
48
+    private String ownerNm;
49
+
50
+    @ApiModelProperty(value = "전화번호")
51
+    private String tel;
52
+
53
+    @ApiModelProperty(value = "휴대번호")
54
+    private String cell;
55
+
56
+    @ApiModelProperty(value = "팩스")
57
+    private String fax;
58
+
59
+    @ApiModelProperty(value = "이메일")
60
+    private String email;
61
+
62
+    @ApiModelProperty(value = "우편번호")
63
+    private String zipNo;
64
+
65
+    @ApiModelProperty(value = "주소1(기본주소)")
66
+    private String addr1;
67
+
68
+    @ApiModelProperty(value = "주소2(상세주소)")
69
+    private String addr2;
70
+
71
+    @ApiModelProperty(value = "지역코드")
72
+    private String areaCd;
73
+
74
+    @ApiModelProperty(value = "오픈일")
75
+    private String openDate;
76
+
77
+    @ApiModelProperty(value = "폐점일")
78
+    private String closeDate;
79
+
80
+    @ApiModelProperty(value = "사용여부 - Y")
81
+    private String useYn;
82
+}

+ 46 - 0
src/main/java/com/oqpo/api/web/dto/response/ifmng/BoStoreChgInfoResponse.java

@@ -0,0 +1,46 @@
1
+package com.oqpo.api.web.dto.response.ifmng;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.stinfo.StoreBaseInfoEntity;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.*;
7
+
8
+
9
+@Getter
10
+@Setter
11
+@Builder
12
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
13
+@JsonInclude(JsonInclude.Include.ALWAYS)
14
+public class BoStoreChgInfoResponse {
15
+
16
+    @ApiModelProperty(value = "결과코드")
17
+    private String code;
18
+
19
+    @ApiModelProperty(value = "결과메세지")
20
+    private String message;
21
+
22
+    @ApiModelProperty(value = "브랜드코드")
23
+    private String brandCd;
24
+
25
+    @ApiModelProperty(value = "매장번호")
26
+    private String storeNo;
27
+
28
+    @ApiModelProperty(value = "수발주브랜드아이디")
29
+    private String brandId;
30
+
31
+    @ApiModelProperty(value = "수발주매장아이디")
32
+    private String storeId;
33
+
34
+
35
+    public static BoStoreChgInfoResponse toDTO(StoreBaseInfoEntity entity) {
36
+        if (entity == null) return null;
37
+        return BoStoreChgInfoResponse.builder()
38
+                .code(entity.getCode())
39
+                .message(entity.getMessage() == null ? "" : entity.getMessage())
40
+                .brandCd(entity.getOqBrandId() == null ? "" : entity.getOqBrandId())
41
+                .storeNo(entity.getOqStoreId() == null ? "" : entity.getOqStoreId())
42
+                .brandId(entity.getBrandId() == null ? "" : entity.getBrandId())
43
+                .storeId(entity.getStoreId() == null ? "" : entity.getStoreId())
44
+                .build();
45
+    }
46
+}

+ 29 - 0
src/main/resources/mybatis/sqlmaps/stinfo/Store.xml

@@ -233,4 +233,33 @@
233 233
          and   use_yn = 'Y'
234 234
     </select>
235 235
 
236
+    <update id="updateBoStoreChgInfo">
237
+        update store_base_info
238
+        set sys_chg_dttm	= now()
239
+            ,sys_chg_id	    = #{userId}
240
+            ,store_dvsn     = #{entity.storeDvsn}
241
+            ,store_st_cd    = #{entity.storeStCd}
242
+            ,store_nm       = #{entity.storeNm}
243
+            ,bsns_reg_no    = #{entity.bsnsRegNo}
244
+            ,bsns_cndt      = #{entity.bsnsCndt}
245
+            ,ctgr_bsns      = #{entity.ctgrBsns}
246
+            ,owner_nm       = #{entity.ownerNm}
247
+            ,tel_no         = #{entity.telNo}
248
+            ,mbl_no         = #{entity.mblNo}
249
+            ,fax_no         = #{entity.faxNo}
250
+            ,emal_addr      = #{entity.emalAddr}
251
+            ,zip_no         = #{entity.zipNo}
252
+            ,addr1          = #{entity.addr1}
253
+            ,addr2          = #{entity.addr2}
254
+            ,area_cd        = #{entity.areaCd}
255
+            ,open_dt        = #{entity.openDt}
256
+            ,close_dt       = #{entity.closeDt}
257
+            ,del_yn         = #{entity.delYn}
258
+            ,oq_brand_id    = #{entity.oqBrandId}
259
+            ,oq_store_id    = #{entity.oqStoreId}
260
+        where brand_id = #{entity.brandId}
261
+        and   store_id = #{entity.storeId}
262
+    </update>
263
+
264
+
236 265
 </mapper>

+ 1 - 1
src/main/resources/mybatis/sqlmaps/stockmng/StockMng.xml

@@ -7,7 +7,7 @@
7 7
         /* StockMngMapper.selectStockMngGridList */
8 8
         SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
9 9
             C.store_id, FN_STORE_NM(A.brand_id, C.store_id) AS store_nm,
10
-            A.whs_id, C.whs_nm, A.location, D.location_nm, A.item_id, E.item_nm, A.unit, A.stck_qty, A.prp_stck_qty,
10
+            A.whs_id, C.whs_nm, A.location, D.location_nm, A.item_id, E.item_nm, E.unit, A.stck_qty, A.prp_stck_qty,
11 11
             A.sft_stck_rt, A.cur_stck_rt
12 12
         FROM stck_mgnt_base_info A
13 13
         INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id