江苏常州小学生坠楼案进展:班主任降岗 事发原因仍不明
作者:互联网
http://www.caixin.com/2020-07-08/101577226.html
package com.tansuo365.test1.bean.kucunbean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tansuo365.test1.bean.InfoData;
import com.tansuo365.test1.bean.otherbean.DWuliao;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
* chuku xiangqing
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ChukuDetails implements Serializable,InfoData {
private Integer id;
private String dalei;
private String wuliaobianma;
private String mingchengguige; //名称规格
private String danwei;
private Double chukushuliang; //出库数量
private Double tuihuishuliang; //退回数量
private Double huishoushuliang; //回收数量
private String chukukufang;
private String beizhu;
private String kehuishou; //是否可回收 (空瓶空桶)
private String huishouxiang; //回收项 回收的是啥东西
private String xiangmumingcheng; //项目名称
@Transient
private String lingliaodanwei; //领料单位
@Transient
private Integer o_id; //物料类别id
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_btime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_etime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createtime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime;
private Integer zongzhangid;
@Transient
private String sort;
@Transient
private String order;
}
package com.tansuo365.test1.bean.kucunbean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ChukuZhixing implements Serializable {
private Integer id;
private String duiyingchukudanhao;
private String chukutuikuzhuangtai;
private String xiangmumingcheng;
private Double chukushuliang;
private Double tuikushuliang;
private Double weituihuiliang;
private String mingchengguige;
private String wuliaobianma;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createtime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime;
private String chukukufang;
private String beizhu;
private String danwei;
private String dalei;
private String lingliaodanwei;
private String lingliaoren;
private String faliaoren;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_btime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_etime;
@Transient
private String sort;
@Transient
private String order;
}
package com.tansuo365.test1.bean.kucunbean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
* chukudan
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ChukuZong implements Serializable {
private Integer id;
private String wuliaochukudanhao;
private String xiangmumingcheng;
private String chkukufang;
private String lingliaodanwei;
private String lingliaoren;
private String faliaoren;
private String zhaiyao;
private String beizhu;
private String founder;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createtime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime;
private String candelete; //关联状态,默认 1 关联,前端无法进行更改
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_btime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Transient
private String s_etime;
@Transient
private String sort;
@Transient
private String order;
}
package com.tansuo365.test1.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @author ukyo
* @date 2020/4/22
* @description 多线程,在创建单号时不使之重复
*/
@Configuration
@EnableAsync
public class AsyncConfig {
@Bean
public TaskExecutor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 设置核心线程数
executor.setCorePoolSize(5);
// 设置最大线程数
executor.setMaxPoolSize(10);
// 设置队列容量
executor.setQueueCapacity(20);
// 设置线程活跃时间(秒)
executor.setKeepAliveSeconds(60);
// 设置默认线程名称
executor.setThreadNamePrefix("danhao-");
// 设置拒绝策略
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// 等待所有任务结束后再关闭线程池
executor.setWaitForTasksToCompleteOnShutdown(true);
return executor;
}
}
package com.tansuo365.test1.config;
import io.swagger.annotations.ApiModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
/*国际化解析器 和@Value引入配置*/
@ApiModel(value="MyAppConfig我的应用配置",description="加载外部properties文件,中/英文切换")
@Configuration
public class MyAppConfig {
//让@Value加载properties中的参数成为可能
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
package com.tansuo365.test1.config;
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import com.tansuo365.test1.config.realm.DatabaseRealm;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.filter.DelegatingFilterProxy;
import java.util.LinkedHashMap;
import java.util.Map;
//import com.tansuo365.test1.filter.URLPathMatchingFilter;
//import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
/*权限配置类*/
@Configuration
@PropertySource(value= "classpath:encrypt.properties")
public class ShiroConfiguration {
// @Autowired
// private MemberShiroConfiguration memberShiroConfiguration;
@Value("${algorithm.name}")
private String algorithmName;
@Value("${algorithm.times}")
private int algorithmTimes;
//用于thymeleaf模板使用shiro标签
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
@Bean
public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public FilterRegistrationBean delegatingFilterProxy(){
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
DelegatingFilterProxy proxy = new DelegatingFilterProxy();
proxy.setTargetFilterLifecycle(true);
proxy.setTargetBeanName("shiroFilter");
filterRegistrationBean.setFilter(proxy);
return filterRegistrationBean;
}
/**
* ShiroFilterFactoryBean 处理拦截资源文件问题。
* 注意:单独一个ShiroFilterFactoryBean配置是或报错的,因为在
* 初始化ShiroFilterFactoryBean的时候需要注入:SecurityManager
* <p>
* Filter Chain定义说明
* 1、一个URL可以配置多个Filter,使用逗号分隔
* 2、当设置多个过滤器时,全部验证通过,才视为通过
* 3、部分过滤器可指定参数,如perms,roles
*/
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
//将设置url的参数改为application.properties中去配置
//securityManager改为可选择的进行传入
//customisedFilter的hashmap传入的url及URLPath...Filter改为参数可传入
//customisedFilter这个HashMap装配了登录及登录后可未授权页面(admin的配置admin的,member的配置member的)
//filterChainDefinitionMap
//1.securityManager中的realm按需配置
//2.shiroFilterFactoryBean中的set...Url为按需配置
//3.shiroFilterFactoryBean.setFilters(customisedFilter);中的customisedFilter按需配置
//**customisedFilter为put了仅仅一个"url",value为URL路径匹配过滤器(按需传入)
//4.shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
//**filterChainDefinitionMap为按需配置
// 必须设置 SecurityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
//这里注释掉user/login,并用
// shiroFilterFactoryBean.setLoginUrl("/user/login"); //原为/login
shiroFilterFactoryBean.setLoginUrl("/login.html"); //原为/login 会覆盖前面的出错
// 登录成功后要跳转的链接
// shiroFilterFactoryBean.setSuccessUrl("/user/index"); //原为/index
//未授权界面;
// shiroFilterFactoryBean.setUnauthorizedUrl("/user/unauthorized"); //原为/unauthorized
//拦截器.
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
//自定义拦截器
// Map<String, Filter> customisedFilter = new HashMap<>();
// customisedFilter.put("url", getURLPathMatchingFilter());
// customisedFilter.put("theMember",theMember());
// customisedFilter.put("theAdmin",theAdmin());
// //配置映射关系 anon表示不需要权限即可访问
// filterChainDefinitionMap.put("/user/login", "anon");
// filterChainDefinitionMap.put("/admin/login", "anon");
filterChainDefinitionMap.put("/admin/loginAdmin", "anon");
//// filterChainDefinitionMap.put("/admin/index", "anon");
filterChainDefinitionMap.put("/static/**", "anon");
filterChainDefinitionMap.put("/admin/config/**", "anon");
// filterChainDefinitionMap.put("/admin/reg", "anon");
filterChainDefinitionMap.put("/admin/user/register", "anon");
filterChainDefinitionMap.put("/admin/reg", "anon");
filterChainDefinitionMap.put("/admin/user/register", "anon");
// filterChainDefinitionMap.put("/user/doLogout", "logout");
filterChainDefinitionMap.put("/admin/doLogout", "logout");
// ;//后台登出
//// 单独放入member的配置中 filterChainDefinitionMap.put("/member/doLogout","logout");//前端客户登出
// filterChainDefinitionMap.put("/user/**", "url"); //路径/shiro_admin/**全部需要进行权限验证
// filterChainDefinitionMap.put("/admin/**", "url"); //路径/shiro_admin/**全部需要进行权限验证
// //其他资源都需要认证 authc 表示需要认证才能进行访问 user表示配置记住我或认证通过可以访问的地址
// filterChainDefinitionMap.put("/user/**", "theMember");
filterChainDefinitionMap.put("/admin/**", "user"); //user表示验证身份通过,保存了rememberMe时也可以通过
filterChainDefinitionMap.put("/swagger-ui.html", "authc"); //authc表示验证身份才能通过
filterChainDefinitionMap.put("/druid/login.html", "authc"); //authc表示验证身份才能通过
filterChainDefinitionMap.put("/druid/index.html", "authc"); //authc表示验证身份才能通过
//TODO 测试接口时注销 ,真正部署时 开放
filterChainDefinitionMap.put("/**", "authc"); //authc表示验证身份才能通过
// filterChainDefinitionMap.put("/excel/exportExcel/**", "anon"); //authc表示验证身份才能通过
// shiroFilterFactoryBean.setFilters(customisedFilter);
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
//
//
// }
// @Bean
// public AdminFilter theAdmin(){
// return new AdminFilter();
// }
//
// @Bean
// public MemberFilter theMember(){
// return new MemberFilter();
// }
// public
//
// public URLPathMatchingFilter getURLPathMatchingFilter() {
// return new URLPathMatchingFilter();
// }
/*安全管理器*/
@Bean(name = "securityManager")
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
//设置自定义realm.
securityManager.setRealm(getDatabaseRealm());
//配置记住我
securityManager.setRememberMeManager(rememberMeManager());
SecurityUtils.setSecurityManager(securityManager);
return securityManager;
}
// @Bean
// public FormAuthenticationFilter formAuthenticationFilter(){
// return new MyFormAuthenticationFilter();
// }
// @Bean
// public AdminRealm getAdminRealm(){
// AdminRealm adminRealm = new AdminRealm();
// adminRealm.setCredentialsMatcher(hashedCredentialsMatcher());
// return adminRealm;
// }
// @Bean
// public MyRealm getMyRealm(){
// MyRealm myRealm = new MyRealm();
// myRealm.setCredentialsMatcher(hashedCredentialsMatcher());
// return myRealm;
// }
// @Bean
// public MemberRealm getMemberRealm(){
// MemberRealm memberRealm = new MemberRealm();
// memberRealm.setCredentialsMatcher(hashedCredentialsMatcher());
// return memberRealm;
// }
@Bean
public DatabaseRealm getDatabaseRealm() {
DatabaseRealm myShiroRealm = new DatabaseRealm();
myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
return myShiroRealm;
}
// @Bean
// public MemberDatabaseRealm getMemberDatabaseRealm() {
// MemberDatabaseRealm memberShiroRealm = new MemberDatabaseRealm();
// memberShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher());
// return memberShiroRealm;
// }
/**
* 凭证匹配器
* (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了
* 所以我们需要修改下doGetAuthenticationInfo中的代码;
* )
*
* @return
*/
@Bean
public HashedCredentialsMatcher hashedCredentialsMatcher() {
HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher();
hashedCredentialsMatcher.setHashAlgorithmName(algorithmName);//散列算法:这里使用MD5算法;
hashedCredentialsMatcher.setHashIterations(algorithmTimes);//散列的次数,比如散列两次,相当于 md5(md5(""));
return hashedCredentialsMatcher;
}
/**
* cookie对象,会话Cookie模板,默认为:JSESSIONID
*
* @return
*/
@Bean
public SimpleCookie rememberMeCookie() {
SimpleCookie simpleCookie = new SimpleCookie("rememberMe");
simpleCookie.setHttpOnly(true);
simpleCookie.setPath("/");
simpleCookie.setMaxAge(60 * 60 * 24 * 30);//一个月cookie保留时间
return simpleCookie;
}
/**
* cookie管理对象,记住我功能,rememberMe管理器
*
* @return
*/
@Bean
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag=="));
return cookieRememberMeManager;
}
/**
* FormAuthenticationFilter过滤器 过滤记住我
*
* @return
*/
// @Bean
// public FormAuthenticationFilter formAuthenticationFilter() {
// FormAuthenticationFilter formAuthenticationFilter = new FormAuthenticationFilter();
// formAuthenticationFilter.setRememberMeParam("rememberMe");
// return formAuthenticationFilter;
// }
/**
* 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证
* 配置以下两个bean(DefaultAdvisorAutoProxyCreator和AuthorizationAttributeSourceAdvisor)即可实现此功能
* @return
*/
@Bean
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){
DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
advisorAutoProxyCreator.setProxyTargetClass(true);
return advisorAutoProxyCreator;
}
/**
* 开启shiro aop注解支持.
* 使用代理方式;所以需要开启代码支持;
*
* @param securityManager
* @return
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
}
标签:return,String,班主任,private,降岗,import,filterChainDefinitionMap,public,坠楼 来源: https://blog.51cto.com/u_11956468/3005089