Explorar o código

시스템관리 메뉴 엑션 권한 부분 수정 조치

dwkim %!s(int64=2) %!d(string=hai) anos
pai
achega
306a5f2bd5

+ 1 - 0
src/main/java/com/oqpo/api/config/WebMvcConfig.java

@@ -43,6 +43,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
43 43
                         .excludePathPatterns("/api/member/find-id")
44 44
                         .excludePathPatterns("/api/member/find-pw")
45 45
                         .excludePathPatterns("/api/verinfo/info-lastver")
46
+                        .excludePathPatterns("/api/session/bsnsbrand")
46 47
                         .excludePathPatterns("/api/file/download/**");
47 48
             }
48 49
 

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

@@ -29,4 +29,7 @@ public interface BrandMapper {
29 29
 
30 30
     String selectBrandInitPw(@Param("brandId") String brandId )throws Exception;
31 31
 
32
+    List<BrandEntity> selectBsnsBrandList(@Param("bsnsRegNo") String bsnsRegNo)throws Exception;
33
+
34
+
32 35
 }

+ 25 - 8
src/main/java/com/oqpo/api/service/SessionService.java

@@ -2,6 +2,7 @@ package com.oqpo.api.service;
2 2
 
3 3
 import com.oqpo.api.config.JwtTokenProvider;
4 4
 import com.oqpo.api.entity.oper.MemberEntity;
5
+import com.oqpo.api.entity.stinfo.BrandEntity;
5 6
 import com.oqpo.api.enums.SystemMessageCode;
6 7
 import com.oqpo.api.exception.GlobalException;
7 8
 import com.oqpo.api.service.oper.AfflService;
@@ -11,12 +12,15 @@ import com.oqpo.api.service.system.ActionService;
11 12
 import com.oqpo.api.service.system.CodeService;
12 13
 import com.oqpo.api.service.system.MenuService;
13 14
 import com.oqpo.api.web.dto.response.session.MsessionResponse;
15
+import com.oqpo.api.web.dto.response.session.SessionBrandListResponse;
14 16
 import com.oqpo.api.web.dto.response.session.SessionResponse;
17
+import com.oqpo.api.web.dto.response.stinfo.brand.BsnsBrandListResponse;
15 18
 import lombok.extern.slf4j.Slf4j;
16 19
 import org.springframework.beans.factory.annotation.Autowired;
17 20
 import org.springframework.stereotype.Service;
18 21
 
19 22
 import javax.servlet.http.HttpServletRequest;
23
+import java.util.List;
20 24
 
21 25
 @Service
22 26
 @Slf4j
@@ -70,22 +74,35 @@ public class SessionService extends CommonService {
70 74
                 brandService.selectTargetBrandGridList(memberEntity.getUserId(), memberEntity.getAuthTpCd()));
71 75
     }
72 76
 
