|
|
@@ -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.config.Global;
|
|
|
+import com.jeesite.common.entity.Page;
|
|
|
+import com.jeesite.common.lang.StringUtils;
|
|
|
+import com.jeesite.common.web.BaseController;
|
|
|
+import com.jeesite.modules.report.entity.ResearchBriefReport;
|
|
|
+import com.jeesite.modules.report.entity.ResearchBriefReportLabel;
|
|
|
+import com.jeesite.modules.report.service.ResearchBriefReportLabelService;
|
|
|
+import com.jeesite.modules.report.service.ResearchBriefReportService;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@@ -14,11 +18,8 @@ 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.ResearchBriefReport;
|
|
|
-import com.jeesite.modules.report.service.ResearchBriefReportService;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
/**
|
|
|
* 简报智库Controller
|
|
|
@@ -31,6 +32,8 @@ public class ResearchBriefReportController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ResearchBriefReportService researchBriefReportService;
|
|
|
+ @Autowired
|
|
|
+ private ResearchBriefReportLabelService researchBriefReportLabelService;
|
|
|
|
|
|
/**
|
|
|
* 获取数据
|
|
|
@@ -53,7 +56,7 @@ public class ResearchBriefReportController extends BaseController {
|
|
|
/**
|
|
|
* 查询列表数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReport:view")
|
|
|
+// @RequiresPermissions("report:researchBriefReport:view")
|
|
|
@RequestMapping(value = "listData")
|
|
|
@ResponseBody
|
|
|
public Page<ResearchBriefReport> listData(ResearchBriefReport researchBriefReport, HttpServletRequest request, HttpServletResponse response) {
|
|
|
@@ -65,7 +68,7 @@ public class ResearchBriefReportController extends BaseController {
|
|
|
/**
|
|
|
* 查看编辑表单
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReport:view")
|
|
|
+// @RequiresPermissions("report:researchBriefReport:view")
|
|
|
@RequestMapping(value = "form")
|
|
|
public String form(ResearchBriefReport researchBriefReport, Model model) {
|
|
|
model.addAttribute("researchBriefReport", researchBriefReport);
|
|
|
@@ -75,10 +78,27 @@ public class ResearchBriefReportController extends BaseController {
|
|
|
/**
|
|
|
* 保存数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReport:edit")
|
|
|
+// @RequiresPermissions("report:researchBriefReport:edit")
|
|
|
@PostMapping(value = "save")
|
|
|
@ResponseBody
|
|
|
public String save(@Validated ResearchBriefReport researchBriefReport) {
|
|
|
+ if (StringUtils.isEmpty(researchBriefReport.getTopLabelId())) {
|
|
|
+ return renderResult(Global.FALSE, text("一级标签为空!"));
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(researchBriefReport.getSecondLabelId())) {
|
|
|
+ return renderResult(Global.FALSE, text("二级标签为空!"));
|
|
|
+ }
|
|
|
+ ResearchBriefReportLabel researchBriefReportLabel = researchBriefReportLabelService.get(researchBriefReport.getTopLabelId());
|
|
|
+ if (researchBriefReportLabel == null) {
|
|
|
+ return renderResult(Global.FALSE, text("一级标签不存在!"));
|
|
|
+ }
|
|
|
+ ResearchBriefReportLabel researchBriefReportLabelTwo = researchBriefReportLabelService.get(researchBriefReport.getSecondLabelId());
|
|
|
+ if (researchBriefReportLabelTwo == null) {
|
|
|
+ return renderResult(Global.FALSE, text("二级标签不存在!"));
|
|
|
+ }
|
|
|
+ if (!researchBriefReportLabelTwo.getParentId().contains(researchBriefReportLabel.getId())) {
|
|
|
+ return renderResult(Global.FALSE, text("二级标签不属于一级标签下!"));
|
|
|
+ }
|
|
|
researchBriefReportService.save(researchBriefReport);
|
|
|
return renderResult(Global.TRUE, text("保存简报智库成功!"));
|
|
|
}
|
|
|
@@ -86,7 +106,7 @@ public class ResearchBriefReportController extends BaseController {
|
|
|
/**
|
|
|
* 删除数据
|
|
|
*/
|
|
|
- @RequiresPermissions("report:researchBriefReport:edit")
|
|
|
+// @RequiresPermissions("report:researchBriefReport:edit")
|
|
|
@RequestMapping(value = "delete")
|
|
|
@ResponseBody
|
|
|
public String delete(ResearchBriefReport researchBriefReport) {
|