forked from Gitlink/microservices
Merge pull request '软件工厂统计、专区数据统计能力上线' (#843) from xjy_software_fact_statis into master
This commit is contained in:
commit
17c3882691
|
|
@ -3,8 +3,10 @@ package com.microservices.pms.common.controller;
|
|||
import com.microservices.common.core.utils.html.EscapeUtil;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.pms.specialArea.service.SoftwareFactStatisticsServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -23,6 +25,9 @@ public class OpenController extends BaseController {
|
|||
@Value("${http.gitLinkUrl}")
|
||||
public String gitLinkUrl;
|
||||
|
||||
@Autowired
|
||||
private SoftwareFactStatisticsServiceImpl softwareFactStatisticsService;
|
||||
|
||||
/**
|
||||
* 查询项目管理企业列表
|
||||
*/
|
||||
|
|
@ -33,4 +38,23 @@ public class OpenController extends BaseController {
|
|||
(Object) EscapeUtil.removeExtraSlashOfUrl(gitLinkUrl + "/login")
|
||||
);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "今日工作态势")
|
||||
@GetMapping("/specialArea/softwareFact/statis/todayWorkSituation")
|
||||
public AjaxResult todayWorkSituation(){
|
||||
return AjaxResult.success(softwareFactStatisticsService.todayWorkSituation());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "周、月工作态势")
|
||||
@GetMapping("/specialArea/softwareFact/statis/weekMonthWorkSituation")
|
||||
public AjaxResult weekMonthWorkSituation(String type){
|
||||
return AjaxResult.success(softwareFactStatisticsService.weekMonthWorkSituation(type));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "项目研发状态")
|
||||
@GetMapping("/specialArea/softwareFact/statis/projectSituation")
|
||||
public AjaxResult projectSituation(){
|
||||
return AjaxResult.success(softwareFactStatisticsService.projectSituation());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.microservices.pms.specialArea.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class Constant {
|
||||
|
||||
private Constant() {}
|
||||
|
||||
public static final List<Integer> ISSUE_NOT_FINISHED = Arrays.asList(1,2);
|
||||
public static final List<Integer> ISSUE_FINISHED = Arrays.asList(3,5,6);
|
||||
|
||||
public static final Integer NEED = 1;
|
||||
public static final Integer TASK = 2;
|
||||
public static final Integer BUG = 3;
|
||||
|
||||
|
||||
public static final Integer TASK_CASE_STATUS_NOT_EXEC = 0;
|
||||
public static final Integer TASK_CASE_STATUS_PASS = 1;
|
||||
public static final Integer TASK_CASE_STATUS_FAIL = 2;
|
||||
public static final Integer TASK_CASE_STATUS_BLOCK = 3;
|
||||
public static final Integer TASK_CASE_STATUS_SKIP = 4;
|
||||
|
||||
|
||||
public static final Integer SPRINT_STATUS_CLOSED = 2;
|
||||
public static final Integer SPRINT_STATUS_PROCESSING = 1;
|
||||
public static final Integer SPRINT_STATUS_NOT_START = 0;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.microservices.pms.specialArea.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ForgeProject {
|
||||
|
||||
//项目ID
|
||||
private Long pmProjectId;
|
||||
// 需求1 任务2 缺陷3,默认为 1
|
||||
private Integer pmIssueType;
|
||||
|
||||
//状态ID
|
||||
private List<Integer> statusIds;
|
||||
//创建时间开始
|
||||
private Date createTimeS;
|
||||
//创建时间结束
|
||||
private Date createTimeE;
|
||||
//更新时间开始
|
||||
private Date updateTimeS;
|
||||
private Date updateTimeE;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.microservices.pms.specialArea.domain;
|
||||
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ZonePmsProject {
|
||||
|
||||
/** 项目ID */
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 组织Id
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/** 项目标识 */
|
||||
@Excel(name = "项目标识")
|
||||
private String projectIdentifier;
|
||||
|
||||
/** 项目名称 */
|
||||
@Excel(name = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/** 项目负责人 */
|
||||
@Excel(name = "项目负责人")
|
||||
private Long projectAssigneeId;
|
||||
|
||||
/** 项目负责人 */
|
||||
@Excel(name = "项目负责人")
|
||||
private String projectAssigneeName;
|
||||
/** 所属企业ID */
|
||||
@Excel(name = "所属企业ID")
|
||||
private Long pmsEnterpriseId;
|
||||
/** 所属企业ID */
|
||||
@Excel(name = "所属企业")
|
||||
private String pmsEnterpriseName;
|
||||
|
||||
/** 状态 0关闭 1开启 2暂停 */
|
||||
@Excel(name = "状态 0关闭 1开启 2暂停")
|
||||
private String status;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.microservices.pms.specialArea.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KeyValVO {
|
||||
private Integer key;
|
||||
private Long val;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.microservices.pms.specialArea.domain.vo;
|
||||
|
||||
import com.microservices.pms.specialArea.domain.ZonePmsProject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ProjectSituationVO extends ZonePmsProject {
|
||||
private Long needCount;
|
||||
private Long needFinishedCount;
|
||||
private Long taskCount;
|
||||
private Long taskFinishedCount;
|
||||
private Long sprintCount;
|
||||
private Long sprintFinishedCount;
|
||||
private Long testCaseCount;
|
||||
private Long testBugCount;
|
||||
private Long notExecTestCaseCount;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.microservices.pms.specialArea.mapper;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.pms.specialArea.domain.ForgeProject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Slave
|
||||
public interface SoftwareFactStatisForgeMapper {
|
||||
|
||||
List<ForgeProject> selectForgeProject(ForgeProject forgeProject);
|
||||
|
||||
Long countForgeProject(ForgeProject forgeProject);
|
||||
Long countForgeProjectByCUES(ForgeProject forgeProject);
|
||||
Long countForgeProjectByProject(ForgeProject forgeProject);
|
||||
Long countForgeProjectByAssigner(ForgeProject forgeProject);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.microservices.pms.specialArea.mapper;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Master;
|
||||
import com.microservices.pms.specialArea.domain.ForgeProject;
|
||||
import com.microservices.pms.specialArea.domain.ZonePmsProject;
|
||||
import com.microservices.pms.specialArea.domain.vo.KeyValVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Master
|
||||
@Mapper
|
||||
public interface SoftwareFactStatisPmsMapper {
|
||||
|
||||
List<ZonePmsProject> selectPmsProjectList();
|
||||
|
||||
ZonePmsProject selectPmsProjectById(@Param("id") Long id);
|
||||
// 状态 0待开始 1进行中 2已关闭
|
||||
List<KeyValVO> countSprintByStatus(Long projectId);
|
||||
Long countSprintByCUES(ForgeProject forgeProject);
|
||||
Long countTestCaseBy(Long projectId);
|
||||
Long countTestCaseInSheet(ForgeProject forgeProject);
|
||||
Long countTestCaseByCUES(ForgeProject forgeProject);
|
||||
|
||||
String selectPmsUserByGitlinkId(@Param("gitlinkId") Long gitlinkId);
|
||||
|
||||
List<Long> selectPmsProjectListByDict();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
package com.microservices.pms.specialArea.service;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.pms.specialArea.domain.ForgeProject;
|
||||
import com.microservices.pms.specialArea.domain.ZonePmsProject;
|
||||
import com.microservices.pms.specialArea.domain.vo.KeyValVO;
|
||||
import com.microservices.pms.specialArea.domain.vo.ProjectSituationVO;
|
||||
import com.microservices.pms.specialArea.mapper.SoftwareFactStatisForgeMapper;
|
||||
import com.microservices.pms.specialArea.mapper.SoftwareFactStatisPmsMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.microservices.pms.specialArea.constant.Constant.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SoftwareFactStatisticsServiceImpl extends BaseController {
|
||||
|
||||
private final SoftwareFactStatisPmsMapper statisPmsMapper;
|
||||
private final SoftwareFactStatisForgeMapper statisForgeMapper;
|
||||
|
||||
public static Date[] getDayStartAndEnd(int days) {
|
||||
// 获取今天的日期
|
||||
LocalDate today = LocalDate.now();
|
||||
today = today.plusDays(days);
|
||||
// 获取今天的开始时间(00:00:00)
|
||||
LocalDateTime startOfDay = today.atStartOfDay();
|
||||
|
||||
// 获取今天的结束时间(23:59:59.999999999)
|
||||
LocalDateTime endOfDay = today.atTime(LocalTime.MAX);
|
||||
|
||||
// 转换为 Date 对象
|
||||
Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||
Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
return new Date[]{startDate, endDate};
|
||||
}
|
||||
|
||||
public static Date[] getCurrentWeek() {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate startOfWeek = today.with(java.time.DayOfWeek.MONDAY);
|
||||
LocalDate endOfWeek = today.with(java.time.DayOfWeek.SUNDAY);
|
||||
|
||||
LocalDateTime startDateTime = startOfWeek.atStartOfDay();
|
||||
LocalDateTime endDateTime = endOfWeek.atTime(23, 59, 59);
|
||||
|
||||
return new Date[]{
|
||||
Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||
};
|
||||
}
|
||||
|
||||
public static Date[] getCurrentMonth() {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate startOfMonth = today.withDayOfMonth(1);
|
||||
LocalDate endOfMonth = today.withDayOfMonth(today.lengthOfMonth());
|
||||
|
||||
LocalDateTime startDateTime = startOfMonth.atStartOfDay();
|
||||
LocalDateTime endDateTime = endOfMonth.atTime(23, 59, 59);
|
||||
|
||||
return new Date[]{
|
||||
Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||
};
|
||||
}
|
||||
|
||||
public Map<String, Object> todayWorkSituation() {
|
||||
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
|
||||
ForgeProject forgeProject = new ForgeProject();
|
||||
forgeProject.setStatusIds(ISSUE_NOT_FINISHED);
|
||||
|
||||
//需求待评审
|
||||
forgeProject.setPmIssueType(NEED);
|
||||
Long needNotFinishCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
res.put("needNotFinishCount", needNotFinishCount);
|
||||
|
||||
//任务待完成
|
||||
forgeProject.setPmIssueType(TASK);
|
||||
Long taskNotFinishCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
res.put("taskNotFinishCount", taskNotFinishCount);
|
||||
|
||||
//缺陷待修复
|
||||
forgeProject.setPmIssueType(BUG);
|
||||
Long bugNotFinishCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
res.put("bugNotFinishCount", bugNotFinishCount);
|
||||
//测试用例未执行数
|
||||
forgeProject.setStatusIds(Collections.singletonList(TASK_CASE_STATUS_NOT_EXEC));
|
||||
Long notExecTestCaseCount = statisPmsMapper.countTestCaseInSheet(forgeProject);
|
||||
res.put("notExecTestCaseCount", notExecTestCaseCount);
|
||||
|
||||
ForgeProject f2 = new ForgeProject();
|
||||
f2.setStatusIds(ISSUE_NOT_FINISHED);
|
||||
f2.setPmIssueType(TASK);
|
||||
//任务最多项目
|
||||
Long taskMaxProjectId = statisForgeMapper.countForgeProjectByProject(f2);
|
||||
ZonePmsProject taskMaxProject = statisPmsMapper.selectPmsProjectById(taskMaxProjectId);
|
||||
res.put("taskMaxProject", taskMaxProject == null ?"": taskMaxProject.getProjectName());
|
||||
//任务最多个人
|
||||
Long taskMaxAssignerId = statisForgeMapper.countForgeProjectByAssigner(f2);
|
||||
String taskMaxAssigner = statisPmsMapper.selectPmsUserByGitlinkId(taskMaxAssignerId);
|
||||
res.put("taskMaxAssigner", taskMaxAssigner);
|
||||
f2.setPmIssueType(BUG);
|
||||
//缺陷最多项目
|
||||
Long bugMaxProjectId = statisForgeMapper.countForgeProjectByProject(f2);
|
||||
ZonePmsProject bugMaxProject = statisPmsMapper.selectPmsProjectById(bugMaxProjectId);
|
||||
res.put("bugMaxProject", bugMaxProject == null ?"": bugMaxProject.getProjectName());
|
||||
//缺陷最多个人
|
||||
Long bugMaxAssignerId = statisForgeMapper.countForgeProjectByAssigner(f2);
|
||||
String bugMaxAssigner = statisPmsMapper.selectPmsUserByGitlinkId(bugMaxAssignerId);
|
||||
res.put("bugMaxAssigner", bugMaxAssigner);
|
||||
|
||||
|
||||
// 昨日完成、昨日新增
|
||||
Date[] dayStartAndEnd = getDayStartAndEnd(-1);
|
||||
ForgeProject forgeProjectTime = new ForgeProject();
|
||||
forgeProjectTime.setCreateTimeS(dayStartAndEnd[0]);
|
||||
forgeProjectTime.setCreateTimeE(dayStartAndEnd[1]);
|
||||
buildDayWeekMonthData(forgeProjectTime, res, dayStartAndEnd);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private void buildDayWeekMonthData(ForgeProject forgeProjectTime, Map<String, Object> res, Date[] dayStartAndEnd) {
|
||||
// 昨日新增需求
|
||||
forgeProjectTime.setPmIssueType(NEED);
|
||||
Long yesterdayAddNeed = statisForgeMapper.countForgeProject(forgeProjectTime);
|
||||
res.put("yesterdayAddNeed", yesterdayAddNeed);
|
||||
//昨日新增 任务
|
||||
forgeProjectTime.setPmIssueType(TASK);
|
||||
Long yesterdayAddTask = statisForgeMapper.countForgeProject(forgeProjectTime);
|
||||
res.put("yesterdayAddTask", yesterdayAddTask);
|
||||
//昨日新增 缺陷
|
||||
forgeProjectTime.setPmIssueType(BUG);
|
||||
Long yesterdayAddBug = statisForgeMapper.countForgeProject(forgeProjectTime);
|
||||
res.put("yesterdayAddBug", yesterdayAddBug);
|
||||
|
||||
ForgeProject forgeProjectFinish = new ForgeProject();
|
||||
forgeProjectFinish.setStatusIds(ISSUE_FINISHED);
|
||||
forgeProjectFinish.setUpdateTimeS(dayStartAndEnd[0]);
|
||||
forgeProjectFinish.setUpdateTimeE(dayStartAndEnd[1]);
|
||||
//昨日任务完结
|
||||
forgeProjectFinish.setPmIssueType(TASK);
|
||||
Long yesterdayFinishTask = statisForgeMapper.countForgeProject(forgeProjectFinish);
|
||||
res.put("yesterdayFinishTask", yesterdayFinishTask);
|
||||
//昨日缺陷关闭数
|
||||
forgeProjectFinish.setPmIssueType(BUG);
|
||||
Long yesterdayFinishBug = statisForgeMapper.countForgeProject(forgeProjectFinish);
|
||||
res.put("yesterdayFinishBug", yesterdayFinishBug);
|
||||
// 昨日需求评审数
|
||||
forgeProjectFinish.setPmIssueType(NEED);
|
||||
Long yesterdayFinishNeed = statisForgeMapper.countForgeProject(forgeProjectFinish);
|
||||
res.put("yesterdayFinishNeed", yesterdayFinishNeed);
|
||||
//昨日测试用例执行
|
||||
ForgeProject forgeProjectTest = new ForgeProject();
|
||||
forgeProjectFinish.setStatusIds(Arrays.asList(TASK_CASE_STATUS_PASS, TASK_CASE_STATUS_FAIL, TASK_CASE_STATUS_BLOCK, TASK_CASE_STATUS_SKIP));
|
||||
forgeProjectFinish.setUpdateTimeS(dayStartAndEnd[0]);
|
||||
forgeProjectFinish.setUpdateTimeE(dayStartAndEnd[1]);
|
||||
Long yesterdayTestCase = statisPmsMapper.countTestCaseInSheet(forgeProjectTest);
|
||||
res.put("yesterdayTestCase", yesterdayTestCase);
|
||||
|
||||
// 昨日最活跃项目
|
||||
List<ZonePmsProject> zonePmsProjects = statisPmsMapper.selectPmsProjectList();
|
||||
long pmsProjectIdMax = 0L, maxVal = -1L;
|
||||
for (ZonePmsProject p : zonePmsProjects) {
|
||||
ForgeProject f = new ForgeProject();
|
||||
f.setCreateTimeS(dayStartAndEnd[0]);
|
||||
f.setCreateTimeE(dayStartAndEnd[1]);
|
||||
f.setUpdateTimeS(dayStartAndEnd[0]);
|
||||
f.setUpdateTimeE(dayStartAndEnd[1]);
|
||||
f.setPmProjectId(p.getId());
|
||||
|
||||
f.setPmIssueType(NEED);
|
||||
Long a = statisForgeMapper.countForgeProjectByCUES(f);
|
||||
f.setPmIssueType(TASK);
|
||||
Long b = statisForgeMapper.countForgeProjectByCUES(f);
|
||||
f.setPmIssueType(BUG);
|
||||
Long c = statisForgeMapper.countForgeProjectByCUES(f);
|
||||
Long d = statisPmsMapper.countSprintByCUES(f);
|
||||
Long e = statisPmsMapper.countTestCaseByCUES(f);
|
||||
|
||||
long total = a + b + c + d + e;
|
||||
if (total > maxVal) {
|
||||
pmsProjectIdMax = p.getId();
|
||||
maxVal = total;
|
||||
}
|
||||
}
|
||||
|
||||
ZonePmsProject zonePmsProjectMax = statisPmsMapper.selectPmsProjectById(pmsProjectIdMax);
|
||||
res.put("zonePmsProjectMax", zonePmsProjectMax==null? "": zonePmsProjectMax.getProjectName());
|
||||
}
|
||||
|
||||
public List<ProjectSituationVO> projectSituation() {
|
||||
|
||||
List<ZonePmsProject> zonePmsProjects = statisPmsMapper.selectPmsProjectList();
|
||||
List<Long> showProjectList = statisPmsMapper.selectPmsProjectListByDict()
|
||||
.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!showProjectList.isEmpty()) {
|
||||
zonePmsProjects = zonePmsProjects.stream().filter(e->showProjectList.contains(e.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
List<ProjectSituationVO> res = new ArrayList<>();
|
||||
zonePmsProjects.forEach(zonePmsProject -> {
|
||||
|
||||
ProjectSituationVO vo = new ProjectSituationVO();
|
||||
BeanUtils.copyProperties(zonePmsProject, vo);
|
||||
|
||||
Map<Integer, Long> sprintCountMap = statisPmsMapper.countSprintByStatus(zonePmsProject.getId())
|
||||
.stream()
|
||||
.collect(Collectors.toMap(KeyValVO::getKey, KeyValVO::getVal, (o, n) -> n));
|
||||
|
||||
vo.setSprintFinishedCount(sprintCountMap.getOrDefault(SPRINT_STATUS_CLOSED,0L));
|
||||
vo.setSprintCount(sprintCountMap.values().stream().reduce(0L, Long::sum));
|
||||
|
||||
ForgeProject forgeProject = new ForgeProject();
|
||||
forgeProject.setPmProjectId(zonePmsProject.getId());
|
||||
forgeProject.setPmIssueType(NEED);
|
||||
Long planCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
vo.setNeedCount(planCount);
|
||||
forgeProject.setStatusIds(ISSUE_FINISHED);
|
||||
Long planFinishCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
vo.setNeedFinishedCount(planFinishCount);
|
||||
forgeProject.setPmIssueType(TASK);
|
||||
Long taskFinishCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
vo.setTaskFinishedCount(taskFinishCount);
|
||||
forgeProject.setStatusIds(new ArrayList<>());
|
||||
Long taskCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
vo.setTaskCount(taskCount);
|
||||
|
||||
// 测试相关
|
||||
//测试用例数
|
||||
Long testCaseCount = statisPmsMapper.countTestCaseBy(zonePmsProject.getId());
|
||||
forgeProject.setPmIssueType(BUG);
|
||||
forgeProject.setStatusIds(ISSUE_NOT_FINISHED);
|
||||
vo.setTestCaseCount(testCaseCount);
|
||||
// 测试缺陷数
|
||||
Long testBugCount = statisForgeMapper.countForgeProject(forgeProject);
|
||||
vo.setTestBugCount(testBugCount);
|
||||
// 测试用例未执行数
|
||||
forgeProject.setStatusIds(Collections.singletonList(TASK_CASE_STATUS_NOT_EXEC));
|
||||
Long notExecTestCaseCount = statisPmsMapper.countTestCaseInSheet(forgeProject);
|
||||
vo.setNotExecTestCaseCount(notExecTestCaseCount);
|
||||
|
||||
res.add(vo);
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public Map<String, Object> weekMonthWorkSituation(String type) {
|
||||
Map<String, Object> res = new HashMap<>();
|
||||
Date[] dayStartAndEnd = getDayStartAndEnd(-1);
|
||||
if (Objects.equals(type, "week")) {
|
||||
dayStartAndEnd = getCurrentWeek();
|
||||
} else if (Objects.equals(type, "month")) {
|
||||
dayStartAndEnd = getCurrentMonth();
|
||||
}
|
||||
ForgeProject forgeProjectTime = new ForgeProject();
|
||||
forgeProjectTime.setCreateTimeS(dayStartAndEnd[0]);
|
||||
forgeProjectTime.setCreateTimeE(dayStartAndEnd[1]);
|
||||
buildDayWeekMonthData(forgeProjectTime, res, dayStartAndEnd);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.microservices.pms.specialArea.mapper.SoftwareFactStatisForgeMapper">
|
||||
|
||||
<select id="selectForgeProject" resultType="com.microservices.pms.specialArea.domain.ForgeProject">
|
||||
select pm_project_id,pm_issue_type from issues
|
||||
<where>
|
||||
<if test="pmIssueType != null ">and pm_issue_type = #{pmIssueType}</if>
|
||||
<if test="createTimeS != null ">and created_on >= #{createTimeS}</if>
|
||||
<if test="createTimeE != null ">and created_on <= #{createTimeE}</if>
|
||||
<if test="updateTimeS != null ">and updated_on >= #{updateTimeS}</if>
|
||||
<if test="updateTimeE != null ">and updated_on <= #{updateTimeE}</if>
|
||||
<if test="pmIssueType != null ">and pm_issue_type = #{pmIssueType}</if>
|
||||
<if test="pmProjectId != null ">and pm_project_id = #{pmProjectId}</if>
|
||||
<if test="statusIds != null and statusIds.size() > 0">and status_id in
|
||||
<foreach item="item" collection="statusIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countForgeProject" resultType="java.lang.Long">
|
||||
select count(id) from issues
|
||||
<where>
|
||||
<if test="createTimeS != null ">and created_on >= #{createTimeS}</if>
|
||||
<if test="createTimeE != null ">and created_on <= #{createTimeE}</if>
|
||||
<if test="updateTimeS != null ">and updated_on >= #{updateTimeS}</if>
|
||||
<if test="updateTimeE != null ">and updated_on <= #{updateTimeE}</if>
|
||||
<if test="pmIssueType != null ">and pm_issue_type = #{pmIssueType}</if>
|
||||
<if test="pmProjectId != null ">and pm_project_id = #{pmProjectId}</if>
|
||||
<if test="statusIds != null and statusIds.size() > 0">and status_id in
|
||||
<foreach item="item" collection="statusIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countForgeProjectByCUES" resultType="java.lang.Long">
|
||||
select count(id) from issues
|
||||
where pm_project_id = #{pmProjectId} and ((created_on >= #{createTimeS} and created_on <= #{createTimeE})
|
||||
OR (updated_on >= #{updateTimeS} and updated_on <= #{updateTimeE}))
|
||||
</select>
|
||||
|
||||
<select id="countForgeProjectByProject" resultType="java.lang.Long">
|
||||
select pm_project_id from (select pm_project_id, count(id) as val from issues
|
||||
where pm_project_id is not null
|
||||
<if test="pmIssueType != null ">and pm_issue_type = #{pmIssueType}</if>
|
||||
<if test="pmProjectId != null ">and pm_project_id = #{pmProjectId}</if>
|
||||
<if test="statusIds != null and statusIds.size() > 0">and status_id in
|
||||
<foreach item="item" collection="statusIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
group by pm_project_id
|
||||
order by val DESC LIMIT 1) tmp
|
||||
</select>
|
||||
|
||||
<select id="countForgeProjectByAssigner" resultType="java.lang.Long">
|
||||
select assigner_id from (SELECT ia.assigner_id, COUNT(i.id) AS issue_count
|
||||
FROM issue_assigners ia
|
||||
JOIN issues i ON ia.issue_id = i.id
|
||||
WHERE ia.assigner_id is not null
|
||||
<if test="pmIssueType != null ">and i.pm_issue_type = #{pmIssueType}</if>
|
||||
<if test="pmProjectId != null ">and i.pm_project_id = #{pmProjectId}</if>
|
||||
<if test="statusIds != null and statusIds.size() > 0">and i.status_id in
|
||||
<foreach item="item" collection="statusIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY ia.assigner_id
|
||||
ORDER BY issue_count DESC
|
||||
LIMIT 1
|
||||
) tmp
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.microservices.pms.specialArea.mapper.SoftwareFactStatisPmsMapper">
|
||||
|
||||
<select id="selectPmsProjectList" resultType="com.microservices.pms.specialArea.domain.ZonePmsProject">
|
||||
select id,
|
||||
project_name as projectName,
|
||||
project_assignee_id projectAssigneeId,
|
||||
pms_enterprise_id pmsEnterpriseId,
|
||||
dept_id deptId,
|
||||
`status`,
|
||||
(select enterprise_name from pms_enterprise where id = pms_enterprise_id) as pmsEnterpriseName,
|
||||
(select nick_name from sys_user where gitlink_user_id = project_assignee_id) as projectAssigneeName
|
||||
from pms_project
|
||||
where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="countSprintByStatus" resultType="com.microservices.pms.specialArea.domain.vo.KeyValVO">
|
||||
select `status` as `key`, count(id) as val
|
||||
from pms_project_sprint
|
||||
where `status` is not null
|
||||
<if test="projectId != null">
|
||||
and pms_project_id = #{projectId}
|
||||
</if>
|
||||
group by `status`
|
||||
</select>
|
||||
|
||||
<select id="countSprintByCUES" resultType="java.lang.Long">
|
||||
select count(id)
|
||||
from pms_project_sprint
|
||||
where pms_project_id = #{pmProjectId} and ((create_time >= #{createTimeS} and create_time <= #{createTimeE})
|
||||
OR (update_time >= #{updateTimeS} and update_time <= #{updateTimeE}))
|
||||
</select>
|
||||
|
||||
<select id="countTestCaseInSheet" resultType="java.lang.Long">
|
||||
select count(id) from pms_project_testsheet_cases
|
||||
<where>
|
||||
<if test="statusIds != null and statusIds.size() > 0">and test_status in
|
||||
<foreach item="item" collection="statusIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="pmProjectId != null">and project_testsheet_id in (
|
||||
select id from pms_project_testsheet where pms_project_id = #{pmProjectId}
|
||||
)
|
||||
</if>
|
||||
<if test="createTimeS != null ">and created_on >= #{createTimeS}</if>
|
||||
<if test="createTimeE != null ">and created_on <= #{createTimeE}</if>
|
||||
<if test="updateTimeS != null ">and updated_on >= #{updateTimeS}</if>
|
||||
<if test="updateTimeE != null ">and updated_on <= #{updateTimeE}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countTestCaseBy" resultType="java.lang.Long">
|
||||
select count(id) from pms_project_testcase
|
||||
<where>
|
||||
<if test="pmsProjectId != null">pms_project_id=#{pmsProjectId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPmsProjectById" resultType="com.microservices.pms.specialArea.domain.ZonePmsProject">
|
||||
select id,
|
||||
project_name as projectName,
|
||||
project_assignee_id projectAssigneeId,
|
||||
pms_enterprise_id pmsEnterpriseId,
|
||||
dept_id deptId,
|
||||
`status`,
|
||||
(select enterprise_name from pms_enterprise where id = pms_enterprise_id) as pmsEnterpriseName,
|
||||
(select nick_name from sys_user where gitlink_user_id = project_assignee_id) as projectAssigneeName
|
||||
from pms_project
|
||||
where is_deleted = 0 and id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectPmsUserByGitlinkId" resultType="java.lang.String">
|
||||
select nick_name from sys_user where gitlink_user_id = #{gitlinkId}
|
||||
</select>
|
||||
|
||||
<select id="countTestCaseByCUES" resultType="java.lang.Long">
|
||||
select count(pptc.id) from pms_project_testsheet_cases pptc
|
||||
left join pms_project_testcase ppt on pptc.project_testcase_id = ppt.id
|
||||
where ppt.pms_project_id = #{pmProjectId} and ((pptc.create_time >= #{createTimeS} and pptc.create_time <= #{createTimeE})
|
||||
OR (pptc.update_time >= #{updateTimeS} and pptc.update_time <= #{updateTimeE}))
|
||||
</select>
|
||||
<select id="selectPmsProjectListByDict" resultType="java.lang.Long">
|
||||
select dict_value from sys_dict_data where dict_type = 'xjy_zone_project_list'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -247,4 +247,22 @@ public class ZoneDetailDataVo extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "数据集板块标题")
|
||||
private String sectionDataSetTitle;
|
||||
|
||||
/**
|
||||
* 近一周的文章新增发布数
|
||||
*/
|
||||
@ApiModelProperty(value = "近一周的文章新增发布数")
|
||||
private Long weekArticles = 0L;
|
||||
|
||||
/**
|
||||
* 近一周UV数(点击去重)
|
||||
*/
|
||||
@ApiModelProperty(value = "近一周UV数(点击去重)")
|
||||
private Long weekUV = 0L;
|
||||
|
||||
/**
|
||||
* 近一周PV数(总访问量)
|
||||
*/
|
||||
@ApiModelProperty(value = "近一周PV数(总访问量)")
|
||||
private Long weekPV = 0L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@ package com.microservices.zone.detail.mapper;
|
|||
|
||||
import com.microservices.common.datascope.annotation.DataScope;
|
||||
import com.microservices.zone.detail.domain.ZoneDetail;
|
||||
import com.microservices.zone.detail.domain.vo.ZoneDetailDataVo;
|
||||
import com.microservices.zone.detail.domain.vo.ZoneDetailSearchVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.access.method.P;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -95,4 +99,22 @@ public interface ZoneDetailMapper {
|
|||
* @return
|
||||
*/
|
||||
ZoneDetail selectZoneDetailByName(String name);
|
||||
|
||||
/**
|
||||
* 专区文章数统计
|
||||
* @param createTimeS
|
||||
* @param createTimeE
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
ZoneDetailDataVo countArticlesGroupByKey(@Param("createTimeS") Date createTimeS, @Param("createTimeE") Date createTimeE, @Param("key") String key);
|
||||
|
||||
/**
|
||||
* 专区浏览数据统计
|
||||
* @param createTimeS
|
||||
* @param createTimeE
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
ZoneDetailDataVo countPUVsGroupByKey(@Param("createTimeS") Date createTimeS, @Param("createTimeE") Date createTimeE, @Param("key") String key);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -198,6 +198,22 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
gitLinkRequestHelper.gitLinkUrl + "/zone/" + zoneDetail.getKey()
|
||||
)
|
||||
);
|
||||
|
||||
Date[] lastWeek = getLastWeek();
|
||||
//专区文章数统计
|
||||
ZoneDetailDataVo articlesGroupByKey = zoneDetailMapper
|
||||
.countArticlesGroupByKey(lastWeek[0],lastWeek[1],zoneDetail.getKey()) ;
|
||||
if (articlesGroupByKey != null) {
|
||||
zoneDetailDataVo.setWeekArticles(articlesGroupByKey.getWeekArticles());
|
||||
}
|
||||
//专区浏览数据统计
|
||||
ZoneDetailDataVo puVsGroupByKey = zoneDetailMapper
|
||||
.countPUVsGroupByKey(lastWeek[0],lastWeek[1],zoneDetail.getKey()) ;
|
||||
if (puVsGroupByKey != null) {
|
||||
zoneDetailDataVo.setWeekPV(puVsGroupByKey.getWeekPV());
|
||||
zoneDetailDataVo.setWeekUV(puVsGroupByKey.getWeekUV());
|
||||
}
|
||||
|
||||
return zoneDetailDataVo;
|
||||
}
|
||||
|
||||
|
|
@ -776,4 +792,17 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
return zoneStatisticsVo;
|
||||
}
|
||||
|
||||
public Date[] getLastWeek() {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate startOfWeek = today.with(java.time.DayOfWeek.MONDAY).minusDays(7);
|
||||
LocalDate endOfWeek = today.with(java.time.DayOfWeek.SUNDAY).minusDays(7);
|
||||
|
||||
LocalDateTime startDateTime = startOfWeek.atStartOfDay();
|
||||
LocalDateTime endDateTime = endOfWeek.atTime(23, 59, 59);
|
||||
|
||||
return new Date[]{
|
||||
Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,215 +192,235 @@
|
|||
<include refid="selectWhere"/>
|
||||
</select>
|
||||
|
||||
<select id="selectZoneDetailById" parameterType="Long" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectZoneDetailByDeptId" parameterType="Long" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where dept_id = #{deptId}
|
||||
</select>
|
||||
<select id="selectZoneDetailCount" resultType="java.lang.Integer">
|
||||
select count(0) from zone_detail as z
|
||||
<include refid="selectWhere"/>
|
||||
</select>
|
||||
<select id="selectZoneDetailByKey" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where `key` = #{key}
|
||||
</select>
|
||||
<select id="selectZoneDetailByName" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where `name` = #{name}
|
||||
</select>
|
||||
<select id="selectZoneDetailById" parameterType="Long" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectZoneDetailByDeptId" parameterType="Long" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where dept_id = #{deptId}
|
||||
</select>
|
||||
<select id="selectZoneDetailCount" resultType="java.lang.Integer">
|
||||
select count(0) from zone_detail as z
|
||||
<include refid="selectWhere"/>
|
||||
</select>
|
||||
<select id="selectZoneDetailByKey" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where `key` = #{key}
|
||||
</select>
|
||||
<select id="selectZoneDetailByName" resultMap="ZoneDetailResult">
|
||||
<include refid="selectZoneDetailVo"/>
|
||||
where `name` = #{name}
|
||||
</select>
|
||||
|
||||
<insert id="insertZoneDetail" parameterType="ZoneDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into zone_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="key != null and key != ''">`key`,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="mainTitle != null">main_title,</if>
|
||||
<if test="subTitle != null">sub_title,</if>
|
||||
<if test="firstTitle != null">first_title,</if>
|
||||
<if test="bannerList != null">banner_list,</if>
|
||||
<if test="introductionTitle != null">introduction_title,</if>
|
||||
<if test="introductionContent != null">introduction_content,</if>
|
||||
<if test="introductionImage != null">introduction_image,</if>
|
||||
<if test="homepageMembershipSize != null">homepage_membership_size,</if>
|
||||
<if test="homepageCmsSize != null">homepage_cms_size,</if>
|
||||
<if test="homepageProjectSize != null">homepage_project_size,</if>
|
||||
<if test="cmsProjectId != null">cms_project_id,</if>
|
||||
<if test="gitlinkProjectKeys != null">gitlink_project_keys,</if>
|
||||
<if test="cmsShow != null">cms_show,</if>
|
||||
<if test="projectShow != null">project_show,</if>
|
||||
<if test="memberShow != null">member_show,</if>
|
||||
<if test="partnersShow != null">partners_show,</if>
|
||||
<if test="specialProjectShow != null">special_project_show,</if>
|
||||
<if test="homepageSpecialProjectTitle != null">homepage_special_project_title,</if>
|
||||
<if test="resourceShow != null">resource_show,</if>
|
||||
<if test="homepageResourceTitle != null">homepage_resource_title,</if>
|
||||
<if test="homepageCmsTitle != null">homepage_cms_title,</if>
|
||||
<if test="homepageProjectTitle != null">homepage_project_title,</if>
|
||||
<if test="homepageMemberTitle != null">homepage_member_title,</if>
|
||||
<if test="homepagePartnersTitle != null">homepage_partners_title,</if>
|
||||
<if test="template != null">template,</if>
|
||||
<if test="helperTitle != null">helper_title,</if>
|
||||
<if test="helperShow != null">helper_show,</if>
|
||||
<if test="docNeedAudit != null">doc_need_audit,</if>
|
||||
<if test="resourceNeedAudit != null">resource_need_audit,</if>
|
||||
<if test="isLockCms != null">is_lock_cms,</if>
|
||||
<if test="sectionCmsShow != null">section_cms_show,</if>
|
||||
<if test="sectionProjectShow != null">section_project_show,</if>
|
||||
<if test="sectionMemberShow != null">section_member_show,</if>
|
||||
<if test="sectionHelperShow != null">section_helper_show,</if>
|
||||
<if test="sectionHomepageShow != null">section_homepage_show,</if>
|
||||
<if test="sectionResourceShow != null">section_resource_show,</if>
|
||||
<if test="sectionDataSetShow != null">section_dataset_show,</if>
|
||||
<if test="sectionCmsTitle != null">section_cms_title,</if>
|
||||
<if test="sectionProjectTitle != null">section_project_title,</if>
|
||||
<if test="sectionMemberTitle != null">section_member_title,</if>
|
||||
<if test="sectionHelperTitle != null">section_helper_title,</if>
|
||||
<if test="sectionHomepageTitle != null">section_homepage_title,</if>
|
||||
<if test="sectionResourceTitle != null">section_resource_title,</if>
|
||||
<if test="sectionDataSetTitle != null">section_dataset_title,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="key != null and key != ''">#{key},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="mainTitle != null">#{mainTitle},</if>
|
||||
<if test="subTitle != null">#{subTitle},</if>
|
||||
<if test="firstTitle != null">#{firstTitle},</if>
|
||||
<if test="bannerList != null">#{bannerList},</if>
|
||||
<if test="introductionTitle != null">#{introductionTitle},</if>
|
||||
<if test="introductionContent != null">#{introductionContent},</if>
|
||||
<if test="introductionImage != null">#{introductionImage},</if>
|
||||
<if test="homepageMembershipSize != null">#{homepageMembershipSize},</if>
|
||||
<if test="homepageCmsSize != null">#{homepageCmsSize},</if>
|
||||
<if test="homepageProjectSize != null">#{homepageProjectSize},</if>
|
||||
<if test="cmsProjectId != null">#{cmsProjectId},</if>
|
||||
<if test="gitlinkProjectKeys != null">#{gitlinkProjectKeys},</if>
|
||||
<if test="cmsShow != null">#{cmsShow},</if>
|
||||
<if test="projectShow != null">#{projectShow},</if>
|
||||
<if test="memberShow != null">#{memberShow},</if>
|
||||
<if test="partnersShow != null">#{partnersShow},</if>
|
||||
<if test="specialProjectShow != null">#{specialProjectShow},</if>
|
||||
<if test="homepageSpecialProjectTitle != null">#{homepageSpecialProjectTitle},</if>
|
||||
<if test="resourceShow != null">#{resourceShow},</if>
|
||||
<if test="homepageResourceTitle != null">#{homepageResourceTitle},</if>
|
||||
<if test="homepageCmsTitle != null">#{homepageCmsTitle},</if>
|
||||
<if test="homepageProjectTitle != null">#{homepageProjectTitle},</if>
|
||||
<if test="homepageMemberTitle != null">#{homepageMemberTitle},</if>
|
||||
<if test="homepagePartnersTitle != null">#{homepagePartnersTitle},</if>
|
||||
<if test="template != null">#{template},</if>
|
||||
<if test="helperTitle != null">#{helperTitle},</if>
|
||||
<if test="helperShow != null">#{helperShow},</if>
|
||||
<if test="docNeedAudit != null">#{docNeedAudit},</if>
|
||||
<if test="resourceNeedAudit != null">#{resourceNeedAudit},</if>
|
||||
<if test="isLockCms != null">#{isLockCms},</if>
|
||||
<if test="sectionCmsShow != null">#{sectionCmsShow},</if>
|
||||
<if test="sectionProjectShow != null">#{sectionProjectShow},</if>
|
||||
<if test="sectionMemberShow != null">#{sectionMemberShow},</if>
|
||||
<if test="sectionHelperShow != null">#{sectionHelperShow},</if>
|
||||
<if test="sectionHomepageShow != null">#{sectionHomepageShow},</if>
|
||||
<if test="sectionResourceShow != null">#{sectionResourceShow},</if>
|
||||
<if test="sectionDataSetShow != null">#{sectionDataSetShow},</if>
|
||||
<if test="sectionCmsTitle != null">#{sectionCmsTitle},</if>
|
||||
<if test="sectionProjectTitle != null">#{sectionProjectTitle},</if>
|
||||
<if test="sectionMemberTitle != null">#{sectionMemberTitle},</if>
|
||||
<if test="sectionHelperTitle != null">#{sectionHelperTitle},</if>
|
||||
<if test="sectionHomepageTitle != null">#{sectionHomepageTitle},</if>
|
||||
<if test="sectionResourceTitle != null">#{sectionResourceTitle},</if>
|
||||
<if test="sectionDataSetTitle != null">#{sectionDataSetTitle},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countArticlesGroupByKey" resultType="com.microservices.zone.detail.domain.vo.ZoneDetailDataVo">
|
||||
SELECT zd.`key`, COUNT(*) AS weekArticles
|
||||
FROM cms_doc cd
|
||||
left join zone_detail zd on zd.dept_id = cd.dept_id
|
||||
where zd.`key` = #{key} and cd.create_time >= #{createTimeS} and cd.create_time <= #{createTimeE}
|
||||
GROUP BY zd.`key`
|
||||
</select>
|
||||
|
||||
<update id="updateZoneDetail" parameterType="ZoneDetail">
|
||||
update zone_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="key != null and key != ''">`key` = #{key},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="mainTitle != null">main_title = #{mainTitle},</if>
|
||||
<if test="subTitle != null">sub_title = #{subTitle},</if>
|
||||
<if test="firstTitle != null">first_title = #{firstTitle},</if>
|
||||
<if test="bannerList != null">banner_list = #{bannerList},</if>
|
||||
<if test="introductionTitle != null">introduction_title = #{introductionTitle},</if>
|
||||
<if test="introductionContent != null">introduction_content = #{introductionContent},</if>
|
||||
<if test="introductionImage != null">introduction_image = #{introductionImage},</if>
|
||||
<if test="homepageMembershipSize != null">homepage_membership_size = #{homepageMembershipSize},</if>
|
||||
<if test="homepageCmsSize != null">homepage_cms_size = #{homepageCmsSize},</if>
|
||||
<if test="homepageProjectSize != null">homepage_project_size = #{homepageProjectSize},</if>
|
||||
<if test="cmsProjectId != null">cms_project_id = #{cmsProjectId},</if>
|
||||
<if test="gitlinkProjectKeys != null">gitlink_project_keys = #{gitlinkProjectKeys},</if>
|
||||
<if test="isPublish != null">is_publish = #{isPublish},</if>
|
||||
<if test="cmsShow != null">cms_show = #{cmsShow},</if>
|
||||
<if test="projectShow != null">project_show = #{projectShow},</if>
|
||||
<if test="memberShow != null">member_show = #{memberShow},</if>
|
||||
<if test="partnersShow != null">partners_show = #{partnersShow},</if>
|
||||
<if test="specialProjectShow != null">special_project_show = #{specialProjectShow},</if>
|
||||
<if test="homepageSpecialProjectTitle != null">homepage_special_project_title =
|
||||
#{homepageSpecialProjectTitle},
|
||||
</if>
|
||||
<if test="resourceShow != null">resource_show = #{resourceShow},</if>
|
||||
<if test="homepageResourceTitle != null">homepage_resource_title =
|
||||
#{homepageResourceTitle},
|
||||
</if>
|
||||
<if test="homepageCmsTitle != null">homepage_cms_title = #{homepageCmsTitle},</if>
|
||||
<if test="homepageProjectTitle != null">homepage_project_title = #{homepageProjectTitle},</if>
|
||||
<if test="homepageMemberTitle != null">homepage_member_title = #{homepageMemberTitle},</if>
|
||||
<if test="homepagePartnersTitle != null">homepage_partners_title = #{homepagePartnersTitle},</if>
|
||||
<if test="template != null">template = #{template},</if>
|
||||
<if test="helperShow != null">helper_show = #{helperShow},</if>
|
||||
<if test="helperTitle != null">helper_title = #{helperTitle},</if>
|
||||
<if test="docNeedAudit != null">doc_need_audit = #{docNeedAudit},</if>
|
||||
<if test="resourceNeedAudit != null">resource_need_audit = #{resourceNeedAudit},</if>
|
||||
<if test="isLockCms != null">is_lock_cms = #{isLockCms},</if>
|
||||
<if test="sectionCmsShow != null">section_cms_show = #{sectionCmsShow},</if>
|
||||
<if test="sectionProjectShow != null">section_project_show = #{sectionProjectShow},</if>
|
||||
<if test="sectionMemberShow != null">section_member_show = #{sectionMemberShow},</if>
|
||||
<if test="sectionHelperShow != null">section_helper_show = #{sectionHelperShow},</if>
|
||||
<if test="sectionHomepageShow != null">section_homepage_show = #{sectionHomepageShow},</if>
|
||||
<if test="sectionResourceShow != null">section_resource_show = #{sectionResourceShow},</if>
|
||||
<if test="sectionDataSetShow != null">section_dataset_show = #{sectionDataSetShow},</if>
|
||||
<if test="sectionCmsTitle != null">section_cms_title = #{sectionCmsTitle},</if>
|
||||
<if test="sectionProjectTitle != null">section_project_title = #{sectionProjectTitle},</if>
|
||||
<if test="sectionMemberTitle != null">section_member_title = #{sectionMemberTitle},</if>
|
||||
<if test="sectionHelperTitle != null">section_helper_title = #{sectionHelperTitle},</if>
|
||||
<if test="sectionHomepageTitle != null">section_homepage_title = #{sectionHomepageTitle},</if>
|
||||
<if test="sectionResourceTitle != null">section_resource_title = #{sectionResourceTitle},</if>
|
||||
<if test="sectionDataSetTitle != null">section_dataset_title = #{sectionDataSetTitle},</if>
|
||||
</trim>
|
||||
<select id="countPUVsGroupByKey" resultType="com.microservices.zone.detail.domain.vo.ZoneDetailDataVo">
|
||||
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(zv.url, '/', 3), '/', -1) AS `key`,
|
||||
COUNT(*) AS weekPV,
|
||||
COUNT(DISTINCT uuid) AS weekUV
|
||||
FROM zone_visits as zv
|
||||
left JOIN
|
||||
zone_detail d ON SUBSTRING_INDEX(SUBSTRING_INDEX(zv.url, '/', 3), '/', -1) = d.key
|
||||
WHERE d.key = #{key} and zv.create_time >= #{createTimeS}
|
||||
and zv.create_time <= #{createTimeE}
|
||||
GROUP BY SUBSTRING_INDEX(SUBSTRING_INDEX(zv.url, '/', 3), '/', -1)
|
||||
</select>
|
||||
|
||||
<insert id="insertZoneDetail" parameterType="ZoneDetail" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into zone_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="key != null and key != ''">`key`,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="mainTitle != null">main_title,</if>
|
||||
<if test="subTitle != null">sub_title,</if>
|
||||
<if test="firstTitle != null">first_title,</if>
|
||||
<if test="bannerList != null">banner_list,</if>
|
||||
<if test="introductionTitle != null">introduction_title,</if>
|
||||
<if test="introductionContent != null">introduction_content,</if>
|
||||
<if test="introductionImage != null">introduction_image,</if>
|
||||
<if test="homepageMembershipSize != null">homepage_membership_size,</if>
|
||||
<if test="homepageCmsSize != null">homepage_cms_size,</if>
|
||||
<if test="homepageProjectSize != null">homepage_project_size,</if>
|
||||
<if test="cmsProjectId != null">cms_project_id,</if>
|
||||
<if test="gitlinkProjectKeys != null">gitlink_project_keys,</if>
|
||||
<if test="cmsShow != null">cms_show,</if>
|
||||
<if test="projectShow != null">project_show,</if>
|
||||
<if test="memberShow != null">member_show,</if>
|
||||
<if test="partnersShow != null">partners_show,</if>
|
||||
<if test="specialProjectShow != null">special_project_show,</if>
|
||||
<if test="homepageSpecialProjectTitle != null">homepage_special_project_title,</if>
|
||||
<if test="resourceShow != null">resource_show,</if>
|
||||
<if test="homepageResourceTitle != null">homepage_resource_title,</if>
|
||||
<if test="homepageCmsTitle != null">homepage_cms_title,</if>
|
||||
<if test="homepageProjectTitle != null">homepage_project_title,</if>
|
||||
<if test="homepageMemberTitle != null">homepage_member_title,</if>
|
||||
<if test="homepagePartnersTitle != null">homepage_partners_title,</if>
|
||||
<if test="template != null">template,</if>
|
||||
<if test="helperTitle != null">helper_title,</if>
|
||||
<if test="helperShow != null">helper_show,</if>
|
||||
<if test="docNeedAudit != null">doc_need_audit,</if>
|
||||
<if test="resourceNeedAudit != null">resource_need_audit,</if>
|
||||
<if test="isLockCms != null">is_lock_cms,</if>
|
||||
<if test="sectionCmsShow != null">section_cms_show,</if>
|
||||
<if test="sectionProjectShow != null">section_project_show,</if>
|
||||
<if test="sectionMemberShow != null">section_member_show,</if>
|
||||
<if test="sectionHelperShow != null">section_helper_show,</if>
|
||||
<if test="sectionHomepageShow != null">section_homepage_show,</if>
|
||||
<if test="sectionResourceShow != null">section_resource_show,</if>
|
||||
<if test="sectionDataSetShow != null">section_dataset_show,</if>
|
||||
<if test="sectionCmsTitle != null">section_cms_title,</if>
|
||||
<if test="sectionProjectTitle != null">section_project_title,</if>
|
||||
<if test="sectionMemberTitle != null">section_member_title,</if>
|
||||
<if test="sectionHelperTitle != null">section_helper_title,</if>
|
||||
<if test="sectionHomepageTitle != null">section_homepage_title,</if>
|
||||
<if test="sectionResourceTitle != null">section_resource_title,</if>
|
||||
<if test="sectionDataSetTitle != null">section_dataset_title,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="key != null and key != ''">#{key},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="mainTitle != null">#{mainTitle},</if>
|
||||
<if test="subTitle != null">#{subTitle},</if>
|
||||
<if test="firstTitle != null">#{firstTitle},</if>
|
||||
<if test="bannerList != null">#{bannerList},</if>
|
||||
<if test="introductionTitle != null">#{introductionTitle},</if>
|
||||
<if test="introductionContent != null">#{introductionContent},</if>
|
||||
<if test="introductionImage != null">#{introductionImage},</if>
|
||||
<if test="homepageMembershipSize != null">#{homepageMembershipSize},</if>
|
||||
<if test="homepageCmsSize != null">#{homepageCmsSize},</if>
|
||||
<if test="homepageProjectSize != null">#{homepageProjectSize},</if>
|
||||
<if test="cmsProjectId != null">#{cmsProjectId},</if>
|
||||
<if test="gitlinkProjectKeys != null">#{gitlinkProjectKeys},</if>
|
||||
<if test="cmsShow != null">#{cmsShow},</if>
|
||||
<if test="projectShow != null">#{projectShow},</if>
|
||||
<if test="memberShow != null">#{memberShow},</if>
|
||||
<if test="partnersShow != null">#{partnersShow},</if>
|
||||
<if test="specialProjectShow != null">#{specialProjectShow},</if>
|
||||
<if test="homepageSpecialProjectTitle != null">#{homepageSpecialProjectTitle},</if>
|
||||
<if test="resourceShow != null">#{resourceShow},</if>
|
||||
<if test="homepageResourceTitle != null">#{homepageResourceTitle},</if>
|
||||
<if test="homepageCmsTitle != null">#{homepageCmsTitle},</if>
|
||||
<if test="homepageProjectTitle != null">#{homepageProjectTitle},</if>
|
||||
<if test="homepageMemberTitle != null">#{homepageMemberTitle},</if>
|
||||
<if test="homepagePartnersTitle != null">#{homepagePartnersTitle},</if>
|
||||
<if test="template != null">#{template},</if>
|
||||
<if test="helperTitle != null">#{helperTitle},</if>
|
||||
<if test="helperShow != null">#{helperShow},</if>
|
||||
<if test="docNeedAudit != null">#{docNeedAudit},</if>
|
||||
<if test="resourceNeedAudit != null">#{resourceNeedAudit},</if>
|
||||
<if test="isLockCms != null">#{isLockCms},</if>
|
||||
<if test="sectionCmsShow != null">#{sectionCmsShow},</if>
|
||||
<if test="sectionProjectShow != null">#{sectionProjectShow},</if>
|
||||
<if test="sectionMemberShow != null">#{sectionMemberShow},</if>
|
||||
<if test="sectionHelperShow != null">#{sectionHelperShow},</if>
|
||||
<if test="sectionHomepageShow != null">#{sectionHomepageShow},</if>
|
||||
<if test="sectionResourceShow != null">#{sectionResourceShow},</if>
|
||||
<if test="sectionDataSetShow != null">#{sectionDataSetShow},</if>
|
||||
<if test="sectionCmsTitle != null">#{sectionCmsTitle},</if>
|
||||
<if test="sectionProjectTitle != null">#{sectionProjectTitle},</if>
|
||||
<if test="sectionMemberTitle != null">#{sectionMemberTitle},</if>
|
||||
<if test="sectionHelperTitle != null">#{sectionHelperTitle},</if>
|
||||
<if test="sectionHomepageTitle != null">#{sectionHomepageTitle},</if>
|
||||
<if test="sectionResourceTitle != null">#{sectionResourceTitle},</if>
|
||||
<if test="sectionDataSetTitle != null">#{sectionDataSetTitle},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateZoneDetail" parameterType="ZoneDetail">
|
||||
update zone_detail
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="key != null and key != ''">`key` = #{key},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="mainTitle != null">main_title = #{mainTitle},</if>
|
||||
<if test="subTitle != null">sub_title = #{subTitle},</if>
|
||||
<if test="firstTitle != null">first_title = #{firstTitle},</if>
|
||||
<if test="bannerList != null">banner_list = #{bannerList},</if>
|
||||
<if test="introductionTitle != null">introduction_title = #{introductionTitle},</if>
|
||||
<if test="introductionContent != null">introduction_content = #{introductionContent},</if>
|
||||
<if test="introductionImage != null">introduction_image = #{introductionImage},</if>
|
||||
<if test="homepageMembershipSize != null">homepage_membership_size = #{homepageMembershipSize},</if>
|
||||
<if test="homepageCmsSize != null">homepage_cms_size = #{homepageCmsSize},</if>
|
||||
<if test="homepageProjectSize != null">homepage_project_size = #{homepageProjectSize},</if>
|
||||
<if test="cmsProjectId != null">cms_project_id = #{cmsProjectId},</if>
|
||||
<if test="gitlinkProjectKeys != null">gitlink_project_keys = #{gitlinkProjectKeys},</if>
|
||||
<if test="isPublish != null">is_publish = #{isPublish},</if>
|
||||
<if test="cmsShow != null">cms_show = #{cmsShow},</if>
|
||||
<if test="projectShow != null">project_show = #{projectShow},</if>
|
||||
<if test="memberShow != null">member_show = #{memberShow},</if>
|
||||
<if test="partnersShow != null">partners_show = #{partnersShow},</if>
|
||||
<if test="specialProjectShow != null">special_project_show = #{specialProjectShow},</if>
|
||||
<if test="homepageSpecialProjectTitle != null">homepage_special_project_title =
|
||||
#{homepageSpecialProjectTitle},
|
||||
</if>
|
||||
<if test="resourceShow != null">resource_show = #{resourceShow},</if>
|
||||
<if test="homepageResourceTitle != null">homepage_resource_title =
|
||||
#{homepageResourceTitle},
|
||||
</if>
|
||||
<if test="homepageCmsTitle != null">homepage_cms_title = #{homepageCmsTitle},</if>
|
||||
<if test="homepageProjectTitle != null">homepage_project_title = #{homepageProjectTitle},</if>
|
||||
<if test="homepageMemberTitle != null">homepage_member_title = #{homepageMemberTitle},</if>
|
||||
<if test="homepagePartnersTitle != null">homepage_partners_title = #{homepagePartnersTitle},</if>
|
||||
<if test="template != null">template = #{template},</if>
|
||||
<if test="helperShow != null">helper_show = #{helperShow},</if>
|
||||
<if test="helperTitle != null">helper_title = #{helperTitle},</if>
|
||||
<if test="docNeedAudit != null">doc_need_audit = #{docNeedAudit},</if>
|
||||
<if test="resourceNeedAudit != null">resource_need_audit = #{resourceNeedAudit},</if>
|
||||
<if test="isLockCms != null">is_lock_cms = #{isLockCms},</if>
|
||||
<if test="sectionCmsShow != null">section_cms_show = #{sectionCmsShow},</if>
|
||||
<if test="sectionProjectShow != null">section_project_show = #{sectionProjectShow},</if>
|
||||
<if test="sectionMemberShow != null">section_member_show = #{sectionMemberShow},</if>
|
||||
<if test="sectionHelperShow != null">section_helper_show = #{sectionHelperShow},</if>
|
||||
<if test="sectionHomepageShow != null">section_homepage_show = #{sectionHomepageShow},</if>
|
||||
<if test="sectionResourceShow != null">section_resource_show = #{sectionResourceShow},</if>
|
||||
<if test="sectionDataSetShow != null">section_dataset_show = #{sectionDataSetShow},</if>
|
||||
<if test="sectionCmsTitle != null">section_cms_title = #{sectionCmsTitle},</if>
|
||||
<if test="sectionProjectTitle != null">section_project_title = #{sectionProjectTitle},</if>
|
||||
<if test="sectionMemberTitle != null">section_member_title = #{sectionMemberTitle},</if>
|
||||
<if test="sectionHelperTitle != null">section_helper_title = #{sectionHelperTitle},</if>
|
||||
<if test="sectionHomepageTitle != null">section_homepage_title = #{sectionHomepageTitle},</if>
|
||||
<if test="sectionResourceTitle != null">section_resource_title = #{sectionResourceTitle},</if>
|
||||
<if test="sectionDataSetTitle != null">section_dataset_title = #{sectionDataSetTitle},</if>
|
||||
</trim>
|
||||
|
||||
|
||||
where id = #{id}
|
||||
</update>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteZoneDetailById" parameterType="Long">
|
||||
delete
|
||||
from zone_detail
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteZoneDetailById" parameterType="Long">
|
||||
delete
|
||||
from zone_detail
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteZoneDetailByIds" parameterType="String">
|
||||
delete from zone_detail where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
<delete id="deleteZoneDetailByIds" parameterType="String">
|
||||
delete from zone_detail where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue