Commit 4e502a6f by 袁伟铭

添加请求工具类

parent 3d1e3602
...@@ -51,7 +51,7 @@ public class CategoryController { ...@@ -51,7 +51,7 @@ public class CategoryController {
@ApiOperation("修改目录") @ApiOperation("修改目录")
@PostMapping(value = "/modifyCategory") @PostMapping(value = "/modifyCategory")
public ResultVo modifyCategory(@RequestBody DataCategory vo) { public ResultVo modifyCategory(@RequestBody DataCategory vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
categoryService.modifyCategory(vo); categoryService.modifyCategory(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -34,21 +34,20 @@ public class DeptController { ...@@ -34,21 +34,20 @@ public class DeptController {
@ApiOperation("获取机构信息") @ApiOperation("获取机构信息")
@GetMapping(value = "/getDeptInfo/{deptId}") @GetMapping(value = "/getDeptInfo/{deptId}")
public ResultVo<OrgDeptVo> getDeptInfo(@PathVariable Long deptId) { public ResultVo<OrgDeptVo> getDeptInfo(@PathVariable String deptId) {
AssertUtils.notNull(deptId, "缺少机构ID"); AssertUtils.notNull(deptId, "缺少机构ID");
return ResultVo.success(deptService.getDeptInfo(deptId)); return ResultVo.success(deptService.getDeptInfo(deptId));
} }
@ApiOperation("根据部门PID查询子机构") @ApiOperation("根据部门PID查询子机构")
@GetMapping(value = "/getDeptByPid/{parentId}") @GetMapping(value = "/getDeptByPid/{parentId}")
public ResultVo<List<OrgDept>> getDeptByPid(@PathVariable Long parentId) { public ResultVo<List<OrgDept>> getDeptByPid(@PathVariable String parentId) {
return ResultVo.success(deptService.getDeptByPid(parentId)); return ResultVo.success(deptService.getDeptByPid(parentId));
} }
@ApiOperation("添加机构") @ApiOperation("添加机构")
@PostMapping(value = "/addDept") @PostMapping(value = "/addDept")
public ResultVo addDept(@RequestBody OrgDept vo) { public ResultVo addDept(@RequestBody OrgDept vo) {
AssertUtils.notNull(vo.getParentId(), "缺少父级ID");
AssertUtils.hasText(vo.getDeptName(), "缺少机构名称"); AssertUtils.hasText(vo.getDeptName(), "缺少机构名称");
AssertUtils.notNull(vo.getDeptType(), "缺少机构类型"); AssertUtils.notNull(vo.getDeptType(), "缺少机构类型");
AssertUtils.hasText(vo.getAreaCode(), "缺少区域码"); AssertUtils.hasText(vo.getAreaCode(), "缺少区域码");
...@@ -65,7 +64,7 @@ public class DeptController { ...@@ -65,7 +64,7 @@ public class DeptController {
@ApiOperation("修改机构") @ApiOperation("修改机构")
@PostMapping(value = "/modifyDept") @PostMapping(value = "/modifyDept")
public ResultVo modifyDept(@RequestBody OrgDept vo) { public ResultVo modifyDept(@RequestBody OrgDept vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
deptService.modifyDept(vo); deptService.modifyDept(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -3,7 +3,6 @@ package com.zq.resource.controller.admin; ...@@ -3,7 +3,6 @@ package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils; import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo; import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo; import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.entity.DataDict; import com.zq.resource.entity.DataDict;
import com.zq.resource.service.DictService; import com.zq.resource.service.DictService;
import com.zq.resource.vo.DataDictFindVo; import com.zq.resource.vo.DataDictFindVo;
...@@ -49,7 +48,7 @@ public class DictController { ...@@ -49,7 +48,7 @@ public class DictController {
@ApiOperation("修改字典") @ApiOperation("修改字典")
@PostMapping(value = "/modifyDict") @PostMapping(value = "/modifyDict")
public ResultVo modifyDict(@RequestBody DataDict vo) { public ResultVo modifyDict(@RequestBody DataDict vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
dictService.modifyDict(vo); dictService.modifyDict(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -48,7 +48,7 @@ public class GovAffairController { ...@@ -48,7 +48,7 @@ public class GovAffairController {
@ApiOperation("修改政务服务事项") @ApiOperation("修改政务服务事项")
@PostMapping(value = "/modifyGovAffair") @PostMapping(value = "/modifyGovAffair")
public ResultVo modifyGovAffair(@RequestBody GovAffairItem vo) { public ResultVo modifyGovAffair(@RequestBody GovAffairItem vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
govAffairService.modifyGovAffair(vo); govAffairService.modifyGovAffair(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -48,7 +48,7 @@ public class GovMonitorController { ...@@ -48,7 +48,7 @@ public class GovMonitorController {
@ApiOperation("修改政务监管事项") @ApiOperation("修改政务监管事项")
@PostMapping(value = "/modifyGovMonitor") @PostMapping(value = "/modifyGovMonitor")
public ResultVo modifyGovMonitor(@RequestBody GovMonitorItem vo) { public ResultVo modifyGovMonitor(@RequestBody GovMonitorItem vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
govMonitorService.modifyGovMonitor(vo); govMonitorService.modifyGovMonitor(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -57,7 +57,7 @@ public class MetadataController { ...@@ -57,7 +57,7 @@ public class MetadataController {
@ApiOperation("修改字典") @ApiOperation("修改字典")
@PostMapping(value = "/modifyMetadata") @PostMapping(value = "/modifyMetadata")
public ResultVo modifyMetadata(@RequestBody InfoMetadata vo) { public ResultVo modifyMetadata(@RequestBody InfoMetadata vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
metadataService.modifyMetadata(vo); metadataService.modifyMetadata(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -36,7 +36,7 @@ public class SystemController { ...@@ -36,7 +36,7 @@ public class SystemController {
@PostMapping(value = "/addSystem") @PostMapping(value = "/addSystem")
public ResultVo addSystem(@RequestBody InfoSystem vo) { public ResultVo addSystem(@RequestBody InfoSystem vo) {
AssertUtils.hasText(vo.getSystemName(), "缺少系统名称"); AssertUtils.hasText(vo.getSystemName(), "缺少系统名称");
AssertUtils.notNull(vo.getBelongDeptId(), "缺少所属部门ID"); AssertUtils.hasText(vo.getBelongDeptId(), "缺少所属部门ID");
AssertUtils.notNull(vo.getSystemType(), "缺少系统类型"); AssertUtils.notNull(vo.getSystemType(), "缺少系统类型");
AssertUtils.notNull(vo.getSystemLevelType(), "缺少系统层级"); AssertUtils.notNull(vo.getSystemLevelType(), "缺少系统层级");
AssertUtils.notNull(vo.getCoverLevelType(), "缺少覆盖层级"); AssertUtils.notNull(vo.getCoverLevelType(), "缺少覆盖层级");
...@@ -58,7 +58,7 @@ public class SystemController { ...@@ -58,7 +58,7 @@ public class SystemController {
@ApiOperation("修改系统") @ApiOperation("修改系统")
@PostMapping(value = "/modifySystem") @PostMapping(value = "/modifySystem")
public ResultVo modifySystem(@RequestBody InfoSystem vo) { public ResultVo modifySystem(@RequestBody InfoSystem vo) {
AssertUtils.notNull(vo.getId()); AssertUtils.hasText(vo.getId());
systemService.modifySystem(vo); systemService.modifySystem(vo);
return ResultVo.success(); return ResultVo.success();
......
...@@ -3,7 +3,6 @@ package com.zq.resource.service; ...@@ -3,7 +3,6 @@ package com.zq.resource.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils; import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils; import com.zq.common.utils.PagingUtils;
...@@ -15,6 +14,7 @@ import com.zq.resource.vo.DataTreeVo; ...@@ -15,6 +14,7 @@ import com.zq.resource.vo.DataTreeVo;
import com.zq.resource.vo.OrgDeptFindVo; import com.zq.resource.vo.OrgDeptFindVo;
import com.zq.resource.vo.OrgDeptVo; import com.zq.resource.vo.OrgDeptVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -55,7 +55,7 @@ public class DeptService { ...@@ -55,7 +55,7 @@ public class DeptService {
return PagingUtils.paging(vo, orgDeptDao, OrgDept.class, lambdaQuery); return PagingUtils.paging(vo, orgDeptDao, OrgDept.class, lambdaQuery);
} }
public List<OrgDept> getDeptByPid(Long parentId) { public List<OrgDept> getDeptByPid(String parentId) {
return orgDeptDao.selectList(Wrappers.lambdaQuery(OrgDept.builder().parentId(parentId).build())); return orgDeptDao.selectList(Wrappers.lambdaQuery(OrgDept.builder().parentId(parentId).build()));
} }
...@@ -105,13 +105,13 @@ public class DeptService { ...@@ -105,13 +105,13 @@ public class DeptService {
return TreeUtils.buildTree(collect, "0"); return TreeUtils.buildTree(collect, "0");
} }
public OrgDeptVo getDeptInfo(Long deptId) { public OrgDeptVo getDeptInfo(String deptId) {
OrgDept orgDept = orgDeptDao.selectById(deptId); OrgDept orgDept = orgDeptDao.selectById(deptId);
AssertUtils.notNull(orgDept, "机构不存在"); AssertUtils.notNull(orgDept, "机构不存在");
OrgDeptVo orgDeptVo = BeanUtil.copyProperties(orgDept, OrgDeptVo.class); OrgDeptVo orgDeptVo = BeanUtil.copyProperties(orgDept, OrgDeptVo.class);
if (orgDept.getParentId() != null && orgDept.getParentId() != 0) { if (StringUtils.isNotBlank(orgDept.getParentId())) {
OrgDept parentDept = orgDeptDao.selectById(orgDept.getParentId()); OrgDept parentDept = orgDeptDao.selectById(orgDept.getParentId());
if (parentDept != null) { if (parentDept != null) {
orgDeptVo.setParentName(parentDept.getDeptName()); orgDeptVo.setParentName(parentDept.getDeptName());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment