Commit b3ec308c authored by chenhao's avatar chenhao

提交装备分类树和车辆分类树

parent 8aa6feb7
......@@ -76,8 +76,10 @@ public class FireFightingSystemController extends AbstractBaseController {
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
ICarService carService;
@RequestMapping(value = "/getEquiplistBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询设备列表")
......@@ -656,4 +658,28 @@ public class FireFightingSystemController extends AbstractBaseController {
public List<PointTreeVo> getPointTree(@RequestParam(required = false) String systemId, @RequestParam(required = false) String bizOrgCode) {
return fireFightingSystemService.getPointTree(systemId, bizOrgCode);
}
/**
* 获取装备类型和统计值
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取装备类型和统计值", notes = "获取装备类型和统计值")
@GetMapping(value = "/getEquipmentTypeAndCount/tree")
public Object getEquipmentTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception {
equipmentSpecificSerivce.refreshStaData();
return fireFightingSystemService.getEquipmentTypeAndCount(bizOrgCode);
}
/**
* 获取车辆类型和统计值
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取车辆类型和统计值", notes = "获取车辆类型和统计值")
@GetMapping(value = "/getCarTypeAndCount/tree")
public Object getCarTypeAndCount( @RequestParam(required = false) String bizOrgCode) throws Exception {
carService.refreshStaData();
return fireFightingSystemService.getCarTypeAndCount(bizOrgCode);
}
}
......@@ -207,4 +207,18 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @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;
}
......@@ -64,6 +64,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSource
import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo;
import com.yeejoin.equipmanage.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.equipmanage.common.enums.EquipmentSpeIndexEnum;
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;
......@@ -89,6 +90,7 @@ import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IRiskSourceSceneService;
import com.yeejoin.equipmanage.service.ISourceSceneService;
import com.yeejoin.equipmanage.service.ISourceStatistics;
import com.yeejoin.equipmanage.service.ISyncDataService;
import com.yeejoin.equipmanage.service.MqttSendGateway;
......@@ -167,6 +169,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
IEquipmentCategoryService iEquipmentCategoryService;
@Autowired
ISourceStatistics sourceStatistics;
@Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId);
......@@ -987,30 +992,50 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
public Object getwaterResourceType() throws Exception {
public Object getEquipmentTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> responseList = this.typeList();
if(responseList == null || responseList.size()<1) {
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream().filter(i->"2".equals(i.getIndustryCode())).collect(Collectors.toList());
getCountToChildren(equipmentTypeList);
return responseList;
getCountToChildren(equipmentTypeList,bizOrgCode);
return equipmentTypeList;
}
public Object getCountToChildren(List<EquipmentCategory> children) throws Exception {
public Object getCountToChildren(List<EquipmentCategory> children,String bizOrgCode) throws Exception {
for (EquipmentCategory equipmentCategory : children) {
equipmentCategory.getCode();
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, SourceTypeEnum.EQUIPMENT, equipmentCategory.getCode());
equipmentCategory.setCount(Double.parseDouble(num+""));
List<EquipmentCategory> childrenList =equipmentCategory.getChildren();
if(childrenList!=null && childrenList.size()>0) {
getCountToChildren(childrenList);
getCountToChildren(childrenList,bizOrgCode);
}
}
return children;
}
public Object getCarTypeAndCount(String bizOrgCode) throws Exception {
List<EquipmentCategory> responseList = this.typeList();
if(responseList == null || responseList.size()<1) {
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream().filter(i->"20000000".equals(i.getCode()) && "2".equals(i.getIndustryCode())).collect(Collectors.toList());
getCountToChildren(equipmentTypeList,bizOrgCode);
return equipmentTypeList;
}
public Object getCarCountToChildren(List<EquipmentCategory> children,String bizOrgCode) throws Exception {
for (EquipmentCategory equipmentCategory : children) {
int num = sourceStatistics.equipCategoryStatistics(bizOrgCode, SourceTypeEnum.CAR, equipmentCategory.getCode());
equipmentCategory.setCount(Double.parseDouble(num+""));
List<EquipmentCategory> childrenList =equipmentCategory.getChildren();
if(childrenList!=null && childrenList.size()>0) {
getCountToChildren(childrenList,bizOrgCode);
}
}
return children;
}
......
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