Browse Source

fix: 解决车辆模块消息推送失败的问题

zhongwei
liwen 10 months ago
parent
commit
3223c22962
  1. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java

22
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/jobs/CarJob.java

@ -14,8 +14,11 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -46,6 +49,9 @@ public class CarJob {
@Autowired @Autowired
ISysClient sysClient; ISysClient sysClient;
@Autowired
IUserClient userClient;
/** /**
* 车辆台账自动变更 * 车辆台账自动变更
*/ */
@ -98,10 +104,12 @@ public class CarJob {
log.error("系统无该用户信息,推送车保过期消息失败"); log.error("系统无该用户信息,推送车保过期消息失败");
return; return;
} }
// 查询用户
R<User> userRes = userClient.userInfoById(carEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
String deptId = AuthUtil.getDeptId(); if (StringUtils.isNotEmpty(user.getDeptId())) {
if (StringUtils.isNotEmpty(deptId)) { Long id = Long.valueOf(user.getDeptId());
Long id = Long.valueOf(deptId);
businessMessageDTO.setDeptId(id); businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("车保到期"); businessMessageDTO.setBusinessKey("车保到期");
@ -125,10 +133,12 @@ public class CarJob {
log.error("系统无该用户信息,推送维保过期消息失败"); log.error("系统无该用户信息,推送维保过期消息失败");
return; return;
} }
// 查询用户
R<User> userRes = userClient.userInfoById(carEntity.getManagerId());
User user = userRes.getData();
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO();
String deptId = AuthUtil.getDeptId(); if (StringUtils.isNotEmpty(user.getDeptId())) {
if (StringUtils.isNotEmpty(deptId)) { Long id = Long.valueOf(user.getDeptId());
Long id = Long.valueOf(deptId);
businessMessageDTO.setDeptId(id); businessMessageDTO.setDeptId(id);
businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData()); businessMessageDTO.setDeptName(sysClient.getDeptName(id).getData());
businessMessageDTO.setBusinessKey("维保到期"); businessMessageDTO.setBusinessKey("维保到期");

Loading…
Cancel
Save