Search in sources :

Example 1 with DegreeFeedbackAssignVO

use of com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO in project bamboobsc by billchen198318.

the class DegreeFeedbackProjectScoreSaveOrUpdateAction method fetchScores.

private void fetchScores() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields("fetch");
    BbEmployee rater = this.employeeService.findByAccountOid(this.getAccountOid());
    if (null == rater || StringUtils.isBlank(rater.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    BbEmployee owner = this.employeeService.findByPKng(this.getFields().get("ownerOid"));
    if (null == owner || StringUtils.isBlank(owner.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST));
    }
    String projectOid = this.getFields().get("projectOid");
    DegreeFeedbackAssignVO assing = new DegreeFeedbackAssignVO();
    assing.setProjectOid(projectOid);
    assing.setOwnerId(owner.getEmpId());
    assing.setRaterId(rater.getEmpId());
    DefaultResult<DegreeFeedbackAssignVO> result = this.degreeFeedbackAssignService.findByUK(assing);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    assing = result.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("assignOid", assing.getOid());
    paramMap.put("projectOid", projectOid);
    this.projectScores = this.degreeFeedbackScoreService.findListVOByParams(paramMap);
    paramMap.clear();
    paramMap.put("projectOid", projectOid);
    this.projectLevels = this.degreeFeedbackLevelService.findListVOByParams(paramMap);
    paramMap.clear();
    BbDegreeFeedbackLevel minLevel = this.degreeFeedbackLevelService.findForMinByProject(projectOid);
    if (minLevel != null) {
        this.minLevelOid = minLevel.getOid();
    }
    this.success = IS_YES;
}
Also used : BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) DegreeFeedbackAssignVO(com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BbDegreeFeedbackLevel(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackLevel)

Example 2 with DegreeFeedbackAssignVO

use of com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method findAssign.

private DegreeFeedbackAssignVO findAssign(String projectOid, String raterId, String ownerId) throws ServiceException, Exception {
    DegreeFeedbackAssignVO assing = new DegreeFeedbackAssignVO();
    assing.setProjectOid(projectOid);
    assing.setOwnerId(ownerId);
    assing.setRaterId(raterId);
    DefaultResult<DegreeFeedbackAssignVO> result = this.degreeFeedbackAssignService.findByUK(assing);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    return result.getValue();
}
Also used : DegreeFeedbackAssignVO(com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 3 with DegreeFeedbackAssignVO

use of com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO 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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) HashMap(java.util.HashMap) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) DegreeFeedbackAssignVO(com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DegreeFeedbackScoreVO(com.netsteadfast.greenstep.vo.DegreeFeedbackScoreVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) DegreeFeedbackProjectVO(com.netsteadfast.greenstep.vo.DegreeFeedbackProjectVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DegreeFeedbackAssignVO

use of com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method createAssign.

private void createAssign(DegreeFeedbackProjectVO project, List<String> ownerEmplOids, List<String> raterEmplOids) throws ServiceException, Exception {
    Map<String, EmployeeVO> tmpBag = new HashMap<String, EmployeeVO>();
    for (String ownerOid : ownerEmplOids) {
        EmployeeVO owner = this.fetchEmployee(ownerOid, tmpBag);
        for (String raterOid : raterEmplOids) {
            EmployeeVO rater = this.fetchEmployee(raterOid, tmpBag);
            DegreeFeedbackAssignVO assign = new DegreeFeedbackAssignVO();
            assign.setProjectOid(project.getOid());
            assign.setOwnerId(owner.getEmpId());
            assign.setRaterId(rater.getEmpId());
            this.degreeFeedbackAssignService.saveObject(assign);
        }
    }
    tmpBag.clear();
    tmpBag = null;
}
Also used : DegreeFeedbackAssignVO(com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) HashMap(java.util.HashMap)

Aggregations

DegreeFeedbackAssignVO (com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO)4 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 HashMap (java.util.HashMap)3 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)2 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)1 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)1 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 BbDegreeFeedbackLevel (com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackLevel)1 DegreeFeedbackProjectVO (com.netsteadfast.greenstep.vo.DegreeFeedbackProjectVO)1 DegreeFeedbackScoreVO (com.netsteadfast.greenstep.vo.DegreeFeedbackScoreVO)1 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)1 LinkedHashMap (java.util.LinkedHashMap)1 Transactional (org.springframework.transaction.annotation.Transactional)1