Commit d71b080b authored by tangwei's avatar tangwei

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

parents d867eb0b a8832769
......@@ -806,6 +806,9 @@ LEFT JOIN (
#{bizOrgType}
</foreach>
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
and usr.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
order by usr.rec_date
</select>
......
......@@ -533,27 +533,27 @@ public class EquipmentDetailController extends AbstractBaseController {
// List<EquipmentDetailDownloadTemplateVO> equipmentDetailDownloads = new ArrayList<>();
// ExcelUtils.exportExcel(equipmentDetailDownloads, "设备信息", "设备信息", EquipmentDetailDownloadTemplateVO.class, simpleDateFormat.format(new Date()) + ".xls", response);
try {
// 判读机场服务是否在线
ExcelEnums excelEnums;
ResponseModel<String[]> result = jcsFeign.getEquipmentInfo(getAppKey(), getProduct(), getToken(), null, "getEquipCompany");
if (200 == result.getStatus()) {
excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZB.getType());
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, getToken(),
getAppKey(), getProduct(), true);
}
} catch (Exception e) {
// try {
// // 判读机场服务是否在线
// ExcelEnums excelEnums;
// ResponseModel<String[]> result = jcsFeign.getEquipmentInfo(getAppKey(), getProduct(), getToken(), null, "getEquipCompany");
// if (200 == result.getStatus()) {
// excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZB.getType());
// ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
// String url = excelDto.getClassUrl();
// Class<?> clz = Class.forName(url);
// ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, getToken(),
// getAppKey(), getProduct(), true);
// }
//
// } catch (Exception e) {
ExcelEnums excelEnums = ExcelEnums.getByKey(ExcelEnums.XFZBSINGLE.getType());
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
String url = excelDto.getClassUrl();
Class<?> clz = Class.forName(url);
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), null, clz, getToken(),
getAppKey(), getProduct(), true);
}
// }
}
/**
......
package com.yeejoin.equipmanage.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.equipmanage.utils.ExplicitConstraint;
import com.yeejoin.equipmanage.utils.RoleNameExplicitConstraint;
/**
* @author litw
......@@ -48,4 +50,14 @@ public class EquipmentDetailExcelSingleTemplateDto {
//@Excel(name = "消防系统编码", width = 30, orderNum = "10")
private String fightingSysCodes;
@ExplicitConstraint(indexNum = 10, sourceClass = RoleNameExplicitConstraint.class,method="getEquipFireTeam") //动态下拉内容
@ExcelProperty(value = "所属队伍", index = 10)
//@Excel(name = "所属队伍",width = 30,orderNum = "11")
private String fireTeam;
//动态下拉内容
@ExplicitConstraint(indexNum = 11, sourceClass = RoleNameExplicitConstraint.class,method="getEquipCompany") //动态下拉内容
@ExcelProperty(value = "所属单位", index = 11)
//@Excel(name = "所属单位",width = 30,orderNum = "12")
private String companyName;
}
......@@ -1152,13 +1152,19 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}).collect(Collectors.toList());
// 3.将建筑的bizOrgCode转换为parentId连接树 ,拼接数据准备
Map<String, Long> comMap = companyList.stream().collect(Collectors.toMap(BuildingTreeVo::getBizOrgCode, BuildingTreeVo::getId));
buildingTreeVos.forEach(b -> {
//增加了一层对树的过滤,过滤掉指定公司外的其他建筑。
List<BuildingTreeVo> collect = buildingTreeVos.stream().filter(build ->companyList.stream().map(m -> {
String bizOrgCode = m.getBizOrgCode();
return bizOrgCode;
}).collect(Collectors.toList()).contains(build.getBizOrgCode())).collect(Collectors.toList());
collect.forEach(b -> {
b.setParentId("0".equals(b.getParentId()) ? String.valueOf(comMap.get(b.getBizOrgCode())) : b.getParentId());
b.setDetailPaneApi(address);
b.setApiUrl(apiUrl);
});
// 4.组装树
companyList.addAll(buildingTreeVos);
companyList.addAll(collect);
return companyList;
}
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
......@@ -16,8 +17,11 @@ import com.yeejoin.equipmanage.common.enums.AlarmCleanTypeEnum;
import com.yeejoin.equipmanage.common.enums.AlarmStatusEnum;
import com.yeejoin.equipmanage.common.enums.AlarmTypeEnum;
import com.yeejoin.equipmanage.common.enums.TopicEnum;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.Token;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.fegin.SystemctlFeign;
import com.yeejoin.equipmanage.mapper.ConfirmAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
......@@ -85,6 +89,12 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Value("${window.vedioFormat}")
String vedioFormat;
@Value("${isSendApp}")
private Boolean isSendApp;
@Autowired
private SystemctlFeign systemctlFeign;
@Autowired
private RuleConfirmAlarmService ruleConfirmAlamService;
......@@ -96,6 +106,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Override
public Map<String, Object> getDetailsById(Long alarmId, Long equipId, String type, String area) {
final String videoType = "video";
......@@ -177,10 +188,15 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
}
if (isBatch == 1 && CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(x -> webMqttHandler.publish(TopicEnum.EQYQR.getTopic(), JSON.parseObject(JSON.toJSONString(x), HashMap.class)));
list.stream().forEach(x ->{
webMqttHandler.publish(TopicEnum.EQYQR.getTopic(), JSON.parseObject(JSON.toJSONString(x), HashMap.class));
x.setAlarmReason(ent.getAlarmReason());
// syncConfirmAlarmMsgToSystemctl(x);
});
} else {
// mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSON.toJSONString(ent));
webMqttHandler.publish(TopicEnum.EQYQR.getTopic(), JSON.parseObject(JSON.toJSONString(ent), HashMap.class));
// syncConfirmAlarmMsgToSystemctl(ent);
}
// syncDataService.syncCreatedSendAlarmReport(ent);
}
......@@ -200,6 +216,39 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
}
public void syncConfirmAlarmMsgToSystemctl(EquipmentSpecificAlarmLog equipmentSpecificAlarmLog) {
try {
MessageModel model = new MessageModel();
String alarmReason = ValidationUtil.isEmpty(equipmentSpecificAlarmLog.getAlarmReason()) ? "" : equipmentSpecificAlarmLog.getAlarmReason();
if (alarmReason.contains(":")) {
String[] split = alarmReason.split(":");
alarmReason = split[1];
}
model.setTitle(equipmentSpecificAlarmLog.getEquipmentSpecificIndexName());
String body = String.format("警情类型:%s;报警设备:%s;报警位置:%s;报警原因:%s;报警时间:%s",
equipmentSpecificAlarmLog.getEquipmentSpecificIndexName(), equipmentSpecificAlarmLog.getEquipmentSpecificName(),
equipmentSpecificAlarmLog.getLocation(), alarmReason,
DateUtils.date2LongStr(equipmentSpecificAlarmLog.getCreateDate()));
model.setBody(body);
model.setMsgType("iotMonitor");
if (isSendApp){
model.setIsSendApp(true);
model.setTerminal("APP/WEB");
} else {
model.setIsSendApp(false);
model.setTerminal("WEB");
}
model.setIsSendWeb(true);
model.setCategory(1);
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
log.debug(String.format("调用平台消息服务成功:%s", JSON.toJSONString(model)));
} catch (Exception e) {
log.error("告警消息同步平台失败:syncSystemctlMsg,===>>>" + e.getMessage());
}
}
@Override
public Integer getFireAlarm() {
return confirmAlarmMapper.getFireAlarm();
......
......@@ -983,12 +983,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public Object getEquipmentTypeAndCount(String bizOrgCode) {
if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) {
return JSONArray.parseArray(
JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class);
} else {
// if (redisUtils.hasKey(equipTypeAndCount + bizOrgCode)) {
// return JSONArray.parseArray(
// JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class);
// } else {
return refreshEquipmentTypeAndCount(bizOrgCode);
}
// }
}
@Override
......@@ -999,6 +999,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.filter(m->!m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode()))
.collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode, SourceTypeEnum.EQUIPMENT);
redisUtils.set(equipTypeAndCount + bizOrgCode, list, 86400);
......
......@@ -907,13 +907,14 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarmLog.setEquipmentSpecificCode(equipmentSpecificAlarm.getCode());
equipmentSpecificAlarmLog.setBuildId(equipmentSpecificAlarm.getBuildId());
equipmentSpecificAlarmLog.setStatus(equipmentSpecificAlarm.getStatus());
equipmentSpecificAlarmLogService.save(equipmentSpecificAlarmLog);
boolean bool = equipmentSpecificAlarmLogService.save(equipmentSpecificAlarmLog);
// 同步告警消息给平台
if (amosSwitch) {
if (amosSwitch && bool) {
EquipmentSpecificAlarmLog alarmLog = equipmentSpecificAlarmLogService.getById(equipmentSpecificAlarmLog.getId());
new Thread(new Runnable() {
@Override
public void run() {
syncSystemctlMsg(equipmentSpecificAlarmLog);
syncSystemctlMsg(alarmLog);
}
}).start();
}
......
......@@ -213,7 +213,7 @@
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d
<where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">
d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%")
</if>
......@@ -270,7 +270,7 @@
left join wl_equipment_specific wles ON wlesa.equipment_specific_id = wles.id
) d
<where>
<if test="warehouseStructureName != null and warehouseStructureName != ''">and d.warehouseStructureName like
<if test="warehouseStructureName != null and warehouseStructureName != ''"> d.warehouseStructureName like
concat(concat("%",#{warehouseStructureName}),"%")
</if>
<if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like
......@@ -348,8 +348,8 @@
wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d
WHERE
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and
<where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">
d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%")
</if>
......@@ -389,6 +389,8 @@
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND
d.cleanStatus = '未消除'
</if>
</where>
ORDER BY d.createDate DESC
</select>
<select id="getAlarmList" resultType="java.util.HashMap">
......@@ -459,7 +461,7 @@
) d
<where>
<if test="warehouseStructureName != null and warehouseStructureName != ''">
and d.warehouseStructureName like
d.warehouseStructureName like
concat(concat("%",#{warehouseStructureName}),"%")
</if>
<if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like
......@@ -515,9 +517,8 @@
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d
WHERE 1=1
AND d.fireEquipmentName IS NOT NULL
AND d.id = #{id}
WHERE
d.id = #{id}
AND d.type = #{alarmType}
ORDER BY d.createDate DESC
</select>
......@@ -554,9 +555,7 @@
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d
WHERE
1 = 1
AND d.fireEquipmentName IS NOT NULL
AND d.equipmentSpecificId = #{id}
d.equipmentSpecificId = #{id}
AND d.type = #{alarmType}
</select>
<select id="getEquipmentAlarmCount" resultType="int">
......@@ -577,9 +576,7 @@
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d
WHERE
d.fireEquipmentName <![CDATA[<>]]> ''
AND d.equipmentSpecificId = #{id}
WHERE d.equipmentSpecificId = #{id}
AND d.type = #{alarmType}
</select>
<select id="findByTypeAndDate" resultMap="resultMapDto">
......@@ -659,7 +656,6 @@
</where>
) d
<where>
d.fireEquipmentName IS NOT NULL
<choose>
<when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type}
......@@ -797,7 +793,6 @@
</where>
) d
<where>
d.fireEquipmentName IS NOT NULL
<choose>
<when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type}
......@@ -958,7 +953,6 @@
</where>
) d
<where>
d.fireEquipmentName IS NOT NULL
<choose>
<when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type}
......@@ -1011,7 +1005,7 @@
)m
<where>
<if test="dto.status != null and dto.status != ''">
AND `status`= #{dto.status}
`status`= #{dto.status}
</if>
<if test="dto.warehouseStructureName != null and dto.warehouseStructureName != ''">
AND warehouseStructureName LIKE CONCAT('%', #{dto.warehouseStructureName}, '%' )
......
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