73
-    public MsessionResponse mdata(HttpServletRequest request) throws Exception {
77
+    public SessionResponse mdata(HttpServletRequest request) throws Exception {
74 78
         MemberEntity memberEntity = new MemberEntity();
75 79
         String connKey = jwtTokenProvider.resolveToken(request);
76 80
         try {
77 81
             memberEntity.setUserId(jwtTokenProvider.getUserId(connKey));
82
+            memberEntity.setUserNm(jwtTokenProvider.getUserNm(connKey));
83
+            memberEntity.setSystemAdminYn(jwtTokenProvider.getSystemAdminYn(connKey));
84
+            memberEntity.setAuthTpCd(jwtTokenProvider.getAuthTpCd(connKey));
85
+            memberEntity.setAuthTpNm(jwtTokenProvider.getAuthTpNm(connKey));
86
+            memberEntity.setAfflShopId(jwtTokenProvider.getAfflShopId(connKey));
87
+            memberEntity.setBrandId(jwtTokenProvider.getBrandId(connKey));
88
+            memberEntity.setAuthTpNm(jwtTokenProvider.getAuthTpNm(connKey));
89
+
90
+
78 91
         } catch (Exception e) {
79 92
             e.getStackTrace();
80 93
             throw new GlobalException(SystemMessageCode.NEED_AUTH);
81 94
         }
82
-        return MsessionResponse.toDTO(memberEntity,
83
-                userMngService.selectMobileUserInfo(memberEntity.getUserId()),
84
-                menuService.selectMobleMenuList()
85
-                /*,
86
-                nkUserInfoService.selectMobileUserStoreList(memberEntity.getUserId())
87
-                */
88
-                );
95
+        return SessionResponse.toDTO(memberEntity,
96
+                codeService.codeList(memberEntity.getUserId()),
97
+                menuService.authMenuList(memberEntity.getUserId(), memberEntity),
98
+                actionService.actionList(memberEntity.getUserId(), memberEntity),
99
+                afflService.selectTargetAfflGridList(memberEntity.getUserId(), memberEntity.getAuthTpCd()),
100
+                brandService.selectTargetBrandGridList(memberEntity.getUserId(), memberEntity.getAuthTpCd()));
101
+    }
89 102
 
103
+    //selectBsnsBrandList
104
+    public SessionBrandListResponse bsnsBrandList(String bsnsRegNo) throws Exception {
105
+        return SessionBrandListResponse.toDTO(brandService.selectBsnsBrandList(bsnsRegNo));
90 106
     }
107
+
91 108
 }

+ 20 - 4
src/main/java/com/oqpo/api/service/stinfo/BrandService.java

@@ -2,6 +2,8 @@ package com.oqpo.api.service.stinfo;
2 2
 
3 3
 
4 4
 
5
+import com.oqpo.api.entity.ActionEntity;
6
+import com.oqpo.api.entity.CodeEntity;
5 7
 import com.oqpo.api.entity.oper.*;
6 8
 import com.oqpo.api.entity.stinfo.BrandEntity;
7 9
 import com.oqpo.api.entity.stinfo.ItemClassMngEntity;
@@ -15,12 +17,10 @@ import com.oqpo.api.web.dto.request.GridRequest;
15 17
 import com.oqpo.api.web.dto.request.oper.salemgr.SaveSaleMgrMgnlRequest;
16 18
 import com.oqpo.api.web.dto.request.stinfo.brand.SaveBrandInfolRequest;
17 19
 import com.oqpo.api.web.dto.response.GridResponse;
20
+import com.oqpo.api.web.dto.response.code.CodeSearchListResponse;
18 21
 import com.oqpo.api.web.dto.response.oper.affl.AfflShopInfoResponse;
19 22
 import com.oqpo.api.web.dto.response.oper.salemgr.SaleMgrMgnInfoResponse;
20
-import com.oqpo.api.web.dto.response.stinfo.brand.BrandInfoResponse;
21
-import com.oqpo.api.web.dto.response.stinfo.brand.BrandSearchListResponse;
22
-import com.oqpo.api.web.dto.response.stinfo.brand.BrandSearchResponse;
23
-import com.oqpo.api.web.dto.response.stinfo.brand.AfflBrandSearchResponse;
23
+import com.oqpo.api.web.dto.response.stinfo.brand.*;
24 24
 import lombok.extern.slf4j.Slf4j;
25 25
 import org.springframework.beans.factory.annotation.Autowired;
26 26
 import org.springframework.security.crypto.password.PasswordEncoder;
@@ -244,4 +244,20 @@ public class BrandService extends CommonService {
244 244
         }
245 245
     }
246 246
 
247
+    /*
248
+        사업자번호 브랜드 리스트
249
+     */
250
+    public List<BrandEntity> selectBsnsBrandList(String bsnsRegNo) throws Exception {
251
+
252
+        List<BrandEntity> entities = brandMapper.selectBsnsBrandList(bsnsRegNo);
253
+
254
+        return entities;
255
+    }
256
+
257
+    /*
258
+    public BsnsBrandListResponse selectBsnsBrandList(String bsnsRegNo) throws Exception {
259
+        List<BrandEntity> entities = brandMapper.selectBsnsBrandList(bsnsRegNo);
260
+        return BsnsBrandListResponse.toDTO(entities);
261
+    }
262
+    */
247 263
 }

