Commit 5a943828 authored by 张森's avatar 张森

Merge remote-tracking branch 'origin/develop_dl' into develop_dl_bugfix

parents b9454fc3 256e3bfb
...@@ -79,4 +79,7 @@ public class EquipTypeImgAmountVO { ...@@ -79,4 +79,7 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "日常运维") @ApiModelProperty(value = "日常运维")
private String equip; private String equip;
@ApiModelProperty(value = "系统IDs")
private String systemId;
} }
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -1008,11 +1009,31 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1008,11 +1009,31 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage); .getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
ArrayList<String> systemIds = new ArrayList<>();
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) { if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]); x.setAmount(x.getAmount().split("\\.")[0]);
} }
if (StringUtil.isNotEmpty(x.getSystemId())) {
List<String> systemId = Arrays.asList(x.getSystemId().split(","));
systemIds.addAll(systemId);
}
}); });
if (CollUtil.isNotEmpty(systemIds)) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getId, systemIds);
List<FireFightingSystemEntity> fireSystemList = fireFightingSystemMapper.selectList(wrapper);
Map<String, String> systemNameMap = fireSystemList.stream().collect(Collectors.toMap(t -> t.getId().toString(), FireFightingSystemEntity::getName));
list.getRecords().parallelStream().forEach(item -> {
if (StringUtil.isNotEmpty(item.getSystemId())) {
ArrayList<String> systemNames = new ArrayList<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(","));
systemIdList.parallelStream().forEach(id -> systemNames.add(systemNameMap.getOrDefault(id, "")));
String join = String.join(",", systemNames);
item.setSystemName(join);
}
});
}
return list; return list;
} }
......
...@@ -2071,7 +2071,7 @@ ...@@ -2071,7 +2071,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList"> <select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
select * from (
SELECT SELECT
wles.id, wles.id,
wles.qr_code, wles.qr_code,
...@@ -2083,8 +2083,7 @@ ...@@ -2083,8 +2083,7 @@
concat_ws('-',wlws.full_name,wled.area) as full_name, concat_ws('-',wlws.full_name,wled.area) as full_name,
wlws.name as belongBuildName, wlws.name as belongBuildName,
wlun.NAME unitName, wlun.NAME unitName,
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,wles.system_id)) wles.system_id as systemId,
as systemName,
wlsd.amount, wlsd.amount,
wlsd.id as stockDetailId, wlsd.id as stockDetailId,
'equipment' as type, 'equipment' as type,
...@@ -2165,13 +2164,12 @@ ...@@ -2165,13 +2164,12 @@
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''"> <if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%') AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if> </if>
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"> <if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
AND s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%') AND concat_ws('-',wlws.full_name,wled.area) LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if> </if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"> <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%') AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if> </if>
order by createDate DESC order by createDate DESC
</select> </select>
......
...@@ -40,33 +40,33 @@ public class KafkaConsumerService { ...@@ -40,33 +40,33 @@ public class KafkaConsumerService {
@Value("classpath:/json/commonMessage.json") @Value("classpath:/json/commonMessage.json")
private Resource commonMessage; private Resource commonMessage;
/** // /**
* 批量消费kafka消息 // * 批量消费kafka消息
* Kafka消息转emq // * Kafka消息转emq
* // *
* @param consumerRecords messages // * @param consumerRecords messages
* @param ack ack // * @param ack ack
*/ // */
@KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}") // @KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}")
public void listen1(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) { // public void listen1(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) {
try { // try {
for (ConsumerRecord<String, String> consumerRecord : consumerRecords) { // for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value()); // Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value());
if (kafkaMessage.isPresent()) { // if (kafkaMessage.isPresent()) {
JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get()); // JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get());
if (messageObj.has(TOPIC)) { // if (messageObj.has(TOPIC)) {
emqKeeper.getMqttClient().publish(messageObj.optString(TOPIC), messageObj.getJSONObject(DATA).toString() // emqKeeper.getMqttClient().publish(messageObj.optString(TOPIC), messageObj.getJSONObject(DATA).toString()
.getBytes(StandardCharsets.UTF_8), 0, false); // .getBytes(StandardCharsets.UTF_8), 0, false);
} // }
log.info("kafka消费zhTestGroup消息{}", messageObj); // log.info("kafka消费zhTestGroup消息{}", messageObj);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e); // log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e);
} finally { // } finally {
ack.acknowledge(); // ack.acknowledge();
} // }
} // }
/** /**
* 批量消费kafka消息 * 批量消费kafka消息
...@@ -244,29 +244,29 @@ public class KafkaConsumerService { ...@@ -244,29 +244,29 @@ public class KafkaConsumerService {
// } // }
///** /**
// * 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"} * 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
// * *
// * @param message 消息 * @param message 消息
// */ */
//@KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2") @KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2")
//public void consumerSingle(String message, Acknowledgment ack) { public void consumerSingle(String message, Acknowledgment ack) {
// JSONObject messageObj = JSONObject.fromObject(message); JSONObject messageObj = JSONObject.fromObject(message);
// try { try {
// String topic = null; String topic = null;
// JSONObject data = null; JSONObject data = null;
// if (messageObj.has("topic")) { if (messageObj.has("topic")) {
// topic = messageObj.getString("topic"); topic = messageObj.getString("topic");
// data = messageObj.getJSONObject("data"); data = messageObj.getJSONObject("data");
// emqKeeper.getMqttClient().publish(topic, data.toString().getBytes(StandardCharsets.UTF_8), 0, false); emqKeeper.getMqttClient().publish(topic, data.toString().getBytes(StandardCharsets.UTF_8), 0, false);
// ack.acknowledge(); ack.acknowledge();
// log.info("消息转发成功" + messageObj); log.info("消息转发成功" + messageObj);
// } }
// } catch (Exception e) { } catch (Exception e) {
// log.error("消息转发失败" + e.getMessage(), e); log.error("消息转发失败" + e.getMessage(), e);
// } }
//} }
//
///** ///**
// * 省级消息转发 // * 省级消息转发
......
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