Search in sources :

Example 41 with VisionVO

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

the class LoadStrategyMapItemsForNewCommand method execute.

@Override
public boolean execute(Context context) throws Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    for (VisionVO obj : treeObj.getVisions()) {
        if (obj.getOid().equals(visionOid)) {
            vision = obj;
        }
    }
    StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision);
    this.setResult(context, mapItems);
    return false;
}
Also used : StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 42 with VisionVO

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

the class LoadStrategyMapItemsForRecCommand method execute.

@Override
public boolean execute(Context context) throws ServiceException, Exception {
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    for (VisionVO obj : treeObj.getVisions()) {
        if (obj.getOid().equals(visionOid)) {
            vision = obj;
        }
    }
    StrategyMapItemsVO mapItems = this.fillStrategyMapItems(vision, context);
    this.setResult(context, mapItems);
    return false;
}
Also used : StrategyMapItemsVO(com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 43 with VisionVO

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

the class OrganizationReportPdfCommand method createPdf.

private String createPdf(Context context) throws Exception {
    BscReportPropertyUtils.loadData();
    String visionOid = (String) context.get("visionOid");
    VisionVO vision = null;
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    for (VisionVO visionObj : treeObj.getVisions()) {
        if (visionObj.getOid().equals(visionOid)) {
            vision = visionObj;
        }
    }
    FontFactory.register(BscConstants.PDF_ITEXT_FONT);
    String fileName = UUID.randomUUID().toString() + ".pdf";
    String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
    OutputStream os = new FileOutputStream(fileFullPath);
    Document document = new Document(PageSize.A4.rotate(), 10, 10, 10, 10);
    document.left(100f);
    document.top(150f);
    PdfWriter writer = PdfWriter.getInstance(document, os);
    document.open();
    PdfPTable table = new PdfPTable(MAX_COLSPAN);
    table.setWidthPercentage(100f);
    PdfPTable signTable = new PdfPTable(1);
    signTable.setWidthPercentage(100f);
    this.createHead(table, vision, context);
    this.createBody(table, vision);
    this.putSignature(signTable, context);
    document.add(table);
    document.add(signTable);
    document.close();
    writer.close();
    os.flush();
    os.close();
    os = null;
    File file = new File(fileFullPath);
    String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "department-report.pdf");
    file = null;
    return oid;
}
Also used : PdfWriter(com.itextpdf.text.pdf.PdfWriter) PdfPTable(com.itextpdf.text.pdf.PdfPTable) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) Document(com.itextpdf.text.Document) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) File(java.io.File)

Example 44 with VisionVO

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

the class LoadBscStructTreeCommand method processPerspective.

private void processPerspective(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
    for (VisionVO vision : treeObj.getVisions()) {
        for (BscMixDataVO mixData : mixDatas) {
            if (!vision.getVisId().equals(mixData.getVisId())) {
                continue;
            }
            boolean found = false;
            for (int i = 0; i < vision.getPerspectives().size(); i++) {
                if (vision.getPerspectives().get(i).getPerId().equals(mixData.getPerId())) {
                    found = true;
                }
            }
            if (!found) {
                PerspectiveVO perspective = new PerspectiveVO();
                perspective.setOid(mixData.getPerOid());
                perspective.setPerId(mixData.getPerId());
                perspective.setVisId(mixData.getVisId());
                perspective.setName(mixData.getPerName());
                perspective.setWeight(mixData.getPerWeight());
                perspective.setTarget(mixData.getPerTarget());
                perspective.setMin(mixData.getPerMin());
                perspective.setDescription(mixData.getPerDescription());
                vision.getPerspectives().add(perspective);
            }
        }
    }
}
Also used : PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

Example 45 with VisionVO

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

the class LoadBscStructTreeCommand method processVision.

private void processVision(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
    for (BscMixDataVO mixData : mixDatas) {
        boolean found = false;
        for (int i = 0; i < treeObj.getVisions().size(); i++) {
            if (treeObj.getVisions().get(i).getVisId().equals(mixData.getVisId())) {
                found = true;
            }
        }
        if (!found) {
            VisionVO vision = new VisionVO();
            vision.setOid(mixData.getVisOid());
            vision.setVisId(mixData.getVisId());
            vision.setTitle(mixData.getVisTitle());
            treeObj.getVisions().add(vision);
        }
    }
}
Also used : VisionVO(com.netsteadfast.greenstep.vo.VisionVO) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

Aggregations

VisionVO (com.netsteadfast.greenstep.vo.VisionVO)66 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)38 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)29 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)22 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)21 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)17 HashMap (java.util.HashMap)16 Map (java.util.Map)8 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)7 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)7 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)7 ArrayList (java.util.ArrayList)7 LinkedList (java.util.LinkedList)7 Transactional (org.springframework.transaction.annotation.Transactional)7 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)6 File (java.io.File)6 FileOutputStream (java.io.FileOutputStream)6 BscMixDataVO (com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Document (com.itextpdf.text.Document)3