|
|
|
@ -11,8 +11,6 @@ import com.jfinal.plugin.activerecord.Page;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.SqlPara;
|
|
|
|
|
|
|
|
|
|
import java.sql.Time;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -39,21 +37,16 @@ public class OrganizationModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map getCityAreaMainSchoolByBureauId(String bureau_id) {
|
|
|
|
|
try {
|
|
|
|
|
HashMap<String,Object> resMap = new HashMap<>();
|
|
|
|
|
String sql = Db.getSql("organization.getOrgInfoById");
|
|
|
|
|
List<Record> list = Db.find(sql, bureau_id);
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
resMap.put("city_id", list.get(0).getStr("city_id"));
|
|
|
|
|
resMap.put("area_id", list.get(0).getStr("area_id"));
|
|
|
|
|
resMap.put("main_school_id", list.get(0).getStr("main_school_id"));
|
|
|
|
|
resMap.put("school_type_id", list.get(0).getStr("school_type_id"));
|
|
|
|
|
return resMap;
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
HashMap<String, Object> resMap = new HashMap<>();
|
|
|
|
|
String sql = Db.getSql("organization.getOrgInfoById");
|
|
|
|
|
List<Record> list = Db.find(sql, bureau_id);
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
resMap.put("city_id", list.getFirst().getStr("city_id"));
|
|
|
|
|
resMap.put("area_id", list.getFirst().getStr("area_id"));
|
|
|
|
|
resMap.put("main_school_id", list.getFirst().getStr("main_school_id"));
|
|
|
|
|
resMap.put("school_type_id", list.getFirst().getStr("school_type_id"));
|
|
|
|
|
return resMap;
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -71,7 +64,7 @@ public class OrganizationModel {
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
String sql = Db.getSql("dm.getAreaById");
|
|
|
|
|
List<Record> records = Db.find(sql, id);
|
|
|
|
|
if (records.size() == 0) {
|
|
|
|
|
if (records.isEmpty()) {
|
|
|
|
|
map.put("city_id", NullGuid);
|
|
|
|
|
map.put("area_id", NullGuid);
|
|
|
|
|
map.put("area_name", "没有找到");
|
|
|
|
@ -79,23 +72,23 @@ public class OrganizationModel {
|
|
|
|
|
map.put("area_code", "");
|
|
|
|
|
} else {
|
|
|
|
|
//如果是市
|
|
|
|
|
if (records.get(0).getStr("id").equals(records.get(0).getStr("city_id"))) {
|
|
|
|
|
if (records.getFirst().getStr("id").equals(records.getFirst().getStr("city_id"))) {
|
|
|
|
|
map.put("city_id", id);
|
|
|
|
|
map.put("area_id", NullGuid);
|
|
|
|
|
map.put("parent_id", records.get(0).getStr("parent_id"));
|
|
|
|
|
map.put("area_name", records.get(0).getStr("area_name"));
|
|
|
|
|
map.put("area_code", records.get(0).getStr("area_code"));
|
|
|
|
|
map.put("province_id", records.get(0).getStr("province_id"));
|
|
|
|
|
map.put("province_name", records.get(0).getStr("province_name"));
|
|
|
|
|
map.put("parent_id", records.getFirst().getStr("parent_id"));
|
|
|
|
|
map.put("area_name", records.getFirst().getStr("area_name"));
|
|
|
|
|
map.put("area_code", records.getFirst().getStr("area_code"));
|
|
|
|
|
map.put("province_id", records.getFirst().getStr("province_id"));
|
|
|
|
|
map.put("province_name", records.getFirst().getStr("province_name"));
|
|
|
|
|
} else//如果是县区
|
|
|
|
|
{
|
|
|
|
|
sql = Db.getSql("dm.getAreaById");
|
|
|
|
|
String city_id = Db.find(sql, id).get(0).getStr("parent_id");
|
|
|
|
|
String city_id = Db.find(sql, id).getFirst().getStr("parent_id");
|
|
|
|
|
map.put("city_id", city_id);
|
|
|
|
|
map.put("area_id", id);
|
|
|
|
|
map.put("parent_id", records.get(0).getStr("parent_id"));
|
|
|
|
|
map.put("area_name", records.get(0).getStr("area_name"));
|
|
|
|
|
map.put("area_code", records.get(0).getStr("area_code"));
|
|
|
|
|
map.put("parent_id", records.getFirst().getStr("parent_id"));
|
|
|
|
|
map.put("area_name", records.getFirst().getStr("area_name"));
|
|
|
|
|
map.put("area_code", records.getFirst().getStr("area_code"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
@ -107,7 +100,7 @@ public class OrganizationModel {
|
|
|
|
|
* 时间: 2018-11-29
|
|
|
|
|
*/
|
|
|
|
|
public void addBureau(String org_code, String org_name, String parent_org_id, int org_type_id, int school_type_id, int sort_id, String operator,
|
|
|
|
|
String ip_address, String property_id, int level_id,int is_virtual) {
|
|
|
|
|
String ip_address, String property_id, int level_id, int is_virtual) {
|
|
|
|
|
//默认的身份证号
|
|
|
|
|
String NullIdCardCode = "000000000000000000";
|
|
|
|
|
String city_id;
|
|
|
|
@ -146,7 +139,7 @@ public class OrganizationModel {
|
|
|
|
|
record.set("property_id", property_id);
|
|
|
|
|
record.set("level_id", level_id);
|
|
|
|
|
record.set("update_ts", DateTime.now());
|
|
|
|
|
record.set("is_virtual",is_virtual);
|
|
|
|
|
record.set("is_virtual", is_virtual);
|
|
|
|
|
Db.save("t_base_organization", "org_id", record);
|
|
|
|
|
|
|
|
|
|
//添加登录人员信息(单位管理员)
|
|
|
|
@ -202,9 +195,9 @@ public class OrganizationModel {
|
|
|
|
|
record.set("bureau_id", bureau_id);
|
|
|
|
|
record.set("org_pk_num", org_pk_num);
|
|
|
|
|
List<Record> rs = getAreaIdByParentId(bureau_id);
|
|
|
|
|
if (rs != null && rs.size() > 0) {
|
|
|
|
|
city_id = rs.get(0).getStr("city_id");
|
|
|
|
|
area_id = rs.get(0).getStr("area_id");
|
|
|
|
|
if (rs != null && !rs.isEmpty()) {
|
|
|
|
|
city_id = rs.getFirst().getStr("city_id");
|
|
|
|
|
area_id = rs.getFirst().getStr("area_id");
|
|
|
|
|
} else {
|
|
|
|
|
city_id = "-1";
|
|
|
|
|
area_id = "-1";
|
|
|
|
@ -244,10 +237,10 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getAreaIdByParentId(String parent_id) {
|
|
|
|
|
List<Record> rs = getOrgInfoById(parent_id);
|
|
|
|
|
if (rs.size() > 0) {
|
|
|
|
|
String bureau_id = rs.get(0).getStr("bureau_id");
|
|
|
|
|
if (!rs.isEmpty()) {
|
|
|
|
|
String bureau_id = rs.getFirst().getStr("bureau_id");
|
|
|
|
|
rs = getOrgInfoById(bureau_id);
|
|
|
|
|
if (rs.size() > 0) {
|
|
|
|
|
if (!rs.isEmpty()) {
|
|
|
|
|
return rs;
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
@ -262,7 +255,8 @@ public class OrganizationModel {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间: 2018-11-29
|
|
|
|
|
*/
|
|
|
|
|
public void updateBureau(String org_id, String org_code, String org_name, String parent_org_id, int sort_id, String main_school_id, int property_id, String operator, String ip_address,int is_virtual) {
|
|
|
|
|
public void updateBureau(String org_id, String org_code, String org_name, String parent_org_id, int sort_id, String main_school_id, int property_id, String operator, String ip_address, int is_virtual,
|
|
|
|
|
String city_id, String area_id) {
|
|
|
|
|
Record record = Db.findById("t_base_organization", "org_id", org_id);
|
|
|
|
|
record.set("org_id", org_id);
|
|
|
|
|
record.set("org_code", org_code);
|
|
|
|
@ -277,18 +271,20 @@ public class OrganizationModel {
|
|
|
|
|
record.set("bureau_id", org_id);
|
|
|
|
|
record.set("operator", operator);
|
|
|
|
|
record.set("ip_address", IpUtil.ipToLong(ip_address));
|
|
|
|
|
if (!StrKit.isBlank(city_id)) record.set("city_id", city_id);
|
|
|
|
|
if (!StrKit.isBlank(area_id)) record.set("area_id", area_id);
|
|
|
|
|
//获取不可以修改的字段信息
|
|
|
|
|
DateTime create_time = DateTime.now();
|
|
|
|
|
int b_use = 0;
|
|
|
|
|
List<Record> rs = getOrgInfoById(org_id);
|
|
|
|
|
if (rs.size() > 0) {
|
|
|
|
|
create_time = DateUtil.parse(rs.get(0).getStr("create_time"));
|
|
|
|
|
b_use = rs.get(0).getInt("b_use");
|
|
|
|
|
if (!rs.isEmpty()) {
|
|
|
|
|
create_time = DateUtil.parse(rs.getFirst().getStr("create_time"));
|
|
|
|
|
b_use = rs.getFirst().getInt("b_use");
|
|
|
|
|
}
|
|
|
|
|
record.set("create_time", create_time);
|
|
|
|
|
record.set("b_use", b_use);
|
|
|
|
|
record.remove("update_ts");
|
|
|
|
|
record.set("is_virtual",is_virtual);
|
|
|
|
|
record.set("is_virtual", is_virtual);
|
|
|
|
|
Db.update("t_base_organization", "org_id", record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -310,9 +306,9 @@ public class OrganizationModel {
|
|
|
|
|
String area_id;
|
|
|
|
|
|
|
|
|
|
List<Record> rs = getAreaIdByParentId(parent_id);
|
|
|
|
|
if (rs != null && rs.size() > 0) {
|
|
|
|
|
city_id = rs.get(0).getStr("city_id");
|
|
|
|
|
area_id = rs.get(0).getStr("area_id");
|
|
|
|
|
if (rs != null && !rs.isEmpty()) {
|
|
|
|
|
city_id = rs.getFirst().getStr("city_id");
|
|
|
|
|
area_id = rs.getFirst().getStr("area_id");
|
|
|
|
|
} else {
|
|
|
|
|
city_id = "-1";
|
|
|
|
|
area_id = "-1";
|
|
|
|
@ -326,10 +322,10 @@ public class OrganizationModel {
|
|
|
|
|
int b_use = 0;
|
|
|
|
|
String bureau_id = null;
|
|
|
|
|
rs = getOrgInfoById(org_id);
|
|
|
|
|
if (rs.size() > 0) {
|
|
|
|
|
bureau_id = rs.get(0).getStr("bureau_id");
|
|
|
|
|
create_time = rs.get(0).getStr("create_time");
|
|
|
|
|
b_use = rs.get(0).getInt("b_use");
|
|
|
|
|
if (!rs.isEmpty()) {
|
|
|
|
|
bureau_id = rs.getFirst().getStr("bureau_id");
|
|
|
|
|
create_time = rs.getFirst().getStr("create_time");
|
|
|
|
|
b_use = rs.getFirst().getInt("b_use");
|
|
|
|
|
}
|
|
|
|
|
record.set("bureau_id", bureau_id);
|
|
|
|
|
record.set("create_time", DateUtil.parse(create_time));
|
|
|
|
@ -350,7 +346,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getClassCountByBureauId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("class.getClassCountByBureauId");
|
|
|
|
|
return Db.find(sql, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -363,7 +359,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getOrgCountByBureauId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("organization.getOrgCountByBureauId");
|
|
|
|
|
return Db.find(sql, org_id, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -376,7 +372,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getTeacherCountByBureauId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTeacherCountByBureauId");
|
|
|
|
|
return Db.find(sql, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -389,7 +385,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getTeacherCountByOrgId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getTeacherCountByOrgId");
|
|
|
|
|
return Db.find(sql, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -402,7 +398,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getStudentCountByBureauId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getStudentCountByBureauId");
|
|
|
|
|
return Db.find(sql, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -415,7 +411,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getParentCountByBureauId(String org_id) {
|
|
|
|
|
String sql = Db.getSql("loginPerson.getParentCountByBureauId");
|
|
|
|
|
return Db.find(sql, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -453,7 +449,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getOrgCodeCount(String org_code) {
|
|
|
|
|
String sql = Db.getSql("organization.getOrgCodeCount");
|
|
|
|
|
return Db.find(sql, org_code).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_code).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -466,7 +462,7 @@ public class OrganizationModel {
|
|
|
|
|
*/
|
|
|
|
|
public int getOrgCodeCountExceptSelf(String org_id, String org_code) {
|
|
|
|
|
String sql = Db.getSql("organization.getOrgCodeCountExceptSelf");
|
|
|
|
|
return Db.find(sql, org_code, org_id).get(0).getInt("c");
|
|
|
|
|
return Db.find(sql, org_code, org_id).getFirst().getInt("c");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -475,15 +471,15 @@ public class OrganizationModel {
|
|
|
|
|
* 时间:2018-12-03
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getBureauList(String parent_id, int org_type_id, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage;
|
|
|
|
|
if (org_type_id == -1) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("organization.getBureauList", parent_id);
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
dataPage = Db.paginate(page, limit, sp);
|
|
|
|
|
} else {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit,
|
|
|
|
|
dataPage = Db.paginate(page, limit,
|
|
|
|
|
Db.getSqlPara("organization.getBureauListByBureauType", parent_id, org_type_id));
|
|
|
|
|
return dataPage;
|
|
|
|
|
}
|
|
|
|
|
return dataPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -497,14 +493,14 @@ public class OrganizationModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getSchoolList(String parent_org_id, int school_type_id, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage;
|
|
|
|
|
if (school_type_id == -1) {
|
|
|
|
|
SqlPara sp = Db.getSqlPara("organization.getSchoolList", parent_org_id);
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, sp);
|
|
|
|
|
return dataPage;
|
|
|
|
|
dataPage = Db.paginate(page, limit, sp);
|
|
|
|
|
} else {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getSchoolListBySchoolType", parent_org_id, school_type_id));
|
|
|
|
|
return dataPage;
|
|
|
|
|
dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getSchoolListBySchoolType", parent_org_id, school_type_id));
|
|
|
|
|
}
|
|
|
|
|
return dataPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -513,8 +509,7 @@ public class OrganizationModel {
|
|
|
|
|
* 时间:2018-12-04
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getOrgList(String parent_org_id, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getOrgList", parent_org_id));
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page, limit, Db.getSqlPara("organization.getOrgList", parent_org_id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -539,8 +534,7 @@ public class OrganizationModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getSchoolListByAreaId(String area_id, String keyword, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getSchoolListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page, limit, Db.getSqlPara("organization.getSchoolListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -553,8 +547,7 @@ public class OrganizationModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getBureauListByAreaId(String area_id, String keyword, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getBureauListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page, limit, Db.getSqlPara("organization.getBureauListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -567,7 +560,6 @@ public class OrganizationModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Page<Record> getAllListByAreaId(String area_id, String keyword, int page, int limit) {
|
|
|
|
|
Page<Record> dataPage = Db.paginate(page, limit, Db.getSqlPara("organization.getAllListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
return dataPage;
|
|
|
|
|
return Db.paginate(page, limit, Db.getSqlPara("organization.getAllListByAreaId", area_id, area_id, "%" + keyword + "%"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|