Search in sources :

Example 1 with PdcaDocVO

use of com.netsteadfast.greenstep.vo.PdcaDocVO in project bamboobsc by billchen198318.

the class LoadPdcaDataCommand method loadDetail.

private void loadDetail(PdcaVO pdca) throws ServiceException, Exception {
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("pdcaOid", pdca.getOid());
    // 1. Project owner
    List<String> ownerNames = this.employeeService.findForAppendNames(this.employeeService.findForAppendEmployeeOidsByPdcaOwner(pdca.getOid()));
    pdca.setResponsibilityAppendNames(StringUtils.join(ownerNames.toArray(), Constants.ID_DELIMITER) + Constants.ID_DELIMITER);
    // 2. Confirm employee
    if (!StringUtils.isBlank(pdca.getConfirmEmpId())) {
        pdca.setConfirmEmployeeName(this.getEmployeeNameNoThrow(pdca.getConfirmEmpId()));
    }
    // 3. Project organization/department
    List<String> orgaNames = this.organizationService.findForAppendNames(this.organizationService.findForAppendOrganizationOidsByPdcaOrga(pdca.getOid()));
    pdca.setOrganizationAppendNames(StringUtils.join(orgaNames.toArray(), Constants.ID_DELIMITER) + Constants.ID_DELIMITER);
    // 4. Project KPIs
    List<String> kpiNames = this.kpiService.findForAppendNames(this.kpiService.findForAppendOidsByPdcaKpis(pdca.getOid()));
    pdca.setKpisAppendNames(StringUtils.join(kpiNames.toArray(), Constants.ID_DELIMITER) + Constants.ID_DELIMITER);
    // 5. parent project
    if (!StringUtils.isBlank(pdca.getParentOid())) {
        PdcaVO parentPdca = new PdcaVO();
        parentPdca.setOid(pdca.getParentOid());
        DefaultResult<PdcaVO> pResult = this.pdcaService.findObjectByOid(parentPdca);
        if (pResult.getValue() == null) {
            throw new ServiceException(pResult.getSystemMessage().getValue());
        }
        pdca.setParentName(pResult.getValue().getTitle());
    }
    // 6. Documents file
    List<PdcaDocVO> pdcaDocs = this.pdcaDocService.findListVOByParams(paramMap);
    if (pdcaDocs != null && pdcaDocs.size() > 0) {
        pdca.getDocs().addAll(pdcaDocs);
    }
    for (int i = 0; pdca.getDocs() != null && i < pdca.getDocs().size(); i++) {
        PdcaDocVO doc = pdca.getDocs().get(i);
        doc.setShowName(UploadSupportUtils.findUploadNoByteContent(doc.getUploadOid()).getShowName());
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) PdcaDocVO(com.netsteadfast.greenstep.vo.PdcaDocVO) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO)

Example 2 with PdcaDocVO

use of com.netsteadfast.greenstep.vo.PdcaDocVO in project bamboobsc by billchen198318.

the class PdcaLogicServiceImpl method createDocuments.

