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 8b867daa..c5d95bd8 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 @@ -12,7 +12,6 @@ import com.mdp.safe.client.entity.User; import com.mdp.safe.client.utils.LoginUtils; import com.mdp.swagger.ApiEntityParams; import com.xm.core.entity.XmIteration; -import com.xm.core.entity.XmIterationLink; import com.xm.core.service.*; import com.xm.core.vo.XmIterationVo; import io.swagger.annotations.*; @@ -51,8 +50,6 @@ public class XmIterationController { private XmIterationService xmIterationService; - @Autowired - private XmIterationLinkService xmIterationLinkService; @Autowired private XmProductService xmProductService; @@ -229,11 +226,6 @@ public class XmIterationController { return failed("no-qx","您无权删除,迭代创建人、负责人可以删除"); } - XmIterationLink linkQ=new XmIterationLink(); - linkQ.setIterationId(iterationDb.getId()); - if(xmIterationLinkService.countByWhere(linkQ)>0){ - return failed("links-no-0","该迭代具有产品或者项目关联,请先移除关联关系"); - } xmIterationService.deleteByPk(xmIteration); xmRecordService.addXmIterationRecord(xmIteration.getId(),"迭代-删除","删除迭代"+iterationDb.getIterationName(),"", JSON.toJSONString(iterationDb)); 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 deleted file mode 100644 index 897f1487..00000000 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmIterationLinkController.java +++ /dev/null @@ -1,278 +0,0 @@ -package com.xm.core.ctrl; - -import com.mdp.core.entity.Tips; -import com.mdp.core.err.BizException; -import com.mdp.core.utils.RequestUtils; -import com.mdp.core.utils.ResponseHelper; -import com.mdp.mybatis.PageUtils; -import com.mdp.safe.client.entity.User; -import com.mdp.safe.client.utils.LoginUtils; -import com.mdp.swagger.ApiEntityParams; -import com.xm.core.entity.XmIterationLink; -import com.xm.core.entity.XmMenu; -import com.xm.core.entity.XmTask; -import com.xm.core.service.*; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * url编制采用rest风格,如对XM.xm_iteration_product_link 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表的操作有增删改查,对应的url分别为:
- * 新增: core/xmIterationLink/add
- * 查询: core/xmIterationLink/list
- * 模糊查询: core/xmIterationLink/listKey
- * 修改: core/xmIterationLink/edit
- * 删除: core/xmIterationLink/del
- * 批量删除: core/xmIterationLink/batchDel
- * 组织 com 顶级模块 xm 大模块 core 小模块
- * 实体 XmIterationLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; - ***/ -@RestController("xm.core.xmIterationLinkController") -@RequestMapping(value="/**/core/xmIterationLink") -@Api(tags={"迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表操作接口"}) -public class XmIterationLinkController { - - static Logger logger =LoggerFactory.getLogger(XmIterationLinkController.class); - - @Autowired - private XmIterationLinkService xmIterationLinkService; - - @Autowired - private XmIterationService xmIterationService; - - - @Autowired - private XmTaskService xmTaskService; - - - @Autowired - private XmMenuService xmMenuService; - - @Autowired - XmGroupService xmGroupService; - - - @ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") - @ApiEntityParams(XmIterationLink.class) - @ApiResponses({ - @ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") - }) - @RequestMapping(value="/list",method=RequestMethod.GET) - public Map listXmIterationLink( @ApiIgnore @RequestParam Map xmIterationLink){ - Map m = new HashMap<>(); - RequestUtils.transformArray(xmIterationLink, "iterationIdsproductIds"); - PageUtils.startPage(xmIterationLink); - List> xmIterationLinkList = xmIterationLinkService.selectListMapByWhere(xmIterationLink); //列出XmIterationLink列表 - PageUtils.responePage(m, xmIterationLinkList); - m.put("data",xmIterationLinkList); - Tips tips=new Tips("查询成功"); - m.put("tips", tips); - return m; - } - @ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") - @ApiResponses({ - @ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") - }) - @RequestMapping(value="/listWithProductInfo",method=RequestMethod.GET) - public Map listWithProductInfo( @ApiIgnore @RequestParam Map xmIterationLink){ - Map m = new HashMap<>(); - RequestUtils.transformArray(xmIterationLink, "iterationIdsproductIds"); - PageUtils.startPage(xmIterationLink); - List> xmIterationLinkList = xmIterationLinkService.listWithProductInfo(xmIterationLink); //列出XmIterationLink列表 - PageUtils.responePage(m, xmIterationLinkList); - m.put("data",xmIterationLinkList); - Tips tips=new Tips("查询成功"); - m.put("tips", tips); - return m; - } - @ApiOperation( value = "查询迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息列表",notes=" ") - @ApiEntityParams(XmIterationLink.class) - @ApiResponses({ - @ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}") - }) - @RequestMapping(value="/listWithProjectInfo",method=RequestMethod.GET) - public Map listWithProjectInfo( @ApiIgnore @RequestParam Map xmIterationLink){ - Map m = new HashMap<>(); - RequestUtils.transformArray(xmIterationLink, "pkList"); - PageUtils.startPage(xmIterationLink); - List> xmIterationLinkList = xmIterationLinkService.listWithProjectInfo(xmIterationLink); //列出XmIterationLink列表 - PageUtils.responePage(m, xmIterationLinkList); - m.put("data",xmIterationLinkList); - Tips tips=new Tips("查询成功"); - m.put("tips", tips); - return m; - } - - - @ApiOperation( value = "新增一条迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") - @ApiResponses({ - @ApiResponse(code = 200,response= XmIterationLink.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") - }) - @RequestMapping(value="/add",method=RequestMethod.POST) - public Map addXmIterationLink(@RequestBody XmIterationLink xmIterationLink) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功新增一条数据"); - try{ - - if(StringUtils.isEmpty(xmIterationLink.getIterationId())) { - return ResponseHelper.failed("iterationId-0","请上送迭代编号"); - } - if(StringUtils.isEmpty(xmIterationLink.getProId())) { - return ResponseHelper.failed("proId-0","请上送产品编号或项目编号"); - } - - if(StringUtils.isEmpty(xmIterationLink.getLtype())) { - return ResponseHelper.failed("ltype-0","请上送关联类型"); - } - if(xmIterationLinkService.selectOneObject(xmIterationLink) !=null ){ - tips.setFailureMsg("该产品或者项目已经在迭代中,无需再添加"); - m.put("tips", tips); - 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()); - xmIterationLink.setLinkStatus("1"); - xmIterationLinkService.insert(xmIterationLink); - m.put("data",xmIterationLink); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - @ApiOperation( value = "删除一条迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") - @ApiResponses({ - @ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}}") - }) - @RequestMapping(value="/del",method=RequestMethod.POST) - public Map delXmIterationLink(@RequestBody XmIterationLink xmIterationLink){ - Map m = new HashMap<>(); - Tips tips=new Tips("成功删除一条数据"); - try{ - if(StringUtils.isEmpty(xmIterationLink.getIterationId())) { - return ResponseHelper.failed("iterationId-0","请上送迭代编号"); - } - 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","您不是产品管理人员,无权将该产品移出迭代"); - }; - //检查是否有需求关联这个迭代,如果有,不允许删除 - List menus= xmMenuService.listTenMenuByProductIdAndIterationId(xmIterationLink.getProId(),xmIterationLink.getIterationId()); - if(menus!=null && menus.size()>0){ - return ResponseHelper.failed("menus-not-0","存在至少"+menus.size()+"个需求与迭代关联,不能移出.关联需求【"+menus.stream().map(i->i.getMenuName()).collect(Collectors.joining(","))+"】"); - } - }else if("0".equals(xmIterationLink.getLtype())){ - if(!xmGroupService.checkUserIsProjectAdm(xmIterationLink.getProId(),user.getUserid())){ - return ResponseHelper.failed("no-project-qx","您不是项目管理人员,无权将该项目移出迭代"); - }; - //检查是否有任务关联这个迭代,如果有,不允许删除 - List tasks= xmTaskService.listTenTaskByProjectIdAndIterationId(xmIterationLink.getProId(),xmIterationLink.getIterationId()); - if(tasks!=null && tasks.size()>0){ - return ResponseHelper.failed("tasks-not-0","存在至少"+tasks.size()+"个任务与迭代关联,不能移出.关联任务【"+tasks.stream().map(i->i.getName()).collect(Collectors.joining(","))+"】"); - } - }else{ - return ResponseHelper.failed("ltype-not-0|1","请上送正确的关联类型"); - } - - - xmIterationLinkService.deleteByPk(xmIterationLink); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - - /** - @ApiOperation( value = "根据主键修改一条迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") - @ApiResponses({ - @ApiResponse(code = 200,response=XmIterationLink.class, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") - }) - @RequestMapping(value="/edit",method=RequestMethod.POST) - public Map editXmIterationLink(@RequestBody XmIterationLink xmIterationLink) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功更新一条数据"); - try{ - xmIterationLinkService.updateByPk(xmIterationLink); - m.put("data",xmIterationLink); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - */ - - - - /** - @ApiOperation( value = "根据主键列表批量删除迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表信息",notes=" ") - @ApiResponses({ - @ApiResponse(code = 200, message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'}") - }) - @RequestMapping(value="/batchDel",method=RequestMethod.POST) - public Map batchDelXmIterationLink(@RequestBody List xmIterationLinks) { - Map m = new HashMap<>(); - Tips tips=new Tips("成功删除"+xmIterationLinks.size()+"条数据"); - try{ - xmIterationLinkService.batchDelete(xmIterationLinks); - }catch (BizException e) { - tips=e.getTips(); - logger.error("",e); - }catch (Exception e) { - tips.setFailureMsg(e.getMessage()); - logger.error("",e); - } - m.put("tips", tips); - return m; - } - */ -} diff --git a/xm-core/src/main/java/com/xm/core/entity/XmIterationLink.java b/xm-core/src/main/java/com/xm/core/entity/XmIterationLink.java deleted file mode 100644 index 92723bef..00000000 --- a/xm-core/src/main/java/com/xm/core/entity/XmIterationLink.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.xm.core.entity; - -import lombok.Data; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; - -/** - * 组织 com 顶级模块 xm 大模块 core 小模块
- * 实体 XmIterationLink所有属性名:
- * "iterationId","迭代表主键","proId","产品或者项目表主键","ctime","创建时间","cuserid","创建人编号","cusername","创建人姓名","linkStatus","关联状态1关联0取消关联","ltype","关联类型0-项目,1-产品,为了简化,只关联产品,无须关联项目;项目通过产品关联";
- * 当前主键(包括多主键):
- * iteration_id,pro_id;
- */ - @Data -@ApiModel(description="迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表") -public class XmIterationLink implements java.io.Serializable { - - private static final long serialVersionUID = 1L; - - @ApiModelProperty(notes="迭代表主键,主键",allowEmptyValue=true,example="",allowableValues="") - String iterationId; - - @ApiModelProperty(notes="产品或者项目表主键,主键",allowEmptyValue=true,example="",allowableValues="") - String proId; - - - @ApiModelProperty(notes="创建时间",allowEmptyValue=true,example="",allowableValues="") - Date ctime; - - @ApiModelProperty(notes="创建人编号",allowEmptyValue=true,example="",allowableValues="") - String cuserid; - - @ApiModelProperty(notes="创建人姓名",allowEmptyValue=true,example="",allowableValues="") - String cusername; - - @ApiModelProperty(notes="关联状态1关联0取消关联",allowEmptyValue=true,example="",allowableValues="") - String linkStatus; - - @ApiModelProperty(notes="关联类型0-项目,1-产品,为了简化,只关联产品,无须关联项目;项目通过产品关联",allowEmptyValue=true,example="",allowableValues="") - String ltype; - - /** - *迭代表主键,产品或者项目表主键 - **/ - public XmIterationLink(String iterationId,String proId) { - this.iterationId = iterationId; - this.proId = proId; - } - - /** - * 迭代表与产品表的关联关系,一般由迭代管理员将迭代挂接到产品表 - **/ - public XmIterationLink() { - } - -} \ No newline at end of file diff --git a/xm-core/src/main/java/com/xm/core/service/XmGroupService.java b/xm-core/src/main/java/com/xm/core/service/XmGroupService.java index 2cf95e6b..b0fb243a 100644 --- a/xm-core/src/main/java/com/xm/core/service/XmGroupService.java +++ b/xm-core/src/main/java/com/xm/core/service/XmGroupService.java @@ -41,8 +41,6 @@ public class XmGroupService extends BaseService { @Autowired XmGroupCacheService groupCacheService; - @Autowired - XmIterationLinkService xmIterationLinkService; @Autowired XmProductProjectLinkService xmProductProjectLinkService; 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 deleted file mode 100644 index 348d247e..00000000 --- a/xm-core/src/main/java/com/xm/core/service/XmIterationLinkService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.xm.core.service; - -import com.mdp.core.service.BaseService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -/** - * 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.
- * 组织 com 顶级模块 xm 大模块 core 小模块
- * 实体 XmIterationLink 表 XM.xm_iteration_product_link 当前主键(包括多主键): iteration_id,product_id; - ***/ -@Service("xm.core.xmIterationLinkService") -public class XmIterationLinkService extends BaseService { - - - - - static Logger logger =LoggerFactory.getLogger(XmIterationLinkService.class); - - public List> listWithProductInfo(Map xmIterationLink) { - return super.selectList("listWithProductInfo",xmIterationLink); - } - - public List> listWithProjectInfo(Map xmIterationLink) { - return super.selectList("listWithProjectInfo",xmIterationLink); - } - /** 请在此类添加自定义函数 */ - - - -} - 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 80c1c133..23030063 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 @@ -2,7 +2,6 @@ package com.xm.core.service; import com.mdp.core.service.BaseService; import com.xm.core.vo.XmIterationVo; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -17,8 +16,6 @@ import java.util.Map; @Service("xm.core.xmIterationService") public class XmIterationService extends BaseService { - @Autowired - XmIterationLinkService xmIterationLinkService; @@ -44,11 +41,6 @@ public class XmIterationService extends BaseService { @Transactional public void addIteration(XmIterationVo xmIteration) { super.insert(xmIteration); - if(xmIteration.getLinks()!=null && xmIteration.getLinks().size()>0){ - - this.xmIterationLinkService.batchInsert(xmIteration.getLinks()); - } - } public String createIterationId( Long count){ diff --git a/xm-core/src/main/java/com/xm/core/vo/XmIterationVo.java b/xm-core/src/main/java/com/xm/core/vo/XmIterationVo.java index b3dbc881..5b14918a 100644 --- a/xm-core/src/main/java/com/xm/core/vo/XmIterationVo.java +++ b/xm-core/src/main/java/com/xm/core/vo/XmIterationVo.java @@ -1,21 +1,7 @@ package com.xm.core.vo; import com.xm.core.entity.XmIteration; -import com.xm.core.entity.XmIterationLink; - -import java.util.List; public class XmIterationVo extends XmIteration { - - - List links; - - public List getLinks() { - return links; - } - - public void setLinks(List links) { - this.links = links; - } } diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml deleted file mode 100644 index 09841522..00000000 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmIterationLinkMapper.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - and (res.iteration_id, res.pro_id) in - - ( #{item.iterationId}, #{item.proId}) - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into xm_iteration_link( - - ) values ( - #{iterationId},#{proId},#{ctime},#{cuserid},#{cusername},#{linkStatus},#{ltype} - ) - - - - - delete from xm_iteration_link res - - - - - - - - delete from xm_iteration_link - where iteration_id = #{iterationId} and pro_id = #{proId} - - - - - update xm_iteration_link - - - - where iteration_id = #{iterationId} and pro_id = #{proId} - - - - - update xm_iteration_link - - - - where iteration_id = #{iterationId} and pro_id = #{proId} - - - - - - - - update xm_iteration_link - set - - where iteration_id = #{item.iterationId} and pro_id = #{item.proId} - - - - - - update xm_iteration_link - - - - where (iteration_id, pro_id) in - - ( #{item.iterationId}, #{item.proId}) - - - - - delete from xm_iteration_link - where - (iteration_id, pro_id) in - - ( #{item.iterationId}, #{item.proId} ) - - - - - - - iteration_id,pro_id,ctime,cuserid,cusername,link_status,ltype - - - - - and res.iteration_id = #{iterationId} - and res.pro_id = #{proId} - and date_format(res.ctime,'%Y-%m-%d') = date_format(#{ctime},'%Y-%m-%d') - and res.cuserid = #{cuserid} - and res.cusername = #{cusername} - and res.link_status = #{linkStatus} - and res.ltype = #{ltype} - - - - ctime = #{ctime}, - cuserid = #{cuserid}, - cusername = #{cusername}, - link_status = #{linkStatus}, - ltype = #{ltype} - - - ctime = #{ctime}, - cuserid = #{cuserid}, - cusername = #{cusername}, - link_status = #{linkStatus}, - ltype = #{ltype}, - - - - ctime = #{item.ctime}, - cuserid = #{item.cuserid}, - cusername = #{item.cusername}, - link_status = #{item.linkStatus}, - ltype = #{item.ltype} - - \ No newline at end of file