Search in sources :

Example 16 with VisionVO

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

the class LoadBscStructTreeCommand method processObjective.

private void processObjective(BscStructTreeObj treeObj, List<BscMixDataVO> mixDatas) throws Exception {
    for (VisionVO vision : treeObj.getVisions()) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (BscMixDataVO mixData : mixDatas) {
                if (!vision.getVisId().equals(mixData.getVisId()) || !perspective.getPerId().equals(mixData.getPerId())) {
                    continue;
                }
                boolean found = false;
                for (int i = 0; i < perspective.getObjectives().size(); i++) {
                    if (perspective.getObjectives().get(i).getObjId().equals(mixData.getObjId())) {
                        found = true;
                    }
                }
                if (!found) {
                    ObjectiveVO objective = new ObjectiveVO();
                    objective.setOid(mixData.getObjOid());
                    objective.setObjId(mixData.getObjId());
                    objective.setPerId(mixData.getPerId());
                    objective.setName(mixData.getObjName());
                    objective.setWeight(mixData.getObjWeight());
                    objective.setTarget(mixData.getObjTarget());
                    objective.setMin(mixData.getObjMin());
                    objective.setDescription(mixData.getObjDescription());
                    perspective.getObjectives().add(objective);
                }
            }
        }
    }
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) BscMixDataVO(com.netsteadfast.greenstep.bsc.vo.BscMixDataVO)

Example 17 with VisionVO

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

the class LoadMeasureDataCommand method execute.

@SuppressWarnings("unchecked")
@Override
public boolean execute(Context context) throws Exception {
    measureDataService = (IMeasureDataService<MeasureDataVO, BbMeasureData, String>) AppContext.getBean("bsc.service.MeasureDataService");
    String frequency = (String) context.get("frequency");
    String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim();
    String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim();
    String startDate = StringUtils.defaultString((String) context.get("startDate")).trim();
    String endDate = StringUtils.defaultString((String) context.get("endDate")).trim();
    startDate = startDate.replaceAll("/", "").replaceAll("-", "");
    endDate = endDate.replaceAll("/", "").replaceAll("-", "");
    String date1 = startDate;
    String date2 = endDate;
    if (BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency)) {
        date1 = startYearDate + "0101";
        date2 = endYearDate + "12" + SimpleUtils.getMaxDayOfMonth(Integer.parseInt(endYearDate), 12);
    }
    String measureDataOrgaId = (String) context.get("orgId");
    String measureDataEmplId = (String) context.get("empId");
    if (this.getResult(context) == null || !(this.getResult(context) instanceof BscStructTreeObj)) {
        return false;
    }
    BscStructTreeObj treeObj = (BscStructTreeObj) this.getResult(context);
    for (VisionVO vision : treeObj.getVisions()) {
        for (PerspectiveVO perspective : vision.getPerspectives()) {
            for (ObjectiveVO objective : perspective.getObjectives()) {
                for (KpiVO kpi : objective.getKpis()) {
                    this.fillMeasureData(kpi, frequency, date1, date2, measureDataOrgaId, measureDataEmplId);
                }
            }
        }
    }
    return false;
}
Also used : ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) BbMeasureData(com.netsteadfast.greenstep.po.hbm.BbMeasureData) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) MeasureDataVO(com.netsteadfast.greenstep.vo.MeasureDataVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 18 with VisionVO

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

the class PersonalReportExcelCommand method createExcel.

private String createExcel(Context context) throws Exception {
    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;
        }
    }
    BscReportPropertyUtils.loadData();
    String fileName = SimpleUtils.getUUIDStr() + ".xlsx";
    String fileFullPath = Constants.getWorkTmpDir() + "/" + fileName;
    int row = 0;
    XSSFWorkbook wb = new XSSFWorkbook();
    XSSFSheet sh = wb.createSheet();
    row += this.createHead(wb, sh, row, vision, context);
    row = this.createMainBody(wb, sh, row, vision, context);
    this.createFoot(wb, sh, row, vision, context);
    this.putSignature(wb, sh, row + 2, context);
    FileOutputStream out = new FileOutputStream(fileFullPath);
    wb.write(out);
    out.close();
    wb = null;
    File file = new File(fileFullPath);
    String oid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, file, "personal-report.xlsx");
    file = null;
    return oid;
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) BscStructTreeObj(com.netsteadfast.greenstep.bsc.model.BscStructTreeObj) FileOutputStream(java.io.FileOutputStream) XSSFWorkbook(org.apache.poi.xssf.usermodel.XSSFWorkbook) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) File(java.io.File)

Example 19 with VisionVO

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

the class KpiReportPdfCommand method createPdf.

private String createPdf(Context context) throws Exception {
    BscReportPropertyUtils.loadData();
    // 2015-04-18 add
    BscReportSupportUtils.loadExpression();
    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 document = new Document(PageSize.A4, 10, 10, 10, 10);
    document.left(100f);
    document.top(150f);
    PdfWriter writer = PdfWriter.getInstance(document, os);
    document.open();
    int dateRangeRows = 4 + vision.getPerspectives().get(0).getObjectives().get(0).getKpis().get(0).getDateRangeScores().size();
    PdfPTable table = new PdfPTable(MAX_COLSPAN);
    PdfPTable dateRangeTable = new PdfPTable(dateRangeRows);
    PdfPTable chartsTable = new PdfPTable(2);
    PdfPTable signTable = new PdfPTable(1);
    table.setWidthPercentage(100f);
    dateRangeTable.setWidthPercentage(100f);
    chartsTable.setWidthPercentage(100f);
    signTable.setWidthPercentage(100f);
    this.createHead(table, vision);
    this.createBody(table, vision);
    this.createDateRange(dateRangeTable, vision, context, dateRangeRows);
    this.putCharts(chartsTable, context);
    this.putSignature(signTable, context);
    document.add(chartsTable);
    document.add(table);
    document.add(dateRangeTable);
    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, "kpi-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) ByteArrayOutputStream(java.io.ByteArrayOutputStream) 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 20 with VisionVO

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

the class StrategyMapLogicServiceImpl 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 visionOid, Map<String, Object> jsonData) throws ServiceException, Exception {
    this.delete(visionOid);
    VisionVO vision = new VisionVO();
    vision.setOid(visionOid);
    DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
    if (vResult.getValue() == null) {
        // 沒 TB_VISION 資料, 不用清 STRATEGY MAP 			
        throw new ServiceException(vResult.getSystemMessage().getValue());
    }
    vision = vResult.getValue();
    StrategyMapVO strategyMap = new StrategyMapVO();
    strategyMap.setVisId(vision.getVisId());
    DefaultResult<StrategyMapVO> smResult = strategyMapService.saveObject(strategyMap);
    if (smResult.getValue() == null) {
        throw new ServiceException(smResult.getSystemMessage().getValue());
    }
    strategyMap = smResult.getValue();
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(Boolean.TRUE);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    this.saveNodesAndConnections(strategyMap, jsonData);
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) StrategyMapVO(com.netsteadfast.greenstep.vo.StrategyMapVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

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