use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class PerformanceScoreChainUtils method createOrUpdateMonitorItemScore.
public static void createOrUpdateMonitorItemScore(String dateVal, Context context) throws ServiceException, Exception {
ChainResultObj result = getResult(context);
if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) {
logger.warn("No data!");
return;
}
//String dateVal = SimpleUtils.getStrYMD("");
String frequency = (String) context.get("frequency");
String orgId = (String) context.get("orgId");
String empId = (String) context.get("empId");
List<VisionVO> visions = ((BscStructTreeObj) result.getValue()).getVisions();
for (VisionVO vision : visions) {
List<PerspectiveVO> perspectives = vision.getPerspectives();
MonitorItemScoreVO visionMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.VISION, vision.getVisId());
//visionMonitorItemScore.setScore( BscReportSupportUtils.parse2(vision.getScore()) );
setScore(visionMonitorItemScore, vision.getScore());
saveOrUpdateMonitorItemScore(visionMonitorItemScore);
for (PerspectiveVO perspective : perspectives) {
List<ObjectiveVO> objectives = perspective.getObjectives();
MonitorItemScoreVO perspectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.PERSPECTIVES, perspective.getPerId());
//perspectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(perspective.getScore()) );
setScore(perspectiveMonitorItemScore, perspective.getScore());
saveOrUpdateMonitorItemScore(perspectiveMonitorItemScore);
for (ObjectiveVO objective : objectives) {
List<KpiVO> kpis = objective.getKpis();
MonitorItemScoreVO objectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.STRATEGY_OF_OBJECTIVES, objective.getObjId());
//objectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(objective.getScore()) );
setScore(objectiveMonitorItemScore, objective.getScore());
saveOrUpdateMonitorItemScore(objectiveMonitorItemScore);
for (KpiVO kpi : kpis) {
MonitorItemScoreVO kpiMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.KPI, kpi.getId());
//kpiMonitorItemScore.setScore( BscReportSupportUtils.parse2(kpi.getScore()) );
setScore(kpiMonitorItemScore, kpi.getScore());
saveOrUpdateMonitorItemScore(kpiMonitorItemScore);
}
}
}
}
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method fillLineChartData.
private void fillLineChartData(BscStructTreeObj treeObj) throws Exception {
// 給 09 - Dashboard 用的 , 判斷 用第1筆的資料來組 categories 的變數
int c = 0;
List<VisionVO> visions = treeObj.getVisions();
for (VisionVO vision : visions) {
if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
continue;
}
// 在 Dashboard 查詢時, 一定要選 vision, 所以只會有一個 vision , 給 09 - Dashboard 用的
this.subTitle = vision.getTitle();
for (PerspectiveVO perspective : vision.getPerspectives()) {
// 給 04 - Perspectives Dashboard 用的
this.perspectiveItems.add(perspective);
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
Map<String, String> labelMap = new HashMap<String, String>();
List<List<Object>> dataList = new LinkedList<List<Object>>();
labelMap.put("label", kpi.getName());
this.lineChartNames.add(labelMap);
for (DateRangeScoreVO entry : kpi.getDateRangeScores()) {
List<Object> dateScoreList = new LinkedList<Object>();
dateScoreList.add(entry.getDate().replaceAll("/", "-"));
dateScoreList.add(entry.getScore());
dataList.add(dateScoreList);
}
this.lineChartValues.add(dataList);
// ----------------------------------------------------------------------
// 給 09 - Dashboard 用的
// 給 Dashboard 頁面 trend line chart 用的資料
Map<String, Object> mapData = new HashMap<String, Object>();
List<Float> rangeScore = new LinkedList<Float>();
for (DateRangeScoreVO dateRangeScore : kpi.getDateRangeScores()) {
if (c == 0) {
// 用第1筆的資料來組 categories 就可已了
categories.add(dateRangeScore.getDate());
}
rangeScore.add(dateRangeScore.getScore());
}
mapData.put("name", kpi.getName());
mapData.put("data", rangeScore);
this.series.add(mapData);
c++;
// ----------------------------------------------------------------------
}
}
}
}
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class KpiReportContentQueryAction method fillPerspectivesBarChartData.
private void fillPerspectivesBarChartData(BscStructTreeObj treeObj) throws Exception {
Map<String, Object> valueMap = new LinkedHashMap<String, Object>();
List<Map<String, Object>> values = new LinkedList<Map<String, Object>>();
valueMap.put("key", "Perspectives");
List<VisionVO> visions = treeObj.getVisions();
for (VisionVO vision : visions) {
if (!vision.getOid().equals(this.getFields().get("visionOid"))) {
continue;
}
for (PerspectiveVO perspective : vision.getPerspectives()) {
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("label", perspective.getName());
dataMap.put("value", perspective.getScore());
values.add(dataMap);
this.perspectivesBarChartBgColor.add(perspective.getBgColor());
}
}
valueMap.put("values", values);
this.perspectivesBarChartValue.add(valueMap);
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class ObjectiveManagementAction method loadObjectiveData.
private void loadObjectiveData() throws ServiceException, Exception {
this.transformFields2ValueObject(this.objective, new String[] { "oid" });
DefaultResult<ObjectiveVO> result = this.objectiveService.findObjectByOid(objective);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.objective = result.getValue();
PerspectiveVO perspective = new PerspectiveVO();
perspective.setPerId(this.objective.getPerId());
DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findByUK(perspective);
if (pResult.getValue() == null) {
throw new ServiceException(pResult.getSystemMessage().getValue());
}
perspective = pResult.getValue();
this.getFields().put("perspectiveOid", perspective.getOid());
VisionVO vision = new VisionVO();
vision.setVisId(perspective.getVisId());
DefaultResult<VisionVO> vResult = this.visionService.findForSimpleByVisId(vision.getVisId());
if (vResult.getValue() == null) {
throw new ServiceException(vResult.getSystemMessage().getValue());
}
vision = vResult.getValue();
this.getFields().put("visionOid", vision.getOid());
this.perspectiveMap = this.perspectiveService.findForMapByVisionOid(vision.getOid(), true);
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class RegionMapRelationKpisAction method fillRelationKpis.
private void fillRelationKpis(BscStructTreeObj treeObj) throws Exception {
List<VisionVO> visions = treeObj.getVisions();
for (VisionVO vision : visions) {
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
boolean isFound = false;
for (Map<String, Object> founds : this.relationKpis) {
if (kpi.getId().equals(founds.get("id"))) {
isFound = true;
}
}
if (isFound) {
continue;
}
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("id", kpi.getId());
paramMap.put("name", kpi.getName());
paramMap.put("score", NumberUtils.toFloat(BscReportSupportUtils.parse2(kpi.getScore())));
paramMap.put("bgColor", kpi.getBgColor());
paramMap.put("fontColor", kpi.getFontColor());
paramMap.put("target", kpi.getTarget());
paramMap.put("min", kpi.getMin());
this.relationKpis.add(paramMap);
}
}
}
}
}
Aggregations