use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class StrategyMapLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(String visionOid) throws ServiceException, Exception {
if (super.isBlank(visionOid) || super.isNoSelectId(visionOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_SUCCESS)));
VisionVO vision = new VisionVO();
vision.setOid(visionOid);
DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
if (vResult.getValue() == null) {
// 沒 TB_VISION 資料, 不用清 STRATEGY MAP
return result;
}
vision = vResult.getValue();
StrategyMapVO strategyMap = new StrategyMapVO();
strategyMap.setVisId(vision.getVisId());
DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(strategyMap);
if (smResult.getValue() == null) {
// 沒有 BB_STRATEGY_MAP 資料
return result;
}
strategyMap = smResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("masterOid", strategyMap.getOid());
List<BbStrategyMapNodes> nodes = this.strategyMapNodesService.findListByParams(params);
List<BbStrategyMapConns> conns = this.strategyMapConnsService.findListByParams(params);
for (int i = 0; nodes != null && i < nodes.size(); i++) {
strategyMapNodesService.delete(nodes.get(i));
}
for (int i = 0; conns != null && i < conns.size(); i++) {
strategyMapConnsService.delete(conns.get(i));
}
return strategyMapService.deleteObject(strategyMap);
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class BscMobileCardUtils method getVisionCardFromUpload.
public static VisionVO getVisionCardFromUpload(String uploadOid) throws ServiceException, Exception {
byte[] content = UploadSupportUtils.getDataBytes(uploadOid);
String jsonStr = new String(content, Constants.BASE_ENCODING);
if (StringUtils.isBlank(jsonStr)) {
throw new Exception("vision-card json data error.");
}
VisionVO vision = new ObjectMapper().readValue(jsonStr, VisionVO.class);
return vision;
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class BscMobileCardUtils method getVisionCard.
public static List<VisionVO> getVisionCard(String frequency, String startDate, String endDate) throws ServiceException, Exception {
List<VisionVO> visionScores = new ArrayList<VisionVO>();
Map<String, String> visions = visionService.findForMap(false);
if (null == visions || visions.size() < 1) {
return visionScores;
}
Context context = new ContextBase();
context.put("startDate", startDate);
context.put("endDate", endDate);
context.put("startYearDate", startDate.substring(0, 4));
context.put("endYearDate", endDate.substring(0, 4));
context.put("frequency", frequency);
context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ALL);
context.put("orgId", BscConstants.MEASURE_DATA_ORGANIZATION_FULL);
context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
for (Map.Entry<String, String> entry : visions.entrySet()) {
String visionOid = entry.getKey();
context.put("visionOid", visionOid);
SimpleChain chain = new SimpleChain();
ChainResultObj resultObj = chain.getResultFromResource("performanceScoreChain", context);
BscStructTreeObj treeObj = (BscStructTreeObj) resultObj.getValue();
for (int i = 0; treeObj.getVisions() != null && i < treeObj.getVisions().size(); i++) {
VisionVO vision = treeObj.getVisions().get(i);
vision.setContent(" ".getBytes());
DefaultResult<VisionVO> vResult = visionService.findObjectByOid(vision);
if (vResult.getValue() != null) {
// 計算分數chain 取出的vision資料沒有放 content 欄位, 但這邊要用到, 所以取出content欄位
vision.setContent(new String(vResult.getValue().getContent(), Constants.BASE_ENCODING).getBytes());
}
for (PerspectiveVO perspective : vision.getPerspectives()) {
for (ObjectiveVO objective : perspective.getObjectives()) {
for (KpiVO kpi : objective.getKpis()) {
// 產生報表不需要以下欄位
kpi.getAggregationMethod().setDescription(" ");
kpi.getAggregationMethod().setExpression1(" ");
kpi.getAggregationMethod().setExpression2(" ");
kpi.getFormula().setExpression(" ");
}
}
}
visionScores.add(vision);
}
}
return visionScores;
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class BscMobileCardUtils method getDashboardScore.
public static VisionVO getDashboardScore(String visionOid, String frequency, String startDate, String endDate) throws ServiceException, Exception {
String startYear = "";
String endYear = "";
if (BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency) || BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency)) {
startYear = startDate.substring(0, 4);
endYear = endDate.substring(0, 4);
}
ChainResultObj result = PerformanceScoreChainUtils.getResult(visionOid, startDate, endDate, startYear, endYear, frequency, BscConstants.MEASURE_DATA_FOR_ALL, "", "");
if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
}
BscStructTreeObj resultObj = (BscStructTreeObj) result.getValue();
VisionVO visionObj = resultObj.getVisions().get(0);
return visionObj;
}
use of com.netsteadfast.greenstep.vo.VisionVO in project bamboobsc by billchen198318.
the class HistoryItemScoreReportContentQueryUtils method getBasicDataList.
private static List<VisionVO> getBasicDataList() throws ServiceException, Exception {
List<VisionVO> visions = new LinkedList<VisionVO>();
List<VisionVO> visionsTempList = new ArrayList<VisionVO>();
Map<String, String> visionMap = visionService.findForMap(false);
for (Map.Entry<String, String> visionEntry : visionMap.entrySet()) {
DefaultResult<VisionVO> visionResult = visionService.findForSimple(visionEntry.getKey());
if (visionResult.getValue() == null) {
throw new ServiceException(visionResult.getSystemMessage().getValue());
}
VisionVO vision = visionResult.getValue();
visionsTempList.add(vision);
}
Map<String, Object> paramMap = new HashMap<String, Object>();
for (VisionVO vision : visionsTempList) {
paramMap.clear();
paramMap.put("visId", vision.getVisId());
List<PerspectiveVO> perspectivesList = perspectiveService.findListVOByParams(paramMap);
for (int p = 0; perspectivesList != null && p < perspectivesList.size(); p++) {
PerspectiveVO perspective = perspectivesList.get(p);
vision.getPerspectives().add(perspective);
paramMap.clear();
paramMap.put("perId", perspective.getPerId());
List<ObjectiveVO> objectivesList = objectiveService.findListVOByParams(paramMap);
for (int o = 0; objectivesList != null && o < objectivesList.size(); o++) {
ObjectiveVO objective = objectivesList.get(o);
perspective.getObjectives().add(objective);
paramMap.clear();
paramMap.put("objId", objective.getObjId());
List<KpiVO> kpiList = kpiService.findListVOByParams(paramMap);
if (kpiList != null && kpiList.size() > 0) {
objective.getKpis().addAll(kpiList);
}
}
}
}
// 必須有 KPI 才能放到回傳的 visions
for (int v = 0; v < visionsTempList.size(); v++) {
boolean isFoundData = true;
VisionVO vision = visionsTempList.get(v);
for (int p = 0; p < vision.getPerspectives().size() && isFoundData; p++) {
PerspectiveVO perspective = vision.getPerspectives().get(p);
for (int o = 0; o < perspective.getObjectives().size() && isFoundData; o++) {
ObjectiveVO objective = perspective.getObjectives().get(o);
if (objective.getKpis() == null || objective.getKpis().size() < 1) {
isFoundData = false;
}
}
}
if (isFoundData) {
visions.add(vision);
}
}
return visions;
}
Aggregations