+ 24 - 6
src/main/java/com/oqpo/api/web/controller/SessionController.java

@@ -3,7 +3,9 @@ package com.oqpo.api.web.controller;
3 3
 import com.oqpo.api.service.SessionService;
4 4
 import com.oqpo.api.web.dto.response.session.HashedResponse;
5 5
 import com.oqpo.api.web.dto.response.session.MsessionResponse;
6
+import com.oqpo.api.web.dto.response.session.SessionBrandListResponse;
6 7
 import com.oqpo.api.web.dto.response.session.SessionResponse;
8
+import com.oqpo.api.web.dto.response.stinfo.brand.BsnsBrandListResponse;
7 9
 import io.swagger.annotations.ApiImplicitParam;
8 10
 import io.swagger.annotations.ApiImplicitParams;
9 11
 import io.swagger.annotations.ApiOperation;
@@ -16,10 +18,7 @@ import org.springframework.http.ResponseEntity;
16 18
 import org.springframework.security.core.Authentication;
17 19
 import org.springframework.security.core.context.SecurityContextHolder;
18 20
 import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
19
-import org.springframework.web.bind.annotation.GetMapping;
20
-import org.springframework.web.bind.annotation.PatchMapping;
21
-import org.springframework.web.bind.annotation.RequestMapping;
22
-import org.springframework.web.bind.annotation.RestController;
21
+import org.springframework.web.bind.annotation.*;
23 22
 
24 23
 import javax.servlet.http.HttpServletRequest;
25 24
 import javax.servlet.http.HttpServletResponse;
@@ -107,8 +106,27 @@ public class SessionController {
107 106
             @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
108 107
     })
109 108
     @ApiOperation(value = "모바일 기본정보 전송")
110
-    @GetMapping("/mdata")
111
-    public ResponseEntity<MsessionResponse> mdata(HttpServletRequest request) throws Exception {
109
+    @GetMapping("/data-app")
110
+    public ResponseEntity<SessionResponse> mdata(HttpServletRequest request) throws Exception {
112 111
         return ResponseEntity.ok(sessionService.mdata(request));
113 112
     }
113
+
114
+
115
+    /**
116
+     * 설명 : 모바일 사업자번호 브랜드리스트
117
+     *
118
+     * @param request
119
+     * @return
120
+     * @throws Exception
121
+     */
122
+    @ApiImplicitParams({
123
+            @ApiImplicitParam(name = "bsnsRegNo", value = "사업자 번호", required = false, dataType = "String", paramType = "query")
124
+    })
125
+    @ApiOperation(value = "사업자번호 브랜드리스트")
126
+    @GetMapping("/bsnsbrand")
127
+    public ResponseEntity<SessionBrandListResponse> getBsnsBrandList(@RequestParam(value = "bsnsRegNo", required = true) String bsnsRegNo) throws Exception {
128
+        return ResponseEntity.ok(sessionService.bsnsBrandList(bsnsRegNo));
129
+    }
130
+
131
+
114 132
 }

+ 51 - 0
src/main/java/com/oqpo/api/web/dto/response/session/SessionBrandListResponse.java

