|
|
@@ -0,0 +1,129 @@
|
|
|
+package com.xjrsoft.module.liteflow.node;
|
|
|
+
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.db.Entity;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
+import com.xjrsoft.XjrSoftApplication;
|
|
|
+import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
+import com.xjrsoft.common.enums.StudentTypeEnum;
|
|
|
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.organization.entity.User;
|
|
|
+import com.xjrsoft.module.organization.mapper.UserMapper;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentContactDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentFamilyDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentFamilyMemberDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentSchoolRollDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentSubsidizeDto;
|
|
|
+import com.xjrsoft.module.student.dto.AddBaseStudentUserDto;
|
|
|
+import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
|
|
|
+import com.xjrsoft.module.student.service.IStudentManagerService;
|
|
|
+import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import static org.junit.jupiter.api.Assertions.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author dzx
|
|
|
+ * @date 2025/4/1
|
|
|
+ */
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest(classes = XjrSoftApplication.class)
|
|
|
+class WfStudentRepeatStudyNodeTest {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IStudentManagerService studentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWorkflowExecuteService workflowExecuteService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserMapper userMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBaseStudentSchoolRollService schoolRollService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void test(){
|
|
|
+ Long formId = 1906987877859340288L;
|
|
|
+
|
|
|
+ String tableName = "wf_student_repeat_study";
|
|
|
+ Entity where = Entity.create(tableName);
|
|
|
+ where.set("id", formId);
|
|
|
+ Map<String, Object> objectMap = SqlRunnerAdapter.db().dynamicSelectOne(tableName, where);
|
|
|
+ int isOriginal = Integer.parseInt(objectMap.get("is_original").toString());
|
|
|
+
|
|
|
+ String credentialNumber = objectMap.get("credential_number").toString();
|
|
|
+
|
|
|
+ User user = userMapper.selectOne(
|
|
|
+ new MPJLambdaWrapper<User>()
|
|
|
+ .disableLogicDel()
|
|
|
+ .select(User::getId)
|
|
|
+ .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
|
|
|
+ .eq(User::getCredentialNumber, credentialNumber)
|
|
|
+ );
|
|
|
+
|
|
|
+ if(isOriginal == 0 && user == null){
|
|
|
+ AddBaseStudentUserDto baseStudentUser = new AddBaseStudentUserDto();
|
|
|
+ baseStudentUser.setName(objectMap.get("name").toString());
|
|
|
+ baseStudentUser.setCredentialType("ZZLS10007");
|
|
|
+ baseStudentUser.setCredentialNumber(objectMap.get("credential_number").toString());
|
|
|
+ baseStudentUser.setMobile(objectMap.get("mobile").toString());
|
|
|
+ baseStudentUser.setUserName(objectMap.get("credential_number").toString());
|
|
|
+
|
|
|
+ List<AddBaseStudentSchoolRollDto> baseStudentSchoolRollList = new ArrayList<>();
|
|
|
+ AddBaseStudentSchoolRollDto rollDto = new AddBaseStudentSchoolRollDto();
|
|
|
+ rollDto.setStduyStatus(objectMap.get("stduy_status").toString());
|
|
|
+ rollDto.setStduyStatus(ArchivesStatusEnum.FB2901.getCode());
|
|
|
+ rollDto.setMajorSetId(Long.parseLong(objectMap.get("major_set_id").toString()));
|
|
|
+ rollDto.setStudentType(StudentTypeEnum.FB2801.getCode());
|
|
|
+ rollDto.setClassId(Long.parseLong(objectMap.get("class_id").toString()));
|
|
|
+ rollDto.setGradeId(Long.parseLong(objectMap.get("grade_id").toString()));
|
|
|
+ baseStudentSchoolRollList.add(rollDto);
|
|
|
+ baseStudentUser.setBaseStudentSchoolRollList(baseStudentSchoolRollList);
|
|
|
+
|
|
|
+ List<AddBaseStudentDto> baseStudentList = new ArrayList<>();
|
|
|
+ AddBaseStudentDto studentDto = new AddBaseStudentDto();
|
|
|
+ studentDto.setIsMigrateChildren(0);
|
|
|
+ studentDto.setStudentId(baseStudentUser.getCredentialNumber());
|
|
|
+ studentDto.setIsFloatingPopulation(0);
|
|
|
+ baseStudentList.add(studentDto);
|
|
|
+ baseStudentUser.setBaseStudentList(baseStudentList);
|
|
|
+
|
|
|
+ List<AddBaseStudentContactDto> baseStudentContactList = new ArrayList<>();
|
|
|
+ baseStudentContactList.add(new AddBaseStudentContactDto());
|
|
|
+ baseStudentUser.setBaseStudentContactList(baseStudentContactList);
|
|
|
+
|
|
|
+ List<AddBaseStudentFamilyDto> baseStudentFamilyList = new ArrayList<>();
|
|
|
+ baseStudentFamilyList.add(new AddBaseStudentFamilyDto());
|
|
|
+ baseStudentUser.setBaseStudentFamilyList(baseStudentFamilyList);
|
|
|
+
|
|
|
+ List<AddBaseStudentFamilyMemberDto> baseStudentFamilyMemberList = new ArrayList<>();
|
|
|
+ baseStudentFamilyMemberList.add(new AddBaseStudentFamilyMemberDto());
|
|
|
+ baseStudentUser.setBaseStudentFamilyMemberList(baseStudentFamilyMemberList);
|
|
|
+
|
|
|
+ List<AddBaseStudentSubsidizeDto> baseStudentSubsidizeList = new ArrayList<>();
|
|
|
+ baseStudentUser.setBaseStudentSubsidizeList(baseStudentSubsidizeList);
|
|
|
+
|
|
|
+ studentService.add(baseStudentUser);
|
|
|
+ }else{
|
|
|
+ schoolRollService.activateStudent(user.getId());
|
|
|
+ schoolRollService.updateStudentClassGradeMajorStduyStatus(
|
|
|
+ Long.parseLong(objectMap.get("class_id").toString()),
|
|
|
+ Long.parseLong(objectMap.get("grade_id").toString()),
|
|
|
+ Long.parseLong(objectMap.get("major_set_id").toString()),
|
|
|
+ objectMap.get("stduy_status").toString(),
|
|
|
+ user.getId()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|