Compare commits
3 Commits
0c8b2f1f57
...
3dc4676491
Author | SHA1 | Date |
---|---|---|
wangliwen | 3dc4676491 | |
dinggang | 27218ae82b | |
wangliwen | e057a5550c |
|
@ -116,7 +116,7 @@ public class CensusControllerV2 {
|
|||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
|
||||
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源';", Long.class);
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
|
|
|
@ -20,4 +20,5 @@ public class Tsingtao_xhaProperties {
|
|||
private String localcam;
|
||||
private String resourcecount;
|
||||
private String resourceapplyinfo;
|
||||
private String sjzy;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ import io.renren.common.utils.Result;
|
|||
import io.renren.common.validator.ValidatorUtils;
|
||||
import io.renren.common.validator.group.AddGroup;
|
||||
import io.renren.common.validator.group.DefaultGroup;
|
||||
import io.renren.modules.resource.dataResource.AbstractDataResourceService;
|
||||
import io.renren.modules.resource.dataResource.DataResourceFactory;
|
||||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.renren.modules.resource.excel.ResourceExcelImportListener;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
|
@ -323,8 +326,6 @@ public class ResourceController {
|
|||
HashMap result = JSONObject.parseObject(json, HashMap.class);
|
||||
|
||||
List<Map> rows = (List<Map>) result.get("data");
|
||||
|
||||
|
||||
List<Object> objects = rows.stream()
|
||||
.filter(item -> item.get("main") != null)
|
||||
.map(item -> item.get("main"))
|
||||
|
@ -402,7 +403,7 @@ public class ResourceController {
|
|||
*/
|
||||
|
||||
@GetMapping("getHls")
|
||||
@ApiOperation("对接知识库数据")
|
||||
@ApiOperation("获取hls地址")
|
||||
public Result<String> getHls(String key) {
|
||||
Optional<AbstractVideoPreviewService> factory = VideoPreviewFactory.build();
|
||||
if (factory.isPresent()) {
|
||||
|
@ -412,4 +413,15 @@ public class ResourceController {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getDataResource")
|
||||
@ApiOperation("获取数据资源")
|
||||
public Result<Object> getDataResource(@RequestBody GetDataResourceListDto dto) {
|
||||
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
||||
if (factory.isPresent()) {
|
||||
Object dataResource = factory.get().getDataResource(dto);
|
||||
return new Result<Object>().ok(dataResource);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package io.renren.modules.resource.dataResource;
|
||||
|
||||
|
||||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 视频预览抽象类
|
||||
*/
|
||||
public abstract class AbstractDataResourceService {
|
||||
|
||||
/**
|
||||
* 获取数据资源列表
|
||||
*
|
||||
* @param Map 查询参数集合
|
||||
* @return
|
||||
*/
|
||||
public abstract Object getDataResource(GetDataResourceListDto dto);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package io.renren.modules.resource.dataResource;
|
||||
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.domain.BaoTouProperties;
|
||||
import io.renren.common.domain.TsingtaoProperties;
|
||||
import io.renren.common.domain.Tsingtao_xhaProperties;
|
||||
import io.renren.common.utils.SpringContextUtils;
|
||||
import io.renren.modules.resource.dataResource.domain.TsingtaoXHADataResourceService;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 数据资源工厂类
|
||||
*/
|
||||
public final class DataResourceFactory {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataResourceFactory.class);
|
||||
|
||||
private static ResourceService resourceService;
|
||||
|
||||
private static int projectPlace;
|
||||
|
||||
private static TsingtaoProperties tsingtaoProperties; // 青岛市区配置
|
||||
|
||||
private static Tsingtao_xhaProperties tsingtao_xhaProperties; // 青岛西海岸配置
|
||||
|
||||
static {
|
||||
DataResourceFactory.resourceService = SpringContextUtils.getBean(ResourceService.class);
|
||||
DataResourceFactory.projectPlace = resourceService.getProjectPlace();
|
||||
DataResourceFactory.tsingtaoProperties = SpringContextUtils.getBean(TsingtaoProperties.class);
|
||||
DataResourceFactory.tsingtao_xhaProperties = SpringContextUtils.getBean(Tsingtao_xhaProperties.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据资源服务实现
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Optional<AbstractDataResourceService> build() {
|
||||
AbstractDataResourceService abstractDataResourceService = null;
|
||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case TSINGTAO: { // 青岛市局
|
||||
}
|
||||
break;
|
||||
case TSINGTAO_XHA: { // 青岛西海岸
|
||||
abstractDataResourceService = new TsingtaoXHADataResourceService(tsingtao_xhaProperties);
|
||||
}
|
||||
break;
|
||||
case UNKNOWN: { // 未知区域
|
||||
logger.error("区域未知");
|
||||
}
|
||||
break;
|
||||
}
|
||||
return Optional.ofNullable(abstractDataResourceService);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package io.renren.modules.resource.dataResource.domain;
|
||||
|
||||
import io.renren.modules.resource.dataResource.AbstractDataResourceService;
|
||||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 青岛市局数据资源
|
||||
*/
|
||||
public class TsingtaoDataResourceService extends AbstractDataResourceService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TsingtaoDataResourceService.class);
|
||||
@Override
|
||||
public Object getDataResource(GetDataResourceListDto dto) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package io.renren.modules.resource.dataResource.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.renren.common.domain.Tsingtao_xhaProperties;
|
||||
import io.renren.modules.resource.dataResource.AbstractDataResourceService;
|
||||
import io.renren.modules.resource.dto.GetDataResourceListDto;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* 青岛西海岸数据资源
|
||||
*/
|
||||
public class TsingtaoXHADataResourceService extends AbstractDataResourceService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TsingtaoXHADataResourceService.class);
|
||||
Tsingtao_xhaProperties tsingtao_xhaProperties;
|
||||
|
||||
public TsingtaoXHADataResourceService(Tsingtao_xhaProperties tsingtao_xhaProperties) {
|
||||
this.tsingtao_xhaProperties = tsingtao_xhaProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDataResource(GetDataResourceListDto dto){
|
||||
JSONObject result = null;
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getSjzy(),
|
||||
dto.getServiceName(), dto.getOrderField(), dto.getOrderType(), dto.getPageNum(), dto.getPageSize())).build();
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject jsonObject = JSON.parseObject(response.body().string());
|
||||
if (jsonObject.containsKey("data")) {
|
||||
result = jsonObject.getJSONObject("data");
|
||||
}
|
||||
} else {
|
||||
logger.error("西海岸数据资源列表获取失败");
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.error("西海岸数据资源列表获取失败", exception);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package io.renren.modules.resource.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据资源查询参数对象
|
||||
*/
|
||||
@Data
|
||||
public class GetDataResourceListDto {
|
||||
|
||||
//名称,模糊查询
|
||||
private String serviceName;
|
||||
//排序字段
|
||||
private String orderField;
|
||||
//排序方式:desc,asc
|
||||
private String orderType;
|
||||
//分页页数
|
||||
private Integer pageNum;
|
||||
//分页大小
|
||||
private Integer pageSize;
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package io.renren.modules.resource.videoPreview;
|
||||
|
||||
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.domain.BaoTouProperties;
|
||||
import io.renren.common.domain.TsingtaoProperties;
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.renren.common.validator.ValidatorUtils;
|
|||
import io.renren.common.validator.group.AddGroup;
|
||||
import io.renren.common.validator.group.DefaultGroup;
|
||||
import io.renren.common.validator.group.UpdateGroup;
|
||||
import io.renren.modules.resource.service.ResourceService;
|
||||
import io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO;
|
||||
import io.renren.modules.resourceBrowse.excel.ResourceBrowseExcel;
|
||||
import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
|
||||
|
@ -38,6 +39,8 @@ import java.util.Map;
|
|||
public class ResourceBrowseController {
|
||||
@Autowired
|
||||
private ResourceBrowseService resourceBrowseService;
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分页")
|
||||
|
@ -45,12 +48,12 @@ public class ResourceBrowseController {
|
|||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
|
||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
|
||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
|
||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
|
||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
|
||||
})
|
||||
//@RequiresPermissions("resourceBrowse:resourcebrowse:page")
|
||||
public Result<PageData<ResourceBrowseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||
PageData<ResourceBrowseDTO> page = resourceBrowseService.page(params);
|
||||
|
||||
page.getList().forEach(item -> item.setResourceDTO(resourceService.get(item.getResourceId())));
|
||||
return new Result<PageData<ResourceBrowseDTO>>().ok(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.renren.modules.resourceBrowse.dto;
|
||||
|
||||
import io.renren.modules.resource.dto.ResourceDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -41,4 +42,9 @@ public class ResourceBrowseDTO implements Serializable {
|
|||
@ApiModelProperty(value = "备用字段3")
|
||||
private String note3;
|
||||
|
||||
@ApiModelProperty(value = "能力信息")
|
||||
private ResourceDTO resourceDTO;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ public class ResourceBrowseServiceImpl extends CrudServiceImpl<ResourceBrowseDao
|
|||
|
||||
@Autowired
|
||||
private ResourceBrowseDao resourceBrowseDao;
|
||||
|
||||
@Value("${system.startDay}")
|
||||
private String systemDay;
|
||||
|
||||
|
|
|
@ -3,4 +3,5 @@ tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weatherwarning/camera/getCamer
|
|||
tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
|
||||
tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
|
||||
tsingtao-xha.resourcecount=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43
|
||||
tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count
|
||||
tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count
|
||||
tsingtao-xha.sjzy=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43
|
||||
|
|
Loading…
Reference in New Issue