@@ -0,0 +1,51 @@
1
+package com.oqpo.api.web.dto.response.session;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.ActionEntity;
5
+import com.oqpo.api.entity.CodeEntity;
6
+import com.oqpo.api.entity.oper.AfflEntity;
7
+import com.oqpo.api.entity.oper.MemberEntity;
8
+import com.oqpo.api.entity.oper.MenuEntity;
9
+import com.oqpo.api.entity.stinfo.BrandEntity;
10
+import io.swagger.annotations.ApiModelProperty;
11
+import lombok.*;
12
+import org.apache.commons.lang3.StringUtils;
13
+
14
+import java.util.List;
15
+import java.util.stream.Collectors;
16
+
17
+@Getter
18
+@Setter
19
+@Builder
20
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
21
+@JsonInclude(JsonInclude.Include.ALWAYS)
22
+public class SessionBrandListResponse {
23
+
24
+    @ApiModelProperty(value = "브랜드 리스트")
25
+    private List<BrandInfo> brandList;
26
+
27
+    public static SessionBrandListResponse toDTO(List<BrandEntity> brandList) {
28
+        if (brandList == null) return null;
29
+        return SessionBrandListResponse.builder()
30
+                .brandList(brandList.stream()
31
+                        .map(m -> BrandInfo.builder()
32
+                                .brandId(m.getBrandId())
33
+                                .brandNm(m.getBrandNm())
34
+                                .build())
35
+                        .collect(Collectors.toList()))
36
+                .build();
37
+    }
38
+
39
+
40
+    @Getter
41
+    @Builder
42
+    @AllArgsConstructor(access = AccessLevel.PROTECTED)
43
+    static class BrandInfo {
44
+        @ApiModelProperty(value = "브랜드아이디")
45
+        private String brandId ;
46
+
47
+        @ApiModelProperty(value = "브랜드명")
48
+        private String brandNm;
49
+    }
50
+
51
+}

+ 42 - 0
src/main/java/com/oqpo/api/web/dto/response/stinfo/brand/BsnsBrandListResponse.java

@@ -0,0 +1,42 @@
1
+package com.oqpo.api.web.dto.response.stinfo.brand;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.stinfo.BrandEntity;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.*;
7
+
8
+import java.util.List;
9
+import java.util.stream.Collectors;
10
+
11
+@Getter
12
+@Setter
13
+@Builder
14
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
15
+@JsonInclude(JsonInclude.Include.ALWAYS) //null 값 전송
16
+public class BsnsBrandListResponse {
17
+    @ApiModelProperty(value = "조회리스트")
18
+    private List<BrandInfo> brandList;
19
+
20
+    public static BsnsBrandListResponse toDTO(List<BrandEntity> entities) {
21
+        if (entities == null) return null;
22
+        return BsnsBrandListResponse.builder()
23
+                .brandList(entities.stream()
24
+                        .map(m -> BrandInfo.builder()
25
+                                .brandId(m.getBrandId())
26
+                                .brandNm(m.getBrandNm())
27
+                                .build())
28
+                        .collect(Collectors.toList()))
29
+                .build();
30
+    }
31
+
32
+    @Getter
33
+    @Builder
34
+    @AllArgsConstructor(access = AccessLevel.PROTECTED)
35
+    static class BrandInfo {
36
+        @ApiModelProperty(value = "브랜드아이디")
37
+        private String brandId;
38
+
39
+        @ApiModelProperty(value = "브랜드명")
40
+        private String brandNm;
41
+    }
42
+}

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

@@ -197,4 +197,25 @@
197 197
          where brand_id  = #{brandId}
198 198
     </select>
199 199
 
