Search in sources :

Example 21 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class ReportRoleViewLogicServiceImpl method create.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> create(String roleOid, List<String> emplOids, List<String> orgaOids) throws ServiceException, Exception {
    if (super.isNoSelectId(roleOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    RoleVO role = new RoleVO();
    role.setOid(roleOid);
    DefaultResult<RoleVO> rResult = this.getRoleService().findObjectByOid(role);
    if (rResult.getValue() == null) {
        throw new ServiceException(rResult.getSystemMessage().getValue());
    }
    role = rResult.getValue();
    this.deleteByRole(role.getRole());
    for (int i = 0; emplOids != null && i < emplOids.size(); i++) {
        EmployeeVO employee = this.findEmployeeData(emplOids.get(i));
        this.createReportRoleView(role.getRole(), ReportRoleViewTypes.IS_EMPLOYEE, employee.getAccount());
    }
    for (int i = 0; orgaOids != null && i < orgaOids.size(); i++) {
        OrganizationVO organization = this.findOrganizationData(orgaOids.get(i));
        this.createReportRoleView(role.getRole(), ReportRoleViewTypes.IS_ORGANIZATION, organization.getOrgId());
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) RoleVO(com.netsteadfast.greenstep.vo.RoleVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 22 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class MeasureDataLogicServiceImpl method saveOrUpdate.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE, ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> saveOrUpdate(String kpiOid, String date, String frequency, String dataFor, String organizationId, String employeeId, List<MeasureDataVO> measureDatas) throws ServiceException, Exception {
    if (super.isBlank(kpiOid) || super.isBlank(date) || super.isBlank(frequency) || super.isBlank(dataFor) || super.isBlank(organizationId) || super.isBlank(employeeId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    KpiVO kpi = new KpiVO();
    kpi.setOid(kpiOid);
    DefaultResult<KpiVO> kResult = this.kpiService.findObjectByOid(kpi);
    if (kResult.getValue() == null) {
        throw new ServiceException(kResult.getSystemMessage().getValue());
    }
    kpi = kResult.getValue();
    this.getOrganizationId(organizationId);
    this.getEmployeeId(employeeId);
    if (BscConstants.MEASURE_DATA_FOR_ORGANIZATION.equals(dataFor) && BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(organizationId)) {
        throw new ServiceException("organization is required!");
    }
    if (BscConstants.MEASURE_DATA_FOR_EMPLOYEE.equals(dataFor) && BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(employeeId)) {
        throw new ServiceException("employee is required!");
    }
    this.fillMeasureDatas(kpi, organizationId, employeeId, measureDatas);
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    result.setValue(Boolean.FALSE);
    this.delete(kpi, date, frequency, organizationId, employeeId);
    for (MeasureDataVO measureData : measureDatas) {
        this.measureDataService.saveObject(measureData);
    }
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    result.setValue(Boolean.TRUE);
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) MeasureDataVO(com.netsteadfast.greenstep.vo.MeasureDataVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 23 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage 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 24 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class EmployeeLogicServiceImpl method updateSupervisor.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateSupervisor(EmployeeVO employee, String supervisorOid) throws ServiceException, Exception {
    if (employee == null || super.isBlank(employee.getOid()) || super.isBlank(supervisorOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.FALSE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    employee = this.findEmployeeData(employee.getOid());
    this.deleteHierarchy(employee);
    if ("root".equals(supervisorOid) || "r".equals(supervisorOid)) {
        this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
    } else {
        EmployeeVO newHierEmployee = this.findEmployeeData(supervisorOid);
        // 找當前員工的的資料, 不因該存在要update的新關聯主管
        if (this.foundChild(employee.getOid(), newHierEmployee.getOid())) {
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
        }
        this.createHierarchy(employee, newHierEmployee.getOid());
    }
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 25 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class DegreeFeedbackLogicServiceImpl method startProcess.

@ServiceMethodAuthority(type = { ServiceMethodType.SELECT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<DegreeFeedbackProjectVO> startProcess(DegreeFeedbackProjectVO project) throws ServiceException, Exception {
    if (null == project || super.isBlank(project.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<DegreeFeedbackProjectVO> result = this.degreeFeedbackProjectService.findObjectByOid(project);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    project = result.getValue();
    if (YesNo.YES.equals(project.getPublishFlag())) {
        throw new ServiceException("The project is published, cannot start audit processing!");
    }
    List<BusinessProcessManagementTaskVO> tasks = this.queryTaskByVariableProjectOid(project.getOid());
    if (null != tasks && tasks.size() > 0) {
        throw new ServiceException("Audit processing has been started!");
    }
    this.startProcess(this.getProcessFlowParam(project.getOid(), YesNo.YES, "start apply." + project.getName()));
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : BusinessProcessManagementTaskVO(com.netsteadfast.greenstep.vo.BusinessProcessManagementTaskVO) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DegreeFeedbackProjectVO(com.netsteadfast.greenstep.vo.DegreeFeedbackProjectVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)53 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)50 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)49 Transactional (org.springframework.transaction.annotation.Transactional)34 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)31 HashMap (java.util.HashMap)13 List (java.util.List)12 Map (java.util.Map)10 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)3 BigDecimal (java.math.BigDecimal)3