From 08f1b1f1804a8bd833d42f257908d80e88387b55 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 14 三月 2025 11:27:47 +0800 Subject: [PATCH] 3.5增加登录验证、修改密码、人员列表调整 --- flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 40 insertions(+), 5 deletions(-) diff --git a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java index 0564736..e8e2838 100644 --- a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java +++ b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java @@ -6,10 +6,13 @@ import com.dg.core.annotation.CurrentUser; import com.dg.core.db.gen.entity.ReplyTemplateEntity; import com.dg.core.db.gen.entity.SysUser; +import com.dg.core.service.IOrganizationChartService; import com.dg.core.service.IReplyTemplateService; +import com.dg.core.util.PermissionUtil; import com.dg.core.util.TableDataInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -24,19 +27,32 @@ @Autowired IReplyTemplateService iReplyTemplateService; + @Autowired + IOrganizationChartService iOrganizationChartService; + + /** * 获取模板列表 * @return */ @ApiOperation("获取模板列表") @GetMapping("/getlist") + @Authorization public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum, @RequestParam(value = "pageSize",required = false) Integer pageSize, - @RequestParam(value = "Name",required = false) String Name) + @RequestParam(value = "name",required = false) String Name, + @CurrentUser SysUser sysUser) { Page<ReplyTemplateEntity> pageParam = new Page<>(pageNum,pageSize); - List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name); - int num=iReplyTemplateService.countNum(Name); + List<String> ids=PermissionUtil.getStairDepartment(sysUser,iOrganizationChartService); + List<ReplyTemplateEntity> list; + if (sysUser.getUserType().equals("1")||sysUser.getIsDivisionHead().equals("1")){ + list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,null); + } + else { + list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,sysUser.getUserId()); + } + int num=iReplyTemplateService.countNum(Name,ids); return getDataTable(list,num); } @@ -47,6 +63,7 @@ */ @ApiOperation("获取详情") @GetMapping("/getdata") + @Authorization public ResultData selectConfigData(@RequestParam(value = "Id",required = false) String Id) { if(StringUtils.isEmpty(Id)) @@ -76,8 +93,21 @@ return ResultData.error("模板名称不能为空"); } + if(StringUtils.isEmpty(entity.getDepartmentId())) + { + return ResultData.error("部门id不能为空 请分配部门id"); + } + + List<String> ids=iOrganizationChartService.getIds(entity.getDepartmentId()); + int num=iReplyTemplateService.countNum(entity.getName(),ids); + + if(num>0) + { + return ResultData.error("部门里办事名称重复!"); + } + entity.setId(null); - entity.setDepartmentId(sysUser.getDepartmentId()); + entity.setDepartmentId(entity.getDepartmentId()); entity.setCreateUserId(sysUser.getUserId()+""); return toAjax(iReplyTemplateService.insertConfig(entity)); @@ -90,6 +120,7 @@ */ @ApiOperation("更新模板") @PostMapping("/update") + @Authorization public ResultData updateConfig(@RequestBody ReplyTemplateEntity entity) { if(entity==null) @@ -111,6 +142,7 @@ */ @ApiOperation("删除模板") @DeleteMapping("/delete") + @Authorization public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id) { return toAjax(iReplyTemplateService.deleteConfigById(Id)); @@ -124,7 +156,8 @@ */ @ApiOperation("复制模板") @PostMapping("/copy") - public ResultData copy(@RequestParam(value = "Id",required = false) String Id) + @Authorization + public ResultData copy(@RequestParam(value = "Id",required = false) String Id,@CurrentUser SysUser sysUser) { if(StringUtils.isEmpty(Id)) { @@ -137,6 +170,8 @@ { return ResultData.error("模板不存在!"); } + entity.setCreateUserId(sysUser.getUserId()); + entity.setName(entity.getName()+"(副本)"); entity.setId(null); return toAjax(iReplyTemplateService.insertConfig(entity)); } -- Gitblit v1.7.1