|
|
@@ -1,5 +1,6 @@
|
|
|
package com.xjrsoft.module.job;
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.xjrsoft.XjrSoftApplication;
|
|
|
@@ -21,6 +22,8 @@ import com.xjrsoft.module.student.service.IBaseNewStudentService;
|
|
|
import com.xjrsoft.module.student.service.IEnrollmentPlanService;
|
|
|
import com.xjrsoft.module.student.service.IPbCseFeeobjupdateService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.junit.jupiter.api.AfterEach;
|
|
|
+import org.junit.jupiter.api.BeforeEach;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -62,12 +65,23 @@ class BaseNewStudentTaskTest {
|
|
|
@Autowired
|
|
|
private IBaseMajorSetService majorSetService;
|
|
|
|
|
|
+ @BeforeEach
|
|
|
+ void setUp() {
|
|
|
+ // 模拟用户登录
|
|
|
+ StpUtil.login(1000000000000000000L); // 假设用户ID为1
|
|
|
+ }
|
|
|
+
|
|
|
+ @AfterEach
|
|
|
+ void tearDown() {
|
|
|
+ // 清理会话
|
|
|
+ StpUtil.logout();
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void execute(){
|
|
|
doExecute();
|
|
|
}
|
|
|
-
|
|
|
- void doExecute(){
|
|
|
+ void doExecute() {
|
|
|
List<PbCseFeeobjupdate> dataList = cseFeeobjupdateService.list();
|
|
|
|
|
|
String sql = "select distinct enteryear, userdef6 from pb_cse_feeobjupdate";
|
|
|
@@ -83,14 +97,14 @@ class BaseNewStudentTaskTest {
|
|
|
|
|
|
Map<String, Long> planMap = new HashMap<>();
|
|
|
//插入招生计划数据
|
|
|
- gradeList.forEach((x)->{
|
|
|
+ gradeList.forEach((x) -> {
|
|
|
EnrollmentPlan plan = new EnrollmentPlan();
|
|
|
plan.setCreateDate(new Date());
|
|
|
plan.setEnabledMark(EnabledMark.ENABLED.getCode());
|
|
|
plan.setDeleteMark(DeleteMark.NODELETE.getCode());
|
|
|
- if("1".equals(x.get("userdef6").toString())){
|
|
|
+ if ("1".equals(x.get("userdef6").toString())) {
|
|
|
plan.setEnrollType(EnrollTypeEnum.SPRING_ENROLLMENT.getCode());
|
|
|
- }else if("2".equals(x.get("userdef6").toString())){
|
|
|
+ } else if ("2".equals(x.get("userdef6").toString())) {
|
|
|
plan.setEnrollType(EnrollTypeEnum.AUTUMN_ENROLLMENT.getCode());
|
|
|
}
|
|
|
|
|
|
@@ -107,7 +121,7 @@ class BaseNewStudentTaskTest {
|
|
|
planMap.put(x.get("enteryear").toString() + x.get("userdef6").toString(), oldPlanId);
|
|
|
|
|
|
//判断是否已经存在,不存在就新增
|
|
|
- if(oldPlanId == null){
|
|
|
+ if (oldPlanId == null) {
|
|
|
planService.save(plan);
|
|
|
planMap.put(x.get("enteryear").toString() + x.get("userdef6").toString(), plan.getId());
|
|
|
}
|
|
|
@@ -125,7 +139,7 @@ class BaseNewStudentTaskTest {
|
|
|
.eq(BaseMajorSet::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
.eq(BaseMajorSet::getEnabledMark, EnabledMark.ENABLED.getCode())
|
|
|
);
|
|
|
- Map<String, Long> majorSetMap = majorSetList.stream().collect(Collectors.toMap(BaseMajorSet::getCode, BaseMajorSet::getId));
|
|
|
+ Map<String, Long> majorSetNameMap = majorSetList.stream().collect(Collectors.toMap(BaseMajorSet::getName, BaseMajorSet::getId));
|
|
|
|
|
|
//循环攀宝的数据,准备更新到新生表中
|
|
|
List<BaseNewStudent> updateList = new ArrayList<>();
|
|
|
@@ -133,20 +147,20 @@ class BaseNewStudentTaskTest {
|
|
|
for (PbCseFeeobjupdate feeobjupdate : dataList) {
|
|
|
BaseNewStudent existsNewStudent = existsNewStudentMap.get(feeobjupdate.getPersonalid());
|
|
|
|
|
|
- if(existsNewStudent != null){
|
|
|
+ if (existsNewStudent != null) {
|
|
|
existsNewStudent.setName(feeobjupdate.getFeeobjname());
|
|
|
existsNewStudent.setPaymnystate(feeobjupdate.getPaymnystate());
|
|
|
existsNewStudent.setPrevious(feeobjupdate.getPrevious());
|
|
|
existsNewStudent.setProvince(feeobjupdate.getProvince());
|
|
|
existsNewStudent.setCity(feeobjupdate.getCity());
|
|
|
existsNewStudent.setMyarea(feeobjupdate.getMyarea());
|
|
|
- if(StrUtil.isNotEmpty(feeobjupdate.getSg())){
|
|
|
- if(StringUtils.isNumeric(feeobjupdate.getSg())){
|
|
|
+ if (StrUtil.isNotEmpty(feeobjupdate.getSg())) {
|
|
|
+ if (StringUtils.isNumeric(feeobjupdate.getSg())) {
|
|
|
existsNewStudent.setHeight(BigDecimal.valueOf(Double.parseDouble(feeobjupdate.getSg())));
|
|
|
}
|
|
|
}
|
|
|
- if(StrUtil.isNotEmpty(feeobjupdate.getTz())){
|
|
|
- if(StringUtils.isNumeric(feeobjupdate.getTz())){
|
|
|
+ if (StrUtil.isNotEmpty(feeobjupdate.getTz())) {
|
|
|
+ if (StringUtils.isNumeric(feeobjupdate.getTz())) {
|
|
|
existsNewStudent.setWeight(BigDecimal.valueOf(Double.parseDouble(feeobjupdate.getTz())));
|
|
|
}
|
|
|
}
|
|
|
@@ -156,12 +170,14 @@ class BaseNewStudentTaskTest {
|
|
|
existsNewStudent.setMobile(feeobjupdate.getTelephone());
|
|
|
existsNewStudent.setFamilyMobile(feeobjupdate.getJzlxdh());
|
|
|
existsNewStudent.setFamilyAddress(feeobjupdate.getAddress());
|
|
|
- existsNewStudent.setFirstAmbition(majorSetMap.get(feeobjupdate.getSpeccode()));
|
|
|
- existsNewStudent.setFirstAmbitionId(majorSetMap.get(feeobjupdate.getSpeccode()));
|
|
|
- existsNewStudent.setSecondAmbition(majorSetMap.get(feeobjupdate.getZytjspec()));
|
|
|
- existsNewStudent.setSecondAmbitionId(majorSetMap.get(feeobjupdate.getZytjspec()));
|
|
|
+ existsNewStudent.setFirstAmbition(majorSetNameMap.get(feeobjupdate.getSpecname()));
|
|
|
+ existsNewStudent.setFirstAmbitionId(majorSetNameMap.get(feeobjupdate.getSpecname()));
|
|
|
+ existsNewStudent.setSecondAmbition(majorSetNameMap.get(feeobjupdate.getZytjspec()));
|
|
|
+ existsNewStudent.setSecondAmbitionId(majorSetNameMap.get(feeobjupdate.getZytjspec()));
|
|
|
existsNewStudent.setGender(GenderDictionaryEnum.getCode(feeobjupdate.getSex()));
|
|
|
existsNewStudent.setModifyDate(new Date());
|
|
|
+ existsNewStudent.setStatus(0);
|
|
|
+ existsNewStudent.setIsCanBanding(1);
|
|
|
|
|
|
updateList.add(existsNewStudent);
|
|
|
continue;
|
|
|
@@ -169,7 +185,7 @@ class BaseNewStudentTaskTest {
|
|
|
|
|
|
Long planId = planMap.get(feeobjupdate.getEnteryear() + feeobjupdate.getUserdef6());
|
|
|
insertList.add(
|
|
|
- new BaseNewStudent(){{
|
|
|
+ new BaseNewStudent() {{
|
|
|
setCredentialNumber(feeobjupdate.getPersonalid());
|
|
|
setName(feeobjupdate.getFeeobjname());
|
|
|
setPaymnystate(feeobjupdate.getPaymnystate());
|
|
|
@@ -177,41 +193,41 @@ class BaseNewStudentTaskTest {
|
|
|
setProvince(feeobjupdate.getProvince());
|
|
|
setCity(feeobjupdate.getCity());
|
|
|
setMyarea(feeobjupdate.getMyarea());
|
|
|
- if(StrUtil.isNotEmpty(feeobjupdate.getSg())){
|
|
|
- if(StringUtils.isNumeric(feeobjupdate.getSg())){
|
|
|
+ if (StrUtil.isNotEmpty(feeobjupdate.getSg())) {
|
|
|
+ if (StringUtils.isNumeric(feeobjupdate.getSg())) {
|
|
|
setHeight(BigDecimal.valueOf(Double.parseDouble(feeobjupdate.getSg())));
|
|
|
}
|
|
|
}
|
|
|
- if(StrUtil.isNotEmpty(feeobjupdate.getTz())){
|
|
|
- if(StringUtils.isNumeric(feeobjupdate.getTz())){
|
|
|
+ if (StrUtil.isNotEmpty(feeobjupdate.getTz())) {
|
|
|
+ if (StringUtils.isNumeric(feeobjupdate.getTz())) {
|
|
|
setWeight(BigDecimal.valueOf(Double.parseDouble(feeobjupdate.getTz())));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
setGraduateSchool(feeobjupdate.getGraduations());
|
|
|
setStduyStatus(StudyStatusEnum.getCode(feeobjupdate.getQuartername()));
|
|
|
setSource(StudentTypeEnum.getCode(feeobjupdate.getResourcename()));
|
|
|
setMobile(feeobjupdate.getTelephone());
|
|
|
setFamilyMobile(feeobjupdate.getJzlxdh());
|
|
|
setFamilyAddress(feeobjupdate.getAddress());
|
|
|
- setFirstAmbition(majorSetMap.get(feeobjupdate.getSpeccode()));
|
|
|
- setFirstAmbitionId(majorSetMap.get(feeobjupdate.getSpeccode()));
|
|
|
- setSecondAmbition(majorSetMap.get(feeobjupdate.getZytjspec()));
|
|
|
- setSecondAmbitionId(majorSetMap.get(feeobjupdate.getZytjspec()));
|
|
|
+ setFirstAmbition(majorSetNameMap.get(feeobjupdate.getSpecname()));
|
|
|
+ setFirstAmbitionId(majorSetNameMap.get(feeobjupdate.getSpecname()));
|
|
|
+ setSecondAmbition(majorSetNameMap.get(feeobjupdate.getZytjspec()));
|
|
|
+ setSecondAmbitionId(majorSetNameMap.get(feeobjupdate.getZytjspec()));
|
|
|
setGender(GenderDictionaryEnum.getCode(feeobjupdate.getSex()));
|
|
|
setEnrollmentPlanId(planId);
|
|
|
setCreateDate(new Date());
|
|
|
+ setStatus(0);
|
|
|
+ setIsCanBanding(1);
|
|
|
}}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- if(!updateList.isEmpty()){
|
|
|
+ if (!updateList.isEmpty()) {
|
|
|
newStudentService.updateBatchById(updateList);
|
|
|
}
|
|
|
- if(!insertList.isEmpty()){
|
|
|
+ if (!insertList.isEmpty()) {
|
|
|
newStudentService.saveBatch(insertList);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
}
|