Browse Source

브랜드 그룹및 브랜드관리 수정

dwkim 2 years ago
parent
commit
5b370b62f1

+ 1 - 0
src/main/java/com/oqpo/api/entity/stinfo/BrandEntity.java

@@ -51,6 +51,7 @@ public class BrandEntity implements Serializable {
51 51
     private String pgKey;
52 52
     private String pgAfflId;
53 53
     private String mallId;
54
+    private String useYn;
54 55
 
55 56
 
56 57
     private List<FileEntity> fileEntity ;

+ 3 - 1
src/main/java/com/oqpo/api/mapper/stinfo/BrandMapper.java

@@ -44,7 +44,9 @@ public interface BrandMapper {
44 44
 
45 45
     String selectPgMallId(@Param("brandId") String brandId) throws Exception;
46 46
 
47
-    int updatePgKiccBaseInfo(@Param("userId") String userId, @Param("brandId") String brandId, @Param("mallId") String mallId)  throws Exception;
47
+    int updatePgKiccBaseInfo(@Param("userId") String userId, @Param("brandId") String brandId, @Param("mallId") String mallId, @Param("useYn") String useYn)  throws Exception;
48 48
 
49 49
     BrandEntity selectBrandPgInfo(@Param("brandId") String brandId)throws Exception;
50
+
51
+    List<BrandEntity> selectPgMallIdList(@Param("brandId") String brandId)throws Exception;
50 52
 }

+ 1 - 0
src/main/java/com/oqpo/api/service/oper/AfflService.java

@@ -203,6 +203,7 @@ public class AfflService extends CommonService {
203 203
                 userUEntity.setUserId(entity.getAfflShopId());
204 204
                 userUEntity.setTelNo(entity.getRprstTelNo());
205 205
                 userUEntity.setEmail(entity.getRprstEmai());
206
+                userUEntity.setUserNm(entity.getOwnerNm());
206 207
 
207 208
                 if ("S000".equals(entity.getStCd())) {
208 209
                     userUEntity.setUserStatCd("10");

+ 50 - 1
src/main/java/com/oqpo/api/service/stinfo/BrandService.java

@@ -235,7 +235,56 @@ public class BrandService extends CommonService {
235 235
                 */
236 236
             } else if ("U".equals(saveBrandInfolRequest.getViewCd())) {
237 237
                 brandMapper.updateBrandInfo(userId, entity);
238
+                //브랜드에 사용중인 pg정보 가져오기
239
+                List<BrandEntity> usePgList = brandMapper.selectPgMallIdList(saveBrandInfolRequest.getBrandId());
240
+
241
+                int extPgMallCnt = 0 ;
242
+                int chgMallCnt = 0 ;
243
+                String preUseMallId = "";
244
+
245
+                if (usePgList.size() > 0 ) {
246
+                    for (int i = 0 ; i < usePgList.size() ; i++) {
247
+                        BrandEntity tmpPg = usePgList.get(i);
248
+                        if ("Y".toString().equals(tmpPg.getUseYn())) {
249
+                            preUseMallId = tmpPg.getMallId();
250
+                        }
251
+
252
+                        //동일한 pg존재 여부 확인
253
+                        if (saveBrandInfolRequest.getPgAfflId().equals(tmpPg.getMallId())) {
254
+                            extPgMallCnt = 1;
255
+                            if ("N".toString().equals(tmpPg.getUseYn())) {
256
+                                chgMallCnt = 1;
257
+                            }
258
+                        }
259
+                    }
260
+                   
261
+                    if (extPgMallCnt == 0 ) {
262
+                        // 기존거는 삭제 하고 신규로 등록
263
+                        //기존거 삭제
264
+                        brandMapper.updatePgKiccBaseInfo(userId, saveBrandInfolRequest.getBrandId(), preUseMallId, "N") ;
265
+                        //신규등록
266
+                        PgKiccBaseInfoEntity pgInfoEntity = new PgKiccBaseInfoEntity();
267
+                        pgInfoEntity.setBrandId(saveBrandInfolRequest.getBrandId());
268
+                        pgInfoEntity.setMallId(saveBrandInfolRequest.getPgAfflId());
269
+                        pgInfoEntity.setUseYn("Y");
270
+                        brandMapper.insertPgKiccBaseInfo(userId, pgInfoEntity);
271
+                    } else {
272
+                        if (chgMallCnt > 0 ) {
273
+                            // 기존 사용건은 N으로 하고 N인것을 Y로 변경한다.
274
+                            brandMapper.updatePgKiccBaseInfo(userId, saveBrandInfolRequest.getBrandId(), preUseMallId, "N") ;
275
+                            brandMapper.updatePgKiccBaseInfo(userId, saveBrandInfolRequest.getBrandId(), saveBrandInfolRequest.getPgAfflId(), "Y") ;
276
+                        }
277
+                    }
238 278
 
279
+                } else {
280
+                    PgKiccBaseInfoEntity pgInfoEntity = new PgKiccBaseInfoEntity();
281
+                    pgInfoEntity.setBrandId(saveBrandInfolRequest.getBrandId());
282
+                    pgInfoEntity.setMallId(saveBrandInfolRequest.getPgAfflId());
283
+                    pgInfoEntity.setUseYn("Y");
284
+                    brandMapper.insertPgKiccBaseInfo(userId, pgInfoEntity);
285
+                }
286
+
287
+/*
239 288
                 String mallId = brandMapper.selectPgMallId(saveBrandInfolRequest.getBrandId());
240 289
 
241 290
                 if (mallId == null || "".equals(mallId)) {
@@ -260,7 +309,7 @@ public class BrandService extends CommonService {
260 309
                     }
261 310
                 }
262 311
 
263
-
312
+*/
264 313
                 UserMngEntity userUEntity = new UserMngEntity();
265 314
                 userUEntity.setUserId(entity.getBrandId());
266 315
                 userUEntity.setTelNo(entity.getTelNo());

+ 7 - 1
src/main/resources/mybatis/sqlmaps/stinfo/brand.xml

@@ -297,7 +297,7 @@
297 297
     <update id="updatePgKiccBaseInfo">
298 298
         update pg_kicc_base_info
299 299
         set    sys_reg_dttm = date_format(now(),'%Y%m%d')
300
-          ,    use_yn = 'N'
300
+          ,    use_yn = #{useYn}
301 301
           ,    sys_chg_dttm = now()
302 302
           ,    sys_chg_id = #{userId}
303 303
         where  brand_id = #{brandId}
@@ -310,4 +310,10 @@
310 310
         left outer join pg_kicc_base_info pg on info.brand_id = pg.brand_id and pg.use_yn = 'Y'
311 311
         where info.brand_id = #{brandId}
312 312
     </select>
313
+
314
+    <select id="selectPgMallIdList" resultType="com.oqpo.api.entity.stinfo.BrandEntity">
315
+        select mall_id, use_yn
316
+        from   pg_kicc_base_info
317
+        where  brand_id = #{brandId}
318
+    </select>
313 319
 </mapper>