Commit f3ba4a66 authored by KeYong's avatar KeYong

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

parents 1f9130a4 5155edcc
......@@ -57,4 +57,7 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty(value = "队伍id")
private String teamId;
@ApiModelProperty(value = "是否物联")
private String isIot;
}
......@@ -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;
......
......@@ -188,6 +188,12 @@ 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
......@@ -244,7 +250,8 @@ public class CarController extends AbstractBaseController {
iCarService.refreshStaData();
// 刷新分类树缓存
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode);
}
}
@Async
public void refreshCount(List<Car> list) {
list.forEach(i->{
......@@ -1312,4 +1319,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());
}
}
......@@ -303,7 +303,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);
}
}
......@@ -720,4 +760,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();
}
......@@ -221,7 +221,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @throws Exception
*/
Object getCarTypeAndCount(String bizOrgCode) throws Exception;
Object iotgetEquipmentTypeAndCount(String bizOrgCode) throws Exception;
public Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception;
public 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) {
......
......@@ -16,6 +16,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import com.yeejoin.equipmanage.common.vo.*;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -67,14 +68,6 @@ import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
import com.yeejoin.equipmanage.common.enums.SystemTypeEnum;
import com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum;
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.EquipmentManageMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
......@@ -1043,6 +1036,32 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
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();
......
......@@ -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
......@@ -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>
......@@ -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