diff --git a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java index 8b4175ff8cf415f8d388e75b5629b6a6b8acb514..2621a9c77ea949ab41f0c45202fbf33111158e58 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/hezhi/api/entity/AlipayService.java @@ -75,7 +75,7 @@ public class AlipayService { request.setBizModel(model); request.setNotifyUrl(aliPayConfig.getNotifyUrl()+"/api/pay/aliPayBoilerNotify"); - request.setReturnUrl("https://www.chsie.com.cn/payTheFees?examId="+examId+"&memberUserId="+memberUserId); + request.setReturnUrl("https://www.chsie.com.cn/examDetail?examId="+examId);//支付成功后跳转回哪个页面 AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "POST"); // 如果需要返回GET请求,请使用 diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java index aae6ca64bf2e8ce7410d62818531d2b5ca98d939..61e38e10d94982a39187e994ec8e728bb3dd3342 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/mapper/TbExamBatchMapper.java @@ -104,6 +104,12 @@ public interface TbExamBatchMapper * @return 结果 */ public int insertTbExamBatchBatch(@Param("tbExamBatchList") List tbExamBatchList); + /** + * 批量修改考试批次 + * @param tbExamBatchList 列表 + * @return 结果 + */ + public int updateTbExamBatchBatch(@Param("tbExamBatchList") List tbExamBatchList); /** * 查询考试批次 diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java index e0fe8d086f30c258e36c00f05838892eb5982391..ce9f706d8d424c29e30a969a75b15790f616911c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamRegistrationServiceImpl.java @@ -46,6 +46,10 @@ import java.io.FileInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -1264,11 +1268,29 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService int successRow = 0; for (TbExamRegistrationVO item : collect) { //首先校验数据 - //生日必须有两个-链接 - if (item.getBirthday().split("-").length != 3){ - erreList.put(item.getContactInformation(), "生日格式有误,正确格式:1999-09-09"); - continue; + String birthday = item.getBirthday(); + String normalized = birthday.replace("/", "-"); + String formatted = null; + LocalDate date; + try { + // 先用宽松格式解析(允许不补0) + date = LocalDate.parse(normalized, DateTimeFormatter.ofPattern("yyyy-M-d")); + + // 再用严格格式格式化(自动补0) + formatted = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + } catch (Exception e1) { + try { + // 尝试解析 Java Date.toString() 格式 + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); + Date parsedDate = sdf.parse(normalized); + SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd"); + formatted = targetFormat.format(parsedDate); + } catch (Exception e2) { + erreList.put(item.getContactInformation(), "生日格式有误,应为:1999-09-09 或 Fri Jul 07 00:00:00 CST 2000"); + continue; + } } + item.setBirthday(formatted); // 回写为标准格式 //校验手机号必须11位纯数字 if(item.getContactInformation().length() != 11||!item.getContactInformation().matches("^[0-9]*$")){ erreList.put(item.getContactInformation(), "手机号格式有误,应为11位纯数字"); diff --git a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java index ccb9a501f17c8a5da840f39d14702292479ce78a..3482ea83550092e61b874ddc40e06f2ab7e33991 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/hezhi/service/impl/TbExamServiceImpl.java @@ -25,6 +25,8 @@ import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; import java.util.concurrent.CountDownLatch; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 考试Service业务层处理 @@ -195,6 +197,53 @@ public class TbExamServiceImpl implements ITbExamService tbExamCourseMapper.insertTbExamCourse(tbExamCourse); } } + //todo 删除逻辑 +// +// List existingBatches = tbExamBatchMapper.getByExamId(tbExam.getExamId()); +// //存在的批次 +// Map existingBatchMap = existingBatches.stream() +// .collect(Collectors.toMap(TbExamBatch::getBatchIndex, Function.identity())); +// +// // 2. 获取当前提交的批次(必须包含原来的 batchIndex) +// List newBatches = tbExam.getExamBatchList(); +// Set newBatchIndexes = newBatches.stream() +// .map(TbExamBatch::getBatchIndex) +// .collect(Collectors.toSet()); +// +// // 3. 获取被移除的批次的主键 ID,转换为 Long[] +// Long[] toDeleteIds = existingBatches.stream() +// .filter(old -> !newBatchIndexes.contains(old.getBatchIndex())) +// .map(TbExamBatch::getExamBatchId) +// .toArray(Long[]::new); +// +// // 4. 删除操作 +// if (toDeleteIds.length > 0) { +// tbExamBatchMapper.deleteTbExamBatchByExamBatchIds(toDeleteIds); +// } +// +// List toInsert = new ArrayList<>(); +// List toUpdate = new ArrayList<>(); +// +// for (TbExamBatch newBatch : newBatches) { +// newBatch.setExamId(tbExam.getExamId()); // 保证 examId 正确 +// if (existingBatchMap.containsKey(newBatch.getBatchIndex())) { +// // 是更新:保留已有的主键 ID +// TbExamBatch existing = existingBatchMap.get(newBatch.getBatchIndex()); +// newBatch.setExamBatchId(existing.getExamBatchId()); +// toUpdate.add(newBatch); +// } else { +// // 是新增 +// toInsert.add(newBatch); +// } +// } +// if (!toInsert.isEmpty()) { +// tbExamBatchMapper.insertTbExamBatchBatch(toInsert); +// } +// +// if (!toUpdate.isEmpty()) { +// tbExamBatchMapper.updateTbExamBatchBatch(toUpdate); // 你需要写批量 update 逻辑 +// } + // 考试批次 List tbExamBatchList = tbExam.getExamBatchList(); if (!tbExamBatchList.isEmpty()){ diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbConferenceNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbConferenceNoticeMapper.xml index 65c8cc1393013a28cf9fd1cacb8172d847e1f522..3de8b845e54aff00f12011eb0b0a0b156a036c86 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbConferenceNoticeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbConferenceNoticeMapper.xml @@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and publisher = #{publisher} and create_time = #{createTime} + order by sort asc,create_time desc where diff --git a/ruoyi-system/src/main/resources/mapper/hezhi/TbLiveBroadcastMapper.xml b/ruoyi-system/src/main/resources/mapper/hezhi/TbLiveBroadcastMapper.xml index 052f55e66c175d919fc799ac12037f2d23c96a63..965d0e11f98631c6345e63f437ee7afced7cedaa 100644 --- a/ruoyi-system/src/main/resources/mapper/hezhi/TbLiveBroadcastMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/hezhi/TbLiveBroadcastMapper.xml @@ -66,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and delete_time = #{deleteTime} and delete_by = #{deleteBy} + order by create_time desc