|
@@ -1,9 +1,14 @@
|
|
|
package org.dromara.server.mq.event.kafka.impl.train;
|
|
package org.dromara.server.mq.event.kafka.impl.train;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
+import org.dromara.common.core.enums.TraineeStatusEnum;
|
|
|
import org.dromara.server.common.constant.DefaultConstants;
|
|
import org.dromara.server.common.constant.DefaultConstants;
|
|
|
import org.dromara.server.common.domain.bo.ResourceDept;
|
|
import org.dromara.server.common.domain.bo.ResourceDept;
|
|
|
|
|
+import org.dromara.server.common.domain.bo.ResourcePerson;
|
|
|
|
|
+import org.dromara.server.common.domain.bo.ResourcePersonDept;
|
|
|
|
|
+import org.dromara.server.common.domain.bo.SyncFullDataBo;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -22,6 +27,7 @@ public class TrainUtils {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 培训班级处理
|
|
* 培训班级处理
|
|
|
|
|
+ *
|
|
|
* @param data 班级数据
|
|
* @param data 班级数据
|
|
|
* @return 处理结果
|
|
* @return 处理结果
|
|
|
*/
|
|
*/
|
|
@@ -32,21 +38,71 @@ public class TrainUtils {
|
|
|
dept.setDept_name(data.get("name").toString());
|
|
dept.setDept_name(data.get("name").toString());
|
|
|
dept.setYear(Integer.valueOf(data.get("year").toString()));
|
|
dept.setYear(Integer.valueOf(data.get("year").toString()));
|
|
|
dept.setSemester("0".equals(data.get("xq").toString()) ? "上学期" : "下学期");
|
|
dept.setSemester("0".equals(data.get("xq").toString()) ? "上学期" : "下学期");
|
|
|
- dept.setPayBegin(DateUtil.parse(data.get("bmStarttime").toString(),DefaultConstants.DATE_TIME_FORMAT));
|
|
|
|
|
- dept.setCheckDate(DateUtil.parse(data.get("bdTime").toString(),DefaultConstants.DATE_TIME_FORMAT));
|
|
|
|
|
- dept.setBeginDate(DateUtil.parse(data.get("kbTime").toString(),DefaultConstants.DATE_TIME_FORMAT));
|
|
|
|
|
|
|
+ dept.setPayBegin(DateUtil.parse(data.get("bmStarttime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
|
|
|
+ dept.setCheckDate(DateUtil.parse(data.get("bdTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
|
|
|
+ dept.setBeginDate(DateUtil.parse(data.get("kbTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
|
dept.setEndDate(DateUtil.parse(data.get("byTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
dept.setEndDate(DateUtil.parse(data.get("byTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
|
dept.setPayEnd(DateUtil.parse(data.get("byTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
dept.setPayEnd(DateUtil.parse(data.get("byTime").toString(), DefaultConstants.DATE_TIME_FORMAT));
|
|
|
dept.setChooseRoom("0");
|
|
dept.setChooseRoom("0");
|
|
|
dept.setCanEat("1");
|
|
dept.setCanEat("1");
|
|
|
dept.setPlanCount(Integer.valueOf(data.getOrDefault("studentNum", "0").toString()));
|
|
dept.setPlanCount(Integer.valueOf(data.getOrDefault("studentNum", "0").toString()));
|
|
|
-// dept.setPayCheck(data.get("noPayAllow").toString());
|
|
|
|
|
-// dept.setDept_num(data.get("sortNum").toString());
|
|
|
|
|
|
|
+ dept.setPayCheck(ObjectUtil.isEmpty(data.get("noPayAllow")) ? "0" : data.get("noPayAllow").toString());
|
|
|
|
|
+ //dept.setDept_num("");
|
|
|
dept.setOperatorId(DefaultConstants.KAFKA_SYNC_ADMIN);
|
|
dept.setOperatorId(DefaultConstants.KAFKA_SYNC_ADMIN);
|
|
|
-// dept.setTenantId(DefaultConstants.TENANT_ID);
|
|
|
|
|
dept.setTenantId(data.getStr("tenantId"));
|
|
dept.setTenantId(data.getStr("tenantId"));
|
|
|
resourceDeptlist.add(dept);
|
|
resourceDeptlist.add(dept);
|
|
|
|
|
|
|
|
return resourceDeptlist;
|
|
return resourceDeptlist;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 处理教学员信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param data 教职工
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ public static List<ResourcePerson> getSyncTrainee(JSONObject data) {
|
|
|
|
|
+ List<ResourcePerson> resourcePersonList = new ArrayList<>();
|
|
|
|
|
+ JSONObject stuObj = data.getJSONObject("student");
|
|
|
|
|
+ ResourcePerson person = new ResourcePerson();
|
|
|
|
|
+ person.setUserId(stuObj.getStr("id"));
|
|
|
|
|
+ person.setRealName(stuObj.get("name").toString());
|
|
|
|
|
+ person.setSex(stuObj.get("sex").toString());
|
|
|
|
|
+ person.setPhone(stuObj.get("phone").toString());
|
|
|
|
|
+ person.setDeptId(stuObj.getStr("currentClassId"));
|
|
|
|
|
+ person.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
|
|
|
+ person.setIdNumber(stuObj.getStr("idCard"));
|
|
|
|
|
+ person.setCategory("2");
|
|
|
|
|
+ person.setOperatorId(DefaultConstants.KAFKA_SYNC_ADMIN);
|
|
|
|
|
+ person.setTenantId(data.getStr("tenantId"));
|
|
|
|
|
+ // 学员班级列表处理
|
|
|
|
|
+ List<ResourcePersonDept> resourcePersonDeptList = getResourcePersonDeptList(data);
|
|
|
|
|
+ person.setUserDeptList(resourcePersonDeptList);
|
|
|
|
|
+ resourcePersonList.add(person);
|
|
|
|
|
+
|
|
|
|
|
+ return resourcePersonList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static List<ResourcePersonDept> getResourcePersonDeptList(JSONObject data){
|
|
|
|
|
+ JSONObject stuClassObj = data.getJSONObject("trainClassStudent");
|
|
|
|
|
+ List<ResourcePersonDept> resourcePersonDeptList = new ArrayList<>();
|
|
|
|
|
+ ResourcePersonDept personDept = new ResourcePersonDept();
|
|
|
|
|
+ // 学员Id
|
|
|
|
|
+ personDept.setUserId(stuClassObj.getStr("studentId"));
|
|
|
|
|
+ // 班级Id
|
|
|
|
|
+ personDept.setDeptId(stuClassObj.getStr("classId"));
|
|
|
|
|
+ // 岗位编码,默认为学员
|
|
|
|
|
+ personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
|
|
|
+ // 和班级的绑定状态 0-已报名 1-已确认 3-已报到 一卡通按正常状态处理 2-已拒绝 7-已离校 一卡通按删除状态处理
|
|
|
|
|
+ String status = stuClassObj.getStr("status");
|
|
|
|
|
+ if (ObjectUtil.equals(status, TraineeStatusEnum.REGISTERED.code()) || ObjectUtil.equals(status,TraineeStatusEnum.REPORTED.code())) {
|
|
|
|
|
+ personDept.setDelFlag("0");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ personDept.setDelFlag("2");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ resourcePersonDeptList.add(personDept);
|
|
|
|
|
+ return resourcePersonDeptList;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|