From 5fb0d453f2349dc6bc07b72afcad08cac50464bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Fri, 20 Jan 2023 20:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=A2=E9=98=9F=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xm/core/ctrl/XmQuestionController.java | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java index b6377ed6..4f599d27 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmQuestionController.java @@ -173,16 +173,9 @@ public class XmQuestionController { if(words!=null && words.size()>0){ return failed("remark-sensitive-word","备注中有敏感词"+words+",请修改后再提交"); } - XmProject xmProject=projectService.getProjectFromCache(xmQuestionVo.getProjectId()); - Tips tips1 = this.groupService.checkProjectQx(xmProject,user); - if(!tips1.isOk()){ - if(StringUtils.hasText(xmQuestionVo.getProductId())){ - XmProduct xmProduct=productService.getProductFromCache(xmQuestionVo.getProductId()); - tips1=this.groupService.checkProductQx(xmProduct,1,user); - } - } - if(!tips1.isOk()){ - return failed(tips1); + tips=checkOneQx(xmQuestionVo.getProjectId(),xmQuestionVo.getProductId()); + if(!tips.isOk()){ + return failed(tips); } xmQuestionService.addQuestion(xmQuestionVo); @@ -235,8 +228,17 @@ public class XmQuestionController { Map m = new HashMap<>(); Tips tips=new Tips("成功更新一条数据"); try{ - User user=LoginUtils.getCurrentUserInfo(); + + if(!StringUtils.hasText(xmQuestionVo.getId())){ + return failed("id-0","编号不能为空"); + } + XmQuestion xmQuestionDb=this.xmQuestionService.selectOneById(xmQuestionVo.getId()); + tips=checkOneQx(xmQuestionDb.getProjectId(),xmQuestionDb.getProductId()); + if(!tips.isOk()){ + return failed(tips); + } + User user=LoginUtils.getCurrentUserInfo(); xmQuestionService.updateQuestion(xmQuestionVo); if(!StringUtils.isEmpty(xmQuestionVo.getHandlerUserid())) { xmPushMsgService.pushPrichatMsgToIm(user.getBranchId(), user.getUserid(), user.getUsername(), xmQuestionVo.getHandlerUserid(),xmQuestionVo.getHandlerUsername(), user.getUsername()+"修改bug【"+xmQuestionVo.getName()+"】"); @@ -263,8 +265,18 @@ public class XmQuestionController { Map m = new HashMap<>(); Tips tips=new Tips("成功更新一条数据"); try{ + + if(!StringUtils.hasText(xmQuestion.getId())){ + return failed("id-0","编号不能为空"); + } + + XmQuestion xmQuestionDb=this.xmQuestionService.selectOneById(xmQuestion.getId()); + tips=checkOneQx(xmQuestionDb.getProjectId(),xmQuestionDb.getProductId()); + if(!tips.isOk()){ + return failed(tips); + } + User user=LoginUtils.getCurrentUserInfo(); xmQuestionService.updateSomeFieldByPk(xmQuestion); - User user=LoginUtils.getCurrentUserInfo(); if(!StringUtils.isEmpty(xmQuestion.getHandlerUserid())) { xmPushMsgService.pushPrichatMsgToIm(user.getBranchId(), user.getUserid(), user.getUsername(), xmQuestion.getHandlerUserid(),xmQuestion.getHandlerUsername(), user.getUsername()+"修改bug【"+xmQuestion.getName()+"】状态"); } @@ -463,6 +475,18 @@ public class XmQuestionController { } + public Tips checkOneQx(String projectId,String productId){ + User user=LoginUtils.getCurrentUserInfo(); + XmProject xmProject=projectService.getProjectFromCache(projectId ); + Tips tips1 = this.groupService.checkProjectQx(xmProject,user); + if(!tips1.isOk()){ + if(StringUtils.hasText(productId)){ + XmProduct xmProduct=productService.getProductFromCache(productId); + tips1=this.groupService.checkProductQx(xmProduct,1,user); + } + } + return tips1; + } public void checkQx(List xmQuestionsDb, List canOper, List noOper, Map noOperTips){ User user=LoginUtils.getCurrentUserInfo();