Commit 667953cd authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/DCenterController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEquipmentSpecificSerivce.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java # amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificMapper.xml
parents b969d369 e7772aa9
......@@ -600,7 +600,7 @@ WHERE
ou.sequence_nbr as id,
ou.biz_org_name as userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IFNULL( MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ), '' ) AS postTypeName,
IF(MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '', NULL, MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
......
package com.yeejoin.equipmanage.common.dto;
import lombok.Data;
@Data
public class FireFightingSystemDto {
private Long id;
private String code;
private String name;
private Integer equipTotal = 0;
private Integer alarmEquipTotal = 0;
private Integer status = 0;
private String image;
}
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
......@@ -12,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -33,7 +35,7 @@ import java.util.Map;
public class DCenterController extends AbstractBaseController {
@Autowired
IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
IFireFightingSystemService fireFightingSystemService;
......@@ -43,7 +45,6 @@ public class DCenterController extends AbstractBaseController {
/**
* 直流中心告警列表分页,用于直流中心大数据查询分页,不建议再扩展联表查询
*
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -59,10 +60,34 @@ public class DCenterController extends AbstractBaseController {
request.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
queryRequests.add(request);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.zlzxListPage(param);
Page<Map<String, Object>> list = equipmentSpecificAlarmService.zlzxListPage(param);
return CommonResponseUtil.success(list);
}
/**
* 消防系统运行状态分页查询
* @param bizOrgCode
* @param commonPageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统运行状态分页查询")
@GetMapping("/fireSysRunStatusPage")
public ResponseModel fireSysRunStatusPage(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (StringUtils.isBlank(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemService.fireSysRunStatusPage(page, bizOrgCode));
}
/**
* 获取消防系统总体运行情况
......
......@@ -62,10 +62,6 @@ public class SupervisionConfigureController extends AbstractBaseController {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
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<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getWaterInfoBySuper(page, bizOrgCode));
}
......@@ -94,10 +90,6 @@ public class SupervisionConfigureController extends AbstractBaseController {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
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<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemMapper.getPipeNetworkBySuper(page, bizOrgCode));
}
......@@ -196,11 +188,13 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/fireAlarmLogPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防报警列表分页查询", produces = "application/json;charset=UTF-8", notes = "消防报警列表分页查询")
public ResponseModel pageQuery(@RequestParam(required = false) String code, @RequestParam(required = false) String typeCode, CommonPageable commonPageable) {
public ResponseModel pageQuery(@RequestParam(required = false) String code,
@RequestParam(required = false) String typeCode,
@RequestParam(required = false) String bizOrgCode,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request7 = new CommonRequest();
request7.setName("system");
......@@ -210,12 +204,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
request8.setName("specificIndexKey");
request8.setValue(StringUtil.isNotEmpty(typeCode) ? StringUtils.trimToNull(typeCode) : null);
queryRequests.add(request8);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
queryRequests.add(request13);
}
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(bizOrgCode) ? StringUtils.trimToNull(typeCode) : null);
queryRequests.add(request13);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
return CommonResponseUtil.success(equipmentSpecificAlarmService.fireAlarmLogPage(param));
}
......@@ -225,16 +217,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/alarmTrend", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势")
public ResponseModel alarmTrend() {
String bizOrgCode = null;
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode) {
return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode));
}
......@@ -242,12 +225,10 @@ public class SupervisionConfigureController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览稳压泵信息")
@GetMapping("/getPressurePumpInfo")
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable) {
public ResponseModel getPressurePumpInfo(CommonPageable commonPageable,@RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
......
package com.yeejoin.equipmanage.mapper;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -240,4 +238,9 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Map<String, Object> getWaterSysInfo();
Map<String, Object> getEquipmentStatisticsInfo(@Param("map") Map<String, Object> map);
Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode);
List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode);
}
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipment;
import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
......@@ -17,9 +18,9 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -245,5 +246,22 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
Map<String, Object> getWaterSysInfo(String startDate, String endDate);
List<Map<String, Object>> getEquipmentStatisticsInfo(String bizOrgCode);
/**
* 消防系统物联部件统计
* @param page
* @param bizOrgCode
* @return
*/
Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, String bizOrgCode);
/**
* 系统状态及告警设备统计
* @param date
* @param bizOrgCode
* @return
*/
List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode);
}
......@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.morphic.model.ResourceDTO;
import com.yeejoin.equipmanage.common.datasync.entity.FireFightingSystem;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
......@@ -295,4 +296,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate);
List<Map<String, Object>> getSystemRunningInfoList();
Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode);
}
......@@ -8,8 +8,8 @@ import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
......@@ -1966,6 +1966,17 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
tempMap.put("code", x);
list.add(tempMap);
});
return list;
return list;
}
@Override
public Page<FireFightingSystemDto> fireSysIotEquipCount(Page<Map<String, Object>> page, String bizOrgCode) {
return equipmentSpecificMapper.fireSysIotEquipCount(page, bizOrgCode);
}
@Override
public List<FireFightingSystemDto> fireSysIotEquipAlarmCount(Date date, String bizOrgCode) {
return equipmentSpecificMapper.fireSysIotEquipAlarmCount(date, bizOrgCode);
}
}
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.equipmanage.common.datasync.entity.FireFightingSystem;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
......@@ -35,7 +36,6 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.beanutils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -2075,4 +2075,26 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
return resultList;
}
@Override
public Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode) {
// 消防系统物联部件统计
Page<FireFightingSystemDto> pages = equipmentSpecificSerivce.fireSysIotEquipCount(page, bizOrgCode);
List<FireFightingSystemDto> records = pages.getRecords();
// 系统状态及今日告警设备统计
if (!CollectionUtils.isEmpty(records)) {
List<Long> idList = records.stream().map(FireFightingSystemDto::getId).collect(Collectors.toList());
List<FireFightingSystemDto> list = equipmentSpecificSerivce.fireSysIotEquipAlarmCount(new Date(), bizOrgCode);
//使用stream流把list1和list2根据属性userId合并一个list集合
List<FireFightingSystemDto> collect = records.stream().map(m -> {
list.stream().filter(m2-> Objects.equals(m.getId(),m2.getId())).forEach(m2-> {
m.setAlarmEquipTotal(m2.getAlarmEquipTotal());
m.setStatus(m2.getStatus());
});
return m;
}).collect(Collectors.toList());
pages.setRecords(collect);
}
return pages;
}
}
......@@ -373,4 +373,26 @@
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221116-1152-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_name"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_name</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构/部门名称' AFTER `defect_batch_id`;
</sql>
</changeSet>
<changeSet author="gaojianqiang" id="20221116-1152-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_code</comment>
<sql>
ALTER TABLE `wl_equipment_specific_alarm_log` ADD COLUMN `biz_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构编码' AFTER `biz_org_name`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -1970,6 +1970,7 @@
ORDER BY
`c`.`click_date`
</select>
<select id="getEquipmentStatisticsInfo" resultType="java.util.Map">
SELECT
(
......@@ -2009,4 +2010,70 @@
</if>
) AS 'foamtank'
</select>
<select id="fireSysIotEquipCount" resultType="com.yeejoin.equipmanage.common.dto.FireFightingSystemDto">
SELECT
fs.id,
fs.`code`,
fs.`name`,
count( 1 ) AS equipTotal,
ec.image
FROM
f_fire_fighting_system fs
LEFT JOIN `wl_equipment_specific` `wes` ON find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment e ON wed.`equipment_id` = e.`id`
LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type
WHERE
e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''">
and fs.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
fs.id
ORDER BY
fs.sort
</select>
<select id="fireSysIotEquipAlarmCount" resultType="com.yeejoin.equipmanage.common.dto.FireFightingSystemDto">
SELECT
s.id,
s.`name`,
IFNULL(s.alarmEquipTotal, 0) AS alarmEquipTotal,
<choose>
<when test="date != null">
IF(s.total > 0,1,0) AS `status`
</when>
<otherwise>
IF(s.alarmEquipTotal > 0,1,0) AS `status`
</otherwise>
</choose>
FROM
(SELECT
fs.id,
fs.`name`,
count( 1 ) AS total,
<choose>
<when test="date != null">
SUM(IF(TO_DAYS(esi.create_date) = TO_DAYS(#{date}),1,0)) AS alarmEquipTotal
</when>
<otherwise>
COUNT( 1 ) AS alarmEquipTotal
</otherwise>
</choose>
FROM
f_fire_fighting_system fs
LEFT JOIN `wl_equipment_specific` `wes` ON find_in_set( `fs`.`id`, `wes`.`system_id` )
LEFT JOIN wl_equipment_specific_index esi ON esi.equipment_specific_id = wes.id
<where>
(
( esi.is_alarm = 1 AND esi.`value` = 'true' )
OR ( esi.is_alarm = 0 AND esi.`value` = 'false' )
)
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND fs.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
fs.id) s
</select>
</mapper>
\ No newline at end of file
......@@ -4538,7 +4538,6 @@
select * from (
(SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(
......@@ -4585,12 +4584,9 @@
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
fs.`code` AS systemCode
r.sequence_nbr
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
......@@ -4598,7 +4594,7 @@
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
......@@ -4607,7 +4603,6 @@
(
SELECT
a.`name`,
a.`code`,
a.minLevel,
a.maxLevel,
(
......@@ -4654,13 +4649,11 @@
a.volume,
a.image,
a.resource_type,
a.sequence_nbr,
a.`code` AS systemCode
a.sequence_nbr
FROM
(
SELECT
r.`name`,
ou.`code`,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
(select
......@@ -4674,19 +4667,16 @@
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
fs.`code` AS systemCode
rp.level_device_id
FROM
cb_water_resource r
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = r.biz_org_code
AND ou.is_delete = 0
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND ou.`code` IS NOT NULL
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
......@@ -4893,7 +4883,9 @@
WHERE
ed.`code` LIKE '92011000%'
<!-- AND es.iot_code IS NOT NULL-->
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
es.id
) a
......
......@@ -28,7 +28,7 @@ public class KafkaConsumerService {
* 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
* @param message 消息
*/
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}")
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}", errorHandler = "consumerAwareListenerErrorHandler")
public void consumerSingle(String message,Acknowledgment ack) {
JSONObject messageObj = JSONObject.fromObject(message);
String topic = messageObj.getString("topic");
......
package com.yeejoin.amos.message.kafka.config;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
/**
* topic初始化
*
* @author litw
* @create 2022/11/1 10:06
*/
@Configuration class KafkaConfig {
@Value("${kafka.init.topics}")
private String topics;
/**
* 创建一个名为topic.test的Topic并设置分区数为8,分区副本数为2
*/
@Bean public void initialTopic() {
String[] split = topics.split(",");
Arrays.stream(split).forEach(e->{
new NewTopic(e, 8, (short) 2);
});
}
}
\ No newline at end of file
//package com.yeejoin.amos.message.kafka.config;
//
//
//import org.apache.kafka.clients.admin.NewTopic;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.Arrays;
//
///**
// * topic初始化
// *
// * @author litw
// * @create 2022/11/1 10:06
// */
//@Configuration class KafkaConfig {
//
// @Value("${kafka.init.topics}")
// private String topics;
//
// /**
// * 创建一个名为topic.test的Topic并设置分区数为8,分区副本数为2
// */
// @Bean public void initialTopic() {
// String[] split = topics.split(",");
// Arrays.stream(split).forEach(e->{
// new NewTopic(e, 8, (short) 2);
// });
// }
//
//
//}
\ No newline at end of file
......@@ -8,6 +8,67 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
management.health.redis.enabled=false
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
......@@ -16,14 +77,18 @@ emqx.client-user-name=admin
emqx.client-password=public
emqx.max-inflight=1000
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=1234560
# 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边
#站端配置
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=null.topic
kafka.init.topics=
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
\ No newline at end of file
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
##中心级配置配置
##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
#kafka.topics=JKXT2BP-XFYY-Topic
#
##需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
#emq.topic=
\ No newline at end of file
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.11.201:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 生产者 ssl
spring.kafka.producer.properties.security.protocol=SASL_SSL
spring.kafka.producer.properties.sasl.mechanism=PLAIN
spring.kafka.producer.properties.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="io.cs" \
password="@$-5mocGV2n62K67GiMv9#sqvpaOu.0=%4y6vZ#cS#.@n2n-x5$n/35xfvSAKD12";
spring.kafka.producer.properties.ssl.truststore.location=D:/client.truststore.jks
spring.kafka.producer.properties.ssl.truststore.password=dms@kafka
spring.kafka.producer.properties.ssl.endpoint.identification.algorithm=
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 消费者 ssl
spring.kafka.consumer.properties.security.protocol=SASL_SSL
spring.kafka.consumer.properties.sasl.mechanism=PLAIN
spring.kafka.consumer.properties.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
username="io.cs" \
password="@$-5mocGV2n62K67GiMv9#sqvpaOu.0=%4y6vZ#cS#.@n2n-x5$n/35xfvSAKD12";
spring.kafka.consumer.properties.ssl.truststore.location=D:/client.truststore.jks
spring.kafka.consumer.properties.ssl.truststore.password=dms@kafka
spring.kafka.consumer.properties.ssl.endpoint.identification.algorithm=
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
management.health.redis.enabled=false
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin
emqx.client-password=public
emqx.max-inflight=1000
# 下面个配置默认站端 中心级系统的时候注释掉上边 放开下边
#站端配置
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=null.topic
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
##中心级配置配置
##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
#kafka.topics=JKXT2BP-XFYY-Topic
#
##需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
#emq.topic=
\ No newline at end of file
......@@ -5,59 +5,4 @@ spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=0
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
......@@ -2,26 +2,31 @@
{
"code": "iot",
"emqTopic": "emq.iot.created",
"akkaTopic": "akka.iot.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "akka.patrol.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "sign",
"emqTopic": "emq.sign.created",
"akkaTopic": "akka.sign.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "bussSign",
"emqTopic": "emq.bussSign.created",
"akkaTopic": "akka.bussSign.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "user",
"emqTopic": "emq.user.created",
"akkaTopic": "akka.user.created"
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "xf",
"emqTopic": "emq.xf.created",
"akkaTopic": "JKXT2BP-XF-Topic"
}
]
\ No newline at end of file
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