|
@ -1,5 +1,6 @@
|
|
package com.yihu.quota.controller;
|
|
package com.yihu.quota.controller;
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
import com.yihu.ehr.constants.ApiVersion;
|
|
import com.yihu.ehr.constants.ApiVersion;
|
|
import com.yihu.ehr.constants.ServiceApi;
|
|
import com.yihu.ehr.constants.ServiceApi;
|
|
import com.yihu.ehr.util.rest.Envelop;
|
|
import com.yihu.ehr.util.rest.Envelop;
|
|
@ -10,6 +11,7 @@ import com.yihu.quota.model.rest.FieldInfo;
|
|
import com.yihu.quota.service.cube.CubeMappingService;
|
|
import com.yihu.quota.service.cube.CubeMappingService;
|
|
import com.yihu.quota.service.cube.CubeMemberMappingService;
|
|
import com.yihu.quota.service.cube.CubeMemberMappingService;
|
|
import com.yihu.quota.service.cube.CubeService;
|
|
import com.yihu.quota.service.cube.CubeService;
|
|
|
|
import com.yihu.quota.service.cube.ElasticSearchDataProcessService;
|
|
import com.yihu.quota.util.ElasticSearchHandler;
|
|
import com.yihu.quota.util.ElasticSearchHandler;
|
|
import com.yihu.quota.vo.CubeMappingModel;
|
|
import com.yihu.quota.vo.CubeMappingModel;
|
|
import com.yihu.quota.vo.CubeMemberMappingModel;
|
|
import com.yihu.quota.vo.CubeMemberMappingModel;
|
|
@ -25,7 +27,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by janseny on 2018/9/19.
|
|
* Created by janseny on 2018/9/19.
|
|
@ -43,6 +47,8 @@ public class CubeController extends BaseController {
|
|
private CubeMemberMappingService cubeMemberMappingService;
|
|
private CubeMemberMappingService cubeMemberMappingService;
|
|
@Autowired
|
|
@Autowired
|
|
private ElasticSearchHandler esHandler;
|
|
private ElasticSearchHandler esHandler;
|
|
|
|
@Autowired
|
|
|
|
private ElasticSearchDataProcessService elasticSearchDataProcessService;
|
|
|
|
|
|
@ApiOperation(value = "创建多维数据集ES的mapping结构 ")
|
|
@ApiOperation(value = "创建多维数据集ES的mapping结构 ")
|
|
@RequestMapping(value = "/elasticSearchMapping", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/elasticSearchMapping", method = RequestMethod.GET)
|
|
@ -143,4 +149,39 @@ public class CubeController extends BaseController {
|
|
envelop.setSuccessFlg(false);
|
|
envelop.setSuccessFlg(false);
|
|
return envelop;
|
|
return envelop;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "测试保存mapping 数据 ")
|
|
|
|
@RequestMapping(value = "/saveElasticSearchMappingData", method = RequestMethod.GET)
|
|
|
|
public Envelop saveElasticSearchMappingData(
|
|
|
|
@ApiParam(name = "table", value = "表", required = true)
|
|
|
|
@RequestParam(value = "table", required = true) String table,
|
|
|
|
@ApiParam(name = "rowkey", value = "行数据唯一键值", required = true)
|
|
|
|
@RequestParam(value = "rowkey", required = true) String rowkey,
|
|
|
|
@ApiParam(name = "cloumn", value = "列", required = true)
|
|
|
|
@RequestParam(value = "cloumn", required = true) String cloumn,
|
|
|
|
@ApiParam(name = "cloumnValue", value = "列值", required = true)
|
|
|
|
@RequestParam(value = "cloumnValue", required = true) Object cloumnValue,
|
|
|
|
@ApiParam(name = "action", value = "执行动作 1:put 添加修改数据 2:del 删除单个字段值 3:delAll 删除整行", required = true)
|
|
|
|
@RequestParam(value = "action", required = true) Object action
|
|
|
|
|
|
|
|
){
|
|
|
|
Envelop envelop = new Envelop();
|
|
|
|
envelop.setSuccessFlg(true);
|
|
|
|
try {
|
|
|
|
Gson gson = new Gson();
|
|
|
|
Map<String, Object> source = new HashMap<>();
|
|
|
|
source.put("dataSource","hbase");
|
|
|
|
source.put("table",table);
|
|
|
|
source.put("rowkey",rowkey);
|
|
|
|
source.put("action",action);
|
|
|
|
source.put(cloumn,cloumnValue);
|
|
|
|
String jsonData = gson.toJson(source);
|
|
|
|
elasticSearchDataProcessService.saveData(jsonData);
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
envelop.setSuccessFlg(false);
|
|
|
|
}
|
|
|
|
return envelop;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|