|
@@ -23,7 +23,7 @@ public class StdWishService {
|
|
|
private CfAspectWishDao daoAspectWish;
|
|
|
|
|
|
public void saveStdWish(Integer std_id, Integer[] wish_ids, Integer adjust) {
|
|
|
- this.checkConditon(wish_ids, adjust);
|
|
|
+ this.checkCondition(wish_ids, adjust);
|
|
|
CfAspectWish cfwish = daoAspectWish.find(wish_ids[0]);
|
|
|
this.deleteStdWish(std_id, cfwish.getAspect_id());
|
|
|
Integer seq = 0;
|
|
@@ -41,47 +41,46 @@ public class StdWishService {
|
|
|
|
|
|
/**
|
|
|
* 删除志愿
|
|
|
- * @param std_id
|
|
|
- * @param wish_ids
|
|
|
+ * @param std_id 考生ID
|
|
|
+ * @param aspect_id 专业ID
|
|
|
*/
|
|
|
private void deleteStdWish(Integer std_id,Integer aspect_id) {
|
|
|
daoStdWish.deleteByAspectId(std_id, aspect_id);
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void checkConditon(Integer[] wish_ids, Integer adjust) {
|
|
|
+ private void checkCondition(Integer[] wish_ids, Integer adjust) {
|
|
|
FrameAssertUtil.isNotNull(adjust, "必须选择是否服从调剂");
|
|
|
- for(Integer i = 0;i<wish_ids.length;i++) {
|
|
|
- for(Integer j=i+1;j<wish_ids.length;j++) {
|
|
|
- if(wish_ids[i].equals(wish_ids[j])) {
|
|
|
+ for (int i = 0; i < wish_ids.length; i++) {
|
|
|
+ for (int j = i + 1; j < wish_ids.length; j++) {
|
|
|
+ if (wish_ids[i].equals(wish_ids[j])) {
|
|
|
throw new BusinessException("不能选择重复的志愿");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<CfAspectWish> awArr = new ArrayList<CfAspectWish>();
|
|
|
- for(Integer wish_id : wish_ids) {
|
|
|
+ List<CfAspectWish> awArr = new ArrayList<>();
|
|
|
+ for (Integer wish_id : wish_ids) {
|
|
|
awArr.add(this.daoAspectWish.find(wish_id));
|
|
|
}
|
|
|
boolean flag = false;
|
|
|
Integer index = 0;
|
|
|
- for(int i = 0;i<awArr.size(); i++) {
|
|
|
- CfAspectWish aw = awArr.get(i);
|
|
|
- if(StringHelper.isNotEmpty(aw.getWish_group())) {
|
|
|
- flag = true;
|
|
|
- index ++;
|
|
|
- }
|
|
|
- }
|
|
|
- if(flag && !index.equals(3)) {
|
|
|
+ for (CfAspectWish aw : awArr) {
|
|
|
+ if (StringHelper.isNotEmpty(aw.getWish_group())) {
|
|
|
+ flag = true;
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag && !index.equals(3)) {
|
|
|
throw new BusinessException("绘画(水彩画)、绘画(油画)、绘画(版画)三个志愿需一起填报或都不填报!");
|
|
|
}
|
|
|
-
|
|
|
- for(int i=0; i<awArr.size(); i++) {
|
|
|
+
|
|
|
+ for (int i = 0; i < awArr.size(); i++) {
|
|
|
CfAspectWish aw = awArr.get(i);
|
|
|
- if(StringHelper.isNotEmpty(aw.getWish_group())) {
|
|
|
- if(i+1<awArr.size() && StringHelper.isEmpty(awArr.get(i+1).getWish_group())) {
|
|
|
+ if (StringHelper.isNotEmpty(aw.getWish_group())) {
|
|
|
+ if (i + 1 < awArr.size() && StringHelper.isEmpty(awArr.get(i + 1).getWish_group())) {
|
|
|
throw new BusinessException("绘画(水彩画)、绘画(油画)、绘画(版画)三个志愿须连续填报");
|
|
|
}
|
|
|
- if(i+2<awArr.size() && StringHelper.isEmpty(awArr.get(i+2).getWish_group())) {
|
|
|
+ if (i + 2 < awArr.size() && StringHelper.isEmpty(awArr.get(i + 2).getWish_group())) {
|
|
|
throw new BusinessException("绘画(水彩画)、绘画(油画)、绘画(版画)三个志愿须连续填报");
|
|
|
}
|
|
|
break;
|