Commit c48ecc5b authored by 张森's avatar 张森

29937 关键数据卡片接口开发

parent 3deaa132
...@@ -18,7 +18,8 @@ public enum UnitEnum { ...@@ -18,7 +18,8 @@ public enum UnitEnum {
M("m", "米", ""), M("m", "米", ""),
DM("dm", "分米", ""), DM("dm", "分米", ""),
CM("cm", "厘米", ""), CM("cm", "厘米", ""),
MM("mm", "毫米", ""); MM("mm", "毫米", ""),
LFM("m³", "立方米", "");
private String key; private String key;
......
...@@ -152,4 +152,36 @@ public class UnitTransformUtil { ...@@ -152,4 +152,36 @@ public class UnitTransformUtil {
map.put("unit", "M"); map.put("unit", "M");
return map; return map;
} }
public static Map<String, Object> transformValuesLFM(String currentValue, String currentUnit, String volume) {
Map<String, Object> map = new HashMap<>();
if (UnitEnum.LFM.getKey().equalsIgnoreCase(currentUnit) || UnitEnum.LFM.getName().equals(currentUnit)) {
BigDecimal nowVal = new BigDecimal(0);
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)) {
nowVal = new BigDecimal(currentValue);
map.put("nowValue", nowVal.setScale(2, BigDecimal.ROUND_HALF_UP));
} else {
map.put("nowValue", "--");
}
// status 中 0 表示过低;1 表示正常;2 表示过高
if (StringUtil.isNotEmpty(currentValue) && !"--".equals(currentValue)
&& StringUtil.isNotEmpty(volume) && !"--".equals(volume)
&& StringUtil.isNotEmpty(currentUnit)) {
if (nowVal.compareTo(new BigDecimal(volume)) == 1) {
map.put("status", "2");
map.put("abs", 100);
} else if (nowVal.compareTo(new BigDecimal(volume)) == 0) {
map.put("status", "1");
map.put("abs", 100);
} else {
map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(volume),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
}
} else {
map.put("status", "--");
map.put("abs", "--");
}
}
map.put("unit", "m³");
return map;
}
} }
...@@ -396,6 +396,17 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -396,6 +396,17 @@ public class EquipmentSpecificController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getListByEquipmentCodeCSZZ/{code}")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public List<Map<String, Object>> getListByEquipmentCodeCSZZ( @PathVariable String code, @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode){
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams ReginParams=getSelectedOrgInfo();
bizOrgCode = ReginParams.getPersonIdentity().getCompanyBizOrgCode();
}
return equipmentSpecificSerivce.getListByEquipmentCodeCSZZ(code, bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getListByEquipmentCodeEQ/{code}") @GetMapping(value = "/getListByEquipmentCodeEQ/{code}")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list") @ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public List<Map<String, Object>> getFirePumpInfoEQ( @PathVariable String code){ public List<Map<String, Object>> getFirePumpInfoEQ( @PathVariable String code){
......
...@@ -51,4 +51,12 @@ public class KeyWordsInfoController extends AbstractBaseController { ...@@ -51,4 +51,12 @@ public class KeyWordsInfoController extends AbstractBaseController {
return CommonResponseUtil.success(resultList); return CommonResponseUtil.success(resultList);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "查询已绑定排油阀的换流变信息 - 根据分类分组", notes = "查询已绑定排油阀的换流变信息 - 根据分类分组")
@RequestMapping(value = "/getFEquipInfoListCategory", method = RequestMethod.GET)
public ResponseModel getFEquipInfoListCategory(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> resultList = iFireFightingSystemService.getFEquipInfoListCategory(bizOrgCode);
return CommonResponseUtil.success(resultList);
}
} }
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex; import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.FormInstanceEquip; import com.yeejoin.equipmanage.common.entity.FormInstanceEquip;
import com.yeejoin.equipmanage.common.enums.IndexStatusEnum; import com.yeejoin.equipmanage.common.enums.IndexStatusEnum;
import com.yeejoin.equipmanage.common.enums.UnitEnum;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
...@@ -228,6 +229,47 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -228,6 +229,47 @@ public class SupervisionConfigureController extends AbstractBaseController {
@PersonIdentify @PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "CAFS水箱和CAFS泡沫罐信息")
@GetMapping("/cafs/watertank-foamtankYJFour")
public ResponseModel getCAFSWaterTankAndFormTankYJFour(@RequestParam(value = "pageNumber", required = false) Long pageNumber,
@RequestParam(value = "pageSize", required = false) Long pageSize,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode
) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
}
Page page = new Page<>(pageNumber, pageSize);
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getCAFSWaterTankAndFormTank(page, bizOrgCode);
List<Map<String, Object>> res = page1.getRecords();
if (!res.isEmpty()) {
for (Map<String, Object> m : res) {
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
if (UnitEnum.LFM.getKey().equalsIgnoreCase(String.valueOf(m.get("unit"))) || UnitEnum.LFM.getName().equals(String.valueOf(m.get("unit")))) {
transResult = UnitTransformUtil.transformValuesLFM(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("volume")));
}
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
m.put("levelStatus", "--");
}
m.put("levelAbs", transResult.get("abs"));
if (transResult.containsKey("unit")) {
m.put("unit", transResult.get("unit"));
}
}
}
return CommonResponseUtil.success(page1);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘概览泡沫罐和水箱信息(监盘概览)") @ApiOperation(value = "监盘概览泡沫罐和水箱信息(监盘概览)")
@GetMapping("/getFoamTankBySuper") @GetMapping("/getFoamTankBySuper")
public ResponseModel getFoamTankBySuper(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) { public ResponseModel getFoamTankBySuper(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
......
...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.fegin; ...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.fegin;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.equipmanage.common.dto.*; import com.yeejoin.equipmanage.common.dto.*;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -204,4 +205,7 @@ public interface JcsFeign { ...@@ -204,4 +205,7 @@ public interface JcsFeign {
@GetMapping(value = "/org-usr/getCompany") @GetMapping(value = "/org-usr/getCompany")
FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode); FeignClientResult getCompany( @RequestParam(value = "bizOrgCode") String bizOrgCode);
@GetMapping(value = "/data-dictionary/dataDictionaryIdFillMenu")
FeignClientResult<List<DataDictionary>> dataDictionaryIdFillMenu(@RequestParam(value = "type") String type);
} }
...@@ -254,6 +254,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -254,6 +254,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getFireMonitorInfo(@Param("equipmentId") Long fireEquipmentId, @Param("list") String[] strings); List<Map<String, Object>> getFireMonitorInfo(@Param("equipmentId") Long fireEquipmentId, @Param("list") String[] strings);
List<Map<String, Object>> getFirePumpInfoCSZZ(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getFirePumpInfo(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getFirePumpInfoEQ(@Param("list") String[] strings,@Param("bizOrgCode") String bizOrgCode);
......
...@@ -740,4 +740,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -740,4 +740,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect); List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect);
List<Map<String, Object>> getFEquipInfoListCategory(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -253,6 +253,8 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -253,6 +253,8 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
*/ */
List<Map<String, Object>> getListByEquipmentCodeJ(String code,String bizOrgCode); List<Map<String, Object>> getListByEquipmentCodeJ(String code,String bizOrgCode);
List<Map<String, Object>> getFirePumpInfoEQ(String code,String bizOrgCode); List<Map<String, Object>> getFirePumpInfoEQ(String code,String bizOrgCode);
List<Map<String, Object>> getListByEquipmentCodeCSZZ(String code,String bizOrgCode);
/** /**
* 根据装备分类code获取装备列表,id 升序 * 根据装备分类code获取装备列表,id 升序
* @param code 装备分类逗号隔开 * @param code 装备分类逗号隔开
......
...@@ -357,4 +357,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -357,4 +357,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getFireCannonInfo(String bizOrgCode); List<Map<String, Object>> getFireCannonInfo(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoList(String bizOrgCode); List<Map<String, Object>> getFEquipInfoList(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode);
} }
...@@ -1873,6 +1873,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1873,6 +1873,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public List<Map<String, Object>> getListByEquipmentCodeCSZZ(String code, String bizOrgCode) {
List<Map<String, Object>> list = new ArrayList<>();
if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(",");
list = equipmentSpecificMapper.getFirePumpInfoCSZZ(strings, bizOrgCode);
}
return list;
}
@Override
public List<Map<String, Object>> getFirePumpInfoEQ(String code, String bizCode) { public List<Map<String, Object>> getFirePumpInfoEQ(String code, String bizCode) {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
if (StringUtil.isNotEmpty(code)) { if (StringUtil.isNotEmpty(code)) {
......
...@@ -16,6 +16,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -16,6 +16,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto; import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
...@@ -196,6 +198,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -196,6 +198,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired @Autowired
private StockDetailMapper stockDetailMapper; private StockDetailMapper stockDetailMapper;
@Autowired
private DataDictionaryServiceImpl dataDictionaryService;
@Override @Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) { public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId); return this.baseMapper.getEquipCountBySystemId(systemId);
...@@ -2933,4 +2938,63 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2933,4 +2938,63 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<Map<String, Object>> closeList = Collections.singletonList(closeMap); List<Map<String, Object>> closeList = Collections.singletonList(closeMap);
return CollUtil.isNotEmpty(resultList) ? resultList : closeList; return CollUtil.isNotEmpty(resultList) ? resultList : closeList;
} }
@Override
public List<Map<String, Object>> getFEquipInfoListCategory(String bizOrgCode) {
List<DataDictionary> zdsbfl = jcsFeignClient.dataDictionaryIdFillMenu("ZDSBFL").getResult();
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoListCategory(bizOrgCode);
ArrayList<String> strings = new ArrayList<>();
list.forEach(item -> {
String equipIds = item.get("equipIds").toString();
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> equipIndexList = this.baseMapper.getEquipIndexList(collect);
Map<String, Map<String, Object>> equipmentSpecificId = equipIndexList.stream().collect(Collectors.toMap(item -> item.get("equipmentSpecificId").toString(), item -> item));
List<Map<String, Object>> resultList = new ArrayList<>();
list.forEach(item -> {
int isOpen = 0;
Date updateDate = null;
String equipIds = item.get("equipIds").toString();
String[] equipIdList = equipIds.split(",");
for (String index : equipIdList) {
if (ObjectUtil.isNotEmpty(equipmentSpecificId)
&& equipmentSpecificId.containsKey(index)
&& equipmentSpecificId.get(index).containsKey("equipmentIndexKey")
&& equipmentSpecificId.get(index).get("equipmentIndexKey").toString().equals("ONL_DrainOilValve_Open")) {
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN);
} else {
int comparisonResult = DateUtil.compare(updateDate, DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN));
updateDate = comparisonResult < 0 ? DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN) : updateDate;
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("id", item.get("id"));
resultMap.put("name", item.get("name"));
resultMap.put("time", updateDate);
resultMap.put("drainDuration", item.get("drainDuration"));
resultMap.put("category", item.get("category"));
if (isOpen == 1) {
resultMap.put("status", "start");
} else {
resultMap.put("status", "stop");
}
resultList.add(resultMap);
});
List<Map<String, Object>> listNew = new ArrayList<>();
Map<String, List<Map<String, Object>>> categoryMap = resultList.stream().collect(Collectors.groupingBy(t -> t.get("category").toString()));
zdsbfl.forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("code", item.getTreeCode());
map.put("name", item.getName());
map.put("items", categoryMap.get(item.getTreeCode()));
listNew.add(map);
});
return listNew;
}
} }
...@@ -1797,7 +1797,42 @@ ...@@ -1797,7 +1797,42 @@
ORDER BY realtiemIotIndexUpdateDate DESC ORDER BY realtiemIotIndexUpdateDate DESC
</select> </select>
<select id="getFirePumpInfoCSZZ" resultType="Map">
SELECT
wes.id,
wes.name,
wes.position,
wes.code,
wes.equipment_code equipmentCode,
wes.realtime_iot_index_name realtimeIotIndexName,
wes.realtime_iot_index_key realtimeIotIndexKey,
wes.realtime_iot_index_value realtimeIotIndexValue,
wes.value_label valueLabel,
wes.realtime_iot_es_index_id realtimeIotSpecificIndexId,
wes.realtime_iot_index_update_date realtiemIotIndexUpdateDate,
wes.realtime_iot_index_id realtimeIotIndexId,
wes.equip_status equipStatus,
ifnull( max( CASE WHEN b.equipment_index_key = 'CAFS_FoamProductionDevice_OutletFlow' THEN `value` END ), '' ) AS outletFlow,
ifnull( max( CASE WHEN b.equipment_index_key = 'CAFS_FoamProductionDevice_OutletFlow' THEN `unit` END ), '' ) AS outletFlowUnit,
ifnull( max( CASE WHEN b.equipment_index_key = 'CAFS_FoamProductionDevice_OutletPressure' THEN `value` END ), '' ) AS outletPressure,
ifnull( max( CASE WHEN b.equipment_index_key = 'CAFS_FoamProductionDevice_OutletPressure' THEN `unit` END ), '' ) AS outletPressureUnit
FROM
wl_equipment_specific wes
LEFT JOIN wl_equipment_specific_index b ON wes.id = b.equipment_specific_id
<where>
<if test="list != null and list.length > 0">
<foreach collection="list" item="item" index="index" open="(" close=")" separator="OR">
wes.equipment_code LIKE <![CDATA[CONCAT(#{item},'%')]]>
</foreach>
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
and wes.biz_org_code LIKE concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
wes.id
ORDER BY realtiemIotIndexUpdateDate DESC
</select>
<select id="getFirePumpInfoEQ" resultType="Map"> <select id="getFirePumpInfoEQ" resultType="Map">
SELECT SELECT
......
...@@ -6697,4 +6697,31 @@ ...@@ -6697,4 +6697,31 @@
ORDER BY ORDER BY
update_date DESC update_date DESC
</select> </select>
<select id="getFEquipInfoListCategory" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds,
a.category
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
AND category IS NOT NULL AND category != ''
ORDER BY
a.create_date DESC
</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