|
|
|
@ -263,7 +263,7 @@ public class DataEaseController extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
@Before(GET.class)
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsNumericInterface({ "id" })
|
|
|
|
|
@IsNumericInterface({"id"})
|
|
|
|
|
public void getDataSetContent(int id) {
|
|
|
|
|
//登录的人员
|
|
|
|
|
int identity_id = Integer.parseInt(CookieUtil.getValue(getRequest(), "identity_id"));
|
|
|
|
@ -277,15 +277,15 @@ public class DataEaseController extends Controller {
|
|
|
|
|
//父亲的区域名称
|
|
|
|
|
String parent_area_name = rm.getParentAreaName(area_name);
|
|
|
|
|
|
|
|
|
|
List<Record> list = dm.getDataSetContent(id,identity_id,area_name);
|
|
|
|
|
List<Record> list = dm.getDataSetContent(id, identity_id, area_name);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据集下的数据表
|
|
|
|
|
*
|
|
|
|
|
* @param id 数据集id
|
|
|
|
|
* @param data 保存的数据
|
|
|
|
|
* @param id 数据集id
|
|
|
|
|
* @param data 保存的数据
|
|
|
|
|
*/
|
|
|
|
|
@Before(POST.class)
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
@ -309,7 +309,98 @@ public class DataEaseController extends Controller {
|
|
|
|
|
jo.put("上级行政区划", parent_area_name);
|
|
|
|
|
}
|
|
|
|
|
//保存
|
|
|
|
|
dm.saveDataSet(identity_id,id, area_name, jsonArray);
|
|
|
|
|
dm.saveDataSet(identity_id, id, area_name, jsonArray);
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(true, "保存成功"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 市级管理员获取县区级可视数据集有哪些
|
|
|
|
|
*/
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void getDataSetByCity() {
|
|
|
|
|
String identity_idStr = CookieUtil.getValue(getRequest(), "identity_id");
|
|
|
|
|
int identity_id = 1;
|
|
|
|
|
if (!StrKit.isBlank(identity_idStr)) {
|
|
|
|
|
identity_id = Integer.parseInt(identity_idStr);
|
|
|
|
|
}
|
|
|
|
|
if (identity_id != 2) {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, "非城市管理员,无法获取数据集名称"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//根据当前登录人员的身份,获取对应的数据集名称
|
|
|
|
|
String person_id = CookieUtil.getValue(getRequest(), "person_id");
|
|
|
|
|
//获取他是哪个城市或者县区的管理员
|
|
|
|
|
//行政区划码
|
|
|
|
|
String area_code = rm.getAreaCode(identity_id, person_id);
|
|
|
|
|
//根据区域码,获取区域名称
|
|
|
|
|
String area_name = rm.getAreaName(area_code);
|
|
|
|
|
List<Record> list = dm.getDataSetByIdentityId(3, area_name);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 市州管理员,帮助县区管理员填报数据,需要获取指定数据集的数据
|
|
|
|
|
*
|
|
|
|
|
* @param id 数据集id
|
|
|
|
|
*/
|
|
|
|
|
@Before(GET.class)
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@IsNumericInterface({"id"})
|
|
|
|
|
public void getDataSetContentByCity(int id) {
|
|
|
|
|
//登录的人员
|
|
|
|
|
int identity_id = Integer.parseInt(CookieUtil.getValue(getRequest(), "identity_id"));
|
|
|
|
|
String person_id = CookieUtil.getValue(getRequest(), "person_id");
|
|
|
|
|
//获取他是哪个城市或者县区的管理员
|
|
|
|
|
//行政区划码
|
|
|
|
|
String area_code = rm.getAreaCode(identity_id, person_id);
|
|
|
|
|
//根据区域码,获取区域名称
|
|
|
|
|
String area_name = rm.getAreaName(area_code);
|
|
|
|
|
|
|
|
|
|
List<Record> list = dm.getDataSetContentByCity(id, area_name);
|
|
|
|
|
renderJson(CommonUtil.renderJsonForLayUI(list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 市州管理员,帮助县区管理员填报数据,保存数据集下的数据表
|
|
|
|
|
*
|
|
|
|
|
* @param id 数据集id
|
|
|
|
|
* @param data 保存的数据
|
|
|
|
|
*/
|
|
|
|
|
@Before(POST.class)
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
public void saveDataSetByCity(int id, String data) {
|
|
|
|
|
//登录的人员
|
|
|
|
|
int identity_id = Integer.parseInt(CookieUtil.getValue(getRequest(), "identity_id"));
|
|
|
|
|
String person_id = CookieUtil.getValue(getRequest(), "person_id");
|
|
|
|
|
|
|
|
|
|
//获取他是哪个城市或者县区的管理员
|
|
|
|
|
//行政区划码
|
|
|
|
|
String area_code = rm.getAreaCode(identity_id, person_id);
|
|
|
|
|
//根据区域码,获取区域名称
|
|
|
|
|
String area_name = rm.getAreaName(area_code);
|
|
|
|
|
//行政区划
|
|
|
|
|
Record rArea = rm.getAreaRecordByName(area_name);
|
|
|
|
|
String area_id = rArea.getStr("id");
|
|
|
|
|
//此市州下有哪些县区
|
|
|
|
|
List<Record> list = dm.getAreaList(area_id);
|
|
|
|
|
Set<String> set = new HashSet<>();
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
set.add(record.getStr("area_name"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JSONArray jsonArray = JSONArray.fromObject(data);
|
|
|
|
|
for (Object o : jsonArray) {
|
|
|
|
|
JSONObject jo = (JSONObject) o;
|
|
|
|
|
if (!set.contains(jo.get("行政区划").toString())) {
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(false, jo.get("行政区划").toString() + "并不隶属于" + area_name + ",请检查后重新填报!"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
jo.put("上级行政区划", area_name);
|
|
|
|
|
}
|
|
|
|
|
//保存
|
|
|
|
|
dm.saveDataSetByCity(id, area_name, jsonArray);
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(true, "保存成功"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|