From 22a167a0765e5b9a917d39952132e60536f15af7 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 12 Apr 2023 10:34:41 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=9C=AA=E8=AF=BB=E6=B6=88=E6=81=AF=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/message/vo/UnreadMessageVO.java | 34 ++++++++++++++++++++++ .../controller/MessagePushRecordController.java | 10 +++++++ .../message/service/IMessagePushRecordService.java | 8 ++++- .../service/impl/MessagePushRecordServiceImpl.java | 34 ++++++++++++++++++++++ .../station/controller/StationController.java | 2 +- .../station/service/IStationService.java | 4 +-- .../station/service/impl/StationServiceImpl.java | 33 ++++++++++----------- 7 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java new file mode 100644 index 0000000..0833bf0 --- /dev/null +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/UnreadMessageVO.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.message.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @ClassName UnreadMessageVO + * @description: 个人消息中心-待办消息统计返回对象 + * @author: hx + * @create: 2023-04-11 19:04 + * @Version 4.0 + **/ +@Data +@ApiModel("个人消息中心-待办消息统计返回对象") +@EqualsAndHashCode +public class UnreadMessageVO implements Serializable { + + @ApiModelProperty("业务分类") + private String businessClassify; + + @ApiModelProperty("业务分类名称") + private String businessName; + + @ApiModelProperty("待办消息数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Long todoNum; + +} diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java index 6733667..530359e 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java @@ -7,6 +7,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.service.IMessagePushRecordService; +import com.hnac.hzims.message.vo.UnreadMessageVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -77,4 +78,13 @@ public class MessagePushRecordController extends BladeController { .eq(MessagePushRecordEntity::getId, id); return R.status(messagePushRecordService.update(eq)); } + + @GetMapping("/getPersonalUnreadMessage") + @ApiOperation("获取当前登录人待办消息") + @ApiOperationSupport(order = 7) + public R> getPersonalUnreadMessage() { + List personalUnreadMessage = messagePushRecordService.getPersonalUnreadMessage(); + return R.data(personalUnreadMessage); + } + } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java index b978230..60d9ecc 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java @@ -2,6 +2,7 @@ package com.hnac.hzims.message.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.message.entity.MessagePushRecordEntity; +import com.hnac.hzims.message.vo.UnreadMessageVO; import com.hnac.hzims.message.vo.msgpushrecord.*; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -69,6 +70,11 @@ public interface IMessagePushRecordService extends BaseService pushStat(MessagePushRecordEntityVo vo); - + /** @Author hx + * @Description 获取当前登录人待办消息 + * @Date 2023/4/11 19:27 + * @return + **/ + List getPersonalUnreadMessage(); } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java index c7d1e44..0e5c4f1 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java @@ -1,9 +1,14 @@ package com.hnac.hzims.message.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.Wrappers; +import com.hnac.hzims.common.utils.CacheUtil; import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.config.MessageFactory; import com.hnac.hzims.message.entity.MessagePushRecordEntity; @@ -11,6 +16,7 @@ import com.hnac.hzims.message.enums.PushStatEnum; import com.hnac.hzims.message.mapper.MessagePushRecordMapper; import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessageService; +import com.hnac.hzims.message.vo.UnreadMessageVO; import com.hnac.hzims.message.vo.msgpushrecord.*; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -18,7 +24,9 @@ import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.system.cache.DictCache; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; @@ -46,6 +54,12 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl getPersonalUnreadMessage() { + QueryWrapper query = Wrappers.query(); + query.select("business_classify businessClassify,count(0) todoNum"); + query.eq("account",AuthUtil.getUserId()); + query.groupBy("business_classify"); + List> list = this.listMaps(query); + return list.stream().map(map -> { + UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); + unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify",unreadMessageVO.getBusinessClassify())); + return unreadMessageVO; + }).collect(Collectors.toList()); + } + /** * 状态 ===> 状态名称 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java index 9dfb795..41bd2bc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java @@ -143,7 +143,7 @@ public class StationController extends BladeController { */ @PostMapping("/remove") @ApiOperationSupport(order = 40) - @ApiOperation(value = "逻辑删除", notes = "传入ids") + @ApiOperation(value = "逻辑删除", notes = "传入id") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(stationService.removeStation(ids)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java index 83a30ef..d4dc67e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java @@ -38,10 +38,10 @@ public interface IStationService extends BaseService { /** * 删除站点 - * @param ids 站点ID,按逗号分隔 + * @param id 站点ID,按逗号分隔 * @return */ - boolean removeStation(String ids); + boolean removeStation(String id); IPage list(StationEntity req, Query query); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index d97b91e..3d425d6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -126,24 +126,23 @@ public class StationServiceImpl extends BaseServiceImpl { - StationEntity stationEntity = this.getById(id); - // 删除数据平台项目 - Result existProject = projectClient.getProjectByPid(stationEntity.getCode()); - if(existProject.isSuccess() && ObjectUtil.isNotEmpty(existProject.getData())) { - Result dataDelete = projectClient.delete(stationEntity.getCode()); - Assert.isTrue(dataDelete.isSuccess(),() -> { - logger.error("hzims-operational:station:removeStation",stationEntity.getCode()+"删除失败,报错信息为:"+dataDelete.getMsg()); - throw new ServiceException("数据平台删除项目失败!"); - }); - } - // 删除智能诊断站点 - questionClient.deleteStationInfo(stationEntity.getCode()); - }); + public boolean removeStation(String id) { + StationEntity stationEntity = this.getById(id); + boolean saveFlag = this.removeById(Long.valueOf(id)); + if(saveFlag) { + // 删除数据平台项目 + Result existProject = projectClient.getProjectByPid(stationEntity.getCode()); + if(existProject.isSuccess() && ObjectUtil.isNotEmpty(existProject.getData())) { + Result dataDelete = projectClient.delete(stationEntity.getCode()); + Assert.isTrue(dataDelete.isSuccess(),() -> { + logger.error("hzims-operational:station:removeStation",stationEntity.getCode()+"删除失败,报错信息为:"+dataDelete.getMsg()); + throw new ServiceException("数据平台删除项目失败!"); + }); + } + // 删除智能诊断站点 + questionClient.deleteStationInfo(stationEntity.getCode()); } - return true; + return saveFlag; } @Override