X Tutup
Skip to content

Commit b48e4c2

Browse files
committed
商家认证 可用版
1 parent feaf501 commit b48e4c2

File tree

14 files changed

+206
-154
lines changed

14 files changed

+206
-154
lines changed
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.pinyougou.service;
22

33
import java.util.ArrayList;
4+
import java.util.Collection;
45
import java.util.List;
56

6-
import org.omg.CORBA.PRIVATE_MEMBER;
77
import org.springframework.security.core.GrantedAuthority;
88
import org.springframework.security.core.authority.SimpleGrantedAuthority;
99
import org.springframework.security.core.userdetails.User;
@@ -13,49 +13,38 @@
1313

1414
import com.pinyougou.pojo.TbSeller;
1515
import com.pinyougou.sellergoods.service.SellerService;
16-
1716
/**
1817
* 认证类
19-
* @author rxs
18+
* @author Administrator
2019
*
2120
*/
2221
public class UserDetailsServiceImpl implements UserDetailsService {
2322

23+
2424
private SellerService sellerService;
2525

26-
public SellerService getSellerService() {
27-
return sellerService;
28-
}
29-
3026
public void setSellerService(SellerService sellerService) {
3127
this.sellerService = sellerService;
3228
}
3329

3430
@Override
35-
public UserDetails loadUserByUsername(String username)
36-
throws UsernameNotFoundException {
37-
38-
39-
System.out.println("经过了这个类型方法阿斯顿发");
31+
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
32+
System.out.println("经过了UserDetailsServiceImpl");
4033
//构建角色列表
41-
List<GrantedAuthority> grantAuths =new ArrayList();
34+
List<GrantedAuthority> grantAuths=new ArrayList();
4235
grantAuths.add(new SimpleGrantedAuthority("ROLE_SELLER"));
4336

37+
//得到商家对象
4438
TbSeller seller = sellerService.findOne(username);
45-
if(seller !=null){
39+
if(seller!=null){
4640
if(seller.getStatus().equals("1")){
4741
return new User(username,seller.getPassword(),grantAuths);
48-
49-
}else {
42+
}else{
5043
return null;
51-
}
52-
53-
}else {
44+
}
45+
}else{
5446
return null;
5547
}
56-
5748
}
5849

59-
60-
6150
}

