use of com.netsteadfast.greenstep.vo.DegreeFeedbackScoreVO in project bamboobsc by billchen198318.
the class DegreeFeedbackLogicServiceImpl method updateScore.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DegreeFeedbackProjectVO> updateScore(String projectOid, String ownerEmployeeOid, String raterEmployeeOid, List<DegreeFeedbackScoreVO> scores) throws ServiceException, Exception {
if (super.isBlank(projectOid) || super.isNoSelectId(ownerEmployeeOid) || super.isBlank(raterEmployeeOid) || null == scores || scores.size() < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DegreeFeedbackProjectVO project = new DegreeFeedbackProjectVO();
project.setOid(projectOid);
DefaultResult<DegreeFeedbackProjectVO> projectResult = this.degreeFeedbackProjectService.findObjectByOid(project);
if (projectResult.getValue() == null) {
throw new ServiceException(projectResult.getSystemMessage().getValue());
}
project = projectResult.getValue();
DefaultResult<DegreeFeedbackProjectVO> result = new DefaultResult<DegreeFeedbackProjectVO>();
BbEmployee rater = this.getEmployeeService().findByAccountOid(raterEmployeeOid);
if (null == rater || super.isBlank(rater.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
BbEmployee owner = this.getEmployeeService().findByPKng(ownerEmployeeOid);
if (null == owner || super.isBlank(owner.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST));
}
DegreeFeedbackAssignVO assign = this.findAssign(projectOid, rater.getEmpId(), owner.getEmpId());
this.deleteScoreWithAssign(project, assign);
Map<String, Object> paramMap = new HashMap<String, Object>();
for (DegreeFeedbackScoreVO score : scores) {
paramMap.put("oid", score.getItemOid());
if (this.degreeFeedbackItemService.countByParams(paramMap) != 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST));
}
score.setAssignOid(assign.getOid());
super.setStringValueMaxLength(score, "memo", MAX_DESCRIPTION_OR_MEMO_LENGTH);
DefaultResult<DegreeFeedbackScoreVO> insertResult = this.degreeFeedbackScoreService.saveObject(score);
if (insertResult.getValue() == null) {
throw new ServiceException(insertResult.getSystemMessage().getValue());
}
result.setSystemMessage(insertResult.getSystemMessage());
}
paramMap.clear();
paramMap = null;
result.setValue(project);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
return result;
}
use of com.netsteadfast.greenstep.vo.DegreeFeedbackScoreVO in project bamboobsc by billchen198318.
the class DegreeFeedbackProjectScoreSaveOrUpdateAction method fillScores.
private List<DegreeFeedbackScoreVO> fillScores() throws Exception {
List<DegreeFeedbackScoreVO> scores = new ArrayList<DegreeFeedbackScoreVO>();
Map<String, List<Map<String, Object>>> dataMap = this.fillJsonData(this.getFields().get("scoreData"));
List<Map<String, Object>> nodes = dataMap.get("data");
for (Map<String, Object> node : nodes) {
String name = String.valueOf(node.get("name"));
if (StringUtils.isBlank(name)) {
logger.warn("BSC_PROG005D0003Q_RADIO name is blank.");
continue;
}
// BSC_PROG005D0003Q_RADIO:<s:property value="project.oid"/>:<s:property value="items[#st1.index].oid"/>
String[] tmp = name.split(":");
if (tmp.length != 3) {
logger.warn("BSC_PROG005D0003Q_RADIO name is error: " + name);
continue;
}
DegreeFeedbackScoreVO scoreObj = new DegreeFeedbackScoreVO();
scoreObj.setProjectOid(this.getFields().get("projectOid"));
scoreObj.setItemOid(tmp[2]);
scoreObj.setScore(NumberUtils.toInt(String.valueOf(node.get("value")), 0));
scoreObj.setMemo(String.valueOf(node.get("memo")));
scores.add(scoreObj);
}
return scores;
}
Aggregations