强壮代码

This commit is contained in:
thinkgem
2020-03-15 12:13:59 +08:00
parent effa1ef257
commit 203161867d
4 changed files with 17 additions and 9 deletions

View File

@@ -97,7 +97,9 @@ public class ReflectUtils {
Field field = getAccessibleField(obj, fieldName); Field field = getAccessibleField(obj, fieldName);
if (field == null) { if (field == null) {
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); //throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 "); if (obj != null) {
logger.debug("在 [" + obj.getClass() + "] 中,没有找到 [" + fieldName + "] 字段 ");
}
return null; return null;
} }
E result = null; E result = null;
@@ -141,7 +143,9 @@ public class ReflectUtils {
Method method = getAccessibleMethod(obj, methodName, parameterTypes); Method method = getAccessibleMethod(obj, methodName, parameterTypes);
if (method == null) { if (method == null) {
//throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); //throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 "); if (obj != null) {
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 ");
}
return null; return null;
} }
try { try {
@@ -164,7 +168,9 @@ public class ReflectUtils {
if (method == null) { if (method == null) {
// 如果为空不报错,直接返回空。 // 如果为空不报错,直接返回空。
// throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 "); // throw new IllegalArgumentException("在 [" + obj.getClass() + "] 中,没有找到 [" + methodName + "] 方法 ");
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 "); if (obj != null) {
logger.debug("在 [" + (obj.getClass() == Class.class ? obj : obj.getClass()) + "] 中,没有找到 [" + methodName + "] 方法 ");
}
return null; return null;
} }
try { try {

View File

@@ -50,12 +50,14 @@ public class ShiroConfig {
/** /**
* Apache Shiro Filter * Apache Shiro Filter
* @throws Exception
*/ */
@Bean @Bean
@Order(3000) @Order(3000)
@ConditionalOnMissingBean(name="shiroFilterProxy") @ConditionalOnMissingBean(name="shiroFilterProxy")
public FilterRegistrationBean<Filter> shiroFilterProxy(ShiroFilterFactoryBean shiroFilter) throws Exception { public FilterRegistrationBean<Filter> shiroFilterProxy(ShiroFilterFactoryBean shiroFilter) throws Exception {
if (Global.isUseCorpModel() != Global.getPropertyToBoolean("user.useCorpModel", "false")){
throw new Exception("\n\nuser.useCorpModel=true? 你是否开启了多租户模式视乎你的当前版本不是JeeSite专业版。\n");
}
FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>(); FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
bean.setFilter((Filter) shiroFilter.getInstance()); bean.setFilter((Filter) shiroFilter.getInstance());
bean.addUrlPatterns("/*"); bean.addUrlPatterns("/*");

View File

@@ -97,12 +97,12 @@ public class EmpUser extends User {
@ExcelField(title="电子邮箱", attrName="email", align=Align.LEFT, sort=50), @ExcelField(title="电子邮箱", attrName="email", align=Align.LEFT, sort=50),
@ExcelField(title="手机号码", attrName="mobile", align=Align.CENTER, sort=60), @ExcelField(title="手机号码", attrName="mobile", align=Align.CENTER, sort=60),
@ExcelField(title="办公电话", attrName="phone", align=Align.CENTER, sort=70), @ExcelField(title="办公电话", attrName="phone", align=Align.CENTER, sort=70),
@ExcelField(title="性别", attrName="sex", dictType="sys_user_sex", words=10, align=Align.CENTER, sort=75), @ExcelField(title="性别", attrName="sex", dictType="sys_user_sex", align=Align.CENTER, words=10, sort=75),
@ExcelField(title="员工编码", attrName="employee.empCode", align=Align.CENTER, sort=80), @ExcelField(title="员工编码", attrName="employee.empCode", align=Align.CENTER, sort=80),
@ExcelField(title="员工姓名", attrName="employee.empName", align=Align.CENTER, sort=95), @ExcelField(title="员工姓名", attrName="employee.empName", align=Align.CENTER, sort=95),
@ExcelField(title="拥有角色编号", attrName="userRoleString", align=Align.LEFT, sort=800, type=ExcelField.Type.IMPORT), @ExcelField(title="拥有角色编号", attrName="userRoleString", align=Align.LEFT, sort=800, type=ExcelField.Type.IMPORT),
@ExcelField(title="建档日期", attrName="createDate", words=15, align=Align.CENTER, sort=900, type=ExcelField.Type.EXPORT, dataFormat="yyyy-MM-dd"), @ExcelField(title="建档日期", attrName="createDate", align=Align.CENTER, words=15, sort=900, type=ExcelField.Type.EXPORT, dataFormat="yyyy-MM-dd"),
@ExcelField(title="最后登录", attrName="lastLoginDate", words=20, align=Align.CENTER, sort=900, type=ExcelField.Type.EXPORT), @ExcelField(title="最后登录", attrName="lastLoginDate", align=Align.CENTER, words=20, sort=900, type=ExcelField.Type.EXPORT),
}) })
public Employee getEmployee(){ public Employee getEmployee(){
Employee employee = (Employee)super.getRefObj(); Employee employee = (Employee)super.getRefObj();

View File

@@ -41,7 +41,7 @@ var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{
//win.$('button[type=reset]').click(); //win.$('button[type=reset]').click();
win.$('#officeCode').val(treeNode.id); win.$('#officeCode').val(treeNode.id);
win.$('#officeName').val(treeNode.name); win.$('#officeName').val(treeNode.name);
win.page(); win.page(1);
}} }}
}, tree, loadTree = function(){ }, tree, loadTree = function(){
js.ajaxSubmit("${ctx}/sys/office/treeData?___t=" + new Date().getTime(), js.ajaxSubmit("${ctx}/sys/office/treeData?___t=" + new Date().getTime(),
@@ -73,7 +73,7 @@ $('#btnCollapse').click(function(){
$('#btnRefresh').click(function(){ $('#btnRefresh').click(function(){
loadTree(); loadTree();
}); });
//调用子页分页函数 // 调用子页分页函数
function page(){ function page(){
win.page(); win.page();
} }