private void createDocuments(PdcaVO pdca, List<String> attachment) throws ServiceException, Exception {
    if (attachment == null || attachment.size() < 1) {
        return;
    }
    for (String oid : attachment) {
        SysUploadVO upload = this.findUploadDataForNoByteContent(oid);
        if (!(upload.getSystem().equals(Constants.getSystem()) && upload.getType().equals(UploadTypes.IS_TEMP))) {
            throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
        }
        PdcaDocVO pdcaDoc = new PdcaDocVO();
        pdcaDoc.setPdcaOid(pdca.getOid());
        pdcaDoc.setUploadOid(upload.getOid());
        pdcaDoc.setViewMode(UploadSupportUtils.getViewMode(upload.getShowName()));
        DefaultResult<PdcaDocVO> result = this.pdcaDocService.saveObject(pdcaDoc);
        if (result.getValue() == null) {
            throw new ServiceException(result.getSystemMessage().getValue());
        }
        UploadSupportUtils.updateType(oid, UploadTypes.IS_PDCA_DOCUMENT);
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaDocVO(com.netsteadfast.greenstep.vo.PdcaDocVO) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO)

Example 3 with PdcaDocVO

use of com.netsteadfast.greenstep.vo.PdcaDocVO in project bamboobsc by billchen198318.

the class LoadPdcaDataCommand method execute.

@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
    pdcaService = (IPdcaService<PdcaVO, BbPdca, String>) AppContext.getBean("bsc.service.PdcaService");
    pdcaDocService = (IPdcaDocService<PdcaDocVO, BbPdcaDoc, String>) AppContext.getBean("bsc.service.PdcaDocService");
    pdcaItemService = (IPdcaItemService<PdcaItemVO, BbPdcaItem, String>) AppContext.getBean("bsc.service.PdcaItemService");
    pdcaItemDocService = (IPdcaItemDocService<PdcaItemDocVO, BbPdcaItemDoc, String>) AppContext.getBean("bsc.service.PdcaItemDocService");
    pdcaAuditService = (IPdcaAuditService<PdcaAuditVO, BbPdcaAudit, String>) AppContext.getBean("bsc.service.PdcaAuditService");
    employeeService = (IEmployeeService<EmployeeVO, BbEmployee, String>) AppContext.getBean("bsc.service.EmployeeService");
    organizationService = (IOrganizationService<OrganizationVO, BbOrganization, String>) AppContext.getBean("bsc.service.OrganizationService");
    kpiService = (IKpiService<KpiVO, BbKpi, String>) AppContext.getBean("bsc.service.KpiService");
    String pdcaOid = (String) context.get("pdcaOid");
    PdcaVO pdca = new PdcaVO();
    pdca.setOid(pdcaOid);
    DefaultResult<PdcaVO> result = pdcaService.findObjectByOid(pdca);
    if (result.getValue() == null) {
        this.setMessage(context, result.getSystemMessage().getValue());
    } else {
        pdca = result.getValue();
        this.loadDetail(pdca);
        this.loadPdcaItems(pdca);
        this.loadAudit(pdca);
        this.setResult(context, pdca);
        // Action 輸出可能會要用到
        context.put("pdca", pdca);
    }
    return false;
}
Also used : PdcaItemDocVO(com.netsteadfast.greenstep.vo.PdcaItemDocVO) PdcaDocVO(com.netsteadfast.greenstep.vo.PdcaDocVO) BbPdcaItemDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) BbPdcaDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaDoc) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) BbKpi(com.netsteadfast.greenstep.po.hbm.BbKpi) BbPdcaAudit(com.netsteadfast.greenstep.po.hbm.BbPdcaAudit) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) BbOrganization(com.netsteadfast.greenstep.po.hbm.BbOrganization) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) BbPdca(com.netsteadfast.greenstep.po.hbm.BbPdca) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) BbPdcaItem(com.netsteadfast.greenstep.po.hbm.BbPdcaItem) PdcaAuditVO(com.netsteadfast.greenstep.vo.PdcaAuditVO)

Example 4 with PdcaDocVO

use of com.netsteadfast.greenstep.vo.PdcaDocVO in project bamboobsc by billchen198318.

the class PdcaManagementAction method loadPdcaData.

