Bläddra i källkod

가맹 및 브랜드 종료시 매장 창고 사용자 공급사 종료 처리함

dwkim 2 år sedan
förälder
incheckning
dfe1f37c3b

+ 2 - 0
src/main/java/com/oqpo/api/mapper/oper/UserMngMapper.java

@@ -49,4 +49,6 @@ public interface UserMngMapper {
49
 
49
 
50
     int insertUserTypeAuth(@Param("newId") String newId, @Param("userId") String userId, @Param("authTpCd") String authTpCd) throws Exception;
50
     int insertUserTypeAuth(@Param("newId") String newId, @Param("userId") String userId, @Param("authTpCd") String authTpCd) throws Exception;
51
 
51
 
52
+    int updateCloseUser(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
53
+
52
 }
54
 }

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

@@ -31,5 +31,6 @@ public interface BrandMapper {
31
 
31
 
32
     List<BrandEntity> selectBsnsBrandList(@Param("bsnsRegNo") String bsnsRegNo)throws Exception;
32
     List<BrandEntity> selectBsnsBrandList(@Param("bsnsRegNo") String bsnsRegNo)throws Exception;
33
 
33
 
34
+    int updateCloseBrand(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
34
 
35
 
35
 }
36
 }

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

@@ -25,5 +25,5 @@ public interface StoreBaseInfoMapper {
25
 
25
 
26
     StoreBaseInfoEntity selectStoreLoanInfo(@Param("brandId") String brandId, @Param("storeId") String storeId)throws Exception;
26
     StoreBaseInfoEntity selectStoreLoanInfo(@Param("brandId") String brandId, @Param("storeId") String storeId)throws Exception;
27
 
27
 
28
-
28
+    int updateCloseStore(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
29
 }
29
 }

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

@@ -32,6 +32,6 @@ public interface SupplyMapper {
32
 
32
 
33
     int selectMaxSpplyMgrId( @Param("spplyId") String spplyId)   throws Exception;
33
     int selectMaxSpplyMgrId( @Param("spplyId") String spplyId)   throws Exception;
34
 
34
 
35
-
35
+    int updateCloseSpply(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
36
 
36
 
37
 }
37
 }

+ 4 - 0
src/main/java/com/oqpo/api/mapper/stockmng/WhsMngMapper.java

@@ -38,4 +38,8 @@ public interface WhsMngMapper {
38
 
38
 
39
     int updateStoreWhsStatus(@Param("userId") String userId, @Param("brandId") String brandId, @Param("storeId") String storeId, @Param("whsStCd") String whsStCd) throws Exception;
39
     int updateStoreWhsStatus(@Param("userId") String userId, @Param("brandId") String brandId, @Param("storeId") String storeId, @Param("whsStCd") String whsStCd) throws Exception;
40
     int updateWhsLocStatus(@Param("userId") String userId, @Param("brandId") String brandId, @Param("storeId") String storeId, @Param("locStCd") String locStCd) throws Exception;
40
     int updateWhsLocStatus(@Param("userId") String userId, @Param("brandId") String brandId, @Param("storeId") String storeId, @Param("locStCd") String locStCd) throws Exception;
41
+
42
+    int updateCloseWhs(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
43
+    int updateCloseWhsLoc(@Param("userId") String userId, @Param("brandId") String brandId, @Param("afflShopId") String afflShopId) throws Exception;
44
+
41
 }
45
 }

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

@@ -9,6 +9,10 @@ import com.oqpo.api.exception.GlobalException;
9
 import com.oqpo.api.mapper.FileMapper;
9
 import com.oqpo.api.mapper.FileMapper;
10
 import com.oqpo.api.mapper.oper.AfflMapper;
10
 import com.oqpo.api.mapper.oper.AfflMapper;
11
 import com.oqpo.api.mapper.oper.UserMngMapper;
11
 import com.oqpo.api.mapper.oper.UserMngMapper;
12
+import com.oqpo.api.mapper.stinfo.BrandMapper;
13
+import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
14
+import com.oqpo.api.mapper.stinfo.SupplyMapper;
15
+import com.oqpo.api.mapper.stockmng.WhsMngMapper;
12
 import com.oqpo.api.service.CommonService;
