jeesiteV1.2.7
Java代碼篇
StringUtils字符串工具類
位置:com.thinkgem.jeesite.common.utils
/**
* 判斷字符串是否不為空並且不為空字符串
* StringUtils.isNotBlank(null) = false
* * StringUtils.isNotBlank("") = false
* * StringUtils.isNotBlank(" ") = false
* * StringUtils.isNotBlank("bob") = true
* * StringUtils.isNotBlank(" bob ") = true
*/
StringUtils.isNotBlank("str1");
//判斷字符串是否為空
StringUtils.isBlank("str1");
//判斷字符串str1是否存在searchSeq
StringUtils.contains("str1", "searchSeq");
//判斷字符串是否為nul
StringUtils.isEmpty("str1");
//判斷字符串是否不為null
StringUtils.isNotEmpty("str1");
//替換字符串中的目標字符
StringUtils.replace("text", "searchString", "replacement");
//比對字符串
StringUtils.equals("CharSequence1", "CharSequence2");
//不區分大小寫比對字符串
StringUtils.equalsIgnoreCase("str1", "str2");
//拆分字符串,跟split用法相同,返回字符串數組
StringUtils.split("str","separatorChars");
DateUtils日期工具類
位置:com.thinkgem.jeesite.common.utils
//得到當前日期字符串 格式(yyyy-MM-dd)
DateUtils.getDate();
// 得到當前年份字符串 格式(yyyy)
DateUtils.getYear();
// 得到當前月份字符串 格式(MM)
DateUtils.getMonth();
//得到當天字符串 格式(dd)
DateUtils.getDay();
//得到當前日期字符串 格式(yyyy-MM-dd) pattern可以為:"yyyy-MM-dd" "HH:mm:ss" "E"
DateUtils.getDate("pattern");
//判斷兩個日期是否為同一天
DateUtils.isSameDay(new Date(), new Date());
//日期修改,為當前日期添加1天
DateUtils.addDays(new Date(), 1);
//字符串轉日期,parsePatterns如果沒有,默認格式轉換
DateUtils.parseDate("the date to parse, not null", "the date format patterns to use, see SimpleDateFormat, not null");
//得到日期字符串 默認格式(yyyy-MM-dd) pattern可以為:"yyyy-MM-dd" "HH:mm:ss" "E"
DateUtils.formatDate(new Date(), "parsePatterns");
IdGen id工具類
位置:com.thinkgem.jeesite.common.utils
//封裝JDK自帶的UUID, 通過Random數字生成, 中間無-分割.
IdGen.uuid();
Global全局配置類
位置:com.thinkgem.jeesite.common.config;
//獲取當前對象實例
getInstance()
// 獲取管理端根路徑
getAdminPath()
//獲取前端根路徑
getFrontPath()
//獲取URL后綴
getUrlSuffix()
//獲取上傳文件的根目錄
getUserfilesBaseDir()
//獲取工程路徑
getProjectPath()
DloadImgUtil圖片下載工具類
位置:com.thinkgem.jeesite.common.wechat.utils
/**
* 獲取媒體文件
* @param accessToken 接口訪問憑證
* @param mediaId 媒體文件id
* @param savePath 文件在本地服務器上的存儲路徑
* */
public static String downloadMedia(String accessToken, String mediaId, String savePath,String filePath)
/**
* 獲取多張媒體文件
* @param accessToken 接口訪問憑證
* @param savePath 文件在本地服務器上的存儲路徑
* */
public static String downloadMedias(String accessToken, String mediaIds, String savePath,String filePath)
MNews企業號消息推送
位置:com.thinkgem.jeesite.common.wechat.utils;
//給對應的用戶推送消息,多個用戶可以用|隔開,調用時需進入方法里,修改為對應url
sendMessage(String userId)
TokenSchUtil獲取token類
@Service
@Lazy(false)
public class TokenSchUtil {
//應用的accesstoken
public static String accessToken_x = "";
@Scheduled(fixedRate = 1000*60*60)//每1.5小時觸發
public void taskCycle(){
accessToken_x = WeixinUtil.getAccessToken(Constants.CORPID, Constants.XC_SECRETA).getToken();
}
}
位置:com.thinkgem.jeesite
//獲取token
TokenSchUtil.accessToken_x
timedTask定時任務類
位置:com.thinkgem.jeesite
對應資料:https://www.cnblogs.com/liaojie970/p/5913272.html
DictUtils字典工具類
位置:com.thinkgem.jeesite.modules.sys.utils;
//根據type並通過value查找label,defaultValue為默認value
public static String getDictLabel(String value, String type, String defaultValue)
//根據type並通過label查找value,defaultLabel為默認label
public static String getDictValue(String label, String type, String defaultLabel)
//返回字典列表
public static List<Dict> getDictList(String type)
//返回字典列表(JSON)
public static String getDictListJson(String type)
UserUtils用戶工具類
位置:com.thinkgem.jeesite.modules.sys.utils;
//根據ID獲取用戶,獲取不到返回null
public static User get(String id)
//根據登錄名獲取用戶, 獲取不到返回null
public static User getByLoginName(String loginName)
//清除當前用戶緩存
public static void clearCache()
//清除指定用戶緩存
public static void clearCache(User user)
//獲取當前用戶, 取不到返回 new User().當前用戶為后台登錄用戶,手機端沒有做登錄則永遠為new User()
public static User getUser()
//獲取當前用戶角色列表
public static List<Role> getRoleList()
resources資源篇
資源存放位置
注:
數據庫xml存放位置為resources/mappings/modules/
緩存配置:resources/cache
配置文件說明
errors.properties:系統錯誤配置文檔
jeesite.properties:jeesite配置文檔,可配置jdbc,redis,產品名稱,版本,管理路徑,前端路徑,網址后綴,工程路徑等
log4j. properties:日志文件,可配置日志打印的資源。建議項目部署上主機資源不足且需要減少日志時,可注釋最下方5行配置
log4j.logger.com.thinkgem.jeesite=DEBUG
log4j.logger.com.thinkgem.jeesite.common.security.shiro=WARN
log4j.logger.com.thinkgem.jeesite.common.utils.JedisUtils=WARN
log4j.logger.com.thinkgem.jeesite.modules.sys.web.LoginController=WARN
log4j.logger.com.thinkgem.jeesite.modules.oa.dao.OaNotifyDao.findCount=WARN
spring-context-shiro.xml:權限控制配置文件
webapp(根目錄)
static為所有頁面css,js,圖片資源等存放位置
userfiles為項目運行時產生的所有文件(圖片等)的存儲位置。
WEB-INF 下lib為項目運行所需的jar包
WEB-INF 下views為項目所需頁面的存放位置
所有映射文件(企業號與服務號的文件)均存放在根目錄下