use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class ObjectiveLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<ObjectiveVO> create(ObjectiveVO objective, String perspectiveOid) throws ServiceException, Exception {
if (null == objective || super.isBlank(perspectiveOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
PerspectiveVO perspective = new PerspectiveVO();
perspective.setOid(perspectiveOid);
DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findObjectByOid(perspective);
if (pResult.getValue() == null) {
throw new ServiceException(pResult.getSystemMessage().getValue());
}
perspective = pResult.getValue();
objective.setPerId(perspective.getPerId());
if (!SimpleUtils.checkBeTrueOf_azAZ09(4, 14, objective.getObjId())) {
// for import-mode from csv file OBJ_ID is old(before id).
objective.setObjId(this.findForMaxObjId(SimpleUtils.getStrYMD("")));
}
this.setStringValueMaxLength(objective, "description", MAX_DESCRIPTION_LENGTH);
return this.objectiveService.saveObject(objective);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority 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.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method initHierarchyForFirst.
/**
* for upgrade 0.7.1 need data
*
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public void initHierarchyForFirst() throws ServiceException, Exception {
List<EmployeeVO> employeeList = this.getEmployeeService().findListVOByParams(null);
if (null == employeeList || employeeList.size() < 1) {
return;
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (EmployeeVO employee : employeeList) {
paramMap.clear();
paramMap.put("empOid", employee.getOid());
if (this.employeeHierService.countByParams(paramMap) > 0) {
continue;
}
this.createHierarchy(employee, BscConstants.EMPLOYEE_HIER_ZERO_OID);
}
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority 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);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<EmployeeVO> update(EmployeeVO employee, List<String> organizationOid) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
EmployeeVO dbEmployee = this.findEmployeeData(employee.getOid());
this.deleteEmployeeOrganization(dbEmployee);
employee.setAccount(dbEmployee.getAccount());
employee.setEmpId(dbEmployee.getEmpId());
DefaultResult<EmployeeVO> result = this.getEmployeeService().updateObject(employee);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.createEmployeeOrganization(result.getValue(), organizationOid);
return result;
}
Aggregations