Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
商家认证 可用版
  • Loading branch information
Cook-R committed Mar 20, 2019
commit b48e4c2b4105bae73e40e2ef032c522b7ebd3118
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.pinyougou.service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.omg.CORBA.PRIVATE_MEMBER;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
Expand All @@ -13,49 +13,38 @@

import com.pinyougou.pojo.TbSeller;
import com.pinyougou.sellergoods.service.SellerService;

/**
* 认证类
* @author rxs
* @author Administrator
*
*/
public class UserDetailsServiceImpl implements UserDetailsService {


private SellerService sellerService;

public SellerService getSellerService() {
return sellerService;
}

public void setSellerService(SellerService sellerService) {
this.sellerService = sellerService;
}

@Override
public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException {


System.out.println("经过了这个类型方法阿斯顿发");
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
System.out.println("经过了UserDetailsServiceImpl");
//构建角色列表
List<GrantedAuthority> grantAuths =new ArrayList();
List<GrantedAuthority> grantAuths=new ArrayList();
grantAuths.add(new SimpleGrantedAuthority("ROLE_SELLER"));

//得到商家对象
TbSeller seller = sellerService.findOne(username);
if(seller !=null){
if(seller!=null){
if(seller.getStatus().equals("1")){
return new User(username,seller.getPassword(),grantAuths);

}else {
}else{
return null;
}

}else {
}
}else{
return null;
}

}



}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.pinyougou.pojo.TbSeller;
import com.pinyougou.sellergoods.service.SellerService;
Expand Down Expand Up @@ -50,9 +49,11 @@ public PageResult findPage(int page,int rows){
*/
@RequestMapping("/add")
public Result add(@RequestBody TbSeller seller){
//密码加密
BCryptPasswordEncoder passwordEncoder=new BCryptPasswordEncoder();
String password = passwordEncoder.encode(seller.getPassword());
String password = passwordEncoder.encode(seller.getPassword());//加密
seller.setPassword(password);

try {
sellerService.add(seller);
return new Result(true, "增加成功");
Expand Down Expand Up @@ -84,7 +85,7 @@ public Result update(@RequestBody TbSeller seller){
* @return
*/
@RequestMapping("/findOne")
public TbSeller findOne(String id){
public TbSeller findOne(String id){
return sellerService.findOne(id);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">


<!-- 设置页面不登录也可以访问 -->

<!-- 设置页面不登陆也可以访问 -->
<http pattern="/*.html" security="none"></http>
<http pattern="/css/**" security="none"></http>
<http pattern="/img/**" security="none"></http>
<http pattern="/plugins/**" security="none"></http>
<http pattern="/js/**" security="none"></http>
<http pattern="/plugins/**" security="none"></http>
<http pattern="/seller/add.do" security="none"></http>
<!-- 页面的拦截规则 use-expressions:是否启动SPEL表达式 默认是true -->

<!-- 页面的拦截规则 use-expressions:是否启动SPEL表达式 默认是true -->
<http use-expressions="false">
<!-- 当前用户必须拥有ROLE_USER的角色 才可以访问更目录及所属子目录的资源 -->
<!-- 当前用户必须有ROLE_USER的角色 才可以访问根目录及所属子目录的资源 -->
<intercept-url pattern="/**" access="ROLE_SELLER"/>
<!-- 开启表单登录功能 -->
<form-login login-page="/shoplogin.html" default-target-url="/admin/index.html" authentication-failure-url="/shoplogin.html" always-use-default-target="true"/>
<!-- 开启表单登陆功能 -->
<form-login login-page="/shoplogin.html" default-target-url="/admin/index.html" authentication-failure-url="/shoplogin.html" always-use-default-target="true"/>
<csrf disabled="true"/>
<headers>
<frame-options policy="SAMEORIGIN"/>
</headers>
<logout/>
</http>
<!-- 认证管理器 -->
<authentication-manager>
<!-- 认证的提供者 -->
<authentication-provider user-service-ref="userDetailService">
<password-encoder ref="bcryptEncoder"></password-encoder>
</authentication-provider>
</authentication-manager>

<!-- 认证类 -->
<beans:bean id="userDetailService" class="com.pinyougou.service.UserDetailsServiceImpl">
<beans:property name="sellerService" ref="sellerService" ></beans:property>
</beans:bean>

<!-- 引用dubbo 服务 -->
<dubbo:application name="pinyougou-shop-web" />
<dubbo:registry address="zookeeper://192.168.25.135:2181" timeout="50000"/>
<dubbo:reference id="sellerService" interface="com.pinyougou.sellergoods.service.SellerService"></dubbo:reference>


<!-- 认证管理器 -->
<authentication-manager>
<authentication-provider user-service-ref="userDetailService">
<password-encoder ref="bcryptEncoder"></password-encoder>
</authentication-provider>
</authentication-manager>

<beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></beans:bean>
<!-- 认证类 -->
<beans:bean id="userDetailService" class="com.pinyougou.service.UserDetailsServiceImpl">
<beans:property name="sellerService" ref="sellerService"></beans:property>
</beans:bean>

<!-- 引用dubbo 服务 -->
<dubbo:application name="pinyougou-shop-web" />
<dubbo:registry address="zookeeper://192.168.25.135:2181"/>
<dubbo:reference id="sellerService" interface="com.pinyougou.sellergoods.service.SellerService"></dubbo:reference>


<beans:bean id="bcryptEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></beans:bean>
</beans:beans>
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

<!-- 引用dubbo 服务 -->
<dubbo:application name="pinyougou-shop-web" />
<dubbo:registry address="zookeeper://192.168.25.135:2181" timeout="50000"/>
<dubbo:annotation package="com.pinyougou.shop.controller" />


<dubbo:registry address="zookeeper://192.168.25.135:2181"/>
<dubbo:annotation package="com.pinyougou.shop.controller" />

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-security.xml</param-value>
Expand All @@ -50,8 +50,9 @@
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</filter-mapping>

</web-app>
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,27 @@
<!-- 颜色图片 -->
<div class="btn-group">
<button type="button" class="btn btn-default" title="新建" data-target="#uploadModal" data-toggle="modal" ><i class="fa fa-file-o"></i> 新建</button>

<button type="button" class="btn btn-default" title="删除" ><i class="fa fa-trash-o"></i> 删除</button>
</div>

<table class="table table-bordered table-striped table-hover dataTable">
<thead>
<tr>

<th class="" style="padding-right:0px">
<input id="selall" type="checkbox" class="icheckbox_square-blue">
</th>
<th class="sorting">颜色</th>
<th class="sorting">图片</th>
<th class="sorting">操作</th>
</thead>
<tbody>
<tr>
<tr>
<td><input type="checkbox" ></td>
<td>

</td>
<td>
<img alt="" src="" width="100px" height="100px">
</td>
<td> <button type="button" class="btn btn-default" title="删除" ><i class="fa fa-trash-o"></i> 删除</button></td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -184,7 +185,8 @@
<div class="row data-type">
<div class="col-md-2 title">是否启用规格</div>
<div class="col-md-10 data">
<input type="checkbox" >
<input type="checkbox" >
<button type="button" class="btn btn-default" title="自定义规格" data-target="#mySpecModal" data-toggle="modal" ><i class="fa fa-file-o"></i> 自定义规格</button>
</div>
</div>
<p>
Expand Down Expand Up @@ -376,7 +378,7 @@ <h3 id="myModalLabel">上传商品图片</h3>
</button>
</td>
<td>
<img src="" width="200px" height="200px">
<img src="{{image_entity.url}}" width="200px" height="200px">
</td>
</tr>
</table>
Expand All @@ -393,6 +395,40 @@ <h3 id="myModalLabel">上传商品图片</h3>
</div>
</div>



<!-- 自定义规格窗口 -->
<div class="modal fade" id="mySpecModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">自定义规格</h3>
</div>
<div class="modal-body">

<table class="table table-bordered table-striped">
<tr>
<td>规格名称</td>
<td><input class="form-control" placeholder="规格名称" > </td>
</tr>
<tr>
<td>规格选项(用逗号分隔)</td>
<td>
<input class="form-control" placeholder="规格选项" >
</td>
</tr>
</table>

</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">保存</button>
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
</div>
</div>
</div>
</div>


<!-- 正文区域 /-->
<script type="text/javascript">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<!-- 页面meta /-->

<link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="../css/style.css">

<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>

<script src="../plugins/adminLTE/js/app.min.js"></script>



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

<p>
chendahai
chendahai - 陈大海
<small>最后登录 11:20AM</small>
</p>
</li>
Expand Down Expand Up @@ -381,6 +376,37 @@ <h3>
</div>


<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="../plugins/raphael/raphael-min.js"></script>
<script src="../plugins/morris/morris.min.js"></script>
<script src="../plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="../plugins/knob/jquery.knob.js"></script>
<script src="../plugins/daterangepicker/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="../plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="../plugins/fastclick/fastclick.js"></script>
<script src="../plugins/iCheck/icheck.min.js"></script>
<script src="../plugins/adminLTE/js/app.min.js"></script>
<script src="../plugins/treeTable/jquery.treetable.js"></script>
<script src="../plugins/select2/select2.full.min.js"></script>
<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
<script src="../plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script src="../plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
<script src="../plugins/bootstrap-markdown/js/markdown.js"></script>
<script src="../plugins/bootstrap-markdown/js/to-markdown.js"></script>
<script src="../plugins/ckeditor/ckeditor.js"></script>

</body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var app=angular.module('pinyougou',[]);//定义品优购模块
var app=angular.module('pinyougou',[]);
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var app=angular.module('pinyougou',['pagination']);//定义品优购模块
var app=angular.module('pinyougou',['pagination']);
Loading