|
|
@@ -95,6 +95,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
@@ -1103,6 +1105,15 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
vo.setReason("学历等级不能为空");
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
+
|
|
|
+ List<String> list = Arrays.asList("职高", "高中", "专科", "本科", "硕士研究生", "博士研究生");
|
|
|
+ if (StringUtils.isBlank(bo.getExistingLevel()) || !list.contains(bo.getExistingLevel())){
|
|
|
+ AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
+ vo.setField("existingLevel");
|
|
|
+ vo.setReason("学历等级不符合标准");
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
//学历专业
|
|
|
if (StringUtils.isBlank(bo.getEduMajor())){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
@@ -1110,6 +1121,7 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
vo.setReason("学历专业不能为空");
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
+
|
|
|
if (!artisanChecks.stream().anyMatch(x -> x.getMajor().equals(bo.getEduMajor()))){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
vo.setField("学历专业");
|
|
|
@@ -1125,6 +1137,17 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getEduMajor()) && (bo.getEduMajor().equals("职高") || bo.getEduMajor().equals("高中"))){
|
|
|
+ //职高或者高中毕业时间要大于一年
|
|
|
+ if (isFullYear(bo.getExistingLevel(),"yyyy-MM-dd",1)){
|
|
|
+ AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
+ vo.setField("existingLevel");
|
|
|
+ vo.setReason("学历属于职高/高中,毕业时间需满1年");
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
if (bo.getType().equals("评审") && bo.getEducation().equals("有")){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
vo.setField("继续教育");
|
|
|
@@ -1225,21 +1248,43 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
- List<String> list = Arrays.asList("本科", "本科及以上");
|
|
|
+ List<String> list = Arrays.asList("职高", "高中", "专科", "本科", "硕士研究生", "博士研究生");
|
|
|
if (StringUtils.isBlank(bo.getExistingLevel()) || !list.contains(bo.getExistingLevel())){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
vo.setField("existingLevel");
|
|
|
- vo.setReason("现有资格等级不符合标准");
|
|
|
+ vo.setReason("学历等级不符合标准");
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(bo.getExistingLevel()) && (bo.getExistingLevel().equals("职高") || bo.getExistingLevel().equals("高中"))){
|
|
|
+ //职高或者高中毕业时间要大于一年
|
|
|
+ if (isFullYear(bo.getExistingLevel(),"yyyy-MM-dd",1)){
|
|
|
+ AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
+ vo.setField("existingLevel");
|
|
|
+ vo.setReason("学历属于职高/高中,毕业时间需满1年");
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (StringUtils.isBlank(bo.getExistingMajor()) || !artisanChecks.stream().anyMatch(x -> x.getMajor().equals(bo.getExistingMajor()))){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
vo.setField("existingMajor");
|
|
|
- vo.setReason("现有资格专业不符合");
|
|
|
+ vo.setReason("学历专业不符合");
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
+ if (bo.getType().equals("认定")){
|
|
|
+ //认定:学历专业和申报专业需一样
|
|
|
+ if (!bo.getExistingMajor().equals(bo.getMajor())){
|
|
|
+ AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
+ vo.setField("major");
|
|
|
+ vo.setReason("认定:学历专业和申报专业需要一样");
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isBlank(bo.getGraduateTime())){
|
|
|
AssistantCheckVo vo = new AssistantCheckVo();
|
|
|
vo.setField("graduateTime");
|
|
|
@@ -1263,6 +1308,29 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
|
|
return resultVo;
|
|
|
}
|
|
|
|
|
|
+ private static boolean isFullYear(String dateString, String pattern,Integer year) {
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
|
|
+ Date targetDate = sdf.parse(dateString);
|
|
|
+ Date currentDate = new Date();
|
|
|
+
|
|
|
+ Calendar targetCalendar = Calendar.getInstance();
|
|
|
+ targetCalendar.setTime(targetDate);
|
|
|
+
|
|
|
+ Calendar currentCalendar = Calendar.getInstance();
|
|
|
+ currentCalendar.setTime(currentDate);
|
|
|
+
|
|
|
+ // 增加一年到目标日期
|
|
|
+ targetCalendar.add(Calendar.YEAR, year);
|
|
|
+
|
|
|
+ // 判断增加一年后的日期是否小于等于当前日期
|
|
|
+ return !targetCalendar.after(currentCalendar);
|
|
|
+
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new IllegalArgumentException("日期格式错误或解析失败", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private boolean checkUnique(Long GoodsId,Long UserId) {
|
|
|
ShoppingCart info = iShoppingCartService.getOne(new LambdaQueryWrapper<ShoppingCart>()
|
|
|
.eq(ShoppingCart::getUserId,UserId).eq(ShoppingCart::getGoodsId,GoodsId).last("limit 1"));
|