Search in sources :

Example 1 with BbDegreeFeedbackScore

use of com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method deleteScoreWithAssign.

private void deleteScoreWithAssign(DegreeFeedbackProjectVO project, DegreeFeedbackAssignVO assign) throws ServiceException, Exception {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("projectOid", project.getOid());
    paramMap.put("assignOid", assign.getOid());
    List<BbDegreeFeedbackScore> scores = this.degreeFeedbackScoreService.findListByParams(paramMap);
    for (BbDegreeFeedbackScore score : scores) {
        this.degreeFeedbackScoreService.delete(score);
    }
}
Also used : HashMap(java.util.HashMap) BbDegreeFeedbackScore(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore)

Example 2 with BbDegreeFeedbackScore

use of com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method deleteScore.

private void deleteScore(DegreeFeedbackProjectVO project) throws ServiceException, Exception {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("projectOid", project.getOid());
    List<BbDegreeFeedbackScore> scores = this.degreeFeedbackScoreService.findListByParams(paramMap);
    for (BbDegreeFeedbackScore score : scores) {
        this.degreeFeedbackScoreService.delete(score);
    }
}
Also used : HashMap(java.util.HashMap) BbDegreeFeedbackScore(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore)

Example 3 with BbDegreeFeedbackScore

use of com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore in project bamboobsc by billchen198318.

the class DegreeFeedbackScoreCalculateUtils method setItemScoreCalculate.

private static void setItemScoreCalculate(DegreeFeedbackProjectVO project, List<DegreeFeedbackItemVO> items, List<BbDegreeFeedbackScore> scores) throws ServiceException, Exception {
    // 拿來放真的有評分的評分者數量
    List<String> assigns = new ArrayList<String>();
    for (BbDegreeFeedbackScore scoreData : scores) {
        if (!assigns.contains(scoreData.getAssignOid())) {
            assigns.add(scoreData.getAssignOid());
        }
    }
    for (DegreeFeedbackItemVO item : items) {
        int sumScore = 0;
        float avgScore = 0.0f;
        for (BbDegreeFeedbackScore scoreData : scores) {
            if (scoreData.getItemOid().equals(item.getOid())) {
                sumScore += scoreData.getScore();
            }
        }
        if (sumScore > 0 && assigns.size() > 0) {
            // 得分 = 總計/評分者				
            avgScore = Float.valueOf(sumScore) / Float.valueOf(assigns.size());
            BigDecimal bd = new BigDecimal(avgScore);
            avgScore = bd.setScale(1, BigDecimal.ROUND_HALF_UP).floatValue();
        }
        item.setSumScore(sumScore);
        item.setAvgScore(avgScore);
    }
    assigns.clear();
    assigns = null;
}
Also used : DegreeFeedbackItemVO(com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO) ArrayList(java.util.ArrayList) BbDegreeFeedbackScore(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore) BigDecimal(java.math.BigDecimal)

Example 4 with BbDegreeFeedbackScore

use of com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore in project bamboobsc by billchen198318.

the class DegreeFeedbackScoreServiceImpl method findResultsByProjectAndOwner.

@Override
public DefaultResult<List<BbDegreeFeedbackScore>> findResultsByProjectAndOwner(String projectOid, String ownerId) throws Exception {
    if (StringUtils.isBlank(projectOid) || StringUtils.isBlank(ownerId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    List<BbDegreeFeedbackScore> searchList = this.degreeFeedbackScoreDAO.findForListByProjectAndOwner(projectOid, ownerId);
    DefaultResult<List<BbDegreeFeedbackScore>> result = new DefaultResult<List<BbDegreeFeedbackScore>>();
    if (null != searchList && searchList.size() > 0) {
        result.setValue(searchList);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BbDegreeFeedbackScore(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Aggregations

BbDegreeFeedbackScore (com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackScore)4 HashMap (java.util.HashMap)2 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)1 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 DegreeFeedbackItemVO (com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO)1 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1