|
|
@@ -1,22 +1,31 @@
|
|
|
package com.xjrsoft.module.liteflow.node;
|
|
|
|
|
|
+import cn.dev33.satoken.secure.BCrypt;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
+import com.xjrsoft.common.enums.EnabledMark;
|
|
|
+import com.xjrsoft.common.utils.LocalDateUtil;
|
|
|
+import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
+import com.xjrsoft.module.organization.dto.GetUserByParamDto;
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.student.entity.BaseClassMajorSet;
|
|
|
+import com.xjrsoft.module.student.entity.BaseNewStudent;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.entity.StudentTransfer;
|
|
|
import com.xjrsoft.module.student.mapper.BaseClassMajorSetMapper;
|
|
|
import com.xjrsoft.module.student.mapper.StudentTransferMapper;
|
|
|
+import com.xjrsoft.module.student.service.IBaseNewStudentService;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
|
|
|
-import com.xjrsoft.module.student.service.IStudentChangeRecordService;
|
|
|
import com.yomahub.liteflow.core.NodeComponent;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -37,7 +46,13 @@ public class StudentTransferNode extends NodeComponent {
|
|
|
private BaseClassMajorSetMapper baseClassMajorSetMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private IStudentChangeRecordService changeRecordService;
|
|
|
+ private IBaseNewStudentService newStudentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonPropertiesConfig propertiesConfig;
|
|
|
|
|
|
@Override
|
|
|
public void process() throws Exception {
|
|
|
@@ -48,24 +63,51 @@ public class StudentTransferNode extends NodeComponent {
|
|
|
if (formId != null) {
|
|
|
//查询出数据
|
|
|
StudentTransfer studentTransfer = studentTransferMapper.selectById(formId);
|
|
|
- BaseClass baseClass = baseClassMapper.selectById(studentTransfer.getClassId());
|
|
|
- BaseClassMajorSet majorSet = baseClassMajorSetMapper.selectOne(
|
|
|
- new QueryWrapper<BaseClassMajorSet>().lambda()
|
|
|
- .eq(BaseClassMajorSet::getClassId, studentTransfer.getClassId())
|
|
|
- .eq(BaseClassMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+
|
|
|
+ BaseNewStudent newStudent = newStudentService.getById(studentTransfer.getStudentUserId());
|
|
|
+ User user = userService.getUserByParam(
|
|
|
+ new GetUserByParamDto() {{
|
|
|
+ setCredentialNumber(newStudent.getCredentialNumber());
|
|
|
+ }}
|
|
|
);
|
|
|
- BaseStudentSchoolRoll roll = new BaseStudentSchoolRoll();
|
|
|
- roll.setStduyStatus(studentTransfer.getStudyStatus());
|
|
|
- roll.setClassId(studentTransfer.getClassId());
|
|
|
- roll.setEnrollType(baseClass.getEnrollType());
|
|
|
- roll.setCreateDate(LocalDateTime.now());
|
|
|
- roll.setGradeId(baseClass.getGradeId());
|
|
|
- roll.setMajorSetId(majorSet.getMajorSetId());
|
|
|
- roll.setCreateUserId(studentTransfer.getCreateUserId());
|
|
|
- roll.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
|
|
|
- roll.setUserId(studentTransfer.getStudentUserId());
|
|
|
- //新增学籍信息
|
|
|
- studentSchoolRollService.save(roll);
|
|
|
+ LocalDate birthDate = LocalDateUtil.getBirthDate(newStudent.getCredentialNumber());
|
|
|
+ if(user == null){
|
|
|
+ User xjrUser = new User() {{
|
|
|
+ setCreateDate(LocalDateTime.now());
|
|
|
+ setPassword(BCrypt.hashpw(propertiesConfig.getDefaultPassword(), BCrypt.gensalt()));
|
|
|
+ setName(newStudent.getName());
|
|
|
+ setUserName(newStudent.getCredentialNumber());
|
|
|
+ setCredentialNumber(newStudent.getCredentialNumber());
|
|
|
+ setCredentialType("ZZLS10007");
|
|
|
+ setMobile(newStudent.getMobile());
|
|
|
+ setEnabledMark(EnabledMark.DISABLED.getCode());
|
|
|
+ setGender(newStudent.getGender());
|
|
|
+ setIsChangePassword(1);
|
|
|
+ setBirthDate(birthDate.atStartOfDay());
|
|
|
+ }};
|
|
|
+ userService.save(xjrUser);
|
|
|
+
|
|
|
+ BaseClass baseClass = baseClassMapper.selectById(studentTransfer.getClassId());
|
|
|
+ BaseClassMajorSet majorSet = baseClassMajorSetMapper.selectOne(
|
|
|
+ new QueryWrapper<BaseClassMajorSet>().lambda()
|
|
|
+ .eq(BaseClassMajorSet::getClassId, studentTransfer.getClassId())
|
|
|
+ .eq(BaseClassMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ );
|
|
|
+ BaseStudentSchoolRoll roll = new BaseStudentSchoolRoll();
|
|
|
+ roll.setStduyStatus(studentTransfer.getStudyStatus());
|
|
|
+ roll.setClassId(studentTransfer.getClassId());
|
|
|
+ roll.setEnrollType(baseClass.getEnrollType());
|
|
|
+ roll.setCreateDate(LocalDateTime.now());
|
|
|
+ roll.setGradeId(baseClass.getGradeId());
|
|
|
+ roll.setMajorSetId(majorSet.getMajorSetId());
|
|
|
+ roll.setCreateUserId(studentTransfer.getCreateUserId());
|
|
|
+ roll.setArchivesStatus(ArchivesStatusEnum.FB2901.getCode());
|
|
|
+ roll.setUserId(studentTransfer.getStudentUserId());
|
|
|
+ //新增学籍信息
|
|
|
+ studentSchoolRollService.save(roll);
|
|
|
+ }else{
|
|
|
+ studentSchoolRollService.updateStudentClass(studentTransfer.getClassId(), user.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|