From ad69633c233f880d95b8beefe9921e02752a4f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Fri, 11 Mar 2022 17:33:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8A=82=E7=82=B9=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=81=E6=A0=87=E7=AD=BE=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xm/core/ctrl/XmIterationController.java | 21 ++++++++-- .../core/ctrl/XmIterationLinkController.java | 38 +++++++++++++++++-- .../core/service/XmIterationLinkService.java | 9 +++++ .../xm/core/service/XmIterationService.java | 7 ++++ 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java index bb632032..f38cac4e 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationController.java @@ -11,10 +11,7 @@ import com.mdp.safe.client.entity.User; import com.mdp.safe.client.utils.LoginUtils; import com.xm.core.entity.XmIteration; import com.xm.core.entity.XmIterationLink; -import com.xm.core.service.XmIterationLinkService; -import com.xm.core.service.XmIterationService; -import com.xm.core.service.XmProductService; -import com.xm.core.service.XmRecordService; +import com.xm.core.service.*; import com.xm.core.vo.XmIterationVo; import io.swagger.annotations.*; import org.apache.commons.logging.Log; @@ -59,6 +56,10 @@ public class XmIterationController { @Autowired private XmRecordService xmRecordService; + + @Autowired + XmGroupService xmGroupService; + @ApiOperation( value = "查询迭代定义信息列表",notes="listXmIteration,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}") @ApiImplicitParams({ @ApiImplicitParam(name="id",value="迭代编码,主键",required=false), @@ -188,6 +189,18 @@ public class XmIterationController { if(!StringUtils.hasText(link.getLtype())){ return ResponseHelper.failed("ltype-0","关联类型不能为空"); } + + if("1".equals(link.getLtype())){ + if(!xmGroupService.checkUserIsProductAdm(link.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品与迭代关联"); + }; + }else if("0".equals(link.getLtype())){ + if(!xmGroupService.checkUserIsProjectAdm(link.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目与迭代关联"); + }; + }else{ + return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); + } } } xmIterationService.addIteration(xmIteration); diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java index f0837876..22491d0f 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java @@ -9,6 +9,9 @@ import com.mdp.core.utils.ResponseHelper; import com.mdp.safe.client.entity.User; import com.mdp.safe.client.utils.LoginUtils; import com.xm.core.entity.XmIterationLink; +import com.xm.core.service.XmGroupService; +import com.xm.core.service.XmProductService; +import com.xm.core.service.XmProjectService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -50,9 +53,10 @@ public class XmIterationLinkController { @Autowired private XmIterationLinkService xmIterationLinkService; - - - + + @Autowired + XmGroupService xmGroupService; + @ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") @ApiResponses({ @@ -130,6 +134,18 @@ public class XmIterationLinkController { return m; } User user= LoginUtils.getCurrentUserInfo(); + if("1".equals(xmIterationLink.getLtype())){ + if(!xmGroupService.checkUserIsProductAdm(xmIterationLink.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品与迭代关联"); + }; + }else if("0".equals(xmIterationLink.getLtype())){ + if(!xmGroupService.checkUserIsProjectAdm(xmIterationLink.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目与迭代关联"); + }; + }else{ + return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); + } + xmIterationLink.setCuserid(user.getUserid()); xmIterationLink.setCusername(user.getUsername()); xmIterationLink.setCtime(new Date()); @@ -162,6 +178,22 @@ public class XmIterationLinkController { if(StringUtils.isEmpty(xmIterationLink.getProId())) { return ResponseHelper.failed("proId-0","请上送产品编号或项目编号"); } + xmIterationLink=this.xmIterationLinkService.selectOneObject(xmIterationLink); + if(xmIterationLink==null){ + return ResponseHelper.failed("data-0","该关联关系已不存在"); + } + User user= LoginUtils.getCurrentUserInfo(); + if("1".equals(xmIterationLink.getLtype())){ + if(!xmGroupService.checkUserIsProductAdm(xmIterationLink.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-product-qx","您不是产品管理人员,无权将该产品移出迭代"); + }; + }else if("0".equals(xmIterationLink.getLtype())){ + if(!xmGroupService.checkUserIsProjectAdm(xmIterationLink.getProId(),user.getUserid())){ + return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目移出迭代"); + }; + }else{ + return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); + } xmIterationLinkService.deleteByPk(xmIterationLink); }catch (BizException e) { tips=e.getTips(); diff --git a/xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java b/xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java index 63eb141a..c091b56c 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java @@ -1,7 +1,10 @@ package com.xm.core.service; +import com.mdp.core.entity.Tips; +import com.xm.core.entity.XmIteration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.mdp.core.service.BaseService; @@ -15,6 +18,10 @@ import java.util.Map; ***/ @Service("xm.core.xmIterationLinkService") public class XmIterationLinkService extends BaseService { + + + + static Logger logger =LoggerFactory.getLogger(XmIterationLinkService.class); public List> listWithProductInfo(Map xmIterationLink) { @@ -26,5 +33,7 @@ public class XmIterationLinkService extends BaseService { } /** 请在此类添加自定义函数 */ + + } diff --git a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java index 4461632f..44f80d73 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmIterationService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmIterationService.java @@ -1,6 +1,10 @@ package com.xm.core.service; +import com.mdp.core.entity.Tips; import com.mdp.core.service.BaseService; +import com.mdp.safe.client.entity.User; +import com.xm.core.entity.XmIteration; +import com.xm.core.entity.XmProject; import com.xm.core.vo.XmIterationVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,6 +23,9 @@ public class XmIterationService extends BaseService { @Autowired XmIterationLinkService xmIterationLinkService; + + + /** * 调用存储过程计算指定迭代的任务预算数据