diff --git a/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java b/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java index 6adf145f..dbd68e12 100644 --- a/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java +++ b/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java @@ -1900,6 +1900,17 @@ public class CollectController extends Controller { renderJson(map); } + /** + * 功能:我系统中所有有效单位 + * http://10.10.21.20:9000/QingLong/collect/getAllBureau?type_id=1 + */ + @Before({GET.class, RepeatIntercetpor.class}) + @IsNumericInterface({"type_id"}) + public void getAllBureau(int type_id) { + List list = cm.getAllBureau(type_id); + renderJson(CommonUtil.renderJsonForLayUI(list)); + } + /** * 功能:获取天喻的所有单位列表 * http://10.10.21.20:9000/QingLong/collect/getTyAllBureau @@ -1958,5 +1969,35 @@ public class CollectController extends Controller { } renderJson(res); } + + /** + * 功能:匹配第三方系统与我们的系统单位ID一致 + * + * @throws InterruptedException + */ + @Before({GET.class, RepeatIntercetpor.class}) + @EmptyInterface({"third_party_id", "org_id"}) + public void matchBureau(String org_id, String third_party_id) { + cm.matchBureau(org_id, third_party_id); + Map map = new HashMap<>(); + map.put("success", true); + map.put("message", "保存成功!"); + renderJson(map); + } + + /** + * 功能:解除第三方系统与我们的系统单位ID的匹配 + * + * @throws InterruptedException + */ + @Before({GET.class, RepeatIntercetpor.class}) + @EmptyInterface({"third_party_id", "org_id"}) + public void disMatchBureau(String org_id) { + cm.disMatchBureau(org_id); + Map map = new HashMap<>(); + map.put("success", true); + map.put("message", "保存成功!"); + renderJson(map); + } } diff --git a/src/main/java/com/dsideal/QingLong/Collect/Model/CollectModel.java b/src/main/java/com/dsideal/QingLong/Collect/Model/CollectModel.java index 841623eb..812a3bd9 100644 --- a/src/main/java/com/dsideal/QingLong/Collect/Model/CollectModel.java +++ b/src/main/java/com/dsideal/QingLong/Collect/Model/CollectModel.java @@ -2551,11 +2551,7 @@ public class CollectModel { * @return */ public Map getAllMatchBureau() { - GlobalModel gm = new GlobalModel(); - String city_id = gm.getGlobalValueByKey("install_area"); - - String sql = "select org_id,org_name,third_party_id from t_base_organization where city_id=? and bureau_id=org_id"; - List list = Db.find(sql, city_id); + List list = getAllBureau(-1); Map _map = new HashMap<>(); for (Record record : list) { String third_party_id = record.getStr("third_party_id"); @@ -2564,4 +2560,48 @@ public class CollectModel { } return _map; } + + /** + * 功能:获取我系统中所有有效单位 + * + * @return + */ + public List getAllBureau(int type_id) { + GlobalModel gm = new GlobalModel(); + String city_id = gm.getGlobalValueByKey("install_area"); + + String sql = "select org_id,org_name,third_party_id,CASE WHEN third_party_id IS NULL THEN 0 ELSE 1 END AS is_match from t_base_organization where city_id=? and bureau_id=org_id and is_virtual=0 order by is_match desc"; + List list = Db.find(sql, city_id); + + List res = new ArrayList<>(); + for (Record record : list) { + int is_match = record.getInt("is_match"); + if (type_id == 0 && is_match == 0) res.add(record); + if (type_id == 1 && is_match == 1) res.add(record); + if (type_id == -1) res.add(record); + } + return res; + } + + /** + * 功能:匹配第三方系统与我们的系统单位ID一致 + * + * @throws InterruptedException + */ + public void matchBureau(String org_id, String third_party_id) { + Record record = Db.findById("t_base_organization", "org_id", org_id); + record.set("third_party_id", third_party_id); + Db.update("t_base_organization", "org_id", record); + } + + /** + * 功 功能:解除第三方系统与我们的系统单位ID的匹配 + * + * @throws InterruptedException + */ + public void disMatchBureau(String org_id) { + Record record = Db.findById("t_base_organization", "org_id", org_id); + record.set("third_party_id", null); + Db.update("t_base_organization", "org_id", record); + } } \ No newline at end of file