Commit 0be13336 authored by chenhao's avatar chenhao

Merge branch 'develop_ccs' of http://172.16.10.76/moa/amos-boot-biz into develop_ccs

parents f556c87f a36bef8b
......@@ -456,6 +456,10 @@ public class RedisUtils {
}
return null;
}
public Set<String> getPatternKeys(String pattern) {
return redisTemplate.keys(pattern);
}
/**
* 获取指定前缀key列表
*
......
......@@ -44,4 +44,7 @@ public class OrgUsrDto extends BaseDto {
@ApiModelProperty(value = "省市区名称,用逗号分隔")
private String pczName;
@ApiModelProperty(value = "建筑ID")
private String buildId;
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* @author DELL
*/
@AllArgsConstructor
@Getter
public enum SourceTypeEnum {
/**
* 资源类型枚举
*/
EQUIPMENT("装备","equipment", "equipmentSpecificSerivceImpl","refreshStaData"),
CAR("车辆","car", "carServiceImpl","refreshStaData");
private String name;
private String code;
private String beanName;
private String methodName;
}
......@@ -74,4 +74,7 @@ public class BuildingTreeVo {
@ApiModelProperty("建筑地址")
private String address;
@ApiModelProperty("机构编码")
private String bizOrgCode;
}
......@@ -2,11 +2,9 @@ package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.equipmanage.common.dto.AreaDto;
import com.yeejoin.equipmanage.common.entity.Area;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.AreaResquest;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import com.yeejoin.equipmanage.service.IAreaService;
......@@ -47,23 +45,25 @@ public class AreaController extends AbstractBaseController {
/**
* 获取公司部门区域树
*
* @return list
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取单位区域树", notes = "根据登陆人获取单位区域树")
@GetMapping(value = "/tree")
public List<UnitAreaTreeVo> getSystemTree(){
public List<UnitAreaTreeVo> getSystemTree() {
return iAreaService.getAreaTreeListVo();
}
/**
* 获取公司部门树
*
* @return list
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据登陆人获取公司树", notes = "根据登陆人获取公司树")
@GetMapping(value = "/companyTreeByUserAndType")
public List<OrgMenuDto> companyTreeByUserAndType(){
public List<OrgMenuDto> companyTreeByUserAndType() {
return iAreaService.companyDeptTree();
}
......
package com.yeejoin.equipmanage.controller;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.vo.BuildingListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import com.yeejoin.equipmanage.service.IBuilldService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -11,15 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.vo.BuildingListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoListVO;
import com.yeejoin.equipmanage.common.entity.vo.BuildingVideoVO;
import com.yeejoin.equipmanage.common.vo.BuildingTreeVo;
import com.yeejoin.equipmanage.service.IBuilldService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description: 消防建筑视屏监控
......@@ -43,12 +42,19 @@ public class BuildingVideoController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑视屏监控树")
@GetMapping(value = "/treeByBizOrgTypeCode")
public List<BuildingTreeVo> getBuildingTreeByBizOrgTypeCode(@RequestParam(required = false) String orgTypes) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
return buildService.getBuildingTreeByBizOrgTypeCode(orgTypes, bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑视屏监控分页列表")
@GetMapping(value = "/page")
public Page<BuildingVideoVO> buildingList(Page page, BuildingVideoListVO dto) {
if ("0".equals(dto.getBuildingId())) {
dto.setBuildingId(null);
}
return buildService.buildingVideoList(page, dto);
}
......
......@@ -449,17 +449,6 @@ public class FireFightingSystemController extends AbstractBaseController {
/**
* 获取点位图,区域树数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取点位图,区域树数据", notes = "消防系统点位图使用")
@GetMapping(value = "/point/tree")
public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId) {
return fireFightingSystemService.getPointTree(systemId, getOrgCode());
}
/**
* 设备报警信息
*
* @param id
......@@ -641,7 +630,30 @@ public class FireFightingSystemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取系统分类树", notes = "获取系统分类树")
@GetMapping(value = "/systemTypeTree")
public List<FireFightingSystemTypeTreeVo> systemTypeTree() {
return fireFightingSystemService.systemTypeTree();
public List<FireFightingSystemTypeTreeVo> systemTypeTree(@RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.systemTypeTree(bizOrgCode);
}
/**
* 根据bizOrgCode获取系统列表不分页
*
* @return list
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取系统分类树", notes = "获取系统分类树")
@GetMapping(value = "/systemListByBziOrgCode")
public List<FireFightingSystemEntity> systemListByBziOrgCode(@RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.systemListByBziOrgCode(bizOrgCode);
}
/**
* 获取点位图,区域树数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取点位图,区域树数据", notes = "消防系统点位图使用")
@GetMapping(value = "/point/tree")
public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId, @RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.getPointTree(systemId, bizOrgCode);
}
}
......@@ -71,4 +71,6 @@ public interface CarMapper extends BaseMapper<Car> {
int equipmentCarListcount(Long teamId, String name,String code,Long id,Boolean isNo);
List<CarFusionDto> selectCarAndCarProperty();
List<Map<String, Object>> queryCompanyCarStaData();
}
......@@ -200,4 +200,10 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
* @return 指标详情
*/
List<Map<String, String>> getBoxTropicsIndexDetails();
/**
* 统计数据
* @return
*/
List<Map<String, Object>> queryCompanyStaData();
}
......@@ -214,4 +214,11 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
Map<String,Object> fireFoamSysEquipmentNumber();
/**
* 根据bizorgcode获取系统分类数量
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> listByBizOrgCode(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -103,8 +103,9 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
/**
* 消防建筑视屏监控统计树
* @return
* @param bizOrgCodeList
*/
List<Map<String, Object>> getBuildVideoListCount();
List<Map<String, Object>> getBuildVideoListCount(@Param("list") List<String> bizOrgCodeList);
/**
* 可乐建筑视屏监控统计树
......
......@@ -208,6 +208,14 @@ public interface IBuilldService extends IService<Building> {
List<BuildingTreeVo> getBuildingVideoTree();
/**
* 消防建筑视屏监控统计树
* @param orgTypes
* @param bizOrgCode
* @return
*/
List<BuildingTreeVo> getBuildingTreeByBizOrgTypeCode(String orgTypes, String bizOrgCode);
/**
* 消防建筑视屏监控分页列表
* @param page
* @param dto
......@@ -299,4 +307,5 @@ public interface IBuilldService extends IService<Building> {
* @return
*/
Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId);
}
......@@ -173,4 +173,9 @@ public interface ICarService extends IService<Car> {
* @return
*/
List<CarFusionDto> getCarFusionList();
/**
* 更新redis 统计数据
*/
void refreshStaData();
}
......@@ -194,4 +194,9 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @return
*/
Map<String, List<Map<String, String>>> getFessIndexDetails();
/**
* 更新redis 统计数据
*/
void refreshStaData();
}
......@@ -199,5 +199,12 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
*
* @return
*/
List<FireFightingSystemTypeTreeVo> systemTypeTree();
List<FireFightingSystemTypeTreeVo> systemTypeTree(String bizOrgCode);
/**
* 获取列表不分页
* @param bizOrgCode orgCode
* @return
*/
List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode);
}
......@@ -136,8 +136,9 @@ public interface IFormInstanceService extends IService<FormInstance> {
/**
* 消防建筑视屏监控统计树
* @return
* @param bizOrgCodeList
*/
List<Map<String, Object>> getBuildVideoListCount();
List<Map<String, Object>> getBuildVideoListCount(List<String> bizOrgCodeList);
/**
* 安防消防建筑视屏监控统计树
......
package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
public interface ISourceStatistics {
/**
* 装备、车辆按照单位及分类统计
*
* @param bizOrgCode 单位部门code
* @param sourceType 资源类型
* @param categoryCode 资源分类code
* @return int 数量
*/
int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode);
}
......@@ -422,7 +422,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// responses.add(p);
// });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
List<PointTreeVo> buildList = buildingMapper.getBuildList(null);
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode);
return transferListToPointTree(buildList, id);
}
......@@ -955,16 +955,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public List<FireFightingSystemTypeTreeVo> systemTypeTree() {
// 获取所有系统list
public List<FireFightingSystemTypeTreeVo> systemTypeTree(String bizOrgCode) {
// 获取所有系统分类list
LambdaQueryWrapper<DynamicFormGroup> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DynamicFormGroup::getGroupType, "fireSystem");
wrapper.eq(DynamicFormGroup::getParentId, 0);
List<DynamicFormGroup> list = iEqDynamicFormGroupService.list(wrapper);
List<Map<String, Object>> typeList = fireFightingSystemMapper.listByBizOrgCode(bizOrgCode);
List<FireFightingSystemTypeTreeVo> childrenList = list.stream().map(item -> {
FireFightingSystemTypeTreeVo vo = new FireFightingSystemTypeTreeVo();
vo.setName(item.getGroupName());
vo.setTotal("0");
typeList.forEach(obj -> {
if (item.getId().equals(Long.valueOf(obj.get("typeId").toString()))) {
vo.setTotal(obj.get("total").toString());
}
});
vo.setType(item.getGroupType());
vo.setId(String.valueOf(item.getId()));
return vo;
......@@ -1044,4 +1049,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
@Override
public List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
if (StringUtil.isNotEmpty(bizOrgCode)) {
wrapper.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode);
}
return this.baseMapper.selectList(wrapper);
}
}
......@@ -479,8 +479,8 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
}
@Override
public List<Map<String, Object>> getBuildVideoListCount() {
return formInstanceMapper.getBuildVideoListCount();
public List<Map<String, Object>> getBuildVideoListCount(List<String> bizOrgCodeList) {
return formInstanceMapper.getBuildVideoListCount(bizOrgCodeList);
}
@Override
......
package com.yeejoin.equipmanage.service.impl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.ISourceStatistics;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.SpringContextHelper;
import java.lang.reflect.Method;
import java.util.Set;
/**
* @author DELL
*/
@Service
public class SourcesStatisticsImpl implements ISourceStatistics {
@Autowired
private RedisUtils redisUtil;
@Override
public int equipCategoryStatistics(String bizOrgCode, SourceTypeEnum sourceType, String categoryCode) {
// 计算处通用code,用来上下级匹配如12001010000->1200101
String treeCode = subStringZero(categoryCode);
Set<String> keys = redisUtil.getKeys(buildKey(bizOrgCode, sourceType.getCode(), treeCode));
if (keys.size() > 0) {
//求和
return this.sumNumber(keys);
} else {
//按照类型插入缓存
Object bean = SpringContextHelper.getBean(sourceType.getBeanName());
Method[] methods = bean.getClass().getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(sourceType.getMethodName())) {
try {
method.invoke(bean);
} catch (Exception e) {
throw new RuntimeException("更新redis数据失败" + e.getMessage());
}
}
}
return this.sumNumber(keys);
}
}
private int sumNumber(Set<String> keys) {
return keys.stream().filter(k -> redisUtil.get(k) != null).mapToInt(k -> Integer.parseInt(redisUtil.get(k).toString())).sum();
}
private String subStringZero(String categoryCode) {
String reverse = new StringBuffer(categoryCode).reverse().toString();
int noZero = Integer.parseInt(reverse);
return new StringBuffer(String.valueOf(noZero)).reverse().toString();
}
private String buildKey(String bizOrgCode, String sourceType, String treeCode) {
return bizOrgCode + "*_" + sourceType + "_" + treeCode + "*";
}
}
......@@ -384,6 +384,11 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
if (StringUtils.isNotBlank(equipmentDetailDownloadVOS.get(i).getCompanyName())) {
String[] company = equipmentDetailDownloadVOS.get(i).getCompanyName().split("@");
equipmentSpecific.setAgencyId(company[1]);
equipmentSpecific.setAgencyName(company[0]);
equipmentSpecific.setBizOrgCode(company[2]);
equipmentSpecific.setBizOrgName(company[0]);
}
equipmentSpecificMapper.insert(equipmentSpecific);
......
......@@ -36,7 +36,7 @@ dutyMode.fegin.name=AMOS-DUTYMODE
riskSource.feign.name=AMOS-AUTOSYS
equipManage.name=AMOS-EQUIPMANAGE
iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS-SHG
jcs.fegin.name=JCS
video.fegin.name=VIDEO
#项目初始化画布id
morphic.projectSeq=1390314016458514433
......@@ -93,3 +93,5 @@ auth-key-fire-system=fire_system_info;
auth-key-fire-equip=fire_equip_info;
# 权限标识-消防视频
auth-key-fire-video=fire_video_info;
# 权限标识-消防视频
auth-key-fire-build-video=fire_build_video_info;
\ No newline at end of file
......@@ -233,16 +233,17 @@
AND cd.field_name = 'code'
LEFT JOIN wl_form_instance AS bzc ON bzc.instance_id = ins.instance_id
AND bzc.field_name = 'bizOrgCode'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
bzc.field_value = #{bizOrgCode}
</if>
</where>
GROUP BY
ins.instance_id
ORDER BY
parentId
) t
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
t.bizOrgCode = #{bizOrgCode}
</if>
</where>
</select>
<select id="get3dBuildList" resultType="com.yeejoin.equipmanage.common.entity.vo.PointTreeVo">
select
......
......@@ -604,4 +604,19 @@
from wl_car wc LEFT JOIN wl_car_property wcp on wc.id = wcp.car_id
where wcp.equipment_index_key in ('FAS_Car_Video', 'FAS_Car_GIS');
</select>
<select id="queryCompanyCarStaData" resultType="java.util.Map">
SELECT
s.biz_org_code as bizOrgCode,
c.code as categoryCode,
count(1) as total
FROM
`wl_car` s,
wl_equipment e,
wl_equipment_category c
where
s.equipment_id = e.`id`
and e.category_id = c.id
and s.biz_org_code <![CDATA[<>]]> ''
GROUP BY s.biz_org_code ,c.code
</select>
</mapper>
......@@ -1441,4 +1441,19 @@
WHERE
s.equipment_code = '92251100TZE44'
</select>
<select id="queryCompanyStaData" resultType="java.util.Map">
SELECT
s.biz_org_code as bizOrgCode,
c.code as categoryCode,
count(1) as total
FROM
`wl_equipment_specific` s,
wl_equipment e,
wl_equipment_category c
where
s.equipment_code = e.`code`
and e.category_id = c.id
and s.biz_org_code <![CDATA[<>]]> ''
GROUP BY s.biz_org_code ,c.code
</select>
</mapper>
\ No newline at end of file
......@@ -1829,32 +1829,16 @@ FROM
order by createDate DESC
</select>
<select id="listByBizOrgCode" resultType="java.util.Map">
SELECT
form_group_id typeId,
COUNT(form_group_id) total
FROM
f_fire_fighting_system
WHERE
biz_org_code LIKE CONCAT(#{bizOrgCode}, '%' )
GROUP BY form_group_id
</select>
</mapper>
......@@ -259,6 +259,7 @@
</select>
<!-- 消防建筑视屏监控统计树 -->
<select id="getBuildVideoListCount" resultType="hashmap">
SELECT * FROM(
SELECT
sa.*,
b.total
......@@ -269,7 +270,8 @@
a.group_code AS groupCode,
a.group_type AS groupType,
MAX( CASE WHEN a.field_name = 'parentId' THEN a.field_value END ) AS parentId,
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS instanceName
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS instanceName,
MAX( CASE WHEN a.field_name = 'biz_org_code' THEN a.field_value END ) AS bizOrgCode
FROM
`wl_form_instance` a
GROUP BY
......@@ -283,9 +285,19 @@
'else' as groupType,
0 as parentId,
'其他' as instanceName,
NULL AS bizOrgCode,
count(1) as total
from
wl_video where id not in (select video_id from wl_video_source)
) tmp
<where>
<if test="list != null and list.size() >0">
AND tmp.bizOrgCode IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="getColaBuildVideoListCount" resultType="hashmap">
......
......@@ -70,6 +70,12 @@
<if test="dto.buildingId!=null and dto.buildingId!=''">
FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{dto.buildingId}))
</if>
<if test="dto.buildIdList != null and dto.buildIdList.size > 0">
AND
<foreach collection="dto.buildIdList" item="item" index="index" open="(" close=")" separator=" OR ">
FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{item, jdbcType=INTEGER}))
</foreach>
</if>
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment