@Override public List<AssemblyVO> getAssembliesAtAppEnvByStatus( int appId, AppEnvEnum appEnvEnum, IntegrationStatusEnum integrationStatus) { List<AssemblyDO> dos = new ArrayList<>(); switch (appEnvEnum) { case DEV: dos = assemblyDOMapper.selectAssembliesInDev(appId, integrationStatus.getDescription()); break; case TEST: dos = assemblyDOMapper.selectAssembliesInTest(appId, integrationStatus.getDescription()); break; case PRE: dos = assemblyDOMapper.selectAssembliesInPre(appId, integrationStatus.getDescription()); break; case PRD: dos = assemblyDOMapper.selectAssembliesInPrd( appId, IntegrationStatusEnum.TOPUBLISH.getDescription()); break; } List<AssemblyVO> vos = new ArrayList<AssemblyVO>(); for (AssemblyDO dO : dos) { AssemblyVO vo = BaseConvertor.convert(dO, AssemblyVO.class); loadAssemblyUsers(vo); vo.setGmtPlanToPublish(DateUtil.formatDateOnly(dO.getGmtPlanToPublish())); switch (appEnvEnum) { case DEV: if (dO.getCodeReviewer() == null) { vo.setCodeReviewer(""); } if (dO.getSelfTester() == null) { vo.setSelfTester(""); } vo.setGmtCodeReview(DateUtil.formatDateTime(dO.getGmtCodeReview())); vo.setGmtSelfTest(DateUtil.formatDateTime(dO.getGmtSelfTest())); break; case TEST: if (dO.getTestEnvTester() == null) { vo.setTestEnvTester(""); } if (dO.getPublishAssessor() == null) { vo.setPublishAssessor(""); } vo.setGmtTestVerify(DateUtil.formatDateTime(dO.getGmtTestVerify())); vo.setGmtRiskSubmit(DateUtil.formatDateTime(dO.getGmtRiskSubmit())); vo.setGmtPublishAssessment(DateUtil.formatDateTime(dO.getGmtPublishAssessment())); break; case PRE: if (dO.getPreEnvTester() == null) { vo.setPreEnvTester(""); } vo.setGmtPreVerify(DateUtil.formatDateTime(dO.getGmtPreVerify())); break; default: break; } vos.add(vo); } return vos; }
@Override public List<AssemblyVO> searchTestingAssembliesByAppName(String appName, Page page) { List<AssemblyDO> dos = assemblyDOMapper.searchTestingAssembliesByAppName(appName, page); if (page != null) { page.setSearchedRecords(assemblyDOMapper.countTestingAssembliesByAppName(appName)); } return convert2AssemblyVOs(dos); }
@Override public List<AssemblyVO> searchPublishedAssembliesByAppName(String appName, Page page) { List<AssemblyVO> vos = new ArrayList<>(); List<AssemblyDO> dos = assemblyDOMapper.searchAssembliesPublishedByAppName(appName, page); if (page != null) { page.setSearchedRecords(assemblyDOMapper.countAssembliesPublishedByAppName(appName)); } return convertPublishedAssemblyDOs2VOs(dos); }
@Override public List<AssemblyVO> getTestingAssemblies(Page page) { List<AssemblyDO> dos = assemblyDOMapper.selectTestingAssemblies(page); if (page != null) { int records = assemblyDOMapper.countTestingAssemblies(); page.setTotalRecords(records); page.setSearchedRecords(records); } return convert2AssemblyVOs(dos); }
@Override public List<AssemblyVO> getPublishedAssemblies(Page page) { List<AssemblyVO> vos = new ArrayList<>(); List<AssemblyDO> dos = assemblyDOMapper.selectAssembliesPublished(page); if (page != null) { int records = assemblyDOMapper.countAssembliesPublished(); page.setTotalRecords(records); page.setSearchedRecords(records); } return convertPublishedAssemblyDOs2VOs(dos); }
@Override public boolean changeAssemblyStatus( List<Integer> assemblyId, AppEnvEnum appEnvEnum, IntegrationStatusEnum integrationStatus) { List<AssemblyDO> dos = new ArrayList<AssemblyDO>(); for (int id : assemblyId) { AssemblyDO dO = new AssemblyDO(); dO.setAssemblyId(id); switch (appEnvEnum) { case DEV: dO.setIntegrationStatusDev(integrationStatus.getDescription()); break; case TEST: dO.setIntegrationStatusTest(integrationStatus.getDescription()); break; case PRE: dO.setIntegrationStatusPre(integrationStatus.getDescription()); break; case PRD: dO.setIntegrationStatusPrd(integrationStatus.getDescription()); if (IntegrationStatusEnum.PUBLISHED == integrationStatus) { dO.setGmtActualPublish(new Date()); } break; } dos.add(dO); } int count = assemblyDOMapper.updateBatch(dos); return count > 0 ? true : false; }
@Override public boolean addAssembly(AssemblyVO assemblyVO) { AssemblyDO dO = BaseConvertor.convert(assemblyVO, AssemblyDO.class); String date = assemblyVO.getGmtPlanToPublish(); dO.setGmtPlanToPublish(DateUtil.parseDateOnly(date)); int count = assemblyDOMapper.insertSelective(dO); assemblyVO.setAssemblyId(dO.getAssemblyId()); return count > 0 ? true : false; }
@Override public boolean removeAssemblyAndRelatedUsers(int assemblyId) { int count = assemblyUserCfgDOMapper.deleteUsersByAssemblyId(assemblyId); if (count > 0) { count = assemblyDOMapper.deleteByPrimaryKey(assemblyId); return count > 0 ? true : false; } else { return false; } }
@Override public boolean removeBatchAssemblyAndRelatedUsers(List<Integer> assemblyIds) { int count = assemblyUserCfgDOMapper.deleteUsersByAssemblyIds(assemblyIds); if (count > 0) { count = assemblyDOMapper.deleteBatch(assemblyIds); return count > 0 ? true : false; } else { return false; } }
@Override public List<AssemblyVO> getAssembliesByPrjId(int prjId) { List<AssemblyDO> dos = assemblyDOMapper.selectByPrjId(prjId); return convert2AssemblyVOs(dos); }
@Override public Integer getAssessmentIdForAssembly(int assemblyId) { Integer assessmentId = assemblyDOMapper.selectAssessmentId(assemblyId); return assessmentId; }
@Override public boolean updateAssembly(AssemblyDO assemblyDO) { int count = assemblyDOMapper.updateByPrimaryKeySelective(assemblyDO); return count > 0 ? true : false; }
@Override public AssemblyDO getBranchNameAndGitLinkByAssemblyId(Integer assemblyId) { return assemblyDOMapper.selectBranchNameNGitLinkByAssemblyId(assemblyId); }
@Override public boolean isPrjDone(int assemblyId) { int count = assemblyDOMapper.countNotPublishedPrjsForSpecificAssembly(assemblyId); return count == 0 ? true : false; }
@Override public boolean resetAssemblyStatus(Integer assemblyId) { int count = assemblyDOMapper.reset(assemblyId); return count > 0 ? true : false; }
@Override public List<AssemblyVO> getAssembliesForUserInPrj(int userId, int prjId) { List<Integer> ids = assemblyUserCfgDOMapper.selectAssemblyIdsForUserInPrj(userId, prjId); List<AssemblyDO> dos = assemblyDOMapper.selectByAssemblyIdList(ids); return convert2AssemblyVOs(dos); }
@Override public List<Integer> getAssemblyIdsByPrjId(int prjId) { return assemblyDOMapper.selectAssemblyIdsByPrjId(prjId); }
@Override public Integer getPrjIdByAssemblyId(Integer assemblyId) { return assemblyDOMapper.selectPrjIdByAssemblyId(assemblyId); }
@Override public List<Integer> getPrjIdsByAssemblyIds(List<Integer> assemblyIds) { return assemblyDOMapper.selectPrjIdsByAssemblyIds(assemblyIds); }
@Override public List<Integer> getAssociatedAppsInAssembliesByPrjId(int prjId) { return assemblyDOMapper.selectAppIdsByPrjId(prjId); }
@Override public List<AssemblyDO> getBranchNamesAndGitLinksByAssemblyIds(List<Integer> assemblyIds) { return assemblyDOMapper.selectBranchNamesNGitLinksByAssemblyIds(assemblyIds); }
@Override public AssemblyDO getAssemblyById(int assemblyId) { return assemblyDOMapper.selectByPrimaryKey(assemblyId); }