haogh пре 6 месеци
родитељ
комит
3ffeb767bb

+ 2 - 1
src/cn/hmsoft/art/control/score/ScoreYmControl.java

@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.File;
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 分数合成-包括科目分合成 和 专业分合成
@@ -98,7 +99,7 @@ public class ScoreYmControl extends ArtControl {
 	@CrossOrigin
 	@RequestMapping("score/ymfirst/upload")
 	public Ajax ymfirstUpload(MultipartFile file) throws Exception {
-		List<List<String>> values = ExcelReaderHelper.readSheet(file.getOriginalFilename(), file.getInputStream(), 1, 16);
+		List<List<String>> values = ExcelReaderHelper.readSheet(Objects.requireNonNull(file.getOriginalFilename()), file.getInputStream(), 1, 16);
 		final FrameOptr optr = this.getFrameOptr();
 		if (values.size() > 100) {
 			// 超过100条用 线程模式

+ 18 - 12
src/cn/hmsoft/art/control/score/ScoreYmService.java

@@ -101,12 +101,13 @@ public class ScoreYmService extends ArtService {
 		FrameThreadHelper.updateThread(thread, 1, "初试成绩", FrameThreadStatus.Running);
 		int row = 2;
 		int total = 0;
-		List<Map<String, Object>> enrolList = this.daoEnrol.listMapBySql("select s.std_id,s.cert_id,e.aspect_ticket_num,e.aspect_name,e.aspect_id from std_enrol e,std_reg s where e.std_id=s.std_id");
-		Map<String, Map<String, Object>> enrolMap = new HashMap<String, Map<String, Object>>();
+		List<Map<String, Object>> enrolList = this.daoEnrol.listMapBySql(
+				"select s.std_id,s.cert_id,e.aspect_ticket_num,e.aspect_name,e.aspect_id from std_enrol e,std_reg s where e.std_id=s.std_id");
+		Map<String, Map<String, Object>> enrolMap = new HashMap<>();
 		for (Map<String, Object> map : enrolList) {
 			enrolMap.put(map.get("cert_id").toString(), map);
 		}
-		Map<String, List<ScScoreYm>> scoreListMap = new HashMap<String, List<ScScoreYm>>();
+		Map<String, List<ScScoreYm>> scoreListMap = new HashMap<>();
 		for (List<String> list : values) {
 			String no = list.get(0) == null ? null : list.get(0).trim();//序号
 			String cert_id = list.get(1) == null ? null : list.get(1).trim();//身份证号
@@ -122,7 +123,7 @@ public class ScoreYmService extends ArtService {
 			String aspect_level = list.get(11) == null ? null : list.get(11).trim();//专业排名
 			String aspect_qualified = list.get(12) == null ? null : list.get(12).trim();//是否合格
 			String wei_gui = list.get(13) == null ? null : list.get(13).trim();//是否违规
-			String pdf = list.get(14) == null ? null : list.get(14).trim();//是否违规
+			String pdf = list.get(14) == null ? null : list.get(14).trim();//违规证据
 			String remark = list.get(15) == null ? null : list.get(15).trim();//成绩备注
 			
 			if (StringHelper.isEmpty(cert_id)) {
@@ -148,12 +149,10 @@ public class ScoreYmService extends ArtService {
 			if (stdMap == null) {
 				uploadError(thread, "第【" + row + "】行,身份证号【" + cert_id + "】对应的报考数据不存在,请确认");
 			}
-			List<ScScoreYm> scoreList = scoreListMap.get(aspect_name);
-			if (scoreList == null) {
-				scoreList = new ArrayList<ScScoreYm>();
-				scoreListMap.put(aspect_name, scoreList);
-			}
-			try {
+
+            List<ScScoreYm> scoreList = scoreListMap.computeIfAbsent(aspect_name, k -> new ArrayList<>());
+
+            try {
 				ScScoreYm score = new ScScoreYm();
 				score.setBatch("first");
 				score.setStd_id(Integer.valueOf(stdMap.get("std_id").toString()));
@@ -178,11 +177,12 @@ public class ScoreYmService extends ArtService {
 				uploadError(thread, "第【" + row + "】行,身份证号【" + cert_id + "】" + e.getMessage());
 			}
 		}
+		// 专业名称
 		for (String key : scoreListMap.keySet()) {
 			List<ScScoreYm> scoreList = scoreListMap.get(key);
 			//Collections.sort(scoreList);
 			int level = 1;
-			for (int i=0; i<scoreList.size(); i++) {
+			for (int i = 0; i < scoreList.size(); i++) {
 				ScScoreYm ym = scoreList.get(i);
 				/*if (i == 0) {
 					ym.setAspect_level(String.valueOf(level));
@@ -199,7 +199,7 @@ public class ScoreYmService extends ArtService {
 					}
 				}*/
 				row++;
-				total ++;
+				total++;
 				this.daoEnrol.insert(ym);
 				if (total % 500 == 0) {
 					FrameThreadHelper.updateThread(thread, total * 100 / values.size(),
@@ -207,6 +207,12 @@ public class ScoreYmService extends ArtService {
 				}
 			}
 		}
+
+		// 更新准考证号
+		String sql = "update sc_score_ym s ,std_enrol e set s.ticket_no=e.aspect_ticket_num  where s.std_id=e.std_id "
+				+ " and s.aspect_name=e.aspect_name and s.batch='first'";
+		this.daoEnrol.update(sql);
+
 		FrameThreadHelper.completeThread(thread, "导入成功:已处理【" + total + "】条初试成绩信息");
 		this.log(optr, ArtOptrLogType.StdScore_Import.toString(), values.size());
 	}