Search in sources :

Example 1 with LowQualityRank

use of com.ibeiliao.deployment.admin.vo.stat.LowQualityRank in project Corgi by kevinYin.

the class DeployHistoryDaoTest method testStatLowQualityModule.

/**
 * 仅测试语法,不测试逻辑
 */
@Test
public void testStatLowQualityModule() {
    Date startTime = DateUtil.currentStartDate();
    Date endTime = DateUtil.currentEndDate();
    int[] envId = { 1 };
    String envStr = StringUtils.join(envId, ",");
    List<LowQualityRank> ranks = deployHistoryDao.statLowQualityModule(startTime, endTime, envStr, DeployStatus.DEPLOYED.getValue(), DeployResult.SUCCESS.getValue(), Constants.LOW_QUALITY_DEPLOY_TIMES);
    assertNotNull(ranks);
}
Also used : LowQualityRank(com.ibeiliao.deployment.admin.vo.stat.LowQualityRank) Date(java.util.Date) Test(org.junit.Test)

Example 2 with LowQualityRank

use of com.ibeiliao.deployment.admin.vo.stat.LowQualityRank in project Corgi by kevinYin.

the class StatServiceImpl method statLowQualityModule.

private void statLowQualityModule(Date startTime, Date endTime) {
    List<LowQualityRank> lowQualityRanks = deployHistoryService.statLowQualityModule(startTime, endTime);
    if (lowQualityRanks.isEmpty()) {
        logger.warn("没有发布数据");
        return;
    }
    List<LowQualityRankPO> list = new ArrayList<>(lowQualityRanks.size());
    for (LowQualityRank rank : lowQualityRanks) {
        LowQualityRankPO po = new LowQualityRankPO();
        po.setModuleId(rank.getModuleId());
        po.setDeployTimes(rank.getDeployTimes());
        po.setStatDate(startTime);
    }
    lowQualityRankDao.deleteByDate(startTime);
    lowQualityRankDao.batchInsertOrUpdate(list);
}
Also used : LowQualityRankPO(com.ibeiliao.deployment.admin.po.stat.LowQualityRankPO) LowQualityRank(com.ibeiliao.deployment.admin.vo.stat.LowQualityRank)

Example 3 with LowQualityRank

use of com.ibeiliao.deployment.admin.vo.stat.LowQualityRank in project Corgi by kevinYin.

the class DeployHistoryServiceImpl method statLowQualityModule.

@Override
public List<LowQualityRank> statLowQualityModule(@Param("startTime") Date startTime, @Param("endTime") Date endTime) {
    List<ProjectEnv> envs = projectEnvService.findAllEnv();
    List<Integer> onlineEnvs = new ArrayList<>(envs.size());
    for (ProjectEnv env : envs) {
        if (env.getOnlineFlag() == Constants.TRUE) {
            onlineEnvs.add(env.getEnvId());
        }
    }
    if (onlineEnvs.isEmpty()) {
        return Collections.emptyList();
    }
    String env = StringUtils.join(onlineEnvs, ",");
    List<LowQualityRank> ranks = deployHistoryDao.statLowQualityModule(startTime, endTime, env, DeployStatus.DEPLOYED.getValue(), DeployResult.SUCCESS.getValue(), Constants.LOW_QUALITY_DEPLOY_TIMES);
    return ranks;
}
Also used : LowQualityRank(com.ibeiliao.deployment.admin.vo.stat.LowQualityRank) ProjectEnv(com.ibeiliao.deployment.admin.vo.global.ProjectEnv)

Aggregations

LowQualityRank (com.ibeiliao.deployment.admin.vo.stat.LowQualityRank)3 LowQualityRankPO (com.ibeiliao.deployment.admin.po.stat.LowQualityRankPO)1 ProjectEnv (com.ibeiliao.deployment.admin.vo.global.ProjectEnv)1 Date (java.util.Date)1 Test (org.junit.Test)1