看板,导出迭代,等

This commit is contained in:
2026-01-27 16:30:21 +08:00
parent 0e7e291f50
commit ea575012a8
10 changed files with 141 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import com.sa.zentao.entity.ZtStoryUser;
import com.sa.zentao.enums.StoryStageEnums;
import com.sa.zentao.enums.StoryStatusEnums;
import com.sa.zentao.enums.UserStoryEnums;
import com.sa.zentao.mapper.ZtProjectMapper;
import com.sa.zentao.qo.SearchQo;
import com.sa.zentao.qo.StoryQo;
import com.sa.zentao.qo.ZtProjectQo;
@@ -64,6 +65,8 @@ public class ZtStoryController {
@Value("${file.backUrl}")
private String url;
@Autowired
private ZtProjectMapper ztProjectMapper;
@RequestMapping(value = "/pageList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
public Result<ZtStoryDTO> storyPageList(@RequestBody ZtProjectQo qo){
@@ -179,6 +182,47 @@ public class ZtStoryController {
}
@RequestMapping(value = "/projectStoryExport", method = RequestMethod.POST)
public void projectStoryExport(@RequestBody ZtProjectQo qo, jakarta.servlet.ServletResponse response){
qo.setPageSize(ExportConstants.MAX_EXPORT_SIZE);
PageInfo<ZtStoryDTO> p = ztStoryService.projectStoryPageList(qo);
List<ZtStoryDTO> list = p.getList();
List<ProjectStoryExportDTO> exportList = new java.util.ArrayList<>();
for (ZtStoryDTO dto : list) {
ProjectStoryExportDTO exportDTO = new ProjectStoryExportDTO();
exportDTO.setId(dto.getId());
exportDTO.setTitle(dto.getTitle());
exportDTO.setPri(dto.getPri());
exportDTO.setStatus(StoryStatusEnums.transfer(dto.getStatus()) == null ? null : StoryStatusEnums.transfer(dto.getStatus()).getDesc());
exportDTO.setPlanEndDate(dto.getPlanEndDate());
exportDTO.setStage(StoryStageEnums.transfer(dto.getStage()) == null ? null : StoryStageEnums.transfer(dto.getStage()).getDesc());
exportDTO.setAssignedToName(dto.getAssignedToName());
exportDTO.setYsUserName(dto.getYsUserName());
exportDTO.setTaskCount(dto.getTaskCount());
exportDTO.setOpenedbyName(dto.getOpenedbyName());
exportDTO.setOpeneddate(dto.getOpeneddate());
exportList.add(exportDTO);
}
ExcelWriter excelWriter = null;
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
try {
excelWriter = EasyExcel.write(response.getOutputStream())
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.needHead(Boolean.TRUE).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0, ExportConstants.SHEET_NAME)
.head(ProjectStoryExportDTO.class)
.needHead(Boolean.TRUE).build();
excelWriter.write(exportList, writeSheet);
excelWriter.finish();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@RequestMapping(value = "/myStoryPageList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
public Result<ZtStoryDTO> myStoryPageList(@RequestBody ZtProjectQo qo){
@@ -339,9 +383,7 @@ public class ZtStoryController {
return Result.success(searchDTOPageInfo);
}
//迭代列表根据项目id
//迭代列表根据项目id 或者产品id
@RequestMapping(value = "/execListByProject", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
public Result execListByProject(@RequestBody ZtStoryDTO dto){
if(dto.getProduct()!=null){

View File

@@ -0,0 +1,52 @@
package com.sa.zentao.dao;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 项目需求导出DTO
* 表头: ID 研发需求名称 P 状态 期望完成时间 阶段 指派给 验收人 任务量 创建者 创建日期
*
* @author gqb
*/
@Data
public class ProjectStoryExportDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "ID", index = 0)
private Integer id;
@ExcelProperty(value = "研发需求名称", index = 1)
private String title;
@ExcelProperty(value = "P", index = 2)
private Integer pri;
@ExcelProperty(value = "状态", index = 3)
private String status;
@ExcelProperty(value = "期望完成时间", index = 4)
private Date planEndDate;
@ExcelProperty(value = "阶段", index = 5)
private String stage;
@ExcelProperty(value = "指派给", index = 6)
private String assignedToName;
@ExcelProperty(value = "验收人", index = 7)
private String ysUserName;
@ExcelProperty(value = "任务量", index = 8)
private Integer taskCount;
@ExcelProperty(value = "创建者", index = 9)
private String openedbyName;
@ExcelProperty(value = "创建日期", index = 10)
private Date openeddate;
}

View File

@@ -31,6 +31,10 @@ public class StoryQo extends BaseQo {
private List<String> statusList;
private String ids;
/**
* 迭代
*/
private Integer execution;
private List<String> storyIds;
}

View File

@@ -77,7 +77,11 @@ public interface IZtStoryService extends IService<ZtStory> {
void storyYs(ZtStoryDTO dto);
ZtStoryDTO getStoryById(Integer id,Integer execution);
/**
* 迭代 跟进项目
* @param dto
* @return
*/
List<ZtProject> execListByProject(ZtStoryDTO dto);
void changeAssignedTo(ZtStoryDTO dto);

View File

@@ -233,7 +233,7 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl<ZtKanbanlaneMapper, ZtK
ZtKanbancell fromkanbancell = this.kanbancellService.getOne(new QueryWrapper<ZtKanbancell>().lambda()
.eq(ZtKanbancell::getColumn, fromId));
List<String> carIds = new ArrayList<>(Arrays.asList(fromkanbancell.getCards().split(",")));
Set<String> carIds = new HashSet<>(Arrays.asList(fromkanbancell.getCards().split(",")));
carIds.remove(qo.getId().toString());
@@ -249,7 +249,7 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl<ZtKanbanlaneMapper, ZtK
if(StringUtils.isEmpty(tokanbancell.getCards())){
tokanbancell.setCards(qo.getId().toString());
}else{
carIds = new ArrayList<>(Arrays.asList(tokanbancell.getCards().split(",")));
carIds = new HashSet<>(Arrays.asList(tokanbancell.getCards().split(",")));
carIds.add(qo.getId().toString());
tokanbancell.setCards(StringUtils.join(carIds,","));
}

View File

@@ -1118,7 +1118,7 @@ public class ZtProjectServiceImpl extends ServiceImpl<ZtProjectMapper, ZtProject
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()));
return this.list(new QueryWrapper<ZtProject>().lambda().in(ZtProject::getId,list.stream().map(o->o.getExecution()).collect(Collectors.toList())).orderByDesc(ZtProject::getId));
}
}
@@ -1130,7 +1130,7 @@ public class ZtProjectServiceImpl extends ServiceImpl<ZtProjectMapper, ZtProject
in(ZtExecutionproject::getProject, list.stream().map(o->o.getProject()).collect(Collectors.toList())));
if(!CollectionUtils.isEmpty(eList)){
return this.list(new QueryWrapper<ZtProject>().lambda().in(ZtProject::getId,eList.stream().map(o->o.getExecution()).collect(Collectors.toList()))
.ne(ZtProject::getStatus,"closed").ne(ZtProject::getDeleted,"1")
.ne(ZtProject::getStatus,"closed").ne(ZtProject::getDeleted,"1").orderByDesc(ZtProject::getId)
);
}
}

View File

@@ -502,6 +502,8 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
Integer id = dto.getId();
ZtStory ztStory = this.baseMapper.selectById(id);
String oldAssignedTo = ztStory.getAssignedTo();
String title = dto.getTitle();
String oldTitle = ztStory.getTitle();
if ("closed".equals(ztStory.getStatus())) {
throw new BusinessException("当前已关闭");
}
@@ -654,7 +656,10 @@ public class ZtStoryServiceImpl extends ServiceImpl<ZtStoryMapper, ZtStory> impl
actionService.addAction(ActionType.XQ, ActionStatus.BJ, dto.getId(), dto.getProduct() + "", dto.getProject(), null,
RiskUserThreadLocal.get().getName(), dto.getRemark(), "");
}
if(!title.equals(oldTitle)){
actionService.addAction(ActionType.XQ, ActionStatus.BJ, dto.getId(), dto.getProduct() + "", dto.getProject(), null,
RiskUserThreadLocal.get().getName(), oldTitle +" 修改为 -> "+title, "");
}
storySendZpMessage(ztStory.getId(), oldAssignedTo, ztStory.getAssignedTo());
}

