Browse Source

#消息中心优化

zhongwei
yang_shj 5 months ago
parent
commit
18be56465e
  1. 4
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageConfigClient.java
  2. 55
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessagePushClient.java
  3. 32
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java
  4. 54
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessagePushClient.java
  5. 24
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageSmsClient.java
  6. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  7. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  8. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  9. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  10. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java
  11. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/scheduled/SafeToolTypePushUserTask.java

4
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageConfigClient.java

@ -5,10 +5,6 @@ import com.hnac.hzims.message.entity.config.MailConfigEntity;
import com.hnac.hzims.message.entity.config.PushConfigEntity;
import com.hnac.hzims.message.entity.config.SmsConfigEntity;
import com.hnac.hzims.message.entity.config.WsConfigEntity;
import com.hnac.hzims.message.entity.log.AppLogEntity;
import com.hnac.hzims.message.entity.log.MailLogEntity;
import com.hnac.hzims.message.entity.log.SmsLogEntity;
import com.hnac.hzims.message.entity.log.WsLogEntity;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

55
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessagePushClient.java

@ -1,55 +0,0 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.message.req.PushReq;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author xiashandong
* @created 2021/6/25 15:27
**/
@FeignClient(
value = MessageConstants.APP_NAME
)
public interface IMessagePushClient {
String API_PREFIX = "/feign/sms";
String SEND_MESSAGE_BY_USER_ID = API_PREFIX + "/send-message-by-user-id";
String SEND_MESSAGE_BY_TAG = API_PREFIX + "/send-message-by-tag";
String SEND_MESSAGE_ALL = API_PREFIX + "/send-message-all";
String SEND_MESSAGE = API_PREFIX + "/send-message";
/**
* 根据账户ID发送消息
*
* @param userIds 账户ID多个值用,分隔
* @param req
*/
@PostMapping(SEND_MESSAGE_BY_USER_ID)
void sendMessage(@RequestParam("userIds") String userIds, @RequestBody PushExtrasReq req, @RequestParam("tenantId") String tenantId
, @RequestParam("createDept") Long createDept,@RequestParam("createUser") Long createUser);
/**
* 根据标签发送消息
*
* @param tags 标签多个值用,分隔
* @param req
*/
@PostMapping(SEND_MESSAGE_BY_TAG)
void sendMessage(@RequestParam("tags") String tags, @RequestBody PushReq req);
/**
* 给所有账户发送消息
*
* @param req
*/
@PostMapping(SEND_MESSAGE_ALL)
void sendMessage(@RequestBody PushExtrasReq req);
}

32
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java

@ -1,32 +0,0 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.req.SmsReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author xiashandong
* @created 2021/6/25 15:27
**/
@FeignClient(
value = MessageConstants.APP_NAME
)
public interface IMessageSmsClient {
String API_PREFIX = "/feign/sms";
String SEND_MESSAGE = API_PREFIX + "/send-message";
/**
* 发送短信
*
* @param req
*/
@PostMapping(SEND_MESSAGE)
void sendMessage(@RequestBody SmsReq req);
}

54
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessagePushClient.java

@ -1,54 +0,0 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.message.req.PushReq;
import com.hnac.hzims.message.req.SmsReq;
import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.service.PushService;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.SpringUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author xiashandong
* @created 2021/6/25 15:44
**/
@AllArgsConstructor
@RestController
public class MessagePushClient implements IMessagePushClient {
private final PushService service;
@Override
@PostMapping(SEND_MESSAGE_BY_USER_ID)
public void sendMessage(@RequestParam("userIds") String userIds, @RequestBody PushExtrasReq req
, @RequestParam("tenantId") String tenantId, @RequestParam("createDept") Long createDept, @RequestParam("createUser") Long createUser) {
List<String> userIdList = Arrays.stream(userIds.split(",")).collect(Collectors.toSet()).stream().collect(Collectors.toList());
//service.sendByUserId(userIdList, req, tenantId, createDept, createUser);
}
@Override
@PostMapping(SEND_MESSAGE_BY_TAG)
public void sendMessage(@RequestParam("tags") String tags, @RequestBody PushReq req) {
List<String> tagList = Arrays.stream(tags.split(",")).collect(Collectors.toSet()).stream().collect(Collectors.toList());
//service.sendByTags(tagList, req);
}
@Override
@PostMapping(SEND_MESSAGE_ALL)
public void sendMessage(@RequestBody PushExtrasReq req) {
service.sendAll(req);
}
}

