/** * 更加登录信息获取项目列表 * * @param user * @return */ public List<Project> findProjectById(ShiroUser user) { // 创建list List<Project> projectList = new ArrayList<Project>(); List<Efficiency> efficiencyList = null; // 根据登录人员id查询登录员工信息 Employe employe = employeDao.findOne(user.id); if (null != employe && null != employe.getIsPm() && null != employe.getIsMt()) { if (employe.getIsPm()) { projectList = projectDao.findByPmId(user.id.intValue()); } else if (!employe.getIsMt() && !employe.getIsPm()) { efficiencyList = efficiencyDao.findByEmployeId(employe.getId().intValue()); if (null != efficiencyList && efficiencyList.size() > 0) { for (Efficiency temp : efficiencyList) { if (null != temp.getProjectId()) { Project project = projectDao.findOne(temp.getProjectId().longValue()); if (null != project) { if (!projectList.contains(project)) { projectList.add(project); } } } } } } } return projectList; }
public EfficiencyProjectBo findEfficiencyProjectByProId(Long proId) { int a = 0; int b = 0; int c = 0; EfficiencyProjectBo eff_pro = new EfficiencyProjectBo(); Project pro = (Project) projectDao.findOne(proId); List<Efficiency> eff_list = null; /** beging */ if (null != pro && null != pro.getId()) { eff_list = (List<Efficiency>) efficiencyDao.findByProjectId(proId.intValue()); if (null != eff_list && eff_list.size() > 0) { for (Efficiency temp : eff_list) { if (null != temp.getPlanHours()) { a += temp.getPlanHours(); } if (null != temp.getActualHours()) { b += temp.getActualHours(); } if (null != temp.getOutputHours()) { c += temp.getOutputHours(); } } } } /** 结束 */ eff_pro.setActualHoursAll(b); eff_pro.setPlanHoursAll(a); eff_pro.setOutputHoursAll(c); eff_pro.setName(pro.getName()); eff_pro.setPm(pro.getPm()); eff_pro.setProjectPersonnel(pro.getProjectPersonnel()); eff_pro.setState(pro.getState()); eff_pro.setProId(pro.getId()); return eff_pro; }
public Project findById(int proId) { return projectDao.findOne(new Long(proId)); }