Commit 79218d84 authored by suhuiguang's avatar suhuiguang

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

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/CarController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IFireFightingSystemService.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/FireFightingSystemServiceImpl.java
parents 97fb9777 7381bc04
......@@ -105,4 +105,10 @@ public class EquipmentIndex extends BaseEntity {
@Transient
@TableField(exist = false)
private String perfQuotaStr;
/**
* 是否支持趋势查看
*/
@TableField(value = "is_trend")
private Boolean isTrend;
}
......@@ -57,4 +57,7 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty(value = "队伍id")
private String teamId;
@ApiModelProperty(value = "是否物联")
private String isIot;
}
......@@ -63,4 +63,6 @@ public class EquipmentIndexVO {
@ApiModelProperty(value = "更新日期")
private Date updateDate;
@ApiModelProperty(value = "是否支持趋势查看")
private Integer isTrend;
}
......@@ -14,8 +14,8 @@ public enum SourceTypeEnum {
* 资源类型枚举
*/
EQUIPMENT("装备","equipment", "equipmentSpecificSerivceImpl","refreshStaData"),
CAR("车辆","car", "carServiceImpl","refreshStaData");
CAR("车辆","car", "carServiceImpl","refreshStaData"),
IOT("iot","car", "carServiceImpl","iotrefreshStaData");
private String name;
private String code;
......
......@@ -129,6 +129,10 @@ public class CarController extends AbstractBaseController {
@Value("${auth-key-fire-car}")
private String carAuthKey;
@Value("${auth-key-fire-iot-equip:fire_iot-equip_info}")
private String iotAuthKey;
@Autowired
JcsFeign jcsFeign;
@Autowired
......@@ -185,6 +189,7 @@ public class CarController extends AbstractBaseController {
iCarService.refreshStaData();
// 刷新分类树缓存
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
}
@Async
......@@ -259,7 +264,6 @@ public class CarController extends AbstractBaseController {
Car car1 = iCarService.updateOneById(car);
CarController controllerProxy = SpringUtils.getBean(CarController.class);
controllerProxy.refreshCount(car.getBizOrgCode());
refreshCount(car.getBizOrgCode());
return car1;
}
......@@ -1254,4 +1258,13 @@ public class CarController extends AbstractBaseController {
FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(carAuthKey, null);
return ResponseHelper.buildResponse(menusList.getResult());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/iot/companyTreeByUserAndType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司部门树", notes = "根据登录人及类型获取公司部门树")
public ResponseModel<Object> iotcompanyTreeByUserAndType() throws Exception {
FeignClientResult<List<OrgMenuDto>> menusList = jcsFeign.getCompanyDeptTreeWithAuth(iotAuthKey, null);
return ResponseHelper.buildResponse(menusList.getResult());
}
}
......@@ -314,7 +314,47 @@ public class FireFightingSystemController extends AbstractBaseController {
@PostMapping(value = "/iot/getEquipTypeAmount")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "九大类下装备,通过code截取", notes = "九大类下装备信息列表")
public IPage<EquipTypeImgAmountVO> iotgetEquipTypeAmount(@RequestBody EquipTypeAmountPageDTO equipTypeAmountPage) {
equipTypeAmountPage.setIsIot("1");
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i]));
}
if (StringUtil.isNotEmpty(equipTypeAmountPage.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode());
equipmentCategoryQueryWrapper.eq("industry_code", equipTypeAmountPage.getIndustryCode());
EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(equipmentCategoryQueryWrapper);
if (equipmentCategory == null) {
throw new RuntimeException("装备定义code有误");
}
int inhierarchy = 1;
for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层
if (equipmentCategory.getParentId() == null) {
//判断是否是最下面的子节点
if (i >= 4) {
inhierarchy = 8;
} else {
inhierarchy = map.get(i);
}
break;
} else {
//查找到循环几次为空
equipmentCategory = equipmentCategoryService.getById(equipmentCategory.getParentId());
}
}
return fireFightingSystemService.getColaCategoryAmountList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().substring(0, inhierarchy), equipTypeAmountPage);
} else {
return fireFightingSystemService.getColaCategoryAmountList(0, null, equipTypeAmountPage);
}
}
......@@ -731,4 +771,19 @@ public class FireFightingSystemController extends AbstractBaseController {
public Object getCarTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception {
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> {
List<CarFusionDto> selectCarAndCarProperty();
List<Map<String, Object>> queryCompanyCarStaData();
List<Map<String, Object>> queryCompanyIotStaData();
}
......@@ -178,4 +178,11 @@ public interface ICarService extends IService<Car> {
* 更新redis 统计数据
*/
void refreshStaData();
/**
* iot装备更新redis 统计数据
*/
void iotrefreshStaData();
}
......@@ -203,28 +203,35 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
/**
* 获取列表不分页
*
* @param bizOrgCode orgCode
* @return
*/
List<FireFightingSystemEntity> systemListByBziOrgCode(String bizOrgCode);
/**
*装备分类的类型和总数
* @param bizOrgCode
* @return
* @throws Exception
*/
Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception;
/***
* 车辆类型和统计值
* @param bizOrgCode
* @return
* @throws Exception
*/
Object getCarTypeAndCount(String bizOrgCode) throws Exception;
Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception;
Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
/**
* 装备分类的类型和总数
*
* @param bizOrgCode
* @return
* @throws Exception
*/
Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception;
/***
* 车辆类型和统计值
* @param bizOrgCode
* @return
* @throws Exception
*/
Object getCarTypeAndCount(String bizOrgCode) throws Exception;
Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception;
Object iotgetEquipmentTypeAndCount(String bizOrgCode) throws Exception;
Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
}
......@@ -1621,9 +1621,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
public void refreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyCarStaData();
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) {
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
@Autowired
private IVideoService videoService;
@Autowired
private ICarService carService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -1592,6 +1596,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public void refreshStaData() {
List<Map<String, Object>> result = this.baseMapper.queryCompanyStaData();
result.forEach(m -> redisUtils.set((buildKey(m)), m.get("total"), 86400));
carService.iotrefreshStaData();
}
private String buildKey(Map<String, Object> row) {
......
......@@ -975,7 +975,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
}
@Override
public Object refreshEquipmentTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList();
......@@ -993,15 +992,34 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public Object getCarTypeAndCount(String bizOrgCode) {
if (redisUtils.hasKey(carTypeAndCount + bizOrgCode)) {
List<EquipmentCategory> typeList = JSONArray.parseArray(
return JSONArray.parseArray(
JSONArray.toJSONString(redisUtils.get(carTypeAndCount + bizOrgCode)), EquipmentCategory.class);
return typeList;
} else {
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
public Object refreshCarTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList();
if (responseList == null || responseList.size() < 1) {
......@@ -1015,10 +1033,10 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return list;
}
public List<EquipmentCategory> typeList() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
return this.iEquipmentCategoryService
.getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode));
return equipmentCategorys;
}
public List<EquipmentCategory> typeListTree(List<EquipmentCategory> equipmentCategorys, String bizOrgCode,
......
......@@ -103,4 +103,8 @@ auth-key-fire-building=fire_building_info
redis_car_type_count = carTypeAndCount
redis_equip_type_count = equipTypeAndCount
\ No newline at end of file
redis_equip_type_count = equipTypeAndCount
# 权限标识-物联装备
auth-key-fire-iot-equip=fire_iot-equip_info
\ No newline at end of file
......@@ -2261,7 +2261,17 @@
</sql>
</changeSet>
<changeSet author="keyong" id="1641977770-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_index" columnName="is_trend"/>
</not>
</preConditions>
<comment>wl_equipment_index add column is_trend</comment>
<sql>
alter table `wl_equipment_index` add column `is_trend` bit(1) DEFAULT b'0' COMMENT '是否支持趋势查看, 默认false';
</sql>
</changeSet>
......
......@@ -619,4 +619,43 @@
and s.biz_org_code <![CDATA[<>]]> ''
GROUP BY s.biz_org_code ,c.code
</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>
......@@ -153,7 +153,8 @@
index_definition_id as index_id,
1 as is_importent_parameter,
sort_num,
type
type,
is_trend
from
wl_equipment_index
where id = #{id}
......
......@@ -611,6 +611,11 @@
<if test="codeHead!=null and codeHead!='' and codeHead!=' '">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
</if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=1
</if>
<if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode}
</if>
......@@ -713,6 +718,9 @@
<if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=1
</if>
<if test="equipTypeAmountPage.equipmentName!=null and equipTypeAmountPage.equipmentName!=''">
And wlc.`NAME` LIKE CONCAT('%',#{equipTypeAmountPage.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