|
@@ -1,6 +1,7 @@
|
|
|
package com.tofly.pms.testmanage.controller;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -17,6 +18,7 @@ import com.tofly.pms.testmanage.dto.BugInfoBatchDto;
|
|
|
import com.tofly.pms.testmanage.dto.BugUpdateDto;
|
|
|
import com.tofly.pms.testmanage.entity.BugInfo;
|
|
|
import com.tofly.pms.testmanage.entity.BugLog;
|
|
|
+import com.tofly.pms.testmanage.mapper.BugInfoMapper;
|
|
|
import com.tofly.pms.testmanage.service.BugInfoService;
|
|
|
import com.tofly.pms.testmanage.service.BugLogService;
|
|
|
import com.tofly.pms.testmanage.service.SystemItemService;
|
|
@@ -29,6 +31,8 @@ import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.DateFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -50,6 +54,8 @@ public class BugInfoController {
|
|
|
private SystemItemService systemItemService;
|
|
|
@Autowired
|
|
|
private ProjectTeamWService projectTeamWService;
|
|
|
+ @Autowired
|
|
|
+ private BugInfoMapper bugInfoMapper;
|
|
|
|
|
|
|
|
|
* 通过ID查询单条数据
|
|
@@ -72,14 +78,35 @@ public class BugInfoController {
|
|
|
*/
|
|
|
@ApiOperation("分页查询")
|
|
|
@GetMapping
|
|
|
- public ResponseEntity<Page<BugInfo>> paginQuery(BugInfo bugInfo, Page page) {
|
|
|
+ public ResponseEntity<Page<BugInfo>> paginQuery(BugInfo bugInfo, Page<BugInfo> page) {
|
|
|
String title = bugInfo.getTitle();
|
|
|
bugInfo.setTitle(null);
|
|
|
LambdaQueryWrapper<BugInfo> wrapper = new QueryWrapper<>(bugInfo).lambda()
|
|
|
.like(StringUtils.isNotBlank(title), BugInfo::getTitle, title)
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.orderByDesc(BugInfo::getCreateTime);
|
|
|
- final Page page1 = bugInfoService.page(page, wrapper);
|
|
|
+ final Page<BugInfo> page1 = bugInfoService.page(page, wrapper);
|
|
|
+ List<BugInfo> records = page1.getRecords();
|
|
|
+ if (CollectionUtil.isNotEmpty(records)) {
|
|
|
+ for (BugInfo record : records) {
|
|
|
+ String adviseDate = record.getAdviseTime();
|
|
|
+ Date startDate = null;
|
|
|
+ if (StringUtils.isNotBlank(adviseDate)) {
|
|
|
+ startDate = DateUtil.parse(adviseDate, "yyyy-MM-dd");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date nowDate = new Date();
|
|
|
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = df.format(nowDate);
|
|
|
+ nowDate = DateUtil.parse(format, "yyyy-MM-dd");
|
|
|
+ if (Objects.nonNull(startDate) && startDate.before(nowDate)) {
|
|
|
+ record.setTimeStatus(1);
|
|
|
+ } else {
|
|
|
+ record.setTimeStatus(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return ResponseEntity.ok(page1);
|
|
|
}
|
|
|
|
|
@@ -180,26 +207,26 @@ public class BugInfoController {
|
|
|
for (String s : split) {
|
|
|
Integer id = Integer.valueOf(s);
|
|
|
BugInfo byId = bugInfoService.getById(id);
|
|
|
- if(Objects.isNull(byId)){
|
|
|
+ if (Objects.isNull(byId)) {
|
|
|
continue;
|
|
|
}
|
|
|
- if(!Objects.equals(userID,byId.getCreateUser())){
|
|
|
+ if (!Objects.equals(userID, byId.getCreateUser())) {
|
|
|
Integer projectId = byId.getProjectId();
|
|
|
ProjectTeamW one = projectTeamWService.getOne(Wrappers.lambdaQuery(ProjectTeamW.class)
|
|
|
.eq(ProjectTeamW::getProjectId, projectId)
|
|
|
.and(wr -> wr.like(ProjectTeamW::getAdminId, userID)
|
|
|
.or()
|
|
|
.like(ProjectTeamW::getTestId, userID)));
|
|
|
- if(Objects.isNull(one)){
|
|
|
+ if (Objects.isNull(one)) {
|
|
|
RoleClient roleClient = SpringUtil.getBean(RoleClient.class);
|
|
|
Boolean has = roleClient.getHasRoleByUserId(userID, "所有功能");
|
|
|
- if(!has){
|
|
|
+ if (!has) {
|
|
|
throw new BusinessException("没有权限");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
byId.setDeleted(1);
|
|
|
- bugInfoService.updateById(byId);
|
|
|
+ bugInfoMapper.updateById(byId);
|
|
|
}
|
|
|
return ResponseEntity.ok(Boolean.TRUE);
|
|
|
}
|
|
@@ -232,7 +259,7 @@ public class BugInfoController {
|
|
|
Page<BugInfo> page1;
|
|
|
LambdaQueryWrapper<BugInfo> wrapper = Wrappers
|
|
|
.lambdaQuery(bugInfo)
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.like(BugInfo::getHeadId, tokenUserID)
|
|
|
.eq(StringUtils.isNotBlank(severity), BugInfo::getSeverity, severity)
|
|
|
.eq(StringUtils.isNotBlank(urgency), BugInfo::getUrgency, urgency)
|
|
@@ -265,6 +292,22 @@ public class BugInfoController {
|
|
|
Integer functionId = record.getFunctionId();
|
|
|
String name = systemItemService.getFullNameByFunctionId(functionId);
|
|
|
record.setFullFunctionName(name);
|
|
|
+
|
|
|
+ String adviseDate = record.getAdviseTime();
|
|
|
+ Date startDate = null;
|
|
|
+ if (StringUtils.isNotBlank(adviseDate)) {
|
|
|
+ startDate = DateUtil.parse(adviseDate, "yyyy-MM-dd");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date nowDate = new Date();
|
|
|
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String format = df.format(nowDate);
|
|
|
+ nowDate = DateUtil.parse(format, "yyyy-MM-dd");
|
|
|
+ if (Objects.nonNull(startDate) && startDate.before(nowDate)) {
|
|
|
+ record.setTimeStatus(1);
|
|
|
+ } else {
|
|
|
+ record.setTimeStatus(0);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return ResponseEntity.ok(page1);
|
|
@@ -319,7 +362,7 @@ public class BugInfoController {
|
|
|
}
|
|
|
final Page<BugInfo> page1 = bugInfoService.page(page,
|
|
|
Wrappers.lambdaQuery(bugInfo)
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.like(BugInfo::getSureId, tokenUserID)
|
|
|
.eq(BugInfo::getStatus, "2")
|
|
|
.in(CollectionUtil.isNotEmpty(bugIdList), BugInfo::getId, bugIdList));
|
|
@@ -358,16 +401,16 @@ public class BugInfoController {
|
|
|
}
|
|
|
List<BugInfo> list1 = bugInfoService.list(Wrappers.lambdaQuery(bugInfo)
|
|
|
.like(BugInfo::getSureId, tokenUserID)
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.eq(BugInfo::getStatus, "2"));
|
|
|
List<BugInfo> list2 = bugInfoService.list(Wrappers.lambdaQuery(bugInfo)
|
|
|
.like(BugInfo::getSureId, tokenUserID)
|
|
|
.eq(BugInfo::getStatus, "2")
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.in(BugInfo::getId, bugIdList2));
|
|
|
List<BugInfo> list3 = bugInfoService.list(Wrappers.lambdaQuery(bugInfo)
|
|
|
.like(BugInfo::getSureId, tokenUserID)
|
|
|
- .eq(BugInfo::getDeleted,0)
|
|
|
+ .eq(BugInfo::getDeleted, 0)
|
|
|
.eq(BugInfo::getStatus, "2")
|
|
|
.in(BugInfo::getId, bugIdList3));
|
|
|
Map<String, Integer> res = new LinkedHashMap<>(3);
|