use of com.netsteadfast.greenstep.vo.StrategyMapVO in project bamboobsc by billchen198318.
the class LoadStrategyMapItemsForRecCommand method fillStrategyMapItems.
private StrategyMapItemsVO fillStrategyMapItems(VisionVO vision, Context context) throws ServiceException, Exception {
StrategyMapItemsVO mapItems = new StrategyMapItemsVO();
int w = 190;
StrategyMapVO map = new StrategyMapVO();
map.setVisId(vision.getVisId());
DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(map);
if (smResult.getValue() == null) {
this.setMessage(context, smResult.getSystemMessage().getValue());
return mapItems;
}
map = smResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("masterOid", map.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++) {
BbStrategyMapNodes node = nodes.get(i);
String div = "<div class=\"w\" id=\"" + node.getId() + "\">" + node.getText() + "<div class=\"ep\"></div></div>";
String css = "#" + node.getId() + " { left:" + node.getPositionX() + "px; top:" + node.getPositionY() + "px; width:" + w + "px; }";
mapItems.getDiv().add(div);
mapItems.getCss().add(css);
}
for (int i = 0; conns != null && i < conns.size(); i++) {
BbStrategyMapConns conn = conns.get(i);
mapItems.getCon().add("{ source:\"" + conn.getSourceId() + "\", target:\"" + conn.getTargetId() + "\" }");
}
return mapItems;
}
use of com.netsteadfast.greenstep.vo.StrategyMapVO 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;
}
use of com.netsteadfast.greenstep.vo.StrategyMapVO 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.StrategyMapVO in project bamboobsc by billchen198318.
the class VisionLogicServiceImpl method deleteStrategyMap.
private void deleteStrategyMap(VisionVO vision) throws ServiceException, Exception {
StrategyMapVO strategyMap = new StrategyMapVO();
strategyMap.setVisId(vision.getVisId());
DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(strategyMap);
if (smResult.getValue() == null) {
// 沒有 BB_STRATEGY_MAP 資料
return;
}
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));
}
this.strategyMapService.deleteObject(strategyMap);
}
Aggregations