需求任务添加bug列表

This commit is contained in:
2025-03-14 08:55:41 +08:00
parent 5496f18959
commit 11cec800ef
11 changed files with 556 additions and 407 deletions

View File

@ -3,10 +3,7 @@ package com.sa.zentao.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.sa.zentao.dao.BusinessException;
import com.sa.zentao.dao.Result;
import com.sa.zentao.dao.ZtProjectDTO;
import com.sa.zentao.dao.ZtStoryDTO;
import com.sa.zentao.dao.*;
import com.sa.zentao.entity.ZtProject;
import com.sa.zentao.entity.ZtProjectproduct;
import com.sa.zentao.qo.ZtProjectQo;
@ -181,6 +178,14 @@ public class ZtStoryController {
return Result.success();
}
//切换指派
@RequestMapping(value = "/storyListByUserStory", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
public Result storyListByUserStory(@RequestBody ZtStoryDTO dto){
List<ZtStoryDTO> list = ztStoryService.storyListByUserStory(dto);
return Result.success(list);
}
//迭代列表根据项目id
@RequestMapping(value = "/execListByProject", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")

View File

@ -113,4 +113,5 @@ public class ZtStoryUserController {
}
}

View File

@ -257,4 +257,5 @@ public class ZtStoryDTO implements Serializable {
private Integer releaseFlag=0;
private List<ZtBugDTO> bugList;
}

View File

@ -200,5 +200,5 @@ public class ZtTaskDTO implements Serializable {
private BigDecimal useTime;
private List<ZtBugDTO> bugList;
}

View File

@ -2,6 +2,7 @@ package com.sa.zentao.service;
import com.github.pagehelper.PageInfo;
import com.sa.zentao.dao.ZtStoryDTO;
import com.sa.zentao.dao.ZtStoryUserDTO;
import com.sa.zentao.entity.ZtProject;
import com.sa.zentao.entity.ZtStory;
import com.baomidou.mybatisplus.extension.service.IService;
@ -83,4 +84,6 @@ public interface IZtStoryService extends IService<ZtStory> {
Map<Integer,List<ZtProject>> getExecutionMapByStory(List<ZtStoryDTO> list);
void batchAddStory(ZtStoryDTO dto);
List<ZtStoryDTO> storyListByUserStory(ZtStoryDTO dto);
}

View File

@ -489,7 +489,7 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
result.put("project",pList);
if(!CollectionUtils.isEmpty(pList)){
List<ZtProjectproduct> productList = this.projectproductService.list(new QueryWrapper<ZtProjectproduct>().lambda().in(ZtProjectproduct::getProject
, pList.stream().map(o -> o.getProject()).collect(Collectors.toList())));
, pList.stream().map(o -> o.getId()).collect(Collectors.toList())));
if(CollectionUtils.isEmpty(productList)){
result.put("product",Arrays.asList());
}else{
@ -503,7 +503,7 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
Integer taskId = dto.getTaskId();
if(taskId!=null){
ZtTask task = this.taskService.getById(taskId);
result.put("task",task);
result.put("task",Arrays.asList(task));
Integer execution = task.getExecution();
Integer product = task.getProduct();
Integer project = task.getProject();
@ -512,8 +512,10 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
result.put("project",(project==null||project==0)?Arrays.asList():Arrays.asList(this.projectService.getById(project)));
result.put("execution",(execution==null||execution==0)?Arrays.asList():Arrays.asList(this.projectService.getById(execution)));
result.put("feedback",(feedback==null||feedback==0)?Arrays.asList():Arrays.asList(this.storyFeedbackService.getById(feedback)));
Integer story = task.getStory();
result.put("story",(story==null||story==0)?Arrays.asList():Arrays.asList(this.storyService.getById(story)));
}else{
result.put("task",null);
result.put("task",Arrays.asList());
}
@ -521,7 +523,7 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
Integer storyId = dto.getStoryId();
if(storyId!=null){
ZtStory ztStory = this.storyService.getById(storyId);
result.put("story",ztStory);
result.put("story",Arrays.asList(ztStory));
ZtProduct product = this.baseMapper.selectById(ztStory.getProduct());
result.put("product",Arrays.asList(product));
@ -534,8 +536,9 @@ public class ZtProductServiceImpl extends ServiceImpl<ZtProductMapper, ZtProduct
List<ZtProject> execList = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList()));
result.put("execution",execList);
}
}else{
result.put("story",null);
List<ZtTask> list = this.taskService.list(new QueryWrapper<ZtTask>().lambda()
.eq(ZtTask::getStory, storyId));
result.put("task",list);
}