200
+    <select id="selectBsnsBrandList" resultType="com.oqpo.api.entity.stinfo.BrandEntity">
201
+        select info.brand_id, fn_brand_nm(info.brand_id) as brand_nm
202
+        from (
203
+                select brand_id
204
+                from brand_base_info
205
+                where bsns_reg_no = #{bsnsRegNo}
206
+                or affl_shop_id in (select affl_shop_id
207
+                from affl_shop_base_info
208
+                where bsns_reg_no = #{bsnsRegNo})
209
+                union all
210
+                select brand_id
211
+                from store_base_info
212
+                where bsns_reg_no = #{bsnsRegNo}
213
+                union all
214
+                select brand_id
215
+                from spply_base_info
216
+                where bsns_reg_no = #{bsnsRegNo}
217
+        ) info
218
+        order by brand_nm	asc
219
+    </select>
220
+
200 221
 </mapper>

+ 4 - 4
src/main/resources/mybatis/sqlmaps/system/Action.xml

@@ -20,7 +20,7 @@
20 20
          left outer join (
21 21
                                  select adtl.wr_yn , adtl.menu_no
22 22
                                  from   np_user_auth uauth
23
-                                   join np_auth_dtl  adtl on uauth.auth_no = adtl.auth_no and adtl.use_yn = 'Y'
23
+                                   join np_auth_dtl  adtl on uauth.auth_no = adtl.auth_no 
24 24
                                  where uauth.user_id = #{userId}  ) uauth
25 25
                                 on ainfo.menu_no = uauth.menu_no
26 26
         </if>
@@ -33,7 +33,7 @@
33 33
            , act.act_id
34 34
            , act.act_nm
35 35
            , act.conn_url
36
-           , act.wr_yn
36
+           , act.wr_yn as write_yn
37 37
         from np_act_info act
38 38
         inner join np_sys_menu menu
39 39
             on menu.menu_no = act.menu_no
@@ -50,7 +50,7 @@
50 50
            , act_id
51 51
            , act_nm
52 52
            , conn_url
53
-           , wr_yn
53
+           , wr_yn as write_yn
54 54
         from np_act_info
55 55
         where menu_no = #{menuNo}
56 56
         and use_yn = 'Y'
@@ -100,7 +100,7 @@
100 100
             , act_nm
101 101
             , use_yn
102 102
             , conn_url
103
-            , wr_yn
103
+            , wr_yn as write_yn
104 104
         from np_act_info
105 105
         where menu_no = #{menuNo}
106 106
         <choose>

+ 1 - 1
src/main/resources/mybatis/sqlmaps/system/Auth.xml

@@ -117,7 +117,7 @@
117 117
 
118 118
     <delete id="deleteAuthDtl" >
119 119
         delete from np_auth_dtl /** deleteAuthDtl */
120
-        where auth_no = #{menuNo}
120
+        where auth_no = #{authNo}
121 121
         and menu_no in
122 122
         <foreach collection="gridDeleteData" item="item" separator="," open="(" close=")">
123 123
             #{item.menuNo}

+ 5 - 4
src/main/resources/mybatis/sqlmaps/system/Menu.xml

@@ -19,7 +19,7 @@
19 19
         , fn_code_nm('USE_YN', use_yn) as use_yn_nm
20 20
         , menu_id
21 21
         from np_sys_menu
22
-        where top_menu_no = 0
22
+        where top_menu_no = 10
23 23
         union all
24 24
         select c.level + 1
25 25
         , b.menu_no
@@ -41,7 +41,7 @@
41 41
         , tlist.conn_url, tlist.menu_id
42 42
         from   tree_menu_list tlist
43 43
         <if test="systemAdminYn neq 'Y'.toString() ">
44
-        join  (	select 1 as top_menu_no, top_menu_no as  menu_no, 'Y' as wr_yn
44
+        join  (	select 100 as top_menu_no, top_menu_no as  menu_no, 'Y' as wr_yn
45 45
         from   np_user_auth uauth
46 46
             join np_auth_info ainfo on uauth.auth_no = ainfo.auth_no and ainfo.use_yn = 'Y'
47 47
             where  uauth.user_id = #{userId}
@@ -278,7 +278,8 @@
278 278
             , menu_nm as id_path_nm
279 279
             , open_cd
280 280
             from np_sys_menu
281
-            where top_menu_no = 0
281
+            where top_menu_no = 10
282
+            and   sys_type_cd = 'W'
282 283
             and   open_cd  <![CDATA[ <> ]]> 'p'
283 284
             union all
284 285
             select c.level + 1
@@ -331,7 +332,7 @@
331 332
         , menu_nm as id_path_nm
332 333
         , open_cd
333 334
         from np_sys_menu
334
-        where top_menu_no = 0
335
+        where top_menu_no = 10
335 336
         and   open_cd  <![CDATA[ <> ]]> 'p'
336 337
         union all
337 338
         select c.level + 1