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);
}
}
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations