|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.dsideal.FengHuang.Organization.Controller;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.FengHuang.Interceptor.*;
|
|
|
|
|
import com.dsideal.FengHuang.Util.CommonUtil;
|
|
|
|
|
import com.dsideal.FengHuang.Util.IpUtil;
|
|
|
|
@ -10,6 +12,7 @@ import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.core.Controller;
|
|
|
|
|
import com.jfinal.ext.interceptor.GET;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Page;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
@ -280,7 +283,7 @@ public class OrganizationController extends Controller {
|
|
|
|
|
@Before({POST.class})
|
|
|
|
|
@IsLoginInterface({})
|
|
|
|
|
@EmptyInterface({"parent_org_id", "org_name"})
|
|
|
|
|
@IsNumericInterface({"sort_id","department_type_id"})
|
|
|
|
|
@IsNumericInterface({"sort_id", "department_type_id"})
|
|
|
|
|
@IsSysAdminInterface({"1", "4"}) //超级管理员与单位管理员才可以增加部门
|
|
|
|
|
@AuthorityInterface({}) //是不是有权限操作这个单位或区域下的数据?
|
|
|
|
|
@LengthInterface({"org_name,2,64"})
|
|
|
|
@ -289,7 +292,7 @@ public class OrganizationController extends Controller {
|
|
|
|
|
* 作者:黄海
|
|
|
|
|
* 时间:2018-12-04
|
|
|
|
|
*/
|
|
|
|
|
public void addOrg(String org_name, String parent_org_id,int department_type_id, int sort_id) {
|
|
|
|
|
public void addOrg(String org_name, String parent_org_id, int department_type_id, int sort_id) {
|
|
|
|
|
//单位编码
|
|
|
|
|
String org_code = "-1";
|
|
|
|
|
|
|
|
|
@ -305,7 +308,7 @@ public class OrganizationController extends Controller {
|
|
|
|
|
//客户端ip_address
|
|
|
|
|
String ip_address = IpUtil.getIpAddr(getRequest());
|
|
|
|
|
|
|
|
|
|
model.addOrg(bureau_id, org_code, org_name, parent_org_id, department_type_id,sort_id, operator, ip_address);
|
|
|
|
|
model.addOrg(bureau_id, org_code, org_name, parent_org_id, department_type_id, sort_id, operator, ip_address);
|
|
|
|
|
renderJson(CommonUtil.returnMessageJson(true, "保存成功!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -449,4 +452,52 @@ public class OrganizationController extends Controller {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// http://10.10.11.124:9000/FengHuang/organization/getZyClassSelectTree?bureau_id=0D8C9679-16B6-4A3B-A6FC-5CF4FF066437
|
|
|
|
|
@Before({GET.class})
|
|
|
|
|
@EmptyInterface({"bureau_id"})
|
|
|
|
|
public void getZyClassSelectTree(String bureau_id) {
|
|
|
|
|
Kv res = Kv.create();
|
|
|
|
|
Kv status = Kv.by("code", 200).set("message", "操作成功");
|
|
|
|
|
|
|
|
|
|
JSONArray data = new JSONArray();
|
|
|
|
|
JSONObject root = new JSONObject();
|
|
|
|
|
root.put("org_id", bureau_id);
|
|
|
|
|
|
|
|
|
|
Record rOrg = model.getOrgInfo(bureau_id);
|
|
|
|
|
root.put("org_name", rOrg.getStr("org_name"));
|
|
|
|
|
root.put("parent_id", "0");
|
|
|
|
|
|
|
|
|
|
//Level1
|
|
|
|
|
JSONArray level1 = new JSONArray();
|
|
|
|
|
List<Record> firstList = model.getZyClassSelectTreeLevel1(bureau_id);
|
|
|
|
|
|
|
|
|
|
//Level2
|
|
|
|
|
List<Record> secondList = model.getZyClassSelectTreeLevel2(bureau_id);
|
|
|
|
|
for (Record r1 : firstList) {
|
|
|
|
|
JSONObject jo = new JSONObject();
|
|
|
|
|
jo.put("org_id", r1.getStr("org_id"));
|
|
|
|
|
jo.put("org_name", r1.getStr("org_name"));
|
|
|
|
|
jo.put("parent_id", r1.getStr("parent_id"));
|
|
|
|
|
JSONArray children = new JSONArray();
|
|
|
|
|
String org_id = r1.getStr("org_id");
|
|
|
|
|
for (Record r2 : secondList) {
|
|
|
|
|
if (r2.getStr("parent_id").equals(org_id)) {
|
|
|
|
|
JSONObject child = new JSONObject();
|
|
|
|
|
child.put("org_id", r2.getStr("org_id"));
|
|
|
|
|
child.put("org_name", r2.getStr("org_name"));
|
|
|
|
|
child.put("parent_id", r2.getStr("parent_id"));
|
|
|
|
|
children.add(child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
jo.put("children", children);
|
|
|
|
|
level1.add(jo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
root.put("children", level1);
|
|
|
|
|
data.add(root);
|
|
|
|
|
res.set("status", status);
|
|
|
|
|
res.set("data", data);
|
|
|
|
|
renderJson(res);
|
|
|
|
|
}
|
|
|
|
|
}
|