pinyougou-parent/pinyougou-shop-web/src/main/java/com/pinyougou/shop/controller/SellerController.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.springframework.web.bind.annotation.RequestBody;
66
import org.springframework.web.bind.annotation.RequestMapping;
77
import org.springframework.web.bind.annotation.RestController;
8-
98
import com.alibaba.dubbo.config.annotation.Reference;
109
import com.pinyougou.pojo.TbSeller;
1110
import com.pinyougou.sellergoods.service.SellerService;
@@ -50,9 +49,11 @@ public PageResult findPage(int page,int rows){
5049
*/
5150
@RequestMapping("/add")
5251
public Result add(@RequestBody TbSeller seller){
52+
//密码加密
5353
BCryptPasswordEncoder passwordEncoder=new BCryptPasswordEncoder();
54-
String password = passwordEncoder.encode(seller.getPassword());
54+
String password = passwordEncoder.encode(seller.getPassword());//加密
5555
seller.setPassword(password);
56+
5657
try {
5758
sellerService.add(seller);
5859
return new Result(true, "增加成功");
@@ -84,7 +85,7 @@ public Result update(@RequestBody TbSeller seller){
8485
* @return
8586
*/
8687
@RequestMapping("/findOne")
87-
public TbSeller findOne(String id){
88+
public TbSeller findOne(String id){
8889
return sellerService.findOne(id);
8990
}
9091

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<beans:beans xmlns="http://www.springframework.org/schema/security"
3-
xmlns:beans="http://www.springframework.org/schema/beans"
4-
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:beans="http://www.springframework.org/schema/beans"
4+
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
56
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
67
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
78
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
8-
9-
10-
<!-- 设置页面不登录也可以访问 -->
9+
10+
<!-- 设置页面不登陆也可以访问 -->
1111
<http pattern="/*.html" security="none"></http>
1212
<http pattern="/css/**" security="none"></http>
1313
<http pattern="/img/**" security="none"></http>
14-
<http pattern="/plugins/**" security="none"></http>
1514
<http pattern="/js/**" security="none"></http>
15+
<http pattern="/plugins/**" security="none"></http>
1616
<http pattern="/seller/add.do" security="none"></http>
17-
18-
<!-- 页面的拦截规则 use-expressions:是否启动SPEL表达式 默认是true -->
17+
18+
<!-- 页面的拦截规则 use-expressions:是否启动SPEL表达式 默认是true -->
1919
<http use-expressions="false">
20-
<!-- 当前用户必须拥有ROLE_USER的角色 才可以访问更目录及所属子目录的资源 -->
20+
<!-- 当前用户必须有ROLE_USER的角色 才可以访问根目录及所属子目录的资源 -->
2121
<intercept-url pattern="/**" access="ROLE_SELLER"/>
22-
<!-- 开启表单登录功能 -->
23-
<form-login login-page="/shoplogin.html" default-target-url="/admin/index.html" authentication-failure-url="/shoplogin.html" always-use-default-target="true"/>
22+
<!-- 开启表单登陆功能 -->
23+
<form-login login-page="/shoplogin.html" default-target-url="/admin/index.html" authentication-failure-url="/shoplogin.html" always-use-default-target="true"/>
2424
<csrf disabled="true"/>
2525
<headers>
2626
<frame-options policy="SAMEORIGIN"/>
2727
</headers>
2828
<logout/>
2929
</http>
30-
<!-- 认证管理器 -->
31-
<authentication-manager>
32-
<!-- 认证的提供者 -->
33-
<authentication-provider user-service-ref="userDetailService">
34-
<password-encoder ref="bcryptEncoder"></password-encoder>
35-
</authentication-provider>
36-
</authentication-manager>
37-
38-
<!-- 认证类 -->
39-
<beans:bean id="userDetailService" class="com.pinyougou.service.UserDetailsServiceImpl">
40-
<beans:property name="sellerService" ref="sellerService" ></beans:property>
41-
</beans:bean>
42-
43-
<!-- 引用dubbo 服务 -->
44-
<dubbo:application name="pinyougou-shop-web" />
45-
<dubbo:registry address="zookeeper://192.168.25.135:2181" timeout="50000"/>
46-
<dubbo:reference id="sellerService" interface="com.pinyougou.sellergoods.service.SellerService"></dubbo:reference>
47-
30+
31+
<!-- 认证管理器 -->
32+
<authentication-manager>
33+
<authentication-provider user-service-ref="userDetailService">
34+
<password-encoder ref="bcryptEncoder"></password-encoder>
35+
</authentication-provider>
36+
</authentication-manager>
4837

49-
<beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></beans:bean>
38+
<!-- 认证类 -->
39+
<beans:bean id="userDetailService" class="com.pinyougou.service.UserDetailsServiceImpl">
40+
<beans:property name="sellerService" ref="sellerService"></beans:property>
41+
</beans:bean>
42+
43+
<!-- 引用dubbo 服务 -->
44+
<dubbo:application name="pinyougou-shop-web" />
45+
<dubbo:registry address="zookeeper://192.168.25.135:2181"/>
46+
<dubbo:reference id="sellerService" interface="com.pinyougou.sellergoods.service.SellerService"></dubbo:reference>
47+
48+
49+
<beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></beans:bean>
5050
</beans:beans>

pinyougou-parent/pinyougou-shop-web/src/main/resources/spring/springmvc.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525

2626
<!-- 引用dubbo 服务 -->
2727
<dubbo:application name="pinyougou-shop-web" />
28-
<dubbo:registry address="zookeeper://192.168.25.135:2181" timeout="50000"/>
29-
<dubbo:annotation package="com.pinyougou.shop.controller" />
30-
31-
28+
<dubbo:registry address="zookeeper://192.168.25.135:2181"/>
29+
<dubbo:annotation package="com.pinyougou.shop.controller" />
3230

3331
</beans>

pinyougou-parent/pinyougou-shop-web/src/main/webapp/WEB-INF/web.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<servlet-name>springmvc</servlet-name>
3636
<url-pattern>*.do</url-pattern>
3737
</servlet-mapping>
38-
38+
3939
<context-param>
4040
<param-name>contextConfigLocation</param-name>
4141
<param-value>classpath:spring/spring-security.xml</param-value>
@@ -50,8 +50,9 @@
5050
<filter-name>springSecurityFilterChain</filter-name>
5151
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
5252
</filter>
53-
<filter-mapping>
53+
<filter-mapping>
5454
<filter-name>springSecurityFilterChain</filter-name>
5555
<url-pattern>/*</url-pattern>
56-
</filter-mapping>
56+
</filter-mapping>
57+
5758
</web-app>

pinyougou-parent/pinyougou-shop-web/src/main/webapp/admin/goods_edit.html

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,27 @@
133133
<!-- 颜色图片 -->
134134
<div class="btn-group">
135135
<button type="button" class="btn btn-default" title="新建" data-target="#uploadModal" data-toggle="modal" ><i class="fa fa-file-o"></i> 新建</button>
136-
136+
<button type="button" class="btn btn-default" title="删除" ><i class="fa fa-trash-o"></i> 删除</button>
137137
</div>
138138

139139
<table class="table table-bordered table-striped table-hover dataTable">
140140
<thead>
141141
<tr>
142-
142+
<th class="" style="padding-right:0px">
143+
<input id="selall" type="checkbox" class="icheckbox_square-blue">
144+
</th>
143145
<th class="sorting">颜色</th>
144146
<th class="sorting">图片</th>
145-
<th class="sorting">操作</th>
146147
</thead>
147148
<tbody>
148-
<tr>
149+
<tr>
150+
<td><input type="checkbox" ></td>
149151
<td>
150152

151153
</td>
152154
<td>
153155
<img alt="" src="" width="100px" height="100px">
154156
</td>
155-
<td> <button type="button" class="btn btn-default" title="删除" ><i class="fa fa-trash-o"></i> 删除</button></td>
156157
</tr>
157158
</tbody>
158159
</table>
@@ -184,7 +185,8 @@
184185
<div class="row data-type">
185186
<div class="col-md-2 title">是否启用规格</div>
186187
<div class="col-md-10 data">
187-
<input type="checkbox" >
188+
<input type="checkbox" >
189+
<button type="button" class="btn btn-default" title="自定义规格" data-target="#mySpecModal" data-toggle="modal" ><i class="fa fa-file-o"></i> 自定义规格</button>
188190
</div>
189191
</div>
190192
<p>
@@ -376,7 +378,7 @@ <h3 id="myModalLabel">上传商品图片</h3>
376378
</button>
377379
</td>
378380
<td>
379-
<img src="" width="200px" height="200px">
381+
<img src="{{image_entity.url}}" width="200px" height="200px">
380382
</td>
381383
</tr>
382384
</table>
@@ -393,6 +395,40 @@ <h3 id="myModalLabel">上传商品图片</h3>
393395
</div>
394396
</div>
395397

398+
399+
400+
<!-- 自定义规格窗口 -->
401+
<div class="modal fade" id="mySpecModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
402+
<div class="modal-dialog" >
403+
<div class="modal-content">
404+
<div class="modal-header">
405+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
406+
<h3 id="myModalLabel">自定义规格</h3>
407+
</div>
408+
<div class="modal-body">
409+
410+
<table class="table table-bordered table-striped">
411+
<tr>
412+
<td>规格名称</td>
413+
<td><input class="form-control" placeholder="规格名称" > </td>
414+
</tr>
415+
<tr>
416+
<td>规格选项(用逗号分隔)</td>
417+
<td>
418+
<input class="form-control" placeholder="规格选项" >
419+
</td>
420+
</tr>
421+
</table>
422+
423+
</div>
424+
<div class="modal-footer">
425+
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">保存</button>
426+
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
427+
</div>
428+
</div>
429+
</div>
430+
</div>
431+
396432

397433
<!-- 正文区域 /-->
398434
<script type="text/javascript">

pinyougou-parent/pinyougou-shop-web/src/main/webapp/admin/index.html

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99
<!-- Tell the browser to be responsive to screen width -->
1010
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
1111
<!-- 页面meta /-->
12+
1213
<link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
1314
<link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
1415
<link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
1516
<link rel="stylesheet" href="../css/style.css">
1617

17-
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
18-
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
19-
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
20-
21-
<script src="../plugins/adminLTE/js/app.min.js"></script>
22-
2318

2419

2520
<script type="text/javascript">
@@ -266,7 +261,7 @@ <h3>
266261
<img src="../img/user2-160x160.jpg" class="img-circle" alt="User Image">
267262

268263
<p>
269-
chendahai
264+
chendahai - 陈大海
270265
<small>最后登录 11:20AM</small>
271266
</p>
272267
</li>
@@ -381,6 +376,37 @@ <h3>
381376
</div>
382377

383378

379+
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
380+
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
381+
<script>
382+
$.widget.bridge('uibutton', $.ui.button);
383+
</script>
384+
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
385+
<script src="../plugins/raphael/raphael-min.js"></script>
386+
<script src="../plugins/morris/morris.min.js"></script>
387+
<script src="../plugins/sparkline/jquery.sparkline.min.js"></script>
388+
<script src="../plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
389+
<script src="../plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
390+
<script src="../plugins/knob/jquery.knob.js"></script>
391+
<script src="../plugins/daterangepicker/moment.min.js"></script>
392+
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
393+
<script src="../plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
394+
<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
395+
<script src="../plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
396+
<script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
397+
<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
398+
<script src="../plugins/fastclick/fastclick.js"></script>
399+
<script src="../plugins/iCheck/icheck.min.js"></script>
400+
<script src="../plugins/adminLTE/js/app.min.js"></script>
401+
<script src="../plugins/treeTable/jquery.treetable.js"></script>
402+
<script src="../plugins/select2/select2.full.min.js"></script>
403+
<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
404+
<script src="../plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
405+
<script src="../plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
406+
<script src="../plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
407+
<script src="../plugins/bootstrap-markdown/js/markdown.js"></script>
408+
<script src="../plugins/bootstrap-markdown/js/to-markdown.js"></script>
409+
<script src="../plugins/ckeditor/ckeditor.js"></script>
384410

385411
</body>
386412

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var app=angular.module('pinyougou',[]);//定义品优购模块
1+
var app=angular.module('pinyougou',[]);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var app=angular.module('pinyougou',['pagination']);//定义品优购模块
1+
var app=angular.module('pinyougou',['pagination']);

0 commit comments

Comments
 (0)
X Tutup