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);
}
}
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);
}
}
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();
}
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;
}
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);
}
Aggregations