From e887e4414e8522de6a72d95b2cd315ad0a4de0f2 Mon Sep 17 00:00:00 2001 From: zhc077 <565291854@qq.com> Date: Thu, 24 Oct 2024 17:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=B9=A6-=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0=2010.?= =?UTF-8?q?24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/controller/ProjectController.java | 21 +++++++++++-------- .../project/ProjectList.vue | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java index 9a7653e..409ecd4 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/project/controller/ProjectController.java @@ -7,14 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; -import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.demo.departext.entity.DepartExt; import org.jeecg.modules.demo.departext.service.IDepartExtService; import org.jeecg.modules.demo.project.dto.DepartExtDto; @@ -99,7 +98,7 @@ public class ProjectController extends JeecgController @ApiOperation(value = "项目表-根据id查询", notes = "项目表-根据id查询") @GetMapping(value = "/getById") - public Result getById(Project param,HttpServletRequest req) { + public Result getById(Project param, HttpServletRequest req) { Project project = projectService.getById(param.getId()); ProjectType projectType = iProjectTypeService.getById(project.getProjectTypeid()); project.setAnnualName(projectType.getAnnualName()); @@ -111,7 +110,7 @@ public class ProjectController extends JeecgController @ApiOperation(value = "获取项目负责人信息", notes = "获取项目负责人信息") @GetMapping(value = "/getUserInfo") - public Result getUserInfo(Project para,HttpServletRequest req) { + public Result getUserInfo(Project para, HttpServletRequest req) { // LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); Project project = projectService.getById(para.getId()); SysUser sysUser = iSysUserService.getById(project.getProjectCharger()); @@ -126,7 +125,7 @@ public class ProjectController extends JeecgController @ApiOperation(value = "获取申请单位信息", notes = "获取申请单位信息") @GetMapping(value = "/getDepartInfo") - public Result getDepartInfo(Project para,HttpServletRequest req) { + public Result getDepartInfo(Project para, HttpServletRequest req) { Project project = projectService.getById(para.getId()); SysUser sysUser = iSysUserService.getById(project.getProjectCharger()); SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper().eq(SysDepart::getOrgCode, sysUser.getOrgCode())); @@ -135,8 +134,8 @@ public class ProjectController extends JeecgController .eq(DepartExt::getProjectId, para.getId()) ); DepartExtDto dto = new DepartExtDto(); - BeanUtils.copyProperties(sysDepart,dto); - BeanUtils.copyProperties(departExt,dto); + BeanUtils.copyProperties(sysDepart, dto); + BeanUtils.copyProperties(departExt, dto); return Result.OK(dto); } @@ -159,6 +158,10 @@ public class ProjectController extends JeecgController @ApiOperation(value = "新增项目审报", notes = "新增项目审报") @PostMapping(value = "/save4shenbao") public Result save4shenbao(@RequestBody ProjectShenBaoDto dto) { + long count = projectService.count(new LambdaQueryWrapper().eq(Project::getProjectTypeid, dto.getProjectTypeid())); + if (count > 0) { + throw new JeecgBootException("该项目类型,当年已填报,不能重复填报!"); + } projectService.save4shenbao(dto); return Result.OK("添加成功!"); } @@ -198,8 +201,8 @@ public class ProjectController extends JeecgController @DeleteMapping(value = "/delete") public Result delete(@RequestParam(name = "id", required = true) String id) { projectService.removeById(id); - iUserExtService.remove(new LambdaQueryWrapper().eq(UserExt::getProjectId,id)); - iDepartExtService.remove(new LambdaQueryWrapper().eq(DepartExt::getProjectId,id)); + iUserExtService.remove(new LambdaQueryWrapper().eq(UserExt::getProjectId, id)); + iDepartExtService.remove(new LambdaQueryWrapper().eq(DepartExt::getProjectId, id)); return Result.OK("删除成功!"); } diff --git a/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue b/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue index 6964d17..7d586ff 100644 --- a/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue +++ b/jeecgboot-vue3/src/views/projectApplication/project/ProjectList.vue @@ -4,7 +4,7 @@