|
@@ -133,6 +133,32 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
return voList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public String insertByAddBoImport(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();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Long time = sdf.parse(dateForma).getTime() / 1000;
|
|
|
+ if (System.currentTimeMillis()/1000 > time){
|
|
|
+ return "当前选择的考试时间已过期,请重新预约,选择未过期考试时间";
|
|
|
+ }
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ add.setSubscribeStatus(1);
|
|
|
+ add.setExamStatus(0);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ this.save(add);
|
|
|
+ //发送预约考试消息
|
|
|
+ sendExamSucceed(bo);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Long insertByAddBo(UserSubscribeAddBo bo) throws ParseException {
|
|
|
UserSubscribe add = BeanUtil.toBean(bo, UserSubscribe.class);
|
|
@@ -142,7 +168,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String dateString = formatter.format(times);
|
|
|
String dateForma =null;
|
|
|
- dateForma = dateString+" "+add.getApplySiteStartTime().replace("-", ":");
|
|
|
+ dateForma = dateString+" "+add.getApplySiteStartTime();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
Long time = sdf.parse(dateForma).getTime() / 1000;
|
|
|
if (System.currentTimeMillis()/1000 > time){
|
|
@@ -486,7 +512,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(userSubscribeImport.getApplySiteTime())) {
|
|
|
- String[] split = userSubscribeImport.getApplySiteTime().split(":");
|
|
|
+ String[] split = userSubscribeImport.getApplySiteTime().split("-");
|
|
|
if (split.length < 2) {
|
|
|
userSubscribeImport.setCause("考试时间段错误");
|
|
|
userSubscribeImports.add(userSubscribeImport);
|
|
@@ -508,7 +534,12 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
userSubscribeAddBo.setImportNo(importNo);
|
|
|
userSubscribeAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
userSubscribeAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- this.insertByAddBo(userSubscribeAddBo);
|
|
|
+ String errorMsg = this.insertByAddBoImport(userSubscribeAddBo);
|
|
|
+ if(Validator.isNotEmpty(errorMsg)){
|
|
|
+ userSubscribeImport.setCause(errorMsg);
|
|
|
+ userSubscribeImports.add(userSubscribeImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
successImports.add(userSubscribeImport);
|
|
|
}
|
|
|
|
|
@@ -613,7 +644,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(userSubscribeImport.getApplySiteTime())) {
|
|
|
- String[] split = userSubscribeImport.getApplySiteTime().split(":");
|
|
|
+ String[] split = userSubscribeImport.getApplySiteTime().split("-");
|
|
|
if (split.length < 2) {
|
|
|
userSubscribeImport.setCause("考试时间段错误");
|
|
|
userSubscribeImports.add(userSubscribeImport);
|
|
@@ -644,7 +675,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(userSubscribeImport.getApplySiteTrainTime())) {
|
|
|
- String[] split = userSubscribeImport.getApplySiteTrainTime().split(":");
|
|
|
+ String[] split = userSubscribeImport.getApplySiteTrainTime().split("-");
|
|
|
if (split.length < 2) {
|
|
|
userSubscribeImport.setCause("考培时间段错误");
|
|
|
userSubscribeImports.add(userSubscribeImport);
|
|
@@ -662,7 +693,12 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
|
|
|
userSubscribeAddBo.setImportNo(importNo);
|
|
|
userSubscribeAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
userSubscribeAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
- this.insertByAddBo(userSubscribeAddBo);
|
|
|
+ String errorMsg = this.insertByAddBoImport(userSubscribeAddBo);
|
|
|
+ if(Validator.isNotEmpty(errorMsg)){
|
|
|
+ userSubscribeImport.setCause(errorMsg);
|
|
|
+ userSubscribeImports.add(userSubscribeImport);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
successImports.add(userSubscribeImport);
|
|
|
}
|
|
|
|