Search in sources :

Example 91 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method createItems.

private void createItems(PdcaVO pdca, List<PdcaItemVO> items) throws ServiceException, Exception {
    for (PdcaItemVO itemObj : items) {
        itemObj.setPdcaOid(pdca.getOid());
        this.setStringValueMaxLength(itemObj, "description", MAX_DESCRIPTION_LENGTH);
        this.replaceSplit2Blank(itemObj, "startDate", "/");
        this.replaceSplit2Blank(itemObj, "endDate", "/");
        DefaultResult<PdcaItemVO> result = this.pdcaItemService.saveObject(itemObj);
        if (result.getValue() == null) {
            throw new ServiceException(result.getSystemMessage().getValue());
        }
        PdcaItemVO item = result.getValue();
        item.setEmployeeOids(itemObj.getEmployeeOids());
        item.setUploadOids(itemObj.getUploadOids());
        this.createItemOwner(item);
        this.createItemDocuments(item);
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO)

Example 92 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method createKpis.

private void createKpis(PdcaVO pdca, List<String> kpiOids) throws ServiceException, Exception {
    for (String oid : kpiOids) {
        KpiVO kpi = new KpiVO();
        kpi.setOid(oid);
        DefaultResult<KpiVO> kpiResult = this.kpiService.findObjectByOid(kpi);
        if (kpiResult.getValue() == null) {
            throw new ServiceException(kpiResult.getSystemMessage().getValue());
        }
        kpi = kpiResult.getValue();
        if (!YesNo.YES.equals(kpi.getActivate())) {
            // 在打開 KPI-tree 選取時還是 ACTIVATE = 'Y' , 然後故意的去KPI修改, 把 ACTIVATE 設定為'N' , 所以要檢查是否正確
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
        }
        PdcaKpisVO pdcaKpi = new PdcaKpisVO();
        pdcaKpi.setPdcaOid(pdca.getOid());
        pdcaKpi.setKpiId(kpi.getId());
        this.pdcaKpisService.saveObject(pdcaKpi);
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PdcaKpisVO(com.netsteadfast.greenstep.vo.PdcaKpisVO)

Example 93 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException 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 94 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException 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 95 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class EmployeeLogicServiceImpl method updatePassword.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<AccountVO> updatePassword(EmployeeVO employee, String newPassword) throws ServiceException, Exception {
    if (employee == null || super.isBlank(employee.getOid()) || super.isBlank(employee.getPassword()) || super.isBlank(newPassword)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    EmployeeVO dbEmployee = this.findEmployeeData(employee.getOid());
    AccountVO account = this.findAccountData(dbEmployee.getAccount());
    if (!account.getPassword().equals(this.getAccountService().tranPassword(employee.getPassword()))) {
        throw new ServiceException("The current password(old password) is incorrect!");
    }
    account.setPassword(this.getAccountService().tranPassword(newPassword));
    return getAccountService().updateObject(account);
}
Also used : EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AccountVO(com.netsteadfast.greenstep.vo.AccountVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)291 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)91 Transactional (org.springframework.transaction.annotation.Transactional)89 HashMap (java.util.HashMap)65 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)49 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)48 SysVO (com.netsteadfast.greenstep.vo.SysVO)30 IOException (java.io.IOException)24 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)20 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)19 List (java.util.List)19 Map (java.util.Map)19 ArrayList (java.util.ArrayList)17 LinkedHashMap (java.util.LinkedHashMap)17 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)16 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)15 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)15 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)14 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)13 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)12