From cba93c7d2b2d2b92be45aff6360887e5513c1928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=85=B6=E5=85=B5?= Date: Wed, 7 May 2025 11:19:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E7=BB=A9=E6=95=88=E8=80=83?= =?UTF-8?q?=E6=A0=B8=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/sa/zentao/conf/CodeGenerator.java | 2 +- .../zentao/controller/ZtCountController.java | 36 +- .../controller/ZtMonthScoreController.java | 37 + .../controller/ZtReleaseController.java | 6 + .../controller/ZtStoryFeedbackController.java | 4 +- .../controller/ZtStoryUserController.java | 3 + .../com/sa/zentao/dao/PerformanceDTO.java | 107 +- .../com/sa/zentao/dao/ProgramCountDTO.java | 157 + .../sa/zentao/dao/ProjectWorkDetailsDTO.java | 4 +- .../com/sa/zentao/dao/WorkDetailsDTO.java | 8 + src/main/java/com/sa/zentao/dao/ZtBugDTO.java | 3 + .../sa/zentao/dao/ZtComputerSourceDTO.java | 1 + .../java/com/sa/zentao/dao/ZtMeetingDTO.java | 4 + .../com/sa/zentao/dao/ZtMonthScopeDTO.java | 44 + .../java/com/sa/zentao/dao/ZtStoryDTO.java | 9 +- .../com/sa/zentao/dao/ZtStoryFeedbackDTO.java | 2 + .../java/com/sa/zentao/dao/ZtTaskDTO.java | 2 + src/main/java/com/sa/zentao/entity/ZtBug.java | 5 + .../sa/zentao/entity/ZtComputerSource.java | 2 + .../java/com/sa/zentao/entity/ZtMeeting.java | 4 + .../com/sa/zentao/entity/ZtMonthScore.java | 47 + .../java/com/sa/zentao/entity/ZtStory.java | 13 +- .../com/sa/zentao/entity/ZtStoryFeedback.java | 4 +- .../com/sa/zentao/enums/ActionStatus.java | 3 +- .../java/com/sa/zentao/enums/ActionType.java | 2 + .../com/sa/zentao/mapper/ZtBugMapper.java | 4 + .../sa/zentao/mapper/ZtMonthScoreMapper.java | 16 + .../com/sa/zentao/mapper/ZtTaskMapper.java | 12 +- src/main/java/com/sa/zentao/qo/ZtBugQo.java | 1 + .../com/sa/zentao/qo/ZtComputerSourceQo.java | 2 + .../java/com/sa/zentao/qo/ZtProjectQo.java | 2 + .../java/com/sa/zentao/qo/ZtReleaseQo.java | 6 +- .../com/sa/zentao/service/IZtBugService.java | 7 + .../zentao/service/IZtMonthScoreService.java | 18 + .../sa/zentao/service/IZtProjectService.java | 3 + .../sa/zentao/service/IZtReleaseService.java | 3 + .../sa/zentao/service/IZtStoryService.java | 3 + .../com/sa/zentao/service/IZtTaskService.java | 30 +- .../zentao/service/impl/IZtCountService.java | 2513 +++++++++-------- .../zentao/service/impl/ZtBugServiceImpl.java | 58 +- .../service/impl/ZtKanbanlaneServiceImpl.java | 11 +- .../service/impl/ZtMeetingServiceImpl.java | 14 +- .../service/impl/ZtMonthScoreServiceImpl.java | 70 + .../service/impl/ZtProductServiceImpl.java | 39 +- .../service/impl/ZtProjectServiceImpl.java | 107 +- .../service/impl/ZtReleaseServiceImpl.java | 126 +- .../impl/ZtStoryFeedbackServiceImpl.java | 89 +- .../service/impl/ZtStoryServiceImpl.java | 267 +- .../service/impl/ZtStoryUserServiceImpl.java | 49 +- .../service/impl/ZtTaskServiceImpl.java | 208 +- .../java/com/sa/zentao/utils/DateUtils.java | 24 +- .../com/sa/zentao/utils/SFunctionColums.java | 47 + .../java/com/sa/zentao/utils/SendEmail.java | 111 +- src/main/resources/application-local.yml | 2 +- src/main/resources/application.yml | 7 +- src/main/resources/mapper/ZtBugMapper.xml | 358 ++- src/main/resources/mapper/ZtMeetingMapper.xml | 16 +- .../resources/mapper/ZtMonthScopeMapper.xml | 15 + .../mapper/ZtReleaseDetailsMapper.xml | 136 +- .../mapper/ZtStoryFeedbackMapper.xml | 32 +- src/main/resources/mapper/ZtStoryMapper.xml | 368 ++- .../resources/mapper/ZtStoryUserMapper.xml | 75 +- .../mapper/ZtStoryUserTaskMapper.xml | 27 +- src/main/resources/mapper/ZtTaskMapper.xml | 375 ++- 64 files changed, 4005 insertions(+), 1755 deletions(-) create mode 100644 src/main/java/com/sa/zentao/controller/ZtMonthScoreController.java create mode 100644 src/main/java/com/sa/zentao/dao/ProgramCountDTO.java create mode 100644 src/main/java/com/sa/zentao/dao/ZtMonthScopeDTO.java create mode 100644 src/main/java/com/sa/zentao/entity/ZtMonthScore.java create mode 100644 src/main/java/com/sa/zentao/mapper/ZtMonthScoreMapper.java create mode 100644 src/main/java/com/sa/zentao/service/IZtMonthScoreService.java create mode 100644 src/main/java/com/sa/zentao/service/impl/ZtMonthScoreServiceImpl.java create mode 100644 src/main/java/com/sa/zentao/utils/SFunctionColums.java create mode 100644 src/main/resources/mapper/ZtMonthScopeMapper.xml diff --git a/src/main/java/com/sa/zentao/conf/CodeGenerator.java b/src/main/java/com/sa/zentao/conf/CodeGenerator.java index e2c59fb..2834484 100644 --- a/src/main/java/com/sa/zentao/conf/CodeGenerator.java +++ b/src/main/java/com/sa/zentao/conf/CodeGenerator.java @@ -22,7 +22,7 @@ public class CodeGenerator { //自己的名字 static String Author = "gqb"; - public static String tableName = "base_user_role"; + public static String tableName = "zt_month_scope"; /** *

diff --git a/src/main/java/com/sa/zentao/controller/ZtCountController.java b/src/main/java/com/sa/zentao/controller/ZtCountController.java index 0f5e3de..ea36598 100644 --- a/src/main/java/com/sa/zentao/controller/ZtCountController.java +++ b/src/main/java/com/sa/zentao/controller/ZtCountController.java @@ -155,17 +155,14 @@ public class ZtCountController { } - //系统需求 - -// @RequestMapping(value = "/projectInfoById", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") -// public Result storyFeedbackCount(@RequestBody ZtCaseDTO dto){ -// -// ZtStoryCountDTO result=countService.storyFeedbackCount(dto); -// -// return Result.success(result) ; -// } - + @RequestMapping(value = "/myWorkScore", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result myWorkScore(@RequestBody ZtProjectQo qo){ + if(qo.getDate()==null){ + throw new BusinessException("请选择日期"); + } + return Result.success(countService.myWorkScore(qo)); + } //我的需求列表 @RequestMapping(value = "/myStoryList", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Result myStoryList(@RequestBody ZtProjectQo qo){ @@ -197,4 +194,23 @@ public class ZtCountController { public Result myDevops(@RequestBody ZtProjectQo qo){ return Result.success(countService.myDevops(qo)); } + + //柱状图需求 + @RequestMapping(value = "/storyBarChart", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result> storyBarChart(@RequestBody ZtProjectQo qo){ + return Result.success(countService.storyBarChart(qo)); + } + //柱状图BUG + @RequestMapping(value = "/bugBarChart", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result> bugBarChart(@RequestBody ZtProjectQo qo){ + return Result.success(countService.bugBarChart(qo)); + } + + + //绩效统计根据产品集 + @RequestMapping(value = "/monthScopeByProgram", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result> monthScopeByProgram(@RequestBody ZtProjectQo qo){ + return Result.success(countService.monthScopeByProgram(qo)); + } + } diff --git a/src/main/java/com/sa/zentao/controller/ZtMonthScoreController.java b/src/main/java/com/sa/zentao/controller/ZtMonthScoreController.java new file mode 100644 index 0000000..7281063 --- /dev/null +++ b/src/main/java/com/sa/zentao/controller/ZtMonthScoreController.java @@ -0,0 +1,37 @@ +package com.sa.zentao.controller; + + +import com.sa.zentao.dao.PerformanceDTO; +import com.sa.zentao.dao.Result; +import com.sa.zentao.dao.ZtMeetingDTO; +import com.sa.zentao.dao.ZtMonthScopeDTO; +import com.sa.zentao.service.IZtMonthScoreService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author gqb + * @since 2025-04-24 + */ +@RestController +@RequestMapping("/zt-month-scope") +public class ZtMonthScoreController { + @Autowired + private IZtMonthScoreService monthScoreService; + + @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result save(@RequestBody PerformanceDTO dto){ + monthScoreService.saveScope(dto); + return Result.success(); + } + + +} diff --git a/src/main/java/com/sa/zentao/controller/ZtReleaseController.java b/src/main/java/com/sa/zentao/controller/ZtReleaseController.java index 2711672..a7d2248 100644 --- a/src/main/java/com/sa/zentao/controller/ZtReleaseController.java +++ b/src/main/java/com/sa/zentao/controller/ZtReleaseController.java @@ -139,6 +139,12 @@ public class ZtReleaseController { releaseService.release(dto); return Result.success(); } + //催促验收 + @RequestMapping(value = "/urgeYs", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") + public Result urgeYs(@RequestBody ZtReleaseQo qo){ + releaseService.urgeYs(qo); + return Result.success(); + } @RequestMapping(value = "/closeRelease", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Result closeRelease(@RequestBody ZtReleaseQo dto){ diff --git a/src/main/java/com/sa/zentao/controller/ZtStoryFeedbackController.java b/src/main/java/com/sa/zentao/controller/ZtStoryFeedbackController.java index b59c2fe..42dbfd3 100644 --- a/src/main/java/com/sa/zentao/controller/ZtStoryFeedbackController.java +++ b/src/main/java/com/sa/zentao/controller/ZtStoryFeedbackController.java @@ -84,7 +84,9 @@ public class ZtStoryFeedbackController { @RequestMapping(value = "/list", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") public Result list(@RequestBody ZtStoryFeedbackDTO dto){ List waitList = storyFeedbackService.list(new QueryWrapper() - .lambda().eq(ZtStoryFeedback::getStatus, "wait")); + .lambda() + .select() + .eq(ZtStoryFeedback::getStatus, "wait")); return Result.success(waitList); diff --git a/src/main/java/com/sa/zentao/controller/ZtStoryUserController.java b/src/main/java/com/sa/zentao/controller/ZtStoryUserController.java index d57146b..24b1601 100644 --- a/src/main/java/com/sa/zentao/controller/ZtStoryUserController.java +++ b/src/main/java/com/sa/zentao/controller/ZtStoryUserController.java @@ -90,6 +90,9 @@ public class ZtStoryUserController { }else { eq.in(ZtStoryUser::getStatus, UserStoryEnums.CFM.getCode(),UserStoryEnums.KFZ.getCode()); } + eq.select(ZtStoryUser::getId,ZtStoryUser::getTitle,ZtStoryUser::getProduct, + ZtStoryUser::getOpenedby,ZtStoryUser::getAssignedto + ); List list = storyUserService.list(eq ); return Result.success(list); diff --git a/src/main/java/com/sa/zentao/dao/PerformanceDTO.java b/src/main/java/com/sa/zentao/dao/PerformanceDTO.java index f2d232d..210f4fb 100644 --- a/src/main/java/com/sa/zentao/dao/PerformanceDTO.java +++ b/src/main/java/com/sa/zentao/dao/PerformanceDTO.java @@ -7,11 +7,16 @@ import lombok.EqualsAndHashCode; import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) public class PerformanceDTO implements Serializable { + @ExcelIgnore + private Date date; + + private Integer id ; @ExcelProperty(value = "姓名",index =0) private String userName; //任务总量 @@ -23,12 +28,7 @@ public class PerformanceDTO implements Serializable { // 小时 @ExcelIgnore private BigDecimal approvalDays; - //发布验收绩效 - @ExcelIgnore - private BigDecimal releaseScore=BigDecimal.ZERO; - //会议绩效 - @ExcelIgnore - private BigDecimal meetScore=BigDecimal.ZERO; + //拆分任务工时 @ExcelIgnore @@ -39,12 +39,11 @@ public class PerformanceDTO implements Serializable { //可用工时 6*工作天数 @ExcelProperty(value = "达标工时 ",index =4) //达标 考核工时 - private BigDecimal examineTime; - //工作饱和度 + private BigDecimal examineTime=BigDecimal.ZERO; @ExcelProperty(value = "产出工时 ",index =5) - private BigDecimal workTime; + private BigDecimal workTime=BigDecimal.ZERO;; @ExcelProperty(value = "分配工时 ",index =6) - private BigDecimal allocationTime; + private BigDecimal allocationTime=BigDecimal.ZERO; @ExcelProperty(value = "工作饱和率 ",index =7) private BigDecimal saturation; @ExcelProperty(value = "饱和率得分 ",index =8) @@ -52,10 +51,13 @@ public class PerformanceDTO implements Serializable { @ExcelProperty(value = "延期任务 ",index =9) private BigDecimal delayTask; + //总任务 + @ExcelIgnore + private BigDecimal totalTask=BigDecimal.ZERO;; @ExcelProperty(value = "完成任务 ",index =10) private BigDecimal finishTask; @ExcelProperty(value = "完成准时率 ",index =11) - private BigDecimal finishPunctuality; + private BigDecimal finishPunctuality=BigDecimal.ZERO;; @ExcelProperty(value = "准时率得分 ",index =12) private BigDecimal punctualityScore=BigDecimal.ZERO; @ExcelProperty(value = "线上严重bug ",index =13) @@ -63,15 +65,98 @@ public class PerformanceDTO implements Serializable { //缺陷检出率 @ExcelIgnore private BigDecimal bugFindScore; + //缺陷检出率得分 + private BigDecimal bugFindRate; //产出线上Bug @ExcelProperty(value = "线上普通bug ",index =14) private BigDecimal slightBug; @ExcelIgnore private BigDecimal bugCount=BigDecimal.ZERO; + //bug密度 + @ExcelIgnore + private BigDecimal bugDensity=BigDecimal.ZERO; //线上Bug得分 @ExcelProperty(value = "线上Bug得分 ",index =15) private BigDecimal bugScore=BigDecimal.ZERO; + + + //普通bug + private BigDecimal devSlightBug; + //严重bug + private BigDecimal devSeriousBug; + private BigDecimal devBugScore; //产出线上Bug @ExcelProperty(value = "总分 ",index =16) private BigDecimal score; + //工作态度 + @ExcelIgnore + private BigDecimal workAttitude=BigDecimal.ZERO; + //优秀分享 创新贡献 + @ExcelIgnore + private BigDecimal excellentShare=BigDecimal.ZERO; + + //质量贡献 + @ExcelIgnore + private BigDecimal quality=BigDecimal.ZERO; + //代码质量问题个数 + private BigDecimal codeQualityProblem=BigDecimal.ZERO; + //代码得分 + private BigDecimal codeQualityScore=BigDecimal.ZERO; + + //需求发布总量 + @ExcelIgnore + private BigDecimal releaseCount; + //即时验收数量 + @ExcelIgnore + private BigDecimal releaseOnTimeCount; + //即时验收率 + @ExcelIgnore + private BigDecimal releaseOnTimeRate; + //发布验收绩效 + @ExcelIgnore + private BigDecimal releaseScore=BigDecimal.ZERO; + + //会议绩效 + @ExcelIgnore + private BigDecimal meetScore=BigDecimal.ZERO; + //周会议 + private BigDecimal meetWeek; + //需求会议 + private BigDecimal meetStory; + //文档质量问题个数 + private BigDecimal documentQualityProblem=BigDecimal.ZERO; + //文档得分 + private BigDecimal documentQualityScore=BigDecimal.ZERO; + + //设计得分 + private BigDecimal designScore=BigDecimal.ZERO; + //设计问题 + private BigDecimal designQualityProblem=BigDecimal.ZERO; +// //项目绩效 +// private BigDecimal projectScore=BigDecimal.ZERO; + + //项目文档 +// private BigDecimal projectDocumentScore=BigDecimal.ZERO; + +// //会议管理 +// private BigDecimal meetDocumentScore=BigDecimal.ZERO; + + + //ui 工作量 加分项 + private BigDecimal uiWorkScore=BigDecimal.ZERO; + //总分 + private BigDecimal totalScore=BigDecimal.ZERO; + + //版本计划完成率 + private BigDecimal versionPlanFinishedRate=BigDecimal.ZERO;; + //任务管理和分解能力 + private BigDecimal taskManageScore=BigDecimal.ZERO;; + //分配工时占比 + private BigDecimal allocationTimeManageRate=BigDecimal.ZERO; + //系统稳定得分 + private BigDecimal systemStabilityScore=BigDecimal.ZERO; + //专业技能提升 + private BigDecimal professionalSkillEnhancementScore=BigDecimal.ZERO; + //问题管理得分 + private BigDecimal developFeedbackStory=BigDecimal.ZERO; } diff --git a/src/main/java/com/sa/zentao/dao/ProgramCountDTO.java b/src/main/java/com/sa/zentao/dao/ProgramCountDTO.java new file mode 100644 index 0000000..d17075c --- /dev/null +++ b/src/main/java/com/sa/zentao/dao/ProgramCountDTO.java @@ -0,0 +1,157 @@ +package com.sa.zentao.dao; + +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +@EqualsAndHashCode(callSuper = false) +public class ProgramCountDTO implements Serializable { + //完成需求总量 + private BigDecimal finishedStoryCount; + //上线需求总量 + private BigDecimal releaseStoryCount; + //完成验收数量 + private BigDecimal ysStoryCount; + //完成需求验收率 + private BigDecimal ysStoryRate; + //线上bug比例 + private BigDecimal prodBugRate; + //完成任务总量 + private BigDecimal taskCount; + //处理问题数量 + private BigDecimal handFeedbackCount; + //问题通过率 + private BigDecimal passFeedbackCountRate; + //需求总工时 + @ExcelProperty(value = "天数",index =2) + private BigDecimal days; + // 小时 + @ExcelIgnore + private BigDecimal approvalDays; + + + //拆分任务工时 + @ExcelIgnore + private BigDecimal splitTimeScore=BigDecimal.ZERO; + //实际产出工时 + @ExcelProperty(value = "可用工时",index =3) + private BigDecimal totalTime; + //可用工时 6*工作天数 + @ExcelProperty(value = "达标工时 ",index =4) + //达标 考核工时 + private BigDecimal examineTime; + //工作饱和度 + @ExcelProperty(value = "产出工时 ",index =5) + private BigDecimal workTime; + @ExcelProperty(value = "分配工时 ",index =6) + private BigDecimal allocationTime; + @ExcelProperty(value = "工作饱和率 ",index =7) + private BigDecimal saturation; + @ExcelProperty(value = "饱和率得分 ",index =8) + private BigDecimal saturationScore; + + @ExcelProperty(value = "延期任务 ",index =9) + private BigDecimal delayTask; + //总任务 + @ExcelIgnore + private BigDecimal totalTask; + @ExcelProperty(value = "完成任务 ",index =10) + private BigDecimal finishTask; + @ExcelProperty(value = "完成准时率 ",index =11) + private BigDecimal finishPunctuality; + @ExcelProperty(value = "准时率得分 ",index =12) + private BigDecimal punctualityScore=BigDecimal.ZERO; + @ExcelProperty(value = "线上严重bug ",index =13) + private BigDecimal seriousBug; + //缺陷检出率 + @ExcelIgnore + private BigDecimal bugFindScore; + //缺陷检出率得分 + private BigDecimal bugFindRate; + //产出线上Bug + @ExcelProperty(value = "线上普通bug ",index =14) + private BigDecimal slightBug; + @ExcelIgnore + private BigDecimal bugCount=BigDecimal.ZERO; + //bug密度 + @ExcelIgnore + private BigDecimal bugDensity=BigDecimal.ZERO; + //线上Bug得分 + @ExcelProperty(value = "线上Bug得分 ",index =15) + private BigDecimal bugScore=BigDecimal.ZERO; + + + //普通bug + private BigDecimal devSlightBug; + //严重bug + private BigDecimal devSeriousBug; + private BigDecimal devBugScore; + //产出线上Bug + @ExcelProperty(value = "总分 ",index =16) + private BigDecimal score; + //工作态度 + @ExcelIgnore + private BigDecimal workAttitude=BigDecimal.ZERO; + //优秀分享 创新贡献 + @ExcelIgnore + private BigDecimal excellentShare=BigDecimal.ZERO; + + //质量贡献 + @ExcelIgnore + private BigDecimal quality=BigDecimal.ZERO; + //代码质量问题个数 + private BigDecimal codeQualityProblem=BigDecimal.ZERO; + //代码得分 + private BigDecimal codeQualityScore=BigDecimal.ZERO; + + //需求发布总量 + @ExcelIgnore + private BigDecimal releaseCount; + //即时验收数量 + @ExcelIgnore + private BigDecimal releaseOnTimeCount; + //即时验收率 + @ExcelIgnore + private BigDecimal releaseOnTimeRate; + //发布验收绩效 + @ExcelIgnore + private BigDecimal releaseScore=BigDecimal.ZERO; + + //会议绩效 + @ExcelIgnore + private BigDecimal meetScore=BigDecimal.ZERO; + //周会议 + private BigDecimal meetWeek; + //需求会议 + private BigDecimal meetStory; + //文档质量问题个数 + private BigDecimal documentQualityProblem=BigDecimal.ZERO; + //文档得分 + private BigDecimal documentQualityScore=BigDecimal.ZERO; + + //设计得分 + private BigDecimal designScore=BigDecimal.ZERO; + //设计问题 + private BigDecimal designQualityProblem=BigDecimal.ZERO; +// //项目绩效 +// private BigDecimal projectScore=BigDecimal.ZERO; + + //项目文档 + private BigDecimal projectDocumentScore=BigDecimal.ZERO; + +// //会议管理 +// private BigDecimal meetDocumentScore=BigDecimal.ZERO; + + + //ui 工作量 加分项 + private BigDecimal uiWorkScore=BigDecimal.ZERO; + //总分 + private BigDecimal totalScore=BigDecimal.ZERO; + + +} diff --git a/src/main/java/com/sa/zentao/dao/ProjectWorkDetailsDTO.java b/src/main/java/com/sa/zentao/dao/ProjectWorkDetailsDTO.java index 23f49b5..c1c11c8 100644 --- a/src/main/java/com/sa/zentao/dao/ProjectWorkDetailsDTO.java +++ b/src/main/java/com/sa/zentao/dao/ProjectWorkDetailsDTO.java @@ -29,12 +29,12 @@ public class ProjectWorkDetailsDTO implements Serializable { //已验收需求总量 @ExcelProperty(value = "已验收需求总量",index =5) - private Integer ysTaskCount; + private BigDecimal ysStoryCount; //验收通过率 @ExcelProperty(value = "验收通过率",index =6) private BigDecimal ysYesRate; //验收不通过数量 @ExcelProperty(value = "验收不通过数量",index =7) - private BigDecimal ysNoRate; + private BigDecimal ysNoCount; //验收情况备注 } diff --git a/src/main/java/com/sa/zentao/dao/WorkDetailsDTO.java b/src/main/java/com/sa/zentao/dao/WorkDetailsDTO.java index a5c4b6e..0f21ac8 100644 --- a/src/main/java/com/sa/zentao/dao/WorkDetailsDTO.java +++ b/src/main/java/com/sa/zentao/dao/WorkDetailsDTO.java @@ -2,6 +2,7 @@ package com.sa.zentao.dao; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; +import com.sa.zentao.enums.UserType; import lombok.Data; import lombok.EqualsAndHashCode; @@ -12,6 +13,8 @@ import java.math.BigDecimal; @EqualsAndHashCode(callSuper = false) public class WorkDetailsDTO implements Serializable { + + @ExcelProperty(value = "员工",index =0) private String userName; //任务总量 @@ -40,4 +43,9 @@ public class WorkDetailsDTO implements Serializable { //产出线上Bug @ExcelProperty(value = "产出线上Bug ",index =6) private BigDecimal bugCount; + + @ExcelIgnore + private UserType userType; + @ExcelIgnore + private String account; } diff --git a/src/main/java/com/sa/zentao/dao/ZtBugDTO.java b/src/main/java/com/sa/zentao/dao/ZtBugDTO.java index 9670af4..cd1d535 100644 --- a/src/main/java/com/sa/zentao/dao/ZtBugDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtBugDTO.java @@ -199,6 +199,7 @@ public class ZtBugDTO implements Serializable { private String files; private List list; + //releaseBug prod dev private String bugType; private String ysUser; @@ -212,4 +213,6 @@ public class ZtBugDTO implements Serializable { private Integer releaseId; private String releaseName; + + private String feedbackSpec; } diff --git a/src/main/java/com/sa/zentao/dao/ZtComputerSourceDTO.java b/src/main/java/com/sa/zentao/dao/ZtComputerSourceDTO.java index 1d7b02b..8bd06ae 100644 --- a/src/main/java/com/sa/zentao/dao/ZtComputerSourceDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtComputerSourceDTO.java @@ -102,4 +102,5 @@ public class ZtComputerSourceDTO implements Serializable { private String code; + private String ip; } diff --git a/src/main/java/com/sa/zentao/dao/ZtMeetingDTO.java b/src/main/java/com/sa/zentao/dao/ZtMeetingDTO.java index 735997a..41d8d20 100644 --- a/src/main/java/com/sa/zentao/dao/ZtMeetingDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtMeetingDTO.java @@ -75,4 +75,8 @@ public class ZtMeetingDTO implements Serializable { private String userStoryName; private String storyIds; + + private String result; + + private String meetingAfter; } diff --git a/src/main/java/com/sa/zentao/dao/ZtMonthScopeDTO.java b/src/main/java/com/sa/zentao/dao/ZtMonthScopeDTO.java new file mode 100644 index 0000000..a742424 --- /dev/null +++ b/src/main/java/com/sa/zentao/dao/ZtMonthScopeDTO.java @@ -0,0 +1,44 @@ +package com.sa.zentao.dao; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author gqb + * @since 2025-04-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class ZtMonthScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + private String account; + + /** + * 2022-07 + */ + private String dateStr; + + private String scopeJson; + + private Date createDate; + + private String createUser; + + private Date updateDate; + + private String updateUser; + + +} diff --git a/src/main/java/com/sa/zentao/dao/ZtStoryDTO.java b/src/main/java/com/sa/zentao/dao/ZtStoryDTO.java index 77be092..8f680df 100644 --- a/src/main/java/com/sa/zentao/dao/ZtStoryDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtStoryDTO.java @@ -61,6 +61,8 @@ public class ZtStoryDTO implements Serializable { private Integer feedback; + private String feedbackSpec; + private String title; private String keywords; @@ -261,6 +263,11 @@ public class ZtStoryDTO implements Serializable { private String releaseName; private List bugList; - + //验收日期 private Date ysDate; + + //开发完成时间 + private Date develDate; + //测试完成时间 + private Date testedDate; } diff --git a/src/main/java/com/sa/zentao/dao/ZtStoryFeedbackDTO.java b/src/main/java/com/sa/zentao/dao/ZtStoryFeedbackDTO.java index 73b2faa..c212f3c 100644 --- a/src/main/java/com/sa/zentao/dao/ZtStoryFeedbackDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtStoryFeedbackDTO.java @@ -120,4 +120,6 @@ public class ZtStoryFeedbackDTO implements Serializable { // 1通过 2不通过 private Integer revieweResult; + private String oaName; + } diff --git a/src/main/java/com/sa/zentao/dao/ZtTaskDTO.java b/src/main/java/com/sa/zentao/dao/ZtTaskDTO.java index 4dbe761..49509ff 100644 --- a/src/main/java/com/sa/zentao/dao/ZtTaskDTO.java +++ b/src/main/java/com/sa/zentao/dao/ZtTaskDTO.java @@ -201,4 +201,6 @@ public class ZtTaskDTO implements Serializable { private BigDecimal useTime; private List bugList; + + private String feedbackSpec; } diff --git a/src/main/java/com/sa/zentao/entity/ZtBug.java b/src/main/java/com/sa/zentao/entity/ZtBug.java index 4fac4ba..90db922 100644 --- a/src/main/java/com/sa/zentao/entity/ZtBug.java +++ b/src/main/java/com/sa/zentao/entity/ZtBug.java @@ -147,6 +147,11 @@ public class ZtBug implements Serializable { @TableField("closedDate") private Date closeddate; + @TableField(exist = false) + private String cancelBy; + @TableField(exist = false) + private Date cancelDate; + @TableField("duplicateBug") private Integer duplicatebug; diff --git a/src/main/java/com/sa/zentao/entity/ZtComputerSource.java b/src/main/java/com/sa/zentao/entity/ZtComputerSource.java index b658f1f..b98041b 100644 --- a/src/main/java/com/sa/zentao/entity/ZtComputerSource.java +++ b/src/main/java/com/sa/zentao/entity/ZtComputerSource.java @@ -102,4 +102,6 @@ public class ZtComputerSource implements Serializable { private Date updateDate; private String code; + + private String ip; } diff --git a/src/main/java/com/sa/zentao/entity/ZtMeeting.java b/src/main/java/com/sa/zentao/entity/ZtMeeting.java index 033401e..3ff436c 100644 --- a/src/main/java/com/sa/zentao/entity/ZtMeeting.java +++ b/src/main/java/com/sa/zentao/entity/ZtMeeting.java @@ -70,4 +70,8 @@ public class ZtMeeting implements Serializable { private String storyIds; + private String result; + + private String meetingAfter; + } diff --git a/src/main/java/com/sa/zentao/entity/ZtMonthScore.java b/src/main/java/com/sa/zentao/entity/ZtMonthScore.java new file mode 100644 index 0000000..dfc721a --- /dev/null +++ b/src/main/java/com/sa/zentao/entity/ZtMonthScore.java @@ -0,0 +1,47 @@ +package com.sa.zentao.entity; + +import java.time.LocalDateTime; +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * + *

+ * + * @author gqb + * @since 2025-04-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class ZtMonthScore implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private String account; + + /** + * 2022-07 + */ + private String dateStr; + + private String scopeJson; + + private Date createDate; + + private String createUser; + + private Date updateDate; + + private String updateUser; + + +} diff --git a/src/main/java/com/sa/zentao/entity/ZtStory.java b/src/main/java/com/sa/zentao/entity/ZtStory.java index eb82f9d..f17cb90 100644 --- a/src/main/java/com/sa/zentao/entity/ZtStory.java +++ b/src/main/java/com/sa/zentao/entity/ZtStory.java @@ -184,9 +184,9 @@ public class ZtStory implements Serializable { private Date planStartDate; //计划结束时间 private Date planEndDate; - //开始日期 + //开始日期 开发开始 private Date startDate; - //结束日期 + //结束日期 测试结束 private Date endDate; private Integer project; @@ -194,7 +194,8 @@ public class ZtStory implements Serializable { private Integer ysFlag; private String ysRemark; - + //开发完毕日期 + private Date developedDate; @TableField(updateStrategy = FieldStrategy.IGNORED) private Integer userStory; @@ -202,6 +203,12 @@ public class ZtStory implements Serializable { private String ysUser; private Integer taskCount; + //验收时间 private Date ysDate; +// //开发完成时间 +// private Date develDate; +// //测试完成时间 +// private Date testedDate; + } diff --git a/src/main/java/com/sa/zentao/entity/ZtStoryFeedback.java b/src/main/java/com/sa/zentao/entity/ZtStoryFeedback.java index 45d422b..542d46c 100644 --- a/src/main/java/com/sa/zentao/entity/ZtStoryFeedback.java +++ b/src/main/java/com/sa/zentao/entity/ZtStoryFeedback.java @@ -85,8 +85,10 @@ public class ZtStoryFeedback implements Serializable { //预计完成时间 private Date planFinishDate; - + //处理完成时间 private Date finishDate; + //验收时间 + private Date ysDate; //响应时间 处理时间 private Date handDate; //关闭日期 diff --git a/src/main/java/com/sa/zentao/enums/ActionStatus.java b/src/main/java/com/sa/zentao/enums/ActionStatus.java index 61bafb6..c9699bb 100644 --- a/src/main/java/com/sa/zentao/enums/ActionStatus.java +++ b/src/main/java/com/sa/zentao/enums/ActionStatus.java @@ -24,6 +24,7 @@ public enum ActionStatus { YSTG(16, "ystg","验收通过"), YSBTG(17, "ysbtg","验收不通过"), FBCG(18, "fb","发布通过"), + FBSB(30, "fb","发布不通过"), QR(19, "qr","确认"), KSCE(21, "testing","开始测试"), @@ -34,7 +35,7 @@ public enum ActionStatus { ZTBG(42, "changeStatus","状态变更"), MQXU(43, "mqxu","明确需求"), - + STORYCCYS(44, "storyccys","发布催促验收"), TJYS(51, "verified","提交验收"), KSCL(61, "startHand","开始处理"), diff --git a/src/main/java/com/sa/zentao/enums/ActionType.java b/src/main/java/com/sa/zentao/enums/ActionType.java index 019cf94..0d43e00 100644 --- a/src/main/java/com/sa/zentao/enums/ActionType.java +++ b/src/main/java/com/sa/zentao/enums/ActionType.java @@ -16,6 +16,8 @@ public enum ActionType { FB(34, "release","发布"), + SCORECOUNT(35, "releasecount","绩效计算"), + USERXQ(14, "user-story","用户需求"), WTFK(15, "story-feedback","问题反馈"), diff --git a/src/main/java/com/sa/zentao/mapper/ZtBugMapper.java b/src/main/java/com/sa/zentao/mapper/ZtBugMapper.java index f286fe2..518724b 100644 --- a/src/main/java/com/sa/zentao/mapper/ZtBugMapper.java +++ b/src/main/java/com/sa/zentao/mapper/ZtBugMapper.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.sa.zentao.qo.ZtProjectQo; import org.apache.ibatis.annotations.Param; +import java.util.Date; import java.util.List; /** @@ -22,4 +23,7 @@ public interface ZtBugMapper extends BaseMapper { List myBugPageList(@Param("qo") ZtProjectQo qo); + List bugListByIds(@Param("ids")List ids); + + List bugListByProductAndDate(@Param("pIds")List pIds, @Param("start")Date start,@Param("end") Date lastDayOfMonth); } diff --git a/src/main/java/com/sa/zentao/mapper/ZtMonthScoreMapper.java b/src/main/java/com/sa/zentao/mapper/ZtMonthScoreMapper.java new file mode 100644 index 0000000..c5e99de --- /dev/null +++ b/src/main/java/com/sa/zentao/mapper/ZtMonthScoreMapper.java @@ -0,0 +1,16 @@ +package com.sa.zentao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.sa.zentao.entity.ZtMonthScore; + +/** + *

+ * Mapper 接口 + *

+ * + * @author gqb + * @since 2025-04-24 + */ +public interface ZtMonthScoreMapper extends BaseMapper { + +} diff --git a/src/main/java/com/sa/zentao/mapper/ZtTaskMapper.java b/src/main/java/com/sa/zentao/mapper/ZtTaskMapper.java index 154fa12..9c033aa 100644 --- a/src/main/java/com/sa/zentao/mapper/ZtTaskMapper.java +++ b/src/main/java/com/sa/zentao/mapper/ZtTaskMapper.java @@ -26,5 +26,15 @@ public interface ZtTaskMapper extends BaseMapper { @DS("slave") List taskListPrd(@Param("id") Integer id); - List itApprovalByUserName(@Param("name") String name,@Param("startDate") Date firstDayOfMonth, @Param("endDate") Date lastDayOfMonth); + List itApprovalByUserName(@Param("name") String name, @Param("startDate") Date firstDayOfMonth, @Param("endDate") Date lastDayOfMonth); + + List taskListByIds(@Param("ids") List ids); + + List taskListByStoryIds(@Param("ids") List sIds); + + List multipleDepartProjectTeam(@Param("start") Date start, @Param("end") Date end); + + List taskListByPIdsAndDate(@Param("pids") List pids, @Param("start")Date firstDayOfMonth, @Param("end")Date lastDayOfMonth); } + + \ No newline at end of file diff --git a/src/main/java/com/sa/zentao/qo/ZtBugQo.java b/src/main/java/com/sa/zentao/qo/ZtBugQo.java index e5bb372..bdbdf09 100644 --- a/src/main/java/com/sa/zentao/qo/ZtBugQo.java +++ b/src/main/java/com/sa/zentao/qo/ZtBugQo.java @@ -31,6 +31,7 @@ public class ZtBugQo extends BaseQo { // testing // tested // closed + // cancel private String status; private String remark; diff --git a/src/main/java/com/sa/zentao/qo/ZtComputerSourceQo.java b/src/main/java/com/sa/zentao/qo/ZtComputerSourceQo.java index 04cf592..3c89566 100644 --- a/src/main/java/com/sa/zentao/qo/ZtComputerSourceQo.java +++ b/src/main/java/com/sa/zentao/qo/ZtComputerSourceQo.java @@ -102,4 +102,6 @@ public class ZtComputerSourceQo extends BaseQo { //1年内、3年内、3~5年、5~7年,7年以上 1 2 3 4 5 private String yearSearch; + private String ip; + } diff --git a/src/main/java/com/sa/zentao/qo/ZtProjectQo.java b/src/main/java/com/sa/zentao/qo/ZtProjectQo.java index 09eda4c..df26def 100644 --- a/src/main/java/com/sa/zentao/qo/ZtProjectQo.java +++ b/src/main/java/com/sa/zentao/qo/ZtProjectQo.java @@ -105,4 +105,6 @@ public class ZtProjectQo extends BaseQo { private String spec; private String bugType; + + private String account; } diff --git a/src/main/java/com/sa/zentao/qo/ZtReleaseQo.java b/src/main/java/com/sa/zentao/qo/ZtReleaseQo.java index 8738f6d..1212799 100644 --- a/src/main/java/com/sa/zentao/qo/ZtReleaseQo.java +++ b/src/main/java/com/sa/zentao/qo/ZtReleaseQo.java @@ -58,5 +58,9 @@ public class ZtReleaseQo extends BaseQo { private List storyList; private List bugList; - + //验收状态 released已发布 verified + private String ysStatus; + //验收结果 1.通过 2不通过 + private Integer ysFlag; + // } diff --git a/src/main/java/com/sa/zentao/service/IZtBugService.java b/src/main/java/com/sa/zentao/service/IZtBugService.java index 673147d..9fa7ccd 100644 --- a/src/main/java/com/sa/zentao/service/IZtBugService.java +++ b/src/main/java/com/sa/zentao/service/IZtBugService.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.sa.zentao.qo.ZtBugQo; import com.sa.zentao.qo.ZtProjectQo; +import java.util.Date; import java.util.List; /** @@ -46,4 +47,10 @@ public interface IZtBugService extends IService { List bugListByTaskStory(ZtBugDTO dto); ZtBugDTO getBugById(Integer id); + + List bugListByIds(List ids); + + List getNormalBugList(List bugList); + + List bugListByProductAndDate(List pIds, Date firstDayOfMonth, Date lastDayOfMonth); } diff --git a/src/main/java/com/sa/zentao/service/IZtMonthScoreService.java b/src/main/java/com/sa/zentao/service/IZtMonthScoreService.java new file mode 100644 index 0000000..1e1138c --- /dev/null +++ b/src/main/java/com/sa/zentao/service/IZtMonthScoreService.java @@ -0,0 +1,18 @@ +package com.sa.zentao.service; + +import com.sa.zentao.dao.PerformanceDTO; +import com.baomidou.mybatisplus.extension.service.IService; +import com.sa.zentao.entity.ZtMonthScore; + +/** + *

+ * 服务类 + *

+ * + * @author gqb + * @since 2025-04-24 + */ +public interface IZtMonthScoreService extends IService { + + void saveScope(PerformanceDTO dto); +} diff --git a/src/main/java/com/sa/zentao/service/IZtProjectService.java b/src/main/java/com/sa/zentao/service/IZtProjectService.java index 5862fce..516d5f9 100644 --- a/src/main/java/com/sa/zentao/service/IZtProjectService.java +++ b/src/main/java/com/sa/zentao/service/IZtProjectService.java @@ -139,4 +139,7 @@ public interface IZtProjectService extends IService { ZtProjectDTO getProjectById(ZtProjectDTO dto); + List projectListByProductIds(List pIds); + + List getExecutionsListByProjectAndDate(List projects, Date firstDayOfMonth, Date lastDayOfMonth); } diff --git a/src/main/java/com/sa/zentao/service/IZtReleaseService.java b/src/main/java/com/sa/zentao/service/IZtReleaseService.java index b2eca23..224ca70 100644 --- a/src/main/java/com/sa/zentao/service/IZtReleaseService.java +++ b/src/main/java/com/sa/zentao/service/IZtReleaseService.java @@ -70,5 +70,8 @@ public interface IZtReleaseService extends IService { void submitAgainReviewing(ZtReleaseDTO dto); ZtRelease getReleaseByStory(Integer id); + ZtRelease getReleaseByBug(Integer id); + + void urgeYs(ZtReleaseQo qo); } diff --git a/src/main/java/com/sa/zentao/service/IZtStoryService.java b/src/main/java/com/sa/zentao/service/IZtStoryService.java index b632c14..eec4688 100644 --- a/src/main/java/com/sa/zentao/service/IZtStoryService.java +++ b/src/main/java/com/sa/zentao/service/IZtStoryService.java @@ -91,4 +91,7 @@ public interface IZtStoryService extends IService { void batchAddStory(ZtStoryDTO dto); List storyListByUserStory(ZtStoryDTO dto); + + List getNormalStory(List sList); + } diff --git a/src/main/java/com/sa/zentao/service/IZtTaskService.java b/src/main/java/com/sa/zentao/service/IZtTaskService.java index fdeaddd..b9c2ed3 100644 --- a/src/main/java/com/sa/zentao/service/IZtTaskService.java +++ b/src/main/java/com/sa/zentao/service/IZtTaskService.java @@ -8,7 +8,9 @@ import com.sa.zentao.dao.ZtYwTaskDTO; import com.sa.zentao.entity.ZtTask; import com.baomidou.mybatisplus.extension.service.IService; import com.sa.zentao.qo.ZtProjectQo; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -62,8 +64,32 @@ public interface IZtTaskService extends IService { * * @param firstDayOfMonth 开始 * @param lastDayOfMonth 结束 - * @param eIds 迭代 + * @param pids 产品 * @return */ - List taskListByEIdsAndDate(Date firstDayOfMonth, Date lastDayOfMonth, List eIds); + List taskListByEIdsAndDate(Date firstDayOfMonth, Date lastDayOfMonth, List pids); + + + List getDelayTask(List t); + + List getOnTimeTask(List t); + + List taskListByIds(List ids); + + List taskListByStoryIds(List sIds); + + List getNormalTaskList(List tList); + + List getDevelAllocation(List tList); + + /** + * + * @param firstDayOfMonth 开始日期 + * @param lastDayOfMonth 结束日期 + * @param eIds 迭代ids + * @return + */ + List develTaskListByExecutions(Date firstDayOfMonth, Date lastDayOfMonth, List eIds); + + List multipleDepartProjectTeam(Date firstDayOfMonth, Date lastDayOfMonth); } diff --git a/src/main/java/com/sa/zentao/service/impl/IZtCountService.java b/src/main/java/com/sa/zentao/service/impl/IZtCountService.java index de55930..bfd1273 100644 --- a/src/main/java/com/sa/zentao/service/impl/IZtCountService.java +++ b/src/main/java/com/sa/zentao/service/impl/IZtCountService.java @@ -2,12 +2,14 @@ package com.sa.zentao.service.impl; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.read.listener.PageReadListener; import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteTable; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -33,6 +35,7 @@ import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.*; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -44,6 +47,8 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.DoubleStream; +import static com.sa.zentao.enums.ProjectTypeEnums.project; + @Service @Slf4j public class IZtCountService { @@ -85,12 +90,12 @@ public class IZtCountService { List pIds = this.projectService.authProductList(); - if(CollectionUtils.isEmpty(pIds)){ + if (CollectionUtils.isEmpty(pIds)) { return result; } List storyList = storyService.list(new QueryWrapper().lambda() .eq(ZtStory::getAssignedTo, name).ne(ZtStory::getStatus, "closed") - .in(ZtStory::getProduct,pIds) + .in(ZtStory::getProduct, pIds) ); List storyCountList = storyList.stream().filter(o -> o.getAssignedTo().equals(name)).filter(o -> !o.getStage().equals("verified")).collect(Collectors.toList()); @@ -103,53 +108,52 @@ public class IZtCountService { Date date = new Date(); - result.put("storyCount", storyCountList.stream().map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("storyCount", storyCountList.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); result.put("storyTimeOutCount", storyList.stream().filter(o -> !"verified".equalsIgnoreCase(o.getStage())) - .filter(o->o.getAssignedTo().equals(name)) + .filter(o -> o.getAssignedTo().equals(name)) .filter(o -> o.getPlanEndDate() != null && o.getPlanEndDate().getTime() < date.getTime()) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); List bugList = bugService.list(new QueryWrapper().lambda().eq(ZtBug::getAssignedTo, name) - .in(ZtBug::getProduct,pIds) + .in(ZtBug::getProduct, pIds) .ne(ZtBug::getStatus, "closed") ); - long bugCount = bugList.stream().filter(o->o.getStatus().equals("active")).count(); + long bugCount = bugList.stream().filter(o -> o.getStatus().equals("active")).count(); long resolvedBugCount = bugService.count(new QueryWrapper().lambda().eq(ZtBug::getAssignedTo, name) .eq(ZtBug::getStatus, "resolved") ); UserType userType = RiskUserThreadLocal.get().getUserType(); - if(userType==UserType.CS){ + if (userType == UserType.CS) { List myBugList = bugService.list(new QueryWrapper().lambda() .ne(ZtBug::getStatus, "closed") - .in(ZtBug::getProduct,pIds) - .and(e->e.eq(ZtBug::getAssignedTo, name).or().eq(ZtBug::getOpenedby, name)) + .in(ZtBug::getProduct, pIds) + .and(e -> e.eq(ZtBug::getAssignedTo, name).or().eq(ZtBug::getOpenedby, name)) ); - result.put("bugCount", myBugList.stream() .map(o->o.getId()+"").collect(Collectors.joining(","))); - }else{ - result.put("bugCount", bugList.stream().filter(o->o.getStatus().equals("active")) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("bugCount", myBugList.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); + } else { + result.put("bugCount", bugList.stream().filter(o -> o.getStatus().equals("active")).map(o -> o.getId() + "").collect(Collectors.joining(","))); } - result.put("bugTimeOutCount", bugList.stream().filter(o -> o.getDeadline() != null &&DateUtils.getDayLast(o.getDeadline()).getTime() < date.getTime()) - .filter(o -> "active".equalsIgnoreCase(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("bugTimeOutCount", bugList.stream().filter(o -> o.getDeadline() != null && DateUtils.getDayLast(o.getDeadline()).getTime() < date.getTime()) + .filter(o -> "active".equalsIgnoreCase(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); // List taskList = taskService.list(new QueryWrapper().lambda() .eq(ZtTask::getAssignedTo, name) - .in(ZtTask::getProduct,pIds) + .in(ZtTask::getProduct, pIds) .ne(ZtTask::getStatus, "closed")); - - long taskCount=taskList.stream().filter(o->o.getStatus().equals("doing")||o.getStatus().equals("wait")).count(); - long resolvedTaskCount = taskList.stream().filter(o->o.getStatus().equals("done")).count(); + long taskCount = taskList.stream().filter(o -> o.getStatus().equals("doing") || o.getStatus().equals("wait")).count(); + long resolvedTaskCount = taskList.stream().filter(o -> o.getStatus().equals("done")).count(); // taskService.count(new QueryWrapper().lambda() // .eq(ZtTask::getAssignedTo, name).eq(ZtTask::getStatus, "done")); - result.put("taskCount", taskList.stream().filter(o->o.getStatus().equals("reviewing")||o.getStatus().equals("doing")||o.getStatus().equals("wait")).map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("taskCount", taskList.stream().filter(o -> o.getStatus().equals("reviewing") || o.getStatus().equals("doing") || o.getStatus().equals("wait")).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.put("taskTimeOutCount", taskList.stream().filter(o -> o.getDeadline() != null && DateUtils.getDayLast(o.getDeadline()).getTime() < date.getTime()) - .filter(o -> o.getStatus().equalsIgnoreCase("doing")||o.getStatus().equalsIgnoreCase("wait")).map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> o.getStatus().equalsIgnoreCase("doing") || o.getStatus().equalsIgnoreCase("wait")).map(o -> o.getId() + "").collect(Collectors.joining(","))); if (taskCount == 0 && bugCount == 0) { result.put("process", 0L); } else { @@ -158,25 +162,24 @@ public class IZtCountService { } List feedbacks = this.storyFeedbackService.list(new QueryWrapper().lambda() .ne(ZtStoryFeedback::getStatus, "closed") - .in(ZtStoryFeedback::getProduct,pIds) - .eq(ZtStoryFeedback::getAssignedTo,RiskUserThreadLocal.get().getName()) + .in(ZtStoryFeedback::getProduct, pIds) + .eq(ZtStoryFeedback::getAssignedTo, RiskUserThreadLocal.get().getName()) ); //处理中 问题 wait doing finished submitVerified 提交验收 closed reviewing verified - result.put("feedbackActive",feedbacks.stream().filter(o->"doing".equals(o.getStatus())).map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("feedbackActive", feedbacks.stream().filter(o -> "doing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); //处理完 问题 - result.put("feedbackFinished",feedbacks.stream().filter(o->"finished".equals(o.getStatus())).map(o->o.getId()+"").collect(Collectors.joining(","))); + result.put("feedbackFinished", feedbacks.stream().filter(o -> "finished".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); - if(UserType.YW==RiskUserThreadLocal.get().getUserType()){ + if (UserType.YW == RiskUserThreadLocal.get().getUserType()) { List list = ywTaskService.list(new QueryWrapper().lambda().eq(ZtYwTask::getCreateUser, RiskUserThreadLocal.get().getName())); - - result.put("activeTask",list.stream().filter(o->2==o.getTaskStatus()||1==o.getTaskStatus()).count()); - result.put("handTask",list.stream().filter(o->3==o.getTaskStatus()).count()); - result.put("yqTask",list.stream().filter(o->2==o.getTaskStatus()||1==o.getTaskStatus()) - .filter(o->o.getTaskStartDate().getTime() 2 == o.getTaskStatus() || 1 == o.getTaskStatus()).count()); + result.put("handTask", list.stream().filter(o -> 3 == o.getTaskStatus()).count()); + result.put("yqTask", list.stream().filter(o -> 2 == o.getTaskStatus() || 1 == o.getTaskStatus()) + .filter(o -> o.getTaskStartDate().getTime() < new Date().getTime()) .count()); } @@ -191,33 +194,34 @@ public class IZtCountService { UserType userType = loginRiskUser.getUserType(); ZtStoryCountDTO result = new ZtStoryCountDTO(); List pIds = this.projectService.authProductList(); - if(CollectionUtils.isEmpty(pIds)){ + if (CollectionUtils.isEmpty(pIds)) { return new ZtStoryCountDTO(); } - if (loginRiskUser.getName().equals("admin")||userType == UserType.GSGC) { + String name = loginRiskUser.getName(); + if (name.equals("admin") || userType == UserType.GSGC) { - List list =null; + List list = null; List ztStory = null; - if(!loginRiskUser.getName().equals("admin")){ - if(!CollectionUtils.isEmpty(pIds)){ - list = this.storyUserService.list(new QueryWrapper().lambda().in(ZtStoryUser::getProduct,pIds) - .in(ZtStoryUser::getStatus, "active", "reviewing","active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed")); + if (!name.equals("admin")) { + if (!CollectionUtils.isEmpty(pIds)) { + list = this.storyUserService.list(new QueryWrapper().lambda().in(ZtStoryUser::getProduct, pIds) + .in(ZtStoryUser::getStatus, "active", "reviewing", "active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed")); ztStory = storyService.list(new QueryWrapper() .lambda().eq(ZtStory::getDeleted, "0") - .in(ZtStory::getProduct,pIds) + .in(ZtStory::getProduct, pIds) .ne(ZtStory::getStatus, "closed") ); - }else{ - list=new ArrayList<>(); - ztStory=new ArrayList<>(); + } else { + list = new ArrayList<>(); + ztStory = new ArrayList<>(); } - }else{ - list = this.storyUserService.list(new QueryWrapper().lambda().in(ZtStoryUser::getStatus, "active", "reviewing","active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed")); + } else { + list = this.storyUserService.list(new QueryWrapper().lambda().in(ZtStoryUser::getStatus, "active", "reviewing", "active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed")); - if(CollectionUtils.isEmpty(list)){ - ztStory=new ArrayList<>(); - }else{ + if (CollectionUtils.isEmpty(list)) { + ztStory = new ArrayList<>(); + } else { ztStory = storyService.list(new QueryWrapper() .lambda().eq(ZtStory::getDeleted, "0") .ne(ZtStory::getStatus, "closed") @@ -227,54 +231,54 @@ public class IZtCountService { List products = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getStatus, "normal").in(ZtProduct::getId, pIds)); - if(!CollectionUtils.isEmpty(products)){ - List userStrList = products.stream().filter(o -> !StringUtils.isEmpty(o.getReviewer())).map(o->o.getReviewer()).collect(Collectors.toList()); - List users=new ArrayList<>(); - for (String str:userStrList) { + if (!CollectionUtils.isEmpty(products)) { + List userStrList = products.stream().filter(o -> !StringUtils.isEmpty(o.getReviewer())).map(o -> o.getReviewer()).collect(Collectors.toList()); + List users = new ArrayList<>(); + for (String str : userStrList) { users.addAll(new ArrayList<>(Arrays.asList(str.split(",")))); } - if(users.contains(loginRiskUser.getName())){ + if (users.contains(loginRiskUser.getName())) { List userStoryList = list.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.toList()); - if(CollectionUtils.isEmpty(userStoryList)){ + if (CollectionUtils.isEmpty(userStoryList)) { result.setDpsCount(""); - }else{ + } else { List userStory = this.storyreviewService.list(new QueryWrapper().lambda().eq(ZtStoryreview::getType, "userStory").in(ZtStoryreview::getStory, userStoryList)); - result.setDpsCount(userStory.stream().filter(o ->StringUtils.isEmpty(o.getResult())&&loginRiskUser.getName().equals(o.getReviewer()) ).map(o->o.getStory().toString()).collect(Collectors.joining(","))); + result.setDpsCount(userStory.stream().filter(o -> StringUtils.isEmpty(o.getResult()) && loginRiskUser.getName().equals(o.getReviewer())).map(o -> o.getStory().toString()).collect(Collectors.joining(","))); } - }else{ - result.setDpsCount(list.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o->o.getId()+"").collect(Collectors.joining(","))); + } else { + result.setDpsCount(list.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); } - }else{ - result.setDpsCount(list.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o->o.getId()+"").collect(Collectors.joining(","))); + } else { + result.setDpsCount(list.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); } result.setPstgCount(list.stream().filter(o -> - Arrays.asList("active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed").contains(o.getStatus())) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + Arrays.asList("active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed").contains(o.getStatus())) + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setPlanCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> o.getStage().equals("wait")).map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> o.getStage().equals("wait")).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setTestingCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> Arrays.asList("testing","tested").contains(o.getStage()) ).map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> Arrays.asList("testing", "tested").contains(o.getStage())).map(o -> o.getId() + "").collect(Collectors.joining(","))); // developing 研发中 developed 研发完毕 testing 测试中 tested测试完毕 result.setJxzCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> Arrays.asList("developing","developed").contains(o.getStage()) - ).map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> Arrays.asList("developing", "developed").contains(o.getStage()) + ).map(o -> o.getId() + "").collect(Collectors.joining(","))); - if(CollectionUtils.isEmpty(ztStory)){ + if (CollectionUtils.isEmpty(ztStory)) { result.setYqCount(null); - }else{ + } else { //延期需求改成延期任务 List tList = this.taskService.list(new QueryWrapper().lambda() .in(ZtTask::getStory, ztStory.stream().map(o -> o.getId()).collect(Collectors.toList())) - .notIn(ZtTask::getStatus,"pause","cancel","closed","done","reviewing") + .notIn(ZtTask::getStatus, "pause", "cancel", "closed", "done", "reviewing") .last(" and DATE(now()) > DATE(deadline) ")); - result.setYqCount(tList.stream().map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setYqCount(tList.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); } // result.setYqCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) @@ -284,166 +288,161 @@ public class IZtCountService { result.setCswbCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("tested")) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setDysCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("released") ) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYsNoCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) .filter(o -> o.getYsFlag() == 2) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYsYesCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) - .filter(o -> o.getYsFlag() == 1||o.getYsFlag() == 0) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> o.getYsFlag() == 1 || o.getYsFlag() == 0) + .map(o -> o.getId() + "").collect(Collectors.joining(","))); List feedbacks = this.storyFeedbackService.list(new QueryWrapper().lambda() - .in(ZtStoryFeedback::getProduct,pIds) - ); + .in(ZtStoryFeedback::getProduct, pIds) + ); - result= setFeedback(result,feedbacks); - } else if (userType == UserType.CP ) { + result = setFeedback(result, feedbacks); + } else if (userType == UserType.CP) { - List list =null; - List storyUsers =null; - if(CollectionUtils.isEmpty(pIds)){ - list=new ArrayList<>(); - storyUsers=new ArrayList<>(); - }else{ - list = this.productService.listByIds(pIds); - storyUsers =CollectionUtils.isEmpty(list)?new ArrayList<>(): this.storyUserService.list(new QueryWrapper().lambda() - .notIn(ZtStoryUser::getStatus, - UserStoryEnums.CLOSED.getCode(),UserStoryEnums.YWC.getCode()) - .in(ZtStoryUser::getProduct,list.stream().map(o->o.getId()).collect(Collectors.toList())) -// .eq(ZtStoryUser::getAssignedto,loginRiskUser.getName()) - .eq(ZtStoryUser::getOpenedby,loginRiskUser.getName()) + List productList = null; + List storyUsers = null; + if (CollectionUtils.isEmpty(pIds)) { + productList = new ArrayList<>(); + storyUsers = new ArrayList<>(); + } else { + productList = this.productService.listByIds(pIds); + storyUsers = this.storyUserService.list(new QueryWrapper().lambda() + .notIn(ZtStoryUser::getStatus, + UserStoryEnums.CLOSED.getCode(), UserStoryEnums.YWC.getCode()) + .in(ZtStoryUser::getProduct, pIds) + .eq(ZtStoryUser::getOpenedby, loginRiskUser.getName()) ); } - //产品看自己的需求 - List ztStory =null; - if(CollectionUtils.isEmpty(list)){ - ztStory=new ArrayList<>(); + List ztStory = null; + if (CollectionUtils.isEmpty(productList)) { + ztStory = new ArrayList<>(); result.setYqCount(null); - }else{ - if(CollectionUtils.isEmpty(storyUsers)){ - ztStory=new ArrayList<>(); - }else{ + } else { + if (CollectionUtils.isEmpty(storyUsers)) { + ztStory = new ArrayList<>(); + } else { ztStory = storyService.list(new QueryWrapper() .lambda().eq(ZtStory::getDeleted, "0") .ne(ZtStory::getStatus, "closed") - .in(ZtStory::getUserStory,storyUsers.stream().map(o->o.getId()).collect(Collectors.toList())) - .in(ZtStory::getProduct,list.stream().map(o->o.getId()).collect(Collectors.toList()))); + .in(ZtStory::getUserStory, storyUsers.stream().map(o -> o.getId()).collect(Collectors.toList())) + .in(ZtStory::getProduct, pIds)); } - if(CollectionUtils.isEmpty(ztStory)){ + if (CollectionUtils.isEmpty(ztStory)) { result.setYqCount(null); - }else{ + } else { //延期需求改成延期任务 TODO List tList = this.taskService.list(new QueryWrapper().lambda() .in(ZtTask::getStory, ztStory.stream().map(o -> o.getId()).collect(Collectors.toList())) - .notIn(ZtTask::getStatus,"pause","cancel","closed","done","reviewing") + .notIn(ZtTask::getStatus, "pause", "cancel", "closed", "done", "reviewing") .last(" and DATE(now()) > DATE(deadline) ")); - result.setYqCount(tList.stream().map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setYqCount(tList.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); } } - - result.setDpsCount(storyUsers.stream().filter(o -> "reviewing".equals(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + //待评审特殊 + result.setDpsCount(storyUsers.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setPstgCount(storyUsers.stream().filter(o -> - Arrays.asList("active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed").contains(o.getStatus())) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + Arrays.asList("active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed").contains(o.getStatus())) + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setPlanCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> o.getStage().equals("wait")) .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> o.getStage().equals("wait")).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setJxzCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> Arrays.asList("tested","testing","developed","developing").contains(o.getStage()) - ) .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> Arrays.asList("tested", "testing", "developed", "developing").contains(o.getStage()) + ).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setCswbCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("tested")) - .map(o->o.getId()+"").collect(Collectors.joining(","))); - result.setDysCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> o.getStage().equals("released")) - .filter(o->o.getYsUser().equals(RiskUserThreadLocal.get().getName())) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); + List waitVerified = this.storyService.list(new QueryWrapper().lambda().eq(ZtStory::getStage, "released") + .in(ZtStory::getProduct,pIds) + .eq(ZtStory::getYsUser, name)); + + result.setDysCount(waitVerified.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYsNoCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) .filter(o -> o.getYsFlag() == 2) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYsYesCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) .filter(o -> o.getYsFlag() == 1) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); List feedbacks = this.storyFeedbackService.list(new QueryWrapper().lambda() - .in(ZtStoryFeedback::getProduct,pIds) - .eq(ZtStoryFeedback::getAssignedTo,loginRiskUser.getName()).or().eq(ZtStoryFeedback::getOpenedBy,loginRiskUser.getName()) + .in(ZtStoryFeedback::getProduct, pIds) + .eq(ZtStoryFeedback::getAssignedTo, loginRiskUser.getName()).or().eq(ZtStoryFeedback::getOpenedBy, loginRiskUser.getName()) ); - result= setFeedback(result,feedbacks); + result = setFeedback(result, feedbacks); } else if (userType == UserType.XMGLY) { - List pList = this.productService.listByIds(pIds); - List storyUsers = this.storyUserService.list(new QueryWrapper().lambda() - .in(ZtStoryUser::getStatus, "active", "reviewing","active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed") - .in(ZtStoryUser::getProduct,pList.stream().map(o->o.getId()).collect(Collectors.toList())) + .in(ZtStoryUser::getStatus, "active", "reviewing", "active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed") + .in(ZtStoryUser::getProduct, pList.stream().map(o -> o.getId()).collect(Collectors.toList())) ); LambdaQueryWrapper eq = new QueryWrapper() .lambda().eq(ZtStory::getDeleted, "0") .ne(ZtStory::getStatus, "closed"); - List ztStory =new ArrayList<>(); // .in(ZtStory::getProduct,integers) // .or() // .in() - if(!CollectionUtils.isEmpty(pIds)){ - //所有的产品 - eq.in(ZtStory::getProduct,pIds); - } + //所有的产品 + eq.in(ZtStory::getProduct, pIds); + List ztStory = this.storyService.list(eq); - result.setDpsCount(storyUsers.stream().filter(o -> "reviewing".equals(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setDpsCount(storyUsers.stream().filter(o -> "reviewing".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); // result.setPstgCount(storyUsers.stream().filter(o -> "active".equals(o.getStatus())) // .filter(o -> o.getStage().equals("wait")) .map(o->o.getId()+"").collect(Collectors.joining(","))); result.setPstgCount(storyUsers.stream().filter(o -> - Arrays.asList("active","unconfirmed","waitcommunicate","waitdesign","designdoing","designdone","storyunconfirmed","confirmed").contains(o.getStatus())) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + Arrays.asList("active", "unconfirmed", "waitcommunicate", "waitdesign", "designdoing", "designdone", "storyunconfirmed", "confirmed").contains(o.getStatus())) + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setPlanCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> o.getStage().equals("wait")) .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> o.getStage().equals("wait")).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setTestingCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> Arrays.asList("testing","tested").contains(o.getStage())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> Arrays.asList("testing", "tested").contains(o.getStage())).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setJxzCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) - .filter(o -> Arrays.asList("developing","developed").contains(o.getStage()) ) .map(o->o.getId()+"").collect(Collectors.joining(","))); + .filter(o -> Arrays.asList("developing", "developed").contains(o.getStage())).map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYqCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> !o.getStage().equals("verified") && !o.getStage().equals("verified")) .filter(o -> o.getPlanEndDate() != null && o.getPlanEndDate().getTime() < new Date().getTime()) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setCswbCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("tested")) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setDysCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("released")) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); // result.setYsNoCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) // .filter(o -> o.getStage().equals("verified")) // .filter(o -> o.getYsFlag() == 2) @@ -451,36 +450,36 @@ public class IZtCountService { //延期需求改成延期任务 TODO - if(CollectionUtils.isEmpty(ztStory)){ + if (CollectionUtils.isEmpty(ztStory)) { result.setYqCount(null); - }else{ + } else { List tList = this.taskService.list(new QueryWrapper().lambda() .in(ZtTask::getStory, ztStory.stream().map(o -> o.getId()).collect(Collectors.toList())) - .notIn(ZtTask::getStatus,"pause","cancel","closed","done","reviewing") + .notIn(ZtTask::getStatus, "pause", "cancel", "closed", "done", "reviewing") .last(" and DATE(now()) > DATE(deadline) ")); // .last(" and finishedDate > DATE_ADD(DATE_ADD(deadline,INTERVAL 1 day),INTERVAL -1 SECOND)")); - result.setYqCount(tList.stream().map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setYqCount(tList.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); } result.setYsYesCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) .filter(o -> o.getYsFlag() == 1) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); result.setYsNoCount(ztStory.stream().filter(o -> "active".equals(o.getStatus())) .filter(o -> o.getStage().equals("verified")) .filter(o -> o.getYsFlag() == 2) - .map(o->o.getId()+"").collect(Collectors.joining(","))); + .map(o -> o.getId() + "").collect(Collectors.joining(","))); List active = bugService.list(new QueryWrapper().lambda().eq(ZtBug::getStatus, "active")); - result.setBugCount(active.stream(). map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setBugCount(active.stream().map(o -> o.getId() + "").collect(Collectors.joining(","))); List feedbacks = this.storyFeedbackService.list(new QueryWrapper() .lambda() - .in(ZtStoryFeedback::getProduct,pList.stream().map(o->o.getId()).collect(Collectors.toList())) + .in(ZtStoryFeedback::getProduct, pList.stream().map(o -> o.getId()).collect(Collectors.toList())) ); - result= setFeedback(result,feedbacks); + result = setFeedback(result, feedbacks); } @@ -492,18 +491,18 @@ public class IZtCountService { return result; } - private ZtStoryCountDTO setFeedback(ZtStoryCountDTO result,List feedbacks) { + private ZtStoryCountDTO setFeedback(ZtStoryCountDTO result, List feedbacks) { //问题反馈 未受理 - result.setFeedbackWslCount(feedbacks.stream().filter(o->"wait".equals(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setFeedbackWslCount(feedbacks.stream().filter(o -> "wait".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); //处理中的 wait doing finished submitVerified 提交验收 closed reviewing verified 验收 dontHand 无需处理 - result.setFeedbackClzCount(feedbacks.stream().filter(o->Arrays.asList("doing","finished","submitVerified").contains(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setFeedbackClzCount(feedbacks.stream().filter(o -> Arrays.asList("doing", "finished", "submitVerified").contains(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); //处理完的 - result.setFeedbackClwCount(feedbacks.stream().filter(o->Arrays.asList("verified").contains(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setFeedbackClwCount(feedbacks.stream().filter(o -> Arrays.asList("verified").contains(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); //延期的 - result.setFeedbackYqCount(feedbacks.stream().filter(o->Arrays.asList("doing","wait").contains(o.getStatus())).filter(o->o.getPlanFinishDate()!=null&&o.getPlanFinishDate().getTime()o.getId()+"").collect(Collectors.joining(","))); - result.setFeedbackGbCount(feedbacks.stream().filter(o->"closed".equals(o.getStatus())) .map(o->o.getId()+"").collect(Collectors.joining(","))); + result.setFeedbackYqCount(feedbacks.stream().filter(o -> Arrays.asList("doing", "wait").contains(o.getStatus())).filter(o -> o.getPlanFinishDate() != null && o.getPlanFinishDate().getTime() < new Date().getTime()).map(o -> o.getId() + "").collect(Collectors.joining(","))); + result.setFeedbackGbCount(feedbacks.stream().filter(o -> "closed".equals(o.getStatus())).map(o -> o.getId() + "").collect(Collectors.joining(","))); return result; } @@ -523,7 +522,11 @@ public class IZtCountService { private IZtTeamService teamService; @Autowired - private IZtMeetingService meetingService;; + private IZtMeetingService meetingService; + ; + + @Autowired + private IZtStoryFeedbackService storyFeedbackService; // @Autowired @@ -532,19 +535,15 @@ public class IZtCountService { public void exportScope(ZtCountQo qo, ServletRequest request, HttpServletResponse response) { - try { - - List perList =newPerformanceCount(qo); - if(CollectionUtils.isEmpty(perList)){ + List perList = newPerformanceCount(qo); + if (CollectionUtils.isEmpty(perList)) { throw new BusinessException("未查询到数据"); } - - Map userMap = userService.userMapByIds(null); List list = new ArrayList<>(); @@ -554,41 +553,39 @@ public class IZtCountService { PerformanceDTO performanceDTO = perList.get(i); ZtUser ztUser = userMap.get(performanceDTO.getAccount()); - if(ztUser.getAccount().equals("liyuyan")){ - generatorXMZLExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"项目助理考核.xlsx"); - }else - if(ztUser.getAccount().equals("liushengqing")){ - generatorUiExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"UI工程师.xlsx"); - }else - if(ztUser.getUserType()==UserType.CS){ - generatorTestExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"测试.xlsx"); - }else if(ztUser.getUserType()==UserType.KFZ){ - generatorDevlopExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"开发.xlsx"); - }else if(ztUser.getUserType()==UserType.UI){ - generatorUiExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"UI工程师.xlsx"); - }else if(ztUser.getUserType()==UserType.XMZL||"liyuyan".equals(ztUser.getAccount())){ - generatorXMZLExcel(performanceDTO.getUserName(),performanceDTO,qo.getDate()); - list.add(performanceDTO.getUserName()+"项目助理考核.xlsx"); - }else if(ztUser.getUserType()==UserType.XMJL||ztUser.getUserType()==UserType.XMGLY||ztUser.getUserType()==UserType.GSGC){ - generatorXMJLExcel(qo,performanceDTO.getUserName(),performanceDTO,qo.getDate(),perList); - list.add(performanceDTO.getUserName()+"项目经理考核.xlsx"); + if (ztUser.getAccount().equals("liyuyan")) { + generatorXMZLExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "项目助理考核.xlsx"); + } else if (ztUser.getAccount().equals("liushengqing")) { + generatorUiExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "UI工程师.xlsx"); + } else if (ztUser.getUserType() == UserType.CS) { + generatorTestExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "测试.xlsx"); + } else if (ztUser.getUserType() == UserType.KFZ) { + generatorDevlopExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "开发.xlsx"); + } else if (ztUser.getUserType() == UserType.UI) { + generatorUiExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "UI工程师.xlsx"); + } else if (ztUser.getUserType() == UserType.XMZL || "liyuyan".equals(ztUser.getAccount())) { + generatorXMZLExcel(performanceDTO.getUserName(), performanceDTO, qo.getDate()); + list.add(performanceDTO.getUserName() + "项目助理考核.xlsx"); + } else if (ztUser.getUserType() == UserType.XMJL || ztUser.getUserType() == UserType.XMGLY || ztUser.getUserType() == UserType.GSGC) { + generatorXMJLExcel(qo, performanceDTO.getUserName(), performanceDTO, qo.getDate(), perList); + list.add(performanceDTO.getUserName() + "项目经理考核.xlsx"); } } - String dir=System.getProperty("user.dir")+"/"; + String dir = System.getProperty("user.dir") + "/"; //生成多sheetexcel - String fileName=dir+DateUtils.formatDate(new Date(),"yyyyMMddHHmmss")+".xlsx"; -// list.add(fileName); - FileOutputStream stream = new FileOutputStream(fileName); + String fileName = dir + DateUtils.formatDate(new Date(), "yyyyMMddHHmmss") + ".xlsx"; + list.add(fileName); + FileOutputStream stream = new FileOutputStream(fileName); try { - exportProjectCount(qo,request,stream); - }catch (Exception e){ + exportProjectCount(qo, request, stream); + } catch (Exception e) { throw new BusinessException("导出失败"); - }finally { + } finally { stream.close(); } @@ -610,13 +607,12 @@ public class IZtCountService { // } // } - String excelName=DateUtils.formatDate(qo.getDate(),"yyyy-MM-dd")+"绩效"+".xlsx"; + String excelName = DateUtils.formatDate(qo.getDate(), "yyyy-MM-dd") + "绩效" + ".xlsx"; - ExcelUtil.mergexcel(list,excelName, dir); + ExcelUtil.mergexcel(list, excelName, dir); - - File f = new File(dir+excelName); + File f = new File(dir + excelName); InputStream fis = new BufferedInputStream(new FileInputStream(f)); // InputStream fis = new BufferedInputStream(new FileInputStream("D:\\1.bmp")); byte[] buffer = new byte[fis.available()]; @@ -642,75 +638,61 @@ public class IZtCountService { response.getOutputStream().close(); response.flushBuffer(); - }catch (Exception e){ - log.error("",e); + } catch (Exception e) { + log.error("", e); } } - public void exportProjectCount(ZtCountQo qo,jakarta.servlet.ServletRequest request,OutputStream outputStream) { + public void exportProjectCount(ZtCountQo qo, jakarta.servlet.ServletRequest request, OutputStream outputStream) { try { - List workDetailsDTOS = projectWorkCount(qo,request); + List workDetailsDTOS = projectWorkCount(qo, request); // ByteArrayOutputStream os = new ByteArrayOutputStream(); List workDetailsDTOS1 = workDetailsCount(qo); - List workTasks= workTaskCounts(qo); - - - List perList =performanceCount(qo); - - - + List workTasks = workTaskCounts(qo); ExcelWriter excelWriter = EasyExcel.write(outputStream) - . registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) .needHead(Boolean.TRUE).build(); - for (int i = 0; i < 4; i++) { + for (int i = 0; i < 3; i++) { - if(i==1){ + if (i == 1) { WriteSheet writeSheet = EasyExcel.writerSheet(i, "导出工作量") - .head(ProjectWorkDetailsDTO.class) + .head(ProjectWorkDetailsDTO.class) .needHead(Boolean.TRUE).build(); excelWriter.write(workDetailsDTOS, writeSheet); - } - else if(i==2){ + } else + if (i == 2) { //任务 WriteSheet writeSheet = EasyExcel.writerSheet(i, "任务统计") .head(ProjectWorkTaskDTO.class) .needHead(Boolean.TRUE).build(); excelWriter.write(workTasks, writeSheet); - } - else if(i==0){ + } else if (i == 0) { WriteSheet writeSheet = EasyExcel.writerSheet(i, "导出统计") .head(WorkDetailsDTO.class) .needHead(Boolean.TRUE).build(); excelWriter.write(workDetailsDTOS1, writeSheet); } - else if(i==3){ - - WriteSheet writeSheet = EasyExcel.writerSheet(i, "绩效") - .head(PerformanceDTO.class) - .needHead(Boolean.TRUE).build(); - excelWriter.write(perList, writeSheet); - } } excelWriter.finish(); - }catch (Exception e){ - log.error("",e); + } catch (Exception e) { + log.error("", e); } } private List performanceCount(ZtCountQo qo) { Date d = qo.getDate(); - if(d==null){ - d=new Date(); + if (d == null) { + d = new Date(); } Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); @@ -729,14 +711,14 @@ public class IZtCountService { return new ArrayList<>(); } List execList = executionprojectService.list(new QueryWrapper().lambda() - .in(ZtExecutionproject::getProject, projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList()))); + .in(ZtExecutionproject::getProject, projectproducts.stream().map(o -> o.getProject()).collect(Collectors.toList()))); if (CollectionUtils.isEmpty(execList)) { return new ArrayList<>(); } List taskList = this.taskService.list(new QueryWrapper().lambda() - .and(o->o.between(ZtTask::getDeadline, firstDayOfMonth,lastDayOfMonth) + .and(o -> o.between(ZtTask::getDeadline, firstDayOfMonth, lastDayOfMonth) .or() - .between(ZtTask::getFinishedDate, firstDayOfMonth,lastDayOfMonth) + .between(ZtTask::getFinishedDate, firstDayOfMonth, lastDayOfMonth) ) .in(ZtTask::getExecution, execList.stream().map(o -> o.getExecution()) .collect(Collectors.toList()))); @@ -754,15 +736,15 @@ public class IZtCountService { } //accountIds 成员 - List ztUsers = this.userService.list(new QueryWrapper().lambda().in(ZtUser::getAccount,accountIds)); + List ztUsers = this.userService.list(new QueryWrapper().lambda().in(ZtUser::getAccount, accountIds)); - List result =new ArrayList<>(); + List result = new ArrayList<>(); - for (ZtUser u:ztUsers) { + for (ZtUser u : ztUsers) { - List approvalList = this.taskService.itApprovalByUserName(u.getNickname(),firstDayOfMonth, lastDayOfMonth); - result.add(buildCsScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); + List approvalList = this.taskService.itApprovalByUserName(u.getNickname(), firstDayOfMonth, lastDayOfMonth); + result.add(buildCsScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); } return result; } @@ -770,17 +752,21 @@ public class IZtCountService { private List newPerformanceCount(ZtCountQo qo) { Date d = qo.getDate(); - if(d==null){ - d=new Date(); + if (d == null) { + d = new Date(); } Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); - //产品集 + List productList = null; Integer project = qo.getProject(); -// if(qo.){ -// -// } - List productList = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, project)); + if (qo.getProject() == null) { + List ids = this.projectService.authProductList(); + productList = this.productService.list(new QueryWrapper().lambda().in(ZtProduct::getId, ids)); + + } else { + productList = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, project)); + + } if (CollectionUtils.isEmpty(productList)) { return new ArrayList<>(); } @@ -789,26 +775,10 @@ public class IZtCountService { if (CollectionUtils.isEmpty(projectproducts)) { return new ArrayList<>(); } - List execList = executionprojectService.list(new QueryWrapper().lambda() - .in(ZtExecutionproject::getProject, projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList()))); - if (CollectionUtils.isEmpty(execList)) { - return new ArrayList<>(); - } - List taskList =this.taskService.taskListByEIdsAndDate(firstDayOfMonth,lastDayOfMonth,execList.stream().map(o -> o.getExecution()) - .collect(Collectors.toList())); + List taskList = this.taskService.taskListByEIdsAndDate(firstDayOfMonth, lastDayOfMonth, productList.stream().map(o->o.getId()).collect(Collectors.toList())); + List ztProjects = this.projectService.getExecutionsListByProjectAndDate(projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList()), firstDayOfMonth, lastDayOfMonth); - if (CollectionUtils.isEmpty(taskList)) { - return new ArrayList<>(); - } - List ztProjects = this.projectService.listByIds(execList.stream().map(o -> o.getExecution()).collect(Collectors.toList())); - - - ztProjects = ztProjects.stream().filter(o -> (o.getBegin().getTime() >= firstDayOfMonth.getTime() - && o.getBegin().getTime() <= lastDayOfMonth.getTime()) || ( - o.getEnd().getTime() >= firstDayOfMonth.getTime() - && o.getEnd().getTime() <= lastDayOfMonth.getTime() - )).collect(Collectors.toList()); if (CollectionUtils.isEmpty(ztProjects)) { return new ArrayList<>(); } @@ -822,640 +792,521 @@ public class IZtCountService { } //accountIds 成员 - List ztUsers = this.userService.list(new QueryWrapper().lambda().in(ZtUser::getAccount,accountIds)); + List ztUsers = this.userService.list(new QueryWrapper().lambda() + .in(ZtUser::getAccount, accountIds)); - List result =new ArrayList<>(); + List result = new ArrayList<>(); - for (ZtUser u:ztUsers) { + for (ZtUser u : ztUsers) { - List approvalList = this.taskService.itApprovalByUserName(u.getNickname(),firstDayOfMonth, lastDayOfMonth); - if(u.getAccount().equals("liyuyan")){ - result.add(buildXMZLScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else - if("liushengqing".equals(u.getAccount())){ - result.add(buildUiScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else - if(u.getUserType()==UserType.KFZ){ - result.add(buildKFZScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else if(u.getUserType()==UserType.CS){ - result.add(buildCScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else if(u.getUserType()==UserType.UI){ - result.add(buildUiScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else if(u.getUserType()==UserType.XMJL||u.getUserType()==UserType.XMGLY||u.getUserType()==UserType.GSGC){ - result.add(buildXMJLScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); - }else if(u.getUserType()==UserType.XMZL){ - result.add(buildXMZLScore(u,approvalList,firstDayOfMonth,lastDayOfMonth,taskList,d)); + List approvalList = this.taskService.itApprovalByUserName(u.getNickname(), firstDayOfMonth, lastDayOfMonth); + if (u.getAccount().equals("liyuyan")) { + result.add(buildXMZLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if ("liushengqing".equals(u.getAccount())) { + result.add(buildUiScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if (u.getUserType() == UserType.KFZ) { + result.add(buildKFZScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if (u.getUserType() == UserType.CS) { + result.add(buildCScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if (u.getUserType() == UserType.UI) { + result.add(buildUiScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if (u.getUserType() == UserType.XMJL || u.getUserType() == UserType.XMGLY || u.getUserType() == UserType.GSGC) { + result.add(buildXMJLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); + } else if (u.getUserType() == UserType.XMZL) { + result.add(buildXMZLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d)); } } return result; } - //新的 - PerformanceDTO buildKFZScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ - PerformanceDTO dto=new PerformanceDTO(); + //新的 + PerformanceDTO buildKFZScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { + + PerformanceDTO dto = new PerformanceDTO(); dto.setUserName(u.getNickname()); dto.setAccount(u.getAccount()); - //本月天数 - int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); - //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; - } - //本月天数 - dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); - //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); - //可用工时 6小时算 - dto.setTotalTime(dto.getDays().multiply(BigDecimal.valueOf(8)).multiply(BigDecimal.valueOf(0.75))); - //达标工时 - dto.setExamineTime(dto.getTotalTime().subtract(BigDecimal.valueOf(applyTime))); + + + dto = setUserWorkTime(dto, d, approvalList, firstDayOfMonth); + //产出工时 算task - List taskTimeList = taskList.stream().filter(o->!o.getStatus().equals("closed")&&!o.getStatus().equals("cancel")).filter(o->u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); + List taskTimeList = this.taskService.getDevelAllocation(taskList.stream().filter(o -> u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList())); + dto.setTotalTask(BigDecimal.valueOf(taskTimeList.stream().filter(o->o.getStatus().equals("done")).collect(Collectors.toList()).size())); + + //延期任务 + List delayTaskList = this.taskService.getDelayTask(taskTimeList); + + dto.setDelayTask(BigDecimal.valueOf(delayTaskList.size())); //分配总工时 - dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); + dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().filter(o->o.getStatus().equals("done")).map(o -> o.getEstimate()).collect(Collectors.toList()))); - dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); + dto.setWorkTime(floatBatchAdd(taskTimeList.stream().map(o -> o.getConsumed()).collect(Collectors.toList()))); //工作饱和度 - dto.setSaturation(dto.getTotalTime().floatValue()==0?BigDecimal.ZERO:dto.getAllocationTime().divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP)); - float saturation = dto.getSaturation().floatValue(); + dto.setSaturation(dto.getTotalTime().floatValue() == 0 ? BigDecimal.ZERO : dto.getAllocationTime().divide(dto.getExamineTime(), 2, BigDecimal.ROUND_HALF_UP)); + + //完成准时率 TODO 延期 / 总完成 - //准时任务 - BigDecimal onTime = floatBatchAdd(taskTimeList.stream().filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() <= DateUtils.getDayLast(o.getDeadline()).getTime()).map(o -> o.getEstimate()).collect(Collectors.toList())); + BigDecimal onTime = floatBatchAdd(taskTimeList.stream().filter(o -> o.getFinishedDate() != null && o.getFinishedDate().getTime() <= DateUtils.getDayLast(o.getDeadline()).getTime()).map(o -> o.getEstimate()).collect(Collectors.toList())); //全部完成 - BigDecimal finishAllTime = floatBatchAdd(taskTimeList.stream().map(o -> o.getEstimate()).collect(Collectors.toList())); + BigDecimal finishAllTime = dto.getAllocationTime(); // List finishAllTime = ; //准时完成率 - BigDecimal onTimeFinishRate = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : onTime.divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal onTimeFinishRate = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : onTime.divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); dto.setFinishPunctuality(onTimeFinishRate); /**准时率得分 * 1. =100%,得满分; * 2. <100%,每减少1%,扣3分,扣完截止。 * */ - dto.setPunctualityScore(onTimeFinishRate.equals(BigDecimal.valueOf(1))?BigDecimal.valueOf(25) - :BigDecimal.valueOf(25).subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(300))).floatValue()<=0?BigDecimal.ZERO: - BigDecimal.valueOf(25).subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(300))) - ); - + dto.setPunctualityScore(onTimeFinishRate.intValue() == 1 ? BigDecimal.valueOf(25) + : BigDecimal.valueOf(25).subtract((BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(100))).multiply(BigDecimal.valueOf(3))).floatValue() <= 0 ? BigDecimal.ZERO : + BigDecimal.valueOf(BigDecimal.valueOf(25).subtract((BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(100))).multiply(BigDecimal.valueOf(3))).floatValue()) + ); //bug得分 - List bugList = this.bugService.list(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .eq(ZtBug::getAssignedTo,u.getAccount())); + List bugList = this.bugService.list(new QueryWrapper().lambda(). + ge(ZtBug::getOpeneddate, firstDayOfMonth).le(ZtBug::getOpeneddate, lastDayOfMonth) + .eq(ZtBug::getAssignedTo, u.getAccount())); + //bug密度 + int bugSize = bugList.size(); + BigDecimal bugDensity = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : BigDecimal.valueOf(bugSize).divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); + dto.setBugDensity(bugDensity); BigDecimal bugScore = BigDecimal.valueOf(30); - bugScore= BigDecimalUtils.isZero(finishAllTime) ?BigDecimal.ZERO: CollectionUtils.isEmpty(bugList)?bugScore: - BigDecimal.valueOf(bugList.size()).divide(finishAllTime,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()<=15?bugScore: - BigDecimal.valueOf(bugList.size()).divide(finishAllTime,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()>25?BigDecimal.ZERO: - bugScore.subtract(BigDecimal.valueOf(bugList.size()).divide(finishAllTime,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).subtract(BigDecimal.valueOf(15)).multiply(BigDecimal.valueOf(3))); + bugScore = BigDecimalUtils.isZero(finishAllTime) ? BigDecimal.ZERO : bugSize < 1 ? bugScore : + BigDecimal.valueOf(bugSize).divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue() <= 15 ? bugScore : + BigDecimal.valueOf(bugSize).divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue() > 25 ? BigDecimal.ZERO : + bugScore.subtract(BigDecimal.valueOf(bugSize).divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).subtract(BigDecimal.valueOf(15)).multiply(BigDecimal.valueOf(3))); dto.setBugCount(BigDecimal.valueOf(bugList.size())); dto.setBugScore(bugScore); + dto.setWorkAttitude(BigDecimal.valueOf(5)); + dto.setDocumentQualityScore(BigDecimal.valueOf(15)); + dto.setCodeQualityScore(BigDecimal.valueOf(5)); //工作质量 1. 全月Bug总数<6个 //2. 当月绩效考核成绩95分以上 //工作质量1. 全月Bug总数<6个 - BigDecimal saturationScore=saturation>=1?BigDecimal.valueOf(20):saturation<0.9?BigDecimal.ZERO:BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(1) - .subtract(BigDecimal.valueOf(saturation)).multiply(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(2))); //饱和率 分数 每天6小时 需求总工时 20分 一个扣2分 - if(BigDecimalUtils.isZero(dto.getExamineTime())||BigDecimalUtils.isZero(dto.getAllocationTime())){ + if (BigDecimalUtils.isZero(dto.getExamineTime()) || BigDecimalUtils.isZero(dto.getAllocationTime())) { dto.setSaturationScore(BigDecimal.ZERO); - }else{ - int allocationTime = dto.getAllocationTime().intValue(); - int examineTime = dto.getExamineTime().intValue(); - dto.setSaturationScore(BigDecimal.valueOf(allocationTime>=examineTime?20:(20-(examineTime-allocationTime)*2)<=0?0:(20-(examineTime-allocationTime)*2))); + } else { + BigDecimal saturation = dto.getSaturation(); + int saturationInt = saturation.multiply(BigDecimal.valueOf(100)).intValue(); + BigDecimal saturationScore = BigDecimal.ZERO; + if (saturationInt >= 100) { + saturationScore = BigDecimal.valueOf(20); + } else if (saturationInt > 90) { + saturationScore = BigDecimal.valueOf(20 - (100 - saturationInt) * 2); + } else { + + } + dto.setSaturationScore(saturationScore); } return dto; } - PerformanceDTO buildCScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ - - PerformanceDTO dto=new PerformanceDTO(); - dto.setUserName(u.getNickname()); - dto.setAccount(u.getAccount()); + public PerformanceDTO setUserWorkTime(PerformanceDTO dto, Date d, List approvalList, Date firstDayOfMonth) { //本月天数 int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; + BigDecimal applyTime = BigDecimal.ZERO; + if (!CollectionUtils.isEmpty(approvalList)) { + applyTime = getApprovalTime(approvalList, firstDayOfMonth); + ; } //本月天数 dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); + dto.setApprovalDays(applyTime); //可用工时 6小时算 - dto.setTotalTime(dto.getDays().multiply(BigDecimal.valueOf(8)).multiply(BigDecimal.valueOf(0.75))); + BigDecimal totalTime = dto.getDays().multiply(BigDecimal.valueOf(8)); + dto.setTotalTime(totalTime.multiply(BigDecimal.valueOf(0.75))); //达标工时 - dto.setExamineTime(dto.getTotalTime().subtract(BigDecimal.valueOf(applyTime))); + dto.setExamineTime(totalTime.subtract(applyTime).multiply(BigDecimal.valueOf(0.75))); + return dto; + } + + PerformanceDTO buildCScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { + + PerformanceDTO dto = new PerformanceDTO(); + dto.setUserName(u.getNickname()); + dto.setAccount(u.getAccount()); + + dto = setUserWorkTime(dto, d, approvalList, firstDayOfMonth); //产出工时 算task - List taskTimeList = taskList.stream().filter(o->!o.getStatus().equals("closed")&&!o.getStatus().equals("cancel") - ).filter(o->o.getAssignedTo().equals(u.getAccount())).collect(Collectors.toList()); + List taskTimeList = taskList.stream().filter(o -> !o.getStatus().equals("closed") && !o.getStatus().equals("cancel") + ).filter(o -> o.getAssignedTo().equals(u.getAccount())).collect(Collectors.toList()); + dto.setTotalTask(BigDecimal.valueOf(taskTimeList.stream().filter(o->o.getStatus().equals("done")).collect(Collectors.toList()).size())); - BigDecimal finishAllTime = floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList())); - List onTimeTask = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() <= DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - BigDecimal onTime=floatBatchAdd(onTimeTask.stream().map(o->o.getEstimate()) + List delayTask = this.taskService.getDelayTask(taskTimeList); + + dto.setDelayTask(BigDecimal.valueOf(delayTask.size())); + + BigDecimal finishAllTime = floatBatchAdd(taskTimeList.stream().map(o -> o.getEstimate()).collect(Collectors.toList())); + + List onTimeTask = this.taskService.getOnTimeTask(taskTimeList); + + BigDecimal onTime = floatBatchAdd(onTimeTask.stream().map(o -> o.getEstimate()) .collect(Collectors.toList())); //准时完成率 BigDecimal onTimeFinishRate = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : onTime.divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); - BigDecimal finishScope=BigDecimal.valueOf(20); - dto.setPunctualityScore(onTimeFinishRate.equals(BigDecimal.valueOf(1))?finishScope: - onTimeFinishRate.multiply(BigDecimal.valueOf(100)).intValue()<90?BigDecimal.ZERO: - finishScope.subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(2)).multiply(BigDecimal.valueOf(100))) ); - - long seriousBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1)); + onTimeFinishRate = onTimeFinishRate.floatValue() > 1 ? BigDecimal.valueOf(1) : onTimeFinishRate; + dto.setFinishPunctuality(onTimeFinishRate); + BigDecimal finishScope = BigDecimal.valueOf(20); + dto.setPunctualityScore(onTimeFinishRate.floatValue() >= 1 ? finishScope : + onTimeFinishRate.multiply(BigDecimal.valueOf(100)).intValue() < 90 ? BigDecimal.ZERO : + finishScope.subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(2)).multiply(BigDecimal.valueOf(100)))); + List allBugList = this.bugService.list(new QueryWrapper().lambda() + .eq(ZtBug::getOpenedby, u.getAccount()) + .ge(ZtBug::getOpeneddate, firstDayOfMonth).le(ZtBug::getOpeneddate, lastDayOfMonth)); + allBugList = allBugList.stream().filter(o -> ("closed".equals(o.getStatus()) ? + ((!StringUtils.isEmpty(o.getResolvedby())) ? true : false) : true)).collect(Collectors.toList()); + //严重 + long seriousBug = allBugList.stream().filter(o -> Integer.valueOf(1).equals(o.getSeverity())).count(); //轻微 - long slightBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 2,3, 4)); - long totalBug = seriousBug*5+slightBug*1; + long slightBug = allBugList.stream().filter(o -> Arrays.asList(4, 2, 3).contains(o.getSeverity())).count(); + long totalBug = seriousBug * 5 + slightBug * 1; + dto.setBugFindRate(BigDecimalUtils.isZero(dto.getExamineTime()) ? BigDecimal.ZERO : BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(), 2, BigDecimal.ROUND_HALF_UP)); //缺陷检出率 TODO bug 数量 / 可用工时 250418尹工说的 - int bugFindScore=BigDecimalUtils.isZero( dto.getExamineTime()) ?0:BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()>20?30: - (30-(20-BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue())*2); - dto.setBugFindScore(BigDecimal.valueOf(bugFindScore<0?0:bugFindScore)); + int bugFindScore = dto.getBugFindRate().multiply(BigDecimal.valueOf(100)).intValue() > 20 ? 30 : + (30 - (20 - BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(), 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()) * 2); + dto.setDevSeriousBug(BigDecimal.valueOf(seriousBug)); + dto.setDevSlightBug(BigDecimal.valueOf(slightBug)); + //bug检出率 + dto.setBugFindScore(BigDecimal.valueOf(bugFindScore < 0 ? 0 : bugFindScore)); + //暂未定义 + dto.setSlightBug(BigDecimal.ZERO); + dto.setSeriousBug(BigDecimal.ZERO); + dto.setBugScore(BigDecimal.ZERO); + + dto.setDocumentQualityScore(BigDecimal.ZERO); + dto.setDocumentQualityProblem(BigDecimal.ZERO); + dto.setWorkTime(BigDecimal.ZERO); + dto.setExcellentShare(BigDecimal.ZERO); + dto.setQuality(BigDecimal.ZERO); //TODO 加分项1. 全月无Bug //2. 当月绩效考核成绩95分以上 +10分 //线上bug 当月上线需求的线上Bug数量 TODO 待明确 - - - - - //分配总工时 - taskTimeList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); - dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); - - dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); - + List prodBugList = this.bugService.list(new QueryWrapper().lambda() + .eq(ZtBug::getAssignedTo, u.getAccount()) + .ge(ZtBug::getOpeneddate, firstDayOfMonth).le(ZtBug::getOpeneddate, lastDayOfMonth)); + prodBugList = allBugList.stream().filter(o -> o.getBugType().equals("prod")).filter(o -> ("closed".equals(o.getStatus()) ? + ((!StringUtils.isEmpty(o.getResolvedby())) ? true : false) : true)).collect(Collectors.toList()); + prodBugList.add(new ZtBug()); + if (CollectionUtils.isEmpty(prodBugList)) { + dto.setBugScore(BigDecimal.valueOf(20)); + } else { + //严重 + long prodSeriousBug = prodBugList.stream().filter(o -> Integer.valueOf(1).equals(o.getSeverity())).count(); + //轻微 + long prodSlightBug = prodBugList.stream().filter(o -> Arrays.asList(4, 2, 3).contains(o.getSeverity())).count(); + if (prodSeriousBug > 0) { + dto.setBugScore(BigDecimal.valueOf(0)); + } else { + dto.setBugScore(BigDecimal.valueOf((20 - prodSlightBug * 5) <= 0 ? 0 : (20 - prodSlightBug * 5))); + } + } + dto.setBugScore(BigDecimal.valueOf(20)); + dto.setDocumentQualityScore(BigDecimal.valueOf(25)); + dto.setWorkAttitude(BigDecimal.valueOf(5)); return dto; } - PerformanceDTO buildUiScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ - PerformanceDTO dto=new PerformanceDTO(); + PerformanceDTO buildUiScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { + + PerformanceDTO dto = new PerformanceDTO(); dto.setUserName(u.getNickname()); dto.setAccount(u.getAccount()); - //本月天数 - int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); - //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; - } - //本月天数 - dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); - //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); - //可用工时 6小时算 - dto.setTotalTime( - dto.getApprovalDays().intValue()==0?dto.getDays().multiply(BigDecimal.valueOf(8)).setScale(2,BigDecimal.ROUND_HALF_UP) - :dto.getDays().multiply(BigDecimal.valueOf(8)).subtract(dto.getApprovalDays()).setScale(2,BigDecimal.ROUND_HALF_UP)); - //达标工时 - dto.setExamineTime(dto.getTotalTime().multiply(BigDecimal.valueOf(0.75))); + dto = setUserWorkTime(dto, d, approvalList, firstDayOfMonth); + //准时率得分 + List myTaskList = taskList.stream().filter(o -> !o.getStatus().equals("closed") && !o.getStatus().equals("cancel")).filter(o -> u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); + //准时任务 + List onTimeTask = this.taskService.getOnTimeTask(myTaskList); + List delayTask = this.taskService.getDelayTask(myTaskList); - //产出工时 算task - List taskTimeList = taskList.stream() - .filter(o->o.getFinishedDate()!=null&& - o.getFinishedDate().getTime()<=lastDayOfMonth.getTime() &&firstDayOfMonth.getTime()<=o.getFinishedDate().getTime() - ).collect(Collectors.toList()); + BigDecimal onTimeRate = CollectionUtils.isEmpty(myTaskList) ? BigDecimal.ZERO : + CollectionUtils.isEmpty(onTimeTask) ? BigDecimal.ZERO : + (BigDecimal.valueOf(onTimeTask.size()).divide(BigDecimal.valueOf(myTaskList.size()), 2, BigDecimal.ROUND_HALF_UP)); - BigDecimal finishAllTime = floatBatchAdd(taskTimeList.stream().map(o->o.getConsumed()).collect(Collectors.toList())); - List onTimeTask = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() < DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - BigDecimal onTime=floatBatchAdd(onTimeTask.stream().map(o->o.getConsumed()).collect(Collectors.toList())); - //准时完成率 - BigDecimal onTimeFinishRate = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : onTime.divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); - BigDecimal finishScope=BigDecimal.valueOf(20); - dto.setPunctualityScore(onTimeFinishRate.equals(BigDecimal.valueOf(1))?finishScope: - onTimeFinishRate.multiply(BigDecimal.valueOf(100)).intValue()<80?BigDecimal.ZERO: - finishScope.subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(2)).multiply(BigDecimal.valueOf(100))) ); -// taskList - // punctualityScore 准时率得分 - // 1 2 严重 - long seriousBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1)); - - //轻微 - long slightBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 2,3, 4)); - long totalBug = seriousBug*5+slightBug*1; - //缺陷检出率 TODO bug 数量 / 可用工时 250418尹工说的 - int bugFindScore=BigDecimalUtils.isZero(dto.getExamineTime()) ?0:BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()>20?30: - (30-(BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()-20)*2); - dto.setBugFindScore(BigDecimal.valueOf(bugFindScore<0?0:bugFindScore)); - //TODO 加分项1. 全月无Bug - //2. 当月绩效考核成绩95分以上 +10分 - - //线上bug 当月上线需求的线上Bug数量 TODO - - - - - //分配总工时 - taskTimeList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); - dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); - - dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); - - //工作饱和度 - dto.setSaturation(dto.getTotalTime().floatValue()==0?BigDecimal.ZERO:dto.getAllocationTime().divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP)); - float saturation = dto.getSaturation().floatValue(); - //完成准时率 TODO 延期 / 总完成 - List delayTaskList =null; - try { - delayTaskList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() > DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - }catch (Exception e){ - log.error("",e); - } - - dto.setFinishTask(BigDecimal.valueOf(taskTimeList.stream().filter(o->o.getFinishedDate()!=null).map(o->o.getEstimate()).collect(Collectors.toList()).size())); - dto.setDelayTask(BigDecimal.valueOf(delayTaskList.size())); - //准时完成率 - dto.setFinishPunctuality(taskTimeList.size()==0?BigDecimal.valueOf(0): - CollectionUtils.isEmpty(delayTaskList)?BigDecimal.valueOf(1): - BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(delayTaskList.size()) - .divide(dto.getFinishTask(),2,BigDecimal.ROUND_HALF_UP))); - //工作饱和度 - if(saturation<0.7){ - // = 0 - dto.setSaturationScore(BigDecimal.ZERO); - }else{ - if(saturation<0.9){ - dto.setSaturationScore(BigDecimal.valueOf(40 - ( 0.9 - saturation ) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); - }else{ - dto.setSaturationScore(BigDecimal.valueOf(40)); - } - } - BigDecimal finishPunctuality = dto.getFinishPunctuality(); - // 准时率得分 ( `完成准时率` < 1 , 25 - (1 - `完成准时率`) * 100 * 1, 25 )) `准时率得分`, - if(finishPunctuality.floatValue()<1){ - //TODO 完成准时率 0.8 - if(finishPunctuality.floatValue()<0.8){ - dto.setPunctualityScore(BigDecimal.ZERO); - }else{ - dto.setPunctualityScore(BigDecimal.valueOf(25 - (1 - finishPunctuality.floatValue()) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); - - } - }else{ - //饱和率得分 - dto.setPunctualityScore(BigDecimal.valueOf(25)); - } -// if(CollectionUtils.isEmpty(taskTimeList)){ -// bugList=new ArrayList<>(); -// }else{ -// bugList = this.bugService.list(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) -// .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); -// } - List bugList = this.bugService.list(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); -// if(!CollectionUtils.isEmpty(fTask)){ -// count = bugService.count(new QueryWrapper().lambda().in(ZtBug::getTotask, fTask.stream().map(o -> o.getId()).collect(Collectors.toList()))); -// } - -// if(CollectionUtils.isEmpty(bugList)){ -// dto.setSeriousBug(BigDecimal.ZERO); -// dto.setSlightBug(BigDecimal.ZERO); -// dto.setBugScore(BigDecimal.valueOf(10)); -// }else{ -// Long seriousBug = bugList.stream().filter(o -> o.getSeverity() == 1).count(); -// dto.setSeriousBug(BigDecimal.valueOf(seriousBug)); -// Long slightBug = bugList.stream().filter(o -> o.getSeverity() == 1).count(); -// dto.setSlightBug(BigDecimal.valueOf(slightBug)); -// -// -// //测试 if(`线上严重bug` = 0 AND `线上普通bug` = 0, 20, 20 - `线上严重bug` * 20 - `线上普通bug` * 5 ) -// if(u.getUserType()==UserType.CS){ -// dto.setBugScore( -// (seriousBug==0l&&slightBug==0l)?BigDecimal.valueOf(20):BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(5))))) -// ); -// }else{ -// dto.setBugScore((seriousBug==0l&&slightBug==0l)?BigDecimal.valueOf(10):BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(3)))))); -// } -// //其余 if(`线上严重bug` = 0 AND `线上普通bug` = 0, 10, 10 - `线上严重bug` * 10 - `线上普通bug` * 3 ) -// } -// if(u.getUserType()==UserType.CS){ -// //算绩效 `线上bug得分` + `准时率得分` + 50, -// dto.setScore(dto.getBugScore() .add(dto.getPunctualityScore()).add(BigDecimal.valueOf(50)) ); -// }else{ -// //`饱和率得分`+ `线上bug得分` + `准时率得分` + 25 -// dto.setScore(dto.getSaturationScore() .add(dto.getBugScore()).add(dto.getPunctualityScore()).add(BigDecimal.valueOf(25))); -// } + int iOnTime = onTimeRate.multiply(BigDecimal.valueOf(100)).intValue(); + dto.setPunctualityScore(BigDecimal.valueOf(iOnTime >= 100 ? 50 : (iOnTime > 90) ? 40 : 0)); + dto.setTotalTask(BigDecimal.valueOf(myTaskList.size())); + dto.setDelayTask(BigDecimal.valueOf(delayTask.size())); + dto.setFinishPunctuality(onTimeRate); + //设计质量 + dto.setDesignScore(BigDecimal.valueOf(40)); + dto.setDesignQualityProblem(BigDecimal.ZERO); + //工作态度 + dto.setWorkAttitude(BigDecimal.valueOf(10)); return dto; } - PerformanceDTO buildXMJLScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ - PerformanceDTO dto=new PerformanceDTO(); + + PerformanceDTO buildXMJLScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { + + PerformanceDTO dto = new PerformanceDTO(); dto.setUserName(u.getNickname()); dto.setAccount(u.getAccount()); - dto.setMeetScore(getMeetScore(u,firstDayOfMonth,lastDayOfMonth)); + dto = getMeetScore(u, firstDayOfMonth, lastDayOfMonth, dto); // //拆分任务工时 // dto.setSplitTimeScore(s); //本月天数 int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; + BigDecimal applyTime = BigDecimal.ZERO; + if (!CollectionUtils.isEmpty(approvalList)) { + applyTime = getApprovalTime(approvalList, firstDayOfMonth); + ; } //本月天数 dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); + dto.setApprovalDays(applyTime + ); - dto.setMeetScore(getSearchMeetScore(u,firstDayOfMonth,lastDayOfMonth)); + dto.setMeetScore(getSearchMeetScore(u, firstDayOfMonth, lastDayOfMonth)); return dto; } private BigDecimal getSearchMeetScore(ZtUser u, Date start, Date end) { List pIds = this.projectService.authProductList(); - if(CollectionUtils.isEmpty(pIds)){ + if (CollectionUtils.isEmpty(pIds)) { return BigDecimal.ZERO; } List list = this.meetingService.list(new QueryWrapper().lambda().in(ZtMeeting::getProductId, pIds) + .like(ZtMeeting::getUsers, u.getAccount()) .ge(ZtMeeting::getMeetingDate, start).le(ZtMeeting::getMeetingDate, end)); - if(CollectionUtils.isEmpty(list)){ + if (CollectionUtils.isEmpty(list)) { return BigDecimal.ZERO; } long weekCount = list.stream().filter(o -> o.getType() == MeetingTypeEnums.week).count(); - int weekMeetScore = (int)(weekCount==0?0:(weekCount>=4)?8:2*weekCount); + int weekMeetScore = (int) (weekCount == 0 ? 0 : (weekCount >= 4) ? 8 : 2 * weekCount); long storyCount = list.stream().filter(o -> o.getType() == MeetingTypeEnums.story).count(); - int storyScore= storyCount>0?2:0; - return BigDecimal.valueOf(storyScore+weekMeetScore); + int storyScore = storyCount > 0 ? 2 : 0; + return BigDecimal.valueOf(storyScore + weekMeetScore); } - PerformanceDTO buildXMZLScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ + PerformanceDTO buildXMZLScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { - PerformanceDTO dto=new PerformanceDTO(); + PerformanceDTO dto = new PerformanceDTO(); dto.setUserName(u.getNickname()); dto.setAccount(u.getAccount()); //本月天数 int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; + BigDecimal applyTime = BigDecimal.ZERO; + if (!CollectionUtils.isEmpty(approvalList)) { + applyTime = getApprovalTime(approvalList, firstDayOfMonth); + ; } //本月天数 dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); + dto.setApprovalDays(applyTime); //可用工时 6小时算 dto.setTotalTime( - dto.getApprovalDays().intValue()==0?dto.getDays().multiply(BigDecimal.valueOf(8)).setScale(2,BigDecimal.ROUND_HALF_UP) - :dto.getDays().multiply(BigDecimal.valueOf(8)).subtract(dto.getApprovalDays()).setScale(2,BigDecimal.ROUND_HALF_UP)); + dto.getApprovalDays().intValue() == 0 ? dto.getDays().multiply(BigDecimal.valueOf(8)).setScale(2, BigDecimal.ROUND_HALF_UP) + : dto.getDays().multiply(BigDecimal.valueOf(8)).subtract(dto.getApprovalDays()).setScale(2, BigDecimal.ROUND_HALF_UP)); //达标工时 dto.setExamineTime(dto.getTotalTime().multiply(BigDecimal.valueOf(0.75))); - dto.setReleaseScore(getReleaseScore(u,firstDayOfMonth)); + dto = getReleaseScore(u, firstDayOfMonth, dto); - dto.setMeetScore(getMeetScore(u,firstDayOfMonth,lastDayOfMonth)); + dto = getMeetScore(u, firstDayOfMonth, lastDayOfMonth, dto); + dto.setDocumentQualityScore(BigDecimal.valueOf(50)); - //产出工时 算task - List taskTimeList = taskList.stream() - .filter(o->o.getFinishedDate()!=null&& - o.getFinishedDate().getTime()<=lastDayOfMonth.getTime() &&firstDayOfMonth.getTime()<=o.getFinishedDate().getTime() - ).collect(Collectors.toList()); - - BigDecimal finishAllTime = floatBatchAdd(taskTimeList.stream().map(o->o.getConsumed()).collect(Collectors.toList())); - List onTimeTask = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() < DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - BigDecimal onTime=floatBatchAdd(onTimeTask.stream().map(o->o.getConsumed()).collect(Collectors.toList())); - //准时完成率 - BigDecimal onTimeFinishRate = BigDecimalUtils.isZero(finishAllTime) ? finishAllTime : onTime.divide(finishAllTime, 2, BigDecimal.ROUND_HALF_UP); - BigDecimal finishScope=BigDecimal.valueOf(20); - dto.setPunctualityScore(onTimeFinishRate.equals(BigDecimal.valueOf(1))?finishScope: - onTimeFinishRate.multiply(BigDecimal.valueOf(100)).intValue()<80?BigDecimal.ZERO: - finishScope.subtract(BigDecimal.valueOf(1).subtract(onTimeFinishRate).multiply(BigDecimal.valueOf(2)).multiply(BigDecimal.valueOf(100))) ); -// taskList - // punctualityScore 准时率得分 - // 1 2 严重 - long seriousBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1)); - - //轻微 - long slightBug = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 2,3, 4)); - long totalBug = seriousBug*5+slightBug*1; - //缺陷检出率 TODO bug 数量 / 可用工时 250418尹工说的 - int bugFindScore=BigDecimalUtils.isZero(dto.getExamineTime()) ?0:BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()>20?30: - (30-(BigDecimal.valueOf(totalBug).divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue()-20)*2); - dto.setBugFindScore(BigDecimal.valueOf(bugFindScore<0?0:bugFindScore)); - //TODO 加分项1. 全月无Bug - //2. 当月绩效考核成绩95分以上 +10分 - - //线上bug 当月上线需求的线上Bug数量 TODO - - - - - //分配总工时 - taskTimeList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); - dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); - - dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); - - //工作饱和度 - dto.setSaturation(dto.getTotalTime().floatValue()==0?BigDecimal.ZERO:dto.getAllocationTime().divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP)); - float saturation = dto.getSaturation().floatValue(); - //完成准时率 TODO 延期 / 总完成 - List delayTaskList =null; - try { - delayTaskList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null - && o.getFinishedDate().getTime() > DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - }catch (Exception e){ - log.error("",e); - } - - dto.setFinishTask(BigDecimal.valueOf(taskTimeList.stream().filter(o->o.getFinishedDate()!=null).map(o->o.getEstimate()).collect(Collectors.toList()).size())); - dto.setDelayTask(BigDecimal.valueOf(delayTaskList.size())); - //准时完成率 - dto.setFinishPunctuality(taskTimeList.size()==0?BigDecimal.valueOf(0): - CollectionUtils.isEmpty(delayTaskList)?BigDecimal.valueOf(1): - BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(delayTaskList.size()) - .divide(dto.getFinishTask(),2,BigDecimal.ROUND_HALF_UP))); - //工作饱和度 -// if(saturation<0.7){ -// // = 0 -// dto.setSaturationScore(BigDecimal.ZERO); -// }else{ -// if(saturation<0.9){ -// dto.setSaturationScore(BigDecimal.valueOf(40 - ( 0.9 - saturation ) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); -// }else{ -// dto.setSaturationScore(BigDecimal.valueOf(40)); -// } -// } -// BigDecimal finishPunctuality = dto.getFinishPunctuality(); -// // 准时率得分 ( `完成准时率` < 1 , 25 - (1 - `完成准时率`) * 100 * 1, 25 )) `准时率得分`, -// if(finishPunctuality.floatValue()<1){ -// //TODO 完成准时率 0.8 -// if(finishPunctuality.floatValue()<0.8){ -// dto.setPunctualityScore(BigDecimal.ZERO); -// }else{ -// dto.setPunctualityScore(BigDecimal.valueOf(25 - (1 - finishPunctuality.floatValue()) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); -// -// } -// }else{ -// //饱和率得分 -// dto.setPunctualityScore(BigDecimal.valueOf(25)); -// } - List bugList = this.bugService.list(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); return dto; } + //满分30 - private BigDecimal getMeetScore(ZtUser u, Date start, Date end) { + private PerformanceDTO getMeetScore(ZtUser u, Date start, Date end, PerformanceDTO dto) { List pIds = this.projectService.authProductList(); - if(CollectionUtils.isEmpty(pIds)){ - return BigDecimal.ZERO; + if (CollectionUtils.isEmpty(pIds)) { + return dto; } List list = this.meetingService.list(new QueryWrapper().lambda().in(ZtMeeting::getProductId, pIds) + .like(ZtMeeting::getUsers, u.getAccount()) .ge(ZtMeeting::getMeetingDate, start).le(ZtMeeting::getMeetingDate, end)); - if(CollectionUtils.isEmpty(list)){ - return BigDecimal.ZERO; + if (CollectionUtils.isEmpty(list)) { + return dto; } - long weekCount = list.stream().filter(o -> o.getType() == MeetingTypeEnums.week).count(); - int weekMeetScore = (int)(weekCount==0?0:(weekCount>=4)?4*6:(24-(4-weekCount)*6)); + long weekCount = 1; + list.stream().filter(o -> o.getType() == MeetingTypeEnums.week).count(); + dto.setMeetWeek(BigDecimal.valueOf(weekCount)); + + int weekMeetScore = (int) (weekCount == 0 ? 0 : (weekCount >= 4) ? 4 * 6 : (24 - (4 - weekCount) * 6)); long storyCount = list.stream().filter(o -> o.getType() == MeetingTypeEnums.story).count(); - int storyScore= storyCount>0?6:0; - return BigDecimal.valueOf(storyScore+weekMeetScore); + dto.setMeetStory(BigDecimal.valueOf(storyCount)); + int storyScore = storyCount > 0 ? 6 : 0; + dto.setMeetScore(BigDecimal.valueOf(storyScore + weekMeetScore)); + return dto; } //默认20分 - private BigDecimal getReleaseScore(ZtUser u, Date firstDayOfMonth) { + private PerformanceDTO getReleaseScore(ZtUser u, Date firstDayOfMonth, PerformanceDTO dto) { //发布 List authList = this.projectService.projectAuthList(); - if(CollectionUtils.isEmpty(authList)){ - return BigDecimal.valueOf(20); + if (CollectionUtils.isEmpty(authList)) { + return dto; + } + + List storyList = monthReleaseBeforeAfterFifteen(firstDayOfMonth, authList); + dto.setReleaseCount(BigDecimal.valueOf(storyList.size())); + if (!CollectionUtils.isEmpty(storyList)) { + int i = 0; + int onTimeYsCount = 0; + for (ZtStory st : storyList) { + Date releaseddate = st.getReleaseddate(); + Date ysDate = st.getYsDate(); + int days = DateUtils.daysBetween(releaseddate, ysDate == null ? new Date() : ysDate); + //超过14天扣钱 发布后超过14天未验收 + if (days > 13) { + i += 1; + } + if (ysDate != null) { + + if (DateUtils.daysBetween(releaseddate, ysDate) <= 13) { + onTimeYsCount += 1; + } + } + + } + dto.setReleaseOnTimeCount(BigDecimal.valueOf(onTimeYsCount)); + dto.setReleaseOnTimeRate(BigDecimalUtils.isZero(dto.getReleaseCount()) ? BigDecimal.ZERO : + dto.getReleaseOnTimeCount().divide(dto.getReleaseCount(), 2, BigDecimal.ROUND_HALF_UP)); + dto.setReleaseScore(BigDecimal.valueOf((20 - i * 5) < 0 ? 0 : (20 - i * 5))); + } else { + dto.setReleaseScore(BigDecimal.valueOf(20)); + } + + return dto; + } + + List monthReleaseBeforeAfterFifteen(Date date, List projectListIds) { + if (CollectionUtils.isEmpty(projectListIds)) { + return new ArrayList<>(); } Calendar dateInstance = Calendar.getInstance(); - dateInstance.setTime(firstDayOfMonth); + dateInstance.setTime(date); // Clead Calendar start = Calendar.getInstance(); int year = dateInstance.get(Calendar.YEAR); int month = dateInstance.get(Calendar.MONTH); // 1代表一月份 - start.set(year, month -1, 15); // 设置年份和月份 + start.set(year, month - 1, 16); // 设置年份和月份 Calendar end = Calendar.getInstance(); - end.set(year, month , 15); // 设置年份和月份 - List releasesList = this.releaseService.list(new QueryWrapper().lambda().in(ZtRelease::getProject, authList) - .ge(ZtRelease::getReleaseDate, start.getTime()).le(ZtRelease::getReleaseDate, end.getTime())); - if(!CollectionUtils.isEmpty(releasesList)){ - List details = this.releaseDetailsService.list(new QueryWrapper().lambda().in(ZtReleaseDetails::getReleaseId, releasesList.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if(!CollectionUtils.isEmpty(details)){ - List storyIds = details.stream().filter(o -> o.getObjectType().equals("story")).map(o->o.getObjectId()).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(storyIds)){ - List storyList = this.storyService.listByIds(storyIds); - int i =0; - for (ZtStory st:storyList) { - Date releaseddate = st.getReleaseddate(); - Date ysDate = st.getYsDate(); - int days = DateUtils.daysBetween(releaseddate, ysDate==null?new Date():ysDate); - //超过14天扣钱 发布后超过14天未验收 - if(days>13){ - i+=1; - } - } - return BigDecimal.valueOf((20-i*5)<0?0:(20-i*5)) ; + end.set(year, month, 15); // 设置年份和月份 + List releasesList = this.releaseService.list(new QueryWrapper().lambda().in(ZtRelease::getProject, projectListIds) + .eq(ZtRelease::getStatus, "released") + .ge(ZtRelease::getReleaseDate, DateUtils.getDayStartDate(start.getTime())).le(ZtRelease::getReleaseDate, DateUtils.getDayLast(end.getTime()))); + List result = new ArrayList<>(); + if (!CollectionUtils.isEmpty(releasesList)) { + List details = this.releaseDetailsService.list(new QueryWrapper().lambda().ne(ZtReleaseDetails::getStatus,"closed").in(ZtReleaseDetails::getReleaseId, releasesList.stream().map(o -> o.getId()).collect(Collectors.toList()))); + if (!CollectionUtils.isEmpty(details)) { + List storyIds = details.stream().filter(o -> o.getObjectType().equals("story")).map(o -> o.getObjectId()).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(storyIds)) { + result = this.storyService.listByIds(storyIds); } } } - return BigDecimal.valueOf(20); + return result; } //老的 - PerformanceDTO buildCsScore(ZtUser u ,List approvalList,Date firstDayOfMonth,Date lastDayOfMonth,List taskList,Date d ){ + PerformanceDTO buildCsScore(ZtUser u, List approvalList, Date firstDayOfMonth, Date lastDayOfMonth, List taskList, Date d) { - PerformanceDTO dto=new PerformanceDTO(); + PerformanceDTO dto = new PerformanceDTO(); dto.setUserName(u.getNickname()); dto.setAccount(u.getAccount()); //本月天数 int workDaysInCurrentMonth = DateUtils.getWorkDaysInCurrentMonth(d); //获取本月请假 - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=getApprovalTime(approvalList,firstDayOfMonth);; + BigDecimal applyTime = BigDecimal.ZERO; + if (!CollectionUtils.isEmpty(approvalList)) { + applyTime = getApprovalTime(approvalList, firstDayOfMonth); + ; } //本月天数 dto.setDays(BigDecimal.valueOf(workDaysInCurrentMonth)); //本月天数 请假天数 - dto.setApprovalDays(applyTime<1?BigDecimal.ZERO:BigDecimal.valueOf(applyTime).divide(BigDecimal.valueOf(60),2,BigDecimal.ROUND_HALF_UP)); + dto.setApprovalDays(applyTime); //可用工时 6小时算 dto.setTotalTime( - dto.getApprovalDays().intValue()==0?dto.getDays().multiply(BigDecimal.valueOf(8)).setScale(2,BigDecimal.ROUND_HALF_UP) - :dto.getDays().multiply(BigDecimal.valueOf(8)).subtract(dto.getApprovalDays()).setScale(2,BigDecimal.ROUND_HALF_UP)); + dto.getApprovalDays().intValue() == 0 ? dto.getDays().multiply(BigDecimal.valueOf(8)).setScale(2, BigDecimal.ROUND_HALF_UP) + : dto.getDays().multiply(BigDecimal.valueOf(8)).subtract(dto.getApprovalDays()).setScale(2, BigDecimal.ROUND_HALF_UP)); //达标工时 dto.setExamineTime(dto.getTotalTime().multiply(BigDecimal.valueOf(0.75))); //产出工时 算task List taskTimeList = taskList.stream() - .filter(o->o.getFinishedDate()!=null&& - o.getFinishedDate().getTime()<=lastDayOfMonth.getTime() &&firstDayOfMonth.getTime()<=o.getFinishedDate().getTime() + .filter(o -> o.getFinishedDate() != null && + o.getFinishedDate().getTime() <= lastDayOfMonth.getTime() && firstDayOfMonth.getTime() <= o.getFinishedDate().getTime() ).collect(Collectors.toList()); //分配总工时 - taskTimeList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); - dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); + taskTimeList = taskList.stream().filter(o -> u.getAccount().equals(o.getAssignedTo())).collect(Collectors.toList()); + dto.setAllocationTime(floatBatchAdd(taskTimeList.stream().map(o -> o.getEstimate()).collect(Collectors.toList()))); - dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); + dto.setWorkTime(floatBatchAdd(taskList.stream().filter(o -> u.getAccount().equals(o.getAssignedTo())).map(o -> o.getConsumed()).collect(Collectors.toList()))); //工作饱和度 - dto.setSaturation(dto.getTotalTime().floatValue()==0?BigDecimal.ZERO:dto.getAllocationTime().divide(dto.getExamineTime(),2,BigDecimal.ROUND_HALF_UP)); + dto.setSaturation(dto.getTotalTime().floatValue() == 0 ? BigDecimal.ZERO : dto.getAllocationTime().divide(dto.getExamineTime(), 2, BigDecimal.ROUND_HALF_UP)); float saturation = dto.getSaturation().floatValue(); //完成准时率 TODO 延期 / 总完成 - List delayTaskList =null; + List delayTaskList = null; try { - delayTaskList = taskList.stream().filter(o->u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null + delayTaskList = taskList.stream().filter(o -> u.getAccount().equals(o.getAssignedTo())).filter(o -> o.getFinishedDate() != null && o.getFinishedDate().getTime() > DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); - }catch (Exception e){ - log.error("",e); + } catch (Exception e) { + log.error("", e); } - dto.setFinishTask(BigDecimal.valueOf(taskTimeList.stream().filter(o->o.getFinishedDate()!=null).map(o->o.getEstimate()).collect(Collectors.toList()).size())); + dto.setFinishTask(BigDecimal.valueOf(taskTimeList.stream().filter(o -> o.getFinishedDate() != null).map(o -> o.getEstimate()).collect(Collectors.toList()).size())); dto.setDelayTask(BigDecimal.valueOf(delayTaskList.size())); //准时完成率 - dto.setFinishPunctuality(taskTimeList.size()==0?BigDecimal.valueOf(0): - CollectionUtils.isEmpty(delayTaskList)?BigDecimal.valueOf(1): + dto.setFinishPunctuality(taskTimeList.size() == 0 ? BigDecimal.valueOf(0) : + CollectionUtils.isEmpty(delayTaskList) ? BigDecimal.valueOf(1) : BigDecimal.valueOf(1).subtract(BigDecimal.valueOf(delayTaskList.size()) - .divide(dto.getFinishTask(),2,BigDecimal.ROUND_HALF_UP))); + .divide(dto.getFinishTask(), 2, BigDecimal.ROUND_HALF_UP))); //工作饱和度 - if(saturation<0.7){ + if (saturation < 0.7) { // = 0 dto.setSaturationScore(BigDecimal.ZERO); - }else{ - if(saturation<0.9){ - dto.setSaturationScore(BigDecimal.valueOf(40 - ( 0.9 - saturation ) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); - }else{ + } else { + if (saturation < 0.9) { + dto.setSaturationScore(BigDecimal.valueOf(40 - (0.9 - saturation) * 100 * 1).setScale(2, BigDecimal.ROUND_HALF_UP)); + } else { dto.setSaturationScore(BigDecimal.valueOf(40)); } } BigDecimal finishPunctuality = dto.getFinishPunctuality(); // 准时率得分 ( `完成准时率` < 1 , 25 - (1 - `完成准时率`) * 100 * 1, 25 )) `准时率得分`, - if(finishPunctuality.floatValue()<1){ + if (finishPunctuality.floatValue() < 1) { //TODO 完成准时率 0.8 - if(finishPunctuality.floatValue()<0.8){ + if (finishPunctuality.floatValue() < 0.8) { dto.setPunctualityScore(BigDecimal.ZERO); - }else{ - dto.setPunctualityScore(BigDecimal.valueOf(25 - (1 - finishPunctuality.floatValue()) * 100 * 1).setScale(2,BigDecimal.ROUND_HALF_UP)); + } else { + dto.setPunctualityScore(BigDecimal.valueOf(25 - (1 - finishPunctuality.floatValue()) * 100 * 1).setScale(2, BigDecimal.ROUND_HALF_UP)); } - }else{ + } else { //饱和率得分 dto.setPunctualityScore(BigDecimal.valueOf(25)); } @@ -1466,16 +1317,16 @@ public class IZtCountService { // .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); // } List bugList = this.bugService.list(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); + .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby, u.getAccount())); // if(!CollectionUtils.isEmpty(fTask)){ // count = bugService.count(new QueryWrapper().lambda().in(ZtBug::getTotask, fTask.stream().map(o -> o.getId()).collect(Collectors.toList()))); // } - if(CollectionUtils.isEmpty(bugList)){ + if (CollectionUtils.isEmpty(bugList)) { dto.setSeriousBug(BigDecimal.ZERO); dto.setSlightBug(BigDecimal.ZERO); dto.setBugScore(BigDecimal.valueOf(10)); - }else{ + } else { Long seriousBug = bugList.stream().filter(o -> o.getSeverity() == 1).count(); dto.setSeriousBug(BigDecimal.valueOf(seriousBug)); Long slightBug = bugList.stream().filter(o -> o.getSeverity() == 1).count(); @@ -1483,30 +1334,30 @@ public class IZtCountService { //测试 if(`线上严重bug` = 0 AND `线上普通bug` = 0, 20, 20 - `线上严重bug` * 20 - `线上普通bug` * 5 ) - if(u.getUserType()==UserType.CS){ + if (u.getUserType() == UserType.CS) { dto.setBugScore( - (seriousBug==0l&&slightBug==0l)?BigDecimal.valueOf(20):BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(5))))) + (seriousBug == 0l && slightBug == 0l) ? BigDecimal.valueOf(20) : BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(20).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(5))))) ); - }else{ - dto.setBugScore((seriousBug==0l&&slightBug==0l)?BigDecimal.valueOf(10):BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(3)))))); + } else { + dto.setBugScore((seriousBug == 0l && slightBug == 0l) ? BigDecimal.valueOf(10) : BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(seriousBug).multiply(BigDecimal.valueOf(10).subtract(BigDecimal.valueOf(slightBug).multiply(BigDecimal.valueOf(3)))))); } //其余 if(`线上严重bug` = 0 AND `线上普通bug` = 0, 10, 10 - `线上严重bug` * 10 - `线上普通bug` * 3 ) } - if(u.getUserType()==UserType.CS){ + if (u.getUserType() == UserType.CS) { //算绩效 `线上bug得分` + `准时率得分` + 50, - dto.setScore(dto.getBugScore() .add(dto.getPunctualityScore()).add(BigDecimal.valueOf(50)) ); - }else{ + dto.setScore(dto.getBugScore().add(dto.getPunctualityScore()).add(BigDecimal.valueOf(50))); + } else { //`饱和率得分`+ `线上bug得分` + `准时率得分` + 25 - dto.setScore(dto.getSaturationScore() .add(dto.getBugScore()).add(dto.getPunctualityScore()).add(BigDecimal.valueOf(25))); + dto.setScore(dto.getSaturationScore().add(dto.getBugScore()).add(dto.getPunctualityScore()).add(BigDecimal.valueOf(25))); } return dto; } - //分钟 请假 d 月份 - public Integer getApprovalTime(List approvalList,Date d) { + //小时 请假 d 月份 + public BigDecimal getApprovalTime(List approvalList, Date d) { String dFormat = DateUtils.formatDate(d, "yyyyMM"); - Integer value=0; - for (ItApproval approval:approvalList) { + Integer value = 0; + for (ItApproval approval : approvalList) { Date applyTimeEnd = approval.getApplyTimeEnd(); Date applyTimeStart = approval.getApplyTimeStart(); @@ -1515,27 +1366,27 @@ public class IZtCountService { int intStart = Integer.valueOf(DateUtils.formatDate(applyTimeEnd, "yyyyMMdd")); int intEnd = Integer.valueOf(DateUtils.formatDate(applyTimeStart, "yyyyMMdd")); - if((intEnd-intStart)==0){ - value+=approval.getApplyDays(); - }else{ + if ((intEnd - intStart) == 0) { + value += approval.getApplyDays(); + } else { // 情况 1 1月27 -2 2 //情况2 2.月28 -3.1 - int days = DateUtils.daysBetween(applyTimeStart, applyTimeEnd)+1; - for (int i =0;i workTaskCounts(ZtCountQo qo) { Date d = qo.getDate(); - int time = DateUtils.getWorkDaysInCurrentMonth(d) * 6; - if(d==null){ - d=new Date(); + if (d == null) { + d = new Date(); } Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); @@ -1589,6 +1438,7 @@ public class IZtCountService { if (CollectionUtils.isEmpty(productList)) { return new ArrayList<>(); } + List pids = productList.stream().map(o -> o.getId()).collect(Collectors.toList()); List projectproducts = this.projectproductService.list(new QueryWrapper().lambda() .in(ZtProjectproduct::getProduct, productList.stream().map(o -> o.getId()).collect(Collectors.toList()))); if (CollectionUtils.isEmpty(projectproducts)) { @@ -1597,78 +1447,66 @@ public class IZtCountService { List list = executionprojectService.list(new QueryWrapper().lambda() - .in(ZtExecutionproject::getProject, projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList()))); + .in(ZtExecutionproject::getProject, projectproducts.stream().map(o -> o.getProject()).collect(Collectors.toList()))); if (CollectionUtils.isEmpty(list)) { return new ArrayList<>(); } List ztProjects = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + ztProjects = ztProjects.stream().filter(o -> (o.getBegin().getTime() >= firstDayOfMonth.getTime() + && o.getBegin().getTime() <= lastDayOfMonth.getTime()) || ( + o.getEnd().getTime() >= firstDayOfMonth.getTime() + && o.getEnd().getTime() <= lastDayOfMonth.getTime())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(ztProjects)) { return new ArrayList<>(); } List executionIds = ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()); //所有任务 - List taskList = this.taskService.list(new QueryWrapper().lambda().in(ZtTask::getExecution, executionIds)); -// taskList=new ArrayList<>(); -// taskList.add(this.taskService.getById(1178)); + List taskList = this.taskService.taskListByEIdsAndDate(firstDayOfMonth, lastDayOfMonth, pids); if (CollectionUtils.isEmpty(taskList)) { return new ArrayList<>(); } - taskList = taskList.stream() - .filter(o -> - ( o.getFinishedDate()!=null&& (o.getFinishedDate().getTime() >= firstDayOfMonth.getTime() - && o.getFinishedDate().getTime() <= lastDayOfMonth.getTime())) - || - (o.getEstStarted()!=null&&o.getDeadline()!=null)&& - (( o.getDeadline().getTime()<=lastDayOfMonth.getTime()&& o.getDeadline().getTime()>=firstDayOfMonth.getTime()) - || - ( o.getEstStarted().getTime()<=lastDayOfMonth.getTime()&& o.getEstStarted().getTime()>=firstDayOfMonth.getTime())) + List result = new ArrayList(); -// || (o.getDeadline().getTime() >=firstDayOfMonth.getTime() && o.getDeadline().getTime() <= lastDayOfMonth.getTime()) -// || (o.getEstStarted().getTime()<=firstDayOfMonth.getTime() && o.getDeadline().getTime() > firstDayOfMonth.getTime()) - ).collect(Collectors.toList()); - - if(CollectionUtils.isEmpty(taskList)){ - return new ArrayList<>(); - } - List result=new ArrayList(); - - Map storyMap=storyMap(taskList); + Map storyMap = storyMap(taskList); Map userMap = this.userService.userMapByIds(null); + for (ZtTask t : taskList) { + ZtUser u = userMap.get(t.getAssignedTo()); + if(u!=null&&u.getUserType()==UserType.KFZ&&!t.getStatus().equals("cancel")){ + ProjectWorkTaskDTO dto = new ProjectWorkTaskDTO(); + + dto.setTaskId(t.getId()); + dto.setStoryId(t.getStory()); + dto.setTaskName(t.getName()); + List execList = ztProjects.stream().filter(o -> o.getId().intValue() == t.getExecution().intValue()).collect(Collectors.toList()); + dto.setExecName(CollectionUtils.isEmpty(execList) ?null:execList.get(0).getName()); + dto.setExecStartDate(DateUtils.formatDate(t.getEstStarted())); + dto.setExecEndDate(DateUtils.formatDate(t.getDeadline())); + + dto.setStoryName(t.getStory() == 0 ? null : storyMap.get(t.getStory()).getTitle()); + + dto.setTypeName(TaskType.transferType(t.getType()) == null ? "" : TaskType.transferType(t.getType()).getValue()); + ZtUser ztUser = userMap.get(t.getAssignedTo()); - for (ZtTask t:taskList) { - ProjectWorkTaskDTO dto=new ProjectWorkTaskDTO(); + dto.setAssignedTo(ztUser == null ? null : ztUser.getNickname()); - dto.setTaskId(t.getId()); - dto.setStoryId(t.getStory()); - dto.setTaskName(t.getName()); - List execList = ztProjects.stream().filter(o -> o.getId().intValue() == t.getExecution().intValue()).collect(Collectors.toList()); - dto.setExecName(execList.get(0).getName()); - dto.setExecStartDate(DateUtils.formatDate(t.getEstStarted())); - dto.setExecEndDate(DateUtils.formatDate(t.getDeadline())); - - dto.setStoryName(t.getStory()==0?"0":storyMap.get(t.getStory()).getTitle()); - - dto.setTypeName(TaskType.transferType(t.getType())==null?"":TaskType.transferType(t.getType()).getValue()); - ZtUser ztUser = userMap.get(t.getAssignedTo()); + dto.setWorkTime(t.getConsumed()); + dto.setPlanTime(t.getEstimate()); + dto.setBalanceTime(BigDecimal.valueOf(t.getEstimate()).subtract(BigDecimal.valueOf(t.getConsumed())).setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()); + dto.setStatus(TaskStatus.transferType(t.getStatus()) == null ? "" : TaskStatus.transferType(t.getStatus()).getValue()); - dto.setAssignedTo(ztUser==null?null:ztUser.getNickname()); - - dto.setWorkTime(t.getConsumed()); - dto.setPlanTime(t.getEstimate()); - dto.setBalanceTime(BigDecimal.valueOf(t.getEstimate()).subtract(BigDecimal.valueOf(t.getConsumed())).setScale(2,BigDecimal.ROUND_HALF_UP).floatValue()); - dto.setStatus(TaskStatus.transferType(t.getStatus())==null?"":TaskStatus.transferType(t.getStatus()).getValue()); + dto.setStartDate(DateUtils.formatDate(t.getRealstarted())); + dto.setEndDate(DateUtils.formatDate(t.getFinishedDate())); + dto.setPlanEndDate(DateUtils.formatDate(t.getDeadline())); + dto.setKeepTime(t.getFinishedDate() != null ? (DateUtils.daysBetween(t.getRealstarted(), t.getFinishedDate())) : (DateUtils.daysBetween(t.getEstStarted(), t.getDeadline()))); + dto.setDelayRemark(((t.getFinishedDate() == null ? new Date() : t.getFinishedDate()).getTime() > DateUtils.getDayLast(t.getDeadline()).getTime()) ? "是" : "否"); + result.add(dto); + } - dto.setStartDate(DateUtils.formatDate(t.getRealstarted())); - dto.setEndDate(DateUtils.formatDate(t.getFinishedDate())); - dto.setPlanEndDate(DateUtils.formatDate(t.getDeadline())); - dto.setKeepTime(t.getFinishedDate()!=null?(DateUtils.daysBetween(t.getRealstarted(),t.getFinishedDate())):(DateUtils.daysBetween(t.getEstStarted(),t.getDeadline()))); - dto.setDelayRemark(((t.getFinishedDate()==null?new Date():t.getFinishedDate()).getTime()>DateUtils.getDayLast(t.getDeadline()).getTime())?"是":"否"); - result.add(dto); } return result; } @@ -1676,21 +1514,21 @@ public class IZtCountService { private Map storyMap(List taskList) { List fTaskList = taskList.stream().filter(o -> o.getStory() != null && o.getStory() != 0).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(fTaskList)){ + if (CollectionUtils.isEmpty(fTaskList)) { return new HashMap<>(); } - List ztStories = this.storyService.listByIds(fTaskList.stream().map(o->o.getStory()).collect(Collectors.toList())); - return ztStories.stream().collect(Collectors.toMap(ZtStory::getId,o->o)); + List ztStories = this.storyService.listByIds(fTaskList.stream().map(o -> o.getStory()).distinct().collect(Collectors.toList())); + return ztStories.stream().collect(Collectors.toMap(ZtStory::getId, o -> o)); } private List> head() { List> list = new ArrayList<>(); List head0 = new ArrayList<>(); - head0.add("字符串" ); + head0.add("字符串"); List head1 = new ArrayList<>(); - head1.add("数字" ); + head1.add("数字"); List head2 = new ArrayList<>(); - head2.add("日期" ); + head2.add("日期"); list.add(head0); list.add(head1); list.add(head2); @@ -1700,90 +1538,80 @@ public class IZtCountService { private List getStoryIds(Integer project) { List list1 = this.projectstoryService.list(new QueryWrapper().lambda() - .eq(ZtProjectstory::getProject, project) - ); - return list1.stream().map(o->o.getStory()).collect(Collectors.toList()); + .eq(ZtProjectstory::getProject, project)); + return list1.stream().map(o -> o.getStory()).collect(Collectors.toList()); } - public List projectWorkCount(ZtCountQo qo,jakarta.servlet.ServletRequest request){ + public List projectWorkCount(ZtCountQo qo, jakarta.servlet.ServletRequest request) { Date d = qo.getDate(); Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); - List result=new ArrayList<>(); + List result = new ArrayList<>(); //产品集id Integer pId = qo.getProject(); List productList = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, pId)); - if(CollectionUtils.isEmpty(productList)){ + if (CollectionUtils.isEmpty(productList)) { return result; } - List projectproducts = this.projectproductService.list(new QueryWrapper().lambda().in(ZtProjectproduct::getProduct, productList.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if(CollectionUtils.isEmpty(projectproducts)){ + List pids = productList.stream().map(o -> o.getId()).collect(Collectors.toList()); + List projectproducts = this.projectproductService.list(new QueryWrapper().lambda().in(ZtProjectproduct::getProduct,pids)); + if (CollectionUtils.isEmpty(projectproducts)) { return result; } - List pList = this.projectService.listByIds(projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList())); + List pList = this.projectService.listByIds(projectproducts.stream().map(o -> o.getProject()).collect(Collectors.toList())); + //完成任务总量 开发 + List taskList =this.taskService.taskListByEIdsAndDate(firstDayOfMonth,lastDayOfMonth,pids); + Map userMap = userService.userMapByIds(null); + for (ZtProject p : pList) { - for (ZtProject p:pList) { - - ProjectWorkDetailsDTO dto=new ProjectWorkDetailsDTO(); + ProjectWorkDetailsDTO dto = new ProjectWorkDetailsDTO(); result.add(dto); dto.setProjectName(p.getName()); //项目id Integer project = p.getId(); - List list = executionprojectService.list(new QueryWrapper().lambda() - .eq(ZtExecutionproject::getProject, project)); - if (CollectionUtils.isEmpty(list)) { - continue; -// return new ArrayList<>(); - } - List ztProjects = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); -// ztProjects = ztProjects.stream() -// .filter(o -> -// (o.getBegin().getTime() > firstDayOfMonth.getTime() && o.getBegin().getTime() < lastDayOfMonth.getTime()) -// || (o.getEnd().getTime() > firstDayOfMonth.getTime() && o.getEnd().getTime() < lastDayOfMonth.getTime()) -// || (o.getBegin().getTime() < firstDayOfMonth.getTime() && o.getEnd().getTime() > lastDayOfMonth.getTime()) -// ).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(ztProjects)) { + + List execList = this.projectService.getExecutionsListByProjectAndDate(Arrays.asList(project),firstDayOfMonth,lastDayOfMonth); + if (CollectionUtils.isEmpty(execList)) { continue; } //项目的需求 - List storyIds=getStoryIds(project); + List storyIds = getStoryIds(project); - List storyList = this.projectstoryService.list(new QueryWrapper().lambda() - .in(ZtProjectstory::getProject, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList())) - .in(ZtProjectstory::getStory,storyIds).eq(ZtProjectstory::getType, ProjectTypeEnums.execution.getValue()) - ); + // //完成需求总量 + List storyList = this.storyService.list(new QueryWrapper().lambda().in(ZtStory::getProduct, pids) + .ge(ZtStory::getEndDate, firstDayOfMonth).le(ZtStory::getEndDate, lastDayOfMonth)); + dto.setFinishCount(storyList.size()); + +// //上线的需求数量 + List releaseStoryList = monthReleaseBeforeAfterFifteen(firstDayOfMonth,Arrays.asList(p.getId())); + +// 完成验收数量 + dto.setYsStoryCount(BigDecimal.valueOf(releaseStoryList.stream().filter(o->Arrays.asList(1,2).contains(o.getYsFlag())).count())); +// //需求完成验收率 + - List ztStories = CollectionUtils.isEmpty(storyList)?new ArrayList<>():this.storyService.listByIds(storyList.stream().map(o -> o.getStory()).collect(Collectors.toList())); - //完成需求总量 released已发布 verified已验收 closed - List finishStoryList = ztStories.stream().filter(o -> Arrays.asList("released","verified","closed"). - contains(o.getStage())).filter(o->o.getEndDate()!=null&&(firstDayOfMonth.getTime()=o.getEndDate().getTime()) - ).collect(Collectors.toList()); - dto.setFinishCount(finishStoryList.size()); - //完成任务总量 - List taskList = CollectionUtils.isEmpty(storyList)?new ArrayList<>():this.taskService.list(new QueryWrapper().lambda() - .in(ZtTask::getExecution, list.stream().map(o -> o.getExecution()).collect(Collectors.toList()))); // 完成后可能会被关闭 - List done = taskList.stream().filter(o -> o.getStatus().equals("done")||o.getStatus().equals("closed")) - .filter(o->o.getFinishedDate()!=null&&(firstDayOfMonth.getTime()<=o.getFinishedDate().getTime()&& - lastDayOfMonth.getTime()>=o.getFinishedDate().getTime())).collect(Collectors.toList()); + List done = taskList.stream() + .filter(o->userMap.get(o.getAssignedTo())!=null&&userMap.get(o.getAssignedTo()).getUserType()==UserType.KFZ) + .filter(o->o.getStatus().equals("done")).collect(Collectors.toList()); + + +// this.taskService.get dto.setFinishTaskCount(done.size()); //完成需求总工时 -// double sum = taskList.stream().map(o -> o.getEstimate()).mapToDouble(e -> Double.valueOf(e)).sum(); List fList = done.stream().map(o -> o.getEstimate()).collect(Collectors.toList()); - dto.setStoryTotalTime(floatBatchAdd(fList)); //实际产出工时 fList = done.stream().map(o -> o.getConsumed()).collect(Collectors.toList()); @@ -1793,33 +1621,29 @@ public class IZtCountService { // 上月未完成需求量预计工时 //已验收需求总量 - List ysVerified = ztStories.stream().filter(o -> o.getStage().equals("verified")||o.getStage().equals("closed")) - .filter(o->o.getEndDate()!=null&&(firstDayOfMonth.getTime()<=o.getEndDate().getTime()&& - lastDayOfMonth.getTime()>=o.getEndDate().getTime())).collect(Collectors.toList()); - dto.setYsTaskCount(ysVerified.size()); +// List ysVerified = ztStories.stream().filter(o -> o.getStage().equals("verified") || o.getStage().equals("closed")) +// .filter(o -> o.getEndDate() != null && (firstDayOfMonth.getTime() <= o.getEndDate().getTime() && +// lastDayOfMonth.getTime() >= o.getEndDate().getTime())).collect(Collectors.toList()); //验收通过率 - List tg = ysVerified.stream().filter(o -> o.getStage().equals("verified")&&o.getYsFlag()==1).collect(Collectors.toList()); + List tg = releaseStoryList.stream().filter(o -> o.getYsFlag().intValue() == 1).collect(Collectors.toList()); int size = tg.size(); - if(size==0){ + if (size == 0) { dto.setYsYesRate(BigDecimal.ZERO); - }else{ - dto.setYsYesRate(BigDecimal.valueOf(size).divide(BigDecimal.valueOf(ysVerified.size()),2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100))); - } - if(CollectionUtils.isEmpty(ysVerified)){ - dto.setYsNoRate(BigDecimal.ZERO); - }else{ - dto.setYsNoRate(BigDecimal.valueOf(ysVerified.stream().filter(o -> o.getStage().equals("verified")&&o.getYsFlag()==2).collect(Collectors.toList()).size())); + } else { + dto.setYsYesRate(BigDecimal.valueOf(size).divide(BigDecimal.valueOf(releaseStoryList.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100))); } + List noTg = releaseStoryList.stream().filter(o -> o.getStage().equals("verified") && o.getYsFlag().intValue() == 2).collect(Collectors.toList()); + dto.setYsNoCount(BigDecimal.valueOf(noTg.size())); } return result; } - private BigDecimal floatBatchAdd(List list){ - BigDecimal f=BigDecimal.ZERO; - for (Float i:list ) { - f=f.add(BigDecimal.valueOf(i)); + private BigDecimal floatBatchAdd(List list) { + BigDecimal f = BigDecimal.ZERO; + for (Float i : list) { + f = f.add(BigDecimal.valueOf(i)); } BigDecimal decimal = f.setScale(2, BigDecimal.ROUND_HALF_UP); @@ -1833,10 +1657,8 @@ public class IZtCountService { Date d = qo.getDate(); - int time = DateUtils.getWorkDaysInCurrentMonth(d) * 6; - - if(d==null){ - d=new Date(); + if (d == null) { + d = new Date(); } Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); @@ -1847,6 +1669,8 @@ public class IZtCountService { if (CollectionUtils.isEmpty(productList)) { return new ArrayList<>(); } + List pids = productList.stream().map(o -> o.getId()).collect(Collectors.toList()); + List projectproducts = this.projectproductService.list(new QueryWrapper().lambda() .in(ZtProjectproduct::getProduct, productList.stream().map(o -> o.getId()).collect(Collectors.toList()))); if (CollectionUtils.isEmpty(projectproducts)) { @@ -1854,105 +1678,77 @@ public class IZtCountService { } - List list = executionprojectService.list(new QueryWrapper().lambda() - .in(ZtExecutionproject::getProject, projectproducts.stream().map(o->o.getProject()).collect(Collectors.toList()))); - if (CollectionUtils.isEmpty(list)) { - return new ArrayList<>(); - } - List ztProjects = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); -// ztProjects = ztProjects.stream() -// .filter(o -> -// (o.getBegin().getTime() > firstDayOfMonth.getTime() && o.getBegin().getTime() < lastDayOfMonth.getTime()) -// || (o.getEnd().getTime() > firstDayOfMonth.getTime() && o.getEnd().getTime() < lastDayOfMonth.getTime()) -// || (o.getBegin().getTime() < firstDayOfMonth.getTime() && o.getEnd().getTime() > lastDayOfMonth.getTime()) -// ).collect(Collectors.toList()); + List ztProjects = this.projectService.getExecutionsListByProjectAndDate(projectproducts.stream().map(o -> o.getProject()).collect(Collectors.toList()), firstDayOfMonth, lastDayOfMonth); if (CollectionUtils.isEmpty(ztProjects)) { return new ArrayList<>(); } - List executionIds = ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()); //所有任务 - List taskList = this.taskService.list(new QueryWrapper().lambda().in(ZtTask::getExecution, executionIds)); + List taskList = this.taskService.taskListByEIdsAndDate(firstDayOfMonth, lastDayOfMonth, pids); + if (CollectionUtils.isEmpty(taskList)) { return new ArrayList<>(); } -// taskList = taskList.stream() -// .filter(o->o.getFinishedDate()!=null) -// .filter(o -> -// (o.getFinishedDate().getTime() >= firstDayOfMonth.getTime() && o.getFinishedDate().getTime() <= lastDayOfMonth.getTime()) -// || (o.getDeadline().getTime() >=firstDayOfMonth.getTime() && o.getDeadline().getTime() <= lastDayOfMonth.getTime()) -// || (o.getEstStarted().getTime()<=firstDayOfMonth.getTime() && o.getDeadline().getTime() > firstDayOfMonth.getTime()) -// ).collect(Collectors.toList()); - - taskList = taskList.stream() - .filter(o -> - ( o.getFinishedDate()!=null&& (o.getFinishedDate().getTime() >= firstDayOfMonth.getTime() - && o.getFinishedDate().getTime() <= lastDayOfMonth.getTime())) - || - (o.getEstStarted()!=null&&o.getDeadline()!=null)&& - (( o.getDeadline().getTime()<=lastDayOfMonth.getTime()&& o.getDeadline().getTime()>=firstDayOfMonth.getTime()) - || - ( o.getEstStarted().getTime()<=lastDayOfMonth.getTime()&& o.getEstStarted().getTime()>=firstDayOfMonth.getTime())) - -// || (o.getDeadline().getTime() >=firstDayOfMonth.getTime() && o.getDeadline().getTime() <= lastDayOfMonth.getTime()) -// || (o.getEstStarted().getTime()<=firstDayOfMonth.getTime() && o.getDeadline().getTime() > firstDayOfMonth.getTime()) - ).filter(o->o.getStatus().equals("done")) - .collect(Collectors.toList()); List teamList = this.teamService.list(new QueryWrapper().lambda().eq(ZtTeam::getType, "execution") .in(ZtTeam::getRoot, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if(CollectionUtils.isEmpty(teamList)){ + if (CollectionUtils.isEmpty(teamList)) { return new ArrayList<>(); } - List userList = this.userService.list(new QueryWrapper().lambda().in(ZtUser::getAccount,teamList.stream().map(o->o.getAccount()).collect(Collectors.toList()))); + List userList = this.userService.list(new QueryWrapper().lambda().in(ZtUser::getAccount, teamList.stream().map(o -> o.getAccount()).collect(Collectors.toList()))); //根据项目 获取本月迭代 - List result=new ArrayList<>(); + List result = new ArrayList<>(); //项目 //迭代 + int time = DateUtils.getWorkDaysInCurrentMonth(d) * 8; + List prodBugList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, pids) + .eq(ZtBug::getBugType, "prod") + .ge(ZtBug::getOpeneddate, firstDayOfMonth) + .le(ZtBug::getOpeneddate, lastDayOfMonth) + .in(ZtBug::getAssignedTo, userList.stream().map(o -> o.getAccount()).collect(Collectors.toList()))); for (ZtUser u : userList) { - List approvalList = this.taskService.itApprovalByUserName(u.getNickname(),firstDayOfMonth, lastDayOfMonth); - Integer approvalTime =0; - if(!CollectionUtils.isEmpty(approvalList)){ - approvalTime = this.getApprovalTime(approvalList, firstDayOfMonth); - } + if(u.getUserType()==UserType.KFZ){ + List approvalList = this.taskService.itApprovalByUserName(u.getNickname(), firstDayOfMonth, lastDayOfMonth); + + List fTask = this.taskService.getDevelAllocation(taskList.stream().filter(o -> o.getAssignedTo().equals(u.getAccount())).collect(Collectors.toList())); + PerformanceDTO performanceDTO = new PerformanceDTO(); + performanceDTO = setUserWorkTime(performanceDTO, d, approvalList, firstDayOfMonth); - List fTask = taskList.stream().filter(o -> o.getAssignedTo().equals(u.getAccount())).collect(Collectors.toList()); + WorkDetailsDTO dto = new WorkDetailsDTO(); + dto.setUserName(u.getNickname()); + fTask=fTask.stream().filter(o->o.getStatus().equals("done")).collect(Collectors.toList()); + dto.setTaskCount(BigDecimal.valueOf(fTask.size())); - WorkDetailsDTO dto = new WorkDetailsDTO(); - dto.setUserName(u.getNickname()); - dto.setTaskCount(BigDecimal.valueOf(taskList.stream().filter(o -> o.getAssignedTo().equals(u.getAccount())).count())); - //预计工时 - dto.setStoryTotalTime(floatBatchAdd(fTask.stream().map(o -> o.getEstimate()).collect(Collectors.toList()))); + + + //预计工时 + dto.setStoryTotalTime(floatBatchAdd(fTask.stream().map(o -> o.getEstimate()).collect(Collectors.toList()))); // - dto.setWorkTime(floatBatchAdd(fTask.stream().map(o -> o.getConsumed()).collect(Collectors.toList()))); + dto.setWorkTime(floatBatchAdd(fTask.stream().map(o -> o.getConsumed()).collect(Collectors.toList()))); // 6*实际工作天数 - dto.setHaveTime(BigDecimal.valueOf(time-approvalTime)); - dto.setSaturation(dto.getWorkTime().compareTo(BigDecimal.ZERO)==0?BigDecimal.ZERO:dto.getWorkTime().divide(dto.getHaveTime(),2,BigDecimal.ROUND_HALF_UP)); - long count =0; - if(!CollectionUtils.isEmpty(fTask)){ - count = this.bugService.count(new QueryWrapper().lambda().between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth) - .in(ZtBug::getSeverity, 1, 2).eq(ZtBug::getResolvedby,u.getAccount())); -// count = bugService.count(new QueryWrapper().lambda().in(ZtBug::getTotask, fTask.stream().map(o -> o.getId()).collect(Collectors.toList()))); + dto.setHaveTime(performanceDTO.getExamineTime()); + dto.setSaturation(dto.getWorkTime().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO : dto.getStoryTotalTime().divide(dto.getHaveTime(), 2, BigDecimal.ROUND_HALF_UP)); + + dto.setBugCount(BigDecimal.valueOf(prodBugList.stream().filter(o -> u.getAccount().equals(o.getAssignedTo())).count())); + result.add(dto); } - dto.setBugCount(BigDecimal.valueOf(count)); - result.add(dto); } return result; } public Object projectInfoById(Integer id) { - Map map=new HashMap<>(); - Map objMap=new HashMap<>(); + Map map = new HashMap<>(); + Map objMap = new HashMap<>(); //产品集 ZtProject project = this.projectService.getById(id); //产品集下所有产品 List products = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, project.getId())); - if(CollectionUtils.isEmpty(products)){ - return zeroMap(map,objMap); + if (CollectionUtils.isEmpty(products)) { + return zeroMap(map, objMap); } //项目列表 List projectList = this.projectproductService.list(new QueryWrapper().lambda() @@ -1961,156 +1757,155 @@ public class IZtCountService { // return zeroMap(map,objMap); // } - List releases =null; - if(CollectionUtils.isEmpty(projectList)){ - releases=new ArrayList<>(); - }else{ - releases=this.releaseService.list(new QueryWrapper().lambda() - .eq(ZtRelease::getStatus,"released") + List releases = null; + if (CollectionUtils.isEmpty(projectList)) { + releases = new ArrayList<>(); + } else { + releases = this.releaseService.list(new QueryWrapper().lambda() + .eq(ZtRelease::getStatus, "released") .in(ZtRelease::getProject, projectList.stream().map(o -> o.getProject()).collect(Collectors.toList()))); } - List ztStories = this.storyService.list(new QueryWrapper().lambda().in(ZtStory::getProduct, products.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if(CollectionUtils.isEmpty(ztStories)){ - return zeroMap(map,objMap); + if (CollectionUtils.isEmpty(ztStories)) { + return zeroMap(map, objMap); } long count = ztStories.stream().count(); long finish = ztStories.stream().filter(o -> "verified".equals(o.getStage()) - ||("closed".equals(o.getStage())) + || ("closed".equals(o.getStage())) ).count(); - objMap.put("count",count); - objMap.put("finish",finish); - objMap.put("balance",count-finish); - map.put("story",objMap); + objMap.put("count", count); + objMap.put("finish", finish); + objMap.put("balance", count - finish); + map.put("story", objMap); - if(CollectionUtils.isEmpty(projectList)){ - return zeroTaskMap(map,objMap); + if (CollectionUtils.isEmpty(projectList)) { + return zeroTaskMap(map, objMap); } //项目成员 项目迭代下所有人员 projectList 项目列表 List exexList = this.executionprojectService.list(new QueryWrapper().lambda() .in(ZtExecutionproject::getProject, projectList.stream().map(o -> o.getProject()).collect(Collectors.toList()))); - if(CollectionUtils.isEmpty(exexList)){ - return zeroTaskMap(map,objMap); + if (CollectionUtils.isEmpty(exexList)) { + return zeroTaskMap(map, objMap); } List taskList = this.taskService.list(new QueryWrapper().lambda() .in(ZtTask::getExecution, exexList.stream().map(o -> o.getExecution()).collect(Collectors.toList()))); - if(CollectionUtils.isEmpty(taskList)){ - return zeroTaskMap(map,objMap); + if (CollectionUtils.isEmpty(taskList)) { + return zeroTaskMap(map, objMap); } - objMap=new HashMap<>(); - objMap.put("totalUser",taskList.stream().map(o->o.getAssignedTo()).distinct().count()); + objMap = new HashMap<>(); + objMap.put("totalUser", taskList.stream().map(o -> o.getAssignedTo()).distinct().count()); double planTime = taskList.stream().map(o -> o.getEstimate()).mapToDouble(e -> Double.valueOf(e)).sum(); - planTime=planTime>0?new BigDecimal(planTime).setScale(1, RoundingMode.HALF_UP).doubleValue():planTime; - objMap.put("planTime",planTime); - double useTime =taskList.stream().map(o->o.getConsumed()).mapToDouble(e->Double.valueOf(e)).sum(); - useTime=useTime>0?new BigDecimal(useTime).setScale(1, RoundingMode.HALF_UP).doubleValue():useTime; - objMap.put("useTime",useTime); - map.put("zy",objMap); + planTime = planTime > 0 ? new BigDecimal(planTime).setScale(1, RoundingMode.HALF_UP).doubleValue() : planTime; + objMap.put("planTime", planTime); + double useTime = taskList.stream().map(o -> o.getConsumed()).mapToDouble(e -> Double.valueOf(e)).sum(); + useTime = useTime > 0 ? new BigDecimal(useTime).setScale(1, RoundingMode.HALF_UP).doubleValue() : useTime; + objMap.put("useTime", useTime); + map.put("zy", objMap); - objMap=new HashMap<>(); + objMap = new HashMap<>(); - objMap.put("wait",taskList.stream().filter(o->"wait".equals(o.getStatus())).count()); - objMap.put("process",taskList.stream().filter(o->"doing".equals(o.getStatus())).count()); - objMap.put("finish",taskList.stream().filter(o->"done".equals(o.getStatus())||"closed".equals(o.getStatus())).count()); - objMap.put("totalCount",taskList.size()); - map.put("task",objMap); + objMap.put("wait", taskList.stream().filter(o -> "wait".equals(o.getStatus())).count()); + objMap.put("process", taskList.stream().filter(o -> "doing".equals(o.getStatus())).count()); + objMap.put("finish", taskList.stream().filter(o -> "done".equals(o.getStatus()) || "closed".equals(o.getStatus())).count()); + objMap.put("totalCount", taskList.size()); + map.put("task", objMap); - List bugList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, products.stream().map(o->o.getId()).collect(Collectors.toList()))); + List bugList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, products.stream().map(o -> o.getId()).collect(Collectors.toList()))); - objMap=new HashMap<>(); - objMap.put("totalBug",bugList.stream().count()); - objMap.put("solve",bugList.stream().filter(o->o.getStatus().equals("resolved")||o.getStatus().equals("closed")).count()); - objMap.put("noSolve",bugList.stream().filter(o->o.getStatus().equals("active")).count()); - map.put("bug",objMap); + objMap = new HashMap<>(); + objMap.put("totalBug", bugList.stream().count()); + objMap.put("solve", bugList.stream().filter(o -> o.getStatus().equals("resolved") || o.getStatus().equals("closed")).count()); + objMap.put("noSolve", bugList.stream().filter(o -> o.getStatus().equals("active")).count()); + map.put("bug", objMap); - objMap=new HashMap<>(); + objMap = new HashMap<>(); //查发布 - if(!CollectionUtils.isEmpty(releases)){ - long relaese= this.releaseDetailsService.count(new QueryWrapper().lambda() + if (!CollectionUtils.isEmpty(releases)) { + long relaese = this.releaseDetailsService.count(new QueryWrapper().lambda() .in(ZtReleaseDetails::getReleaseId, releases.stream().map(o -> o.getId()).collect(Collectors.toList())) - .ne(ZtReleaseDetails::getStatus,"closed") + .ne(ZtReleaseDetails::getStatus, "closed") .eq(ZtReleaseDetails::getObjectType, "story")); - objMap.put("online",relaese); - }else{ - objMap.put("online",0); + objMap.put("online", relaese); + } else { + objMap.put("online", 0); } - objMap.put("ysAll",ztStories.stream().filter(o->o.getYsFlag()!=null&&o.getYsFlag().intValue()!=0).count()); - objMap.put("ysNo",ztStories.stream().filter(o->o.getYsFlag()!=null&&o.getYsFlag().intValue()==2).count()); - map.put("ys",objMap); + objMap.put("ysAll", ztStories.stream().filter(o -> o.getYsFlag() != null && o.getYsFlag().intValue() != 0).count()); + objMap.put("ysNo", ztStories.stream().filter(o -> o.getYsFlag() != null && o.getYsFlag().intValue() == 2).count()); + map.put("ys", objMap); return map; } private Object zeroTaskMap(Map map, Map objMap) { - objMap=new HashMap<>(); - objMap.put("totalUser",0); - objMap.put("planTime",0); - objMap.put("useTime",0); - map.put("zy",objMap); - objMap=new HashMap<>(); - objMap.put("wait",0); - objMap.put("process",0); - objMap.put("finish",0); - objMap.put("totalCount",0); - map.put("task",objMap); - objMap=new HashMap<>(); - objMap.put("totalBug",0); - objMap.put("solve",0); - objMap.put("noSolve",0); - map.put("bug",objMap); + objMap = new HashMap<>(); + objMap.put("totalUser", 0); + objMap.put("planTime", 0); + objMap.put("useTime", 0); + map.put("zy", objMap); + objMap = new HashMap<>(); + objMap.put("wait", 0); + objMap.put("process", 0); + objMap.put("finish", 0); + objMap.put("totalCount", 0); + map.put("task", objMap); + objMap = new HashMap<>(); + objMap.put("totalBug", 0); + objMap.put("solve", 0); + objMap.put("noSolve", 0); + map.put("bug", objMap); - objMap=new HashMap<>(); - objMap.put("online",0); - objMap.put("ysAll",0); - objMap.put("ysNo",0); - map.put("ys",objMap); + objMap = new HashMap<>(); + objMap.put("online", 0); + objMap.put("ysAll", 0); + objMap.put("ysNo", 0); + map.put("ys", objMap); return map; } private Object zeroMap(Map map, Map objMap) { - objMap.put("count",0); - objMap.put("finish",0); - objMap.put("balance",0); + objMap.put("count", 0); + objMap.put("finish", 0); + objMap.put("balance", 0); - map.put("story",objMap); - objMap=new HashMap<>(); - objMap.put("totalUser",0); - objMap.put("planTime",0); - objMap.put("useTime",0); - map.put("zy",objMap); - objMap=new HashMap<>(); - objMap.put("wait",0); - objMap.put("process",0); - objMap.put("finish",0); - objMap.put("totalCount",0); + map.put("story", objMap); + objMap = new HashMap<>(); + objMap.put("totalUser", 0); + objMap.put("planTime", 0); + objMap.put("useTime", 0); + map.put("zy", objMap); + objMap = new HashMap<>(); + objMap.put("wait", 0); + objMap.put("process", 0); + objMap.put("finish", 0); + objMap.put("totalCount", 0); - map.put("task",objMap); - objMap=new HashMap<>(); - objMap.put("totalBug",0); - objMap.put("solve",0); - objMap.put("noSolve",0); - map.put("bug",objMap); + map.put("task", objMap); + objMap = new HashMap<>(); + objMap.put("totalBug", 0); + objMap.put("solve", 0); + objMap.put("noSolve", 0); + map.put("bug", objMap); - objMap=new HashMap<>(); - objMap.put("online",0); - objMap.put("ysAll",0); - objMap.put("ysNo",0); - map.put("ys",objMap); + objMap = new HashMap<>(); + objMap.put("online", 0); + objMap.put("ysAll", 0); + objMap.put("ysNo", 0); + map.put("ys", objMap); return map; @@ -2118,7 +1913,7 @@ public class IZtCountService { public void exportWorkDetailsCount(ZtCountQo qo, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) { try { - List workDetailsDTOS =workDetailsCount(qo); + List workDetailsDTOS = workDetailsCount(qo); ByteArrayOutputStream os = new ByteArrayOutputStream(); EasyExcel.write(os, WorkDetailsDTO.class) @@ -2133,23 +1928,21 @@ public class IZtCountService { response.getOutputStream().write(os.toByteArray()); response.getOutputStream().close(); response.flushBuffer(); - }catch (Exception e){ - log.error("",e); + } catch (Exception e) { + log.error("", e); } } @Autowired private IZtStoryUserService storyUserService; - @Autowired - private IZtStoryFeedbackService storyFeedbackService; public ZtStoryCountDTO storyFeedbackCount(ZtCaseDTO dto) { LoginRiskUser loginRiskUser = RiskUserThreadLocal.get(); UserType userType = RiskUserThreadLocal.get().getUserType(); - if(UserType.XMGLY==userType){ + if (UserType.XMGLY == userType) { //查询产品集的需求 - }else if(UserType.GSGC==userType||loginRiskUser.getName().equals("admin")){ + } else if (UserType.GSGC == userType || loginRiskUser.getName().equals("admin")) { //查询所有的 } return null; @@ -2161,7 +1954,7 @@ public class IZtCountService { } public List ztStoryFeedbackDTO(ZtProjectQo qo) { - return this.storyFeedbackService.ztStoryFeedbackDTO(qo); + return this.storyFeedbackService.ztStoryFeedbackDTO(qo); } public PageInfo myFeedbackPageList(ZtProjectQo qo) { @@ -2178,16 +1971,16 @@ public class IZtCountService { } public List myDevops(ZtProjectQo qo) { - ZtUserQo dto=new ZtUserQo(); + ZtUserQo dto = new ZtUserQo(); dto.setCurrentPage(1); dto.setPageSize(10000); return cronDevopsService.pageList(dto).getList(); } - void generatorDevlopExcel(String name,PerformanceDTO performanceDTO,Date d){ + void generatorDevlopExcel(String name, PerformanceDTO performanceDTO, Date d) { Map dataMap = new HashMap<>(); dataMap.put("name", name); - dataMap.put("date", DateUtils.formatDate(d,"yyyy-MM")); + dataMap.put("date", DateUtils.formatDate(d, "yyyy-MM")); dataMap.put("准时率得分", performanceDTO.getPunctualityScore().toString()); dataMap.put("Bug密度", performanceDTO.getBugScore().toString()); dataMap.put("工作量饱和度", performanceDTO.getSaturationScore().toString()); @@ -2206,17 +1999,17 @@ public class IZtCountService { dataMap.get("工作量饱和度"), dataMap.get("工作态度和责任感") )); - writeXlsx(name,"templates/scope/开发工程师.xlsx",name+"开发.xlsx",dataMap); + writeXlsx(name, "templates/scope/开发工程师.xlsx", name + "开发.xlsx", dataMap); } - void generatorUiExcel(String name,PerformanceDTO performanceDTO,Date d){ + void generatorUiExcel(String name, PerformanceDTO performanceDTO, Date d) { Map dataMap = new HashMap<>(); dataMap.put("name", name); - dataMap.put("date", DateUtils.formatDate(d,"yyyy-MM")); - dataMap.put("总分","100"); - writeXlsx(name,"templates/scope/UI工程师.xlsx",name+"UI工程师.xlsx",dataMap); - InputStream templateFile =null; + dataMap.put("date", DateUtils.formatDate(d, "yyyy-MM")); + dataMap.put("总分", "100"); + writeXlsx(name, "templates/scope/UI工程师.xlsx", name + "UI工程师.xlsx", dataMap); + InputStream templateFile = null; // try { // templateFile=IZtCountService.class.getClassLoader().getResourceAsStream("templates/scope/UI工程师.xlsx"); //// templateFile = IZtCountService.class.getClassLoader().getResourceAsStream("templates/scope/开发工程师.xlsx"); @@ -2258,26 +2051,26 @@ public class IZtCountService { // } } - void generatorXMJLExcel(ZtCountQo qo,String name,PerformanceDTO performanceDTO,Date d, List perList){ + + void generatorXMJLExcel(ZtCountQo qo, String name, PerformanceDTO performanceDTO, Date d, List perList) { Map userMap = userService.userMapByIds(null); Map dataMap = new HashMap<>(); dataMap.put("name", name); - dataMap.put("date", DateUtils.formatDate(d,"yyyy-MM")); + dataMap.put("date", DateUtils.formatDate(d, "yyyy-MM")); - dataMap.put("任务管理",taskManageScore(perList,userMap)); - dataMap.put("bug",bugManageScore(qo,perList,userMap)); + dataMap.put("任务管理", taskManageScore(perList, userMap)); + dataMap.put("bug", bugManageScore(qo, perList, userMap)); - dataMap.put("版本计划完成率",versionPlanScore(qo,perList,userMap)); - dataMap.put("项目文档","10"); - dataMap.put("会议管理",performanceDTO.getMeetScore()+""); - dataMap.put("问题管理","5"); - dataMap.put("系统稳定性","10"); - dataMap.put("专业技能提升","5"); + dataMap.put("版本计划完成率", versionPlanScore(qo, perList, userMap)); + dataMap.put("项目文档", "10"); + dataMap.put("会议管理", performanceDTO.getMeetScore() + ""); + dataMap.put("问题管理", "5"); + dataMap.put("系统稳定性", "10"); + dataMap.put("专业技能提升", "5"); - - dataMap.put("总分",devlopTotal( + dataMap.put("总分", devlopTotal( dataMap.get("版本计划完成率"), dataMap.get("任务管理"), dataMap.get("bug"), @@ -2288,7 +2081,7 @@ public class IZtCountService { dataMap.get("专业技能提升") )); - writeXlsx(name,"templates/scope/项目经理考核.xlsx",name+"项目经理考核.xlsx",dataMap); + writeXlsx(name, "templates/scope/项目经理考核.xlsx", name + "项目经理考核.xlsx", dataMap); } @@ -2306,10 +2099,10 @@ public class IZtCountService { } - private void writeXlsx(String name,String source, String toSource, Map dataMap) { - InputStream templateFile=null; + private void writeXlsx(String name, String source, String toSource, Map dataMap) { + InputStream templateFile = null; try { - templateFile=IZtCountService.class.getClassLoader().getResourceAsStream(source); + templateFile = IZtCountService.class.getClassLoader().getResourceAsStream(source); // templateFile = IZtCountService.class.getClassLoader().getResourceAsStream("templates/scope/开发工程师.xlsx"); @@ -2319,7 +2112,7 @@ public class IZtCountService { Workbook workbook = WorkbookFactory.create(templateFile); Sheet sheet = workbook.getSheetAt(0); - workbook.setSheetName(0,name); + workbook.setSheetName(0, name); // 替换占位符 for (Row row : sheet) { for (Cell cell : row) { @@ -2334,22 +2127,22 @@ public class IZtCountService { } // 生成新文件 - FileOutputStream outputStream =null; + FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(toSource); workbook.write(outputStream); - }catch (Exception e){ - log.error("",e); - }finally { - if(outputStream!=null){ + } catch (Exception e) { + log.error("", e); + } finally { + if (outputStream != null) { outputStream.close(); } } workbook.close(); - }catch (Exception e){ - log.error("",e); - }finally { + } catch (Exception e) { + log.error("", e); + } finally { try { templateFile.close(); } catch (IOException e) { @@ -2360,157 +2153,583 @@ public class IZtCountService { } //项目管理员 线上BUG得分 满分20分 - private String bugManageScore(ZtCountQo qo,List perList,Map userMap) { - List pIds = this.projectService.authProductList(); + private PerformanceDTO buildBugManage(PerformanceDTO result, ZtCountQo qo, List perList, Map userMap) { + List projectIds = this.projectService.projectAuthList(); + if (CollectionUtils.isEmpty(projectIds)) { + return result; + } Date date = qo.getDate(); Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(date); Date lastDayOfMonth = DateUtils.getLastDayOfMonth(date); //线上bug - List bList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, pIds) + List bList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProject, projectIds) .ge(ZtBug::getOpeneddate, firstDayOfMonth).le(ZtBug::getOpeneddate, lastDayOfMonth) - .eq(ZtBug::getBugType,"prod") + .eq(ZtBug::getBugType, "prod") ); - if(CollectionUtils.isEmpty(bList)){ + if (CollectionUtils.isEmpty(bList)) { + result.setBugScore(BigDecimal.valueOf(20)); + return result; + } + + BigDecimal allocationTime = BigDecimal.ZERO; + for (PerformanceDTO d : perList) { + ZtUser ztUser = userMap.get(d.getAccount()); + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { + //可用工时 + allocationTime = allocationTime.add(d.getAllocationTime()); + } + } + List seriousBugList = bList.stream().filter(o -> o.getSeverity() == 1).collect(Collectors.toList()); + //严重bug + result.setSeriousBug(BigDecimal.valueOf(seriousBugList.size())); + //普通bug + List slights = Arrays.asList(1, 2, 3); + List slightBugList = bList.stream().filter(o -> slights.contains(o.getSeverity())).collect(Collectors.toList()); + result.setSlightBug(BigDecimal.valueOf(slightBugList.size())); + + BigDecimal bugRate = BigDecimal.valueOf(bList.size()).divide(BigDecimalUtils.isZero(allocationTime) ? BigDecimal.valueOf(1) : allocationTime, 2, BigDecimal.ROUND_HALF_UP); + result.setBugDensity(bugRate); + int i = bugRate.multiply(BigDecimal.valueOf(100)).intValue(); + if (i <= 5) { + result.setBugScore(BigDecimal.valueOf(20)); + } + //严重10 分 轻微3分一个 + int bugScore = 0; + for (ZtBug b : bList) { + bugScore += b.getSeverity() != 1 ? 3 : 10; + } + if (bugScore > 20) { + } else { + result.setBugScore(BigDecimal.valueOf((20 - bugScore))); + } + return result; + } + + //项目管理员 线上BUG得分 满分20分 + private String bugManageScore(ZtCountQo qo, List perList, Map userMap) { + List projectIds = this.projectService.projectAuthList(); + if (CollectionUtils.isEmpty(projectIds)) { + return "0"; + } + Date date = qo.getDate(); + Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(date); + Date lastDayOfMonth = DateUtils.getLastDayOfMonth(date); + //线上bug + List bList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProject, projectIds) + .ge(ZtBug::getOpeneddate, firstDayOfMonth).le(ZtBug::getOpeneddate, lastDayOfMonth) + .eq(ZtBug::getBugType, "prod") + ); + if (CollectionUtils.isEmpty(bList)) { return "20"; } - BigDecimal allocationTime =BigDecimal.ZERO; - for (PerformanceDTO d:perList) { + BigDecimal allocationTime = BigDecimal.ZERO; + for (PerformanceDTO d : perList) { ZtUser ztUser = userMap.get(d.getAccount()); - if(ztUser!=null&&ztUser.getUserType()==UserType.KFZ){ + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { //可用工时 - allocationTime=allocationTime.add(d.getAllocationTime()); + allocationTime = allocationTime.add(d.getAllocationTime()); } } - int i = BigDecimal.valueOf(bList.size()).divide(allocationTime,2,BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue(); - if(i<=5){ + int i = BigDecimal.valueOf(bList.size()).divide(BigDecimalUtils.isZero(allocationTime) ? BigDecimal.valueOf(1) : allocationTime, 2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(100)).intValue(); + if (i <= 5) { return "20"; } //严重10 分 轻微3分一个 - int bugScore=0; - for (ZtBug b:bList) { - bugScore+=b.getSeverity()!=1?3:10; + int bugScore = 0; + for (ZtBug b : bList) { + bugScore += b.getSeverity() != 1 ? 3 : 10; } - if(bugScore>20){ + if (bugScore > 20) { return "0"; - }else{ - return (20-bugScore)+""; + } else { + return (20 - bugScore) + ""; } } - private String taskManageScore(List perList,Map userMap) { + private PerformanceDTO buildTaskManage(PerformanceDTO result, List perList, Map userMap) { - BigDecimal totalTime =BigDecimal.ZERO; - BigDecimal allocationTime =BigDecimal.ZERO; - for (PerformanceDTO d:perList) { + BigDecimal totalTime = BigDecimal.ZERO; + BigDecimal allocationTime = BigDecimal.ZERO; + for (PerformanceDTO d : perList) { ZtUser ztUser = userMap.get(d.getAccount()); - if(ztUser!=null&&ztUser.getUserType()==UserType.KFZ){ + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { //可用工时 - totalTime=totalTime.add(d.getTotalTime()) ; - allocationTime=allocationTime.add(d.getAllocationTime()); + totalTime = totalTime.add(d.getExamineTime()); + allocationTime = allocationTime.add(d.getAllocationTime()); } } - BigDecimal taskManageRate = BigDecimalUtils.isZero(allocationTime) ?BigDecimal.ZERO:totalTime.divide(allocationTime, 2, BigDecimal.ROUND_HALF_UP); - if(BigDecimalUtils.isZero(taskManageRate) ){ + BigDecimal taskManageRate = BigDecimalUtils.isZero(allocationTime) ? BigDecimal.ZERO : totalTime.divide(allocationTime, 2, BigDecimal.ROUND_HALF_UP); + result.setAllocationTime(allocationTime); + result.setExamineTime(totalTime); + + BigDecimal taskManageScore = BigDecimal.ZERO; + if (BigDecimalUtils.isZero(taskManageRate)) { + } else { + BigDecimal taskRate = taskManageRate.multiply(BigDecimal.valueOf(100)); + int i = taskRate.intValue(); + if (i > 95) { + taskManageScore = BigDecimal.valueOf(20); + } else if (91 < i && i <= 95) { + taskManageScore = BigDecimal.valueOf((20 - ((96 - i) * 5))); + } + } + result.setTaskManageScore(taskManageScore); + result.setAllocationTimeManageRate(taskManageRate); + return result; + } + + private String taskManageScore(List perList, Map userMap) { + + BigDecimal totalTime = BigDecimal.ZERO; + BigDecimal allocationTime = BigDecimal.ZERO; + for (PerformanceDTO d : perList) { + ZtUser ztUser = userMap.get(d.getAccount()); + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { + //可用工时 + totalTime = totalTime.add(d.getExamineTime()); + allocationTime = allocationTime.add(d.getAllocationTime()); + } + } + BigDecimal taskManageRate = BigDecimalUtils.isZero(allocationTime) ? BigDecimal.ZERO : totalTime.divide(allocationTime, 2, BigDecimal.ROUND_HALF_UP); + if (BigDecimalUtils.isZero(taskManageRate)) { return "0"; } BigDecimal taskRate = taskManageRate.multiply(BigDecimal.valueOf(100)); int i = taskRate.intValue(); - if(i>95){ + if (i > 95) { return "20"; - }else if(91 dataMap = new HashMap<>(); dataMap.put("name", name); - dataMap.put("date", DateUtils.formatDate(d,"yyyy-MM")); - dataMap.put("项目绩效",performanceDTO.getReleaseScore().toString()); - dataMap.put("项目文档","50"); - dataMap.put("会议管理",performanceDTO.getMeetScore().toString()); - dataMap.put("总分",devlopTotal(dataMap.get("项目绩效"),dataMap.get("项目文档"),dataMap.get("会议管理"))); - writeXlsx(name,"templates/scope/项目助理考核.xlsx",name+"项目助理考核.xlsx",dataMap); + dataMap.put("date", DateUtils.formatDate(d, "yyyy-MM")); + dataMap.put("项目绩效", performanceDTO.getReleaseScore().toString()); + dataMap.put("项目文档", "50"); + dataMap.put("会议管理", performanceDTO.getMeetScore().toString()); + dataMap.put("总分", devlopTotal(dataMap.get("项目绩效"), dataMap.get("项目文档"), dataMap.get("会议管理"))); + writeXlsx(name, "templates/scope/项目助理考核.xlsx", name + "项目助理考核.xlsx", dataMap); -// InputStream templateFile =null; -// try { -// templateFile=IZtCountService.class.getClassLoader().getResourceAsStream("templates/scope/项目助理考核.xlsx"); -//// templateFile = IZtCountService.class.getClassLoader().getResourceAsStream("templates/scope/开发工程师.xlsx"); -// -// -// -// //测试方案 -// // 读取模板 -// -// Workbook workbook = WorkbookFactory.create(templateFile); -// -// Sheet sheet = workbook.getSheetAt(0); -// workbook.setSheetName(0,name); -// // 替换占位符 -// for (Row row : sheet) { -// for (Cell cell : row) { -// if (cell.getCellType() == CellType.STRING) { -// String cellValue = cell.getStringCellValue(); -// for (Map.Entry entry : dataMap.entrySet()) { -// cellValue = cellValue.replace("{" + entry.getKey() + "}", entry.getValue()); -// } -// cell.setCellValue(cellValue); -// } -// } -// } -// -// // 生成新文件 -// try (FileOutputStream outputStream = new FileOutputStream(name+"项目助理考核.xlsx")) { -// workbook.write(outputStream); -// } -// workbook.close(); -// }catch (Exception e){ -// log.error("",e); -// }finally { -// try { -// templateFile.close(); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// } - } - String devlopTotal(String ...args){ - int i =0; - for (String s:args) { + String devlopTotal(String... args) { + int i = 0; + for (String s : args) { try { - i+=new BigDecimal(s).intValue(); - }catch (Exception e){ - log.error("",e); + i += new BigDecimal(s).intValue(); + } catch (Exception e) { + log.error("", e); } } - return i+""; + return i + ""; } - void generatorTestExcel(String name,PerformanceDTO performanceDTO,Date d){ + + void generatorTestExcel(String name, PerformanceDTO performanceDTO, Date d) { Map dataMap = new HashMap<>(); dataMap.put("name", name); - dataMap.put("date", DateUtils.formatDate(d,"yyyy-MM")); - dataMap.put("准时率得分",performanceDTO.getPunctualityScore().toString()); + dataMap.put("date", DateUtils.formatDate(d, "yyyy-MM")); + dataMap.put("准时率得分", performanceDTO.getPunctualityScore().toString()); dataMap.put("缺陷检出率", performanceDTO.getBugFindScore().toString()); dataMap.put("测试文档", "20"); dataMap.put("工作态度", "5"); dataMap.put("质量贡献", "5"); dataMap.put("线上Bug", "20"); dataMap.put("总分", devlopTotal(dataMap.get("准时率得分") - ,dataMap.get("缺陷检出率"), dataMap.get("测试文档"), dataMap.get("工作态度"), dataMap.get("质量贡献"), dataMap.get("线上Bug")) + , dataMap.get("缺陷检出率"), dataMap.get("测试文档"), dataMap.get("工作态度"), dataMap.get("质量贡献"), dataMap.get("线上Bug")) ); - writeXlsx(name,"templates/scope/测试工程师.xlsx",name+"测试.xlsx",dataMap); - + writeXlsx(name, "templates/scope/测试工程师.xlsx", name + "测试.xlsx", dataMap); } -} \ No newline at end of file + @Autowired + private IZtMonthScoreService monthScoreService; + + public PerformanceDTO myWorkScore(ZtProjectQo qo) { + PerformanceDTO result = new PerformanceDTO(); + Date d = qo.getDate(); + if (d == null) { + d = new Date(); + } + String name = StringUtils.isEmpty(qo.getAccount()) ? RiskUserThreadLocal.get().getName() : qo.getAccount(); + if (StringUtils.isEmpty(name)) { + throw new BusinessException("请检查"); + } + ZtUser u = this.userService.getByAccount(name); + + String month = DateUtils.formatDate(d, "yyyy-MM"); + ZtMonthScore monthScore = this.monthScoreService.getOne(new QueryWrapper().lambda().eq(ZtMonthScore::getAccount, name) + .eq(ZtMonthScore::getDateStr, month)); + if (monthScore != null) { + String scopeJson = monthScore.getScopeJson(); + PerformanceDTO performanceDTO = JSON.parseObject(scopeJson, PerformanceDTO.class); + performanceDTO.setId(monthScore.getId()); + return performanceDTO; + } + + Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); + Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); + + List pIds = this.projectService.authProductList(); + if (CollectionUtils.isEmpty(pIds)) { + return result; + } + + List productList = this.productService.listByIds(pIds); + if (CollectionUtils.isEmpty(productList)) { + return result; + } + List projectproducts = this.projectproductService.list(new QueryWrapper().lambda() + .in(ZtProjectproduct::getProduct, productList.stream().map(o -> o.getId()).collect(Collectors.toList()))); + if (CollectionUtils.isEmpty(projectproducts)) { + return result; + } + List execList = executionprojectService.list(new QueryWrapper().lambda() + .in(ZtExecutionproject::getProject, projectproducts.stream().map(o -> o.getProject()).collect(Collectors.toList()))); + if (CollectionUtils.isEmpty(execList)) { + return result; + } + List taskList = this.taskService.taskListByEIdsAndDate(firstDayOfMonth, lastDayOfMonth, pIds); + + + if (CollectionUtils.isEmpty(taskList)) { + return result; + } + List ztProjects = this.projectService.listByIds(execList.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + + + ztProjects = ztProjects.stream().filter(o -> (o.getBegin().getTime() >= firstDayOfMonth.getTime() + && o.getBegin().getTime() <= lastDayOfMonth.getTime()) || ( + o.getEnd().getTime() >= firstDayOfMonth.getTime() + && o.getEnd().getTime() <= lastDayOfMonth.getTime() + )).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(ztProjects)) { + return result; + } + + List teams = this.teamService.list(new QueryWrapper().lambda().eq(ZtTeam::getType, "execution") + .in(ZtTeam::getRoot, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); + + List accountIds = teams.stream().map(o -> o.getAccount()).distinct().collect(Collectors.toList()); + if (CollectionUtils.isEmpty(accountIds)) { + return result; + } + //accountIds 成员 + + + UserType userType = RiskUserThreadLocal.get().getUserType(); + List approvalList = this.taskService.itApprovalByUserName(u.getNickname(), firstDayOfMonth, lastDayOfMonth); + + if (name.equals("liyuyan")) { + result = buildXMZLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } else if ("liushengqing".equals(name)) { + result = buildUiScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } else if (u.getUserType() == UserType.KFZ) { + result = buildKFZScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } else if (u.getUserType() == UserType.CS) { + result = buildCScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } else if (u.getUserType() == UserType.UI) { + result = buildUiScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } else if (u.getUserType() == UserType.XMJL || u.getUserType() == UserType.XMGLY || u.getUserType() == UserType.GSGC) { + result = buildXMJLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + ZtCountQo ztCountQo = new ZtCountQo(); + BeanUtils.copyProperties(qo, ztCountQo); + List perList = this.newPerformanceCount(ztCountQo); + Map userMap = this.userService.userMapByIds(accountIds); + + result = buildTaskManage(result, perList, userMap); + result = buildBugManage(result, ztCountQo, perList, userMap); + + String versionPlanScore = versionPlanScore(ztCountQo, perList, userMap); + result.setVersionPlanFinishedRate(new BigDecimal(versionPlanScore)); + result.setSystemStabilityScore(BigDecimal.valueOf(10)); + result.setProfessionalSkillEnhancementScore(BigDecimal.valueOf(5)); + } else if (u.getUserType() == UserType.XMZL) { + result = buildXMZLScore(u, approvalList, firstDayOfMonth, lastDayOfMonth, taskList, d); + } + + return result; + + } + + public Map storyBarChart(ZtProjectQo qo) { + Integer id = qo.getId(); + Map map = new HashMap<>(); + Date date = new Date(); + for (int i = 0; i < 6; i++) { + Date d = DateUtils.dateSubMonth(date, i); + JSONObject obj = new JSONObject(); + obj.put("storyCount", 0); + obj.put("storyTime", 0); + map.put(DateUtils.formatDate(d, "yyyy-MM"), obj); + } + + List productList = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, id)); + + List pIds = productList.stream().map(o -> o.getId()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(pIds)) { + return map; + } + Date start = DateUtils.getFirstDayOfMonth(DateUtils.dateSubMonth(date, 6)); + Date end = DateUtils.getLastDayOfMonth(date); + +// List list = this.storyService.list(new QueryWrapper().lambda().in(ZtStory::getProduct, pIds) +// .ge(ZtStory::getOpenedDate, start).le(ZtStory::getOpenedDate, end)); + + List list = this.storyService.list(new QueryWrapper().lambda().in(ZtStory::getProduct, pIds) + .ge(ZtStory::getEndDate, start).le(ZtStory::getEndDate, end)); + + for (int i = 0; i < 6; i++) { + Date d = DateUtils.dateSubMonth(date, i); + + Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); + Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); + + + List sList = list.stream() + .filter(o -> + o.getEndDate().getTime() >= firstDayOfMonth.getTime() + && o.getEndDate().getTime() <= lastDayOfMonth.getTime()).collect(Collectors.toList() + ); + + sList = this.storyService.getNormalStory(sList); + + if (CollectionUtils.isEmpty(sList)) { + continue; + } + JSONObject obj = new JSONObject(); + obj.put("storyCount", sList.size()); + //工作饱和度 分配工时 / 达标工时 + ZtCountQo countQo = new ZtCountQo(); + countQo.setProject(id); + countQo.setDate(firstDayOfMonth); + List performanceDTOS = this.newPerformanceCount(countQo); + BigDecimal examineTime = BigDecimal.ZERO; + BigDecimal allocationTime = BigDecimal.ZERO; + Map userMap = this.userService.userMapByIds(null); + + for (PerformanceDTO performanceDTO : performanceDTOS) { + ZtUser ztUser = userMap.get(performanceDTO.getAccount()); + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { + examineTime = examineTime.add(performanceDTO.getExamineTime()); + allocationTime = allocationTime.add(performanceDTO.getAllocationTime()); + } + } + obj.put("storyTime", BigDecimalUtils.isZero(examineTime) ? 0 : allocationTime.divide(examineTime, 2, BigDecimal.ROUND_HALF_UP)); + map.put(DateUtils.formatDate(d, "yyyy-MM"), obj); + + } + return map; + } + + public Map bugBarChart(ZtProjectQo qo) { + Integer id = qo.getId(); + + Map map = new HashMap<>(); + Date date = new Date(); + for (int i = 0; i < 6; i++) { + Date d = DateUtils.dateSubMonth(date, i); + JSONObject obj = new JSONObject(); + obj.put("devBugCount", 0); + obj.put("prodBugCount", 0); + map.put(DateUtils.formatDate(d, "yyyy-MM"), obj); + } + List productList = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, id)); + + List pIds = productList.stream().map(o -> o.getId()).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(pIds)) { + return map; + } + Date start = DateUtils.getFirstDayOfMonth(DateUtils.dateSubMonth(date, 6)); + Date end = DateUtils.getLastDayOfMonth(date); + List list = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, pIds) + .ge(ZtBug::getOpeneddate, start).le(ZtBug::getOpeneddate, end)); + list=this.bugService.getNormalBugList(list); + List tList = this.taskService.list(new QueryWrapper().lambda().in(ZtTask::getProduct, pIds) + .ge(ZtTask::getOpeneddate, start).le(ZtTask::getOpeneddate, end)); + tList = this.taskService.getNormalTaskList(tList); + if (CollectionUtils.isEmpty(list)) { + return map; + } + + + for (int i = 0; i < 6; i++) { + Date d = DateUtils.dateSubMonth(date, i); + + Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(d); + Date lastDayOfMonth = DateUtils.getLastDayOfMonth(d); + + + List bugList = list.stream().filter(o -> o.getOpeneddate().getTime() >= firstDayOfMonth.getTime() + && o.getOpeneddate().getTime() <= lastDayOfMonth.getTime()).collect(Collectors.toList()); + bugList = this.bugService.getNormalBugList(bugList); +// List taskList = tList.stream().filter(o -> o.getOpeneddate().getTime() >= firstDayOfMonth.getTime() +// && o.getOpeneddate().getTime() <= lastDayOfMonth.getTime()).collect(Collectors.toList()); + + if (CollectionUtils.isEmpty(bugList)) { + continue; + } +// List taskList = this.bugService.bu.taskListByStoryIds(sList.stream().map(o->o.getId()).collect(Collectors.toList())); + JSONObject obj = new JSONObject(); + //bug密度 = bug数量 /分配工时 + List devBugList = bugList.stream().filter(o -> o.getBugType().equals("dev")).collect(Collectors.toList()); + //分配工时 +// BigDecimal estimateAll = floatBatchAdd(taskList.stream().map(o -> o.getEstimate()).collect(Collectors.toList())); + ZtCountQo countQo = new ZtCountQo(); + countQo.setProject(id); + countQo.setDate(firstDayOfMonth); + List performanceDTOS = this.newPerformanceCount(countQo); + BigDecimal examineTime = BigDecimal.ZERO; + BigDecimal allocationTime = BigDecimal.ZERO; + Map userMap = this.userService.userMapByIds(null); + + for (PerformanceDTO performanceDTO : performanceDTOS) { + ZtUser ztUser = userMap.get(performanceDTO.getAccount()); + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { + examineTime = examineTime.add(performanceDTO.getExamineTime()); + allocationTime = allocationTime.add(performanceDTO.getAllocationTime()); + } + } + + BigDecimal Density = BigDecimalUtils.isZero(allocationTime) ? BigDecimal.valueOf(devBugList.size()) : BigDecimal.valueOf(devBugList.size()).divide(allocationTime, 2, BigDecimal.ROUND_HALF_UP); + //bug率 + List prodBugList = bugList.stream().filter(o -> o.getBugType().equals("prod")).collect(Collectors.toList()); + + obj.put("devBugCount", Density); + obj.put("prodBugCount", BigDecimalUtils.isZero(allocationTime) ? 0 : BigDecimal.valueOf(prodBugList.size()).divide(allocationTime, 2, BigDecimal.ROUND_HALF_UP)); + map.put(DateUtils.formatDate(d, "yyyy-MM"), obj); + + } + + + return map; + } + + public ProgramCountDTO monthScopeByProgram(ZtProjectQo qo) { + Integer id = qo.getId(); + + Date date = qo.getDate(); + ProgramCountDTO dto = new ProgramCountDTO(); + + List list = this.productService.list(new QueryWrapper().lambda().eq(ZtProduct::getProgram, id)); + if (CollectionUtils.isEmpty(list)) { + return dto; + } + List pIds = list.stream().map(o -> o.getId()).collect(Collectors.toList()); + + + Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(date); + + + Date lastDayOfMonth = DateUtils.getLastDayOfMonth(firstDayOfMonth); + + + // 开发完成时间 测试完成时间 +// //完成需求总量 + List storyList = this.storyService.list(new QueryWrapper().lambda().in(ZtStory::getProduct, pIds) + .ge(ZtStory::getEndDate, firstDayOfMonth).le(ZtStory::getEndDate, lastDayOfMonth)); + dto.setFinishedStoryCount(BigDecimal.valueOf(storyList.size())); + +// //检出bug总量 + List bugList = this.bugService.bugListByProductAndDate(pIds,firstDayOfMonth,lastDayOfMonth); + bugList=this.bugService.getNormalBugList(bugList); + +// //研发bug密度 + + + // 工作量饱和度分配时间 /达标时间 + ZtCountQo countQo = new ZtCountQo(); + + countQo.setDate(firstDayOfMonth); + countQo.setProject(qo.getId()); + List performanceDTOS = this.newPerformanceCount(countQo); + BigDecimal allocationTime = BigDecimal.ZERO; + BigDecimal examineTime = BigDecimal.ZERO; + BigDecimal workTime = BigDecimal.ZERO; + Map userMap = this.userService.userMapByIds(null); + BigDecimal taskCount= BigDecimal.ZERO; + BigDecimal finishPunctuality =BigDecimal.ZERO; + int kfzCount=0; + List multipleUserList= getmultipleDepartProjectTeam(firstDayOfMonth,lastDayOfMonth); + for (PerformanceDTO performanceDTO : performanceDTOS) { + ZtUser ztUser = userMap.get(performanceDTO.getAccount()); + if (ztUser != null && ztUser.getUserType() == UserType.KFZ) { + //如果多项目组 那么 分配任务工时占 总工时的% TODO + if(multipleUserList.contains(ztUser.getAccount())){ + examineTime = examineTime.add(performanceDTO.getAllocationTime()); + }else{ + examineTime = examineTime.add(performanceDTO.getExamineTime()); + } + allocationTime = allocationTime.add(performanceDTO.getAllocationTime()); + + workTime = workTime.add(performanceDTO.getWorkTime()); + taskCount=taskCount.add(performanceDTO.getTotalTask()); + finishPunctuality=finishPunctuality.add(performanceDTO.getFinishPunctuality()); + kfzCount+=1; + } + } + dto.setAllocationTime(allocationTime); + + List devBugList = bugList.stream().filter(o -> o.getBugType().equals("dev")).collect(Collectors.toList()); + int devBugCount = devBugList.size(); + dto.setBugCount(BigDecimal.valueOf(devBugCount)); + dto.setBugDensity((dto.getAllocationTime() == null || BigDecimalUtils.isZero(dto.getAllocationTime())) ? BigDecimal.ZERO : BigDecimal.valueOf(devBugCount).divide(dto.getAllocationTime(), 2, BigDecimal.ROUND_HALF_UP)); + + + dto.setWorkTime(workTime); + // //完成任务总量 + dto.setTaskCount(taskCount); + //分配公式/达标工时 分配任务工时占 总工时的% TODO + dto.setSaturation(BigDecimalUtils.isZero(examineTime) ? BigDecimal.ZERO : dto.getAllocationTime().divide(examineTime, 2, BigDecimal.ROUND_HALF_UP)); + //完成准时率 + dto.setFinishPunctuality(kfzCount<=0?BigDecimal.ZERO:finishPunctuality.divide(BigDecimal.valueOf(kfzCount),2,BigDecimal.ROUND_HALF_UP)); +// //处理问题数量 + List feedbackList = this.storyFeedbackService.list(new QueryWrapper() + .lambda().in(ZtStoryFeedback::getProduct, pIds) + .ge(ZtStoryFeedback::getOpenedDate, firstDayOfMonth).le(ZtStoryFeedback::getOpenedDate, lastDayOfMonth)); + List feedbacks = feedbackList.stream().filter(o -> !o.getStatus().equals("closed")).collect(Collectors.toList()); + + + dto.setHandFeedbackCount(BigDecimal.valueOf(feedbacks.stream().filter(o -> o.getFinishDate() != null).count())); + List pList = this.projectService.projectListByProductIds(pIds); +// 处理结果通过率 + BigDecimal verifiedCount = BigDecimal.valueOf(feedbackList.stream().filter(o -> o.getStatus().equals("verified")).count()); + + dto.setPassFeedbackCountRate(BigDecimalUtils.isZero(dto.getHandFeedbackCount()) ? BigDecimal.ZERO : verifiedCount.divide(dto.getHandFeedbackCount(), 2, BigDecimal.ROUND_HALF_UP)); + +// //上线的需求数量 + List releaseStoryList = monthReleaseBeforeAfterFifteen(firstDayOfMonth, pList.stream().map(o -> o.getId()).collect(Collectors.toList())); + + dto.setReleaseStoryCount(BigDecimal.valueOf(releaseStoryList.size())); +// 完成验收数量 + dto.setYsStoryCount(BigDecimal.valueOf(releaseStoryList.stream().filter(o -> o.getYsDate() != null).count())); +// //需求完成验收率 + + dto.setYsStoryRate((BigDecimalUtils.isZero(dto.getYsStoryCount())||BigDecimalUtils.isZero(dto.getReleaseStoryCount())) ? BigDecimal.ZERO : dto.getYsStoryCount().divide(dto.getReleaseStoryCount(), 2, BigDecimal.ROUND_HALF_UP)); +// //线上bug率 + List prodBugList = bugList.stream().filter(o -> o.getBugType().equals("prod")).collect(Collectors.toList()); + + dto.setProdBugRate((CollectionUtils.isEmpty(bugList) || BigDecimalUtils.isZero(dto.getAllocationTime())) ? BigDecimal.ZERO : BigDecimal.valueOf(prodBugList.size()).divide(dto.getAllocationTime(), 2, BigDecimal.ROUND_HALF_UP)); + + return dto; + } + + private List getmultipleDepartProjectTeam(Date firstDayOfMonth, Date lastDayOfMonth) { + List multipleDepartProjectTeamList = this.taskService.multipleDepartProjectTeam(firstDayOfMonth,lastDayOfMonth); + if(CollectionUtils.isEmpty(multipleDepartProjectTeamList)){ + return new ArrayList(); + }else{ + return multipleDepartProjectTeamList.stream().filter(o->!StringUtils.isEmpty(o.getAssignedTo())).map(o->o.getAssignedTo()).collect(Collectors.toList()); + } + } +} diff --git a/src/main/java/com/sa/zentao/service/impl/ZtBugServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtBugServiceImpl.java index 088773c..b774a7f 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtBugServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtBugServiceImpl.java @@ -93,20 +93,24 @@ public class ZtBugServiceImpl extends ServiceImpl implements @Override public PageInfo bugPageList(ZtProjectQo qo) { - List pIds = this.projectService.authProductList(); + List pIds = this.projectService.authProductList(); Page page = PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize()); qo.setUserName(RiskUserThreadLocal.get().getName()); List result =null; if(StringUtils.isEmpty(qo.getSource())){ + if(CollectionUtils.isEmpty(pIds)){ return new PageInfo<>(); } if (!StringUtils.isEmpty(qo.getIds())) { String[] split = qo.getIds().split(","); qo.setObjIds(new ArrayList<>(Arrays.asList(split))); + } + if(qo.getProductId()!=null&&qo.getProductId()!=0){ + qo.setProductIds(Arrays.asList(qo.getProductId())); }else{ qo.setProductIds(pIds); } @@ -278,7 +282,13 @@ public class ZtBugServiceImpl extends ServiceImpl implements String lasteditedby = d.getLasteditedby(); String closedby = d.getClosedby(); - + Integer feedback = ztBug.getFeedback(); + if(feedback!=null&&feedback!=0){ + ZtStoryFeedback ztStoryFeedback = this.storyFeedbackService.getById(feedback); + if(ztStoryFeedback!=null){ + d.setFeedbackSpec(ztStoryFeedback.getSpec()); + } + } Map userMap = this.userService.userMapByIds(null); ZtUser ztUser = userMap.get(d.getAssignedTo()); @@ -526,6 +536,31 @@ public class ZtBugServiceImpl extends ServiceImpl implements return this.bugInfoById(id); } + @Override + public List bugListByIds(List ids) { + return this.baseMapper.bugListByIds(ids); + } + + @Override + public List getNormalBugList(List bugList) { + List result=new ArrayList(); + for (ZtBug b:bugList) { + if(!b.getStatus().equals("closed")){ + result.add(b); + } + if(b.getStatus().equals("closed")&&!StringUtils.isEmpty(b.getResolvedby())){ + result.add(b); + } + } + return result; + } + + @Override + public List bugListByProductAndDate(List pIds, Date firstDayOfMonth, Date lastDayOfMonth) { + + return this.baseMapper.bugListByProductAndDate(pIds,firstDayOfMonth,lastDayOfMonth); + } + @Override @Transactional @@ -630,6 +665,9 @@ public class ZtBugServiceImpl extends ServiceImpl implements // } if("closed".equalsIgnoreCase(qo.getStatus())){ + if(!"resolved".equals(ztBug.getStatus())){ + throw new BusinessException("未完成的bug无法关闭"); + } // ztBug.setStatus("closed"); ztBug.setClosedby(RiskUserThreadLocal.get().getName()); @@ -638,6 +676,20 @@ public class ZtBugServiceImpl extends ServiceImpl implements ,RiskUserThreadLocal.get().getName(),qo.getDesc(),"" ); } + + if("cancel".equalsIgnoreCase(qo.getStatus())){ + if("resolved".equals(ztBug.getStatus())||"closed".equals(ztBug.getStatus())||"cancel".equals(ztBug.getStatus())){ + throw new BusinessException("当前无法取消"); + } + // + ztBug.setStatus("cancel"); + ztBug.setCancelBy(RiskUserThreadLocal.get().getName()); + ztBug.setCancelDate(new Date()); + this.actionService.addAction(ActionType.BUG, ActionStatus.QX,ztBug.getId(),ztBug.getProject()+"",ztBug.getProject(),ztBug.getExecution() + ,RiskUserThreadLocal.get().getName(),qo.getDesc(),"" + ); + } + //1.active 2.confire=1 3.解决进行中 不变 4 resolved 完成 5.测试中不变 6.测试完毕不变 ztBug.setLastediteddate(new Date()); ztBug.setLasteditedby(RiskUserThreadLocal.get().getName()); @@ -646,7 +698,7 @@ public class ZtBugServiceImpl extends ServiceImpl implements return; } if(ztBug.getExecution()!=null&&ztBug.getExecution()!=0){ - kanbanlaneService.changeStatus(ztBug.getExecution(),ztBug.getId(),"bug",qo.getStatus()); + kanbanlaneService.changeStatus(ztBug.getExecution(),ztBug.getId(),"bug","cancel".equals(qo.getStatus())?"closed":qo.getStatus()); } diff --git a/src/main/java/com/sa/zentao/service/impl/ZtKanbanlaneServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtKanbanlaneServiceImpl.java index 832c37d..9fb8894 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtKanbanlaneServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtKanbanlaneServiceImpl.java @@ -98,7 +98,6 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl ztStories = this.storyService.listByIds(ids); List ztStoryDTOS = BeanCopyUtil.copyListProperties(ztStories, ZtStoryDTO::new); - List storySpecList = storyspecService.list(new QueryWrapper().lambda().in(ZtStoryspec::getStory, ids)); if(!CollectionUtils.isEmpty(ztStories)){ ZtProduct product = this.productService.getById(ztStoryDTOS.get(0).getProduct()); for (ZtStoryDTO st:ztStoryDTOS) { @@ -113,12 +112,6 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl storyspecs = storySpecList.stream().filter(o -> o.getStory().intValue() == st.getId().intValue()).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(storyspecs)){ - ZtStoryspec ztStoryspec = storyspecs.get(0); - st.setSpec(ztStoryspec.getSpec()); - st.setVerify(ztStoryspec.getVerify()); - } if(product!=null){ st.setProductName(product.getName()); } @@ -127,7 +120,7 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl ztBugs = bugService.listByIds(ids); + List ztBugs = bugService.bugListByIds(ids); List ztBugDTOS =new ArrayList<>(); if(!CollectionUtils.isEmpty(ztBugs)){ @@ -143,7 +136,7 @@ public class ZtKanbanlaneServiceImpl extends ServiceImpl ztTasks = taskService.listByIds(ids); + List ztTasks = taskService.taskListByIds(ids); List ztTaskDTOS =new ArrayList<>(); if(!CollectionUtils.isEmpty(ztTasks)){ ztTaskDTOS=BeanCopyUtil.copyListProperties(ztTasks,ZtTaskDTO::new); diff --git a/src/main/java/com/sa/zentao/service/impl/ZtMeetingServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtMeetingServiceImpl.java index 78d3658..15c1609 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtMeetingServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtMeetingServiceImpl.java @@ -247,7 +247,13 @@ public class ZtMeetingServiceImpl extends ServiceImpl参会人员: {usersName} \n" + "

会议内容

\n" + "
\n"+ - "
{remark}
"; + "
{remark}
"+ + "

讨论的结果

\n" + + "
\n"+ + "
{result}
"+ + "

后续行动安排

\n" + + "
\n"+ + "
{meetingAfter}
"; // 替换内容集合 Map textMap = new LinkedHashMap<>(); @@ -261,6 +267,10 @@ public class ZtMeetingServiceImpl extends ServiceImpl userMap = this.userService.userMapByIds(null); @@ -289,7 +299,7 @@ public class ZtMeetingServiceImpl extends ServiceImpl + * 服务实现类 + *

+ * + * @author gqb + * @since 2025-04-24 + */ +@Service +public class ZtMonthScoreServiceImpl extends ServiceImpl implements IZtMonthScoreService { + + @Autowired + private IZtActionService actionService; + + @Override + @Transactional + public void saveScope(PerformanceDTO dto) { + boolean addFlag = dto.getId()==null?true:false; + + ZtMonthScore ztMonthScore = null; + if(!addFlag){ + ztMonthScore=this.baseMapper.selectById(dto.getId()); + }else if(ztMonthScore==null){ + List ztMonthScores = this.baseMapper.selectList(new QueryWrapper().lambda().eq(ZtMonthScore::getAccount, dto.getAccount()).eq(ZtMonthScore::getDateStr, DateUtils.formatDate(dto.getDate(), "yyyy-MM"))); + if(!CollectionUtils.isEmpty(ztMonthScores)){ + throw new BusinessException("已经存在相同数据"); + } + ztMonthScore=new ZtMonthScore(); + ztMonthScore.setCreateDate(new Date()); + ztMonthScore.setCreateUser(RiskUserThreadLocal.get().getName()); + ztMonthScore.setAccount(dto.getAccount()); + } + ztMonthScore.setDateStr(DateUtils.formatDate(dto.getDate(),"yyyy-MM")); + ztMonthScore.setScopeJson(JSON.toJSONString(dto)); + ztMonthScore.setUpdateDate(new Date()); + ztMonthScore.setUpdateUser(RiskUserThreadLocal.get().getName()); + this.saveOrUpdate(ztMonthScore); + if(addFlag){ + actionService.addAction(ActionType.SCORECOUNT, ActionStatus.XJ,null,null,null,null,RiskUserThreadLocal.get().getName(),"",null); + }else{ + actionService.addAction(ActionType.SCORECOUNT, ActionStatus.BJ,null,null,null,null,RiskUserThreadLocal.get().getName(),"",null); + } + + } + + +} diff --git a/src/main/java/com/sa/zentao/service/impl/ZtProductServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtProductServiceImpl.java index b1f43bf..c301c89 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtProductServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtProductServiceImpl.java @@ -20,6 +20,7 @@ import com.sa.zentao.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.sa.zentao.utils.BeanCopyUtil; import com.sa.zentao.utils.BeanCopyUtilCallBack; +import com.sa.zentao.utils.SFunctionColums; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -424,7 +425,12 @@ public class ZtProductServiceImpl extends ServiceImpl ztProjects = this.projectService.listByIds(projectproductlist.stream().map(o -> o.getProject()).collect(Collectors.toList())); result.put("project",ztProjects); List list = this.executionprojectService.list(new QueryWrapper().lambda().in(ZtExecutionproject::getProject, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); - List execList = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + List execList = this.projectService + .list(new QueryWrapper().lambda() + .ne(ZtProject::getStatus,"closed") + .in(ZtProject::getId,list.stream().map(o -> o.getExecution()).collect(Collectors.toList())) + .orderByDesc(ZtProject::getId) + ); result.put("execution",execList); }else{ result.put("project",Arrays.asList()); @@ -446,7 +452,12 @@ public class ZtProductServiceImpl extends ServiceImpl list = this.executionprojectService.list(new QueryWrapper().lambda().in(ZtExecutionproject::getProject, Arrays.asList(projectId))); if(!CollectionUtils.isEmpty(list)){ - List execList = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + List execList = this.projectService + .list(new QueryWrapper().lambda() + .ne(ZtProject::getStatus,"closed") + .in(ZtProject::getId,list.stream().map(o -> o.getExecution()).collect(Collectors.toList())) + .orderByDesc(ZtProject::getId) + ); result.put("execution",execList); }else{ result.put("execution",Arrays.asList()); @@ -470,7 +481,12 @@ public class ZtProductServiceImpl extends ServiceImpl ztProjects = this.projectService.listByIds(projectproductlist.stream().map(o -> o.getProject()).collect(Collectors.toList())); result.put("project",ztProjects); List list = this.executionprojectService.list(new QueryWrapper().lambda().in(ZtExecutionproject::getProject, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); - List execList = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + List execList = this.projectService + .list(new QueryWrapper().lambda() + .ne(ZtProject::getStatus,"closed") + .in(ZtProject::getId,list.stream().map(o -> o.getExecution()).collect(Collectors.toList())) + .orderByDesc(ZtProject::getId) + ); result.put("execution",execList); }else{ result.put("project",Arrays.asList()); @@ -532,19 +548,28 @@ public class ZtProductServiceImpl extends ServiceImpl ztProjects = this.projectService.listByIds(projectproductlist.stream().map(o -> o.getProject()).collect(Collectors.toList())); result.put("project",ztProjects); - List list = this.executionprojectService.list(new QueryWrapper().lambda().in(ZtExecutionproject::getProject, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); - List execList = this.projectService.listByIds(list.stream().map(o -> o.getExecution()).collect(Collectors.toList())); + List list = this.executionprojectService.list(new QueryWrapper().lambda() + .in(ZtExecutionproject::getProject, ztProjects.stream().map(o -> o.getId()).collect(Collectors.toList()))); + List execList=new ArrayList<>(); + if(!CollectionUtils.isEmpty(list)){ + execList = this.projectService + .list(new QueryWrapper().lambda() + .ne(ZtProject::getStatus,"closed") + .in(ZtProject::getId,(executionId!=null&&executionId!=0)?Arrays.asList(executionId):list.stream().map(o -> o.getExecution()).collect(Collectors.toList())) + .orderByDesc(ZtProject::getId) + ); + } + result.put("execution",execList); } List list = this.taskService.list(new QueryWrapper().lambda() + .select(SFunctionColums.taskColumes()) .eq(ZtTask::getStory, storyId)); result.put("task",list); } - Integer bugId = dto.getBugId(); - return result; diff --git a/src/main/java/com/sa/zentao/service/impl/ZtProjectServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtProjectServiceImpl.java index bfa9597..923ca70 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtProjectServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtProjectServiceImpl.java @@ -1061,6 +1061,46 @@ public class ZtProjectServiceImpl extends ServiceImpl projectListByProductIds(List pIds) { + if(CollectionUtils.isEmpty(pIds)){ + return new ArrayList<>(); + } + List list = this.projectproductService.list(new QueryWrapper().lambda().in(ZtProjectproduct::getProduct, pIds)); + if(CollectionUtils.isEmpty(list)){ + return new ArrayList<>(); + } + return listByIds(list.stream().map(o->o.getProject()).collect(Collectors.toList())); + } + + @Override + public List getExecutionsListByProjectAndDate(List projects, Date firstDayOfMonth, Date lastDayOfMonth) { + + List list = executionprojectService.list(new QueryWrapper().lambda() + .in(ZtExecutionproject::getProject, projects)); + if (CollectionUtils.isEmpty(list)) { + return new ArrayList<>(); + } + + + List ztProjects = this.list( + new QueryWrapper().lambda().in(ZtProject::getId,list.stream().map(o -> o.getExecution()).collect(Collectors.toList()))); + +// .and(o->o.ge(ZtProject::getBegin,firstDayOfMonth).le(ZtProject::getBegin,lastDayOfMonth)) +// .or(e->e.ge(ZtProject::getEnd,firstDayOfMonth).le(ZtProject::getEnd,lastDayOfMonth))); + + if (CollectionUtils.isEmpty(ztProjects)) { + return new ArrayList<>(); + } + ztProjects = ztProjects.stream().filter(o -> (o.getBegin().getTime() >= firstDayOfMonth.getTime() + && o.getBegin().getTime() <= lastDayOfMonth.getTime()) || ( + o.getEnd().getTime() >= firstDayOfMonth.getTime() + && o.getEnd().getTime() <= lastDayOfMonth.getTime() + )).collect(Collectors.toList()); + + return ztProjects; + } + @Override public void projectTeamUpdate(ZtProjectQo qo) { List teamList = qo.getTeamList(); @@ -1806,24 +1846,12 @@ public class ZtProjectServiceImpl extends ServiceImpl(); } - List execList = this.executionprojectService.list(new QueryWrapper().lambda() - .in(ZtExecutionproject::getProject, projectList.stream().map(o -> o.getProject()).collect(Collectors.toList()))); - if (CollectionUtils.isEmpty(execList)) { - return new PageInfo<>(); - } - List ztProjects = this.listByIds(execList.stream().map(o -> o.getExecution()).collect(Collectors.toList())); - - ztProjects = ztProjects.stream().filter(o -> (o.getBegin().getTime() >= firstDayOfMonth.getTime() - && o.getBegin().getTime() <= lastDayOfMonth.getTime()) || ( - o.getEnd().getTime() >= firstDayOfMonth.getTime() - && o.getEnd().getTime() <= lastDayOfMonth.getTime() - )).collect(Collectors.toList()); + List ztProjects = this.getExecutionsListByProjectAndDate(projectList.stream().map(o -> o.getProject()).collect(Collectors.toList()), firstDayOfMonth, lastDayOfMonth); if (CollectionUtils.isEmpty(ztProjects)) { return new PageInfo<>(); } - List list =this.taskService.taskListByEIdsAndDate(firstDayOfMonth,lastDayOfMonth,execList.stream().map(o -> o.getExecution()) - .collect(Collectors.toList())); + List list =this.taskService.taskListByEIdsAndDate(firstDayOfMonth,lastDayOfMonth,products.stream().map(o->o.getId()).collect(Collectors.toList())); if (CollectionUtils.isEmpty(list)) { return new PageInfo<>(); @@ -1832,13 +1860,10 @@ public class ZtProjectServiceImpl extends ServiceImpl efforts = this.effortService.list(new QueryWrapper().lambda() .eq(ZtEffort::getObjecttype, "task") .in(ZtEffort::getObjectid, list.stream().map(o -> o.getId()).collect(Collectors.toList())) - .gt(ZtEffort::getDate, new Date(firstDayOfMonth.getTime() - 2000)).lt(ZtEffort::getDate, lastDayOfMonth) + .gt(ZtEffort::getDate, new Date(firstDayOfMonth.getTime())).le(ZtEffort::getDate, lastDayOfMonth) ); - if (CollectionUtils.isEmpty(execList)) { - return new PageInfo<>(); - } List teams = this.teamService.list(new QueryWrapper().lambda().eq(ZtTeam::getType, "execution") .in(ZtTeam::getRoot, ztProjects.stream().map(o -> o.getId()) @@ -1856,43 +1881,47 @@ public class ZtProjectServiceImpl extends ServiceImpl closeStatus = Arrays.asList("closed", "cancel"); for (String account :accountIds) { - - List taskList = list.stream().filter(o->account.equals(o.getAssignedTo())).filter(o-> !closeStatus.contains(o.getStatus())).collect(Collectors.toList()); + ZtUser ztUser = uMap.get(account); + List taskList =null; + if(ztUser.getUserType()==UserType.KFZ){ + taskList = this.taskService.getDevelAllocation(list.stream().filter(o->account.equals(o.getAssignedTo())).collect(Collectors.toList())); + }else{ + taskList = this.taskService.getNormalTaskList(list.stream().filter(o->account.equals(o.getAssignedTo())).collect(Collectors.toList())); + } var d=new WorkDetailsDTO(); - ZtUser ztUser = uMap.get(account); + + d.setUserType(ztUser.getUserType()); d.setUserName(ztUser.getNickname()); + d.setAccount(account); //需求总工时 - d.setStoryTotalTime(floatToBigDecimal(floatBatchAdd(taskList.stream().map(o -> o.getEstimate()).collect(Collectors.toList())))); + d.setStoryTotalTime(floatToBigDecimal(floatBatchAdd(taskList.stream().filter(o->o.getStatus().equals("done")).map(o -> o.getEstimate()).collect(Collectors.toList())))); //实际产出工时 d.setWorkTime(floatToBigDecimal(floatBatchAdd(taskList.stream().map(o -> o.getConsumed()).collect(Collectors.toList())))); + + + List approvalList = this.taskService.itApprovalByUserName(ztUser.getNickname(),firstDayOfMonth, lastDayOfMonth); - Integer applyTime=0; - if(!CollectionUtils.isEmpty(approvalList)){ - applyTime=countService.getApprovalTime(approvalList,firstDayOfMonth);; - } - d.setQjTime(BigDecimal.valueOf(applyTime)); + PerformanceDTO dto=new PerformanceDTO(); + dto=countService.setUserWorkTime(dto,date,approvalList,firstDayOfMonth); + + d.setQjTime(dto.getApprovalDays()); //可用工时 - BigDecimal haveTime = BigDecimal.valueOf(DateUtils.getWorkDaysInCurrentMonth(date) * 6).subtract(applyTime < 1 ? BigDecimal.ZERO : d.getQjTime()); - d.setHaveTime(haveTime.intValue()<0?BigDecimal.ZERO:haveTime); + d.setHaveTime(dto.getExamineTime()); //工作饱和度 d.setSaturation(BigDecimalUtils.isZero(d.getHaveTime())?BigDecimal.valueOf(1):d.getWorkTime().compareTo(BigDecimal.ZERO)==0?BigDecimal.ZERO:d.getStoryTotalTime().divide(d.getHaveTime(),2,BigDecimal.ROUND_HALF_UP)); // 任务总量 - d.setTaskCount(BigDecimal.valueOf(taskList.size())); + d.setTaskCount(BigDecimal.valueOf(taskList.stream().filter(o->o.getStatus().equals("done")).collect(Collectors.toList()).size())); - List delayList = taskList.stream().filter(o-> - ((o.getFinishedDate()!=null &&DateUtils.getDayLast(o.getFinishedDate()).getTime()>DateUtils.getDayLast(o.getDeadline()).getTime()) ) //实际完成大于预计完成 延期 - ||o.getFinishedDate()==null &&lastDayOfMonth.getTime()>DateUtils.getDayLast(o.getDeadline()).getTime() - ).collect(Collectors.toList()); + List delayList =this.taskService.getDelayTask(taskList); //任务延期量 d.setTaskDelayCount(BigDecimal.valueOf(delayList.size())); if(ztUser.getUserType()==UserType.CS||ztUser.getUserType()==UserType.KFZ){ - BigDecimal finishAllTime = BigDecimal.valueOf(floatBatchAdd(taskList.stream().map(o->o.getEstimate()).collect(Collectors.toList()))); + BigDecimal finishAllTime = BigDecimal.valueOf(floatBatchAdd(taskList.stream().filter(o->o.getStatus().equals("done")).map(o->o.getEstimate()).collect(Collectors.toList()))); List onTimeTask = taskList.stream().filter(o -> o.getFinishedDate() != null && o.getFinishedDate().getTime() <= DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); BigDecimal onTime=BigDecimal.valueOf(floatBatchAdd(onTimeTask.stream().map(o->o.getEstimate()) @@ -1901,13 +1930,15 @@ public class ZtProjectServiceImpl extends ServiceImpl bugList = this.bugService.list(new QueryWrapper().lambda().in(ZtBug::getProduct, products.stream().map(o -> o.getId()).collect(Collectors.toList())) .eq(ZtBug::getBugType,"prod") - .between(ZtBug::getOpeneddate, firstDayOfMonth, lastDayOfMonth).eq(ZtBug::getResolvedby, account)); + .ge(ZtBug::getOpeneddate, firstDayOfMonth) + .le(ZtBug::getOpeneddate, lastDayOfMonth) + .eq(ZtBug::getAssignedTo, account)); d.setBugCount(BigDecimal.valueOf(bugList.size())); result.add(d); diff --git a/src/main/java/com/sa/zentao/service/impl/ZtReleaseServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtReleaseServiceImpl.java index dd1e181..2f12809 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtReleaseServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtReleaseServiceImpl.java @@ -322,11 +322,16 @@ public class ZtReleaseServiceImpl extends ServiceImpl details = this.releaseDetailsService.list(new QueryWrapper().lambda().eq(ZtReleaseDetails::getReleaseId, ztRelease.getId()) .ne(ZtReleaseDetails::getStatus, "closed")); - List storyList = new ArrayList(); - List bugList = new ArrayList(); - for (ZtReleaseDetails d : details) { - if(d.getObjectType().equals("bug")){ - bugList.add(d.getObjectId()); - }else if(d.getObjectType().equals("story")){ - storyList.add(d.getObjectId()); - } - } - if (CollectionUtils.isEmpty(storyList) &&CollectionUtils.isEmpty(bugList) ) { - throw new BusinessException("当前迭代无需求无法发布"); - } - List ztStories = CollectionUtils.isEmpty(storyList)?new ArrayList<>():storyService.listByIds(storyList); - - List bugs =CollectionUtils.isEmpty(bugList)?new ArrayList<>(): bugService.listByIds(bugList); if (dto.getRevieweResult() == 1) { + List storyList = new ArrayList(); + List bugList = new ArrayList(); + for (ZtReleaseDetails d : details) { + if(d.getObjectType().equals("bug")){ + bugList.add(d.getObjectId()); + }else if(d.getObjectType().equals("story")){ + storyList.add(d.getObjectId()); + } + } + if (CollectionUtils.isEmpty(storyList) &&CollectionUtils.isEmpty(bugList) ) { + throw new BusinessException("当前迭代无需求无法发布"); + } + + List ztStories = CollectionUtils.isEmpty(storyList)?new ArrayList<>():storyService.listByIds(storyList); + + List bugs =CollectionUtils.isEmpty(bugList)?new ArrayList<>(): bugService.listByIds(bugList); long notTested = ztStories.stream().filter(o -> !o.getStage().equals("tested")).count(); if(notTested>0){ throw new BusinessException("当前需求存在未测试完成的请检查"); @@ -381,7 +387,7 @@ public class ZtReleaseServiceImpl extends ServiceImpl ztStories) { + //验收提醒 + private void sendReleaseMail(List ztStories) { Map userMap = this.userService.userMapByIds(null); Set mailTo =new HashSet<>(); StringBuilder b=new StringBuilder(); @@ -433,7 +439,60 @@ public class ZtReleaseServiceImpl extends ServiceImpl ztStories,ZtRelease release) { + Map userMap = this.userService.userMapByIds(null); + Set mailTo =new HashSet<>(); + StringBuilder b=new StringBuilder(); + b.append("
Dear all:
"); + String title="以下需求距离上线时间{day}天,请尽快前往IT服务台进行验收。具体待验收的需求如下:"; + title=title.replace("{day}",DateUtils.daysBetween(release.getRealReleaseDate()==null?release.getReleaseDate():release.getRealReleaseDate(),new Date())+""); + ZtProduct ztProduct = this.productService.getById(ztStories.get(0).getProduct()); + title=title.replace("{productName}",ztProduct==null?"":ztProduct.getName()); + b.append("

"); + + b.append(title); + + b.append("

"); + b.append(""); + b.append("" + + "" +// "" + ); + for (ZtStory s:ztStories) { + ZtUser ztUser = userMap.get(s.getYsUser()); + if(ztUser!=null&&!StringUtils.isEmpty(ztUser.getEmail())){ +// String str= "" + +// ""; + String str=""; + + str=str.replace("{nikename}",ztUser.getNickname()); + str=str.replace("{title}",s.getTitle()); + str=str.replace("{id}",s.getId().toString()); + str=str.replace("{status}","已发布"); + str=str.replace("{releaseDate}",DateUtils.formatDate(release.getRealReleaseDate()==null?release.getReleaseDate():release.getRealReleaseDate(),"yyyy-MM-dd")); + str=str.replace("{endDate}",DateUtils.formatDate(DateUtils.dateAddDay(release.getRealReleaseDate()==null?release.getReleaseDate():release.getRealReleaseDate(),14))); + + + b.append(str); + mailTo.add(ztUser.getEmail()); + } + + } + b.append( ""); + b.append( "
需求编号
研发需求名称
需求状态
上线时间
截止验收时间
验收人
需求编号
研发需求名称
需求状态
上线时间
截止验收时间
验收人
{id}
{title}
{nickName}
{id}
{title}
{status}
{releaseDate}
{endDate}
{nikename}
"); + if(!CollectionUtils.isEmpty(mailTo)){ + SendEmail.sendMessage("需求验收提醒:",mailTo.stream().collect(Collectors.toList()), + null, + b.toString()); + } + for (ZtStory s:ztStories) { + actionService.addAction(ActionType.XQ, ActionStatus.STORYCCYS, release.getId(), s.getProduct() + "", s.getProject(), null, + RiskUserThreadLocal.get().getName(),null, s.getYsUser()); + } + + } @Override public List> execMenu(ZtReleaseQo qo) { @@ -626,6 +685,35 @@ public class ZtReleaseServiceImpl extends ServiceImpl sIds = qo.getStoryList(); + List storyList = null; + if(!CollectionUtils.isEmpty(sIds)){ + storyList=this.storyService.list(new QueryWrapper().lambda() + .in(ZtStory::getId,sIds).eq(ZtStory::getStage,"released")); + }else{ + List details = this.releaseDetailsService.list(new QueryWrapper().lambda() + .eq(ZtReleaseDetails::getReleaseId, qo.getId()).eq(ZtReleaseDetails::getObjectType, "story")); + if(CollectionUtils.isEmpty(details)){ + throw new BusinessException("当前无待验收的需求"); + } + storyList=this.storyService.list(new QueryWrapper().lambda() + .in(ZtStory::getId,details.stream().map(o->o.getObjectId()).collect(Collectors.toList())).eq(ZtStory::getStage,"released")); + } + if(CollectionUtils.isEmpty(storyList)){ + throw new BusinessException("当前无待验收的需求"); + } + urgeYsMail(storyList,release); + } + @Override public PageInfo projectStoryPageList(ZtReleaseQo qo) { ZtRelease ztRelease = this.baseMapper.selectById(qo.getId()); diff --git a/src/main/java/com/sa/zentao/service/impl/ZtStoryFeedbackServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtStoryFeedbackServiceImpl.java index 2c23d24..11bf8c0 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtStoryFeedbackServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtStoryFeedbackServiceImpl.java @@ -4,6 +4,8 @@ import ch.qos.logback.core.util.StringUtil; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -152,6 +154,9 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl myFeedbackPageList(ZtProjectQo qo) { - List authList = this.projectService.authList(); - if (RiskUserThreadLocal.get().getUserType()==UserType.GSGC) { - authList = this.projectService.allAuthList(); - } - if (CollectionUtils.isEmpty(authList)) { + List pids = this.projectService.authProductList(); + if (CollectionUtils.isEmpty(pids)) { return new PageInfo(); } - List list = productService.list(new QueryWrapper().lambda().in(ZtProduct::getProgram, authList)); - if (CollectionUtils.isEmpty(list)) { - return new PageInfo(); + if(qo.getProductId()!=null&&qo.getProductId()!=0){ + qo.setProductIds(Arrays.asList(qo.getProductId())); + }else{ + qo.setProductIds(pids); } - Page page = PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize()); - List listFeedback = this.myPageList(qo,list); + List listFeedback = this.myPageList(qo); long total = page.getTotal(); @@ -357,13 +359,32 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl myPageList(ZtProjectQo qo,List list) { + private List myPageList(ZtProjectQo qo) { LambdaQueryWrapper query = new QueryWrapper().lambda(); -// .and(w->{ -// w.eq(ZtStoryFeedback::getAssignedTo, RiskUserThreadLocal.get().getName()) -// .or() -// .eq(ZtStoryFeedback::getOpenedBy, RiskUserThreadLocal.get().getName()) ;}) ; - + query.select(ZtStoryFeedback::getId, + ZtStoryFeedback::getName, + ZtStoryFeedback::getOpenedBy, + ZtStoryFeedback::getFiles, + ZtStoryFeedback::getOpenedDate, + ZtStoryFeedback::getSource, + ZtStoryFeedback::getStatus, + ZtStoryFeedback::getOpenSource, + ZtStoryFeedback::getPlanEndDate, + ZtStoryFeedback::getAssignedTo, + ZtStoryFeedback::getSpec, + ZtStoryFeedback::getFinishDate, + ZtStoryFeedback::getType, + ZtStoryFeedback::getCloseRemark, + ZtStoryFeedback::getProduct, + ZtStoryFeedback::getPlanFinishDate, + ZtStoryFeedback::getHandDate, + ZtStoryFeedback::getCloseDate, + ZtStoryFeedback::getClosedBy, + ZtStoryFeedback::getApprovalRemark, + ZtStoryFeedback::getYsFlag, + ZtStoryFeedback::getDontHandSelect, + ZtStoryFeedback::getDontHandRemark + ); if (!org.apache.commons.lang3.StringUtils.isEmpty(qo.getSearchVal())) { if ("ALL".equals(qo.getSearchVal())) { } @@ -387,10 +408,9 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl o.getId()).collect(Collectors.toList())); } @@ -498,6 +518,7 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper().lambda() + .set(ZtStoryFeedback::getDontHandRemark, dto.getDontHandRemark()) + .set(ZtStoryFeedback::getStatus, "submitVerified") + .set(ZtStoryFeedback::getDontHandSelect, dto.getDontHandSelect()) + .set(ZtStoryFeedback::getYsFlag, 0); + if(ztStoryFeedback.getFinishDate()==null){ + updateWrapper.set(ZtStoryFeedback::getFinishDate,new Date()); + } + updateWrapper.eq(ZtStoryFeedback::getId,ztStoryFeedback.getId()); + this.baseMapper.update(updateWrapper); if (!org.apache.commons.lang3.StringUtils.isEmpty(ztStoryFeedback.getOpenSource()) && ztStoryFeedback.getOpenSource().equals("weixin")) { StringBuilder b = new StringBuilder(); @@ -617,6 +647,7 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper().lambda(); + + if(revieweResult==1){ ztStory.setStatus("verified"); ztStory.setYsFlag(1); + updateWrapper.set(ZtStoryFeedback::getDontHandRemark, ""); + updateWrapper.set(ZtStoryFeedback::getDontHandSelect, ""); + updateWrapper.set(ZtStoryFeedback::getApprovalRemark, ""); + updateWrapper.set(ZtStoryFeedback::getYsDate,new Date()); }else{ + updateWrapper.set(ZtStoryFeedback::getApprovalRemark, dto.getApprovalRemark()); ztStory.setApprovalRemark(dto.getApprovalRemark()); + updateWrapper.set(ZtStoryFeedback::getFinishDate,null); ztStory.setStatus("wait"); ztStory.setYsFlag(2); } - this.baseMapper.updateById(ztStory); + updateWrapper.set(ZtStoryFeedback::getStatus, ztStory.getStatus()); + updateWrapper.set(ZtStoryFeedback::getYsFlag, ztStory.getYsFlag()); + updateWrapper.eq(ZtStoryFeedback::getId,ztStory.getId()); + + this.baseMapper.update(updateWrapper); //添加action @@ -667,6 +711,7 @@ public class ZtStoryFeedbackServiceImpl extends ServiceImpl impl Map> rMap = getReviewMap(list); Map> executionMapByStory = getExecutionMapByStory(list); + Map pMap = this.productService.selectMapProduct(); for (ZtStoryDTO d : list) { d.setRevieweUser(d.getReviewedby().replaceAll(",", "")); @@ -126,7 +127,11 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if (ztUser != null) { d.setAssignedToName(ztUser.getNickname()); } + ZtProduct ztProduct = pMap.get(d.getProduct()); + if(ztProduct!=null){ + d.setProductName(ztProduct.getName()); + } ztUser = userMap.get(d.getOpenedby()); if (ztUser != null) { d.setOpenedbyName(ztUser.getNickname()); @@ -282,9 +287,12 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if(ztStoryUser==null){ throw new BusinessException("未查询到用户需求"); } - if(!Arrays.asList(UserStoryEnums.CFM.getCode(),UserStoryEnums.KFZ.getCode()).contains(ztStoryUser.getStatus())){ + if(!Arrays.asList(UserStoryEnums.CFM.getCode(),UserStoryEnums.KFZ.getCode(),UserStoryEnums.JH.getCode()).contains(ztStoryUser.getStatus())){ throw new BusinessException("用户需求无法关联请检查"); } + if(UserStoryEnums.JH.getCode().equals(ztStoryUser.getStatus())){ + this.storyUserService.changeStatus(ztStoryUser.getId(),UserStoryEnums.CFM); + } } ZtStory s = new ZtStory(); BeanUtils.copyProperties(dto, s); @@ -425,6 +433,21 @@ public class ZtStoryServiceImpl extends ServiceImpl impl return new ArrayList<>(); } + @Override + public List getNormalStory(List sList) { + List result=new ArrayList(); + for (ZtStory st:sList) { + if(!st.getStatus().equals("closed")){ + result.add(st); + } + if(st.getStatus().equals("closed")&&st.getYsFlag()!=null&&st.getYsFlag()!=0){ + result.add(st); + } + + } + return result; + } + @Override @Transactional @@ -623,83 +646,9 @@ public class ZtStoryServiceImpl extends ServiceImpl impl } private void executionUnBindStory(Integer storyId, List execList) { -// if(CollectionUtils.isEmpty(execList)){ -// return; -// }else{ -// List list = this.taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, storyId) -// .in(ZtTask::getExecution, execList) -// ); -// -// if(!CollectionUtils.isEmpty(list)){ -// throw new BusinessException("当前迭代已开始任务,无法取消关联 迭代Id:"+list.get(0).getId()); -// } -// } projectService.removeExecutionStory(storyId, execList); -// if(dto.getExecution()!=null&&dto.getExecution()!=0){ -// //1.没有绑定 解绑 -// ZtProjectstory execStory = this.projectstoryService.getOne(new QueryWrapper().lambda().eq(ZtProjectstory::getStory, ztStory.getId()) -// .ne(ZtProjectstory::getExecution, 0)); -// //如果没有关联过迭代 去关联 第一次 -// if(execStory==null){ -// //如果是产品型需求 加项目 加迭代 如果是项目型产品 加迭代 -// -// if (ztStory.getProduct() != null&&ztStory.getProduct()!=0) { -// List execlist = this.executionprojectService.list(new QueryWrapper().lambda() -// .eq(ZtExecutionproject::getExecution, dto.getExecution())); -// if(CollectionUtils.isEmpty(execlist)){ -// List list = this.projectproductService.list(new QueryWrapper() -// .lambda().eq(ZtProjectproduct::getProduct, ztStory.getProduct())); -// ZtProjectproduct ztProjectproduct = list.get(0); -// -// -// ZtProjectstory ztProjectstory = new ZtProjectstory(); -// ztProjectstory.setOrder(1); -// ztProjectstory.setStory(ztStory.getId()); -// ztProjectstory.setProject(ztProjectproduct.getProject()); -// this.projectstoryService.save(ztProjectstory); -// //添加执行 -// }else{ -// -// ZtProjectstory ztProjectstory = new ZtProjectstory(); -// ztProjectstory.setOrder(1); -// ztProjectstory.setStory(ztStory.getId()); -// ztProjectstory.setProject(execlist.get(0).getProject()); -// this.projectstoryService.save(ztProjectstory); -// } -// } -// ZtProjectDTO d=new ZtProjectDTO(); -// d.setExcludeId(dto.getExecution()); -// d.setStoryIds(new ArrayList<>(){{add(ztStory.getId());}}); -// projectService.executionSyncStory(d); -// } -// else if(dto.getExecution().intValue()==pList.get(0).getExecution().intValue()){ -// //编辑没动 不用管 -// }else{ -// -// -// -// //2.绑定了 切换 -// //1. 删除projectStory 迭代的 删除看板 -// projectService.removeExecutionStory(ztStory.getId(),dto.getExecution()); -// //2. 新增 -// ZtProjectDTO d=new ZtProjectDTO(); -// d.setExcludeId(dto.getExecution()); -// d.setStoryIds(new ArrayList<>(){{add(ztStory.getId());}}); -// projectService.executionSyncStory(d); -// } -// -// } -// else{ -// List list = this.taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, ztStory.getId())); -// if(!CollectionUtils.isEmpty(list)){ -// throw new BusinessException("当前任务已开始无法更换迭代"); -// } -// //3可能解绑 查询是否以前关联过 -// projectService.removeExecutionStory(ztStory.getId()); -// } -// } @@ -739,7 +688,7 @@ public class ZtStoryServiceImpl extends ServiceImpl impl .in(ZtStory::getProduct,pAuth) .and(o-> o.eq(ZtStory::getAssignedTo, RiskUserThreadLocal.get().getName()) .or().eq(ZtStory::getOpenedby, RiskUserThreadLocal.get().getName())) - + .orderByDesc(ZtStory::getId) ); List storyDTOList = BeanCopyUtil.copyListProperties(sList, ZtStoryDTO::new,new BeanCopyUtilCallBack() { @Override @@ -762,7 +711,7 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if (userType == UserType.CP) { List uStory = this.storyUserService.list(new QueryWrapper().lambda().ne(ZtStoryUser::getStatus, "closed") .in(ZtStoryUser::getProduct,pAuth) - .eq(ZtStoryUser::getOpenedby, RiskUserThreadLocal.get().getName()) + .eq(ZtStoryUser::getOpenedby, RiskUserThreadLocal.get().getName()).orderByDesc(ZtStoryUser::getId) ); if (!CollectionUtils.isEmpty(uStory)) { List storyDTOList1 = BeanCopyUtil.copyListProperties(uStory, ZtStoryDTO::new); @@ -973,9 +922,6 @@ public class ZtStoryServiceImpl extends ServiceImpl impl kanbanlaneService.changeStatus(execution, id, "story", "ready"); } -// -// actionService.addAction(ActionType.XQ, ActionStatus.KS, ztStory.getId(), ztStory.getProduct() + "", ztStory.getProject(), null, -// RiskUserThreadLocal.get().getName(), null, ""); } @Override @@ -992,15 +938,6 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if("developing".equals(ztStory.getStage())){ return; } -// List stateList = Arrays.asList("wait", "projected"); -// -// -// if ("active".equalsIgnoreCase(ztStory.getStatus())) { -// if (!stateList.contains(ztStory.getStage())) { -// //已经开始 -// return; -// } -// } ztStory.setStage("developing"); ztStory.setStartDate(new Date()); @@ -1034,50 +971,7 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if (ztStory.getFeedback() != null && ztStory.getFeedback() != 0) { this.storyFeedbackService.feedbackStart(ztStory.getFeedback()); } - - -// List taskList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, id) -// .in(ZtTask::getStatus, Arrays.asList("reviewing", "wait", "doing", "pause")) -// .eq(ZtTask::getType, "devel") -// ); -// //任务没有做完 如果任务还没开始 -// if (!CollectionUtils.isEmpty(taskList)) { -// if (Arrays.asList("wait", "projected").contains(ztStory.getStage())) { -// -// this.taskFinishChangeStatus(id,null); -// } -// return; -// } -// //developed 研发完毕 testing 测试中 tested测试完毕 released已发布 verified已验收 closed -// if (Arrays.asList("developed", "tested", "released", "verified", "closed").contains(ztStory.getStage())) { -// return; -// } -// if ("testing".equals(ztStory.getStage())) { -// List list = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, id) -// .in(ZtTask::getStatus, Arrays.asList("wait", "doing", "pause")) -// .in(ZtTask::getType, "devel", "test") -// ); -// if (!CollectionUtils.isEmpty(list)) { -// return; -// } else { -// ztStory.setStage("tested"); -// this.baseMapper.updateById(ztStory); -// List executionId = this.getExecutionId(ztStory); -// for (Integer execution : executionId) { -// kanbanlaneService.changeStatus(execution, id, "story", "tested"); -// } -// -// actionService.addAction(ActionType.XQ, ActionStatus.CSWC, ztStory.getId(), ztStory.getProduct() + "", ztStory.getProject(), null, -// RiskUserThreadLocal.get().getName(), null, ""); -// } -// return; -// } -// -// if (Arrays.asList("wait").contains(ztStory.getStage()) && !CollectionUtils.isEmpty(taskList)) { -// this.taskFinishChangeStatus(id,null); -// return; -// } - + ztStory.setDevelopedDate(new Date()); ztStory.setStage("developed"); if (ztStory.getStartDate() == null) { ztStory.setStartDate(new Date()); @@ -1146,6 +1040,9 @@ public class ZtStoryServiceImpl extends ServiceImpl impl if (ztStory.getStartDate() == null) { ztStory.setStartDate(new Date()); } + if (ztStory.getDevelopedDate() == null) { + ztStory.setDevelopedDate(new Date()); + } ztStory.setEndDate(new Date()); this.baseMapper.updateById(ztStory); @@ -1335,32 +1232,6 @@ public class ZtStoryServiceImpl extends ServiceImpl impl return; } -// if(cancelFlag&&type==TaskType.test){ -// List develList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "wait", "doing", "pause")) -// .eq(ZtTask::getType, type.getCode())); -// if(!CollectionUtils.isEmpty(develList)){ -// this.startStory(story); -// }else{ -// List testList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "wait", "doing", "pause")) -// .eq(ZtTask::getType, TaskType.test.getCode())); -// if(!CollectionUtils.isEmpty(testList)){ -// testingStory(story); -// }else{ -// List testedList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "done")) -// .eq(ZtTask::getType, TaskType.test.getCode())); -// if(!CollectionUtils.isEmpty(testedList)){ -// testedStory(story,finishBy); -// }else{ -// this.finishStory(story,finishBy); -// } -// } -// -// } -// return; -// } if(type==TaskType.test){ // 测试 @@ -1410,52 +1281,6 @@ public class ZtStoryServiceImpl extends ServiceImpl impl } } } -// @Override -// public void taskFinishChangeStatus(Integer story, String finishBy,TaskType type) { -// if(story==null||story==0){ -// return; -// } -// ZtStory ztStory = this.baseMapper.selectById(story); -// -// List taskList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "wait", "doing", "pause")) -// .eq(ZtTask::getType, "devel")); -// //如果开发有任务 并且状态需要变为开发中 -// if(!CollectionUtils.isEmpty(taskList)&&Arrays.asList( "wait", "projected", "developing").contains(ztStory.getStage())){ -// //如果测试已经开始 那么测试进行中 -// List testList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "doing", "done")) -// .eq(ZtTask::getType, "test")); -// if(!CollectionUtils.isEmpty(testList)){ -// //测试任务已经开始 -// this.testingStory(story); -// }else{ -// this.startStory(story); -// } -// } -// -// //如果开发中任务没有了 -// if(CollectionUtils.isEmpty(taskList)){ -// -// List testList = taskService.list(new QueryWrapper().lambda().eq(ZtTask::getStory, story) -// .in(ZtTask::getStatus, Arrays.asList( "wait", "doing", "pause","done")) -// .eq(ZtTask::getType, "test")); -// //如果测试中有任务 -// Long waitCount = testList.stream().filter(o -> Arrays.asList("wait").contains(o.getStatus())).count(); -// -// if(!CollectionUtils.isEmpty(testList)&&waitCount.intValue()!=testList.size()){ -// Long doneCount = testList.stream().filter(o -> Arrays.asList("done").contains(o.getStatus())).count(); -// if(doneCount.intValue()==testList.size()){ -// testedStory(story,finishBy); -// }else{ -// this.testingStory(story); -// } -// }else{ -// //如果开发任务没有了 并且测试还没开始 -// this.finishStory(story,finishBy); -// } -// } -// } @Override @@ -1719,14 +1544,17 @@ public class ZtStoryServiceImpl extends ServiceImpl impl List ids = new ArrayList<>(Arrays.asList(split)); qo.setObjIds(ids); // list=this.baseMapper.storyPageListByIds(ids); + } + if(productId!=null&&productId!=0){ + qo.setProductIds(Arrays.asList(productId)); }else{ - //自己有权限的 产品集 - List integers = this.projectService.authProductList(); + List pids = this.projectService.authProductList(); - if (!CollectionUtils.isEmpty(integers)) { - qo.setProductIds(integers); + if (!CollectionUtils.isEmpty(pids)) { + qo.setProductIds(pids); } } + // else{ if (UserType.KFZ == loginRiskUser.getUserType() || UserType.CS == loginRiskUser.getUserType()) { @@ -1959,19 +1787,6 @@ public class ZtStoryServiceImpl extends ServiceImpl impl ActionStatus status; if (revieweResult == 1) { status = ActionStatus.YSTG; - //如果研发需求验收完毕 那么用户需求也需要变更 -// if (ztStory.getUserStory() != null && ztStory.getUserStory() != 0) { -// List storyList = this.baseMapper.selectList(new QueryWrapper().lambda() -// .ne(ZtStory::getId, ztStory.getId()) -// .in(ZtStory::getStage, "wait", "projected", "developing", "developed", "testing", "tested", "released") -// .eq(ZtStory::getUserStory, ztStory.getUserStory())); -// if (CollectionUtils.isEmpty(storyList)) { -// ZtStoryUser ztStoryUser = this.storyUserService.getById(ztStory.getUserStory()); -// -// ztStoryUser.setStatus(UserStoryEnums.YWC.getCode()); -// this.storyUserService.updateById(ztStoryUser); -// } -// } ztStory.setStatus("finished"); } else { status = ActionStatus.YSBTG; @@ -2028,7 +1843,13 @@ public class ZtStoryServiceImpl extends ServiceImpl impl d.setImplementName(ztProject.getName()); } } - + Integer feedback = ztStory.getFeedback(); + if(feedback!=null&&feedback!=0){ + ZtStoryFeedback ztStoryFeedback = this.storyFeedbackService.getById(feedback); + if(ztStoryFeedback!=null){ + d.setFeedbackSpec(ztStoryFeedback.getSpec()); + } + } Map userMap = this.userService.userMapByIds(null); diff --git a/src/main/java/com/sa/zentao/service/impl/ZtStoryUserServiceImpl.java b/src/main/java/com/sa/zentao/service/impl/ZtStoryUserServiceImpl.java index 4ebb548..2a2f3ca 100644 --- a/src/main/java/com/sa/zentao/service/impl/ZtStoryUserServiceImpl.java +++ b/src/main/java/com/sa/zentao/service/impl/ZtStoryUserServiceImpl.java @@ -257,8 +257,12 @@ public class ZtStoryUserServiceImpl extends ServiceImpl(); } + if(qo.getProductId()!=null&&qo.getProductId()!=0){ + qo.setProductIds(Arrays.asList(qo.getProductId())); + }else{ + qo.setProductIds(pIds); + } - qo.setProductIds(pIds); l = System.currentTimeMillis(); Page page = PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize()); List list = this.baseMapper.pageList(qo); @@ -348,7 +352,9 @@ public class ZtStoryUserServiceImpl extends ServiceImpl ztStories = this.baseMapper.selectList(eq); if (CollectionUtils.isEmpty(ztStories)) { return new ArrayList<>(); @@ -387,18 +393,6 @@ public class ZtStoryUserServiceImpl extends ServiceImpl需求编号: {id}  需求名称 : {name}      验收人 : {userName}

"; -// str=str.replace("{id}",s.getId().toString()); -// str= str.replace("{name}",s.getTitle()); -// str= str.replace("{userName}",ztUser.getNickname()); -// mailTo.add(ztUser.getEmail()); -// content.append(str); -// } -// -// } if (dto.getRevieweResult() != 1){ ZtUser u = this.userService.getByAccount(ztStory.getOpenedby()); if (u != null && !StringUtils.isEmpty(u.getEmail())) { @@ -411,16 +405,6 @@ public class ZtStoryUserServiceImpl extends ServiceImpl    需求编号: {storyId}

"); b.append("

    需求名称: {storyName}

"); -// b.append("

你好: {userName}

"); -// b.append("

您的需求评审没有通过,请及时处理:

"); -// b.append("

需求编号: {storyId}

"); -// b.append("

需求名称: {storyName}

"); -// b.append("

 

"); -// b.append("

 

"); -// b.append("

 

"); -// b.append("

 

"); -// b.append("

 

"); -// b.append("

谢谢。

"); String str = b.toString(); @@ -467,7 +451,8 @@ public class ZtStoryUserServiceImpl extends ServiceImpl impleme @Autowired private IZtBugService bugService; + @Autowired + private IZtTeamService teamService; + @Override public PageInfo taskPageList(ZtProjectQo qo) { @@ -162,7 +166,8 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme } - List closed = this.baseMapper.selectList(new QueryWrapper().lambda() + List taskList = this.baseMapper.selectList(new QueryWrapper().lambda() + .select(SFunctionColums.taskColumes()) .in(ZtTask::getProduct, pList) .notIn(ZtTask::getStatus, Arrays.asList("closed","cancel","done") ) .and(o->o.eq(ZtTask::getOpenedby, RiskUserThreadLocal.get().getName()) @@ -171,11 +176,11 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme .orderByDesc(ZtTask::getDeadline) .orderByDesc(ZtTask::getId) ); - if (CollectionUtils.isEmpty(closed)) { + if (CollectionUtils.isEmpty(taskList)) { return new ArrayList<>(); } - return BeanCopyUtil.copyListProperties(closed, ZtTaskDTO::new); + return BeanCopyUtil.copyListProperties(taskList, ZtTaskDTO::new); } @@ -246,7 +251,13 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme if (ztUser != null) { dto.setClosedbyName(ztUser.getNickname()); } - + Integer feedback = ztTask.getFeedback(); + if(feedback!=null&&feedback!=0){ + ZtStoryFeedback ztStoryFeedback = this.storyFeedbackService.getById(feedback); + if(ztStoryFeedback!=null){ + dto.setFeedbackSpec(ztStoryFeedback.getSpec()); + } + } ztUser = userMap.get(ztTask.getCanceledby()); if (ztUser != null) { dto.setCanceledbyName(ztUser.getNickname()); @@ -312,22 +323,124 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme } @Override - public List taskListByEIdsAndDate(Date firstDayOfMonth, Date lastDayOfMonth, List eIds) { - if(CollectionUtils.isEmpty(eIds)){ + public List taskListByEIdsAndDate(Date firstDayOfMonth, Date lastDayOfMonth, List pids) { + if(CollectionUtils.isEmpty(pids)){ return new ArrayList<>(); } if(firstDayOfMonth==null||lastDayOfMonth==null){ return new ArrayList<>(); } List taskList = this.list(new QueryWrapper().lambda() - .and(o->o.between(ZtTask::getDeadline, firstDayOfMonth,lastDayOfMonth) - .or() - .between(ZtTask::getFinishedDate, firstDayOfMonth,lastDayOfMonth) - ) - .in(ZtTask::getExecution, eIds)); + .select(SFunctionColums.taskColumes()) + .in(ZtTask::getProduct, pids).and(f->f + .and(o->o.ge(ZtTask::getDeadline,firstDayOfMonth).le(ZtTask::getDeadline,lastDayOfMonth)) + .or(e->e.ge(ZtTask::getFinishedDate,firstDayOfMonth).le(ZtTask::getFinishedDate,lastDayOfMonth)))); + +// return this.baseMapper.taskListByPIdsAndDate(pids,firstDayOfMonth,lastDayOfMonth); return taskList; } + @Override + public List getDelayTask(List t) { + if(CollectionUtils.isEmpty(t)){ + return new ArrayList<>(); + } + List delayList =new ArrayList(); + for (ZtTask task:t) { + //完成延期 + if(task.getFinishedDate()!=null&&task.getFinishedDate().getTime()> DateUtils.getDayLast(task.getDeadline()).getTime()){ + delayList.add(task); + }else{ + if(task.getFinishedDate()==null){ + //直接完成任务等待审核不需要管 + if(task.getFinishedFlag()==1){ + //直接完成任务的不管 + }else{ + //当前时间大于预计完成时间 + if ( new Date().getTime()>DateUtils.getDayLast(task.getDeadline()).getTime()){ + delayList.add(task); + } + } + } + } + + } + return delayList; + } + + @Override + public List getOnTimeTask(List t) { + if(CollectionUtils.isEmpty(t)){ + return new ArrayList<>(); + } + return t.stream().filter(o -> o.getFinishedDate() != null + && o.getFinishedDate().getTime() <= DateUtils.getDayLast(o.getDeadline()).getTime()).collect(Collectors.toList()); + } + + @Override + public List taskListByIds(List ids) { + return this.baseMapper.taskListByIds(ids); + } + + @Override + public List taskListByStoryIds(List sIds) { + if(CollectionUtils.isEmpty(sIds)){ + return new ArrayList<>(); + } + return this.baseMapper.taskListByStoryIds(sIds); + } + + @Override + public List getNormalTaskList(List tList) { + List result=new ArrayList(); + + for (ZtTask t:tList) { + if(!"closed".equals(t.getStatus())&&!"cancel".equals(t.getStatus())){ + result.add(t); + } + } + + return result; + } + + @Override + public List getDevelAllocation(List tList) { + return getNormalTaskList(tList); + } + + @Override + public List develTaskListByExecutions(Date firstDayOfMonth, Date lastDayOfMonth, List eIds) { + if(CollectionUtils.isEmpty(eIds)){ + return new ArrayList<>(); + } + List teamList = this.teamService.list(new QueryWrapper().lambda().in(ZtTeam::getRoot, eIds).eq(ZtTeam::getType, "execution")); + if(CollectionUtils.isEmpty(teamList)){ + return new ArrayList<>(); + } + + Map userMap = this.userService.userMapByIds(teamList.stream().map(o -> o.getAccount()).collect(Collectors.toList())); + List kfzList=new ArrayList<>(); + for (ZtTeam t:teamList) { + ZtUser ztUser = userMap.get(t.getAccount()); + if(ztUser!=null&&ztUser.getUserType()==UserType.KFZ){ + kfzList.add(ztUser.getAccount()); + } + } + if(CollectionUtils.isEmpty(kfzList)){ + return new ArrayList<>(); + } + List taskList = this.list(new QueryWrapper().lambda() + .in(ZtTask::getExecution, eIds) + .in(ZtTask::getAssignedTo,kfzList) + ); + return taskList; + } + + @Override + public List multipleDepartProjectTeam(Date firstDayOfMonth, Date lastDayOfMonth) { + return this.baseMapper.multipleDepartProjectTeam(firstDayOfMonth,lastDayOfMonth); + } + @Override public PageInfo myTaskPageList(ZtProjectQo qo) { @@ -339,45 +452,43 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme //自己有权限的 产品集 - List authList = this.ztProjectService.authList(); + List pids = this.ztProjectService.authProductList(); - if (!CollectionUtils.isEmpty(authList)) { - List pList = this.productService.list(new QueryWrapper().lambda().in(ZtProduct::getProgram, authList)); - //所有的产品 - if (!CollectionUtils.isEmpty(pList)) { - List list = this.projectproductService.list(new QueryWrapper().lambda().in(ZtProjectproduct::getProduct, pList.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if (!CollectionUtils.isEmpty(list)) { - List projectList = executionprojectService.list(new QueryWrapper().lambda().in(ZtExecutionproject::getProject, list.stream().map(o -> o.getProject()).collect(Collectors.toList()))); - projectAuthList = projectList.stream().map(o -> o.getExecution()).collect(Collectors.toList()); - - } - } - } - - if (CollectionUtils.isEmpty(projectAuthList)) { + if (CollectionUtils.isEmpty(pids)) { return new PageInfo(); } Page page = PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize()); +// if (!StringUtils.isEmpty(qo.getIds())) { +// String[] split = qo.getIds().split(","); +// qo.setObjIds(new ArrayList<>(Arrays.asList(split))); +// }else{ +// qo.setProjectIds(projectAuthList); +// } +// if (!StringUtils.isEmpty(qo.getProductName())) { +// List pList = this.productService.selectProductByName(qo.getProductName()); +// if (!CollectionUtils.isEmpty(pList)) { +// List list = this.projectproductService.list(new QueryWrapper() +// .lambda().in(ZtProjectproduct::getProduct, pList.stream().map(o -> o.getId()).collect(Collectors.toList()))); +// if (CollectionUtils.isEmpty(list)) { +// return new PageInfo<>(); +// } else { +// qo.setProjectList(list.stream().map(o -> o.getProject()).collect(Collectors.toList())); +// } +// } +// } + if (!StringUtils.isEmpty(qo.getIds())) { String[] split = qo.getIds().split(","); qo.setObjIds(new ArrayList<>(Arrays.asList(split))); - }else{ - qo.setProjectIds(projectAuthList); } - if (!StringUtils.isEmpty(qo.getProductName())) { - List pList = this.productService.selectProductByName(qo.getProductName()); - if (!CollectionUtils.isEmpty(pList)) { - List list = this.projectproductService.list(new QueryWrapper() - .lambda().in(ZtProjectproduct::getProduct, pList.stream().map(o -> o.getId()).collect(Collectors.toList()))); - if (CollectionUtils.isEmpty(list)) { - return new PageInfo<>(); - } else { - qo.setProjectList(list.stream().map(o -> o.getProject()).collect(Collectors.toList())); - } - } + if(qo.getProductId()!=null&&qo.getProductId()!=0){ + qo.setProductIds(Arrays.asList(qo.getProductId())); + }else{ + + qo.setProductIds(pids); } @@ -427,6 +538,10 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme Integer story = ztTask.getStory(); if (story != null && story != 0) { ZtStory ztStory = this.storyService.getById(story); +// wait 初始化 projected 已立项 developing 研发中 developed 研发完毕 testing 测试中 tested + if(!Arrays.asList("wait","projected","developing","developed","testing","tested").contains(ztStory.getStage())){ + throw new BusinessException("当前状态无法添加任务"); + } if(ztStory.getStatus().equals("closed")){ throw new BusinessException("已关闭的需求无法拆分任务"); } @@ -481,6 +596,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme } if(dto.getFinishedFlag()==null||dto.getFinishedFlag()==0){ //不完成任务 + dto.setApplyDate(null); }else{ //完成修补数据 ztTask.setRealstarted(new Date(ztTask.getApplyDate().getTime()-ztTask.getUseTime() @@ -515,6 +631,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme dto.setId(ztTask.getId()); dto.setConsumed(ztTask.getUseTime().floatValue()); dto.setLeft(ztTask.getUseTime().floatValue()); + dto.setFinishedDate(dto.getApplyDate()); this.startTask(dto); } } @@ -650,9 +767,14 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme if (dto.getFinishedFlag() == 0) { ztTask.setStatus("doing"); } else { + if(ztTask.getFinishedFlag()!=null&&ztTask.getFinishedFlag()==1){ + ztTask.setFinishedDate(ztTask.getApplyDate()); + }else{ + ztTask.setFinishedDate(new Date()); + } ztTask.setStatus("done"); ztTask.setFinishedby(RiskUserThreadLocal.get().getName()); - ztTask.setFinishedDate(new Date()); + } ztTask.setLasteditedby(RiskUserThreadLocal.get().getName()); @@ -770,12 +892,14 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme ztTask.setLeft(0f); ztTask.setStatus("done"); if(ztTask.getFinishedFlag()!=null&&ztTask.getFinishedFlag()==1){ + ztTask.setFinishedDate(ztTask.getApplyDate()); ztTask.setFinishedby(ztTask.getAssignedTo()); }else{ ztTask.setFinishedby(RiskUserThreadLocal.get().getName()); + ztTask.setFinishedDate(new Date()); } - ztTask.setFinishedDate(new Date()); + ztTask.setLasteditedby(RiskUserThreadLocal.get().getName()); ztTask.setLastediteddate(new Date()); this.baseMapper.updateById(ztTask); @@ -1068,7 +1192,7 @@ public class ZtTaskServiceImpl extends ServiceImpl impleme if(t.getFinishedFlag()!=null&&t.getFinishedFlag()==1){ dto.setConsumed(t.getEstimate()); dto.setRealstarted(t.getRealstarted()); - dto.setFinishedDate(t.getFinishedDate()); + dto.setFinishedDate(t.getApplyDate()); this.finishTask(dto,t.getAssignedTo()); } } diff --git a/src/main/java/com/sa/zentao/utils/DateUtils.java b/src/main/java/com/sa/zentao/utils/DateUtils.java index 237d563..f2dfd03 100644 --- a/src/main/java/com/sa/zentao/utils/DateUtils.java +++ b/src/main/java/com/sa/zentao/utils/DateUtils.java @@ -178,16 +178,20 @@ public class DateUtils { } public static Date getFirstDayOfMonth(Date d) { - if(d==null){ - return null; + synchronized (Object.class){ + if(d==null){ + return null; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(d); + calendar.set(5, calendar.getActualMinimum(5)); + calendar.set(11, 0); + calendar.set(12, 0); + calendar.set(13, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND,0); + return calendar.getTime() ; } - Calendar calendar = Calendar.getInstance(); - calendar.setTime(d); - calendar.set(5, calendar.getActualMinimum(5)); - calendar.set(11, 0); - calendar.set(12, 0); - calendar.set(13, 0); - return calendar.getTime(); } @@ -218,7 +222,7 @@ public class DateUtils { calendar2.set(12, 59); calendar2.set(13, 59); calendar2.set(14, 999); - return calendar2.getTime(); + return getDayLast(calendar2.getTime()); } public static Date getYearStartDate(Date date) { diff --git a/src/main/java/com/sa/zentao/utils/SFunctionColums.java b/src/main/java/com/sa/zentao/utils/SFunctionColums.java new file mode 100644 index 0000000..76d8b69 --- /dev/null +++ b/src/main/java/com/sa/zentao/utils/SFunctionColums.java @@ -0,0 +1,47 @@ +package com.sa.zentao.utils; + +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.sa.zentao.entity.ZtStoryFeedback; +import com.sa.zentao.entity.ZtTask; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class SFunctionColums { + + public static List> taskColumes(){ + List> result=new ArrayList<>(); + result.add(ZtTask::getId); + result.add(ZtTask::getAssignedTo); + result.add(ZtTask::getProduct); + result.add(ZtTask::getName); + result.add(ZtTask::getStatus); + result.add(ZtTask::getOpenedby); + result.add(ZtTask::getOpeneddate); + result.add(ZtTask::getFinishedFlag); + result.add(ZtTask::getFinishedDate); + result.add(ZtTask::getFinishedby); + result.add(ZtTask::getApplyDate); + result.add(ZtTask::getLeft); + result.add(ZtTask::getConsumed); + result.add(ZtTask::getEstimate); + result.add(ZtTask::getDeadline); + result.add(ZtTask::getCloseddate); + result.add(ZtTask::getClosedby); + return result; + } + + public static List> feedbackColumes(){ + List> result=new ArrayList<>(); + result.add(ZtStoryFeedback::getId); + result.add(ZtStoryFeedback::getAssignedTo); + result.add(ZtStoryFeedback::getProduct); + result.add(ZtStoryFeedback::getName); + result.add(ZtStoryFeedback::getStatus); + result.add(ZtStoryFeedback::getSource); + result.add(ZtStoryFeedback::getType); + return result; + } + +} diff --git a/src/main/java/com/sa/zentao/utils/SendEmail.java b/src/main/java/com/sa/zentao/utils/SendEmail.java index 35dd86f..1cb3247 100644 --- a/src/main/java/com/sa/zentao/utils/SendEmail.java +++ b/src/main/java/com/sa/zentao/utils/SendEmail.java @@ -1,5 +1,6 @@ package com.sa.zentao.utils; +import com.alibaba.fastjson.JSON; import com.sa.zentao.dao.BusinessException; import com.tencentcloudapi.ses.v20201002.models.EmailSender; import lombok.SneakyThrows; @@ -27,6 +28,19 @@ public class SendEmail { if(StringUtils.isEmpty(title)){ title="运维提醒"; } +// String host = "smtp.qiye.163.com"; +// String port = "587"; +// String username = "sino-employee@sino-assistance.com"; +// String password = "A112233a"; + +// String host = "smtp.qiye.163.com"; +// String port = "587"; +// String port = "465"; +// String username = "itsm@sino-assistance.com"; + +// String password = "RMz66q579UfmBmP1"; +// String password = "GKXL@650"; + String host = "smtp.qiye.163.com"; String port = "587"; String username = "sino-employee@sino-assistance.com"; @@ -35,8 +49,9 @@ public class SendEmail { Properties props = new Properties(); props.put("mail.smtp.host", host); props.put("mail.smtp.port", port); +// props.put("mail.smtp.ssl.enable", "true"); // 启用SSL props.put("mail.smtp.auth", "true"); - + props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); Session session = Session.getInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); @@ -63,8 +78,10 @@ public class SendEmail { Transport.send(message); } catch (MessagingException e) { + log.error("",e); throw new BusinessException("邮件发送失败"); } catch (IOException e) { + log.error("",e); throw new BusinessException("附件处理失败"); } } @@ -135,105 +152,21 @@ public class SendEmail { System.out.println("邮件发送成功!"); } catch (UnsupportedEncodingException e) { - log.error("",e); - throw new BusinessException("邮件发送失败"); + log.error("{} {}",e, JSON.toJSONString(mails)); + throw new BusinessException("邮件发送失败 "); }catch (MessagingException e) { - log.error("",e); + log.error("{} {}",e, JSON.toJSONString(mails)); throw new BusinessException("邮件发送失败"); } } - public static void careStaff(String mail, String mail2, String content, String title, List files){ - // 邮件相关信息 - String host = "smtp.qiye.163.com"; - String port = "587"; -// String username = "sino-employee@sino-assistance.com"; -// String password = "A112233a"; - String toAddress = mail; - - String username = "qinglin.yin@do-tec.com.cn"; - String password = "A112233a"; - - // 创建Properties对象,设置SMTP服务器相关信息 - Properties props = new Properties(); - props.put("mail.smtp.host", host); - props.put("mail.smtp.port", port); - props.put("mail.smtp.auth", "true"); - - // 创建Session对象,并通过用户名和密码进行验证 - Session session = Session.getInstance(props, new Authenticator() { - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - - try { - // 创建MimeMessage对象 - MimeMessage message = new MimeMessage(session); - - // 设置发件人和收件人地址 - message.setFrom(new InternetAddress(username)); - message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); - message.setRecipients(Message.RecipientType.CC, new InternetAddress[] {new InternetAddress(mail2) }); // 抄送 - - // 设置邮件主题 - message.setSubject(title,"GBK"); - - // 构建HTML格式的邮件内容(包含加粗文本) - String htmlContent = "" + content + ""; - - - //正文 - BodyPart textpart = new MimeBodyPart(); - StringBuilder contain = new StringBuilder(); - contain.append(htmlContent); - textpart.setContent(contain.toString(),"text/html;charset=utf-8"); - - - // 将正文+附件组装成multipart对象 - Multipart multipart = new MimeMultipart(); - //设置文字 - multipart.addBodyPart(textpart); - - - if(!CollectionUtils.isEmpty(files)){ - for (String str:files) { - BodyPart bp = new MimeBodyPart(); - FileDataSource fileds = new FileDataSource(str); - bp.setDataHandler(new DataHandler(fileds)); - bp.setFileName(MimeUtility.encodeWord(fileds.getName(), "GB2312", - null)); - // bp.setFileName(fileds.getName()); - //设置文件 - multipart.addBodyPart(bp); - } - } - - - //将multipart对象放入邮箱 - message.setContent(multipart); - // 设置邮件内容和格式 -// message.setContent(new String(htmlContent.getBytes(),"ISO8859-1"), "text/html"); - - // 发送邮件 - Transport.send(message); - - System.out.println("邮件发送成功!"); - } catch (UnsupportedEncodingException e) { - log.error("",e); - throw new BusinessException("邮件发送失败"); - }catch (MessagingException e) { - log.error("",e); - throw new BusinessException("邮件发送失败"); - } - } @SneakyThrows public static void main(String[] args) { // String str="4468058@qq.com;294438420@qq.com;"; // sendMessage(Arrays.asList(str.split(";")),Arrays.asList(""),"22"); -// sendMail("4468058@qq.com","123"); + sendMail("4468058@qq.com","123","123"); } } \ No newline at end of file diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 3f540a8..ed82097 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -22,7 +22,7 @@ spring: strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 datasource: master: - url: jdbc:mysql://192.168.1.161:3306/zentao?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true + url: jdbc:mysql://192.168.1.161:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true username: devgps password: dev@2021GPS # url: jdbc:mysql://192.168.3.200:3306/zentao_dev?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4430ad5..a88accf 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -23,7 +23,12 @@ spring: logging: level: - com.example.classroomrealtimefeedback.mapper: debug + org.springframework.cloud.gateway: debug + org.springframework.http.server.reactive: debug + org.springframework.web.reactive: debug + reactor.ipc.netty: debug + reactor.netty: debug + com.sa: debug mybatis: diff --git a/src/main/resources/mapper/ZtBugMapper.xml b/src/main/resources/mapper/ZtBugMapper.xml index 652c1d9..b2430bc 100644 --- a/src/main/resources/mapper/ZtBugMapper.xml +++ b/src/main/resources/mapper/ZtBugMapper.xml @@ -68,63 +68,132 @@ - SELECT s.*,pt.name productName from zt_bug s left join zt_product pt on s.product = pt.id + SELECT s.id, + s.project, + s.product, + s.injection, + s.identify, + s.branch, + s.module, + s.execution, + s.plan, + s.story, + s.storyVersion, + s.task, + s.toTask, + s.toStory, + s.title, + s.keywords, + s.severity, + s.pri, + s.type, + s.os, + s.browser, + s.hardware, + s.found, + s.`status`, + s.subStatus, + s.color, + s.confirmed, + s.activatedCount, + s.activatedDate, + s.feedbackBy, + s.notifyEmail, + s.mailto, + s.openedBy, + s.openedDate, + s.assignedTo, + s.openedBuild, + s.assignedDate, + s.deadline, + s.resolvedBy, + s.resolution, + s.resolvedBuild, + s.resolvedDate, + s.closedBy, + s.closedDate, + s.duplicateBug, + s.linkBug, + s.caseId, + s.caseVersion, + s.feedback, + s.result, + s.repo, + s.mr, + s.entry, + s.`lines`, + s.v1, + s.v2, + s.repoType, + s.testtask, + s.issueKey, + s.lastEditedBy, + s.lastEditedDate, + s.deleted, + s.file_url, + s.bug_type, + s.ys_user, + s.ys_flag, + s.ys_remark, + s.release_flag, + + pt.name productName from zt_bug s left join zt_product pt on s.product = pt.id WHERE 1=1 @@ -359,6 +497,170 @@ order by id desc + + diff --git a/src/main/resources/mapper/ZtMeetingMapper.xml b/src/main/resources/mapper/ZtMeetingMapper.xml index 27d6622..5099995 100644 --- a/src/main/resources/mapper/ZtMeetingMapper.xml +++ b/src/main/resources/mapper/ZtMeetingMapper.xml @@ -17,7 +17,21 @@ - select s.*,sp.spec ,sp.verify,sp.files from (zt_story s,zt_projectstory ps,zt_release_details details ) 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 + select s.* from (zt_story s,zt_projectstory ps,zt_release_details details ) 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 - WHERE s.id = ps.story - and s.id = details.object_id - and details.object_type ='story' - and details.release_id = #{qo.id} - and details.status != 'closed' + WHERE s.id = ps.story + and s.id = details.object_id + and details.object_type ='story' + and details.release_id = #{qo.id} + and details.status != 'closed' and s.title like concat('%', #{qo.name}, '%') + + + and s.stage = #{qo.ysStatus} + + + and s.ys_flag = #{qo.ysFlag} + + and s.id = #{qo.storyId} - group by s.id + group by s.id - select s.*,sp.spec ,sp.verify,sp.files from zt_story s - left join zt_storyreview v on s.id = v.story and s.version = v.version - left join zt_storyspec sp on s.id = sp.story - where 1=1 - and s.status='active' - and stage in ('wait','projected','developing','developed','testing','tested') - and s.id in + select s.* from zt_story s + left join zt_storyreview v on s.id = v.story and s.version = v.version + left join zt_storyspec sp on s.id = sp.story + where 1=1 + and s.status='active' + and stage in ('wait','projected','developing','developed','testing','tested') + and s.id in #{id} @@ -72,11 +152,11 @@ group by s.id - SELECT * from zt_story_feedback s WHERE 1 = 1 + SELECT + id, + `name`, + files, + opened_by, + opened_date, + update_date, + update_user, + story_id, + source, + plan_end_date, + assigned_to, + spec, + `status`, + finish_date, + file_url, + `type`, + close_remark, + product, + plan_finish_date, + hand_date, + close_date, + closed_by, + open_source, + weixin, + business_id, + ys_flag, + dont_hand_select, + dont_hand_remark + + from zt_story_feedback s WHERE 1 = 1 diff --git a/src/main/resources/mapper/ZtStoryMapper.xml b/src/main/resources/mapper/ZtStoryMapper.xml index b38d2b3..906d198 100644 --- a/src/main/resources/mapper/ZtStoryMapper.xml +++ b/src/main/resources/mapper/ZtStoryMapper.xml @@ -64,9 +64,80 @@ - select s.*,sp.spec ,sp.verify,sp.files from zt_story s left join zt_storyspec sp on s.id = sp.story + select s.id, + s.vision, + s.parent, + s.product, + s.project, + s.branch, + s.module, + s.plan, + s.source, + s.sourceNote, + s.fromBug, + s.feedback, + s.title, + s.keywords, + s.type, + s.category, + s.pri, + s.estimate, + s.`status`, + s.subStatus, + s.color, + s.stage, + s.stagedBy, + s.mailto, + s.lib, + s.fromStory, + s.fromVersion, + s.openedBy, + s.openedDate, + s.assignedTo, + s.assignedDate, + s.approvedDate, + s.lastEditedBy, + s.lastEditedDate, + s.changedBy, + s.changedDate, + s.reviewedBy, + s.reviewedDate, + s.releasedDate, + s.closedBy, + s.closedDate, + s.closedReason, + s.activatedDate, + s.toBug, + s.childStories, + s.linkStories, + s.linkRequirements, + s.twins, + s.duplicateStory, + s.version, + s.storyChanged, + s.feedbackBy, + s.notifyEmail, + s.BSA, + s.duration, + s.demand, + s.submitedBy, + s.roadmap, + s.URChanged, + s.deleted, + s.plan_start_date, + s.plan_end_date, + s.start_date, + s.end_date, + s.ys_flag, + s.user_story, + s.ys_remark, + s.ys_user, + s.task_count, + s.ys_date, + + from zt_story s left join zt_storyreview v on s.id = v.story and s.version = v.version WHERE 1=1 @@ -576,7 +790,79 @@ - SELECT s.*,pt.name productName from zt_story_user s LEFT JOIN zt_product pt on s.product = pt.id WHERE 1=1 + SELECT s.id, + s.vision, + s.parent, + s.product, + s.project, + s.branch, + s.module, + s.plan, + s.source, + s.sourceNote, + s.fromBug, + s.feedback, + s.title, + s.keywords, + s.type, + s.category, + s.pri, + s.estimate, + s.`status`, + s.subStatus, + s.color, + s.stage, + s.stagedBy, + s.mailto, + s.lib, + s.fromStory, + s.fromVersion, + s.openedBy, + s.openedDate, + s.assignedTo, + s.assignedDate, + s.approvedDate, + s.lastEditedBy, + s.lastEditedDate, + s.changedBy, + s.changedDate, + s.reviewedBy, + s.reviewedDate, + s.releasedDate, + s.closedBy, + s.closedDate, + s.closedReason, + s.activatedDate, + s.toBug, + s.childStories, + s.linkStories, + s.linkRequirements, + s.twins, + s.duplicateStory, + s.version, + s.storyChanged, + s.feedbackBy, + s.notifyEmail, + s.BSA, + s.duration, + s.demand, + s.submitedBy, + s.roadmap, + s.URChanged, + s.deleted, + s.plan_start_date, + s.plan_end_date, + s.start_date, + s.end_date, + s.ys_flag, + s.file_url, + s.ps_date, + s.deliver_remark, + s.old_status, + + + pt.name productName from zt_story_user s LEFT JOIN zt_product pt on s.product = pt.id WHERE 1=1 and s.product in @@ -116,7 +187,7 @@ and s.id = #{qo.id} - and s.title = #{qo.title} + and s.title like concat('%', #{qo.title}, '%') diff --git a/src/main/resources/mapper/ZtStoryUserTaskMapper.xml b/src/main/resources/mapper/ZtStoryUserTaskMapper.xml index 7d9e4dc..a75864c 100644 --- a/src/main/resources/mapper/ZtStoryUserTaskMapper.xml +++ b/src/main/resources/mapper/ZtStoryUserTaskMapper.xml @@ -29,7 +29,32 @@ - select s.*,pt.name productName from zt_task s left join zt_project project on s.project = project.id + select + s.reviewing_user, + s.deadline_time, + s.product, + s.finished_flag, + s.approval_result, + s.use_time, + s.apply_date, + s.approval_remark, + s.files, + s.vision, + s.deleted, + s.v2, + s.v1, + s.`lines`, + s.entry, + s.mr, + s.`order`, + s.repo, + s.activatedDate, + s.lastEditedDate, + s.lastEditedBy, + s.closedReason, + s.realDuration, + s.planDuration, + s.closedDate, + s.closedBy, + s.canceledDate, + s.canceledBy, + s.finishedList, + s.finishedDate, + s.finishedBy, + s.realStarted, + s.estStarted, + s.assignedDate, + s.assignedTo, + s.openedDate, + s.openedBy, + s.version, + s.mailto, + s.color, + s.subStatus, + s.`status`, + s.deadline, + s.`left`, + s.consumed, + s.estimate, + s.pri, + s.`mode`, + s.type, + s.`name`, + s.fromIssue, + s.feedback, + s.fromBug, + s.designVersion, + s.storyVersion, + s.story, + s.design, + s.module, + s.execution, + s.parent, + s.project, + s.id, + pt.name productName from zt_task s left join zt_project project on s.project = project.id left join zt_product pt on s.product = pt.id where 1= 1 @@ -104,6 +167,14 @@ + + and pt.id in + + #{id} + + + and s.id in @@ -264,6 +335,308 @@ + + + + + + + +