Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 2 years ago
parent
commit
963c16aea2
  1. 28
      hzims-service/message/pom.xml
  2. 24
      hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageStrategy.java
  3. 13
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  4. 12
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MprNoAurhScopeMapper.java
  5. 4
      hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
  6. 5
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

28
hzims-service/message/pom.xml

@ -21,37 +21,11 @@
<artifactId>blade-core-boot</artifactId> <artifactId>blade-core-boot</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId> <artifactId>lettuce-core</artifactId>
<groupId>io.lettuce</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId> <artifactId>blade-core-cloud</artifactId>

24
hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageStrategy.java

@ -0,0 +1,24 @@
package com.hnac.hzims.message.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/**
* @ClassName MessageStrategy
* @description:
* @author: hx
* @create: 2023-04-14 10:27
* @Version 4.0
**/
@Data
@Component
@ConfigurationProperties("hzims.push-strategy")
public class MessageStrategy {
private Integer concentrateDuration;
private String concentrateUnit;
}

13
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -7,8 +7,10 @@ import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.dto.PushDto; import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.SmsPushDto; import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.service.IMessageService; import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.service.IMessageTemplateService;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl; import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -16,9 +18,7 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
@ -31,6 +31,7 @@ import javax.validation.Valid;
public class MessageClient extends BladeController implements IMessageClient{ public class MessageClient extends BladeController implements IMessageClient{
private final IMessagePushRecordService recordService; private final IMessagePushRecordService recordService;
private final IMessageTemplateService messageTemplateService;
@Override @Override
@PostMapping(SEND_SMS_MESSAGE) @PostMapping(SEND_SMS_MESSAGE)
@ -53,4 +54,10 @@ public class MessageClient extends BladeController implements IMessageClient{
return R.success("推送成功!"); return R.success("推送成功!");
} }
@GetMapping(GET_TEMPLATE_BY_ID)
@Override
public R<MessageTemplateEntity> getMsgTemplateById(@RequestParam Long id) {
return R.data(messageTemplateService.getById(id));
}
} }

12
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MprNoAurhScopeMapper.java

@ -0,0 +1,12 @@
package com.hnac.hzims.message.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
/**
* @author hx
* @description 消息记录-无数据权限mapper
*/
public interface MprNoAurhScopeMapper extends BaseMapper<MessagePushRecordEntity> {
}

4
hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.config.MessageFactory; import com.hnac.hzims.message.config.MessageFactory;
import com.hnac.hzims.message.config.MessageStrategy;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity; import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
@ -45,6 +46,7 @@ import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_SMS_MESSAGE_
public class MessagePushSchedule { public class MessagePushSchedule {
private final IMessageTemplateService templateService; private final IMessageTemplateService templateService;
private final IMessagePushRecordService recordService; private final IMessagePushRecordService recordService;
private final MessageStrategy messageStrategy;
@XxlJob(PUSH_MESSAGE_BY_NOTICE) @XxlJob(PUSH_MESSAGE_BY_NOTICE)
public ReturnT pushSmsMessageByNotice(String params) { public ReturnT pushSmsMessageByNotice(String params) {
@ -52,7 +54,7 @@ public class MessagePushSchedule {
List<MessageTemplateEntity> templateList = templateService.list(); List<MessageTemplateEntity> templateList = templateService.list();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
templateList.forEach(template -> { templateList.forEach(template -> {
LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), template.getConcentratedDuration(), template.getConcentratedTimeUnit()); LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), messageStrategy.getConcentrateDuration(), messageStrategy.getConcentrateUnit());
endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit()); endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit());
LambdaQueryWrapper<MessagePushRecordEntity> lqw = Wrappers.<MessagePushRecordEntity>lambdaQuery() LambdaQueryWrapper<MessagePushRecordEntity> lqw = Wrappers.<MessagePushRecordEntity>lambdaQuery()
.eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH) .eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH)

5
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -16,6 +16,7 @@ import com.hnac.hzims.message.config.MessageFactory;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.enums.PushStatEnum; import com.hnac.hzims.message.enums.PushStatEnum;
import com.hnac.hzims.message.mapper.MessagePushRecordMapper; import com.hnac.hzims.message.mapper.MessagePushRecordMapper;
import com.hnac.hzims.message.mapper.MprNoAurhScopeMapper;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.service.IMessageService; import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.vo.UnreadMessageVO; import com.hnac.hzims.message.vo.UnreadMessageVO;
@ -50,6 +51,8 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRecordMapper, MessagePushRecordEntity> implements IMessagePushRecordService { public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRecordMapper, MessagePushRecordEntity> implements IMessagePushRecordService {
private final MprNoAurhScopeMapper noAurhScopeMapper;
@Override @Override
public List<MessagePushRecordEntity> list(MessagePushRecordEntity request) { public List<MessagePushRecordEntity> list(MessagePushRecordEntity request) {
return this.list(this.getQueryWrapper(request)); return this.list(this.getQueryWrapper(request));
@ -291,7 +294,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
query.select("business_classify businessClassify,count(0) todoNum"); query.select("business_classify businessClassify,count(0) todoNum");
query.eq("account", AuthUtil.getUserId()); query.eq("account", AuthUtil.getUserId());
query.groupBy("business_classify"); query.groupBy("business_classify");
List<Map<String, Object>> list = this.listMaps(query); List<Map<String, Object>> list = noAurhScopeMapper.selectMaps(query);
return list.stream().map(map -> { return list.stream().map(map -> {
UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class);
unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify())); unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify()));

Loading…
Cancel
Save