use of com.netsteadfast.greenstep.vo.EmployeeVO 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;
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method getTreeData.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<Map<String, Object>> getTreeData(String basePath) throws ServiceException, Exception {
List<Map<String, Object>> items = new LinkedList<Map<String, Object>>();
List<EmployeeVO> empList = this.getEmployeeService().findForJoinHier();
if (empList == null || empList.size() < 1) {
return items;
}
for (EmployeeVO emp : empList) {
// 先放沒有父親的員工資料
if (!(super.isBlank(emp.getSupOid()) || BscConstants.EMPLOYEE_HIER_ZERO_OID.equals(emp.getSupOid()))) {
continue;
}
Map<String, Object> parentDataMap = new LinkedHashMap<String, Object>();
parentDataMap.put("type", "parent");
parentDataMap.put("id", emp.getOid());
parentDataMap.put("name", IconUtils.getMenuIcon(basePath, TREE_ICON_ID) + StringEscapeUtils.escapeHtml4(this.getTreeShowName(emp)));
parentDataMap.put("oid", emp.getOid());
items.add(parentDataMap);
}
// 再開始放孩子
for (int ix = 0; ix < items.size(); ix++) {
Map<String, Object> parentDataMap = items.get(ix);
String oid = (String) parentDataMap.get("oid");
this.getTreeData(basePath, parentDataMap, empList, oid);
}
return items;
}
use of com.netsteadfast.greenstep.vo.EmployeeVO 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;
}
use of com.netsteadfast.greenstep.vo.EmployeeVO in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method cloneNewProject.
private void cloneNewProject(PdcaVO parentPdca) throws ServiceException, Exception {
// 1. PDCA main
PdcaVO pdca = new PdcaVO();
this.pdcaService.copyProperties(parentPdca, pdca);
pdca.setOid(null);
pdca.setConfirmDate(null);
pdca.setConfirmEmpId(null);
pdca.setConfirmFlag(YesNo.NO);
pdca.setParentOid(parentPdca.getOid());
String lastTitle = "-(New)";
if ((pdca.getTitle() + lastTitle).length() <= 100) {
pdca.setTitle(pdca.getTitle() + lastTitle);
} else {
pdca.setTitle(pdca.getTitle().substring(pdca.getTitle().length() - lastTitle.length(), 100) + lastTitle);
}
// 2. PDCA measure-freq
PdcaMeasureFreqVO measureFreq = new PdcaMeasureFreqVO();
measureFreq.setPdcaOid(parentPdca.getOid());
DefaultResult<PdcaMeasureFreqVO> mfResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
if (mfResult.getValue() == null) {
throw new ServiceException(mfResult.getSystemMessage().getValue());
}
measureFreq = mfResult.getValue();
measureFreq.setOid(null);
measureFreq.setPdcaOid(null);
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("pdcaOid", parentPdca.getOid());
// 3. organizationOids
List<String> organizationOids = new ArrayList<String>();
List<BbPdcaOrga> pdcaOrgaList = this.pdcaOrgaService.findListByParams(paramMap);
for (BbPdcaOrga pdcaOrga : pdcaOrgaList) {
OrganizationVO organization = this.findOrganizationDataByUK(pdcaOrga.getOrgId());
organizationOids.add(organization.getOid());
}
// 4. employeeOids
List<String> employeeOids = new ArrayList<String>();
List<BbPdcaOwner> pdcaOwnerList = this.pdcaOwnerService.findListByParams(paramMap);
for (BbPdcaOwner pdcaOwner : pdcaOwnerList) {
EmployeeVO employee = this.findEmployeeDataByEmpId(pdcaOwner.getEmpId());
employeeOids.add(employee.getOid());
}
// 5. kpiOids
List<String> kpiOids = new ArrayList<String>();
List<BbPdcaKpis> pdcaKpisList = this.pdcaKpisService.findListByParams(paramMap);
for (BbPdcaKpis pdcaKpi : pdcaKpisList) {
KpiVO kpi = new KpiVO();
kpi.setId(pdcaKpi.getKpiId());
DefaultResult<KpiVO> kResult = this.kpiService.findByUK(kpi);
if (kResult.getValue() == null) {
throw new ServiceException(kResult.getSystemMessage().getValue());
}
kpi = kResult.getValue();
kpiOids.add(kpi.getOid());
}
// 6. attachment
List<String> attachment = new ArrayList<String>();
List<BbPdcaDoc> pdcaDocList = this.pdcaDocService.findListByParams(paramMap);
for (BbPdcaDoc pdcaDoc : pdcaDocList) {
DefaultResult<SysUploadVO> upResult = this.getSysUploadService().findForNoByteContent(pdcaDoc.getUploadOid());
if (upResult.getValue() == null) {
throw new ServiceException(upResult.getSystemMessage().getValue());
}
SysUploadVO upload = upResult.getValue();
File oldFile = UploadSupportUtils.getRealFile(pdcaDoc.getUploadOid());
attachment.add(UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, true, oldFile, upload.getShowName()));
}
// 7. items - PdcaItemVO
List<PdcaItemVO> items = new ArrayList<PdcaItemVO>();
List<BbPdcaItem> pdcaItems = this.pdcaItemService.findListByParams(paramMap);
for (BbPdcaItem pdcaItem : pdcaItems) {
PdcaItemVO itemObj = new PdcaItemVO();
this.pdcaItemService.doMapper(pdcaItem, itemObj, IPdcaItemService.MAPPER_ID_PO2VO);
items.add(itemObj);
}
// 8. item - owner
for (PdcaItemVO itemObj : items) {
itemObj.setEmployeeOids(new ArrayList<String>());
paramMap.put("itemOid", itemObj.getOid());
List<BbPdcaItemOwner> itemOwnerList = this.pdcaItemOwnerService.findListByParams(paramMap);
for (BbPdcaItemOwner itemOwner : itemOwnerList) {
itemObj.getEmployeeOids().add(this.findEmployeeDataByEmpId(itemOwner.getEmpId()).getOid());
}
}
// 9. item - attachment
for (PdcaItemVO itemObj : items) {
itemObj.setUploadOids(new ArrayList<String>());
paramMap.put("itemOid", itemObj.getOid());
List<BbPdcaItemDoc> itemDocList = this.pdcaItemDocService.findListByParams(paramMap);
for (BbPdcaItemDoc itemDoc : itemDocList) {
DefaultResult<SysUploadVO> upResult = this.getSysUploadService().findForNoByteContent(itemDoc.getUploadOid());
if (upResult.getValue() == null) {
throw new ServiceException(upResult.getSystemMessage().getValue());
}
SysUploadVO upload = upResult.getValue();
File oldFile = UploadSupportUtils.getRealFile(itemDoc.getUploadOid());
itemObj.getUploadOids().add(UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, true, oldFile, upload.getShowName()));
}
}
// clear item old OID, PDCA_OID
for (PdcaItemVO itemObj : items) {
itemObj.setOid(null);
itemObj.setPdcaOid(null);
}
this.create(pdca, measureFreq, organizationOids, employeeOids, kpiOids, attachment, items);
}
use of com.netsteadfast.greenstep.vo.EmployeeVO 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;
}
Aggregations