提交 4c86a049 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码 [ ibiz-pay,支付]

上级 5886cfae
...@@ -11,6 +11,7 @@ import org.apache.ibatis.mapping.VendorDatabaseIdProvider; ...@@ -11,6 +11,7 @@ import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Properties; import java.util.Properties;
/** /**
...@@ -19,7 +20,6 @@ import java.util.Properties; ...@@ -19,7 +20,6 @@ import java.util.Properties;
@Configuration @Configuration
@MapperScan(value="cn.ibizlab.core.*.mapper",nameGenerator = UniqueNameGenerator.class) @MapperScan(value="cn.ibizlab.core.*.mapper",nameGenerator = UniqueNameGenerator.class)
public class MybatisConfiguration { public class MybatisConfiguration {
/** /**
* mybatis适配多数据库 * mybatis适配多数据库
* @return * @return
...@@ -54,4 +54,5 @@ public class MybatisConfiguration { ...@@ -54,4 +54,5 @@ public class MybatisConfiguration {
return paginationInterceptor; return paginationInterceptor;
} }
} }
\ No newline at end of file
package cn.ibizlab.util.helper; package cn.ibizlab.util.helper;
import cn.ibizlab.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -312,6 +311,13 @@ public class RuleUtils ...@@ -312,6 +311,13 @@ public class RuleUtils
} }
public static boolean ge(Object exp, Object finalObject) public static boolean ge(Object exp, Object finalObject)
{ {
if(ObjectUtils.isEmpty(exp)){
return false;
}
if(ObjectUtils.isEmpty(finalObject)){
return false;
}
return (!(lt(exp, finalObject))); return (!(lt(exp, finalObject)));
} }
...@@ -321,6 +327,12 @@ public class RuleUtils ...@@ -321,6 +327,12 @@ public class RuleUtils
} }
public static boolean le(Object exp, Object finalObject) public static boolean le(Object exp, Object finalObject)
{ {
if(ObjectUtils.isEmpty(exp)){
return false;
}
if(ObjectUtils.isEmpty(finalObject)){
return false;
}
return (!(gt(exp, finalObject))); return (!(gt(exp, finalObject)));
} }
...@@ -330,6 +342,15 @@ public class RuleUtils ...@@ -330,6 +342,15 @@ public class RuleUtils
} }
public static boolean notin(Object expObj, Object finalObject) public static boolean notin(Object expObj, Object finalObject)
{ {
if (ObjectUtils.isEmpty(finalObject))
return true;
if (ObjectUtils.isEmpty(expObj))
return false;
String tvs=expObj.toString().trim();
if(StringUtils.isEmpty(tvs)){
return false;
}
return (!in(expObj,finalObject)); return (!in(expObj,finalObject));
} }
public static boolean in(Object expObj, Object object, String members) public static boolean in(Object expObj, Object object, String members)
...@@ -340,7 +361,8 @@ public class RuleUtils ...@@ -340,7 +361,8 @@ public class RuleUtils
{ {
if (ObjectUtils.isEmpty(finalObject)) if (ObjectUtils.isEmpty(finalObject))
return false; return false;
if (ObjectUtils.isEmpty(expObj))
return false;
String tvs=expObj.toString().trim(); String tvs=expObj.toString().trim();
if(StringUtils.isEmpty(tvs)){ if(StringUtils.isEmpty(tvs)){
return false; return false;
...@@ -397,6 +419,16 @@ public class RuleUtils ...@@ -397,6 +419,16 @@ public class RuleUtils
} }
public static boolean notmatchor(Object expObj, Object obj) public static boolean notmatchor(Object expObj, Object obj)
{ {
if(ObjectUtils.isEmpty(obj)){
return true;
}
if(ObjectUtils.isEmpty(expObj)){
return false;
}
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp)){
return false;
}
return (!matchor(expObj,obj)); return (!matchor(expObj,obj));
} }
...@@ -406,6 +438,16 @@ public class RuleUtils ...@@ -406,6 +438,16 @@ public class RuleUtils
} }
public static boolean notmatchand(Object expObj, Object finalObject) public static boolean notmatchand(Object expObj, Object finalObject)
{ {
if(ObjectUtils.isEmpty(finalObject)){
return true;
}
if(ObjectUtils.isEmpty(expObj)){
return false;
}
String exp=expObj.toString().trim();
if(StringUtils.isEmpty(exp)){
return false;
}
return (!matchand(expObj,finalObject)); return (!matchand(expObj,finalObject));
} }
...@@ -415,7 +457,10 @@ public class RuleUtils ...@@ -415,7 +457,10 @@ public class RuleUtils
} }
public static boolean matchor(Object expObj, Object obj) public static boolean matchor(Object expObj, Object obj)
{ {
if(obj==null){ if(ObjectUtils.isEmpty(obj)){
return false;
}
if(ObjectUtils.isEmpty(expObj)){
return false; return false;
} }
String exp=expObj.toString().trim(); String exp=expObj.toString().trim();
...@@ -438,7 +483,10 @@ public class RuleUtils ...@@ -438,7 +483,10 @@ public class RuleUtils
public static boolean leftmatchor(Object expObj, Object obj) public static boolean leftmatchor(Object expObj, Object obj)
{ {
if(obj==null){ if(ObjectUtils.isEmpty(obj)){
return false;
}
if(ObjectUtils.isEmpty(expObj)){
return false; return false;
} }
String exp=expObj.toString().trim(); String exp=expObj.toString().trim();
...@@ -462,7 +510,10 @@ public class RuleUtils ...@@ -462,7 +510,10 @@ public class RuleUtils
public static boolean rightmatchor(Object expObj, Object obj) public static boolean rightmatchor(Object expObj, Object obj)
{ {
if(obj==null){ if(ObjectUtils.isEmpty(obj)){
return false;
}
if(ObjectUtils.isEmpty(expObj)){
return false; return false;
} }
String exp=expObj.toString().trim(); String exp=expObj.toString().trim();
...@@ -490,10 +541,10 @@ public class RuleUtils ...@@ -490,10 +541,10 @@ public class RuleUtils
} }
public static boolean matchand(Object expObj,Object obj) public static boolean matchand(Object expObj,Object obj)
{ {
if(obj==null){ if(ObjectUtils.isEmpty(obj)){
return false; return false;
} }
if(expObj==null){ if(ObjectUtils.isEmpty(expObj)){
return false; return false;
} }
String exp=expObj.toString().trim(); String exp=expObj.toString().trim();
...@@ -580,4 +631,56 @@ public class RuleUtils ...@@ -580,4 +631,56 @@ public class RuleUtils
} }
return acts; return acts;
} }
public static boolean inc2s(String tvs, Object finalObject)
{
if (ObjectUtils.isEmpty(finalObject))
return false;
if(StringUtils.isEmpty(tvs))
return false;
if (finalObject instanceof String)
{
tvs="s:"+tvs;
}
else
return false;
List acts = parseTvs(tvs);
for (Iterator localIterator = acts.iterator(); localIterator.hasNext();)
{
Object act = localIterator.next();
if (equal(c2s(act.toString()),c2s(finalObject.toString())))
return true;
}
return false;
}
public static String c2s(String str)
{
if(str==null)
return null;
if(str.length()<300)
{
str=str.trim();//1234567890()【】〔2018〕
str=str.replace("1","1").replace("2","2").replace("3","3").replace("4","4").
replace("5","5").replace("6","6").replace("7","7")
.replace("8","8").replace("9","9").replace("0","0")
.replace("(","〔").replace(")","〕")
.replace("(","〔").replace(")","〕")
.replace("【","〔").replace("】","〕")
.replace("[","〔").replace("]","〕");
}
return str;
}
public static boolean notinc2s(String tvs, Object finalObject)
{
return (!inc2s(tvs,finalObject));
}
} }
\ No newline at end of file
package cn.ibizlab.util.helper;
import cn.ibizlab.util.domain.EntityBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.StringReader;
import java.util.*;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class Setting {
private String property;
private String value;
public static String getValue(String configString,String propertyName)
{
return DataObject.getStringValue(getMap(configString).get(propertyName),"");
}
public static <T extends EntityBase> T getEntity(String configString,T entityBase)
{
if(entityBase!=null) {
Map map=getMap(configString);
map.keySet().forEach(key->{
entityBase.set(key.toString(),map.get(key));
});
}
return entityBase;
}
public static Map getMap(String configString)
{
Map map=new HashMap();
map.put("param",configString);
if(!(StringUtils.isEmpty(configString)))
{
try
{
Object obj=JSON.parse(configString);
if(obj==null)
return map;
else if (obj instanceof JSONArray)
{
List<Setting> settings= JSONArray.parseArray(configString,Setting.class);
for(Setting setting:settings)
map.put(setting.getProperty(),setting.getValue());
}
else if (obj instanceof JSONObject)
{
JSONObject jo = (JSONObject)obj;
jo.keySet().forEach(key->{
map.put(key,jo.get(key));
});
}
}
catch (Exception ex)
{
if(configString.indexOf("=")>0)
{
Properties proper = new Properties();
try {
proper.load(new StringReader(configString)); //把字符串转为reader
} catch (IOException e) {
}
Enumeration enum1 = proper.propertyNames();
while (enum1.hasMoreElements()) {
String strKey = (String) enum1.nextElement();
String strValue = proper.getProperty(strKey);
map.put(strKey, strValue);
}
}
}
}
return map;
}
}
...@@ -49,6 +49,14 @@ public class AuthenticationUser implements UserDetails ...@@ -49,6 +49,14 @@ public class AuthenticationUser implements UserDetails
*/ */
private String domain; private String domain;
/** /**
* 租户
*/
private String srfdcid;
/**
* 动态实例标识
*/
private String srfdynainstid;
/**
* 部门标识 * 部门标识
*/ */
private String mdeptid; private String mdeptid;
......
...@@ -3,6 +3,7 @@ package cn.ibizlab.util.security; ...@@ -3,6 +3,7 @@ package cn.ibizlab.util.security;
import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.service.AuthenticationUserService; import cn.ibizlab.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
...@@ -26,7 +27,7 @@ import java.util.*; ...@@ -26,7 +27,7 @@ import java.util.*;
@Component @Component
public class AuthorizationTokenFilter extends OncePerRequestFilter { public class AuthorizationTokenFilter extends OncePerRequestFilter {
private final UserDetailsService userDetailsService; private final AuthenticationUserService userDetailsService;
private final AuthTokenUtil authTokenUtil; private final AuthTokenUtil authTokenUtil;
private final String tokenHeader; private final String tokenHeader;
private Set<String> excludesPattern = new HashSet<String>(); private Set<String> excludesPattern = new HashSet<String>();
...@@ -60,7 +61,6 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter { ...@@ -60,7 +61,6 @@ public class AuthorizationTokenFilter extends OncePerRequestFilter {
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
if (authTokenUtil.validateToken(authToken, userDetails)) { if (authTokenUtil.validateToken(authToken, userDetails)) {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
......
...@@ -16,11 +16,16 @@ public interface AuthenticationUserService extends UserDetailsService { ...@@ -16,11 +16,16 @@ public interface AuthenticationUserService extends UserDetailsService {
@Override @Override
@Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0") @Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByUsername(String username); default AuthenticationUser loadUserByUsername(String username){
return null ;
}
@Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0") @Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByLogin(String username,String password); AuthenticationUser loadUserByLogin(String username,String password);
@CacheEvict( value="ibzuaa_users", key = "'getByUsername:'+#p0") @CacheEvict( value="ibzuaa_users", key = "'getByUsername:'+#p0")
void resetByUsername(String username); default void resetByUsername(String username){}
} }
...@@ -54,10 +54,4 @@ public class IBZUAAUserService implements AuthenticationUserService{ ...@@ -54,10 +54,4 @@ public class IBZUAAUserService implements AuthenticationUserService{
return user; return user;
} }
@Override
public void resetByUsername(String username) {
}
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册