|
@@ -40,6 +40,7 @@ import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.thymeleaf.util.StringUtils;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -131,8 +132,19 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long insertByAddBo(UserSubscribeAddBo bo) {
|
|
|
+ public Long insertByAddBo(UserSubscribeAddBo bo) throws ParseException {
|
|
|
UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
|
+ Date date = new Date();
|
|
|
+ Long times = add.getApplySiteExamTime()*1000;//时间戳
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String dateString = formatter.format(times);
|
|
|
+ String dateForma =null;
|
|
|
+ dateForma = dateString+" "+add.getApplySiteStartTime().replace("-", ":");
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Long time = sdf.parse(dateForma).getTime() / 1000;
|
|
|
+ if (System.currentTimeMillis()/1000 > time){
|
|
|
+ throw new IllegalArgumentException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
|
|
|
+ }
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setSubscribeStatus(1);
|
|
|
add.setExamStatus(0);
|
|
@@ -369,7 +381,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public List<UserSubscribeImport> importData(List<UserSubscribeImport> userSubscribeImportList) {
|
|
|
+ public List<UserSubscribeImport> importData(List<UserSubscribeImport> userSubscribeImportList) throws ParseException {
|
|
|
if (CollectionUtils.isEmpty(userSubscribeImportList)) {
|
|
|
throw new IllegalArgumentException("请勿导入空表格");
|
|
|
}
|