diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java new file mode 100644 index 0000000..7850b7b --- /dev/null +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.message.vo.msgpushrecord; + +import lombok.Data; + +import java.util.List; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/29 14:18 + */ +@Data +public class PushStatResponseVo { + + /** + * 推送人名称 + */ + private String pusherName; + + /** + * 业务分类 + */ + private String businessClassify; + /** + * 业务分类名称 + */ + private String businessClassifyName; + /** + * 统计数量 + */ + private Integer count; +} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java new file mode 100644 index 0000000..b40af0d --- /dev/null +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.message.vo.msgpushrecord; + +import lombok.Data; + +import javax.sound.sampled.Port; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/29 13:58 + */ +@Data +public class UserPushStatResponseVo { + + /** + * 业务分类 + */ + private String businessClassify; + + /** + * 业务分类名称 + */ + private String businessClassifyName; + + /** + * 封装map + */ + private Map params; +} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java new file mode 100644 index 0000000..1536709 --- /dev/null +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.message.vo.msgpushrecord; + +import lombok.Data; + +import java.util.List; +import java.util.Set; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/6/29 13:46 + */ +@Data +public class UserPushStatTypeResponseVo { + + /** + * 封装人员信息 + */ + private List userNames; + + + /** + * 封装业务分类对象 + */ + private List userPushStatResponseVos; + +} diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java index 8ac126f..2ed9570 100644 --- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java +++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java @@ -22,4 +22,8 @@ public class UserPushStatTypeVo { * 推送业务分类数组 */ private List pushStatList; + + + + } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java index 1c43025..154660e 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java @@ -56,10 +56,22 @@ public class MessageStatisticsController { /** * 人员发送统计 */ + @GetMapping("/userPushStatWithMessgae") + public R userPushStatWithMessgae(MessagePushRecordEntityVo vo) { + log.info("人员发送统计"); + List messagePushRecordVos = messagePushRecordService.userPushStat(vo); + log.info("人员发送统计 返回的数据: {}",messagePushRecordVos); + return R.data(messagePushRecordVos); + } + + + /** + * 新人员发送统计 + */ @GetMapping("/userPushStat") public R userPushStat(MessagePushRecordEntityVo vo) { log.info("人员发送统计"); - List messagePushRecordVos = messagePushRecordService.userPushStat(vo); + UserPushStatTypeResponseVo messagePushRecordVos = messagePushRecordService.newUserPushStat(vo); log.info("人员发送统计 返回的数据: {}",messagePushRecordVos); return R.data(messagePushRecordVos); } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java index c317ec1..4d76dc3 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java @@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import java.util.List; +import java.util.Set; public interface MessagePushRecordMapper extends UserDataScopeBaseMapper { @@ -43,4 +44,11 @@ public interface MessagePushRecordMapper extends UserDataScopeBaseMapper selectByStatus(); + + /** + * 新人员发送统计 + * @param vo + * @return + */ + List selectUserPushStat(@Param("vo") MessagePushRecordEntityVo vo); } diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml index 0eb5aa4..a44dbe5 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml @@ -14,6 +14,7 @@ + @@ -50,6 +52,7 @@ and type = #{vo.type} + and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null) group by businessClassify @@ -74,6 +77,7 @@ and type = #{vo.type} + and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null) group by businessClassify, pusherName @@ -107,6 +111,7 @@ and type = #{vo.type} + and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null) group by businessClassify,status @@ -116,4 +121,33 @@ from hzims_message_push_record group by STATUS + + + + + + + \ No newline at end of file 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 b15f874..56a2974 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 @@ -90,4 +90,12 @@ public interface IMessagePushRecordService extends BaseService records); Boolean sendWsMsgByUsers(List request); + + + /** + * 新人员发送统计 + * @param vo + * @return + */ + UserPushStatTypeResponseVo newUserPushStat(MessagePushRecordEntityVo vo); } 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 aeffe5d..5b80f93 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 @@ -23,6 +23,7 @@ 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 io.minio.messages.Item; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; @@ -233,11 +234,55 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl results = new ArrayList<>(); + List pushStat = baseMapper.selectUserPushStat(vo); + List list = pushStat.stream().map(item -> item.getPusherName()).distinct().collect(Collectors.toList()); + pushStatList.setUserNames(list); + //封装业务分类对象 + Map> collect = pushStat.stream().collect(Collectors.groupingBy(PushStatResponseVo::getBusinessClassify)); + // + for (Map.Entry> entry : collect.entrySet()) { + List arrayList = Lists.newArrayList(list); + UserPushStatResponseVo userPushStatTypeResponseVo = new UserPushStatResponseVo(); + //存储key + userPushStatTypeResponseVo.setBusinessClassify(entry.getKey()); + userPushStatTypeResponseVo.setBusinessClassifyName(this.getBusinessClassifyByName(entry.getKey())); + TreeMap treeMap = new TreeMap<>(); + //存储业务分类 + List pushStatResponseVos = entry.getValue(); + for (PushStatResponseVo pushStatResponseVo : pushStatResponseVos) { + if (arrayList.contains(pushStatResponseVo.getPusherName())){ + arrayList.remove(pushStatResponseVo.getPusherName()); + } + treeMap.put(pushStatResponseVo.getPusherName(),pushStatResponseVo.getCount()); + } + //如果不存在设为0 + for (String name : arrayList) { + treeMap.put(name,0); + } + userPushStatTypeResponseVo.setParams(treeMap); + results.add(userPushStatTypeResponseVo); + } + pushStatList.setUserPushStatResponseVos(results); + + return pushStatList; + } + + /** * 推送成功失败统计 * @@ -321,11 +366,11 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl records) { + public Boolean sendAppMsgByUsers(BusinessMessageDTO request, List records) { PushMessageServiceImpl service = SpringUtil.getBean(PushMessageServiceImpl.class); try { boolean sendFlag = service.sendByUsers(request.getSubject(), request.getContent(), Arrays.asList(request.getUserIds().split(",")), request.getTenantId()); - if(sendFlag) { + if (sendFlag) { return this.update(Wrappers.lambdaUpdate() .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) @@ -333,8 +378,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl { boolean sendFlag = service.send(record); - if(sendFlag) { + if (sendFlag) { this.update(Wrappers.lambdaUpdate() .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)