Search in sources :

Example 1 with PdcaVO

use of com.netsteadfast.greenstep.vo.PdcaVO 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 PdcaVO

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

the class PdcaLogicServiceImpl method findPdca.

private PdcaVO findPdca(String oid) throws ServiceException, Exception {
    PdcaVO pdca = new PdcaVO();
    pdca.setOid(oid);
    DefaultResult<PdcaVO> result = this.pdcaService.findObjectByOid(pdca);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    pdca = result.getValue();
    return pdca;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO)

Example 3 with PdcaVO

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

the class PdcaLogicServiceImpl method findProjectRelatedParent.

private void findProjectRelatedParent(PdcaProjectRelatedVO projectRelated, PdcaVO pdca) throws ServiceException, Exception {
    if (super.isBlank(pdca.getParentOid()) || projectRelated.getParent().size() >= MAX_PROJECT_RELATED_SHOW) {
        return;
    }
    PdcaVO parentPdca = this.findPdca(pdca.getParentOid());
    ((LinkedList<PdcaVO>) projectRelated.getParent()).addFirst(parentPdca);
    this.findProjectRelatedParent(projectRelated, parentPdca);
}
Also used : PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) LinkedList(java.util.LinkedList)

Example 4 with PdcaVO

use of com.netsteadfast.greenstep.vo.PdcaVO 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);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) BbPdcaDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaDoc) BbPdcaOwner(com.netsteadfast.greenstep.po.hbm.BbPdcaOwner) EmployeeVO(com.netsteadfast.greenstep.vo.EmployeeVO) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) BbPdcaKpis(com.netsteadfast.greenstep.po.hbm.BbPdcaKpis) BbPdcaItem(com.netsteadfast.greenstep.po.hbm.BbPdcaItem) BbPdcaItemDoc(com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) BbPdcaItemOwner(com.netsteadfast.greenstep.po.hbm.BbPdcaItemOwner) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BbPdcaOrga(com.netsteadfast.greenstep.po.hbm.BbPdcaOrga) File(java.io.File) PdcaItemVO(com.netsteadfast.greenstep.vo.PdcaItemVO) PdcaMeasureFreqVO(com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)

Example 5 with PdcaVO

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

the class PdcaSaveOrUpdateAction method startPdcaAuditProcess.

private void startPdcaAuditProcess() throws ControllerException, AuthorityException, ServiceException, Exception {
    PdcaVO pdca = new PdcaVO();
    this.transformFields2ValueObject(pdca, new String[] { "oid" });
    DefaultResult<PdcaVO> result = this.pdcaLogicService.startProcess(pdca);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO)

Aggregations

PdcaVO (com.netsteadfast.greenstep.vo.PdcaVO)14 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)6 HashMap (java.util.HashMap)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)3 PdcaItemVO (com.netsteadfast.greenstep.vo.PdcaItemVO)3 BbPdcaDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaDoc)2 BbPdcaItem (com.netsteadfast.greenstep.po.hbm.BbPdcaItem)2 BbPdcaItemDoc (com.netsteadfast.greenstep.po.hbm.BbPdcaItemDoc)2 BusinessProcessManagementTaskVO (com.netsteadfast.greenstep.vo.BusinessProcessManagementTaskVO)2 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)2 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)2 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)2 PdcaDocVO (com.netsteadfast.greenstep.vo.PdcaDocVO)2 PdcaMeasureFreqVO (com.netsteadfast.greenstep.vo.PdcaMeasureFreqVO)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 Transactional (org.springframework.transaction.annotation.Transactional)2 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)1 PdcaProjectRelatedVO (com.netsteadfast.greenstep.bsc.vo.PdcaProjectRelatedVO)1 BbEmployee (com.netsteadfast.greenstep.po.hbm.BbEmployee)1