View File

@@ -151,7 +151,8 @@ public class ZtStoryUserServiceImpl extends ServiceImpl<ZtStoryUserMapper, ZtSto
public void editStory(ZtStoryUserDTO dto) {
Integer id = dto.getId();
ZtStoryUser ztStory = this.baseMapper.selectById(id);
String title = dto.getTitle();
String oldTitle = ztStory.getTitle();
String storyStatus = ztStory.getStatus();
@@ -167,7 +168,10 @@ public class ZtStoryUserServiceImpl extends ServiceImpl<ZtStoryUserMapper, ZtSto
actionService.addAction(ActionType.USERXQ, ActionStatus.BJ, dto.getId(), dto.getProduct() + "", dto.getProject(), null,
RiskUserThreadLocal.get().getName(), dto.getRemark(), "");
if(!title.equals(oldTitle)) {
actionService.addAction(ActionType.USERXQ, ActionStatus.BJ, dto.getId(), dto.getProduct() + "", dto.getProject(), null,
RiskUserThreadLocal.get().getName(), oldTitle +"修改为 -> "+title, "");
}
BeanUtils.copyProperties(dto, ztStory, "status");
ztStory.setLasteditedby(RiskUserThreadLocal.get().getName());

View File

@@ -932,6 +932,12 @@
from zt_story s
left join zt_product pt on s.product = pt.id
left join zt_storyreview v on s.id = v.story and s.version = v.version
<if test="qo.project != null or qo.execution != null">
left join zt_projectstory ps on s.id = ps.story
</if>
WHERE 1=1
@@ -1000,11 +1006,15 @@
</if>
<if test="qo.project != null ">
and ps.type ='project'
and ps.project =#{qo.project}
</if>
<if test="qo.execution != null ">
and ps.type ='execution'
and ps.execution =#{qo.execution}
</if>
<if test="qo.module != null ">
and s.module =#{qo.module}
</if>

View File

@@ -152,6 +152,15 @@
</if>
<if test="qo.execution !=null">
and s.id in (
SELECT DISTINCT st.user_story from zt_story st INNER JOIN zt_projectstory ps on st.id = ps.story and ps.type = 'execution'
WHERE st.`status` not in ('closed')
and st.user_story is not null
and ps.project = #{qo.execution}
)
</if>
<if test="qo.startDate !=null">
and s.openedDate <![CDATA[>=]]> #{qo.startDate}
</if>