From daad7b874fbee35014313a77b299bc253ffcb366 Mon Sep 17 00:00:00 2001 From: LILI <707464720@qq.com> Date: Mon, 1 Apr 2024 16:37:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.=E7=BB=BC=E5=90=88=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=A8=A1=E5=9D=97=E6=9D=83=E9=99=90=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=EF=BC=8C2.=E5=8E=86=E5=8F=B2=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OcrSearchHistoryController.java | 17 ++++- .../ocr/dataobject/OcrSearchHistory.java | 68 +++++++------------ .../impl/OcrSearchHistoryServiceImpl.java | 31 +++++++-- .../jyjz/xiaoyao/ocr/util/FrontMenuEnum.java | 35 ++++++++++ 4 files changed, 99 insertions(+), 52 deletions(-) create mode 100644 jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/FrontMenuEnum.java diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java index 0a546ea9..f16c0ffb 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/controller/OcrSearchHistoryController.java @@ -57,6 +57,7 @@ public class OcrSearchHistoryController { OcrSearchHistory ocrsearchhistory =new OcrSearchHistory(); ocrsearchhistory.setHistoryname(search); + ocrsearchhistory.setTenantId(Long.valueOf(tenantId)); ocrsearchhistory.setUserid(Long.valueOf(userToken.getUserid())); ocrsearchhistory.setCreatedate(System.currentTimeMillis()); ocrSearchHistoryService.save(ocrsearchhistory); @@ -75,9 +76,16 @@ public class OcrSearchHistoryController { */ @RequestMapping(value = "/searchdelete", method = RequestMethod.DELETE) public ResultVo searchdelete(HttpServletRequest request) { + //租户主键,由前端页面传送 + String tenantId = request.getHeader("X-Tenant-Id"); + if (StringUtils.isBlank(tenantId)) { + return ResultVoUtil.error("租户主键不能为空"); + } + UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request)); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("userid",userToken.getUserid()); + wrapper.eq("tenant_id",Long.valueOf(tenantId)); //根据具体情况 判断 是否需要 进行数据返回, 默认不返回数据 ocrSearchHistoryService.remove(wrapper); // return new ResponseEntity("true",HttpStatus.OK); @@ -92,10 +100,15 @@ public class OcrSearchHistoryController { */ @RequestMapping(value = "/historySearch", method = RequestMethod.GET) public ResultVo historySearch(HttpServletRequest request) { - UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request)); + //租户主键,由前端页面传送 + String tenantId = request.getHeader("X-Tenant-Id"); + if (StringUtils.isBlank(tenantId)) { + return ResultVoUtil.error("租户主键不能为空"); + } + UserToken userToken = this.userTokenService.getUserToken(RequestBaseUtil.getToken(request)); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.select("historyname","createdate").eq("userid",userToken.getUserid()).orderByDesc("createdate").last("limit 8"); + wrapper.select("historyname","createdate").eq("userid",userToken.getUserid()).eq("tenant_id",Long.valueOf(tenantId)).orderByDesc("createdate").last("limit 8"); List list = ocrSearchHistoryService.list(wrapper); // return new ResponseEntity>(list, HttpStatus.OK); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSearchHistory.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSearchHistory.java index 03c2f373..4cd90ac9 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSearchHistory.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/dataobject/OcrSearchHistory.java @@ -4,6 +4,12 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; import java.io.Serializable; @@ -15,7 +21,14 @@ import java.io.Serializable; * @author 你的肉123 * @since 2024-03-15 */ -@TableName("ocr_search_history") + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "综合搜索历史表", title = "综合搜索历史表") +@ApiModel(value = "综合搜索历史表", description = "综合搜索历史表") +@TableName(value = "ocr_search_history") public class OcrSearchHistory extends Model { private static final long serialVersionUID = 1L; @@ -30,13 +43,10 @@ public class OcrSearchHistory extends Model { */ private String historyname; - public Long getUserid() { - return userid; - } - - public void setUserid(Long userid) { - this.userid = userid; - } + /** + * 租户ID + */ + private Long tenantId; /** * 创建时间 @@ -47,44 +57,14 @@ public class OcrSearchHistory extends Model { */ private Long createdate; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - - public String getHistoryname() { - return historyname; - } - - public void setHistoryname(String historyname) { - this.historyname = historyname; - } - - public Long getCreatedate() { - return createdate; - } - - public void setCreatedate(Long createdate) { - this.createdate = createdate; - } - - @Override - public Serializable pkVal() { - return this.id; - } - @Override public String toString() { return "OcrSearchHistory{" + - "id=" + id + - ", historyname=" + historyname + - ", userid=" + userid + - ", createdate=" + createdate + - "}"; + "id=" + id + + ", historyname='" + historyname + '\'' + + ", tenantId=" + tenantId + + ", userid=" + userid + + ", createdate=" + createdate + + '}'; } } diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java index 22a2487e..4a394999 100644 --- a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/service/impl/OcrSearchHistoryServiceImpl.java @@ -1,8 +1,11 @@ package cn.jyjz.xiaoyao.ocr.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.jyjz.flowable.service.IFlowTaskService; import cn.jyjz.flowable.utils.PageUtils; +import cn.jyjz.xiaoyao.admin.dataobject.SFrontmenuT; import cn.jyjz.xiaoyao.admin.dataobject.User; +import cn.jyjz.xiaoyao.admin.service.ISFrontmenuTService; import cn.jyjz.xiaoyao.admin.service.UserService; import cn.jyjz.xiaoyao.common.base.service.UserTokenService; import cn.jyjz.xiaoyao.common.base.util.RequestBaseUtil; @@ -18,6 +21,7 @@ import cn.jyjz.xiaoyao.ocr.dataobject.OcrSearchHistory; import cn.jyjz.xiaoyao.ocr.dataobject.OcrTaskchildPictureAppro; import cn.jyjz.xiaoyao.ocr.service.IOcrSearchHistoryService; import cn.jyjz.xiaoyao.ocr.service.OcrPictureService; +import cn.jyjz.xiaoyao.ocr.util.FrontMenuEnum; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -59,16 +63,31 @@ public class OcrSearchHistoryServiceImpl extends ServiceImpl>> selectsearch(String search, String assignee, String userId, String tenantId) { - - - List> strings1 = ocrsearchhistorymapper.selectsearch1(userId,search,tenantId); - List> strings2 = ocrsearchhistorymapper.selectsearch2(assignee,search,tenantId); - List> strings3 = ocrsearchhistorymapper.selectsearch3(assignee,search,tenantId); - + List> strings1 = new ArrayList<>(); + List> strings2 = new ArrayList<>(); + List> strings3 = new ArrayList<>(); + //查询用户搜索的数据前需要判断用户是否有对应菜单模块的权限并过滤 + //返回用户前端菜单权限列表 + List frontmenuTList = isFrontmenuTService.queryUserMenuById(assignee); + if(CollUtil.isNotEmpty(frontmenuTList)){ + for (SFrontmenuT sFrontmenuT : frontmenuTList) { + if(sFrontmenuT.getResKey().equals(FrontMenuEnum.WORKSHEETMAIN.getResKey())){ + strings1 = ocrsearchhistorymapper.selectsearch1(userId,search,tenantId); + } + if(sFrontmenuT.getResKey().equals(FrontMenuEnum.TASKMAIN.getResKey())){ + strings2 = ocrsearchhistorymapper.selectsearch2(assignee,search,tenantId); + } + if(sFrontmenuT.getResKey().equals(FrontMenuEnum.FINALMAIN.getResKey())){ + strings3 = ocrsearchhistorymapper.selectsearch3(assignee,search,tenantId); + } + } + } // List>>> list = new ArrayList<>(); Map>> map=new HashMap<>(); diff --git a/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/FrontMenuEnum.java b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/FrontMenuEnum.java new file mode 100644 index 00000000..fc377a77 --- /dev/null +++ b/jyjz-system/jyjz-system-oa/src/main/java/cn/jyjz/xiaoyao/ocr/util/FrontMenuEnum.java @@ -0,0 +1,35 @@ +package cn.jyjz.xiaoyao.ocr.util; + +public enum FrontMenuEnum { + + HOMEMAIN("home_main", "查重"), + WORKSHEETMAIN("worksheet-main", "工单"), + TASKMAIN("task-main", "审批"), + FINALMAIN("final-main", "终审"); + + //菜单键 + private String resKey; + //菜单名 + private String name; + + FrontMenuEnum(String resKey, String name) { + this.resKey = resKey; + this.name = name; + } + + public String getResKey() { + return resKey; + } + + public void setResKey(String resKey) { + this.resKey = resKey; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file