View File

@ -604,7 +604,32 @@ public class ZtProjectServiceImpl extends ServiceImpl<ZtProjectMapper, ZtProject
//搜索执行根据产品 和 项目
@Override
public List<ZtProject> executionListByProduct(ZtProjectQo qo) {
return this.baseMapper.executionListByProduct(qo);
Integer productId = qo.getProductId();
Integer project = qo.getProject();
if(project!=null&&project!=0){
List<ZtExecutionproject> list = this.executionprojectService.list(new QueryWrapper<ZtExecutionproject>().lambda().eq(ZtExecutionproject::getProject, project));
if(!CollectionUtils.isEmpty(list)){
return this.listByIds(list.stream().map(o->o.getExecution()).collect(Collectors.toList()));
}
}
if(productId!=null&&productId!=0){
List<ZtProjectproduct> list = this.projectproductService.list(new QueryWrapper<ZtProjectproduct>()
.lambda().eq(ZtProjectproduct::getProduct, productId));
if(!CollectionUtils.isEmpty(list)){
List<ZtExecutionproject> eList = this.executionprojectService.list(new QueryWrapper<ZtExecutionproject>().lambda().
in(ZtExecutionproject::getProject, list.stream().map(o->o.getProject()).collect(Collectors.toList())));
if(!CollectionUtils.isEmpty(eList)){
return this.listByIds(eList.stream().map(o->o.getExecution()).collect(Collectors.toList()));
}
}
}
return new ArrayList<>();
}
@Override

View File

@ -94,8 +94,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
private IZtStoryUserService storyUserService;
@Override
public PageInfo<ZtStoryDTO> pageList(ZtProjectQo qo) {
Page<ZtStoryDTO> page = PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
@ -194,8 +192,8 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
fileService.updateFile(dto.getFiles(), s.getId(), FileTypes.story);
if(dto.getFeedbackId()!=null&&dto.getFeedbackId()!=0){
ZtStoryFeedback storyFeedback = this.storyFeedbackService.getById(dto.getFeedbackId());
if (dto.getFeedback() != null && dto.getFeedback() != 0) {
ZtStoryFeedback storyFeedback = this.storyFeedbackService.getById(dto.getFeedback());
if (!storyFeedback.getStatus().equals("wait")) {
throw new BusinessException("问题反馈已被处理");
}
@ -253,7 +251,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
}
private ZtStoryspec buildSpec(ZtStoryDTO dto, ZtStory s) {
@ -283,7 +280,7 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
}
s.setFeedback(dto.getFeedbackId());
s.setFeedback(dto.getFeedback());
s.setStage("wait");
return s;
}
@ -354,6 +351,61 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
@Override
public List<ZtStoryDTO> storyListByUserStory(ZtStoryDTO dto) {
Integer id = dto.getId();
List<ZtStory> list = this.list(new QueryWrapper<ZtStory>().lambda().eq(ZtStory::getUserStory, id));
if (!CollectionUtils.isEmpty(list)) {
List<ZtStoryDTO> storyDTOList = BeanCopyUtil.copyListProperties(list, ZtStoryDTO::new);
Map<String, ZtUser> userMap = this.userService.userMapByIds(null);
Map<Integer, List<ZtStoryreviewDTO>> rMap = getReviewMap(storyDTOList);
Map<Integer, List<ZtProject>> executionMapByStory = getExecutionMapByStory(storyDTOList);
for (ZtStoryDTO d : storyDTOList) {
d.setRevieweUser(d.getReviewedby().replaceAll(",", ""));
d.setViews(rMap.get(d.getId()));
ZtUser ztUser = userMap.get(d.getAssignedTo());
if (ztUser != null) {
d.setAssignedToName(ztUser.getNickname());
}
ztUser = userMap.get(d.getOpenedby());
if (ztUser != null) {
d.setOpenedbyName(ztUser.getNickname());
}
ztUser = userMap.get(d.getYsUser());
if (ztUser != null) {
d.setYsUserName(ztUser.getNickname());
}
List<ZtProject> ztProjectList = executionMapByStory.get(d.getId());
if (!CollectionUtils.isEmpty(ztProjectList)) {
// d.setExecution(ztProject.getId());
d.setExecutionName(ztProjectList.stream().map(o -> o.getName()).collect(Collectors.joining(",")));
d.setExecutions(ztProjectList.stream().map(o -> o.getId()).collect(Collectors.toList()));
}
if (!StringUtils.isEmpty(d.getReviewedby())) {
String[] split = d.getReviewedby().split(",");
StringBuilder b = new StringBuilder();
for (String s : split) {
ZtUser u = userMap.get(s);
if (u != null) {
b.append(u.getNickname() + ",");
}
}
d.setReviewedbyName(b.toString());
}
}
return storyDTOList;
}
return new ArrayList<>();
}
@Override
@Transactional
@ -447,7 +499,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
String stage = ztStory.getStage();
if (!StringUtils.isEmpty(stage) && !StringUtils.isEmpty(dto.getStage()) && !stage.equals(dto.getStage())) {
ZtStoryDTO s = new ZtStoryDTO();
@ -486,8 +537,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
}
@ -501,8 +550,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
.in(ZtExecutionproject::getExecution, execList));
for (Integer execId : execList) {
List<ZtExecutionproject> fProjectList = execProjectList.stream()
.filter(o -> o.getExecution().intValue() == execId.intValue()).collect(Collectors.toList());
@ -755,8 +802,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
@Override
public List<ZtStoryDTO> execNoSyncProject(ZtProjectQo qo) {
String execution = qo.getExecution();
@ -1264,8 +1309,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
public void changeExecution(ZtStoryDTO dto) {
List<Integer> idList = dto.getIdList();
if (CollectionUtils.isEmpty(idList)) {
throw new BusinessException("请选择");
@ -1391,10 +1434,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
if (!CollectionUtils.isEmpty(list)) {
Map<Integer, List<ZtStoryreviewDTO>> rMap = getReviewMap(list);
@ -1434,7 +1473,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
private void closeTaskBug(Integer i) {
List<ZtTask> taskList = this.taskService.list(new QueryWrapper<ZtTask>().lambda().eq(ZtTask::getStory, i).ne(ZtTask::getStatus, "closed"));
@ -1567,6 +1605,7 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
actionService.addAction(ActionType.XQ, ActionStatus.PS, ztStory.getId(), ztStory.getProduct() + "", null, null,
RiskUserThreadLocal.get().getName(), dto.getDesc(), ztStory.getAssignedTo());
}
//验收
@Override
@Transactional
@ -1654,7 +1693,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
Map<String, ZtUser> userMap = this.userService.userMapByIds(null);
@ -1735,9 +1773,55 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
if (ztUser != null) {
ztStoryUserDTO.setAssignedtoName(ztUser.getNickname());
}
Integer parent = ztStoryUserDTO.getParent();
if(parent!=null&&parent!=0){
ZtStoryUser ztStoryUser = this.storyUserService.getById(parent);
if(ztStoryUser!=null){
ztStoryUserDTO.setParentName(ztStoryUser.getTitle());
}
}
Integer product = ztStoryUserDTO.getProduct();
if(product!=null&&product!=0){
ZtProduct ztProduct = this.productService.getById(product);
ztStoryUserDTO.setProductName(ztProduct.getName());
}
Integer module = ztStoryUserDTO.getModule();
if(module!=null&&module!=0){
ZtModule ztModule = this.moduleService.getById(module);
ztStoryUserDTO.setModuleName(ztModule.getName());
}
d.setUserStoryInfo(ztStoryUserDTO);
}
List<ZtBug> bugs = this.bugService.list(new QueryWrapper<ZtBug>().lambda().eq(ZtBug::getTostory, d.getId()));
if(!CollectionUtils.isEmpty(bugs)){
List<ZtBugDTO> ztBugDTOS = BeanCopyUtil.copyListProperties(bugs, ZtBugDTO::new);
if(!CollectionUtils.isEmpty(ztBugDTOS)){
for (ZtBugDTO bug:ztBugDTOS) {
ztUser = userMap.get(bug.getOpenedby());
if(ztUser!=null){
bug.setOpenedbyName(ztUser.getNickname());
}
ztUser = userMap.get(bug.getAssignedTo());
if(ztUser!=null){
bug.setAssignedToName(ztUser.getNickname());
}
ztUser = userMap.get(bug.getYsUser());
if(ztUser!=null){
bug.setYsUserName(ztUser.getNickname());
}
}
}
d.setBugList(ztBugDTOS);
}
return d;
}
@ -1760,7 +1844,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
@Override
public void userReview(ZtStoryDTO dto) {
ZtStory ztStory = this.baseMapper.selectById(dto.getId());
@ -1888,7 +1971,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
@Override
public List<ZtStoryDTO> storyListByExecution(ZtProjectQo qo) {
List<ZtProjectstory> list = projectstoryService.list(new QueryWrapper<ZtProjectstory>().lambda().eq(ZtProjectstory::getProject, qo.getId())
@ -1908,7 +1990,6 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
}
public ProductStoryStatus getProductStatus(String status) {

View File

@ -171,7 +171,6 @@ public class ZtStoryUserServiceImpl extends ServiceImpl<ZtStoryUserMapper, ZtSto
Map<Integer, List<ZtStory>> storyUserMap = getStoryUserMap(list);
Map<Integer, List<ZtStoryreviewDTO>> rMap = getReviewMap(list);
for (ZtStoryUserDTO d : list) {
if(!StringUtils.isEmpty(d.getReviewedby())){
@ -375,6 +374,7 @@ public class ZtStoryUserServiceImpl extends ServiceImpl<ZtStoryUserMapper, ZtSto
}
}
if(dto.getModule()!=null&&dto.getModule()!=0){
ZtModule ztModule = this.moduleService.getById(dto.getModule());
if(ztModule!=null){
@ -415,7 +415,7 @@ public class ZtStoryUserServiceImpl extends ServiceImpl<ZtStoryUserMapper, ZtSto
dto.setSList(storyDTOList);
}
}
dto.setViews(rMap.get(d.getId()));
return dto;
}

View File

@ -72,6 +72,9 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
@Autowired
private IZtExecutionprojectService executionprojectService;
@Autowired
private IZtBugService bugService;
@Override
public PageInfo<ZtTaskDTO> taskPageList(ZtProjectQo qo) {
@ -233,6 +236,30 @@ public class ZtTaskServiceImpl extends ServiceImpl<ZtTaskMapper, ZtTask> impleme
if (ztUser != null) {
dto.setAssignedToName(ztUser.getNickname());
}
List<ZtBug> list = this.bugService.list(new QueryWrapper<ZtBug>().lambda().eq(ZtBug::getTotask, id));
if(!CollectionUtils.isEmpty(list)){
List<ZtBugDTO> ztBugDTOS = BeanCopyUtil.copyListProperties(list, ZtBugDTO::new);
for (ZtBugDTO bug:ztBugDTOS) {
ztUser = userMap.get(bug.getOpenedby());
if(ztUser!=null){
bug.setOpenedbyName(ztUser.getNickname());
}
ztUser = userMap.get(bug.getAssignedTo());
if(ztUser!=null){
bug.setAssignedToName(ztUser.getNickname());
}
ztUser = userMap.get(bug.getYsUser());
if(ztUser!=null){
bug.setYsUserName(ztUser.getNickname());
}
}
dto.setBugList(ztBugDTOS);
}else{
dto.setBugList(Arrays.asList());
}
return dto;
}

View File

@ -175,13 +175,14 @@
select s.*,sp.spec ,sp.verify,sp.files,pt.name productName from (zt_story s,zt_projectstory ps ) left join zt_storyspec sp on s.id = sp.story
select s.*,sp.spec ,sp.verify,sp.files,pt.name productName from zt_story s left join zt_storyspec sp on s.id = sp.story
left join zt_storyreview v on s.id = v.story and s.version = v.version
left join zt_projectstory pstory on s.id = pstory.story and pstory.execution =0
left join zt_project pj on pstory.project = pj.id
left join zt_product pt on s.product = pt.id
WHERE s.id = ps.story
left join zt_projectstory ps on s.id = ps.story
WHERE 1=1
<if test="qo.startDate !=null">
@ -199,9 +200,11 @@
<if test="qo.project != null ">
and ps.project =#{qo.project}
and ps.type= 'project'
</if>
<if test="qo.execution != null ">
and ps.project =#{qo.execution}
and ps.type= 'execution'
</if>
<if test="qo.module != null ">
and s.module =#{qo.module}
@ -271,7 +274,7 @@
</if>
<if test="qo.searchVal != null and qo.searchVal == 'YWGB' ">
and s.status ='closed'
and closedBy =#{qo.userName}
and s.closedBy =#{qo.userName}
</if>