use of com.ibeiliao.deployment.admin.vo.stat.StatProjectResult in project Corgi by kevinYin.
the class StatServiceImpl method statProjectAndSave.
private void statProjectAndSave(Date startTime, Date endTime) {
List<StatProjectResult> projectResults = deployHistoryService.statProject(startTime, endTime);
Map<Integer, StatProjectPO> projectStatMap = new HashMap<>();
for (StatProjectResult spr : projectResults) {
StatProjectPO statProject = projectStatMap.get(spr.getProjectId());
if (statProject == null) {
statProject = new StatProjectPO();
statProject.setEnvId(spr.getEnvId());
statProject.setStatDate(startTime);
statProject.setProjectId(spr.getProjectId());
projectStatMap.put(spr.getProjectId(), statProject);
}
statProject.setDeployTimes(statProject.getDeployTimes() + spr.getNum());
if (spr.getResult() == DeployResult.SUCCESS.getValue()) {
statProject.setSuccess(statProject.getSuccess() + spr.getNum());
} else {
// 其他都算做失败,包括部分成功的
statProject.setFailure(statProject.getFailure() + spr.getNum());
}
}
Collection<StatProjectPO> statProjects = projectStatMap.values();
if (statProjects.isEmpty()) {
logger.warn("没有发布数据");
return;
}
statProjectDao.deleteByDate(startTime);
statProjectDao.batchInsertOrUpdate(statProjects);
saveStatAll(startTime, statProjects);
}
use of com.ibeiliao.deployment.admin.vo.stat.StatProjectResult in project Corgi by kevinYin.
the class DeployHistoryDaoTest method testStatProject.
/**
* 仅测试语法,不测试逻辑
*/
@Test
public void testStatProject() {
Date startTime = DateUtil.currentStartDate();
Date endTime = DateUtil.currentEndDate();
List<StatProjectResult> list = deployHistoryDao.statProject(startTime, endTime, DeployStatus.DEPLOYED.getValue());
assertNotNull(list);
}
Aggregations