Commit 5155edcc authored by tangwei's avatar tangwei

增加iot

parent fda64552
...@@ -14,8 +14,8 @@ public enum SourceTypeEnum { ...@@ -14,8 +14,8 @@ public enum SourceTypeEnum {
* 资源类型枚举 * 资源类型枚举
*/ */
EQUIPMENT("装备","equipment", "equipmentSpecificSerivceImpl","refreshStaData"), EQUIPMENT("装备","equipment", "equipmentSpecificSerivceImpl","refreshStaData"),
CAR("车辆","car", "carServiceImpl","refreshStaData"); CAR("车辆","car", "carServiceImpl","refreshStaData"),
IOT("iot","car", "carServiceImpl","iotrefreshStaData");
private String name; private String name;
private String code; private String code;
......
...@@ -250,7 +250,8 @@ public class CarController extends AbstractBaseController { ...@@ -250,7 +250,8 @@ public class CarController extends AbstractBaseController {
iCarService.refreshStaData(); iCarService.refreshStaData();
// 刷新分类树缓存 // 刷新分类树缓存
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode); fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
}
}
@Async @Async
public void refreshCount(List<Car> list) { public void refreshCount(List<Car> list) {
list.forEach(i->{ list.forEach(i->{
......
...@@ -760,4 +760,19 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -760,4 +760,19 @@ public class FireFightingSystemController extends AbstractBaseController {
public Object getCarTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception { public Object getCarTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception {
return fireFightingSystemService.getCarTypeAndCount(bizOrgCode); return fireFightingSystemService.getCarTypeAndCount(bizOrgCode);
} }
/**
* 获取物联设备类型和统计值
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取物联设备类型和统计值", notes = "获取物联设备类型和统计值")
@GetMapping(value = "iot/getEquipmentTypeAndCount/tree")
public Object iotgetEquipmentTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception {
return fireFightingSystemService.iotgetEquipmentTypeAndCount(bizOrgCode);
}
} }
...@@ -73,4 +73,6 @@ public interface CarMapper extends BaseMapper<Car> { ...@@ -73,4 +73,6 @@ public interface CarMapper extends BaseMapper<Car> {
List<CarFusionDto> selectCarAndCarProperty(); List<CarFusionDto> selectCarAndCarProperty();
List<Map<String, Object>> queryCompanyCarStaData(); List<Map<String, Object>> queryCompanyCarStaData();
List<Map<String, Object>> queryCompanyIotStaData();
} }
...@@ -178,4 +178,11 @@ public interface ICarService extends IService<Car> { ...@@ -178,4 +178,11 @@ public interface ICarService extends IService<Car> {
* 更新redis 统计数据 * 更新redis 统计数据
*/ */
void refreshStaData(); void refreshStaData();
/**
* iot装备更新redis 统计数据
*/
void iotrefreshStaData();
} }
...@@ -221,7 +221,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -221,7 +221,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @throws Exception * @throws Exception
*/ */
Object getCarTypeAndCount(String bizOrgCode) throws Exception; Object getCarTypeAndCount(String bizOrgCode) throws Exception;
Object iotgetEquipmentTypeAndCount(String bizOrgCode) throws Exception;
public Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception; public Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception;
public Object refreshCarTypeAndCount(String bizOrgCode) throws Exception; public Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
......
...@@ -1621,9 +1621,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -1621,9 +1621,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
public void refreshStaData() { public void refreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyCarStaData(); List<Map<String, Object>> result = this.baseMapper.queryCompanyCarStaData();
result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400)); result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400));
iotrefreshStaData();
}
@Override
public void iotrefreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyIotStaData();
result.forEach(m -> redisUtils.set((iotbuildKey(m)), m.get("total"), 86400));
} }
private String buildKey(Map<String, Object> row) { private String buildKey(Map<String, Object> row) {
return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.CAR.getCode() + "_" + row.get("categoryCode").toString(); return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.CAR.getCode() + "_" + row.get("categoryCode").toString();
} }
private String iotbuildKey(Map<String, Object> row) {
return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.IOT.getCode() + "_" + row.get("categoryCode").toString();
}
} }
...@@ -112,6 +112,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -112,6 +112,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired @Autowired
private IVideoService videoService; private IVideoService videoService;
@Autowired
private ICarService carService;
@Value("${systemctl.dict.iot-core-param}") @Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam; private String iotCoreParam;
...@@ -1592,6 +1596,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1592,6 +1596,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public void refreshStaData() { public void refreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyStaData(); List<Map<String, Object>> result = this.baseMapper.queryCompanyStaData();
result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400)); result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400));
carService.iotrefreshStaData();
} }
private String buildKey(Map<String, Object> row) { private String buildKey(Map<String, Object> row) {
......
...@@ -16,6 +16,7 @@ import java.util.Optional; ...@@ -16,6 +16,7 @@ import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.yeejoin.equipmanage.common.vo.*;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -67,14 +68,6 @@ import com.yeejoin.equipmanage.common.enums.SourceTypeEnum; ...@@ -67,14 +68,6 @@ import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
import com.yeejoin.equipmanage.common.enums.SystemTypeEnum; import com.yeejoin.equipmanage.common.enums.SystemTypeEnum;
import com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum; import com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil; import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.EquipmentManageVo;
import com.yeejoin.equipmanage.common.vo.FileUploadVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystem3dVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTypeTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemVo;
import com.yeejoin.equipmanage.common.vo.SpeIndexVo;
import com.yeejoin.equipmanage.mapper.BuildingMapper; import com.yeejoin.equipmanage.mapper.BuildingMapper;
import com.yeejoin.equipmanage.mapper.EquipmentManageMapper; import com.yeejoin.equipmanage.mapper.EquipmentManageMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
...@@ -1043,6 +1036,32 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1043,6 +1036,32 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return refreshCarTypeAndCount(bizOrgCode); return refreshCarTypeAndCount(bizOrgCode);
} }
} }
@Override
public Object iotgetEquipmentTypeAndCount(String bizOrgCode) throws Exception {
if (redisUtils.hasKey("iotTypeAndCount" + bizOrgCode)) {
return JSONArray.parseArray(
JSONArray.toJSONString(redisUtils.get("iotTypeAndCount" + bizOrgCode)), EquipmentCategory.class);
} else {
return iotrefreshEquipmentTypeAndCount(bizOrgCode);
}
}
public Object iotrefreshEquipmentTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList();
if (responseList == null || responseList.size() < 1) {
return null;
}
List<EquipmentCategory> list = typeListTree(responseList, bizOrgCode, SourceTypeEnum.IOT);
redisUtils.set("iotTypeAndCount" + bizOrgCode, list, 86400);
return list;
}
@Override @Override
public Object refreshCarTypeAndCount(String bizOrgCode) { public Object refreshCarTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList(); List<EquipmentCategory> responseList = this.typeList();
......
...@@ -619,4 +619,43 @@ ...@@ -619,4 +619,43 @@
and s.biz_org_code <![CDATA[<>]]> '' and s.biz_org_code <![CDATA[<>]]> ''
GROUP BY s.biz_org_code ,c.code GROUP BY s.biz_org_code ,c.code
</select> </select>
<select id="queryCompanyIotStaData" 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
e.is_iot=1
and s.equipment_id = e.`id`
and e.category_id = c.id
and s.biz_org_code is not null
GROUP BY s.biz_org_code ,c.code
UNION
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
e.is_iot=1
and s.equipment_code = e.`code`
and e.category_id = c.id
and s.biz_org_code is not null
GROUP BY s.biz_org_code ,c.code
</select>
</mapper> </mapper>
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