16
 import com.oqpo.api.service.CommonService;
13
 import com.oqpo.api.web.dto.request.GridRequest;
17
 import com.oqpo.api.web.dto.request.GridRequest;
14
 import com.oqpo.api.web.dto.request.oper.affl.SaveAfflRequest;
18
 import com.oqpo.api.web.dto.request.oper.affl.SaveAfflRequest;
@@ -38,6 +42,18 @@ public class AfflService extends CommonService {
38
     @Autowired
42
     @Autowired
39
     private UserMngMapper userMngMapper;
43
     private UserMngMapper userMngMapper;
40
 
44
 
45
+    @Autowired
46
+    private StoreBaseInfoMapper storeBaseInfoMapper;
47
+
48
+    @Autowired
49
+    private WhsMngMapper whsMngMapper;
50
+
51
+    @Autowired
52
+    private SupplyMapper supplyMapper;
53
+
54
+    @Autowired
55
+    private BrandMapper brandMapper;
56
+
41
     @Autowired
57
     @Autowired
42
     private FileMapper fileMapper;
58
     private FileMapper fileMapper;
43
 
59
 
@@ -192,6 +208,25 @@ public class AfflService extends CommonService {
192
                     userUEntity.setUserStatCd("30");
208
                     userUEntity.setUserStatCd("30");
193
                 }
209
                 }
194
                 userMngMapper.updateUserInfo(userId, userUEntity);
210
                 userMngMapper.updateUserInfo(userId, userUEntity);
211
+
212
+                //가맹점 종료 처리시
213
+                if ("S001".equals(entity.getStCd())) {
214
+                    // 창고 종료
215
+                    whsMngMapper.updateCloseWhs(userId, "", entity.getAfflShopId());
216
+                    // 창고 로케이션 종료
217
+                    whsMngMapper.updateCloseWhsLoc(userId, "", entity.getAfflShopId());
218
+                    // 매장 종료
219
+                    storeBaseInfoMapper.updateCloseStore(userId, "", entity.getAfflShopId());
220
+                    // 공급사 종료
221
+                    supplyMapper.updateCloseSpply(userId, "", entity.getAfflShopId());
222
+
223
+                    // 브랜드  종료
224
+                    brandMapper.updateCloseBrand(userId, "", entity.getAfflShopId());
225
+
226
+                    // 사용자 종료
227
+                    userMngMapper.updateCloseUser(userId, "", entity.getAfflShopId());
228
+                }
229
+
195
             }
230
             }
196
 
231
 
197
             //  영업담당자 상세 정보 저장
232
             //  영업담당자 상세 정보 저장

+ 33 - 0
src/main/java/com/oqpo/api/service/stinfo/BrandService.java

@@ -12,6 +12,9 @@ import com.oqpo.api.mapper.FileMapper;
12
 import com.oqpo.api.mapper.oper.UserMngMapper;
12
 import com.oqpo.api.mapper.oper.UserMngMapper;
13
 import com.oqpo.api.mapper.stinfo.BrandMapper;
13
 import com.oqpo.api.mapper.stinfo.BrandMapper;
14
 import com.oqpo.api.mapper.stinfo.ItemMapper;
14
 import com.oqpo.api.mapper.stinfo.ItemMapper;
15
+import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
16
+import com.oqpo.api.mapper.stinfo.SupplyMapper;
17
+import com.oqpo.api.mapper.stockmng.WhsMngMapper;
15
 import com.oqpo.api.service.CommonService;
18
 import com.oqpo.api.service.CommonService;
16
 import com.oqpo.api.web.dto.request.GridRequest;
19
 import com.oqpo.api.web.dto.request.GridRequest;
17
 import com.oqpo.api.web.dto.request.oper.salemgr.SaveSaleMgrMgnlRequest;
20
 import com.oqpo.api.web.dto.request.oper.salemgr.SaveSaleMgrMgnlRequest;