24
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageSmsClient.java

@ -1,24 +0,0 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.req.SmsReq;
import com.hnac.hzims.message.service.SmsService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author xiashandong
* @created 2021/6/25 15:29
**/
@AllArgsConstructor
@RestController
public class MessageSmsClient implements IMessageSmsClient {
private final SmsService service;
@Override
@PostMapping(SEND_MESSAGE)
public void sendMessage(@RequestBody SmsReq req) {
service.sendMessage(req);
}
}

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -10,11 +10,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
@ -48,7 +46,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
@ -92,7 +89,6 @@ public class OperAccessTaskServiceImpl extends ServiceImpl<OperAccessTaskMapper,
private final IOperAccessStatisticsService statisticsService;
private final IOperAccessContentService contentService;
private final OperAccessTaskMapper mapper;
private final IMessagePushClient messagePushClient;
private final OperPhenomenonMapper operPhenomenonMapper;
private final IUserClient userClient;
@ -646,22 +642,6 @@ public class OperAccessTaskServiceImpl extends ServiceImpl<OperAccessTaskMapper,
}
/**
* 巡检任务生成后待办消息提示
*
* @param req
*/
private void pushHandleMessage(OperAccessTaskDTO operAccessTaskDTO, PushExtrasReq req) {
req.setTitle(AccessConstants.MESSAGE_TITLE);
req.setType(AccessConstants.MESSAGE_ACCESS_TYPE);
req.setBusinessClassify(OperationalConstants.MessageClassifyEnum.MESSAGE_REMINDSY.getVal());
req.setPushAlert(AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送开始----------");
messagePushClient.sendMessage(operAccessTaskDTO.getHandler().toString(), req, operAccessTaskDTO.getTenantId(), operAccessTaskDTO.getCreateDept(), operAccessTaskDTO.getCreateUser());
log.info("消息推送人为:{},推送消息为:{}", operAccessTaskDTO.getHandler().toString(), AccessConstants.AccessProcessEnum.ACCESS_BACKLOG.getMsg());
log.info("--------消息推送成功----------");
}
/**
* 查询导出检修任务记录
* @param id
* @return

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java

@ -189,18 +189,6 @@ public class ImsDutyRecController extends BladeController {
}
/**
* 修改
*/
@GetMapping("/messageRemondingTest")
@ApiOperationSupport(order = 13)
@ApiOperation(value = "消息提醒", notes = "传入entity")
public R messageRemondingTest() {
imsDutyRecService.messageRemondingTest();
return R.success("消息提醒成功");
}
/**
* 交班
*/
@GetMapping("/judgeDelayedHand")

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -80,12 +80,6 @@ public interface IImsDutyRecService extends IService<ImsDutyRecEntity> {
void messageRemondingV2();
/**
* 消息提醒测试
*/
void messageRemondingTest();
/**
* 判断延时接班
* @param entity
* @param recEntity

37
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -12,7 +12,6 @@ import com.google.common.collect.Lists;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.OperationalConstants;
@ -99,8 +98,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
@Autowired
private IStationService stationService;
@Autowired
private IMessagePushClient messagePushClient;
@Autowired
private IMessageClient messageClient;
@Autowired
private IUserClient userClient;
@ -841,14 +838,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
}
}
@Override
public void messageRemondingTest() {
PushExtrasReq req = new PushExtrasReq();
User admin = userClient.userByAccount(AuthUtil.getTenantId(), "admin").getData();
ImsDutyClassEntity classEntity = imsDutyClassService.getById("1417744967255752705");
remondingStation(req, admin, "1380746947515691009", classEntity);//提醒站长
}
/**
* 修改值班状态
*
@ -1129,17 +1118,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
return DateUtil.format(date, PATTERN_DATETIME);
}
/**
* 消息提醒站长
*/
private void remondingStation(PushExtrasReq req, User admin, String userName, ImsDutyClassEntity
classEntity) {
req.setTitle("交接班");
req.setType(DutyRecProcessConstant.MESSAGE_CLASS_TYPE_DUTY_REC);
req.setBusinessClassify(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
req.setPushAlert(userName + " 负责人 值班日期为:(" + classEntity.getStartTime() + "-" + classEntity.getEndTime() + ") 目前已交班延迟,请尽快联系该负责人进行交班工作");
messagePushClient.sendMessage(admin.getId().toString(), req, admin.getTenantId(), admin.getCreateDept(), admin.getCreateUser());
}
/**
* 消息提醒站长
@ -1172,21 +1150,6 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
log.info(booleanR.toString());
}
/**
* 消息提醒交班人
*/
private void remondingHead(PushExtrasReq req, int type, Long managerId, String tenantId, Long createDept, Long createUser) {
req.setTitle("交接班");
req.setType(DutyRecProcessConstant.MESSAGE_CLASS_TYPE_DUTY_REC);
req.setBusinessClassify(MessageConstants.BusinessClassifyEnum.DUTY.getKey());
if (type == OperationalConstants.RecTypeEnum.HAND_REMIND.getVal()) {
req.setPushAlert("您距离本次值班结束时间只剩 15 分钟,请尽快进行交班工作");
} else if (type == OperationalConstants.RecTypeEnum.HAND_DELAY.getVal()) {
req.setPushAlert("您已交班延迟,请尽快进行交班工作");
}
messagePushClient.sendMessage(managerId.toString(), req, tenantId, createDept, createUser);
}
/**
* 消息提醒交班人

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/OperMaintenanceTaskController.java

@ -25,7 +25,6 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
@ -33,7 +32,6 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -41,9 +39,6 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@ -191,15 +186,6 @@ public class OperMaintenanceTaskController extends BladeController {
return R.success("推送成功!");
}
@GetMapping("/testPushMsg")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "测试消息推送")
public R testPushMsg(@RequestParam("date") String date) throws Exception {
//maintenanceTaskPushMsg.execute(date);
maintenanceTaskPushMsg.maintenancePushMsg("1380746947515691009", "200000", 200000000000101L, 1380746947515691009L);
return R.success("推送成功!");
}
@PostMapping("/completeTask")
@ApiOperationSupport(order = 80)
@ApiOperation(value = "完成日常维护工作流任务")

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/scheduled/SafeToolTypePushUserTask.java

@ -1,51 +1,29 @@
package com.hnac.hzims.safeproduct.scheduled;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.message.entity.config.PushConfigEntity;
import com.hnac.hzims.message.entity.config.SmsConfigEntity;
import com.hnac.hzims.message.fegin.IMessageConfigClient;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.fegin.IMessageSmsClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.message.req.SmsReq;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.safeproduct.dto.SafetyToolDTO;
import com.hnac.hzims.safeproduct.dto.SafetyToolTypeDTO;
import com.hnac.hzims.safeproduct.entity.SafetyToolEntity;
import com.hnac.hzims.safeproduct.entity.SafetyToolTypeEntity;
import com.hnac.hzims.safeproduct.service.ISafetyToolService;
import com.hnac.hzims.safeproduct.service.ISafetyToolTypeService;
import com.hnac.hzinfo.core.push.enums.PlatformType;
import com.hnac.hzinfo.core.push.enums.PushAudienceType;
import com.hnac.hzinfo.core.push.model.PushAudience;
import com.hnac.hzinfo.core.push.model.PushInfo;
import com.hnac.hzinfo.core.push.model.PushPlatform;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.resource.feign.IPushClient;
import org.springblade.resource.vo.PushInfoVO;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.stream.Collectors;
@ -57,7 +35,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class SafeToolTypePushUserTask {
private final IMessageSmsClient messageSmsClient;
private final ISafetyToolTypeService toolTypeService;
private final ISafetyToolService safetyToolService;
private final IMessageConfigClient messageConfigClient;

Loading…
Cancel
Save