diff --git a/src/main/java/com/codesdream/ase/configure/ActivityFormConfigure.java b/src/main/java/com/codesdream/ase/configure/ActivityFormConfigure.java index 0d988bf..0ca3161 100644 --- a/src/main/java/com/codesdream/ase/configure/ActivityFormConfigure.java +++ b/src/main/java/com/codesdream/ase/configure/ActivityFormConfigure.java @@ -29,7 +29,7 @@ public class ActivityFormConfigure { add("assist-manager"); add("attendance"); }}; - public final static HashMap> stdActivityMap; + public final static Map> stdActivityMap; static { stdActivityMap = new HashMap() {{ diff --git a/src/main/java/com/codesdream/ase/controller/ActivityController.java b/src/main/java/com/codesdream/ase/controller/ActivityController.java index 6d732e5..421f699 100644 --- a/src/main/java/com/codesdream/ase/controller/ActivityController.java +++ b/src/main/java/com/codesdream/ase/controller/ActivityController.java @@ -2,11 +2,9 @@ package com.codesdream.ase.controller; import com.codesdream.ase.component.ASESpringUtil; import com.codesdream.ase.configure.ActivityFormConfigure; -import com.codesdream.ase.configure.AppConfigure; import com.codesdream.ase.exception.InvalidFormFormatException; import com.codesdream.ase.service.ActivityService; import com.codesdream.ase.validator.WebFormValidator; -import org.springframework.http.HttpRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PostMapping; @@ -23,10 +21,10 @@ public class ActivityController { @Resource ActivityService activityService; - @RequestMapping(value = "/activityCreator") - String activityCreatorView(Model model){return "activityCreator";} + @RequestMapping(value = "/activity_creator") + String activityCreatorView(Model model){return "activity_creator";} - @PostMapping(value = "/activityCreator") + @PostMapping(value = "/activity_creator") String activityCreator(Model model, HttpServletRequest request) throws InvalidFormFormatException { Map parameterMap = request.getParameterMap(); diff --git a/src/main/java/com/codesdream/ase/model/activity/Activity.java b/src/main/java/com/codesdream/ase/model/activity/Activity.java index 30c6f4d..2cf5f7b 100644 --- a/src/main/java/com/codesdream/ase/model/activity/Activity.java +++ b/src/main/java/com/codesdream/ase/model/activity/Activity.java @@ -2,6 +2,7 @@ package com.codesdream.ase.model.activity; import com.codesdream.ase.model.permission.User; import lombok.Data; +import lombok.EqualsAndHashCode; import org.springframework.security.core.parameters.P; import javax.persistence.*; diff --git a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java b/src/main/java/com/codesdream/ase/validator/WebFormValidator.java index 59ce3ec..9ab4dc5 100644 --- a/src/main/java/com/codesdream/ase/validator/WebFormValidator.java +++ b/src/main/java/com/codesdream/ase/validator/WebFormValidator.java @@ -4,10 +4,18 @@ import org.springframework.stereotype.Component; import java.util.*; +//用于检查网页表单格式是否合法 @Component public class WebFormValidator { - public HashMap check(Map> stdFormMap, Map webFormMap){ + /** + * 传入标准表单所具有的属性set以及网页表单的属性set,确保map中的key和value一一对应 + * 检查的时候会将标准表单和网页表单两个map中key相同的value进行完全匹配比较 + * 返回一个map,不同表单有不同的合法情况 + * 支持一次处理多个表单,请务必保持对应表单的标准和网页map中的key一样 + * @return 封装在一个map里的不同表单对应的合法情况 + */ + public HashMap check(Map> stdFormMap, Map webFormMap){ HashMap result = new HashMap(); Set stdKey = stdFormMap.keySet();