diff --git a/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/config/ImtTenantAutoConfiguration.java b/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/config/ImtTenantAutoConfiguration.java index 6129b64..781a67b 100644 --- a/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/config/ImtTenantAutoConfiguration.java +++ b/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/config/ImtTenantAutoConfiguration.java @@ -4,6 +4,7 @@ import com.inspur.framework.common.enums.WebFilterOrderEnum; import com.inspur.framework.mybatis.core.util.MyBatisUtils; import com.inspur.framework.redis.config.ImtCacheProperties; import com.inspur.framework.tenant.core.aop.TenantIgnoreAspect; +import com.inspur.framework.tenant.core.db.ImtTenantLineInnerInterceptor; import com.inspur.framework.tenant.core.db.TenantDatabaseInterceptor; import com.inspur.framework.tenant.core.job.TenantJobAspect; import com.inspur.framework.tenant.core.mq.rabbitmq.TenantRabbitMQInitializer; @@ -57,7 +58,7 @@ public class ImtTenantAutoConfiguration { @Bean public TenantLineInnerInterceptor tenantLineInnerInterceptor(TenantProperties properties, MybatisPlusInterceptor interceptor) { - TenantLineInnerInterceptor inner = new TenantLineInnerInterceptor(new TenantDatabaseInterceptor(properties)); + TenantLineInnerInterceptor inner = new ImtTenantLineInnerInterceptor(new TenantDatabaseInterceptor(properties)); // 添加到 interceptor 中 // 需要加在首个,主要是为了在分页插件前面。这个是 MyBatis Plus 的规定 MyBatisUtils.addInterceptor(interceptor, inner, 0); diff --git a/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/core/db/ImtTenantLineInnerInterceptor.java b/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/core/db/ImtTenantLineInnerInterceptor.java new file mode 100644 index 0000000..4f67e02 --- /dev/null +++ b/imt-server/imt-framework/imt-spring-boot-starter-biz-tenant/src/main/java/com/inspur/framework/tenant/core/db/ImtTenantLineInnerInterceptor.java @@ -0,0 +1,67 @@ +package com.inspur.framework.tenant.core.db; + +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; +import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.Parenthesis; +import net.sf.jsqlparser.expression.RowConstructor; +import net.sf.jsqlparser.expression.StringValue; +import net.sf.jsqlparser.expression.operators.relational.EqualsTo; +import net.sf.jsqlparser.expression.operators.relational.ExpressionList; +import net.sf.jsqlparser.expression.operators.relational.LikeExpression; +import net.sf.jsqlparser.expression.operators.relational.ParenthesedExpressionList; +import net.sf.jsqlparser.schema.Column; +import net.sf.jsqlparser.schema.Table; +import net.sf.jsqlparser.statement.insert.Insert; +import net.sf.jsqlparser.statement.select.PlainSelect; +import net.sf.jsqlparser.statement.select.Select; +import net.sf.jsqlparser.statement.select.Values; +import net.sf.jsqlparser.statement.update.UpdateSet; +import org.springframework.beans.factory.annotation.Value; + +import java.util.List; + +/** + * @Author zhangjunwen + * @create 2024/10/8 + */ +public class ImtTenantLineInnerInterceptor extends TenantLineInnerInterceptor { + private TenantLineHandler tenantLineHandler; + + @Value("${imt.ignoreTenantId}") + private String ignoreTenantId; + + public ImtTenantLineInnerInterceptor() {} + + @Override + public TenantLineHandler getTenantLineHandler() { + return tenantLineHandler; + } + + @Override + public void setTenantLineHandler(TenantLineHandler tenantLineHandler) { + this.tenantLineHandler = tenantLineHandler; + } + + public ImtTenantLineInnerInterceptor(final TenantLineHandler tenantLineHandler) { + super.setTenantLineHandler(tenantLineHandler); + this.tenantLineHandler = tenantLineHandler; + } + + @Override + public Expression buildTableExpression(final Table table, final Expression where, final String whereSegment) { + if (this.tenantLineHandler.ignoreTable(table.getName())) { + return null; + } + Expression expression = this.tenantLineHandler.getTenantId(); + String tenantId = expression.toString(); + if(tenantId.equals(ignoreTenantId)){ + return null; + } + return new EqualsTo(this.getAliasColumn(table), this.tenantLineHandler.getTenantId()); + } + + +} diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java index 1388e34..16db6af 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/mqtt/MyMqttCallback.java @@ -227,10 +227,29 @@ public class MyMqttCallback implements MqttCallback { AlarmRulesApi alarmRulesApi = SpringUtils.getBean(AlarmRulesApi.class); Map fields = new HashMap<>(); Map tags = new HashMap<>(); + String dataType; + if(measurement.split("_").length >= 2) { + dataType = measurement.split("_")[1]; + } else { + dataType = ""; + } tags.put("equip_id",equipId); mapping.forEach((k,v)->{ if(msg.containsKey(k)){ - fields.put(v,msg.get(k)); + switch(dataType){ + case "current": + fields.put(v,(Double.parseDouble(msg.get(k).toString()) - 400) * 0.00125); + break; + case "hy": + fields.put(v,(Double.parseDouble(msg.get(k).toString()) - 400) * 1.25); + break; + case "temp": + fields.put(v,Double.parseDouble(msg.get(k).toString()) * 0.1); + break; + default: + fields.put(v,msg.get(k)); + } + } }); //报警过滤 diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/vo/TreeSelect.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/vo/TreeSelect.java index 0f47d43..d982438 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/vo/TreeSelect.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/gatewayinfo/vo/TreeSelect.java @@ -3,6 +3,7 @@ package com.inspur.module.system.controller.admin.gatewayinfo.vo; import com.fasterxml.jackson.annotation.JsonInclude; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardInfoDO; import com.inspur.module.system.dal.dataobject.gatewayinfo.GatewayCardParamsDO; +import com.inspur.module.system.dal.dataobject.tenant.TenantDO; import lombok.Data; import lombok.NoArgsConstructor; @@ -47,4 +48,10 @@ public class TreeSelect { this.label = gatewayCardParamsDO.getChannelAlias(); this.value = gatewayCardParamsDO.getParamMappingName(); } + + public TreeSelect(TenantDO tenantDO){ + this.id = tenantDO.getId().toString(); + this.label = tenantDO.getName(); + this.value = tenantDO.getId().toString(); + } } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java index a7927a6..1bf4158 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/NoticeController.java @@ -5,12 +5,15 @@ import com.inspur.framework.common.enums.UserTypeEnum; import com.inspur.framework.common.pojo.CommonResult; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.common.util.object.BeanUtils; +import com.inspur.framework.security.core.util.SecurityFrameworkUtils; import com.inspur.module.infra.api.websocket.WebSocketSenderApi; import com.inspur.module.system.controller.admin.notice.vo.NoticePageReqVO; import com.inspur.module.system.controller.admin.notice.vo.NoticeRespVO; import com.inspur.module.system.controller.admin.notice.vo.NoticeSaveReqVO; import com.inspur.module.system.dal.dataobject.notice.NoticeDO; +import com.inspur.module.system.dal.dataobject.notify.NotifyMessageDO; import com.inspur.module.system.service.notice.NoticeService; +import com.inspur.module.system.service.notify.NotifyMessageService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -35,6 +38,9 @@ public class NoticeController { @Resource private WebSocketSenderApi webSocketSenderApi; + @Resource + private NotifyMessageService notifyMessageService; + @PostMapping("/create") @Operation(summary = "创建通知公告") @PreAuthorize("@ss.hasPermission('system:notice:create')") @@ -89,4 +95,20 @@ public class NoticeController { return success(true); } + @PostMapping("/pushMessage") + @Operation(summary = "推送通知公告", description = "直接插入到相关租户的通知") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:notice:update')") + public CommonResult pushMessage(@RequestParam("id") Long id) { + NoticeDO notice = noticeService.getNotice(id); + Assert.notNull(notice, "公告不能为空"); + // 直接插入站内信表 + notice.setId(null); + NotifyMessageDO notifyMessage = BeanUtils.toBean(notice, NotifyMessageDO.class); + notifyMessage.setTemplateNickname(SecurityFrameworkUtils.getLoginUserNickname()); + notifyMessage.setTemplateType(notice.getType()); + notifyMessage.setUserId(SecurityFrameworkUtils.getLoginUserId()); + Long nums = notifyMessageService.createNotifyMessage(notifyMessage); + return success(nums > 0); + } } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeRespVO.java index 5318fc4..8cc8d95 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeRespVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeRespVO.java @@ -27,4 +27,6 @@ public class NoticeRespVO { @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") private LocalDateTime createTime; + @Schema(description = "租户编号") + private Integer tenantId; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeSaveReqVO.java index 9d4527c..917a243 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeSaveReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notice/vo/NoticeSaveReqVO.java @@ -29,4 +29,6 @@ public class NoticeSaveReqVO { @Schema(description = "状态,参见 CommonStatusEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Integer status; + @Schema(description = "租户编号") + private Integer tenantId; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java index 4e12b6b..4cc41c3 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java @@ -33,4 +33,6 @@ public class NotifyMessagePageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; + @Schema(description = "是否已读", example = "true") + private Boolean readStatus; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java index c24427c..c21e151 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java @@ -46,4 +46,15 @@ public class NotifyMessageRespVO { @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; + @Schema(description = "通知标题") + private String title; + + @Schema(description = "通知类型") + private Integer type; + + @Schema(description = "通知内容") + private String content; + + @Schema(description = "租户编号") + private Integer tenantId; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/tenant/TenantController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/tenant/TenantController.java index e0eb945..53f1e7f 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/tenant/TenantController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/tenant/TenantController.java @@ -6,6 +6,7 @@ import com.inspur.framework.common.pojo.PageParam; import com.inspur.framework.common.pojo.PageResult; import com.inspur.framework.common.util.object.BeanUtils; import com.inspur.framework.excel.core.util.ExcelUtils; +import com.inspur.module.system.controller.admin.gatewayinfo.vo.TreeSelect; import com.inspur.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO; import com.inspur.module.system.controller.admin.tenant.vo.tenant.TenantRespVO; import com.inspur.module.system.controller.admin.tenant.vo.tenant.TenantSaveReqVO; @@ -24,6 +25,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.List; +import java.util.stream.Collectors; import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static com.inspur.framework.common.pojo.CommonResult.success; @@ -95,6 +97,15 @@ public class TenantController { return success(BeanUtils.toBean(pageResult, TenantRespVO.class)); } + @GetMapping("/getList") + @Operation(summary = "获得租户列表") +// @PreAuthorize("@ss.hasPermission('system:tenant:query')") + public CommonResult> getTenantList(@Valid TenantPageReqVO pageVO) { + List tenantDOList = tenantService.getTenantList(); + List treeSelectList = tenantDOList.stream().map(TreeSelect::new).collect(Collectors.toList()); + return success(treeSelectList); + } + @GetMapping("/export-excel") @Operation(summary = "导出租户 Excel") @PreAuthorize("@ss.hasPermission('system:tenant:export')") diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java index 25d510a..7dde642 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/admin/user/vo/profile/UserProfileRespVO.java @@ -43,6 +43,9 @@ public class UserProfileRespVO { @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式") private LocalDateTime createTime; + @Schema(description = "租户编号") + private String tenantId; + /** * 所属角色 */ diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSaveReqVO.java index 217bec7..16df5f5 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSaveReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/vo/CustomerInfoSaveReqVO.java @@ -48,4 +48,5 @@ public class CustomerInfoSaveReqVO { @Size(message = "备注最大不允许超过500个字符", max = 500) private String remark; + private String tenantId; } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/baseData/CustomerInfoDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/baseData/CustomerInfoDO.java index 51db015..c44a460 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/baseData/CustomerInfoDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/baseData/CustomerInfoDO.java @@ -71,4 +71,8 @@ public class CustomerInfoDO extends BaseDO { */ private String remark; + /** + * 租户编号 + */ + private String tenantId; } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notice/NoticeDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notice/NoticeDO.java index 27ed208..e806361 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notice/NoticeDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notice/NoticeDO.java @@ -43,5 +43,8 @@ public class NoticeDO extends BaseDO { * 枚举 {@link CommonStatusEnum} */ private Integer status; - + /** + * 租户编号 + */ + private Integer tenantId; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notify/NotifyMessageDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notify/NotifyMessageDO.java index a1c5ad7..9082840 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notify/NotifyMessageDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/notify/NotifyMessageDO.java @@ -1,14 +1,15 @@ package com.inspur.module.system.dal.dataobject.notify; +import com.baomidou.mybatisplus.annotation.*; import com.inspur.framework.common.enums.UserTypeEnum; import com.inspur.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.time.LocalDateTime; import java.util.Map; @@ -30,7 +31,7 @@ public class NotifyMessageDO extends BaseDO { /** * 站内信编号,自增 */ - @TableId + @TableId(type = IdType.ASSIGN_ID) private Long id; /** * 用户编号 @@ -96,4 +97,23 @@ public class NotifyMessageDO extends BaseDO { */ private LocalDateTime readTime; + /** + * 通知标题 + */ + private String title; + + /** + * 通知类型 + */ + private Integer type; + + /** + * 通知内容 + */ + private String content; + + /** + * 租户编号 + */ + private Integer tenantId; } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java index 170e54b..fbf6b13 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/notify/NotifyMessageMapper.java @@ -20,6 +20,7 @@ public interface NotifyMessageMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(NotifyMessageDO::getUserId, reqVO.getUserId()) .eqIfPresent(NotifyMessageDO::getUserType, reqVO.getUserType()) + .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) .likeIfPresent(NotifyMessageDO::getTemplateCode, reqVO.getTemplateCode()) .eqIfPresent(NotifyMessageDO::getTemplateType, reqVO.getTemplateType()) .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) @@ -39,16 +40,16 @@ public interface NotifyMessageMapper extends BaseMapperX { return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()), new LambdaQueryWrapperX() .in(NotifyMessageDO::getId, ids) - .eq(NotifyMessageDO::getUserId, userId) - .eq(NotifyMessageDO::getUserType, userType) +// .eq(NotifyMessageDO::getUserId, userId) +// .eq(NotifyMessageDO::getUserType, userType) .eq(NotifyMessageDO::getReadStatus, false)); } default int updateListRead(Long userId, Integer userType) { return update(new NotifyMessageDO().setReadStatus(true).setReadTime(LocalDateTime.now()), new LambdaQueryWrapperX() - .eq(NotifyMessageDO::getUserId, userId) - .eq(NotifyMessageDO::getUserType, userType) +// .eq(NotifyMessageDO::getUserId, userId) +// .eq(NotifyMessageDO::getUserType, userType) .eq(NotifyMessageDO::getReadStatus, false)); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageService.java index 1fa623b..ebae23b 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageService.java @@ -30,6 +30,11 @@ public interface NotifyMessageService { Long createNotifyMessage(Long userId, Integer userType, NotifyTemplateDO template, String templateContent, Map templateParams); + /** + * 新增站内信 + */ + Long createNotifyMessage(NotifyMessageDO notifyMessageDO); + /** * 获得站内信分页 * diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageServiceImpl.java index 2998ef9..ae42f15 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/notify/NotifyMessageServiceImpl.java @@ -37,6 +37,16 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { return message.getId(); } + /** + * 新增站内信 + */ + @Override + public Long createNotifyMessage(NotifyMessageDO notifyMessageDO){ + notifyMessageDO.setReadStatus(false); + notifyMessageMapper.insert(notifyMessageDO); + return notifyMessageDO.getId(); + } + @Override public PageResult getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) { return notifyMessageMapper.selectPage(pageReqVO); diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantService.java index b58224a..129d4f8 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantService.java @@ -120,6 +120,11 @@ public interface TenantService { */ List getTenantIdList(); + /** + * 获得所有租户信息列表 + */ + List getTenantList(); + /** * 校验租户是否合法 * diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantServiceImpl.java index dcf3cb3..3057afb 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/tenant/TenantServiceImpl.java @@ -81,6 +81,10 @@ public class TenantServiceImpl implements TenantService { return CollectionUtils.convertList(tenants, TenantDO::getId); } + public List getTenantList(){ + return tenantMapper.selectList(); + } + @Override public void validTenant(Long id) { TenantDO tenant = getTenant(id); diff --git a/imt-server/imt-server/src/main/resources/application.yaml b/imt-server/imt-server/src/main/resources/application.yaml index c519437..81921d7 100644 --- a/imt-server/imt-server/src/main/resources/application.yaml +++ b/imt-server/imt-server/src/main/resources/application.yaml @@ -232,6 +232,7 @@ imt: base-package: ${imt.info.base-package} db-schemas: ${spring.datasource.dynamic.datasource.master.name} front-type: 10 # 前端模版的类型,参见 CodegenFrontTypeEnum 枚举类 + ignoreTenantId: 1 tenant: # 多租户相关配置项 enable: true ignore-urls: @@ -316,7 +317,7 @@ imt: data: mqtt: host: tcp://117.73.2.117:1883 - clientId: imt + clientId: imt_2 topics: printer/top/# #符号“#”是代表以 printer/top 开头的所有子主题 topic1: iipwg/jc #单个topic userName: jc diff --git a/imt-ui/src/api/system/gatewayinfo/card.js b/imt-ui/src/api/system/gatewayinfo/card.js index 5237202..d6da720 100644 --- a/imt-ui/src/api/system/gatewayinfo/card.js +++ b/imt-ui/src/api/system/gatewayinfo/card.js @@ -51,3 +51,14 @@ export function exportGatewayCardInfoExcel(params) { responseType: "blob", }); } + +/** + * 获取采集卡参数树 + */ +// 获得机床网关采集卡 +export function getGatewayCardTree(equipId) { + return request({ + url: "/imt/gateway-card-info/getCardTree?equipId=" + equipId, + method: "get", + }); +} diff --git a/imt-ui/src/views/system/alarm/alarmdata/index.vue b/imt-ui/src/views/system/alarm/alarmdata/index.vue index e9f16ba..ca95e3a 100644 --- a/imt-ui/src/views/system/alarm/alarmdata/index.vue +++ b/imt-ui/src/views/system/alarm/alarmdata/index.vue @@ -473,31 +473,39 @@ :before-close="beforeAlarmDataClose" center > -
- - - 查 询 - 重 置 +
+
+ +
+
+ + + 查 询 + 重 置 +
- +
@@ -516,8 +524,8 @@ import * as EquipAlarmDataApi from "@/api/system/alarm/equipalarmdata"; import AlarmDataForm from "./AlarmDataForm.vue"; import { getFieldList } from "@/api/data/query.js"; import { getAlarmRules } from "@/api/system/alarm/alarmrules"; -import AlarmSubmitMaintenanceOrderForm - from "@/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue"; +import AlarmSubmitMaintenanceOrderForm from "@/views/system/maintenance/maintenanceInfo/alarmSubmitMaintenanceOrderForm.vue"; +import { getGatewayCardTree } from "@/api/system/gatewayinfo/card"; var _ = require("lodash"); export default { name: "AlarmData", @@ -585,6 +593,7 @@ export default { dataQueryParams: { equipId: null, nameKey: null, + tableName: null, startTime: null, endTime: null, }, @@ -599,6 +608,7 @@ export default { selectedRow: {}, datetimeRange: [], showOrderSubmit: false, + cardOptions: [], }; }, created() { @@ -611,26 +621,35 @@ export default { this.alarmLevel = this.$route.query.alarmLevel; }, methods: { - getIsSubmitOrder(){ - EquipAlarmDataApi.isSubmitOrder(this.$route.query.equipAlarmId).then(res=>{ - this.showOrderSubmit = res.data - }) + cardChange(e) { + // console.log("选择:", e); + // console.log("绑定:", this.dataQueryParams.nameKey); + this.dataQueryParams.nameKey = e[1]; + this.dataQueryParams.tableName = e[0]; + this.handleAlarmDataQuery(null); + }, + datetimeChange() { + this.datetimeRange = this.formatTimeRange(this.datetimeRange); + }, + getIsSubmitOrder() { + EquipAlarmDataApi.isSubmitOrder(this.$route.query.equipAlarmId).then( + (res) => { + this.showOrderSubmit = res.data; + } + ); }, async handleAlarmDataQuery(row) { //需要row提供匹配数据名称和单位等信息 this.loading = true; //根据时间查询参数数据 - this.dataQueryParams.nameKey = row - ? row.nameKey - : this.selectedRow.nameKey; + // this.dataQueryParams.nameKey = row + // ? row.nameKey + // : this.selectedRow.nameKey; if (this.datetimeRange == null || this.datetimeRange.length == 0) { this.datetimeRange = this.getDefaultTimeRange(row.lastAlarmTime); - } else if (row == null) { - this.datetimeRange = this.formatTimeRange(this.datetimeRange); } this.dataQueryParams.startTime = this.datetimeRange[0]; this.dataQueryParams.endTime = this.datetimeRange[1]; - const data = await getFieldList(this.dataQueryParams); const info = await getAlarmRules(this.selectedRow.alarmRulesId); this.getEchartData(data.data, info.data); @@ -660,15 +679,29 @@ export default { this.detailLoading = false; }, /**报警趋势 */ - handleAlarmTrend(row) { + async handleAlarmTrend(row) { + // console.log("row:", row); if (_.endsWith(row.nameKey, "_diff")) { row.nameKey = row.nameKey.substr(0, row.nameKey.length - 5); } + this.dataQueryParams.equipId = row.equipId; this.selectedRow = row; this.alarmDataOpen = true; this.alarmDataTitle = row.nameKey + "参数报警趋势"; this.datetimeRange = this.getDefaultTimeRange(row.lastAlarmTime); //最新报警时间前一小时数据 - this.handleAlarmDataQuery(row); + const cardTree = await getGatewayCardTree(row.equipId); + this.cardOptions = cardTree.data; + this.cardOptions.forEach((e) => { + const list = e.children; + const matchKey = list.filter((c) => c.value === row.nameKey); + if (matchKey && matchKey.length > 0) { + this.dataQueryParams.tableName = e.value; + this.dataQueryParams.nameKey = row.nameKey; + // console.log("匹配的数据1:", matchKey); + // console.log("匹配的数据2:", e); + this.handleAlarmDataQuery(row); + } + }); }, getDefaultTimeRange(time) { const alarmTime = new Date(time); @@ -711,7 +744,7 @@ export default { * 维修工单 */ handelMaintanence() { - this.$refs.submitOrderForm.open(this.$route.query.equipAlarmId) + this.$refs.submitOrderForm.open(this.$route.query.equipAlarmId); }, /**echart表初始化 */ initchart(xData, yData, name, unit) { @@ -754,8 +787,9 @@ export default { color: "#4E5969", //设置文字颜色 }, formatter: (prams) => { - let name = parseFloat(_.get(prams, [0, "name"])).toFixed(2); - let value = parseFloat(_.get(prams, [0, "value"])).toFixed(4); + console.log("prams:", prams); + let name = _.get(prams, [0, "name"]); + let value = parseFloat(_.get(prams, [0, "value"])).toFixed(2); return ( "" + `(${name}` + diff --git a/imt-ui/src/views/system/baseData/customerInfo/CustomerInfoForm.vue b/imt-ui/src/views/system/baseData/customerInfo/CustomerInfoForm.vue index 3cff7c5..f8a32df 100644 --- a/imt-ui/src/views/system/baseData/customerInfo/CustomerInfoForm.vue +++ b/imt-ui/src/views/system/baseData/customerInfo/CustomerInfoForm.vue @@ -1,56 +1,125 @@ diff --git a/imt-ui/src/views/system/equip/componentInfo/ComponentInfoForm.vue b/imt-ui/src/views/system/equip/componentInfo/ComponentInfoForm.vue index 149b65e..23f1152 100644 --- a/imt-ui/src/views/system/equip/componentInfo/ComponentInfoForm.vue +++ b/imt-ui/src/views/system/equip/componentInfo/ComponentInfoForm.vue @@ -1,52 +1,107 @@ diff --git a/imt-ui/src/views/system/notice/index.vue b/imt-ui/src/views/system/notice/index.vue index 9e6bd29..6838096 100644 --- a/imt-ui/src/views/system/notice/index.vue +++ b/imt-ui/src/views/system/notice/index.vue @@ -1,84 +1,215 @@