Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
wangliwen 2022-07-29 18:04:09 +08:00
commit a26fce4ddb
13 changed files with 121 additions and 178 deletions

View File

@ -0,0 +1,10 @@
ALTER TABLE `tb_fuse`
MODIFY COLUMN `description` varchar(1000) DEFAULT NULL COMMENT '融合服务描述',
DROP COLUMN `dept_user`,
DROP COLUMN `mobile`,
DROP COLUMN `provider`,
DROP COLUMN `provider_user`,
DROP COLUMN `provider_mobile`;
ALTER TABLE `tb_fuse_resource`
ADD COLUMN `type` varchar(128) NULL COMMENT '资源类型';

View File

@ -49,12 +49,7 @@ public class FuseController {
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "mobile", value = "部门联系人电话", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "provider", value = "服务商", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "providerUser", value = "服务商联系人", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "providerMobile", value = "服务商联系人电话", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int")
})
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TbFuseDTO> page = tbFuseService.page(params);

View File

@ -18,6 +18,4 @@ public interface TbFuseDao extends BaseDao<TbFuseEntity> {
List<TbFuseDTO> getFuseDTOList(Map params);
List<Map<String, Object>> selectGroupByDeptId();
}

View File

@ -29,16 +29,6 @@ public class TbFuseDTO {
private String applicationArea;
@ApiModelProperty(value = "所属部门")
private Long deptId;
@ApiModelProperty(value = "部门联系人")
private String deptUser;
@ApiModelProperty(value = "部门联系人电话")
private String mobile;
@ApiModelProperty(value = "服务商")
private String provider;
@ApiModelProperty(value = "服务商联系人")
private String providerUser;
@ApiModelProperty(value = "服务商联系人电话")
private String providerMobile;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")

View File

@ -1,6 +1,5 @@
package io.renren.modules.fuse.dto;
import io.renren.modules.resource.dto.ResourceDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -24,6 +23,8 @@ public class TbFuseResourceDTO {
@ApiModelProperty(value = "资源挂载顺序")
private String sequence;
@ApiModelProperty(value = "资源")
private ResourceDTO resource;
private Object resource;
@ApiModelProperty(value = "资源类型")
private String type;
}

View File

@ -43,26 +43,6 @@ public class TbFuseEntity extends BaseEntity {
*/
@TableField(fill = FieldFill.INSERT)
private Long deptId;
/**
* 部门联系人
*/
private String deptUser;
/**
* 部门联系人电话
*/
private String mobile;
/**
* 服务商
*/
private String provider;
/**
* 服务商联系人
*/
private String providerUser;
/**
* 服务商联系人电话
*/
private String providerMobile;
/**
* 创建人
*/

View File

@ -32,4 +32,8 @@ public class TbFuseResourceEntity {
* 顺序
*/
private String sequence;
/**
* 资源类型
*/
private String type;
}

View File

@ -21,6 +21,4 @@ public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
Integer deleteFuse(Long id);
Integer count(Map<String, Object> params);
}

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.Result;
import io.renren.modules.fuse.dao.TbFuseAttrDao;
import io.renren.modules.fuse.dao.TbFuseDao;
import io.renren.modules.fuse.dao.TbFuseResourceDao;
@ -16,10 +17,16 @@ import io.renren.modules.fuse.entity.TbFuseAttrEntity;
import io.renren.modules.fuse.entity.TbFuseEntity;
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
import io.renren.modules.fuse.service.TbFuseService;
import io.renren.modules.monitor.mapper.CameraChannelMapper;
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.service.ResourceService;
import io.renren.modules.resource.service.impl.ResourceServiceImpl;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.service.SysDeptService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -50,6 +57,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
private ResourceService resourceService;
@Autowired
private ResourceCollectionDao resourceCollectionDao;
@Autowired
private CameraChannelMapper cameraChannelMapper;
@Autowired
private SysDeptService sysDeptService;
@Override
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
@ -71,21 +82,6 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
case "deptId":
wrapper.eq(StringUtils.isNotBlank(params.get("deptId").toString()), "dept_id", params.get("deptId").toString());
break;
case "deptUser":
wrapper.like(StringUtils.isNotBlank(params.get("deptUser").toString()), "dept_user", params.get("deptUser").toString());
break;
case "mobile":
wrapper.like(StringUtils.isNotBlank(params.get("mobile").toString()), "mobile", params.get("mobile").toString());
break;
case "provider":
wrapper.like(StringUtils.isNotBlank(params.get("provider").toString()), "provider", params.get("provider").toString());
break;
case "providerUser":
wrapper.like(StringUtils.isNotBlank(params.get("providerUser").toString()), "provider_user", params.get("providerUser").toString());
break;
case "providerMobile":
wrapper.like(StringUtils.isNotBlank(params.get("providerMobile").toString()), "provider_mobile", params.get("providerMobile").toString());
break;
case "creator":
wrapper.eq(StringUtils.isNotBlank(params.get("creator").toString()), "creator", params.get("creator").toString());
break;
@ -115,23 +111,15 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
}
params.put("userId", SecurityUser.getUserId());
List<TbFuseDTO> dtoList = baseDao.getFuseDTOList(params);
Map<String, Map<String, Object>> dataResourceList=getDataResource();
dtoList.forEach(dto -> {
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId()));
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId(), dataResourceList));
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
});
List<TbFuseDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
return new PageData(result, dtoList.size());
}
@Override
public Integer count(Map<String, Object> params) {
if (params != null) {
return baseDao.selectCount(getWrapper(params));
} else {
return baseDao.selectCount(null);
}
}
@Override
public TbFuseDTO getFuseById(Long id) {
TbFuseEntity fuseEntity = fuseDao.selectById(id);
@ -141,7 +129,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
TbFuseDTO fuseDTO = new TbFuseDTO();
BeanUtils.copyProperties(fuseEntity, fuseDTO);
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id));
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id, getDataResource()));
setCollection(fuseDTO);
return fuseDTO;
}
@ -166,16 +154,58 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
}).collect(Collectors.toList());
}
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId) {
private Map<String, Map<String, Object>> getDataResource() {
Map<String, Map<String, Object>> result = new HashMap<>();
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) {
GetDataResourceListDto dto = new GetDataResourceListDto().setPageNum(0).setPageSize(30);
Map<String, Object> dataMap = (Map<String, Object>) factory.get().getDataResource(dto);
if (dataMap != null) {
List<Map<String, Object>> list = (List<Map<String, Object>>) dataMap.get("data");
list.stream().forEach(map -> {
if (map.containsKey("zyname")) {
result.put(map.get("guid").toString(), map);
} else {
result.put(map.get("serviceId").toString(), map);
}
});
}
}
return result;
}
private List<TbFuseResourceDTO> getFuseResourceByFuseId(Long fuseId, Map<String, Map<String, Object>> dataResourceMap) {
List<TbFuseResourceDTO> result = new ArrayList();
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("fuse_id", fuseId);
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
return list.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto);
dto.setResource(resourceService.get(dto.getResourceId()));
return dto;
}).collect(Collectors.toList());
list.stream().collect(Collectors.groupingBy(TbFuseResourceEntity::getType)).forEach((type, value) -> {
if ("组件服务".equals(type)) {
result.addAll(value.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto);
ResourceDTO resourceDTO=resourceService.get(dto.getResourceId());
resourceDTO.setDeptName(sysDeptService.get(resourceDTO.getDeptId()).getName());
dto.setResource(resourceDTO);
return dto;
}).collect(Collectors.toList()));
} else if ("数据资源".equals(type)) {
result.addAll(value.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto);
dto.setResource(dataResourceMap.get(dto.getResourceId()));
return dto;
}).collect(Collectors.toList()));
} else if ("基础设施".equals(type)) {
result.addAll(value.stream().map(attr -> {
TbFuseResourceDTO dto = new TbFuseResourceDTO();
BeanUtils.copyProperties(attr, dto);
dto.setResource(cameraChannelMapper.selectById(dto.getResourceId().toString()));
return dto;
}).collect(Collectors.toList()));
}
});
return result;
}
@Override

