後端工具集

2021-10-06 23:05:32 字數 3303 閱讀 1495

/**

* 判斷索引是否存在

* @param indexname

* @return

*/public

boolean

i***istsindex

(string indexname)))

.actionget()

;return response.

i***ists()

;}

/**

* 重新建立索引

* 補救措施 如果索引誤刪 自動建立新的索引

*/@postconstruct

public

void

init()

}

@service

public

class

indexservice

implements }

}

protected

static

final map

head =

newhashmap()

;static

/** * 分鐘轉毫秒

* @param timingtime

* @return 返回毫秒

*/public

static long getminutestomilliseconds

(long timingtime)

/** * 計算下乙個時間

* @param workdate 周

* @param time 小時分鐘

* @return 返回下乙個時間戳

*/public

static long getnexttime

(string workdate, string time)

// 存在當前是之前

string theprevious =

gettheprevious

(list, week);if

(theprevious != null)

}//只勾選當前時間

if(list.

size()

==1&& list.

contains

(week)

)//勾選時間超過當天時間

return

datetostamp

(weekdate

(list.

get(0)

),time);}

/** * 獲取上乙個元素

* @param list list陣列

* @param week 當前元素

* @return 返回上乙個元素 如果沒有返回null

*/public

static string gettheprevious

(list

list,string week)}}

return theprevious;

}/**

* 獲取下乙個元素

* @param list list陣列

* @param week 當前元素

* @return 返回下乙個元素 如果沒有返回null

*/public

static string getthenext

(list

list,string week)}}

return thenext;

}/**

* 判斷當前時間是週幾

* @return 返回當前時間是週幾

*/public

static string getweek()

else

if(weekday ==2)

else

if(weekday ==3)

else

if(weekday ==4)

else

if(weekday ==5)

else

if(weekday ==6)

else

if(weekday ==7)

return week;

}/**

* 將時間轉換為時間戳

* @param date 年月日

* @param time 小時分鐘

* @return 返回時間戳

*/public

static long datetostamp

(string date, string time)

catch

(exception e)

",e.

getmessage()

);}return endtime;

}/**

* 當前時間加一天

* @return 返回年月日

*/public

static string nextdate()

/** * 當前時間加幾天

* @param week

* @return 返回年月日

*/public

static string weekdate

(string week)

/** * 當前時間加 7天

* @return 返回 年月日

*/public

static string weeksevendate()

/** * 判斷時間是否在時間段內

** @param nowtime 現在時間

* @param begintime 開始時間

* @param endtime 結束時間

* @return

*/public

static

boolean

belongcalendar

(date nowtime, date begintime, date endtime)

else

}/**

* 判斷這週與下週間隔時間

** @param weekone 這周周幾

* @param weektwo 下週週幾

* @return 間隔天數

*//** * 判斷這週與下週間隔時間

** @param weekone 這周周幾

* @param weektwo 下週週幾

* @return 間隔天數

*/public

static integer getdays

(string weekone,string weektwo)

後端知識 收藏集 掘金

為何 shadowsocks 要棄用一次性驗證 ota 工具資源 掘金 前些天,shadowsocks 提出了 sip004 草案,旨在使用 aead 演算法 取代原先的不安全的 流加密 ota,並棄用了一次性驗證 ota 新協議的提出對於 shadowsocks 是乙個非常非常重大的改進,因此我寫...

後端 Python 專案練習集

1 1.2 3knowledge point 41.練習if.else 52.練習while 63.練習列表的切片取值 78 requirements 9購物車 101.程式啟動後,輸入工資,列印商品列表 112.提示使用者根據商品編號購買產品 123.選擇商品後檢測餘額是否足夠,扣款或提醒餘額不足...

後端引數校驗工具類

1 controller層判斷傳入引數是否符合規則,不符合規則直接返回錯誤狀態碼。2 其他需要校驗引數的地方。public class checkutil 判斷傳入的引數是否都符合規則 中文,字母,數字 30位 param params return true 符合 false 驗證不通過 publ...