|
@@ -14,7 +14,6 @@ import com.template.model.result.PageUtils;
|
|
|
import com.template.model.vo.*;
|
|
import com.template.model.vo.*;
|
|
|
import com.template.services.*;
|
|
import com.template.services.*;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
@@ -29,6 +28,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -64,7 +64,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
private WelcomeAccompanyService welcomeAccompanyService;
|
|
private WelcomeAccompanyService welcomeAccompanyService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private WelcomeStudentDormitoryService welcomeStudentDormitoryService;
|
|
|
|
|
|
|
+ private WelcomeBedService welcomeBedService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WelcomeArriveSettingService welcomeArriveSettingService;
|
|
private WelcomeArriveSettingService welcomeArriveSettingService;
|
|
@@ -162,11 +162,20 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 宿舍信息
|
|
//region 宿舍信息
|
|
|
- WelcomeStudentDormitory wsd = new WelcomeStudentDormitory();
|
|
|
|
|
- wsd.setStudentCard(isr.getCardId());
|
|
|
|
|
- wsd.setBuilding(isr.getBilding());
|
|
|
|
|
- wsd.setDormitory(isr.getDormitory());
|
|
|
|
|
- wsd.setBedNum(isr.getBednum());
|
|
|
|
|
|
|
+ WelcomeBed bedData = welcomeBedService.queryBedData(isr.getSchool(), isr.getBuildId(), isr.getDormitoryId(), Integer.valueOf(isr.getBed()));
|
|
|
|
|
+ if (bedData != null) {
|
|
|
|
|
+ bedData.setStudentCard(isr.getCardId());
|
|
|
|
|
+ bedData.setCollege(isr.getCollege());
|
|
|
|
|
+ bedData.setCollegeId(isr.getCollegeId());
|
|
|
|
|
+ bedData.setMajor(isr.getMajor());
|
|
|
|
|
+ bedData.setMajorId(isr.getMajorId());
|
|
|
|
|
+ bedData.setClassstr(isr.getClassstr());
|
|
|
|
|
+ bedData.setClassstrId(isr.getClassstrId());
|
|
|
|
|
+ bedData.setIsCheck(1);
|
|
|
|
|
+ bedData.setCardNum(isr.getAdmissNum());
|
|
|
|
|
+ bedData.setName(isr.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -193,9 +202,9 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int insertStudentDormitory = welcomeStudentDormitoryService.insertWelcomeStudentDormitory(wsd);
|
|
|
|
|
|
|
+ int insertStudentDormitory = welcomeBedService.updateWelcomeBed(bedData);
|
|
|
if (insertStudentDormitory <= 0) {
|
|
if (insertStudentDormitory <= 0) {
|
|
|
- logger.error("添加宿舍信息失败,参数:" + JSON.toJSON(wsd));
|
|
|
|
|
|
|
+ logger.error("添加学生床位信息失败,参数:" + JSON.toJSON(bedData));
|
|
|
throw new Exception("添加失败!");
|
|
throw new Exception("添加失败!");
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -289,11 +298,52 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 宿舍信息
|
|
//region 宿舍信息
|
|
|
- WelcomeStudentDormitory wsd = new WelcomeStudentDormitory();
|
|
|
|
|
- wsd.setStudentCard(usr.getCardId());
|
|
|
|
|
- wsd.setBuilding(usr.getBilding());
|
|
|
|
|
- wsd.setDormitory(usr.getDormitory());
|
|
|
|
|
- wsd.setBedNum(usr.getBednum());
|
|
|
|
|
|
|
+ List<WelcomeBed> bedDatas = new ArrayList<>();
|
|
|
|
|
+ WelcomeBed bedData = welcomeBedService.queryBedData(usr.getSchool(), usr.getBuildId(), usr.getDormitoryId(), Integer.valueOf(usr.getBed()));
|
|
|
|
|
+ if (bedData != null) {//新床位
|
|
|
|
|
+ if (!StringUtils.hasText(bedData.getStudentCard())) {
|
|
|
|
|
+ bedData.setStudentCard(student.getCardId());
|
|
|
|
|
+ bedData.setCollege(student.getCollege());
|
|
|
|
|
+ bedData.setCollegeId(student.getCollegeId());
|
|
|
|
|
+ bedData.setMajor(student.getMajor());
|
|
|
|
|
+ bedData.setMajorId(student.getMajorId());
|
|
|
|
|
+ bedData.setClassstr(student.getClassstr());
|
|
|
|
|
+ bedData.setClassstrId(student.getClassstrId());
|
|
|
|
|
+ bedData.setIsCheck(1);
|
|
|
|
|
+ bedData.setCardNum(student.getAdmissNum());
|
|
|
|
|
+ bedData.setName(student.getName());
|
|
|
|
|
+
|
|
|
|
|
+ //把旧床位清空
|
|
|
|
|
+ WelcomeBed obedData = welcomeBedService.getBedByCardId(student.getCardId());
|
|
|
|
|
+ if (obedData == null) {
|
|
|
|
|
+ obedData.setStudentCard(null);
|
|
|
|
|
+ obedData.setCollege(null);
|
|
|
|
|
+ obedData.setCollegeId(null);
|
|
|
|
|
+ obedData.setMajor(null);
|
|
|
|
|
+ obedData.setMajorId(null);
|
|
|
|
|
+ obedData.setClassstr(null);
|
|
|
|
|
+ obedData.setClassstrId(null);
|
|
|
|
|
+ obedData.setIsCheck(0);
|
|
|
|
|
+ obedData.setCardNum(null);
|
|
|
|
|
+ obedData.setName(null);
|
|
|
|
|
+ bedDatas.add(obedData);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bedData.setStudentCard(student.getCardId());
|
|
|
|
|
+ bedData.setCollege(student.getCollege());
|
|
|
|
|
+ bedData.setCollegeId(student.getCollegeId());
|
|
|
|
|
+ bedData.setMajor(student.getMajor());
|
|
|
|
|
+ bedData.setMajorId(student.getMajorId());
|
|
|
|
|
+ bedData.setClassstr(student.getClassstr());
|
|
|
|
|
+ bedData.setClassstrId(student.getClassstrId());
|
|
|
|
|
+ bedData.setIsCheck(1);
|
|
|
|
|
+ bedData.setCardNum(student.getAdmissNum());
|
|
|
|
|
+ bedData.setName(student.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ bedDatas.add(bedData);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -322,23 +372,10 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- WelcomeStudentDormitory wsds = welcomeStudentDormitoryService.getManageByCardId(student.getCardId());
|
|
|
|
|
- if(wsds == null){
|
|
|
|
|
- int insertStudentDormitory = welcomeStudentDormitoryService.insertWelcomeStudentDormitory(wsd);
|
|
|
|
|
- if (insertStudentDormitory <= 0) {
|
|
|
|
|
- logger.error("添加宿舍信息失败,参数:" + JSON.toJSON(wsd));
|
|
|
|
|
- throw new Exception("添加失败!");
|
|
|
|
|
- }
|
|
|
|
|
- }else{
|
|
|
|
|
- wsds.setStudentCard(usr.getCardId());
|
|
|
|
|
- wsds.setBuilding(usr.getBilding());
|
|
|
|
|
- wsds.setDormitory(usr.getDormitory());
|
|
|
|
|
- wsds.setBedNum(usr.getBednum());
|
|
|
|
|
- int updateStudentDormitory = welcomeStudentDormitoryService.updateWelcomeStudentDormitory(wsds);
|
|
|
|
|
- if (updateStudentDormitory < 0) {
|
|
|
|
|
- logger.error("编辑宿舍信息失败,参数:" + JSON.toJSON(wsd));
|
|
|
|
|
- throw new Exception("编辑失败!");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ boolean updateBatch = welcomeBedService.updateBatchById(bedDatas);
|
|
|
|
|
+ if (!updateBatch) {
|
|
|
|
|
+ logger.error("添加宿舍信息失败,参数:" + JSON.toJSON(bedDatas));
|
|
|
|
|
+ throw new Exception("添加失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -396,11 +433,14 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
result.setAvs(avs);
|
|
result.setAvs(avs);
|
|
|
|
|
|
|
|
//宿舍信息
|
|
//宿舍信息
|
|
|
- WelcomeStudentDormitory wsd = welcomeStudentDormitoryService.getManageByCardId(ws.getCardId());
|
|
|
|
|
|
|
+ WelcomeBed wsd = welcomeBedService.getBedByCardId(ws.getCardId());
|
|
|
if (wsd != null) {
|
|
if (wsd != null) {
|
|
|
- result.setBuilding(wsd.getBuilding());//楼栋
|
|
|
|
|
|
|
+ result.setBuild(wsd.getBuild());
|
|
|
|
|
+ result.setBuildId(wsd.getBuild());
|
|
|
result.setDormitory(wsd.getDormitory());//寝室号
|
|
result.setDormitory(wsd.getDormitory());//寝室号
|
|
|
- result.setBedNum(wsd.getBedNum());//床位号
|
|
|
|
|
|
|
+ result.setDormitoryId(wsd.getDormitoryId());//寝室号
|
|
|
|
|
+ result.setBed(String.valueOf(wsd.getNumber()));//床位号
|
|
|
|
|
+ result.setBedId(wsd.getId());//床位号
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//时间段
|
|
//时间段
|
|
@@ -574,6 +614,21 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
if (ws == null) {
|
|
if (ws == null) {
|
|
|
return CommonResult.fail("学生信息已失效,无法进行删除操作!");
|
|
return CommonResult.fail("学生信息已失效,无法进行删除操作!");
|
|
|
}
|
|
}
|
|
|
|
|
+ //把旧床位清空
|
|
|
|
|
+ WelcomeBed obedData = welcomeBedService.getBedByCardId(ws.getCardId());
|
|
|
|
|
+ if (obedData != null) {
|
|
|
|
|
+ obedData.setStudentCard(null);
|
|
|
|
|
+ obedData.setCollege(null);
|
|
|
|
|
+ obedData.setCollegeId(null);
|
|
|
|
|
+ obedData.setMajor(null);
|
|
|
|
|
+ obedData.setMajorId(null);
|
|
|
|
|
+ obedData.setClassstr(null);
|
|
|
|
|
+ obedData.setClassstrId(null);
|
|
|
|
|
+ obedData.setIsCheck(0);
|
|
|
|
|
+ obedData.setCardNum(null);
|
|
|
|
|
+ obedData.setName(null);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
//删除学生数据
|
|
//删除学生数据
|
|
|
int deleteStudent = welcomeStudentService.deleteWelcomeStudentById(id);
|
|
int deleteStudent = welcomeStudentService.deleteWelcomeStudentById(id);
|
|
@@ -581,8 +636,15 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
|
|
|
logger.error("删除学生信息失败,id参数:" + JSON.toJSON(id));
|
|
logger.error("删除学生信息失败,id参数:" + JSON.toJSON(id));
|
|
|
throw new Exception("删除学生信息失败!");
|
|
throw new Exception("删除学生信息失败!");
|
|
|
}
|
|
}
|
|
|
- //删除宿舍数据
|
|
|
|
|
- int deleteSd = welcomeStudentDormitoryService.deleteWelcomeStudentDormitoryByCard(ws.getCardId());
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (obedData != null) {
|
|
|
|
|
+ //删除宿舍数据
|
|
|
|
|
+ int deleteSd = welcomeBedService.updateWelcomeBed(obedData);
|
|
|
|
|
+ if (deleteSd < 0) {
|
|
|
|
|
+ logger.error("删除宿舍失败,obedData参数:" + JSON.toJSON(obedData));
|
|
|
|
|
+ throw new Exception("删除学生信息失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//删除同行人员
|
|
//删除同行人员
|
|
|
int deleteWa = welcomeAccompanyService.deleteWelcomeAccompanyByCard(ws.getCardId());
|
|
int deleteWa = welcomeAccompanyService.deleteWelcomeAccompanyByCard(ws.getCardId());
|
|
|
//删除家庭成员
|
|
//删除家庭成员
|