use of com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO in project bamboobsc by billchen198318.
the class DegreeFeedbackLogicServiceImpl method createItems.
private void createItems(DegreeFeedbackProjectVO project, List<DegreeFeedbackItemVO> items) throws ServiceException, Exception {
for (DegreeFeedbackItemVO item : items) {
if (super.isBlank(item.getName())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
item.setProjectOid(project.getOid());
super.setStringValueMaxLength(item, "description", MAX_DESCRIPTION_OR_MEMO_LENGTH);
this.degreeFeedbackItemService.saveObject(item);
}
}
use of com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO in project bamboobsc by billchen198318.
the class DegreeFeedbackProjectSaveOrUpdateAction method fillItems.
private List<DegreeFeedbackItemVO> fillItems() throws Exception {
List<DegreeFeedbackItemVO> items = new ArrayList<DegreeFeedbackItemVO>();
Map<String, List<Map<String, Object>>> dataMap = this.fillJsonData(this.getFields().get("itemData"));
List<Map<String, Object>> nodes = dataMap.get("data");
for (Map<String, Object> node : nodes) {
DegreeFeedbackItemVO obj = new DegreeFeedbackItemVO();
obj.setName(String.valueOf(node.get("name")));
obj.setDescription(String.valueOf(node.get("description")));
items.add(obj);
}
return items;
}
use of com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO in project bamboobsc by billchen198318.
the class DegreeFeedbackScoreCalculateUtils method getProjectScore.
public static DegreeFeedbackProjectVO getProjectScore(String projectOid, String ownerEmployeeOid) throws ServiceException, Exception {
DegreeFeedbackProjectVO project = new DegreeFeedbackProjectVO();
project.setOid(projectOid);
DefaultResult<DegreeFeedbackProjectVO> projectResult = degreeFeedbackProjectService.findObjectByOid(project);
if (projectResult.getValue() == null) {
throw new ServiceException(projectResult.getSystemMessage().getValue());
}
project = projectResult.getValue();
EmployeeVO employee = new EmployeeVO();
employee.setOid(ownerEmployeeOid);
DefaultResult<EmployeeVO> empResult = employeeService.findObjectByOid(employee);
if (empResult.getValue() == null) {
throw new ServiceException(empResult.getSystemMessage().getValue());
}
employee = empResult.getValue();
List<DegreeFeedbackItemVO> items = getItemsScore(project, employee);
if (items != null && items.size() > 0) {
project.setEmployee(employee);
project.setItems(items);
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("projectOid", project.getOid());
Map<String, String> orderMap = new HashMap<String, String>();
orderMap.put("value", "asc");
List<BbDegreeFeedbackLevel> levels = degreeFeedbackLevelService.findListByParams(paramMap, null, orderMap);
project.setLevels(wrapLevels(levels));
}
return project;
}
use of com.netsteadfast.greenstep.vo.DegreeFeedbackItemVO 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;
}
Aggregations