main
黄海 1 year ago
parent aff1d34ff9
commit 8195899dd8

@ -1337,9 +1337,25 @@ public class CollectModel {
//写任务分派表
List<Record> list = new ArrayList<>();
//现在这个要发送的对象是单位1还是人2
// 使用 for-each 循环获取第一个元素
int now_target_type_id = 0;
for (Kv kv : targetSet) {
now_target_type_id = kv.getInt("target_type_id");
break;
}
//如果是单位获取一下单位的target_id,target_name
Map<String, String> _map;
Set<String> _set = new HashSet<>();
for (Kv kv : targetSet) {
_set.add(kv.getStr("target_id"));
}
if (now_target_type_id == 1) {
_map = getBureauMap(_set);
} else {//如果是人获取一下人员的target_id,target_name
_map = getPersonMap(_set);
}
for (Kv kv : targetSet) {
//现在这个要发送的对象是单位1还是人2
int now_target_type_id = kv.getInt("target_type_id");
String target_id = kv.getStr("target_id");
//哪种类型的单位要接受这个任务呢?
int orgTypeId = getOrgTypeId(target_id, now_target_type_id == 2);
@ -1393,8 +1409,10 @@ public class CollectModel {
}
for (Integer status_code : statusCodeList) {
Record record = new Record();
record.set("job_id", job_id);
record.set("now_target_type_id", now_target_type_id);
record.set("target_id", target_id);
record.set("target_name", _map.get(target_id));
record.set("job_id", job_id);
record.set("deadline_time", date);
record.set("bureau_id", bureau_id);
record.set("memo", memo);
@ -1409,6 +1427,61 @@ public class CollectModel {
Db.update(sql, job_id);
}
/**
* ID
*
* @param set
* @return
*/
public Map<String, String> getBureauMap(Set<String> set) {
Map<String, String> map = new HashMap<>();
String str = "";
for (String target_id : set) {
str += "'" + target_id + "',";
}
str = str.substring(0, str.length() - 1);
String sql = "select org_id,org_name from t_base_organization where org_id in (" + str + ")";
List<Record> list = Db.find(sql);
for (Record record : list) {
map.put(record.getStr("org_id"), record.getStr("org_name"));
}
return map;
}
/**
* ID
*
* @param set
* @return
*/
public Map<String, String> getPersonMap(Set<String> set) {
Map<String, String> map = new HashMap<>();
String str = "";
for (String target_id : set) {
str += "'" + target_id + "',";
}
str = str.substring(0, str.length() - 1);
if (THIRD_PARTY_BASE_DATA == 0) {
String sql = "select person_id,person_name from t_sys_loginperson where person_id in (" + str + ")";
List<Record> list = Db.find(sql);
for (Record record : list) {
map.put(record.getStr("person_id"), record.getStr("person_name"));
}
} else {
String sql = "select user_id as person_id,name as person_name from ds_base_student where user_id in (" + str + ")";
List<Record> list = Db.find(sql);
for (Record record : list) {
map.put(record.getStr("person_id"), record.getStr("person_name"));
}
sql = "select user_id as person_id,name as person_name from ds_base_teacher where user_id in (" + str + ")";
list = Db.find(sql);
for (Record record : list) {
map.put(record.getStr("person_id"), record.getStr("person_name"));
}
}
return map;
}
/**
*
*
@ -2085,6 +2158,8 @@ public class CollectModel {
*/
public void ForwardJob(int publish_role_id, String area_id, int job_id, int status_code, String deadline_time, int xiaShuSchool,
int xiaShuJiaoFu, String bureauIds, String groupIds, String memo, String bureau_id, int allTeacher, int allStudent, String njIds, String personIds, String classIds) throws ParseException {
int now_target_type_id = 1;
//获取此县区的所有学校
Set<String> targetSet = new HashSet<>();
if (xiaShuSchool == 1) {
@ -2107,12 +2182,20 @@ public class CollectModel {
}
//人员
if (!StrKit.isBlank(personIds)) {
now_target_type_id = 2;
for (String s : personIds.split(",")) {
targetSet.add(s);
}
}
//群组
if (!StrKit.isBlank(groupIds)) {
for (String group_id : groupIds.split(",")) {
Record record = getGroup(Integer.parseInt(group_id));
int group_type_id = record.getInt("group_type_id");
if (group_type_id == 2) now_target_type_id = 2;
break;
}
for (String group_id : groupIds.split(",")) {
List<Record> list = getGroupTargetList(Integer.parseInt(group_id));
for (Record record : list) {
@ -2122,26 +2205,31 @@ public class CollectModel {
}
//所有老师
if (allTeacher == 1) {
now_target_type_id = 2;
for (Record r : getAllTeacher(bureau_id)) {
targetSet.add(r.getStr("person_id"));
}
}
//所有学生
if (allStudent == 1) {
now_target_type_id = 2;
for (Record r : getAllStudent(bureau_id)) {
targetSet.add(r.getStr("person_id"));
}
}
//年级
for (Record r : getNianJiStudent(bureau_id, njIds)) {
now_target_type_id = 2;
targetSet.add(r.getStr("person_id"));
}
//班级
for (Record r : getBanJiStudent(bureau_id, classIds)) {
now_target_type_id = 2;
targetSet.add(r.getStr("person_id"));
}
//人员
if (!StrKit.isBlank(personIds)) {
now_target_type_id = 2;
for (String s : personIds.split(",")) {
targetSet.add(s);
}
@ -2155,6 +2243,12 @@ public class CollectModel {
//下一个转发状态
int next_status_code = -1;
Map<String, String> _map;
if (now_target_type_id == 1) {
_map = getBureauMap(targetSet);
} else {
_map = getPersonMap(targetSet);
}
for (String s : targetSet) {
switch (publish_job_type_id) {
@ -2180,9 +2274,11 @@ public class CollectModel {
break;
}
Record record = new Record();
record.set("target_id", s);
record.set("now_target_type_id", now_target_type_id);
record.set("target_name", _map.get(s));
record.set("job_id", job_id);
record.set("deadline_time", dateFormat.parse(deadline_time));
record.set("target_id", s);
record.set("bureau_id", bureau_id);
record.set("status_code", next_status_code);
record.set("memo", memo);

Loading…
Cancel
Save