浏览代码

백오피스 연동 - 매장정보 변경시

marseyes 2 年之前
父节点
当前提交
ce6f3a8a39

+ 2 - 4
src/main/java/com/oqpo/api/enums/SystemMessageCode.java

@@ -31,6 +31,8 @@ public enum SystemMessageCode {
31 31
     COL_OK (20025, "수거지시 처리되었습니다.", HttpStatus.OK),
32 32
     RTN_PROC_OK (20026, "반품처리 되었습니다.", HttpStatus.OK),
33 33
     BO_IF_OK (21000, "정상처리 되었습니다.", HttpStatus.OK),
34
+    BO_IF_PART_FAIL (21001, "일부 미등록 처리 되었습니다.", HttpStatus.INTERNAL_SERVER_ERROR),
35
+    BO_IF_ALL_FAIL (21002, "전체 미등록 처리 되었습니다.", HttpStatus.INTERNAL_SERVER_ERROR),
34 36
     ERR_PW(40001, "현재의 비밀번호가 틀립니다. ", HttpStatus.BAD_REQUEST),
35 37
     ERR_FIND_ID(40002, "입력하신  정보로 등록된 아이디가 없습니다.", HttpStatus.BAD_REQUEST),
36 38
     ERR_FIND_PW(40003, "입력하신  정보로 등록된 아이디가 없습니다.", HttpStatus.BAD_REQUEST),
@@ -76,20 +78,16 @@ public enum SystemMessageCode {
76 78
     ERR_NON_BASE_WHS (40042, "창고관리에서 기본창고를 지정해주세요!", HttpStatus.BAD_REQUEST),
77 79
     ;
78 80
 
79
-
80
-
81 81
     private int id;
82 82
     private String message;
83 83
     private HttpStatus httpStatus;
84 84
 
85
-
86 85
     SystemMessageCode(int id, String message, HttpStatus httpStatus) {
87 86
         this.id = id;
88 87
         this.message = message;
89 88
         this.httpStatus = httpStatus;
90 89
     }
91 90
 
92
-
93 91
     public static SystemMessageCode valueOf(Integer id) {
94 92
         for (SystemMessageCode e : SystemMessageCode.values()) {
95 93
             if (id == e.getId()) {

+ 14 - 7
src/main/java/com/oqpo/api/service/stinfo/StoreBaseInfoService.java

@@ -3,6 +3,7 @@ package com.oqpo.api.service.stinfo;
3 3
 
4 4
 import com.oqpo.api.client.oqlink.OqlinkClient;
5 5
 import com.oqpo.api.client.oqlink.dto.OqScmStoreChangeReqModel;
6
+import com.oqpo.api.client.oqlink.dto.OqScmStoreChangeResModel;
6 7
 import com.oqpo.api.client.oqlink.util.HmacUtil;
7 8
 import com.oqpo.api.entity.loan.LoanInfoEntity;
8 9
 import com.oqpo.api.entity.oper.UserMngEntity;
@@ -12,6 +13,7 @@ import com.oqpo.api.entity.stockmng.WhsMgntBaseLocEntity;
12 13
 import com.oqpo.api.enums.IfCode;
13 14
 import com.oqpo.api.enums.StoreDvsn;
14 15
 import com.oqpo.api.enums.StoreStCd;
16
+import com.oqpo.api.enums.SystemMessageCode;
15 17
 import com.oqpo.api.exception.GlobalException;
16 18
 import com.oqpo.api.mapper.loan.LoanMgntMapper;
17 19
 import com.oqpo.api.mapper.oper.UserMngMapper;
@@ -392,8 +394,13 @@ public class StoreBaseInfoService extends CommonService {
392 394
 
393 395
             // TODO 백오피스 연동 (store_base_info 테이블 참조)
394 396
             StoreBaseInfoEntity infoEntity = storeBaseInfoMapper.selectStoreInfo(saveStoreInfolRequest.getBrandId(), saveStoreInfolRequest.getStoreId());
395
-            OqScmStoreChangeReqModel req = toOqScmStoreChangeReqModel(infoEntity);
396
-            oqlinkClient.changeScmStore(HmacUtil.makeHmacValue4OqLink(req), req);
397
+            if (!StringUtil.isEmpty(infoEntity.getOqBrandId()) && !StringUtil.isEmpty(infoEntity.getOqStoreId())) {
398
+                OqScmStoreChangeReqModel req = toOqScmStoreChangeReqModel(infoEntity);
399
+                OqScmStoreChangeResModel result = oqlinkClient.changeScmStore(HmacUtil.makeHmacValue4OqLink(req), req);
400
+                if (SystemMessageCode.BO_IF_OK.getId() != Integer.parseInt(result.getCode())) {
401
+                    throw new GlobalException(SystemMessageCode.valueOf(Integer.valueOf(result.getCode())));
402
+                }
403
+            }
397 404
         } catch (GlobalException e) {
398 405
             e.printStackTrace();
399 406
             throw new GlobalException(e.getSystemMessageCode());
@@ -416,16 +423,16 @@ public class StoreBaseInfoService extends CommonService {
416 423
         req.setBizCat(infoEntity.getBsnsCndt()); // 업태
417 424
         req.setBizCon(infoEntity.getCtgrBsns()); // 업종
418 425
         req.setOwnerNm(infoEntity.getOwnerNm()); // 대표자
419
-        req.setTel(infoEntity.getTelNo()); // 전화번호
420
-        req.setCell(infoEntity.getMblNo()); // 휴대번호
421
-        req.setFax(infoEntity.getFaxNo()); // 팩스
426
+        req.setTel(infoEntity.getTelNo() == null ? "" : infoEntity.getTelNo().replaceAll("-", "")); // 전화번호
427
+        req.setCell(infoEntity.getMblNo() == null ? "" : infoEntity.getMblNo().replaceAll("-", "")); // 휴대번호
428
+        req.setFax(infoEntity.getFaxNo() == null ? "" : infoEntity.getFaxNo().replaceAll("-", "")); // 팩스
422 429
         req.setEmail(infoEntity.getEmalAddr()); // 이메일
423 430
         req.setZipno(infoEntity.getZipNo()); // 우편번호
424 431
         req.setAddr1(infoEntity.getAddr1()); // 주소1
425 432
         req.setAddr2(infoEntity.getAddr2()); // 주소2
426 433
         req.setAreaCd(infoEntity.getAreaCd()); // 지역코드
427
-        req.setOpenDate(infoEntity.getOpenDt()); // 오픈일
428
-        req.setCloseDate(infoEntity.getCloseDt()); // 폐점일
434
+        req.setOpenDate(infoEntity.getOpenDt() == null ? "" : infoEntity.getOpenDt().replaceAll("\\.", "")); // 오픈일
435
+        req.setCloseDate(infoEntity.getCloseDt() == null ? "" : infoEntity.getCloseDt().replaceAll("\\.", "")); // 폐점일
429 436
         req.setUseYn("Y".equals(infoEntity.getDelYn()) ? "N" : "Y"); // 사용여부
430 437
         return req;
431 438
     }