style: 按照CodeReview调整代码格式

This commit is contained in:
2023-09-18 09:50:40 +08:00
parent e45518aefd
commit b83f8d8fd9
12 changed files with 226 additions and 308 deletions
@@ -37,9 +37,13 @@ public class ResultCommon {
public static final String JOB_NUMBER_DOES_NOT_EXIST_EXPORT = "job.number.does.not.exist.export"; // 第{0}行,工号不存在
public static final String DUPLICATE_JOB_NUMBER_EXPORT = "duplicate.job.number.export"; // 第{0}行,工号重复
public static final String NO_CORRESPONDING_RECORD_FOUND = "no.corresponding.record.found"; // 没有找到对应的记录
public static final String PARAMETERS_CANNOT_BE_NULL = "parameters.cannot.be.null"; // 参数不能为空
public static final String ROOT_NODE_CANNOT_BE_EDITED = "root.node.cannot.be.edited"; // 根节点不能编辑
public static final String HORIZONTAL_TRANSGRESSION = "horizontal.transgression"; // 水平越权
}
@@ -13,6 +13,7 @@ import com.jero.modules.laws.enterprise.service.EnterpriseStandardDeclareService
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -38,6 +39,7 @@ public class EnterpriseStandardDeclareController extends JeroController<Enterpri
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:publicize:search")
@AutoLog(value = "企标宣贯-分页列表查询")
@ApiOperation(value="企标宣贯-分页列表查询", notes="企标宣贯-分页列表查询")
@GetMapping(value = "/page")
@@ -45,6 +47,6 @@ public class EnterpriseStandardDeclareController extends JeroController<Enterpri
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardDeclareVo> pageList= esDeclareService.queryPageList(esDeclare, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
return Result.OK(pageList);
}
}
@@ -19,6 +19,7 @@ import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectService
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -56,6 +57,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:check:search")
@AutoLog(value = "企标稽查-分页列表查询")
@ApiOperation(value="企标稽查-分页列表查询", notes="企标稽查-分页列表查询")
@GetMapping(value = "/page")
@@ -63,7 +65,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardInspectVo> pageList = esInspectService.queryPageList(esInspect, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
return Result.OK(pageList);
}
/**
@@ -71,12 +73,13 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:check:deferredCheck")
@AutoLog(value = "企标稽查-延期稽查")
@ApiOperation(value="企标稽查-延期稽查", notes="企标稽查-延期稽查")
@GetMapping(value = "/delayInspect")
public Result<?> delayInspect(@RequestParam("id") String inspectId) {
EnterpriseStandardInspectDelay esInspectDelay = esInspectDelayService.getLastDelayInspect(inspectId);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), esInspectDelay);
return Result.OK(esInspectDelay);
}
/**
@@ -84,6 +87,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:check:checkReport")
@AutoLog(value = "企标稽查-稽查报告")
@ApiOperation(value="企标稽查-稽查报告", notes="企标稽查-稽查报告")
@GetMapping(value = "/inspectReport")
@@ -91,7 +95,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardInspectReport> pageList = esInspectReportService.getInspectReport(inspectId, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
return Result.OK(pageList);
}
/**
@@ -99,6 +103,7 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:check:rectificationPlan")
@AutoLog(value = "企标稽查-整改计划")
@ApiOperation(value="企标稽查-整改计划", notes="企标稽查-整改计划")
@GetMapping(value = "/rectifyPlan")
@@ -106,6 +111,6 @@ public class EnterpriseStandardInspectController extends JeroController<Enterpri
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardInspectRectifyPlan> pageList = esInspectRectifyPlanService.getRectifyPlan(inspectId, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
return Result.OK(pageList);
}
}
@@ -3,7 +3,10 @@ package com.jero.modules.laws.enterprise.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
import com.jero.modules.laws.enterprise.entity.dto.ESPlanQueryDTO;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardPlanVo;
@@ -13,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -37,6 +41,7 @@ public class EnterpriseStandardPlanController extends JeroController<EnterpriseS
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:plan:search")
@AutoLog(value = "企标计划-分页列表查询")
@ApiOperation(value="企标计划-分页列表查询", notes="企标计划-分页列表查询")
@GetMapping(value = "/page")
@@ -52,6 +57,7 @@ public class EnterpriseStandardPlanController extends JeroController<EnterpriseS
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:plan:detail")
@AutoLog(value = "企标计划-企标详情")
@ApiOperation(value="企标计划-企标详情", notes="企标计划-企标详情")
@GetMapping(value = "/detail")
@@ -66,19 +72,20 @@ public class EnterpriseStandardPlanController extends JeroController<EnterpriseS
* @param
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:plan:delete")
@AutoLog(value = "企标计划-通过id删除")
@ApiOperation(value = "企标计划-通过id删除", notes = "企标计划-通过id删除")
@PostMapping(value = "/delete")
public Result<T> deleteEN(String id) {
if (StringUtils.isBlank(id)) {
return Result.error("参数不识别!");
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.PARAMETERS_CANNOT_BE_NULL));
}
EnterpriseStandardPlan esPlan = esPlanService.getById(id);
if (esPlan == null) {
return Result.error("未找到对应实体");
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.NO_CORRESPONDING_RECORD_FOUND));
} else {
esPlanService.deleteById(id);
}
return Result.OK();
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
}
@@ -13,6 +13,7 @@ import com.jero.modules.laws.enterprise.service.EnterpriseStandardRecheckPlanSer
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -41,6 +42,7 @@ public class EnterpriseStandardRecheckPlanController extends JeroController<Ente
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary.recheckPlan.search")
@AutoLog(value = "企标复审计划-分页列表查询")
@ApiOperation(value="企标复审计划-分页列表查询", notes="企标复审计划-分页列表查询")
@GetMapping(value = "/page")
@@ -48,6 +50,6 @@ public class EnterpriseStandardRecheckPlanController extends JeroController<Ente
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardRecheckPlanVo> pageList= recheckPlanService.queryPageList(esDeclare, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
return Result.OK(pageList);
}
}
@@ -3,6 +3,7 @@ package com.jero.modules.laws.enterprise.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon;
@@ -14,6 +15,7 @@ import com.jero.modules.laws.enterprise.service.EnterpriseStandardReviewMeetingR
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -25,60 +27,63 @@ import java.util.Map;
/**
* @Description: 企标宣贯
* @Author: jero-boot
* @Date: 2022-02-12
* @Date: 2022-02-12
* @Version: V1.0
*/
@Api(tags="企标评审会")
@Api(tags = "企标评审会")
@RestController
@RequestMapping("/enterprise/reviewMeeting")
@Slf4j
public class EnterpriseStandardReviewMeetingController extends JeroController<EnterpriseStandardReviewMeetingRecord, EnterpriseStandardReviewMeetingRecordService> {
@Resource
private EnterpriseStandardReviewMeetingRecordService esReviewMeetingService;
@Resource
private EnterpriseStandardReviewMeetingRecordService esReviewMeetingService;
/**
* 分页列表查询
*
* @return
*/
@AutoLog(value = "企标评审会-分页列表查询")
@ApiOperation(value="企标评审会-分页列表查询", notes="企标评审会-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(ESQueryCommonDTO esReviewMeeting,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
IPage<EnterpriseStandardReviewMeetingVo> pageList = esReviewMeetingService.queryPageList(esReviewMeeting, pageNo, pageSize);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), pageList);
}
/**
* 分页列表查询
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:reviewMeeting:search")
@AutoLog(value = "企标评审会-分页列表查询")
@ApiOperation(value = "企标评审会-分页列表查询", notes = "企标评审会-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(ESQueryCommonDTO esReviewMeeting,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
IPage<EnterpriseStandardReviewMeetingVo> pageList = esReviewMeetingService.queryPageList(esReviewMeeting, pageNo, pageSize);
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @return
*/
@AutoLog(value = "企标评审会-评分详情")
@ApiOperation(value="企标评审会-评分详情", notes="企标评审会-评分详情")
@GetMapping(value = "/evaluateDetail/{id}")
public Result<?> evaluateDetail(@PathVariable("id") String id) {
Map<String, List<EnterpriseStandardRmrEvaluateDetail>> resultMap = esReviewMeetingService.evaluateDetail(id);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), resultMap);
}
/**
* 评分详情
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:reviewMeeting:reviewDetail")
@AutoLog(value = "企标评审会-评分详情")
@ApiOperation(value = "企标评审会-评分详情", notes = "企标评审会-评分详情")
@GetMapping(value = "/evaluateDetail/{id}")
public Result<?> evaluateDetail(@PathVariable("id") String id) {
Map<String, List<EnterpriseStandardRmrEvaluateDetail>> resultMap = esReviewMeetingService.evaluateDetail(id);
return Result.OK(resultMap);
}
/**
* 分页列表查询
*
* @return
*/
@AutoLog(value = "企标评审会-设置优质标准")
@ApiOperation(value="企标评审会-设置优质标准", notes="企标评审会-设置优质标准")
@GetMapping(value = "/setQualityStandards")
public Result<?> setQualityStandards(@RequestParam String standardNos) {
List<String> standardNoList = Arrays.asList(standardNos.split(","));
if (standardNoList.size() > 10) {
return Result.error(MessageUtils.getMessage(ResultCommon.RMR_SET_QUALITY_OVER_TEN));
}
esReviewMeetingService.setQualityStandards(standardNoList);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
* 设置优质标准
*
* @return
*/
@RequiresPermissions("enterpriseStandardLibrary:reviewMeeting:setQualityStandard")
@AutoLog(value = "企标评审会-设置优质标准")
@ApiOperation(value = "企标评审会-设置优质标准", notes = "企标评审会-设置优质标准")
@GetMapping(value = "/setQualityStandards")
public Result<?> setQualityStandards(@RequestParam String standardNos) {
List<String> standardNoList = Arrays.asList(standardNos.split(","));
if (standardNoList.size() > 10) {
throw new JeroBootException(MessageUtils.getMessage(ResultCommon.RMR_SET_QUALITY_OVER_TEN));
}
esReviewMeetingService.setQualityStandards(standardNoList);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
}
@@ -4,13 +4,18 @@ import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.jero.common.api.vo.Result;
import com.jero.common.system.util.JwtUtil;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.MessageUtils;
import com.jero.modules.laws.common.constant.ResultCommon;
import com.jero.modules.laws.enterprise.entity.vo.LawsTreeNodeModel;
import com.jero.modules.laws.standard.entity.LawsTreeNode;
import com.jero.modules.laws.standard.service.ILawsTreeNodeService;
import com.jero.modules.tag.enums.TableNameEnum;
import lombok.extern.slf4j.Slf4j;
import com.jero.common.system.base.controller.JeroController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
@@ -37,285 +42,165 @@ public class LawsTreeNodeController extends JeroController<LawsTreeNode, ILawsTr
@Resource
private ILawsTreeNodeService lawsTreeNodeService;
@RequiresPermissions("enterpriseStandard:tree:search")
@AutoLog(value = "企业标准-体系树")
@ApiOperation(value = "企业标准-体系树", notes = "企业标准-体系树")
@GetMapping("/enterprise")
public Result<List<LawsTreeNodeModel>> queryENTreeList(@RequestParam(required = false) String nodeName,
@RequestParam(required = false) String option) {
String moduleCode = "EN";
Result<List<LawsTreeNodeModel>> result = new Result<>();
try {
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
result.setResult(list);
result.setSuccess(true);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
/**
* 添加
*
* @param lawsTreeNode
* @return
*/
@AutoLog(value = "企业标准-添加")
@ApiOperation(value = "企业标准-添加", notes = "企业标准-添加")
@PostMapping(value = "/enterprise/add")
public Result<T> addEN(@RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
try {
String moduleCode = "EN";
lawsTreeNode.setModuleCode(moduleCode);
lawsTreeNode.setCreateBy(username);
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode, username);
return Result.OK("操作成功!");
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("操作失败");
}
}
/**
* 编辑
*
* @param lawsTreeNode
* @return
*/
@AutoLog(value = "企业标准-编辑")
@ApiOperation(value = "企业标准-编辑", notes = "企业标准-编辑")
@PostMapping(value = "/enterprise/edit")
public Result<T> editEN(@Validated @RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
lawsTreeNode.setUpdateBy(username);
LawsTreeNode lawsTreeNodeEntity = lawsTreeNodeService.getById(lawsTreeNode.getId());
if (lawsTreeNodeEntity == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNodeEntity.getNodeType()) {
return Result.error("根节点无法编辑");
} else {
boolean ok = lawsTreeNodeService.updateTreeNodeDataById(lawsTreeNode, username);
if (ok) {
return Result.OK("操作成功!");
}
}
return Result.OK();
}
/**
* 通过id删除
*
* @param map
* @return
*/
@AutoLog(value = "企业标准-通过id删除")
@ApiOperation(value = "企业标准-通过id删除", notes = "企业标准-通过id删除")
@PostMapping(value = "/enterprise/delete")
public Result<T> deleteEN(@RequestBody Map<String, String> map) {
String id = map.get("id");
if (StringUtils.isBlank(id)) {
return Result.error("参数不识别!");
}
LawsTreeNode lawsTreeNode = lawsTreeNodeService.getById(id);
if (lawsTreeNode == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNode.getNodeType()) {
return Result.error("根节点无法删除");
} else {
boolean ok = lawsTreeNodeService.delete(id, lawsTreeNode.getNodeCode());
if (ok) {
return Result.OK("删除成功!");
}
}
return Result.OK();
String moduleCode = TableNameEnum.ENTERPRISE_STANDARDS.getValue();
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
return Result.OK(list);
}
@RequiresPermissions("domesticStandard:tree:search")
@AutoLog(value = "国内标准-体系树")
@ApiOperation(value = "国内标准-体系树", notes = "国内标准-体系树")
@GetMapping("/domestic")
public Result<List<LawsTreeNodeModel>> queryGBTreeList(@RequestParam(required = false) String nodeName,
@RequestParam(required = false) String option) {
String moduleCode = "GB";
Result<List<LawsTreeNodeModel>> result = new Result<>();
try {
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
result.setResult(list);
result.setSuccess(true);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
/**
* 添加
*
* @param lawsTreeNode
* @return
*/
@AutoLog(value = "国内标准-添加")
@ApiOperation(value = "国内标准-添加", notes = "国内标准-添加")
@PostMapping(value = "/domestic/add")
public Result<T> addGB(@RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
try {
String moduleCode = "GB";
lawsTreeNode.setModuleCode(moduleCode);
lawsTreeNode.setCreateBy(username);
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode, username);
return Result.OK("操作成功!");
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("操作失败");
}
}
/**
* 编辑
*
* @param lawsTreeNode
* @return
*/
@AutoLog(value = "国内标准-编辑")
@ApiOperation(value = "国内标准-编辑", notes = "国内标准-编辑")
@PostMapping(value = "/domestic/edit")
public Result<T> editGB(@Validated @RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
lawsTreeNode.setUpdateBy(username);
LawsTreeNode lawsTreeNodeEntity = lawsTreeNodeService.getById(lawsTreeNode.getId());
if (lawsTreeNodeEntity == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNodeEntity.getNodeType()) {
return Result.error("根节点无法编辑");
} else {
boolean ok = lawsTreeNodeService.updateTreeNodeDataById(lawsTreeNode, username);
if (ok) {
return Result.OK("操作成功!");
}
}
return Result.OK();
}
/**
* 通过id删除
*
* @param map
* @return
*/
@AutoLog(value = "国内标准-通过id删除")
@ApiOperation(value = "国内标准-通过id删除", notes = "国内标准-通过id删除")
@PostMapping(value = "/domestic/delete")
public Result<T> deleteGB(@RequestBody Map<String, String> map) {
String id = map.get("id");
if (StringUtils.isBlank(id)) {
return Result.error("参数不识别!");
}
LawsTreeNode lawsTreeNode = lawsTreeNodeService.getById(id);
if (lawsTreeNode == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNode.getNodeType()) {
return Result.error("根节点无法删除");
} else {
boolean ok = lawsTreeNodeService.delete(id, lawsTreeNode.getNodeCode());
if (ok) {
return Result.OK("删除成功!");
}
}
return Result.OK();
String moduleCode = TableNameEnum.DOMESTIC_REGULATIONS.getValue();
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
return Result.OK(list);
}
@RequiresPermissions("overseasStandard:tree:search")
@AutoLog(value = "海外标准-体系树")
@ApiOperation(value = "海外标准-体系树", notes = "海外标准-体系树")
@GetMapping("/overseas")
public Result<List<LawsTreeNodeModel>> queryFBTreeList(@RequestParam(required = false) String nodeName,
@RequestParam(required = false) String option) {
String moduleCode = "FB";
Result<List<LawsTreeNodeModel>> result = new Result<>();
try {
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
result.setResult(list);
result.setSuccess(true);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
String moduleCode = TableNameEnum.FOREIGN_REGULATIONS.getValue();
List<LawsTreeNodeModel> list = lawsTreeNodeService.queryTreeNodeList(moduleCode, nodeName, option);
return Result.OK(list);
}
/**
* 添加
*
* @param lawsTreeNode
* @return
*/
@RequiresPermissions("enterpriseStandard:tree:add")
@AutoLog(value = "企业标准-添加")
@ApiOperation(value = "企业标准-添加", notes = "企业标准-添加")
@PostMapping(value = "/enterprise/add")
public Result<T> addEN(@RequestBody LawsTreeNode lawsTreeNode) {
lawsTreeNode.setModuleCode(TableNameEnum.ENTERPRISE_STANDARDS.getValue());
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@RequiresPermissions("domesticStandard:tree:add")
@AutoLog(value = "国内标准-添加")
@ApiOperation(value = "国内标准-添加", notes = "国内标准-添加")
@PostMapping(value = "/domestic/add")
public Result<T> addGB(@RequestBody LawsTreeNode lawsTreeNode) {
lawsTreeNode.setModuleCode(TableNameEnum.DOMESTIC_REGULATIONS.getValue());
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@RequiresPermissions("overseasStandard:tree:add")
@AutoLog(value = "海外标准-添加")
@ApiOperation(value = "海外标准-添加", notes = "海外标准-添加")
@PostMapping(value = "/overseas/add")
public Result<T> addFB(@RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
try {
String moduleCode = "FB";
lawsTreeNode.setModuleCode(moduleCode);
lawsTreeNode.setCreateBy(username);
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode, username);
return Result.OK("操作成功!");
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error("操作失败");
}
public Result<T> addFB(@RequestBody LawsTreeNode lawsTreeNode) {
lawsTreeNode.setModuleCode(TableNameEnum.FOREIGN_REGULATIONS.getValue());
lawsTreeNodeService.saveTreeNodeData(lawsTreeNode);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
* 编辑
*
* @param lawsTreeNode
* @return
* 通用编辑方法
* @param lawsTreeNode 实体
* @param moduleCode 所属模块
* @return 结果
*/
private Result<T> commonEdit(LawsTreeNode lawsTreeNode, String moduleCode) {
LawsTreeNode lawsTreeNodeEntity = lawsTreeNodeService.getById(lawsTreeNode.getId());
if (lawsTreeNodeEntity == null) {
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_RECORD_FOUND);
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNodeEntity.getNodeType()) {
throw new JeroBootException(ResultCommon.ROOT_NODE_CANNOT_BE_EDITED);
} else if (!moduleCode.equals(lawsTreeNodeEntity.getModuleCode())) {
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
} else {
boolean ok = lawsTreeNodeService.updateTreeNodeDataById(lawsTreeNode);
if (ok) {
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
}
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@RequiresPermissions("enterpriseStandard:tree:edit")
@AutoLog(value = "企业标准-编辑")
@ApiOperation(value = "企业标准-编辑", notes = "企业标准-编辑")
@PostMapping(value = "/enterprise/edit")
public Result<T> editEN(@Validated @RequestBody LawsTreeNode lawsTreeNode) {
return this.commonEdit(lawsTreeNode, TableNameEnum.ENTERPRISE_STANDARDS.getValue());
}
@RequiresPermissions("domesticStandard:tree:edit")
@AutoLog(value = "国内标准-编辑")
@ApiOperation(value = "国内标准-编辑", notes = "国内标准-编辑")
@PostMapping(value = "/domestic/edit")
public Result<T> editGB(@Validated @RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
return this.commonEdit(lawsTreeNode, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
}
@RequiresPermissions("overseasStandard:tree:edit")
@AutoLog(value = "海外标准-编辑")
@ApiOperation(value = "海外标准-编辑", notes = "海外标准-编辑")
@PostMapping(value = "/overseas/edit")
public Result<T> editFB(@Validated @RequestBody LawsTreeNode lawsTreeNode, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request);
lawsTreeNode.setUpdateBy(username);
LawsTreeNode lawsTreeNodeEntity = lawsTreeNodeService.getById(lawsTreeNode.getId());
if (lawsTreeNodeEntity == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNodeEntity.getNodeType()) {
return Result.error("根节点无法编辑");
} else {
boolean ok = lawsTreeNodeService.updateTreeNodeDataById(lawsTreeNode, username);
if (ok) {
return Result.OK("操作成功!");
}
}
return Result.OK();
return this.commonEdit(lawsTreeNode, TableNameEnum.FOREIGN_REGULATIONS.getValue());
}
/**
* 通过id删除
*
* @param map
* @return
* 通用删除方法
* @param map 参数Map
* @param moduleCode 所属模块
* @return 结果
*/
private Result<T> commonDelete(Map<String, String> map, String moduleCode) {
String id = map.get("id");
if (StringUtils.isBlank(id)) {
throw new JeroBootException(ResultCommon.PARAMETERS_CANNOT_BE_NULL);
}
LawsTreeNode lawsTreeNode = lawsTreeNodeService.getById(id);
if (lawsTreeNode == null) {
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_RECORD_FOUND);
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNode.getNodeType()) {
throw new JeroBootException(ResultCommon.ROOT_NODE_CANNOT_BE_EDITED);
} else if (!moduleCode.equals(lawsTreeNode.getModuleCode())) {
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
} else {
boolean ok = lawsTreeNodeService.delete(id, lawsTreeNode.getNodeCode());
if (ok) {
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
}
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@RequiresPermissions("enterpriseStandard:tree:delete")
@AutoLog(value = "企业标准-通过id删除")
@ApiOperation(value = "企业标准-通过id删除", notes = "企业标准-通过id删除")
@PostMapping(value = "/enterprise/delete")
public Result<T> deleteEN(@RequestBody Map<String, String> map) {
return this.commonDelete(map, TableNameEnum.ENTERPRISE_STANDARDS.getValue());
}
@RequiresPermissions("domesticStandard:tree:delete")
@AutoLog(value = "国内标准-通过id删除")
@ApiOperation(value = "国内标准-通过id删除", notes = "国内标准-通过id删除")
@PostMapping(value = "/domestic/delete")
public Result<T> deleteGB(@RequestBody Map<String, String> map) {
return this.commonDelete(map, TableNameEnum.DOMESTIC_REGULATIONS.getValue());
}
@RequiresPermissions("overseasStandard:tree:delete")
@AutoLog(value = "海外标准-通过id删除")
@ApiOperation(value = "海外标准-通过id删除", notes = "海外标准-通过id删除")
@PostMapping(value = "/overseas/delete")
public Result<T> deleteFB(@RequestBody Map<String, String> map) {
String id = map.get("id");
if (StringUtils.isBlank(id)) {
return Result.error("参数不识别!");
}
LawsTreeNode lawsTreeNode = lawsTreeNodeService.getById(id);
if (lawsTreeNode == null) {
return Result.error("未找到对应实体");
} else if (LAWS_TREE_ROOT_NODE == lawsTreeNode.getNodeType()) {
return Result.error("根节点无法删除");
} else {
boolean ok = lawsTreeNodeService.delete(id, lawsTreeNode.getNodeCode());
if (ok) {
return Result.OK("删除成功!");
}
}
return Result.OK();
return this.commonDelete(map, TableNameEnum.FOREIGN_REGULATIONS.getValue());
}
}
@@ -24,17 +24,15 @@ public interface ILawsTreeNodeService extends IService<LawsTreeNode> {
/**
* 新增
* @param lawsTreeNode
* @param username
*/
void saveTreeNodeData(LawsTreeNode lawsTreeNode, String username);
void saveTreeNodeData(LawsTreeNode lawsTreeNode);
/**
* 更新
* @param lawsTreeNode
* @param username
* @return
*/
boolean updateTreeNodeDataById(LawsTreeNode lawsTreeNode, String username);
boolean updateTreeNodeDataById(LawsTreeNode lawsTreeNode);
/**
* 删除
@@ -106,8 +106,8 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
}
@Override
public void saveTreeNodeData(LawsTreeNode lawsTreeNode, String username) {
if (lawsTreeNode != null && username != null) {
public void saveTreeNodeData(LawsTreeNode lawsTreeNode) {
if (lawsTreeNode != null) {
if (lawsTreeNode.getParentId() == null) {
lawsTreeNode.setParentId("");
}
@@ -131,10 +131,8 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
}
@Override
public boolean updateTreeNodeDataById(LawsTreeNode lawsTreeNode, String username) {
if (lawsTreeNode != null && username != null) {
lawsTreeNode.setUpdateTime(new Date());
lawsTreeNode.setUpdateBy(username);
public boolean updateTreeNodeDataById(LawsTreeNode lawsTreeNode) {
if (lawsTreeNode != null) {
this.updateById(lawsTreeNode);
return true;
} else {
@@ -26,5 +26,9 @@ public static final String PLEASE_USE_A_FILE_WITH_THE_SUFFIX_XLSX = "please.use.
public static final String IMPORT_DATA_CANNOT_BE_EMPTY = "import.data.cannot.be.empty"; // \u5BFC\u5165\u6570\u636E\u4E0D\u80FD\u4E3A\u7A7A
public static final String HEADER_INCONSISTENT_WITH_TEMPLATE = "header.inconsistent.with.template"; // \u8868\u5934\u4E0E\u6A21\u677F\u4E0D\u4E00\u81F4
no.corresponding.record.found=\u672A\u627E\u5230\u5BF9\u5E94\u8BB0\u5F55
parameters.cannot.be.null=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A
root.node.cannot.be.edited=\u6839\u8282\u70B9\u65E0\u6CD5\u7F16\u8F91
horizontal.transgression=\u6C34\u5E73\u8D8A\u6743
@@ -20,3 +20,9 @@ cannot.duplicate.favorites=cannot duplicate favorites
no.corresponding.data.found=no corresponding data found
The.toplevel.group.cannot.be.deleted=The toplevel group cannot be deleted
number.workNo.already.exists=number {0} already exists
no.corresponding.record.found=No corresponding record found
parameters.cannot.be.null=Parameters cannot be null
root.node.cannot.be.edited=Root node cannot be edited
horizontal.transgression=Horizontal overstepping of authority
@@ -21,5 +21,7 @@ no.corresponding.data.found=\u672A\u627E\u5230\u5BF9\u5E94\u6570\u636E
The.toplevel.group.cannot.be.deleted=\u6700\u9AD8\u7EA7\u7EC4\u522B\u4E0D\u80FD\u5220\u9664
number.workNo.already.exists=\u5DE5\u53F7 {0} \u5DF2\u5B58\u5728
no.corresponding.record.found=\u672A\u627E\u5230\u5BF9\u5E94\u8BB0\u5F55
parameters.cannot.be.null=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A
root.node.cannot.be.edited=\u6839\u8282\u70B9\u65E0\u6CD5\u7F16\u8F91
horizontal.transgression=\u6C34\u5E73\u8D8A\u6743