|
|
|
@ -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<MessagePushRec
|
|
|
|
|
return this.page(Condition.getPage(query), this.getQueryWrapper(request)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @Author hx |
|
|
|
|
* @Description 根据ID发送短信 |
|
|
|
|
* @Date 2023/4/12 10:22 |
|
|
|
|
* @Param [id] 短信记录ID |
|
|
|
|
* @return java.lang.Boolean 推送结果 |
|
|
|
|
**/ |
|
|
|
|
@Override |
|
|
|
|
public Boolean send(Long id) { |
|
|
|
|
MessagePushRecordEntity record = this.getById(id); |
|
|
|
@ -62,6 +76,12 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
|
|
|
|
|
return this.update(luw); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** @Author hx |
|
|
|
|
* @Description 保存并推送消息 |
|
|
|
|
* @Date 2023/4/12 10:23 |
|
|
|
|
* @Param [request] 消息记录 |
|
|
|
|
* @return java.lang.Boolean 推送解雇 |
|
|
|
|
**/ |
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Boolean saveAndSend(MessagePushRecordEntity request) { |
|
|
|
@ -183,6 +203,20 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
|
|
|
|
|
return pushStatTypeVos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<UnreadMessageVO> getPersonalUnreadMessage() { |
|
|
|
|
QueryWrapper<MessagePushRecordEntity> query = Wrappers.query(); |
|
|
|
|
query.select("business_classify businessClassify,count(0) todoNum"); |
|
|
|
|
query.eq("account",AuthUtil.getUserId()); |
|
|
|
|
query.groupBy("business_classify"); |
|
|
|
|
List<Map<String, Object>> 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()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 状态 ===> 状态名称 |
|
|
|
|