|
@@ -3,8 +3,10 @@ package org.dromara.server.mq.event.kafka.impl.utils;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
+import org.dromara.common.core.config.DefaultConfig;
|
|
|
|
|
+import org.dromara.common.core.constant.DefaultConstants;
|
|
|
import org.dromara.common.core.enums.TraineeStatusEnum;
|
|
import org.dromara.common.core.enums.TraineeStatusEnum;
|
|
|
-import org.dromara.server.common.constant.DefaultConstants;
|
|
|
|
|
|
|
+import org.dromara.common.core.utils.SpringUtils;
|
|
|
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.ResourcePerson;
|
|
|
import org.dromara.server.common.domain.bo.ResourcePersonDept;
|
|
import org.dromara.server.common.domain.bo.ResourcePersonDept;
|
|
@@ -23,7 +25,11 @@ import java.util.List;
|
|
|
* @since JDK 1.8
|
|
* @since JDK 1.8
|
|
|
*/
|
|
*/
|
|
|
public class TrainUtils {
|
|
public class TrainUtils {
|
|
|
|
|
+ private static final DefaultConfig defaultConfig;
|
|
|
|
|
|
|
|
|
|
+ static {
|
|
|
|
|
+ defaultConfig = SpringUtils.getBean(DefaultConfig.class);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 培训班级处理
|
|
* 培训班级处理
|
|
|
*
|
|
*
|
|
@@ -46,9 +52,12 @@ public class TrainUtils {
|
|
|
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(ObjectUtil.isEmpty(data.get("noPayAllow")) ? "0" : data.get("noPayAllow").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(data.getStr("tenantId"));
|
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(data.get("tenantId"))) {
|
|
|
|
|
+ dept.setTenantId(data.get("tenantId").toString());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ dept.setTenantId(defaultConfig.getTenantId());
|
|
|
|
|
+ }
|
|
|
resourceDeptlist.add(dept);
|
|
resourceDeptlist.add(dept);
|
|
|
|
|
|
|
|
return resourceDeptlist;
|
|
return resourceDeptlist;
|
|
@@ -69,11 +78,15 @@ public class TrainUtils {
|
|
|
person.setSex(stuObj.get("sex").toString());
|
|
person.setSex(stuObj.get("sex").toString());
|
|
|
person.setPhone(stuObj.get("phone").toString());
|
|
person.setPhone(stuObj.get("phone").toString());
|
|
|
person.setDeptId(stuObj.getStr("currentClassId"));
|
|
person.setDeptId(stuObj.getStr("currentClassId"));
|
|
|
- person.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
|
|
|
person.setIdNumber(stuObj.getStr("idCard"));
|
|
person.setIdNumber(stuObj.getStr("idCard"));
|
|
|
- person.setCategory("2");
|
|
|
|
|
|
|
+ person.setCategory(DefaultConstants.CATEGORY_TRAINEE);
|
|
|
person.setOperatorId(DefaultConstants.KAFKA_SYNC_ADMIN);
|
|
person.setOperatorId(DefaultConstants.KAFKA_SYNC_ADMIN);
|
|
|
- person.setTenantId(data.getStr("tenantId"));
|
|
|
|
|
|
|
+ person.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(data.get("tenantId"))) {
|
|
|
|
|
+ person.setTenantId(data.get("tenantId").toString());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ person.setTenantId(defaultConfig.getTenantId());
|
|
|
|
|
+ }
|
|
|
// 学员班级列表处理
|
|
// 学员班级列表处理
|
|
|
List<ResourcePersonDept> resourcePersonDeptList = getResourcePersonDeptList(data);
|
|
List<ResourcePersonDept> resourcePersonDeptList = getResourcePersonDeptList(data);
|
|
|
person.setUserDeptList(resourcePersonDeptList);
|
|
person.setUserDeptList(resourcePersonDeptList);
|
|
@@ -92,7 +105,7 @@ public class TrainUtils {
|
|
|
personDept.setDeptId(stuClassObj.getStr("classId"));
|
|
personDept.setDeptId(stuClassObj.getStr("classId"));
|
|
|
// 岗位编码,默认为学员
|
|
// 岗位编码,默认为学员
|
|
|
personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
personDept.setPostCode(DefaultConstants.TRAINEE_CODE);
|
|
|
- // 和班级的绑定状态 0-已报名 1-已确认 3-已报到 一卡通按正常状态处理 2-已拒绝 7-已离校 一卡通按删除状态处理
|
|
|
|
|
|
|
+ // 和班级的绑定状态 状态定义见 TraineeStatusEnum 枚举
|
|
|
String status = stuClassObj.getStr("status");
|
|
String status = stuClassObj.getStr("status");
|
|
|
if (ObjectUtil.equals(status, TraineeStatusEnum.REGISTERED.code()) || ObjectUtil.equals(status,TraineeStatusEnum.REPORTED.code())) {
|
|
if (ObjectUtil.equals(status, TraineeStatusEnum.REGISTERED.code()) || ObjectUtil.equals(status,TraineeStatusEnum.REPORTED.code())) {
|
|
|
personDept.setDelFlag("0");
|
|
personDept.setDelFlag("0");
|