Search in sources :

Example 6 with OrganizationVO

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with OrganizationVO

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);
        }
    }
}
Also used : OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) List(java.util.List) LinkedList(java.util.LinkedList) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 8 with OrganizationVO

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;
}
Also used : OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Example 9 with OrganizationVO

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;
}
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 10 with OrganizationVO

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);
    }
}
Also used : EmployeeOrgaVO(com.netsteadfast.greenstep.vo.EmployeeOrgaVO) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO)

Aggregations

OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)42 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)17 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)15 HashMap (java.util.HashMap)11 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)5 Map (java.util.Map)5 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)4 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)3 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 List (java.util.List)3 Context (org.apache.commons.chain.Context)3 ContextBase (org.apache.commons.chain.impl.ContextBase)3 Transactional (org.springframework.transaction.annotation.Transactional)3 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)2 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)2 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)2 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)2 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)2 PdcaDocVO (com.netsteadfast.greenstep.vo.PdcaDocVO)2