Commit 815440f3 authored by tangwei's avatar tangwei

Merge branch 'developer' into develop_ccs

# Conflicts: # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/EquipmentIndex.java # amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/vo/EquipmentIndexVO.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/impl/FireFightingSystemServiceImpl.java # amos-boot-system-equip/src/main/resources/changelog/wl-3.0.1.xml # amos-boot-system-equip/src/main/resources/mapper/EquipmentIndexMapper.xml # amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificMapper.xml
parents 1e7468e3 5b9215af
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -51,6 +52,32 @@ public class CarProperty extends BaseEntity {
*/
@TableField(value = "equipment_index_key")
private String equipmentIndexKey;
/**
* 颜色
*/
@TableField(value = "emergency_level_color")
private String emergencyLevelColor;
/**
* 是否告警:0-否;1-是
*/
@TableField(value = "is_alarm")
private Integer isAlarm;
/**
* 紧急程度枚举(1:紧急,2:严重,3:轻微,4:正常,5:无效,6:备用,7:其他)
*/
@TableField(value = "emergency_level")
private String emergencyLevel;
/**
* 紧急程度描述
*/
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
@TableField(exist = false)
private String unitName;
......@@ -58,7 +85,12 @@ public class CarProperty extends BaseEntity {
private String perfQuotaName;
@TableField(exist = false)
private String groupName;
@TableField(exist = false)
private String nameKey;
@TableField(exist = false)
private String iotCode;
}
......@@ -83,4 +83,7 @@ public class EquipmentAlarmReportDay extends BaseEntity {
@ApiModelProperty(value = "指标最新值")
private String value;
@ApiModelProperty(value = "是否告警:0-否;1-是")
private Integer isAlarm;
}
......@@ -98,7 +98,6 @@ public class EquipmentIndex extends BaseEntity {
@TableField(value = "perf_value")
private String perfValue;
/**
* 性能指标(临时)
*/
......@@ -111,4 +110,17 @@ public class EquipmentIndex extends BaseEntity {
*/
@TableField(value = "is_trend")
private Boolean isTrend;
@TableField(value = "emergency_level_color")
private String emergencyLevelColor;
@TableField(value = "is_alarm")
private Integer isAlarm;
@TableField(value = "emergency_level")
private String emergencyLevel;
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
}
......@@ -146,7 +146,7 @@ public class EquipmentSpecificAlarm extends BaseEntity {
@ApiModelProperty(value = "设备编码")
@TableField(exist = false)
private String code;
private String equipmentSpecificCode;
@ApiModelProperty(value = "消防系统名称",notes = "告警详情时使用")
@TableField(exist = false)
......@@ -180,4 +180,22 @@ public class EquipmentSpecificAlarm extends BaseEntity {
@TableField(exist = false)
private String buildId;
/**
* 颜色
*/
@TableField(value = "emergency_level_color")
private String emergencyLevelColor;
/**
* 紧急程度枚举(1:紧急,2:严重,3:轻微,4:正常,5:无效,6:备用,7:其他)
*/
@TableField(value = "emergency_level")
private String emergencyLevel;
/**
* 紧急程度描述
*/
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
}
......@@ -188,4 +188,22 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@ApiModelProperty(value = "消除状态")
@TableField(exist = false)
private String cleanStatus;
/**
* 颜色
*/
@TableField(value = "emergency_level_color")
private String emergencyLevelColor;
/**
* 紧急程度枚举(1:紧急,2:严重,3:轻微,4:正常,5:无效,6:备用,7:其他)
*/
@TableField(value = "emergency_level")
private String emergencyLevel;
/**
* 紧急程度描述
*/
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
}
......@@ -50,7 +50,31 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty(value = "指标key(冗余字段)")
@TableField("equipment_index_key")
private String equipmentIndexKey;
/**
* 颜色
*/
@TableField(value = "emergency_level_color")
private String emergencyLevelColor;
/**
* 是否告警:0-否;1-是
*/
@TableField(value = "is_alarm")
private Integer isAlarm;
/**
* 紧急程度枚举(1:紧急,2:严重,3:轻微,4:正常,5:无效,6:备用,7:其他)
*/
@TableField(value = "emergency_level")
private String emergencyLevel;
/**
* 紧急程度描述
*/
@TableField(value = "emergency_level_describe")
private String emergencyLevelDescribe;
@TableField(exist = false)
private String nameKey;
......@@ -109,4 +133,14 @@ public class EquipmentSpecificIndex extends BaseEntity {
@ApiModelProperty(value = "设备所属系统ids")
@TableField(exist = false)
private String systemId;
@ApiModelProperty(value = "详细位置")
@TableField(exist = false)
private String location;
@ApiModelProperty(value = "所属建筑id")
@TableField(exist = false)
private String buildId;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 信号分类量测枚举表
*
* @author system_generator
* @date 2022-02-18
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wl_signal_classify")
public class SignalClassify extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableField("id")
private Long id;
/**
* 量测枚举key
*/
@TableField("type_code")
private String typeCode;
/**
* 类型名称
*/
@TableField("type_name")
private String typeName;
/**
* 十六进制颜色
*/
@TableField("emergency_level_color")
private String emergencyLevelColor;
/**
* 是否删除:0-否;1-是
*/
@TableField("is_alarm")
private Integer isAlarm;
/**
* 紧急程度枚举(1:紧急,2:严重,3:轻微,4:正常,5:无效,6:备用,7:其他)
*/
@TableField("emergency_level")
private String emergencyLevel;
/**
* 紧急程度描述
*/
@TableField("emergency_level_describe")
private String emergencyLevelDescribe;
}
......@@ -65,4 +65,8 @@ public class EquipmentIndexVO {
@ApiModelProperty(value = "是否支持趋势查看")
private Integer isTrend;
@ApiModelProperty(value = "指标枚举")
private String valueEnum;
}
......@@ -54,4 +54,10 @@ public class EquipmentStateVo {
*/
private List<SpeIndexVo> speindexList;
/**
* 紧急程度颜色
*/
private String color;
}
......@@ -16,7 +16,7 @@ public enum CarForGisEnum {
DL("电量","FireCar_Power"),
DDHX("对地航向","FireCar_CourseOverGround"),
SJ("时间","time"),
QT("启停","state");
QT("启停","FireCar_Start");
private String describe;
......
......@@ -10,7 +10,7 @@ package com.yeejoin.equipmanage.common.enums;
*/
public enum EquipmentIndexLabelsEnum {
labels("labels", "装备指标编码");
labels("FireCar_Labels", "装备指标编码");
public final String name;
......
......@@ -6,17 +6,19 @@ import com.yeejoin.equipmanage.common.enums.EquipmentRiskTypeEnum;
import com.yeejoin.equipmanage.common.enums.EquipmentStateEnum;
import com.yeejoin.equipmanage.common.enums.TrueOrFalseEnum;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.validation.Validation;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author keyong
* @title: EquipmentStateUtil
* <pre>
* @description: 通过性能指标判断设备状态(火灾报警 > 故障告警 > 屏蔽 > 运行状态)
......@@ -265,15 +267,9 @@ public class EquipmentStateUtil {
}
public static String judgeEquipState(EquipmentSpecificIndex index) {
String status = EquipmentStateEnum.ZC.getStatus();
String keyValue = String.valueOf(index.getValue());
for (EquipmentRiskTypeEnum enums : EquipmentRiskTypeEnum.values()) {
if (enums.getCode().equals(index.getTypeCode()) && TrueOrFalseEnum.real.value.equals(keyValue)) {
status = enums.getStateCode();
break;
}
if (TrueOrFalseEnum.real.value.toUpperCase().equals(String.valueOf(index.getValue()).toUpperCase())) {
return index.getEmergencyLevelColor();
}
log.info("此装备的状态为: " + status + "(屏蔽-5, 火灾告警-4, 故障-3, 正常-2, 挂起-1)");
return status;
return "";
}
}
......@@ -19,4 +19,16 @@ public class SpeIndexVo {
private String typeCode = "";
private Long equipmentSpecificId;
private String color = "";
private Integer isAlarm = 0;
private String emergencyLevel = "";
private String emergencyLevelDescribe = "";
private String indexValue;
private String indexName;
}
package com.yeejoin.equipmanage.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.servlet.http.HttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.mapper.SignalClassifyMapper;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -15,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -23,15 +31,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.equipmanage.common.entity.Equipment;
import com.yeejoin.equipmanage.common.entity.EquipmentIndex;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.dto.PerfQuotaIotDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.service.ICarPropertyService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificIndexSerivce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -58,6 +59,10 @@ public class EquipmentIndexController {
ICarPropertyService carPropertyService;
@Autowired
private Sequence sequence;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
SignalClassifyMapper signalClassifyMapper;
/**
* 新增消防装备/消防车指标
......@@ -101,7 +106,6 @@ public class EquipmentIndexController {
return true;
}
/**
* 修改消防装备/消防车指标
*
......@@ -114,6 +118,35 @@ public class EquipmentIndexController {
if (equipmentIndex.getIsImportentParameter()) {
//如果不是物联指标项,清空物联指标项信息
if(equipmentIndex.getIsIot()==false){
QueryWrapper<EquipmentDetail> equipmentDetailQueryWrapper = new QueryWrapper<>();
equipmentDetailQueryWrapper.eq("equipment_id", equipmentIndex.getEquipmentId());
List<EquipmentDetail> equipDetailList = iEquipmentDetailService.list(equipmentDetailQueryWrapper);
if (ObjectUtils.isEmpty(equipDetailList)) {
LambdaUpdateWrapper<CarProperty> carWrapper = new LambdaUpdateWrapper<>();
carWrapper.eq(CarProperty::getEquipmentIndexId, equipmentIndex.getId());
List<CarProperty> list = carPropertyService.list(carWrapper);
// 因为是非物联指标信息,所以此处手动定义了默认值(color:#49AA19[绿色];isAlarm:0;alarmDescribe:否;emergencyLevel:4;emergencyLevelDescribe:正常)
list.forEach(x -> {
x.setEmergencyLevelColor("#49AA19");
x.setIsAlarm(0);
x.setEmergencyLevel("4");
x.setEmergencyLevelDescribe("正常");
});
carPropertyService.updateBatchById(list);
} else {
LambdaUpdateWrapper<EquipmentSpecificIndex> equipWrapper = new LambdaUpdateWrapper<>();
equipWrapper.eq(EquipmentSpecificIndex::getEquipmentIndexId, equipmentIndex.getId());
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexSerivce.list(equipWrapper);
if (!ObjectUtils.isEmpty(indexList)) {
indexList.forEach(y -> {
y.setEmergencyLevelColor("#49AA19");
y.setIsAlarm(0);
y.setEmergencyLevel("4");
y.setEmergencyLevelDescribe("正常");
});
equipmentSpecificIndexSerivce.updateBatchById(indexList);
}
}
LambdaUpdateWrapper<EquipmentIndex> equipmentIndexLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
equipmentIndexLambdaUpdateWrapper.eq(EquipmentIndex::getId,equipmentIndex.getId());
equipmentIndexLambdaUpdateWrapper.set(EquipmentIndex::getEquipmentId,equipmentIndex.getEquipmentId());
......@@ -129,6 +162,55 @@ public class EquipmentIndexController {
equipmentIndexLambdaUpdateWrapper.set(EquipmentIndex::getPerfValue,equipmentIndex.getPerfValue());
return equipmentIndexService.update(equipmentIndexLambdaUpdateWrapper);
}else{
AtomicBoolean bool = new AtomicBoolean(true);
if (ValidationUtil.isEmpty(equipmentIndex.getTypeCode())) {
bool.set(false);
}
SignalClassify signalClassify = null;
if (bool.get()) {
LambdaQueryWrapper<SignalClassify> queryWrapper = new LambdaQueryWrapper();
queryWrapper.inSql(SignalClassify::getTypeCode,
"SELECT type_code FROM wl_signal_classify WHERE UPPER(type_code) ='" + equipmentIndex.getTypeCode().toUpperCase() +"'");
signalClassify = signalClassifyMapper.selectOne(queryWrapper);
}
QueryWrapper<EquipmentDetail> equipmentDetailQueryWrapper = new QueryWrapper<>();
equipmentDetailQueryWrapper.eq("equipment_id", equipmentIndex.getEquipmentId());
List<EquipmentDetail> equipDetailList = iEquipmentDetailService.list(equipmentDetailQueryWrapper);
if (ObjectUtils.isEmpty(equipDetailList)) {
LambdaUpdateWrapper<CarProperty> carWrapper = new LambdaUpdateWrapper<>();
carWrapper.eq(CarProperty::getEquipmentIndexId, equipmentIndex.getId());
List<CarProperty> list = carPropertyService.list(carWrapper);
if (!ObjectUtils.isEmpty(list)) {
for (CarProperty x : list) {
x.setEquipmentIndexKey(equipmentIndex.getPerfQuotaDefinitionId());
x.setEquipmentIndexName(equipmentIndex.getPerfQuotaName());
if (bool.get()) {
x.setEmergencyLevelColor(signalClassify.getEmergencyLevelColor());
x.setIsAlarm(signalClassify.getIsAlarm());
x.setEmergencyLevel(signalClassify.getEmergencyLevel());
x.setEmergencyLevelDescribe(signalClassify.getEmergencyLevelDescribe());
}
}
carPropertyService.updateBatchById(list);
}
} else {
LambdaUpdateWrapper<EquipmentSpecificIndex> equipWrapper = new LambdaUpdateWrapper<>();
equipWrapper.eq(EquipmentSpecificIndex::getEquipmentIndexId, equipmentIndex.getId());
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexSerivce.list(equipWrapper);
if (!ObjectUtils.isEmpty(indexList)) {
for (EquipmentSpecificIndex y : indexList) {
y.setEquipmentIndexKey(equipmentIndex.getPerfQuotaDefinitionId());
y.setEquipmentIndexName(equipmentIndex.getPerfQuotaName());
if (bool.get()) {
y.setEmergencyLevelColor(signalClassify.getEmergencyLevelColor());
y.setIsAlarm(signalClassify.getIsAlarm());
y.setEmergencyLevel(signalClassify.getEmergencyLevel());
y.setEmergencyLevelDescribe(signalClassify.getEmergencyLevelDescribe());
}
}
equipmentSpecificIndexSerivce.updateBatchById(indexList);
}
}
return equipmentIndexService.updateById(equipmentIndex);
}
} else {
......
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.SignalClassify;
import com.yeejoin.equipmanage.service.ISignalClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 信号分类量测枚举表
*
* @author system_generator
* @date 2022-02-18
*/
@RestController
@Api(tags = "信号分类量测枚举表Api")
@RequestMapping(value = "/signal/classify", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class SignalClassifyController extends AbstractBaseController {
@Autowired
ISignalClassifyService iSignalClassifyService;
/**
* 新增信号分类量测枚举表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增信号分类量测枚举表", notes = "新增信号分类量测枚举表")
public ResponseModel<SignalClassify> save(@RequestBody SignalClassify model) {
boolean bool = iSignalClassifyService.save(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据id更新
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{id}")
@ApiOperation(httpMethod = "PUT", value = "根据id更新信号分类量测枚举表", notes = "根据id更新信号分类量测枚举表")
public ResponseModel<SignalClassify> updateByidWlSignalClassify(@RequestBody SignalClassify model, @PathVariable(value = "id") Long id) {
model.setId(id);
boolean bool = iSignalClassifyService.updateById(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据id删除
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{id}")
@ApiOperation(httpMethod = "DELETE", value = "根据id删除信号分类量测枚举表", notes = "根据id删除信号分类量测枚举表")
public ResponseModel<Boolean> deleteByid(HttpServletRequest request, @PathVariable(value = "id") Long id){
return ResponseHelper.buildResponse(iSignalClassifyService.removeById(id));
}
/**
* 根据id查询
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{id}")
@ApiOperation(httpMethod = "GET",value = "根据id查询单个信号分类量测枚举表", notes = "根据id查询单个信号分类量测枚举表")
public ResponseModel<SignalClassify> selectOne(@PathVariable Long id) {
return ResponseHelper.buildResponse(iSignalClassifyService.getById(id));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "信号分类量测枚举表列表全部数据查询", notes = "信号分类量测枚举表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<SignalClassify>> selectForList() {
return ResponseHelper.buildResponse(iSignalClassifyService.query().list());
}
}
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm;
import com.yeejoin.equipmanage.common.datasync.vo.AppAlarmExtVo;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
......@@ -28,4 +29,7 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
List<AppAlarmExtVo> findByIdListNoBuildId(@Param("list") List<Long> idBNullList);
List<EquipmentSpecificAlarmLog> getIsConfirmByAlarmId(@Param("equipmentSpecificAlarmId") Long equipmentSpecificAlarmId, @Param("isConfirm") String isConfirm);
List<FireEquipmentFireAlarm> getFireEquipAlarmLogDetailsById(@Param("list") List<Long> ids);
}
......@@ -106,7 +106,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
IPage<SourceNameByEquipSpeIdVO> getSourceNameList(IPage page, Long warehouseStructureId, Long sourceId, String equipmentName, String equipmentCode);
FireEquipment getEquipSpecificDetail(EquipmentSpecific equipmentSpecific);
FireEquipment getEquipSpecificDetail(Long id);
List<EquipmentCategory> getEquipSpeTypeByQrcode(@Param("qrCode") String qrCode);
......@@ -205,4 +205,6 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
String getEquipmentBySpecificId(@Param("specificId") Long specificId);
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId);
List<Map<String,String>> getStationInfo();
}
package com.yeejoin.equipmanage.mapper;
import com.yeejoin.equipmanage.common.entity.SignalClassify;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 信号分类量测枚举表 Mapper 接口
*
* @author system_generator
* @date 2022-02-18
*/
public interface SignalClassifyMapper extends BaseMapper<SignalClassify> {
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.SignalClassify;
import java.util.List;
/**
* 信号分类量测枚举表接口类
*
* @author system_generator
* @date 2022-02-18
*/
public interface ISignalClassifyService extends IService<SignalClassify> {
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.mapper.EquipmentIndexMapper;
import com.yeejoin.equipmanage.mapper.SignalClassifyMapper;
import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.validation.Validation;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@Service
public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, EquipmentIndex> implements IEquipmentIndexService {
......@@ -37,6 +42,9 @@ public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, Equipm
@Autowired
IEquipmentSpecificIndexSerivce iEquipmentSpecificIndexSerivce;
@Autowired
SignalClassifyMapper signalClassifyMapper;
@Override
public IPage<EquipmentIndexVO> getPerfQutoaPage(IPage<EquipmentIndex> page, Long id, String groupName) {
return this.baseMapper.getPage(page, id, groupName);
......@@ -90,7 +98,18 @@ public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, Equipm
@Override
public boolean savePerfQuota(EquipmentIndex equipmentIndex) {
AtomicBoolean bool = new AtomicBoolean(true);
if (ValidationUtil.isEmpty(equipmentIndex.getTypeCode())) {
bool.set(false);
}
int i = this.baseMapper.insert(equipmentIndex);
SignalClassify signalClassify = null;
if (bool.get()) {
LambdaQueryWrapper<SignalClassify> queryWrapper = new LambdaQueryWrapper();
queryWrapper.inSql(SignalClassify::getTypeCode,
"SELECT type_code FROM wl_signal_classify WHERE UPPER(type_code) ='" + equipmentIndex.getTypeCode().toUpperCase() +"'");
signalClassify = signalClassifyMapper.selectOne(queryWrapper);
}
QueryWrapper<EquipmentDetail> equipmentDetailQueryWrapper = new QueryWrapper<>();
equipmentDetailQueryWrapper.eq("equipment_id", equipmentIndex.getEquipmentId());
List<EquipmentDetail> equipDetailList = iEquipmentDetailService.list(equipmentDetailQueryWrapper);
......@@ -100,14 +119,20 @@ public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, Equipm
List<Car> carList = iCarService.list(carQueryWrapper);
if (!ObjectUtils.isEmpty(carList)) {
List<CarProperty> carProperties = new ArrayList<>();
carList.forEach(car -> {
for (Car car : carList) {
CarProperty carProperty = new CarProperty();
carProperty.setCarId(car.getId());
carProperty.setEquipmentIndexId(equipmentIndex.getId());
carProperty.setEquipmentIndexKey(equipmentIndex.getPerfQuotaName());
carProperty.setEquipmentIndexName(equipmentIndex.getPerfQuotaDefinitionId());
if (bool.get()) {
carProperty.setEmergencyLevelColor(signalClassify.getEmergencyLevelColor());
carProperty.setIsAlarm(signalClassify.getIsAlarm());
carProperty.setEmergencyLevel(signalClassify.getEmergencyLevel());
carProperty.setEmergencyLevelDescribe(signalClassify.getEmergencyLevelDescribe());
}
carProperties.add(carProperty);
});
}
iCarPropertyService.saveBatch(carProperties);
}
} else {
......@@ -120,15 +145,21 @@ public class EquipmentIndexImpl extends ServiceImpl<EquipmentIndexMapper, Equipm
List<EquipmentSpecific> equipmentSpecifics = iEquipmentSpecificSerivce.list(equipmentSpecificQueryWrapper);
if (equipmentSpecifics.size() > 0) {
List<EquipmentSpecificIndex> equipmentSpecificIndexList = new ArrayList<>();
equipmentSpecifics.forEach(y -> {
for (EquipmentSpecific y : equipmentSpecifics) {
EquipmentSpecificIndex equipmentSpecificIndex = new EquipmentSpecificIndex();
equipmentSpecificIndex.setEquipmentSpecificId(y.getId());
equipmentSpecificIndex.setEquipmentIndexId(equipmentIndex.getId());
equipmentSpecificIndex.setEquipmentIndexKey(equipmentIndex.getPerfQuotaDefinitionId());
equipmentSpecificIndex.setEquipmentIndexName(equipmentIndex.getPerfQuotaName());
equipmentSpecificIndex.setEquipmentSpecialName(y.getName());
if (bool.get()) {
equipmentSpecificIndex.setEmergencyLevelColor(signalClassify.getEmergencyLevelColor());
equipmentSpecificIndex.setIsAlarm(signalClassify.getIsAlarm());
equipmentSpecificIndex.setEmergencyLevel(signalClassify.getEmergencyLevel());
equipmentSpecificIndex.setEmergencyLevelDescribe(signalClassify.getEmergencyLevelDescribe());
}
equipmentSpecificIndexList.add(equipmentSpecificIndex);
});
};
iEquipmentSpecificIndexSerivce.saveBatch(equipmentSpecificIndexList);
}
}
......
......@@ -139,6 +139,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private VideoMapper videoMapper;
@Autowired
SignalClassifyMapper signalClassifyMapper;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
......@@ -1427,7 +1430,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Override
public FireEquipment getEquipSpecificDetail(EquipmentSpecific equipmentSpecific) {
return equipmentSpecificMapper.getEquipSpecificDetail(equipmentSpecific);
return equipmentSpecificMapper.getEquipSpecificDetail(equipmentSpecific.getId());
}
@Override
......@@ -1466,6 +1469,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
equipmentSpecificIndex.setEquipmentSpecialName(equipName);
equipmentSpecificIndex.setEquipmentIndexName(index.getPerfQuotaName());
equipmentSpecificIndex.setEquipmentIndexKey(index.getPerfQuotaDefinitionId());
equipmentSpecificIndex.setEmergencyLevelColor(index.getEmergencyLevelColor());
equipmentSpecificIndex.setIsAlarm(index.getIsAlarm());
equipmentSpecificIndex.setEmergencyLevel(index.getEmergencyLevel());
equipmentSpecificIndex.setEmergencyLevelDescribe(index.getEmergencyLevelDescribe());
equipmentSpecificIndices.add(equipmentSpecificIndex);
});
}
......
......@@ -48,6 +48,7 @@ import java.net.SocketException;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity>
implements IFireFightingSystemService {
......@@ -566,9 +567,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
List<SpeIndexVo> newList = new ArrayList<>();
List<SpeIndexVo> statusList = new ArrayList<>();
for (SpeIndexVo vo : list) {
String k = vo.getTypeCode();
if (EquipmentRiskTypeEnum.GZ.getCode().equals(k) || EquipmentRiskTypeEnum.HZGJ.getCode().equals(k)
|| EquipmentRiskTypeEnum.YXZT.getCode().equals(k) || EquipmentRiskTypeEnum.PB.getCode().equals(k)) {
int status = vo.getIsAlarm();
if (AlarmStatusEnum.BJ.getCode() == status) {
statusList.add(vo);
}
newList.add(vo);
......@@ -578,8 +578,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
SpeIndexVo spe = new SpeIndexVo();
spe.setKey(EquipmentSpeIndexEnum.YXZT.getCode());
SpeIndexVo latestVo = statusList.get(0);
org.springframework.beans.BeanUtils.copyProperties(latestVo, spe);
spe.setName("当前状态");
spe.setValue(getStatus(statusList));
Map<String, String> map = getStatus(statusList);
spe.setValue(map.get("runStatus"));
spe.setColor(map.get("color"));
statusList.clear();
statusList.add(spe);
statusList.addAll(newList);
......@@ -592,25 +596,28 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
* @param statusList
* @return
*/
private String getStatus(List<SpeIndexVo> statusList) {
private Map<String, String> getStatus(List<SpeIndexVo> statusList) {
Map<String, String> map = new HashMap<>();
SpeIndexVo indexVo = statusList.get(0);
if (EquipmentRiskTypeEnum.HZGJ.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "报警";
}
if (EquipmentRiskTypeEnum.GZ.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "故障";
int i = 0;
for (SpeIndexVo x : statusList) {
if (StringUtil.isNotEmpty(x.getIndexValue())) {
i = i + 1;
}
}
if (EquipmentRiskTypeEnum.PB.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.real.value.equals(indexVo.getValue())) {
return "屏蔽";
if (0 == i) {
map.put("runStatus", "无");
map.put("color", "");
return map;
}
if (EquipmentRiskTypeEnum.YXZT.getCode().equals(indexVo.getTypeCode())
&& TrueOrFalseEnum.fake.value.equals(indexVo.getValue())) {
return "停运";
if (StringUtil.isNotEmpty(indexVo.getIndexValue()) && TrueOrFalseEnum.real.value.toUpperCase().equals(indexVo.getIndexValue().toUpperCase())) {
map.put("runStatus", indexVo.getIndexName());
map.put("color", indexVo.getColor());
return map;
}
return "运行";
map.put("runStatus", "运行");
map.put("color", "");
return map;
}
@Override
......
......@@ -348,7 +348,7 @@ public class RiskSourceSceneServiceImpl extends ServiceImpl<RiskSourceSceneMappe
equipIndexLatestStatus.forEach(action->{
Map<String, String> map = new HashMap<>();
map.put("equipCode", action.getQrCode());
map.put("status", EquipmentStateUtil.judgeEquipState(action));
map.put("color", EquipmentStateUtil.judgeEquipState(action));
data.add(map);
});
return data;
......
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.SignalClassify;
import com.yeejoin.equipmanage.mapper.SignalClassifyMapper;
import com.yeejoin.equipmanage.service.ISignalClassifyService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* 信号分类量测枚举表服务实现类
*
* @author system_generator
* @date 2022-02-18
*/
@Service
public class SignalClassifyServiceImpl extends ServiceImpl<SignalClassifyMapper, SignalClassify> implements ISignalClassifyService {
}
\ No newline at end of file
......@@ -8,15 +8,22 @@
wcp.value AS value,
wcp.remark AS remark,
wcp.equipment_index_id AS equipmentIndexId,
wei.name_key AS nameKey
wei.name_key AS nameKey,
wcp.is_alarm as isAlarm,
wcp.emergency_level_color as emergencyLevelColor,
wcp.emergency_level as emergencyLevel,
wcp.emergency_level_describe as emergencyLevelDescribe,
wc.iot_code as iotCode,
wc.`name` as carName,
wc.car_num as carNum,
wei.unit unitName,
wei.group_name as groupName
FROM
wl_car_property wcp
LEFT JOIN wl_car AS wc ON wc.id = wcp.car_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wcp.equipment_index_id
WHERE
wc.iot_code = #{iotCode}
AND
TRIM(wei.name_key) != '' AND wei.name_key IS NOT NULL
wc.iot_code = #{iotCode} and wei.is_iot = true
</select>
<select id="getCarPropertyList" resultType="com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo">
SELECT
......
......@@ -89,7 +89,8 @@
null as group_name,
null as index_id,
0 as is_importent_parameter,
0 as sort_num
0 as sort_num,
null as value_enum
from wl_equipment
where
id = #{id}
......@@ -108,7 +109,8 @@
group_name,
index_definition_id,
1 as is_importent_parameter,
sort_num
sort_num,
value_enum
from
wl_equipment_index
where equipment_id = #{id}
......@@ -154,7 +156,8 @@
1 as is_importent_parameter,
sort_num,
type,
is_trend
is_trend,
value_enum
from
wl_equipment_index
where id = #{id}
......
......@@ -110,4 +110,42 @@
</if>
</where>
</select>
<select id="getFireEquipAlarmLogDetailsById"
resultType="com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm">
SELECT
sal.id,
es.id AS fireEquipmentId,
si.id AS equipmentMeasurementId,
ei.name_key AS fieldName,
ei.`name` AS fieldLabel,
IFNULL(si.`value`,'') AS `value`,
sa.frequency,
sa.`status`,
sa.type,
IFNULL(es.code,'') AS fireEquipmentMRid,
'' AS equipmentMeasurementMRid,
ed.`name` AS fireEquipmentName,
sa.recovery_date,
sal.create_date,
sal.update_date,
sal.alarm_reason AS description,
IFNULL(sal.equipment_specific_name,'') AS `name`,
IFNULL(sal.equipment_specific_code,'') AS mrid
FROM
wl_equipment_specific_alarm_log sal
LEFT JOIN wl_equipment_specific_alarm sa ON sal.equipment_specific_alarm_id = sa.id
LEFT JOIN wl_equipment_specific es ON sa.equipment_specific_id = es.id
LEFT JOIN wl_equipment_specific_index si ON es.id = si.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment_index ei ON si.equipment_index_id = ei.id
<where>
<if test="list != null and list.size > 0">
sal.id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -57,14 +57,21 @@
ed.equipment_id AS equipmentId,
ed.id AS equipmentDetailId,
wes.code as equipmentSpecificCode,
wes.system_id as systemId
wes.system_id as systemId,
wesi.is_alarm as isAlarm,
wesi.emergency_level_color as emergencyLevelColor,
wesi.emergency_level as emergencyLevel,
wesi.emergency_level_describe as emergencyLevelDescribe,
TRIM(CONCAT_WS(' ',wes.position,sd.description)) AS location,
sd.warehouse_structure_id AS buildId
FROM
wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
LEFT JOIN wl_equipment_index AS wei ON wei.id = wesi.equipment_index_id
LEFT JOIN wl_stock_detail sd ON sd.equipment_specific_id = wes.id
WHERE
wes.iot_code = #{iotCode}
wes.iot_code = #{iotCode} and wei.is_iot = true
</select>
<select id="getEquipmentSpeIndexByIotCode"
......
......@@ -275,13 +275,15 @@
SELECT
equipindex.`value`,
ei.type_code AS 'typeCode',
es.qr_code AS 'qrCode'
es.qr_code AS 'qrCode',
equipindex.color AS emergencyLevelColor
FROM
(
SELECT
esi.equipment_index_id,
esi.equipment_specific_id,
esi.`value`
esi.`value`,
esi.emergency_level_color as color
FROM
wl_equipment_specific_index esi,
(
......@@ -315,12 +317,15 @@
es.realtime_iot_index_name AS 'indexName',
es.qr_code AS 'qrCode',
es.iot_code AS 'iotCode',
es.realtime_iot_index_value AS 'value'
es.realtime_iot_index_value AS 'value',
sc.emergency_level_color AS 'emergencyLevelColor'
FROM
wl_equipment_specific es,
wl_equipment_index ei
wl_equipment_index ei,
wl_signal_classify sc
WHERE
es.realtime_iot_index_id = ei.id
AND upper(ei.type_code) = upper(sc.type_code)
AND find_in_set(
es.id,
(
......@@ -1502,5 +1507,14 @@
LEFT JOIN wl_equipment_category AS wlec ON wlec.id = wle.category_id
WHERE
spe.warehouse_structure_id =#{floorId}
</select>
<select id="getStationInfo" resultType="Map">
SELECT
`name` AS stationName,
station_code AS stationCode
FROM
f_station_info
LIMIT 1
</select>
</mapper>
\ No newline at end of file
......@@ -355,7 +355,6 @@
spein.value_label
),
concat(
IF (
(
ISNULL(spein.value_label)
......@@ -367,7 +366,13 @@
' ',
eqin.unit
)
) AS `value`
) AS `value`,
spein.emergency_level_color AS color,
spein.is_alarm AS isAlarm,
spein.emergency_level AS emergencyLevel,
spein.emergency_level_describe AS emergencyLevelDescribe,
spein.`value` AS indexValue,
spein.equipment_index_name AS indexName
FROM
wl_equipment_specific_index AS spein
LEFT JOIN wl_equipment_index AS eqin ON spein.equipment_index_id = eqin.id
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.SignalClassifyMapper">
</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