private void loadPdcaData() throws ServiceException, Exception {
    // ------------------------------------------------------------------------------
    // PDCA main
    this.loadPdcaDataSimple("oid");
    // ------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------
    // measure frequency
    this.measureFreq.setPdcaOid(pdca.getOid());
    DefaultResult<PdcaMeasureFreqVO> measureFreqResult = this.pdcaMeasureFreqService.findByUK(measureFreq);
    if (measureFreqResult.getValue() == null) {
        throw new ServiceException(measureFreqResult.getSystemMessage().getValue());
    }
    this.measureFreq = measureFreqResult.getValue();
    this.measureFreq.setEmployeeOid("");
    if (!BscConstants.MEASURE_DATA_EMPLOYEE_FULL.equals(this.measureFreq.getEmpId()) && !StringUtils.isBlank(this.measureFreq.getEmpId())) {
        EmployeeVO employee = BscBaseLogicServiceCommonSupport.findEmployeeDataByEmpId(this.employeeService, this.measureFreq.getEmpId());
        this.measureFreq.setEmployeeOid(employee.getOid());
    }
    this.measureFreq.setOrganizationOid("");
    if (!BscConstants.MEASURE_DATA_ORGANIZATION_FULL.equals(this.measureFreq.getOrgId()) && !StringUtils.isBlank(this.measureFreq.getOrgId())) {
        OrganizationVO organization = new OrganizationVO();
        organization.setOrgId(this.measureFreq.getOrgId());
        DefaultResult<OrganizationVO> orgResult = this.organizationService.findByUK(organization);
        if (orgResult.getValue() != null) {
            this.measureFreq.setOrganizationOid(orgResult.getValue().getOid());
        }
    }
    this.getFields().put("measureFreqStartDate", "");
    this.getFields().put("measureFreqEndDate", "");
    this.getFields().put("measureFreqStartYearDate", this.measureFreq.getStartDateTextBoxValue());
    this.getFields().put("measureFreqEndYearDate", this.measureFreq.getEndDateTextBoxValue());
    if (BscMeasureDataFrequency.FREQUENCY_DAY.equals(measureFreq.getFreq()) || BscMeasureDataFrequency.FREQUENCY_WEEK.equals(measureFreq.getFreq()) || BscMeasureDataFrequency.FREQUENCY_MONTH.equals(measureFreq.getFreq())) {
        this.getFields().put("measureFreqStartDate", this.measureFreq.getStartDateTextBoxValue());
        this.getFields().put("measureFreqEndDate", this.measureFreq.getEndDateTextBoxValue());
        this.getFields().put("measureFreqStartYearDate", "");
        this.getFields().put("measureFreqEndYearDate", "");
    }
    //1-DEPT,2-EMP,3-Both
    this.getFields().put("measureFreqDataFor", "all");
    if ("1".equals(this.measureFreq.getDataType())) {
        this.getFields().put("measureFreqDataFor", "organization");
    }
    if ("2".equals(this.measureFreq.getDataType())) {
        this.getFields().put("measureFreqDataFor", "employee");
    }
    // ------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------
    // PDCA organization, Owner, KPIs, DOC
    List<String> appendOrgaOidsPdcaOrga = this.organizationService.findForAppendOrganizationOidsByPdcaOrga(this.pdca.getOid());
    List<String> appendOrgaNamesPdcaOrga = this.organizationService.findForAppendNames(appendOrgaOidsPdcaOrga);
    this.getFields().put("appendOrgaOidsForPdcaOrga", this.joinAppend2String(appendOrgaOidsPdcaOrga));
    this.getFields().put("appendOrgaNamesForPdcaOrga", this.joinAppend2String(appendOrgaNamesPdcaOrga));
    List<String> appendEmplOidsPdcaOwner = this.employeeService.findForAppendEmployeeOidsByPdcaOwner(pdca.getOid());
    List<String> appendEmplNamesPdcaOwner = this.employeeService.findForAppendNames(appendEmplOidsPdcaOwner);
    this.getFields().put("appendOwnerOidsForPdcaOwner", this.joinAppend2String(appendEmplOidsPdcaOwner));
    this.getFields().put("appendOwnerNamesForPdcaOwner", this.joinAppend2String(appendEmplNamesPdcaOwner));
    List<String> appendKpiOidsPdcaKpis = this.kpiService.findForAppendOidsByPdcaKpis(pdca.getOid());
    List<String> appendKpiNamesPdcaKpis = this.kpiService.findForAppendNames(appendKpiOidsPdcaKpis);
    this.getFields().put("appendKpiOidsForPdcaKpis", this.joinAppend2String(appendKpiOidsPdcaKpis));
    this.getFields().put("appendKpiNamesForPdcaKpis", this.joinAppend2String(appendKpiNamesPdcaKpis));
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("pdcaOid", pdca.getOid());
    this.pdcaDocs = this.pdcaDocService.findListVOByParams(paramMap);
    for (int i = 0; this.pdcaDocs != null && i < this.pdcaDocs.size(); i++) {
        PdcaDocVO pdcaDoc = this.pdcaDocs.get(i);
        pdcaDoc.setShowName("unknown-" + pdcaDoc.getUploadOid());
        DefaultResult<SysUploadVO> upResult = this.sysUploadService.findForNoByteContent(pdcaDoc.getUploadOid());
        if (upResult.getValue() != null) {
            pdcaDoc.setShowName(upResult.getValue().getShowName());
        }
    }
    // ------------------------------------------------------------------------------
    // ------------------------------------------------------------------------------
    // PDCA Items
    this.loadPdcaItemsData();
// ------------------------------------------------------------------------------
}
Also used : HashMap(java.util.HashMap) PdcaDocVO(com.netsteadfast.greenstep.vo.PdcaDocVO) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaMeasureFreqVO(com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)

Aggregations

PdcaDocVO (com.netsteadfast.greenstep.vo.PdcaDocVO)4 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)2 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)2 PdcaVO (com.netsteadfast.greenstep.vo.PdcaVO)2 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)2 HashMap (java.util.HashMap)2 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)1 BbKpi (com.netsteadfast.greenstep.po.hbm.BbKpi)1 BbOrganization (com.netsteadfast.greenstep.po.hbm.BbOrganization)1 BbPdca (com.netsteadfast.greenstep.po.hbm.BbPdca)1 BbPdcaAudit (com.netsteadfast.greenstep.po.hbm.BbPdcaAudit)1 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)1 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)1 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)1 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)1 PdcaAuditVO (com.netsteadfast.greenstep.vo.PdcaAuditVO)1 PdcaItemDocVO (com.netsteadfast.greenstep.vo.PdcaItemDocVO)1 PdcaItemVO (com.netsteadfast.greenstep.vo.PdcaItemVO)1 PdcaMeasureFreqVO (com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)1