View File

@ -1,5 +1,6 @@
package io.renren.modules.monitor.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import io.renren.modules.monitor.dto.*;
@ -151,9 +152,7 @@ public class Controller {
List<CameraChannelDto1> list = cameraChannelMapper.selectByChannelCode(channelCode);
Result success = Result.success(list);
return success;
return Result.success(list);
}
@ -170,9 +169,7 @@ public class Controller {
List<CameraChannel> labels = cameraChannelMapper.selectByChannelName(channelName);
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -254,8 +251,7 @@ public class Controller {
public Result selectAllByGps(Double gpsX,Double gpsY,Integer radius){
double[] around = LongLatUtil.getAround(gpsX, gpsY, radius);
List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]);
Result success = Result.success(c);
return success;
return Result.success(c);
}
/**
@ -268,9 +264,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectAllLabel();
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -283,9 +277,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectByLabelCity();
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
* 根据标签名字模糊查询标签
@ -299,9 +291,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectByLabelName(labelName);
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -319,9 +309,7 @@ public class Controller {
List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
Result success = Result.success(organs);
return success;
return Result.success(organs);
}
/**
@ -338,24 +326,13 @@ public class Controller {
})
public Result selectNLAll(Integer page,Integer pageSize,String labelCode){
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize);
if (labelCode != null && labelCode != ""){
if (labelCode != null && !"".equals(labelCode)){
List<CameraChannelNLDto> dtos = cameraChannelMapper.selectByLabel(page, pageSize);
Result success = Result.success(dtos);
return success;
return Result.success(dtos);
}
Result success = Result.success(selectNLAll);
return success;
return Result.success(selectNLAll);
}
//查询视频点播巡检结果只取异常的
// @RequestMapping("listChannelPlayStates")
// public Result listChannelPlayStates(
// @RequestParam(value="page",required = false,defaultValue = "1") Integer page,
// @RequestParam(value="pageSize",required = false,defaultValue = "20") Integer pageSize
// ){
// return monitorService.listChannelPlayStates();
// }
//道路统计数据与排名
@GetMapping("roadData")
@ApiOperation("道路统计数据与排名根据后台dt调用接口")
@ -450,8 +427,7 @@ public class Controller {
@GetMapping("passengerFlow")
@ApiOperation("获取最新的客流列表,测试接口,调用接口获取")
public List<Map> passengerFlow(){
List<Map> list = passengerFlowService.passengerFlow();
return list;
return passengerFlowService.passengerFlow();
}
//获取最新的实时客流列表从表获取
@ -459,15 +435,13 @@ public class Controller {
@ApiOperation("获取最新的实时客流列表,从表获取,热力图")
@ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string")
public List<PassengerFlow> listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
return list;
return passengerFlowService.listPassengerFlow(timeId);
}
//从表中获取最新的客流列表并筛选出all_nums >=5000的
@GetMapping("listPassengerFlowByAllNums")
@ApiOperation("从表中获取最新的客流列表并筛选出all_nums >=5000的")
public List<PassengerFlow> listPassengerFlowByAllNums(){
List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums();
return list;
return passengerFlowService.listPassengerFlowByAllNums();
}
//获取实时客流并保存到表t_passenger_flow
@ -567,7 +541,7 @@ public class Controller {
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double")
})
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer radius){
List<BuildingSite> list = new ArrayList<>();
List<BuildingSite> list;
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,radius);
return Result.success(list);
}
@ -580,8 +554,7 @@ public class Controller {
@ApiOperation("查询全部工地信息")
public Result selectBuildSite(){
List<BuildingSite> buildingSites = buildingSiteMapper.selectBuildSite();
Result success = Result.success(buildingSites);
return success;
return Result.success(buildingSites);
}
/******************************2022/07/13 ytl修改视频资源 start********************************************/
@ -598,13 +571,9 @@ public class Controller {
if (parentId == null){
parentId = "";
}
//List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
List<Map> maps = monitorService.selectSubOrganizationNew(parentId);
Result success = Result.success(maps);
return success;
return Result.success(maps);
}
/**
@ -640,23 +609,19 @@ public class Controller {
list1 = Arrays.asList(labelCodes);
}
//查询当前地区及下级地区的id,组成list,2022-07-14,ytl
List<Map> orgenIds = new ArrayList<>();
String path = "";
if(queryMap.get("parentId") != null && StringUtils.isNotBlank(queryMap.get("parentId").toString())){
//根据parentId获取地区表中的path
Map parentId = cameraOrgenMapper.selectOrgenizationById(queryMap.get("parentId").toString());
path = parentId.get("path").toString();
}
List<Map> list = cameraChannelMapper.selectByParentIdNew(queryMap, list1,path);
Result success = Result.success(list);
success.setCount(cameraChannelMapper.selectByParentIdCountNew(queryMap, list1,path));
return success;
}
/**
* 摄像头按照市区进行聚合查询
*/
@ -670,24 +635,18 @@ public class Controller {
* 保存区域信息
*/
@GetMapping("/saveOrgenization")
public Result saveOrgenization() throws Exception{
List<JSONObject> orgenizationByPage = monitorService.getOrgenization(new ArrayList<JSONObject>(10000));
List<Map> maps = JSONObject.parseArray(JSONObject.toJSONString(orgenizationByPage), Map.class);
if(maps.size() > 0){
public Result saveOrgenization() {
List<JSONObject> orgenizationByPage = monitorService.getOrgenization(new ArrayList<>());
List<Map> maps = JSON.parseArray(JSON.toJSONString(orgenizationByPage), Map.class);
if(!maps.isEmpty()){
List<List<Map>> lists = Lists.partition(maps,100);
lists.forEach(list->{
cameraOrgenMapper.batchSaveOrgenization(list);
});
lists.forEach(list-> cameraOrgenMapper.batchSaveOrgenization(list));
//修改path 信息
List<Map> maps2 = cameraOrgenMapper.testAll();
maps2.forEach(map->{
monitorService.setOrganizationPath(map,map.get("parent_id").toString());
});
maps2.forEach(map-> monitorService.setOrganizationPath(map,map.get("parent_id").toString()));
maps2.forEach(m->{
cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString());
});
maps2.forEach(m-> cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString()));
}
return Result.success();
@ -708,8 +667,8 @@ public class Controller {
*/
@GetMapping("saveChannelInfoAsync")
public Result saveChannelInfoAsync() throws Exception{
monitorService.saveChannelInfoAsync();
return Result.success();
monitorService.saveChannelInfoAsync();
return Result.success("成功收到指令,请耐心等待");
}
/******************************2022/07/13 ytl修改视频资源 end********************************************/
/**
@ -720,21 +679,6 @@ public class Controller {
*/
@GetMapping("/checkCameraIfExists")
public Result checkCameraIfExists(@RequestParam List<String> list){
Result result = cameraChannelService.checkCameraIfExists(list);
return result;
return cameraChannelService.checkCameraIfExists(list);
}
// //以下是7月26号的测试用的
// @GetMapping("/getCameraChannelByPID")
// public Result getCameraChannelByPID(@RequestParam String pid) throws Exception{
// List<Map> channelInfo = monitorService.getChannelInfo(pid);
// return Result.success(channelInfo);
// }
//
// @GetMapping("/getOrganization")
// public Result getOrganization() throws Exception{
// List<JSONObject> orgenization = monitorService.getOrgenization(new ArrayList<>());
// return Result.success(orgenization);
// }
}

View File

@ -551,13 +551,6 @@ public class ResourceController {
return new Result().ok(resourceService.selectInfrastructureList());
}
@GetMapping("/list")
@ApiOperation("能力查询")
@LogOperation("能力查询")
public Result list(@ApiIgnore @RequestParam Map<String, Object> params) {
return new Result<>().ok(resourceService.list(params));
}
@GetMapping("/selectDevelopDoc")
@ApiOperation("查询能力开发文档目录")
@LogOperation("查询能力开发文档目录")

View File

@ -0,0 +1,10 @@
ALTER TABLE `tb_fuse`
MODIFY COLUMN `description` varchar(1000) DEFAULT NULL COMMENT '融合服务描述',
DROP COLUMN `dept_user`,
DROP COLUMN `mobile`,
DROP COLUMN `provider`,
DROP COLUMN `provider_user`,
DROP COLUMN `provider_mobile`;
ALTER TABLE `tb_fuse_resource`
ADD COLUMN `type` varchar(128) NULL COMMENT '资源类型';

View File

@ -38,6 +38,9 @@
<if test="deptId != null and deptId != ''">
and deptId = #{deptId}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="deptUser != null and deptUser != ''">
and dept_user like concat('%', #{deptUser}, '%')
</if>
@ -69,17 +72,4 @@
ORDER BY ${orderField} ${orderType}
</select>
<select id="selectGroupByDeptId" resultType="java.util.Map">
SELECT ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
sd.NAME AS "deptName",
count(tdr.id) AS "deptCount",
sd.id AS "deptId",
sr.name AS "districtName",
sr.id AS "districtId"
FROM sys_dept sd
inner join tb_fuse tdr on sd.id=tdr.dept_id
left join sys_region sr on sr.id=sd.district
group by sd.id
</select>
</mapper>