@@ -43,6 +46,15 @@ public class BrandService extends CommonService {
43
     @Autowired
46
     @Autowired
44
     private UserMngMapper userMngMapper;
47
     private UserMngMapper userMngMapper;
45
 
48
 
49
+    @Autowired
50
+    private StoreBaseInfoMapper storeBaseInfoMapper;
51
+
52
+    @Autowired
53
+    private WhsMngMapper whsMngMapper;
54
+
55
+    @Autowired
56
+    private SupplyMapper supplyMapper;
57
+
46
     @Autowired
58
     @Autowired
47
     private FileMapper fileMapper;
59
     private FileMapper fileMapper;
48
 
60
 
@@ -213,6 +225,27 @@ public class BrandService extends CommonService {
213
                     userUEntity.setUserStatCd("30");
225
                     userUEntity.setUserStatCd("30");
214
                 }
226
                 }
215
                 userMngMapper.updateUserInfo(userId, userUEntity);
227
                 userMngMapper.updateUserInfo(userId, userUEntity);
228
+
229
+
230
+                // 브랜드 종료 면 매장,창고, 공급사 상태 종료 처리함
231
+                /*
232
+                  1. 매장 전체 종료 처리 및 매장을 통한 창고 종료
233
+                  2. 공급사 전체 종료..-- 사용자 계정도함
234
+                 */
235
+                if ("S001".equals(entity.getStCd())) {
236
+                    // 창고 종료
237
+                    whsMngMapper.updateCloseWhs(userId, entity.getBrandId(), "");
238
+                    // 창고 로케이션 종료
239
+                    whsMngMapper.updateCloseWhsLoc(userId, entity.getBrandId(), "");
240
+                    // 매장 종료
241
+                    storeBaseInfoMapper.updateCloseStore(userId, entity.getBrandId(), "");
242
+                    // 공급사 종료
243
+                    supplyMapper.updateCloseSpply(userId, entity.getBrandId(), "");
244
+
245
+                    // 사용자 종료
246
+                    userMngMapper.updateCloseUser(userId, entity.getBrandId(), "");
247
+                }
248
+
216
             }
249
             }
217
 
250
 
