Commit 1552c30a authored by “yiyousong”'s avatar “yiyousong”
parents e6b0bf0e d55e6f3e
...@@ -168,11 +168,13 @@ export default { ...@@ -168,11 +168,13 @@ export default {
const content = formatter(this.tableData, column, val); const content = formatter(this.tableData, column, val);
if (content) { if (content) {
if (val == '0') { if (val == '0') {
return <el-tag size='mini'>{content}</el-tag> return <el-tag type={'warning'} size='mini'>{content}</el-tag>
} else if (val == '1') { } else if (val == '1') {
return <el-tag type={'danger'} size='mini'>{content}</el-tag> return <el-tag type={'danger'} size='mini'>{content}</el-tag>
} else if (val == '2') { } else if (val == '2') {
return <el-tag type={'success'} size='mini'>{content}</el-tag> return <el-tag type={'success'} size='mini'>{content}</el-tag>
}else{
return <el-tag size='mini'>{content}</el-tag>
} }
} else { } else {
return val return val
......
...@@ -41,4 +41,11 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `showWechatQrCode` tinyint(2) DEFA ...@@ -41,4 +41,11 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `showWechatQrCode` tinyint(2) DEFA
ALTER TABLE mortals_xhx_device ADD COLUMN `orgName` varchar(128) COMMENT '所属机构' AFTER showWechatQrCode; ALTER TABLE mortals_xhx_device ADD COLUMN `orgName` varchar(128) COMMENT '所属机构' AFTER showWechatQrCode;
\ No newline at end of file
ALTER TABLE mortals_xhx_device_alarm_info
ADD COLUMN `push` tinyint(2) DEFAULT '0' COMMENT '是否推送',
ADD COLUMN `productId` bigint(20) DEFAULT '0' COMMENT '产品Id',
ADD COLUMN `productCode` varchar(256) DEFAULT '' COMMENT '产品编码',
ADD COLUMN `productName` varchar(256) DEFAULT '' COMMENT '产品名称'
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<profiles.redis.username></profiles.redis.username> <profiles.redis.username></profiles.redis.username>
<profiles.redis.password>12345678</profiles.redis.password> <profiles.redis.password>12345678</profiles.redis.password>
<profiles.redis.database>6</profiles.redis.database> <profiles.redis.database>6</profiles.redis.database>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password> <profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
......
...@@ -146,10 +146,19 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -146,10 +146,19 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmInfoEntity.setReceivePersonnelTelephone(deviceEntity.getLeadingOfficialTelephone()); alarmInfoEntity.setReceivePersonnelTelephone(deviceEntity.getLeadingOfficialTelephone());
alarmInfoEntity.setCreateTime(new Date()); alarmInfoEntity.setCreateTime(new Date());
alarmInfoEntity.setCreateUserId(1L); alarmInfoEntity.setCreateUserId(1L);
deviceAlarmInfoService.save(alarmInfoEntity);
// TODO: 2022/6/23 告警信息保存与发送 // TODO: 2022/6/23 告警信息保存与发送
AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId())); AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId()));
if (!ObjectUtils.isEmpty(alarmConfigEntity)) { if (!ObjectUtils.isEmpty(alarmConfigEntity)) {
/* if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.站内信息.getValue()) {
}*/
if(EnabledEnum.启用.getValue()==alarmConfigEntity.getEnabled()){
alarmInfoEntity.setProductId(productEntity.getId());
alarmInfoEntity.setProductCode(productEntity.getProductCode());
alarmInfoEntity.setProductName(productEntity.getProductName());
alarmInfoEntity.setPush(YesNoEnum.YES.getValue());
deviceAlarmInfoService.save(alarmInfoEntity);
}
if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) { if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) {
// TODO: 2022/7/4 发送短信 // TODO: 2022/7/4 发送短信
Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId())); Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId()));
...@@ -176,12 +185,20 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -176,12 +185,20 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmSmsSendService.save(alarmSmsSendEntity, null); alarmSmsSendService.save(alarmSmsSendEntity, null);
} }
} else { } else {
//推送站类
} }
} }
} }
} }
} }
// deviceAlarmInfoService.save(alarmInfoEntity);
} }
} }
} }
......
...@@ -9,7 +9,7 @@ import java.util.Map; ...@@ -9,7 +9,7 @@ import java.util.Map;
* @author zxfei * @author zxfei
*/ */
public enum AlarmPusW1ayEnum { public enum AlarmPusW1ayEnum {
不推送(0, "不推送"), 站内信息(0, "站内信息"),
短信(1, "短信"); 短信(1, "短信");
private Integer value; private Integer value;
private String desc; private String desc;
......
...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.alarm.web; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.alarm.web;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.AlarmPusW1ayEnum;
import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.module.alarm.model.AlarmConfigEntity; import com.mortals.xhx.module.alarm.model.AlarmConfigEntity;
import com.mortals.xhx.module.alarm.service.AlarmConfigService; import com.mortals.xhx.module.alarm.service.AlarmConfigService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
...@@ -38,8 +40,8 @@ public class AlarmConfigController extends BaseCRUDJsonBodyMappingController<Ala ...@@ -38,8 +40,8 @@ public class AlarmConfigController extends BaseCRUDJsonBodyMappingController<Ala
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("AlarmConfig","alarmType")); this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("AlarmConfig","alarmType"));
this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("AlarmConfig","alarmLevel")); this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("AlarmConfig","alarmLevel"));
this.addDict(model, "alarmPusW1ay", paramService.getParamBySecondOrganize("AlarmConfig","alarmPusW1ay")); this.addDict(model, "alarmPusW1ay", AlarmPusW1ayEnum.getEnumMap());
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("AlarmConfig","isUse")); this.addDict(model, "enabled", EnabledEnum.getEnumMap());
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName()))); this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
super.init(model, context); super.init(model, context);
......
...@@ -4,12 +4,11 @@ import com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo; ...@@ -4,12 +4,11 @@ import com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
* 设备告警日志实体对象 * 设备告警日志实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-27 * @date 2023-07-19
*/ */
@Data @Data
public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
...@@ -24,7 +23,7 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -24,7 +23,7 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
*/ */
private Long alarmDevice; private Long alarmDevice;
/** /**
* 告警类型,(0.离线,1.在线,2.缺纸) * 告警类型,(0.离线)
*/ */
private Integer alarmType; private Integer alarmType;
/** /**
...@@ -59,33 +58,47 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -59,33 +58,47 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
* 设备名称 * 设备名称
*/ */
private String deviceName; private String deviceName;
/**
* 是否推送
*/
private Integer push;
/**
* 产品Id
*/
private Long productId;
/**
* 产品编码
*/
private String productCode;
/**
* 产品名称
*/
private String productName;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getAlarmDevice().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) return false; if (obj == null) return false;
if (obj instanceof DeviceAlarmInfoEntity) { if (obj instanceof DeviceAlarmInfoEntity) {
DeviceAlarmInfoEntity tmp = (DeviceAlarmInfoEntity) obj; DeviceAlarmInfoEntity tmp = (DeviceAlarmInfoEntity) obj;
if (this.getAlarmDevice().equals(tmp.getAlarmDevice())) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
} }
public void initAttrValue() { public void initAttrValue(){
this.alarmTime = null; this.alarmTime = null;
this.alarmDevice = null; this.alarmDevice = -1L;
this.alarmType = null; this.alarmType = -1;
this.alarmLevel = null; this.alarmLevel = -1;
this.alarmReceivePersonnel = ""; this.alarmReceivePersonnel = "";
...@@ -95,10 +108,18 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -95,10 +108,18 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
this.alarmContent = ""; this.alarmContent = "";
this.siteId = null; this.siteId = -1L;
this.deviceCode = ""; this.deviceCode = "";
this.deviceName = ""; this.deviceName = "";
this.push = 0;
this.productId = -1L;
this.productCode = "";
this.productName = "";
} }
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ import java.util.List; ...@@ -5,7 +5,7 @@ import java.util.List;
* 设备告警日志查询对象 * 设备告警日志查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-27 * @date 2023-07-19
*/ */
public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity { public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -156,6 +156,46 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity { ...@@ -156,6 +156,46 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity {
/** 设备名称排除列表 */ /** 设备名称排除列表 */
private List <String> deviceNameNotList; private List <String> deviceNameNotList;
/** 开始 是否推送 */
private Integer pushStart;
/** 结束 是否推送 */
private Integer pushEnd;
/** 增加 是否推送 */
private Integer pushIncrement;
/** 是否推送列表 */
private List <Integer> pushList;
/** 是否推送排除列表 */
private List <Integer> pushNotList;
/** 开始 产品Id */
private Long productIdStart;
/** 结束 产品Id */
private Long productIdEnd;
/** 增加 产品Id */
private Long productIdIncrement;
/** 产品Id列表 */
private List <Long> productIdList;
/** 产品Id排除列表 */
private List <Long> productIdNotList;
/** 产品编码 */
private List<String> productCodeList;
/** 产品编码排除列表 */
private List <String> productCodeNotList;
/** 产品名称 */
private List<String> productNameList;
/** 产品名称排除列表 */
private List <String> productNameNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<DeviceAlarmInfoQuery> orConditionList; private List<DeviceAlarmInfoQuery> orConditionList;
...@@ -987,6 +1027,232 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity { ...@@ -987,6 +1027,232 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity {
this.deviceNameNotList = deviceNameNotList; this.deviceNameNotList = deviceNameNotList;
} }
/**
* 获取 开始 是否推送
* @return pushStart
*/
public Integer getPushStart(){
return this.pushStart;
}
/**
* 设置 开始 是否推送
* @param pushStart
*/
public void setPushStart(Integer pushStart){
this.pushStart = pushStart;
}
/**
* 获取 结束 是否推送
* @return $pushEnd
*/
public Integer getPushEnd(){
return this.pushEnd;
}
/**
* 设置 结束 是否推送
* @param pushEnd
*/
public void setPushEnd(Integer pushEnd){
this.pushEnd = pushEnd;
}
/**
* 获取 增加 是否推送
* @return pushIncrement
*/
public Integer getPushIncrement(){
return this.pushIncrement;
}
/**
* 设置 增加 是否推送
* @param pushIncrement
*/
public void setPushIncrement(Integer pushIncrement){
this.pushIncrement = pushIncrement;
}
/**
* 获取 是否推送
* @return pushList
*/
public List<Integer> getPushList(){
return this.pushList;
}
/**
* 设置 是否推送
* @param pushList
*/
public void setPushList(List<Integer> pushList){
this.pushList = pushList;
}
/**
* 获取 是否推送
* @return pushNotList
*/
public List<Integer> getPushNotList(){
return this.pushNotList;
}
/**
* 设置 是否推送
* @param pushNotList
*/
public void setPushNotList(List<Integer> pushNotList){
this.pushNotList = pushNotList;
}
/**
* 获取 开始 产品Id
* @return productIdStart
*/
public Long getProductIdStart(){
return this.productIdStart;
}
/**
* 设置 开始 产品Id
* @param productIdStart
*/
public void setProductIdStart(Long productIdStart){
this.productIdStart = productIdStart;
}
/**
* 获取 结束 产品Id
* @return $productIdEnd
*/
public Long getProductIdEnd(){
return this.productIdEnd;
}
/**
* 设置 结束 产品Id
* @param productIdEnd
*/
public void setProductIdEnd(Long productIdEnd){
this.productIdEnd = productIdEnd;
}
/**
* 获取 增加 产品Id
* @return productIdIncrement
*/
public Long getProductIdIncrement(){
return this.productIdIncrement;
}
/**
* 设置 增加 产品Id
* @param productIdIncrement
*/
public void setProductIdIncrement(Long productIdIncrement){
this.productIdIncrement = productIdIncrement;
}
/**
* 获取 产品Id
* @return productIdList
*/
public List<Long> getProductIdList(){
return this.productIdList;
}
/**
* 设置 产品Id
* @param productIdList
*/
public void setProductIdList(List<Long> productIdList){
this.productIdList = productIdList;
}
/**
* 获取 产品Id
* @return productIdNotList
*/
public List<Long> getProductIdNotList(){
return this.productIdNotList;
}
/**
* 设置 产品Id
* @param productIdNotList
*/
public void setProductIdNotList(List<Long> productIdNotList){
this.productIdNotList = productIdNotList;
}
/**
* 获取 产品编码
* @return productCodeList
*/
public List<String> getProductCodeList(){
return this.productCodeList;
}
/**
* 设置 产品编码
* @param productCodeList
*/
public void setProductCodeList(List<String> productCodeList){
this.productCodeList = productCodeList;
}
/**
* 获取 产品编码
* @return productCodeNotList
*/
public List<String> getProductCodeNotList(){
return this.productCodeNotList;
}
/**
* 设置 产品编码
* @param productCodeNotList
*/
public void setProductCodeNotList(List<String> productCodeNotList){
this.productCodeNotList = productCodeNotList;
}
/**
* 获取 产品名称
* @return productNameList
*/
public List<String> getProductNameList(){
return this.productNameList;
}
/**
* 设置 产品名称
* @param productNameList
*/
public void setProductNameList(List<String> productNameList){
this.productNameList = productNameList;
}
/**
* 获取 产品名称
* @return productNameNotList
*/
public List<String> getProductNameNotList(){
return this.productNameNotList;
}
/**
* 设置 产品名称
* @param productNameNotList
*/
public void setProductNameNotList(List<String> productNameNotList){
this.productNameNotList = productNameNotList;
}
/** /**
* 设置 主键ID,主键,自增长 * 设置 主键ID,主键,自增长
* @param id * @param id
...@@ -1463,6 +1729,152 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity { ...@@ -1463,6 +1729,152 @@ public class DeviceAlarmInfoQuery extends DeviceAlarmInfoEntity {
return this; return this;
} }
/**
* 设置 是否推送
* @param push
*/
public DeviceAlarmInfoQuery push(Integer push){
setPush(push);
return this;
}
/**
* 设置 开始 是否推送
* @param pushStart
*/
public DeviceAlarmInfoQuery pushStart(Integer pushStart){
this.pushStart = pushStart;
return this;
}
/**
* 设置 结束 是否推送
* @param pushEnd
*/
public DeviceAlarmInfoQuery pushEnd(Integer pushEnd){
this.pushEnd = pushEnd;
return this;
}
/**
* 设置 增加 是否推送
* @param pushIncrement
*/
public DeviceAlarmInfoQuery pushIncrement(Integer pushIncrement){
this.pushIncrement = pushIncrement;
return this;
}
/**
* 设置 是否推送
* @param pushList
*/
public DeviceAlarmInfoQuery pushList(List<Integer> pushList){
this.pushList = pushList;
return this;
}
/**
* 设置 是否推送
* @param pushNotList
*/
public DeviceAlarmInfoQuery pushNotList(List<Integer> pushNotList){
this.pushNotList = pushNotList;
return this;
}
/**
* 设置 产品Id
* @param productId
*/
public DeviceAlarmInfoQuery productId(Long productId){
setProductId(productId);
return this;
}
/**
* 设置 开始 产品Id
* @param productIdStart
*/
public DeviceAlarmInfoQuery productIdStart(Long productIdStart){
this.productIdStart = productIdStart;
return this;
}
/**
* 设置 结束 产品Id
* @param productIdEnd
*/
public DeviceAlarmInfoQuery productIdEnd(Long productIdEnd){
this.productIdEnd = productIdEnd;
return this;
}
/**
* 设置 增加 产品Id
* @param productIdIncrement
*/
public DeviceAlarmInfoQuery productIdIncrement(Long productIdIncrement){
this.productIdIncrement = productIdIncrement;
return this;
}
/**
* 设置 产品Id
* @param productIdList
*/
public DeviceAlarmInfoQuery productIdList(List<Long> productIdList){
this.productIdList = productIdList;
return this;
}
/**
* 设置 产品Id
* @param productIdNotList
*/
public DeviceAlarmInfoQuery productIdNotList(List<Long> productIdNotList){
this.productIdNotList = productIdNotList;
return this;
}
/**
* 设置 产品编码
* @param productCode
*/
public DeviceAlarmInfoQuery productCode(String productCode){
setProductCode(productCode);
return this;
}
/**
* 设置 产品编码
* @param productCodeList
*/
public DeviceAlarmInfoQuery productCodeList(List<String> productCodeList){
this.productCodeList = productCodeList;
return this;
}
/**
* 设置 产品名称
* @param productName
*/
public DeviceAlarmInfoQuery productName(String productName){
setProductName(productName);
return this;
}
/**
* 设置 产品名称
* @param productNameList
*/
public DeviceAlarmInfoQuery productNameList(List<String> productNameList){
this.productNameList = productNameList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
...@@ -242,27 +242,27 @@ public class DeviceEntity extends DeviceVo { ...@@ -242,27 +242,27 @@ public class DeviceEntity extends DeviceVo {
this.deviceMac = ""; this.deviceMac = "";
this.siteId = null; this.siteId = 0L;
this.siteCode = ""; this.siteCode = "";
this.siteName = ""; this.siteName = "";
this.platformId = null; this.platformId = 0L;
this.platformName = ""; this.platformName = "";
this.productId = null; this.productId = 0L;
this.productName = ""; this.productName = "";
this.skinId = null; this.skinId = 0L;
this.skinName = ""; this.skinName = "";
this.homeUrl = ""; this.homeUrl = "";
this.deviceFirmId = null; this.deviceFirmId = 0L;
this.deviceFirmname = ""; this.deviceFirmname = "";
...@@ -274,9 +274,9 @@ public class DeviceEntity extends DeviceVo { ...@@ -274,9 +274,9 @@ public class DeviceEntity extends DeviceVo {
this.lati = ""; this.lati = "";
this.deviceInBuilding = null; this.deviceInBuilding = 1;
this.deviceInFloor = null; this.deviceInFloor = 1;
this.defectsLiabilityPeriod = null; this.defectsLiabilityPeriod = null;
...@@ -318,7 +318,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -318,7 +318,7 @@ public class DeviceEntity extends DeviceVo {
this.productCode = ""; this.productCode = "";
this.hallId = null; this.hallId = 0L;
this.hallName = ""; this.hallName = "";
......
...@@ -69,15 +69,9 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl ...@@ -69,15 +69,9 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
DeviceAlarmInfoQuery deviceAlarmInfoQuery = new DeviceAlarmInfoQuery(); DeviceAlarmInfoQuery deviceAlarmInfoQuery = new DeviceAlarmInfoQuery();
deviceAlarmInfoQuery.setAlarmTimeStart(DateUtil.today()); deviceAlarmInfoQuery.setAlarmTimeStart(DateUtil.today());
deviceAlarmInfoQuery.setAlarmTimeEnd(DateUtil.today()); deviceAlarmInfoQuery.setAlarmTimeEnd(DateUtil.today());
List<OrderCol> orderCols = new ArrayList<>(); deviceAlarmInfoQuery.setOrderColList(Arrays.asList(new OrderCol("alarmTime",OrderCol.DESCENDING)));
OrderCol orderCol = new OrderCol();
orderCol.setColName("alarmTime");
orderCol.setSortKind(OrderCol.DESCENDING);
orderCols.add(orderCol);
deviceAlarmInfoQuery.setOrderColList(orderCols);
List<DeviceAlarmInfoEntity> deviceAlarmInfoList = this.find(deviceAlarmInfoQuery); List<DeviceAlarmInfoEntity> deviceAlarmInfoList = this.find(deviceAlarmInfoQuery);
//统计总设备数量 //统计总设备数量
List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().siteId(siteId)); List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().siteId(siteId));
//设备总量 //设备总量
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
<result property="siteId" column="siteId" /> <result property="siteId" column="siteId" />
<result property="deviceCode" column="deviceCode" /> <result property="deviceCode" column="deviceCode" />
<result property="deviceName" column="deviceName" /> <result property="deviceName" column="deviceName" />
<result property="push" column="push" />
<result property="productId" column="productId" />
<result property="productCode" column="productCode" />
<result property="productName" column="productName" />
</resultMap> </resultMap>
...@@ -72,23 +76,35 @@ ...@@ -72,23 +76,35 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceName') or colPickMode == 1 and data.containsKey('deviceName')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('deviceName') or colPickMode == 1 and data.containsKey('deviceName')))">
a.deviceName, a.deviceName,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('push') or colPickMode == 1 and data.containsKey('push')))">
a.push,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('productId') or colPickMode == 1 and data.containsKey('productId')))">
a.productId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('productCode') or colPickMode == 1 and data.containsKey('productCode')))">
a.productCode,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('productName') or colPickMode == 1 and data.containsKey('productName')))">
a.productName,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="DeviceAlarmInfoEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="DeviceAlarmInfoEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_device_alarm_info insert into mortals_xhx_device_alarm_info
(alarmTime,alarmDevice,alarmType,alarmLevel,alarmReceivePersonnel,receivePersonnelTelephone,alarmStatus,alarmContent,createTime,updateUserId,updateTime,siteId,deviceCode,deviceName) (alarmTime,alarmDevice,alarmType,alarmLevel,alarmReceivePersonnel,receivePersonnelTelephone,alarmStatus,alarmContent,createTime,updateUserId,updateTime,siteId,deviceCode,deviceName,push,productId,productCode,productName)
VALUES VALUES
(#{alarmTime},#{alarmDevice},#{alarmType},#{alarmLevel},#{alarmReceivePersonnel},#{receivePersonnelTelephone},#{alarmStatus},#{alarmContent},#{createTime},#{updateUserId},#{updateTime},#{siteId},#{deviceCode},#{deviceName}) (#{alarmTime},#{alarmDevice},#{alarmType},#{alarmLevel},#{alarmReceivePersonnel},#{receivePersonnelTelephone},#{alarmStatus},#{alarmContent},#{createTime},#{updateUserId},#{updateTime},#{siteId},#{deviceCode},#{deviceName},#{push},#{productId},#{productCode},#{productName})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_device_alarm_info insert into mortals_xhx_device_alarm_info
(alarmTime,alarmDevice,alarmType,alarmLevel,alarmReceivePersonnel,receivePersonnelTelephone,alarmStatus,alarmContent,createTime,updateUserId,updateTime,siteId,deviceCode,deviceName) (alarmTime,alarmDevice,alarmType,alarmLevel,alarmReceivePersonnel,receivePersonnelTelephone,alarmStatus,alarmContent,createTime,updateUserId,updateTime,siteId,deviceCode,deviceName,push,productId,productCode,productName)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.alarmTime},#{item.alarmDevice},#{item.alarmType},#{item.alarmLevel},#{item.alarmReceivePersonnel},#{item.receivePersonnelTelephone},#{item.alarmStatus},#{item.alarmContent},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.siteId},#{item.deviceCode},#{item.deviceName}) (#{item.alarmTime},#{item.alarmDevice},#{item.alarmType},#{item.alarmLevel},#{item.alarmReceivePersonnel},#{item.receivePersonnelTelephone},#{item.alarmStatus},#{item.alarmContent},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.siteId},#{item.deviceCode},#{item.deviceName},#{item.push},#{item.productId},#{item.productCode},#{item.productName})
</foreach> </foreach>
</insert> </insert>
...@@ -158,6 +174,24 @@ ...@@ -158,6 +174,24 @@
<if test="(colPickMode==0 and data.containsKey('deviceName')) or (colPickMode==1 and !data.containsKey('deviceName'))"> <if test="(colPickMode==0 and data.containsKey('deviceName')) or (colPickMode==1 and !data.containsKey('deviceName'))">
a.deviceName=#{data.deviceName}, a.deviceName=#{data.deviceName},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('push')) or (colPickMode==1 and !data.containsKey('push'))">
a.push=#{data.push},
</if>
<if test="(colPickMode==0 and data.containsKey('pushIncrement')) or (colPickMode==1 and !data.containsKey('pushIncrement'))">
a.push=ifnull(a.push,0) + #{data.pushIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('productId')) or (colPickMode==1 and !data.containsKey('productId'))">
a.productId=#{data.productId},
</if>
<if test="(colPickMode==0 and data.containsKey('productIdIncrement')) or (colPickMode==1 and !data.containsKey('productIdIncrement'))">
a.productId=ifnull(a.productId,0) + #{data.productIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('productCode')) or (colPickMode==1 and !data.containsKey('productCode'))">
a.productCode=#{data.productCode},
</if>
<if test="(colPickMode==0 and data.containsKey('productName')) or (colPickMode==1 and !data.containsKey('productName'))">
a.productName=#{data.productName},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -298,6 +332,44 @@ ...@@ -298,6 +332,44 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="push=(case" suffix="ELSE push end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('push')) or (colPickMode==1 and !item.containsKey('push'))">
when a.id=#{item.id} then #{item.push}
</when>
<when test="(colPickMode==0 and item.containsKey('pushIncrement')) or (colPickMode==1 and !item.containsKey('pushIncrement'))">
when a.id=#{item.id} then ifnull(a.push,0) + #{item.pushIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="productId=(case" suffix="ELSE productId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('productId')) or (colPickMode==1 and !item.containsKey('productId'))">
when a.id=#{item.id} then #{item.productId}
</when>
<when test="(colPickMode==0 and item.containsKey('productIdIncrement')) or (colPickMode==1 and !item.containsKey('productIdIncrement'))">
when a.id=#{item.id} then ifnull(a.productId,0) + #{item.productIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="productCode=(case" suffix="ELSE productCode end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('productCode')) or (colPickMode==1 and !item.containsKey('productCode'))">
when a.id=#{item.id} then #{item.productCode}
</if>
</foreach>
</trim>
<trim prefix="productName=(case" suffix="ELSE productName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('productName')) or (colPickMode==1 and !item.containsKey('productName'))">
when a.id=#{item.id} then #{item.productName}
</if>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -753,6 +825,102 @@ ...@@ -753,6 +825,102 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('push')">
<if test="conditionParamRef.push != null ">
${_conditionType_} a.push = #{${_conditionParam_}.push}
</if>
<if test="conditionParamRef.push == null">
${_conditionType_} a.push is null
</if>
</if>
<if test="conditionParamRef.containsKey('pushList') and conditionParamRef.pushList.size() > 0">
${_conditionType_} a.push in
<foreach collection="conditionParamRef.pushList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('pushNotList') and conditionParamRef.pushNotList.size() > 0">
${_conditionType_} a.push not in
<foreach collection="conditionParamRef.pushNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('pushStart') and conditionParamRef.pushStart != null">
${_conditionType_} a.push <![CDATA[ >= ]]> #{${_conditionParam_}.pushStart}
</if>
<if test="conditionParamRef.containsKey('pushEnd') and conditionParamRef.pushEnd != null">
${_conditionType_} a.push <![CDATA[ <= ]]> #{${_conditionParam_}.pushEnd}
</if>
<if test="conditionParamRef.containsKey('productId')">
<if test="conditionParamRef.productId != null ">
${_conditionType_} a.productId = #{${_conditionParam_}.productId}
</if>
<if test="conditionParamRef.productId == null">
${_conditionType_} a.productId is null
</if>
</if>
<if test="conditionParamRef.containsKey('productIdList') and conditionParamRef.productIdList.size() > 0">
${_conditionType_} a.productId in
<foreach collection="conditionParamRef.productIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('productIdNotList') and conditionParamRef.productIdNotList.size() > 0">
${_conditionType_} a.productId not in
<foreach collection="conditionParamRef.productIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('productIdStart') and conditionParamRef.productIdStart != null">
${_conditionType_} a.productId <![CDATA[ >= ]]> #{${_conditionParam_}.productIdStart}
</if>
<if test="conditionParamRef.containsKey('productIdEnd') and conditionParamRef.productIdEnd != null">
${_conditionType_} a.productId <![CDATA[ <= ]]> #{${_conditionParam_}.productIdEnd}
</if>
<if test="conditionParamRef.containsKey('productCode')">
<if test="conditionParamRef.productCode != null and conditionParamRef.productCode != ''">
${_conditionType_} a.productCode like #{${_conditionParam_}.productCode}
</if>
<if test="conditionParamRef.productCode == null">
${_conditionType_} a.productCode is null
</if>
</if>
<if test="conditionParamRef.containsKey('productCodeList') and conditionParamRef.productCodeList.size() > 0">
${_conditionType_} a.productCode in
<foreach collection="conditionParamRef.productCodeList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('productCodeNotList') and conditionParamRef.productCodeNotList.size() > 0">
${_conditionType_} a.productCode not in
<foreach collection="conditionParamRef.productCodeNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('productName')">
<if test="conditionParamRef.productName != null and conditionParamRef.productName != ''">
${_conditionType_} a.productName like #{${_conditionParam_}.productName}
</if>
<if test="conditionParamRef.productName == null">
${_conditionType_} a.productName is null
</if>
</if>
<if test="conditionParamRef.containsKey('productNameList') and conditionParamRef.productNameList.size() > 0">
${_conditionType_} a.productName in
<foreach collection="conditionParamRef.productNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('productNameNotList') and conditionParamRef.productNameNotList.size() > 0">
${_conditionType_} a.productName not in
<foreach collection="conditionParamRef.productNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -841,6 +1009,26 @@ ...@@ -841,6 +1009,26 @@
<if test='orderCol.deviceName != null and "DESC".equalsIgnoreCase(orderCol.deviceName)'>DESC</if> <if test='orderCol.deviceName != null and "DESC".equalsIgnoreCase(orderCol.deviceName)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('push')">
a.push
<if test='orderCol.push != null and "DESC".equalsIgnoreCase(orderCol.push)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('productId')">
a.productId
<if test='orderCol.productId != null and "DESC".equalsIgnoreCase(orderCol.productId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('productCode')">
a.productCode
<if test='orderCol.productCode != null and "DESC".equalsIgnoreCase(orderCol.productCode)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('productName')">
a.productName
<if test='orderCol.productName != null and "DESC".equalsIgnoreCase(orderCol.productName)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
</sql> </sql>
......
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