use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method update.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<OrganizationVO> update(OrganizationVO organization) throws ServiceException, Exception {
if (organization == null || super.isBlank(organization.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
this.checkOrganizationIdIsZero(organization);
OrganizationVO dbOrganization = this.findOrganizationData(organization.getOid());
organization.setOrgId(dbOrganization.getOrgId());
this.setStringValueMaxLength(organization, "description", MAX_DESCRIPTION_LENGTH);
this.handlerLongitudeAndLatitude(organization);
return this.getOrganizationService().updateObject(organization);
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method resetTreeMapContentForOrgChartData.
@SuppressWarnings("unchecked")
private void resetTreeMapContentForOrgChartData(List<Map<String, Object>> childMapList, OrganizationVO currentOrganization) throws Exception {
for (Map<String, Object> nodeMap : childMapList) {
String nodeOrganizationOid = String.valueOf(nodeMap.get("id"));
// 去除 OrgChart 不需要的資料
nodeMap.remove("type");
nodeMap.remove("id");
nodeMap.remove("name");
nodeMap.remove("orgId");
OrganizationVO nodeOrganization = this.findOrganizationData(nodeOrganizationOid);
// OrgChart 需要的資料, nodeMap 需要填入 name 與 title
if (currentOrganization != null && !super.isBlank(currentOrganization.getOid()) && currentOrganization.getOid().equals(nodeOrganizationOid)) {
// 有帶入當前部門(組織)來區別顏色
nodeMap.put("name", "<font color='#8A0808'>" + nodeOrganization.getOrgId() + "</font>");
nodeMap.put("title", "<font color='#8A0808'>" + nodeOrganization.getName() + "</font>");
} else {
nodeMap.put("name", nodeOrganization.getOrgId());
nodeMap.put("title", nodeOrganization.getName());
}
if (nodeMap.get("children") != null && (nodeMap.get("children") instanceof List<?>)) {
// 還有孩子項目資料
this.resetTreeMapContentForOrgChartData((List<Map<String, Object>>) nodeMap.get("children"), currentOrganization);
}
}
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method getTreeData.
/**
* 為了組織架構 tree 的呈現用, json 資料
*
* 不包含
* {
* "identifier":"id",
* "label":"name",
*
* ==================================================
* 只包含 items 的資料內容
* ==================================================
*
* "items":[
* ...............
* ]
* ==================================================
*
* }
*
* @param basePath
* @param checkBox 是否打開checkBox
* @param appendId 已被打勾的部門OID組成的字串, 如 1b2ac208-345c-4f93-92c5-4b26aead31d2;3ba52439-6756-45e8-8269-ae7b4fb6a3dc
* @return
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<Map<String, Object>> getTreeData(String basePath, boolean checkBox, String appendId) throws ServiceException, Exception {
List<Map<String, Object>> items = new LinkedList<Map<String, Object>>();
List<OrganizationVO> orgList = this.getOrganizationService().findForJoinParent();
if (orgList == null || orgList.size() < 1) {
return items;
}
for (OrganizationVO org : orgList) {
// 先放沒有父親的ORG-ID
if (!(super.isBlank(org.getParId()) || BscConstants.ORGANIZATION_ZERO_ID.equals(org.getParId()))) {
continue;
}
Map<String, Object> parentDataMap = new LinkedHashMap<String, Object>();
parentDataMap.put("type", "parent");
parentDataMap.put("name", (checkBox ? getCheckBoxHtmlContent(org, appendId) : "") + IconUtils.getMenuIcon(basePath, TREE_ICON_ID) + StringEscapeUtils.escapeHtml4(org.getName()));
parentDataMap.put("id", org.getOid());
parentDataMap.put("orgId", org.getOrgId());
items.add(parentDataMap);
}
// 再開始放孩子
for (int ix = 0; ix < items.size(); ix++) {
Map<String, Object> parentDataMap = items.get(ix);
String orgId = (String) parentDataMap.get("orgId");
this.getTreeData(basePath, checkBox, appendId, parentDataMap, orgList, orgId);
}
return items;
}
use of com.netsteadfast.greenstep.vo.OrganizationVO 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;
}
use of com.netsteadfast.greenstep.vo.OrganizationVO in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method createEmployeeOrganization.
private void createEmployeeOrganization(EmployeeVO employee, List<String> organizationOid) throws ServiceException, Exception {
if (employee == null || StringUtils.isBlank(employee.getEmpId()) || organizationOid == null || organizationOid.size() < 1) {
return;
}
for (String oid : organizationOid) {
OrganizationVO organization = this.findOrganizationData(oid);
EmployeeOrgaVO empOrg = new EmployeeOrgaVO();
empOrg.setEmpId(employee.getEmpId());
empOrg.setOrgId(organization.getOrgId());
this.employeeOrgaService.saveObject(empOrg);
}
}
Aggregations