218
         } catch (GlobalException e) {
251
         } catch (GlobalException e) {

+ 15 - 0
src/main/resources/mybatis/sqlmaps/oper/UserMng.xml

@@ -270,4 +270,19 @@
270
         where auth_tp_cd = #{authTpCd}
270
         where auth_tp_cd = #{authTpCd}
271
         and   use_yn = 'Y'
271
         and   use_yn = 'Y'
272
     </insert>
272
     </insert>
273
+
274
+
275
+    <update id="updateCloseUser" >
276
+        update  np_user_info
277
+        set  chg_dt	= now()
278
+            ,chg_id	= #{userId}
279
+            ,user_stat_cd = '90'
280
+        where 1=1
281
+        <if test="brandId != null and brandId != ''">
282
+            and   brand_id = #{brandId}
283
+        </if>
284
+        <if test="afflShopId != null and afflShopId != ''">
285
+            and   affl_shop_id = #{afflShopId}
286
+        </if>
287
+    </update>
273
 </mapper>
288
 </mapper>

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

@@ -205,4 +205,18 @@
205
         and store_id = #{storeId}
205
         and store_id = #{storeId}
206
     </select>
206
     </select>
207
 
207
 
208
+    <update id="updateCloseStore" >
209
+        update  store_base_info
210
+        set  sys_chg_dttm	= now()
211
+            ,sys_chg_id	= #{userId}
212
+            ,store_st_cd = 'ST03'
213
+        where 1=1
214
+        <if test="brandId != null and brandId != ''">
215
+        and   brand_id = #{brandId}
216
+        </if>
217
+        <if test="afflShopId != null and afflShopId != ''">
218
+        and   brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
219
+        </if>
220
+    </update>
221
+
208
 </mapper>
222
 </mapper>

+ 13 - 1
src/main/resources/mybatis/sqlmaps/stinfo/Supply.xml

@@ -216,6 +216,18 @@
216
         where  spply_id = #{spplyId}
216
         where  spply_id = #{spplyId}
217
     </select>
217
     </select>
218
 
218
 
219
-
219
+    <update id="updateCloseSpply" >
220
+        update  spply_base_info
221
+        set  sys_chg_dttm	= now()
222
+            ,sys_chg_id	= #{userId}
223
+            ,st_cd = 'S001'
224
+        where 1=1
225
+        <if test="brandId != null and brandId != ''">
226
+            and   brand_id = #{brandId}
227
+        </if>
228
+        <if test="afflShopId != null and afflShopId != ''">
229
+            and   brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
230
+        </if>
231
+    </update>
220
 
232
 
221
 </mapper>
233
 </mapper>

+ 14 - 0
src/main/resources/mybatis/sqlmaps/stinfo/brand.xml

@@ -218,4 +218,18 @@
218
         order by brand_nm	asc
218
         order by brand_nm	asc
219
     </select>
219
     </select>
220
 
220
 
221
+    <update id="updateCloseBrand" >
222
+        update  brand_base_info
223
+        set  sys_chg_dttm	= now()
224
+            ,sys_chg_id	= #{userId}
225
+            ,st_cd = 'S001'
226
+        where 1=1
227
+        <if test="brandId != null and brandId != ''">
228
+            and   brand_id = #{brandId}
229
+        </if>
230
+        <if test="afflShopId != null and afflShopId != ''">
231
+            and   brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
232
+        </if>
233
+    </update>
234
+
221
 </mapper>
235
 </mapper>

+ 41 - 2
src/main/resources/mybatis/sqlmaps/stockmng/WhsMng.xml

@@ -168,7 +168,10 @@
168
         </if>
168
         </if>
169
             sys_chg_dttm = NOW(),
169
             sys_chg_dttm = NOW(),
170
             sys_chg_id = #{userId}
170
             sys_chg_id = #{userId}
171
-        WHERE brand_id = #{brandId}
171
+        WHERE 1=1
172
+        <if test="brandId != null and brandId != ''">
173
+        and brand_id = #{brandId}
174
+        </if>
172
         <if test="storeId != null and storeId != ''">
175
         <if test="storeId != null and storeId != ''">
173
         AND store_id = #{storeId}
176
         AND store_id = #{storeId}
174
         </if>
177
         </if>
@@ -185,11 +188,47 @@
185
         WHERE  concat(brand_id , whs_id) in (
188
         WHERE  concat(brand_id , whs_id) in (
186
                                     select concat(brand_id, whs_id)
189
                                     select concat(brand_id, whs_id)
187
                                      from whs_mgnt_base_info
190
                                      from whs_mgnt_base_info
188
-                                     WHERE brand_id = #{brandId}
191
+                                     WHERE 1=1
192
+                                    <if test="brandId != null and brandId != ''">
193
+                                     and  brand_id = #{brandId}
194
+                                    </if>
189
                                     <if test="storeId != null and storeId != ''">
195
                                     <if test="storeId != null and storeId != ''">
190
                                      AND store_id = #{storeId}
196
                                      AND store_id = #{storeId}
191
                                     </if>
197
                                     </if>
192
                                      )
198
                                      )
193
     </update>
199
     </update>
194
 
200
 
201
+    <update id="updateCloseWhs" >
202
+        update whs_mgnt_base_info
203
+         set  sys_chg_dttm	= now()
204
+             ,sys_chg_id	= #{userId}
205
+             ,whs_st_cd = 'W003'
206
+        where 1=1
207
+        <if test="brandId != null and brandId != ''">
208
+            and   brand_id = #{brandId}
209
+        </if>
210
+        <if test="afflShopId != null and afflShopId != ''">
211
+            and   brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
212
+        </if>
213
+    </update>
214
+
215
+    <update id="updateCloseWhsLoc" >
216
+        UPDATE whs_mgnt_base_loc
217
+        SET  sys_chg_dttm	= now()
218
+            ,sys_chg_id	= #{userId}
219
+             loc_st_cd = 'LOC003'
220
+        WHERE 1=1
221
+        and   concat(brand_id , whs_id) in (
222
+                                            select concat(brand_id, whs_id)
223
+                                            from whs_mgnt_base_info
224
+                                            WHERE 1=1
225
+                                            <if test="brandId != null and brandId != ''">
226
+                                                and  brand_id = #{brandId}
227
+                                            </if>
228
+                                            <if test="afflShopId != null and afflShopId != ''">
229
+                                                and   brand_id in (select brand_id from affl_shop_base_info where affl_shop_id = #{afflShopId})
230
+                                            </if>
231
+                                            )
232
+    </update>
233
+
195
 </mapper>
234
 </mapper>