@ -2036,74 +2036,15 @@ public class CollectController extends Controller {
/ * *
* 功 能 : 我 系 统 中 所 有 有 效 单 位
* http : //10.10.21.20:9000/QingLong/collect/getAllBureau? type_id=1
* http : //10.10.21.20:9000/QingLong/collect/getAllBureau? is_match=1&page=1&limit=20
* /
@Before ( { GET . class , RepeatIntercetpor . class } )
@IsNumericInterface ( { " type_id "} )
public void getAllBureau ( int type_id ) {
List < Record > list = cm . getAllBureau ( type_id ) ;
@IsNumericInterface ( { " is_match", "page" , "limit "} )
public void getAllBureau ( int is_match, int page , int limit ) {
Page < Record > list = cm . getAllBureau ( is_match, page , limit ) ;
renderJson ( CommonUtil . renderJsonForLayUI ( list ) ) ;
}
/ * *
* 功 能 : 获 取 天 喻 的 所 有 单 位 列 表
* http : //10.10.21.20:9000/QingLong/collect/getTyAllBureau
* type_id : 1 : 已 匹 配 , 0 : 未 匹 配 , - 1 : 全 部
*
* @throws InterruptedException
* /
@Before ( { GET . class , RepeatIntercetpor . class } )
@IsNumericInterface ( { "type_id" } )
public void getTyAllBureau ( int type_id ) throws InterruptedException {
String KEY = "TY_BUREAU" ;
//从天喻获取所有单位名单
List < JSONObject > list = new ArrayList < > ( ) ;
if ( ! RedisKit . Exists ( KEY ) ) {
//获取所有机构+学校
com . YunXiao . Model . BaseModel ybm = new com . YunXiao . Model . BaseModel ( ) ;
List < JSONObject > jBureauList = ybm . getBureauList ( ) ;
for ( JSONObject jo : jBureauList ) {
String org_id = jo . getString ( "org_id" ) ;
String org_name = jo . getString ( "org_name" ) ;
JSONObject jo2 = new JSONObject ( ) ;
jo2 . put ( "org_id" , org_id ) ;
jo2 . put ( "org_name" , org_name ) ;
list . add ( jo2 ) ;
}
//缓存到 Redis中, 有效期12小时
RedisKit . Set ( KEY , list . toString ( ) ) ;
RedisKit . Expire ( KEY , 60 * 60 * 12 ) ;
} else {
String json = RedisKit . Get ( KEY ) ;
JSONArray ja = JSONArray . parseArray ( json ) ;
for ( int i = 0 ; i < ja . size ( ) ; i + + ) list . add ( ja . getJSONObject ( i ) ) ;
}
//我们系统中的所有单位
Map < String , Record > map = cm . getAllMatchBureau ( ) ;
for ( JSONObject jo : list ) {
if ( map . containsKey ( jo . getString ( "org_id" ) ) ) {
String third_party_org_id = jo . getString ( "org_id" ) ;
Record record = map . get ( third_party_org_id ) ;
jo . put ( "is_match" , 1 ) ;
jo . put ( "match_org_id" , record . getStr ( "org_id" ) ) ;
jo . put ( "match_org_name" , record . getStr ( "org_name" ) ) ;
} else jo . put ( "is_match" , 0 ) ;
}
SortClass sort = new SortClass ( ) ;
Collections . sort ( list , sort ) ;
List < JSONObject > res = new ArrayList < > ( ) ;
for ( JSONObject jsonObject : list ) {
int is_match = jsonObject . getInteger ( "is_match" ) ;
if ( type_id = = 1 & & is_match = = 1 ) res . add ( jsonObject ) ;
if ( type_id = = 0 & & is_match = = 0 ) res . add ( jsonObject ) ;
if ( type_id = = - 1 ) res . add ( jsonObject ) ;
}
renderJson ( res ) ;
}
/ * *
* 功 能 : 匹 配 第 三 方 系 统 与 我 们 的 系 统 单 位 ID 一 致
*
@ -2133,5 +2074,14 @@ public class CollectController extends Controller {
map . put ( "message" , "保存成功!" ) ;
renderJson ( map ) ;
}
/ * *
* 功 能 : 获 取 天 喻 系 统 中 还 未 与 我 系 统 匹 配 完 成 的 单 位 名 称
* @param keyword
* /
public void getTyBureauList ( String keyword ) {
//TODO
}
}