|
@@ -10,6 +10,11 @@ import com.ynfy.buss.exam.chouqian.service.ICqXxxqService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.BufferedWriter;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileWriter;
|
|
|
+import java.io.IOException;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
@@ -122,9 +127,16 @@ public class CqXxxqServiceImpl extends ServiceImpl<CqXxxqMapper, CqXxxq> impleme
|
|
|
if (cqXxxq.getDistrictname().equals("市直属")) {
|
|
|
cqXxList=cqXxxqMapper.cqxxxqszs(cqXxxq);
|
|
|
if(cqXxList.isEmpty()){
|
|
|
- CqXxxqlistmap.put("市直属",cqXxList);
|
|
|
+ CqXxxqlistmap.put("shizhishu",cqXxList);
|
|
|
// throw new JeecgBootException("没有可抽签的学校!");
|
|
|
}else {
|
|
|
+ LambdaQueryWrapper<CqYcqxx> query = new LambdaQueryWrapper<>();
|
|
|
+ query.eq(CqYcqxx::getDistrictname, cqXxxq.getDistrictname());
|
|
|
+ Long count = cqYcqxxMapper.selectCount(query);
|
|
|
+ if (Integer.parseInt(count + "") > 0) {
|
|
|
+ CqXxxqlistmap.put("shizhishu",cqXxxqLists);
|
|
|
+// throw new JeecgBootException("该区当前等级已经有抽签记录无法重复抽签!");
|
|
|
+ } else if (Integer.parseInt(count + "") == 0) {
|
|
|
//保存被抽签的学校
|
|
|
for (CqXxxq xxxq : cqXxList) {
|
|
|
cqYcqxx.setId(null);
|
|
@@ -134,10 +146,43 @@ public class CqXxxqServiceImpl extends ServiceImpl<CqXxxqMapper, CqXxxq> impleme
|
|
|
cqYcqxx.setClasscode(xxxq.getClasscode());
|
|
|
cqYcqxx.setNianji(xxxq.getNianji());
|
|
|
cqYcqxx.setEstate(xxxq.getEstate());
|
|
|
- cqYcqxx.setSchoolpopulation(xxxq.getSchoolpopulation());
|
|
|
- cqYcqxxMapper.insert(cqYcqxx);
|
|
|
+ if (xxxq.getSchoolpopulation()==null){
|
|
|
+ //判断有几个班级1个的单独拿出来
|
|
|
+ if(xxxq.getClasscode().equals("1")){
|
|
|
+ try {
|
|
|
+ // 创建文件对象
|
|
|
+ File file = new File("c://chouqian//市直属学校人数不足列表.txt");
|
|
|
+
|
|
|
+ // 如果文件不存在,则创建新文件
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.createNewFile();
|
|
|
+ System.out.println("文件已创建: " + file.getAbsolutePath());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用FileWriter的追加模式(第二个参数设为true)
|
|
|
+ // 使用BufferedWriter提高写入效率
|
|
|
+ // 指定UTF-8编码防止中文乱码
|
|
|
+ try (BufferedWriter writer = new BufferedWriter(
|
|
|
+ new FileWriter(file, StandardCharsets.UTF_8, true))) {
|
|
|
+
|
|
|
+ // 写入数据
|
|
|
+ writer.write(xxxq.getSchoolname()+"\n");
|
|
|
+
|
|
|
+ System.out.println("数据已成功追加到文件: " + file.getAbsolutePath());
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ System.err.println("追加数据到文件时出错: " + e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cqYcqxxMapper.insert(cqYcqxx);
|
|
|
+ }else {
|
|
|
+ cqYcqxx.setSchoolpopulation(xxxq.getSchoolpopulation());
|
|
|
+ cqYcqxxMapper.insert(cqYcqxx);
|
|
|
+ }
|
|
|
}
|
|
|
- CqXxxqlistmap.put("市直属",cqXxList);
|
|
|
+ }
|
|
|
+ CqXxxqlistmap.put("shizhishu",cqXxList);
|
|
|
}
|
|
|
}else {
|
|
|
//获取当前地市有多少个等级
|
|
@@ -179,6 +224,38 @@ public class CqXxxqServiceImpl extends ServiceImpl<CqXxxqMapper, CqXxxq> impleme
|
|
|
cqYcqxx.setClasscode(xxxq.getClasscode());
|
|
|
cqYcqxx.setNianji(xxxq.getNianji());
|
|
|
cqYcqxx.setEstate(xxxq.getEstate());
|
|
|
+ if (xxxq.getSchoolpopulation()==null){
|
|
|
+ cqYcqxx.setState("0");
|
|
|
+ cqYcqxxMapper.insert(cqYcqxx);
|
|
|
+ if(xxxq.getClasscode().equals("1")){
|
|
|
+ try {
|
|
|
+ // 创建文件对象
|
|
|
+ File file = new File("c://chouqian//"+xxxq.getDistrictname()+"学校人数不足列表.txt");
|
|
|
+
|
|
|
+ // 如果文件不存在,则创建新文件
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.createNewFile();
|
|
|
+ System.out.println("文件已创建: " + file.getAbsolutePath());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用FileWriter的追加模式(第二个参数设为true)
|
|
|
+ // 使用BufferedWriter提高写入效率
|
|
|
+ // 指定UTF-8编码防止中文乱码
|
|
|
+ try (BufferedWriter writer = new BufferedWriter(
|
|
|
+ new FileWriter(file, StandardCharsets.UTF_8, true))) {
|
|
|
+
|
|
|
+ // 写入数据
|
|
|
+ writer.write(xxxq.getEstate()+" "+xxxq.getSchoolname()+"\n");
|
|
|
+
|
|
|
+ System.out.println("数据已成功追加到文件: " + file.getAbsolutePath());
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ System.err.println("追加数据到文件时出错: " + e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
//获取抽签学校的考生数
|
|
|
cqYcqxx.setSchoolpopulation(xxxq.getSchoolpopulation());
|
|
|
if(xxxq.getSchoolpopulation()<45){
|
|
@@ -225,6 +302,7 @@ public class CqXxxqServiceImpl extends ServiceImpl<CqXxxqMapper, CqXxxq> impleme
|
|
|
cqYcqxx.setState("0");
|
|
|
cqYcqxxMapper.insert(cqYcqxx);
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
System.out.println("异常");
|
|
@@ -335,14 +413,18 @@ public class CqXxxqServiceImpl extends ServiceImpl<CqXxxqMapper, CqXxxq> impleme
|
|
|
List<String> dengji=cqXxxqMapper.huoqudsxxdj(cqXxxq.getDistrictname());
|
|
|
//判断是否是市直属学校
|
|
|
if (cqXxxq.getDistrictname().equals("市直属")) {
|
|
|
+
|
|
|
//获取需要抽签的学校
|
|
|
LambdaQueryWrapper<CqYcqxx> query = new LambdaQueryWrapper<>();
|
|
|
query.eq(CqYcqxx::getDistrictname, cqXxxq.getDistrictname()).eq(CqYcqxx::getNianji, cqXxxq.getNianji());
|
|
|
List<CqYcqxx> cqYcqxxList=cqYcqxxMapper.selectList(query);
|
|
|
- for (CqYcqxx cqYcqxx : cqYcqxxList) {
|
|
|
- //调用抽班级方法
|
|
|
- rycqsjsbj(cqYcqxx,cqCqbjxx,studentamount);
|
|
|
- System.out.println(cqYcqxx);
|
|
|
+ if (cqYcqxxList.isEmpty()){
|
|
|
+ System.out.println("空的不处理!");
|
|
|
+ }else {
|
|
|
+ for (CqYcqxx cqYcqxx : cqYcqxxList) {
|
|
|
+ //调用抽班级方法
|
|
|
+ rycqsjsbj(cqYcqxx, cqCqbjxx, studentamount);
|
|
|
+ }
|
|
|
}
|
|
|
}else {
|
|
|
//获取当前地市有多少个等级
|