|
@@ -1,9 +1,13 @@
|
|
|
package com.jeesite.modules.report.web;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
+import com.jeesite.common.collect.ListUtils;
|
|
|
+import com.jeesite.common.collect.MapUtils;
|
|
|
+import com.jeesite.common.config.Global;
|
|
|
+import com.jeesite.common.entity.Page;
|
|
|
+import com.jeesite.common.web.BaseController;
|
|
|
+import com.jeesite.modules.report.entity.ResearchBriefReportLabel;
|
|
|
+import com.jeesite.modules.report.service.ResearchBriefReportLabelService;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -14,11 +18,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
-import com.jeesite.common.config.Global;
|
|
|
-import com.jeesite.common.entity.Page;
|
|
|
-import com.jeesite.common.web.BaseController;
|
|
|
-import com.jeesite.modules.report.entity.ResearchBriefReportLabel;
|
|
|
-import com.jeesite.modules.report.service.ResearchBriefReportLabelService;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 简报分类Controller
|
|
@@ -53,7 +56,7 @@ public class ResearchBriefReportLabelController extends BaseController {
|
|
|
/**
|
|
|
* 查询列表数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReportLabel:view")
|
|
|
+// @RequiresPermissions("report:researchBriefReportLabel:view")
|
|
|
@RequestMapping(value = "listData")
|
|
|
@ResponseBody
|
|
|
public Page<ResearchBriefReportLabel> listData(ResearchBriefReportLabel researchBriefReportLabel, HttpServletRequest request, HttpServletResponse response) {
|
|
@@ -62,10 +65,33 @@ public class ResearchBriefReportLabelController extends BaseController {
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ // @RequiresPermissions("report:researchBriefReportLabel:view")
|
|
|
+ @RequestMapping(value = "treeData")
|
|
|
+ @ResponseBody
|
|
|
+ public List<Map<String, Object>> treeData() {
|
|
|
+ List<Map<String, Object>> mapList = ListUtils.newArrayList();
|
|
|
+ ResearchBriefReportLabel where = new ResearchBriefReportLabel();
|
|
|
+ where.setStatus(ResearchBriefReportLabel.STATUS_NORMAL);
|
|
|
+ List<ResearchBriefReportLabel> list = researchBriefReportLabelService.findList(where);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ ResearchBriefReportLabel e = list.get(i);
|
|
|
+ Map<String, Object> map = MapUtils.newHashMap();
|
|
|
+ map.put("id", e.getId());
|
|
|
+ map.put("pId", e.getParentId());
|
|
|
+ map.put("name", e.getName());
|
|
|
+ map.put("title", e.getName());
|
|
|
+ map.put("levelNum", e.getLevelNum());
|
|
|
+ map.put("sortNum", e.getSortNum());
|
|
|
+ map.put("isParent", list.stream().filter(r -> r.getParentId().contains(e.getId())).count() > 0);
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查看编辑表单
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReportLabel:view")
|
|
|
+// @RequiresPermissions("report:researchBriefReportLabel:view")
|
|
|
@RequestMapping(value = "form")
|
|
|
public String form(ResearchBriefReportLabel researchBriefReportLabel, Model model) {
|
|
|
model.addAttribute("researchBriefReportLabel", researchBriefReportLabel);
|
|
@@ -75,10 +101,25 @@ public class ResearchBriefReportLabelController extends BaseController {
|
|
|
/**
|
|
|
* 保存数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReportLabel:edit")
|
|
|
+// @RequiresPermissions("report:researchBriefReportLabel:edit")
|
|
|
@PostMapping(value = "save")
|
|
|
@ResponseBody
|
|
|
public String save(@Validated ResearchBriefReportLabel researchBriefReportLabel) {
|
|
|
+ //判断名称是否重复
|
|
|
+ ResearchBriefReportLabel where = new ResearchBriefReportLabel();
|
|
|
+ where.setName(researchBriefReportLabel.getName());
|
|
|
+ where.setLevelNum(researchBriefReportLabel.getLevelNum());
|
|
|
+ List<ResearchBriefReportLabel> labelList = researchBriefReportLabelService.findNameAndLevel(where);
|
|
|
+ if (CollectionUtils.isNotEmpty(labelList)) {
|
|
|
+ return renderResult(Global.FALSE, text("简报分类本层级名称已存在!"));
|
|
|
+ }
|
|
|
+ where = new ResearchBriefReportLabel();
|
|
|
+ where.setSortNum(researchBriefReportLabel.getSortNum());
|
|
|
+ where.setLevelNum(researchBriefReportLabel.getLevelNum());
|
|
|
+ labelList = researchBriefReportLabelService.findNameAndLevel(where);
|
|
|
+ if (CollectionUtils.isNotEmpty(labelList)) {
|
|
|
+ return renderResult(Global.FALSE, text("简报分类本层级排序值已存在!"));
|
|
|
+ }
|
|
|
researchBriefReportLabelService.save(researchBriefReportLabel);
|
|
|
return renderResult(Global.TRUE, text("保存简报分类成功!"));
|
|
|
}
|
|
@@ -86,7 +127,7 @@ public class ResearchBriefReportLabelController extends BaseController {
|
|
|
/**
|
|
|
* 删除数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReportLabel:edit")
|
|
|
+// @RequiresPermissions("report:researchBriefReportLabel:edit")
|
|
|
@RequestMapping(value = "delete")
|
|
|
@ResponseBody
|
|
|
public String delete(ResearchBriefReportLabel researchBriefReportLabel) {
|