|
|
@@ -4,6 +4,7 @@ import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
@@ -33,33 +34,33 @@ import platform.modules.sys.web.ResponseMessage;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/project")
|
|
|
-public class ProjectController extends BaseController{
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ProjectService projectService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ProjectMaterialService projectMaterialService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ProjectTypeService projectTypeService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DictionaryItemService dictionaryItemService;
|
|
|
-
|
|
|
- @OperationLog(value = "查看项目申报项目列表")
|
|
|
- @RequestMapping("/list")
|
|
|
- public String list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
- String keyword , ModelMap modelMap){
|
|
|
-
|
|
|
- PageInfo<Project> pageInfo = projectService.findPage(pageNum,PAGESIZE,keyword);
|
|
|
-
|
|
|
- modelMap.put("keyword",keyword);
|
|
|
- modelMap.put("pageInfo",pageInfo);
|
|
|
+public class ProjectController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectService projectService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectMaterialService projectMaterialService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectTypeService projectTypeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DictionaryItemService dictionaryItemService;
|
|
|
+
|
|
|
+ @OperationLog(value = "查看项目申报项目列表")
|
|
|
+ @RequestMapping("/list")
|
|
|
+ public String list(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ String keyword, ModelMap modelMap) {
|
|
|
+
|
|
|
+ PageInfo<Project> pageInfo = projectService.findPage(pageNum, PAGESIZE, keyword);
|
|
|
+
|
|
|
+ modelMap.put("keyword", keyword);
|
|
|
+ modelMap.put("pageInfo", pageInfo);
|
|
|
return BASE_GOVERNMENT_PATH + "project/list";
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
+
|
|
|
+ /**
|
|
|
* 跳转到项目添加页面
|
|
|
*/
|
|
|
@GetMapping(value = "/add")
|
|
|
@@ -79,11 +80,11 @@ public class ProjectController extends BaseController{
|
|
|
*/
|
|
|
@GetMapping("/getProjectByYear")
|
|
|
@ResponseBody
|
|
|
- public Object getProjectByYear(Integer year){
|
|
|
+ public Object getProjectByYear(Integer year) {
|
|
|
List<ProjectType> projectTypes = projectTypeService.findByYear(year);
|
|
|
return ResponseMessage.success("success", projectTypes);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 添加/编辑项目
|
|
|
*/
|
|
|
@@ -91,15 +92,15 @@ public class ProjectController extends BaseController{
|
|
|
@ResponseBody
|
|
|
@PostMapping(value = "/save")
|
|
|
public ResponseMessage save(Project project) throws Exception {
|
|
|
- if(IsTooFrequently()) {
|
|
|
- return ResponseMessage.error("操作过于频繁,请稍后再试!");
|
|
|
- }
|
|
|
- Boolean flag = true ;
|
|
|
- if(null != project.getId()) {
|
|
|
- projectService.updateProject(project);
|
|
|
- }else {
|
|
|
- projectService.saveProject(project);
|
|
|
- }
|
|
|
+ if (IsTooFrequently()) {
|
|
|
+ return ResponseMessage.error("操作过于频繁,请稍后再试!");
|
|
|
+ }
|
|
|
+ Boolean flag = true;
|
|
|
+ if (null != project.getId()) {
|
|
|
+ projectService.updateProject(project);
|
|
|
+ } else {
|
|
|
+ projectService.saveProject(project);
|
|
|
+ }
|
|
|
if (flag) {
|
|
|
return ResponseMessage.success("保存成功!");
|
|
|
}
|
|
|
@@ -123,7 +124,7 @@ public class ProjectController extends BaseController{
|
|
|
modelMap.put("projectTypeList", projectTypeList);
|
|
|
return BASE_GOVERNMENT_PATH + "project/project_edit";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 删除项目
|
|
|
*/
|
|
|
@@ -133,83 +134,85 @@ public class ProjectController extends BaseController{
|
|
|
public ResponseMessage delete(@PathVariable("id") String id) throws Exception {
|
|
|
|
|
|
try {
|
|
|
- projectService.deleteProject(id);
|
|
|
- return ResponseMessage.success("删除成功!");
|
|
|
- }catch(BaseException e) {
|
|
|
- return ResponseMessage.success(e.getMessage());
|
|
|
- }catch(Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ projectService.deleteProject(id);
|
|
|
+ return ResponseMessage.success("删除成功!");
|
|
|
+ } catch (BaseException e) {
|
|
|
+ return ResponseMessage.success(e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
return ResponseMessage.error("删除失败!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
- * 检验项目名称是否存在
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @GetMapping(value = "/isExistProjectName")
|
|
|
- public Boolean isExistProjectName(String id, String name ,String type, Integer year) throws Exception {
|
|
|
- boolean flag = true;
|
|
|
- log.debug("检验项目名称是否存在参数! id= {}, name= {}", id, name,type);
|
|
|
- Project project= projectService.findProjectByName(name,type);
|
|
|
+ * 检验项目名称是否存在
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping(value = "/isExistProjectName")
|
|
|
+ public Boolean isExistProjectName(String id, String name, String type, Integer year) throws Exception {
|
|
|
+ boolean flag = true;
|
|
|
+ log.debug("检验项目名称是否存在参数! id= {}, name= {}", id, name, type);
|
|
|
+ Project project = projectService.findProjectByName(name, type);
|
|
|
// Project project= projectService.findProjectByYear(name, type, year);
|
|
|
|
|
|
- if (null != project) {
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- flag = false;
|
|
|
- } else {
|
|
|
- if (project.getId() != (Integer.parseInt(id))) {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("检验项目名称是否存在结果! flag = {}", flag);
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ if (null != project) {
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ flag = false;
|
|
|
+ } else {
|
|
|
+ if (project.getId() != (Integer.parseInt(id))) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("检验项目名称是否存在结果! flag = {}", flag);
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取相应类型的项目
|
|
|
*/
|
|
|
- @ResponseBody
|
|
|
+ @ResponseBody
|
|
|
@GetMapping(value = "/getProjectByType")
|
|
|
- public ResponseMessage getProjectByType(ModelMap modelMap,String type) {
|
|
|
- List<Project> projects = projectService.findByType(type);
|
|
|
- return ResponseMessage.success("查询成功",projects);
|
|
|
+ public ResponseMessage getProjectByType(@Param("type") String type, @Param("isApplication") String isApplication) {
|
|
|
+
|
|
|
+ List<Project> projects = projectService.findByType(type, isApplication);
|
|
|
+ return ResponseMessage.success("查询成功", projects);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取相应类型的项目
|
|
|
*/
|
|
|
- @ResponseBody
|
|
|
+ @ResponseBody
|
|
|
@GetMapping(value = "/getProjectMaterials")
|
|
|
- public ResponseMessage getProjectMaterials(ModelMap modelMap,Integer id) {
|
|
|
- List<ProjectMaterial> materials = projectMaterialService.findProjectMaterialByType(id);
|
|
|
- modelMap.put("applyMaterials", materials);
|
|
|
- return ResponseMessage.success("查询成功",modelMap);
|
|
|
+ public ResponseMessage getProjectMaterials(ModelMap modelMap, Integer id) {
|
|
|
+ List<ProjectMaterial> materials = projectMaterialService.findProjectMaterialByType(id);
|
|
|
+ modelMap.put("applyMaterials", materials);
|
|
|
+ return ResponseMessage.success("查询成功", modelMap);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 项目类别列表页
|
|
|
- * @param pageNum
|
|
|
- * @param keyword
|
|
|
- * @param modelMap
|
|
|
- * @return
|
|
|
- */
|
|
|
- @RequestMapping("/type/list")
|
|
|
- public String typeList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
- String keyword , ModelMap modelMap){
|
|
|
-
|
|
|
- PageInfo<ProjectType> pageInfo = projectTypeService.findPage(pageNum,PAGESIZE,keyword);
|
|
|
-
|
|
|
- modelMap.put("keyword",keyword);
|
|
|
- modelMap.put("pageInfo",pageInfo);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目类别列表页
|
|
|
+ *
|
|
|
+ * @param pageNum
|
|
|
+ * @param keyword
|
|
|
+ * @param modelMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/type/list")
|
|
|
+ public String typeList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ String keyword, ModelMap modelMap) {
|
|
|
+
|
|
|
+ PageInfo<ProjectType> pageInfo = projectTypeService.findPage(pageNum, PAGESIZE, keyword);
|
|
|
+
|
|
|
+ modelMap.put("keyword", keyword);
|
|
|
+ modelMap.put("pageInfo", pageInfo);
|
|
|
return BASE_GOVERNMENT_PATH + "project/type_list";
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
+
|
|
|
+ /**
|
|
|
* 跳转到项目类别添加页面
|
|
|
*/
|
|
|
@GetMapping(value = "type/add")
|
|
|
@@ -219,7 +222,7 @@ public class ProjectController extends BaseController{
|
|
|
modelMap.put("projectSuperTypeList", projectSuperTypeList);
|
|
|
return BASE_GOVERNMENT_PATH + "project/project_type_add";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 添加/编辑项目
|
|
|
*/
|
|
|
@@ -227,15 +230,15 @@ public class ProjectController extends BaseController{
|
|
|
@ResponseBody
|
|
|
@PostMapping(value = "type/save")
|
|
|
public ResponseMessage saveType(ProjectType projectType) throws Exception {
|
|
|
- if(IsTooFrequently()) {
|
|
|
- return ResponseMessage.error("操作过于频繁,请稍后再试!");
|
|
|
- }
|
|
|
- Boolean flag = true ;
|
|
|
- if(null != projectType.getId()) {
|
|
|
- projectTypeService.updateType(projectType);
|
|
|
- }else {
|
|
|
- projectTypeService.saveType(projectType);
|
|
|
- }
|
|
|
+ if (IsTooFrequently()) {
|
|
|
+ return ResponseMessage.error("操作过于频繁,请稍后再试!");
|
|
|
+ }
|
|
|
+ Boolean flag = true;
|
|
|
+ if (null != projectType.getId()) {
|
|
|
+ projectTypeService.updateType(projectType);
|
|
|
+ } else {
|
|
|
+ projectTypeService.saveType(projectType);
|
|
|
+ }
|
|
|
if (flag) {
|
|
|
return ResponseMessage.success("保存成功!");
|
|
|
}
|
|
|
@@ -255,7 +258,7 @@ public class ProjectController extends BaseController{
|
|
|
modelMap.put("projectSuperTypeList", projectSuperTypeList);
|
|
|
return BASE_GOVERNMENT_PATH + "project/project_type_edit";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 删除项目
|
|
|
*/
|
|
|
@@ -265,47 +268,47 @@ public class ProjectController extends BaseController{
|
|
|
public ResponseMessage deleteType(@PathVariable("id") Integer id) throws Exception {
|
|
|
|
|
|
try {
|
|
|
- projectTypeService.deleteProjectType(id);
|
|
|
- return ResponseMessage.success("删除成功!");
|
|
|
- }catch(BaseException e) {
|
|
|
- return ResponseMessage.success(e.getMessage());
|
|
|
- }catch(Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ projectTypeService.deleteProjectType(id);
|
|
|
+ return ResponseMessage.success("删除成功!");
|
|
|
+ } catch (BaseException e) {
|
|
|
+ return ResponseMessage.success(e.getMessage());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
return ResponseMessage.error("删除失败!");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检验项目类型是否存在
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping(value = "/isExistProjectTypeName")
|
|
|
+ public Boolean isExistProjectTypeName(String id, String name, String type, Integer project_year) throws Exception {
|
|
|
+ boolean flag = true;
|
|
|
+ log.debug("检验项目类型是否存在参数! id= {}, name= {}", id, name, type);
|
|
|
+ ProjectType projectType = projectTypeService.findProjectTypeByName(name, type, project_year);
|
|
|
+
|
|
|
+ if (null != projectType) {
|
|
|
+ if (StringUtils.isBlank(id)) {
|
|
|
+ flag = false;
|
|
|
+ } else {
|
|
|
+ if (projectType.getId() != (Integer.parseInt(id))) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("检验项目名称是否存在结果! flag = {}", flag);
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * 检验项目类型是否存在
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
- @GetMapping(value = "/isExistProjectTypeName")
|
|
|
- public Boolean isExistProjectTypeName(String id, String name ,String type, Integer project_year) throws Exception {
|
|
|
- boolean flag = true;
|
|
|
- log.debug("检验项目类型是否存在参数! id= {}, name= {}", id, name,type);
|
|
|
- ProjectType projectType= projectTypeService.findProjectTypeByName(name,type, project_year);
|
|
|
-
|
|
|
- if (null != projectType) {
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
- flag = false;
|
|
|
- } else {
|
|
|
- if (projectType.getId() != (Integer.parseInt(id))) {
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("检验项目名称是否存在结果! flag = {}", flag);
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 获取相应大类的项目类型
|
|
|
*/
|
|
|
- @ResponseBody
|
|
|
+ @ResponseBody
|
|
|
@GetMapping(value = "/getProjectTypeBySuper")
|
|
|
public ResponseMessage getProjectTypeBySuper(ModelMap modelMap, String superType) {
|
|
|
List<ProjectType> projectTypes = projectTypeService.findBySuperType(superType);
|
|
|
- return ResponseMessage.success("查询成功",projectTypes);
|
|
|
+ return ResponseMessage.success("查询成功", projectTypes);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|