卡片发送MQ

This commit is contained in:
jjLv 2025-09-29 16:08:55 +08:00
parent b214fb353a
commit 40220f8704
1 changed files with 18 additions and 1 deletions

View File

@ -12,10 +12,15 @@ import com.bonus.canteen.core.account.mapper.AccCardHisMapper;
import com.bonus.canteen.core.account.mapper.AccCardMapper;
import com.bonus.canteen.core.account.mapper.AccInfoMapper;
import com.bonus.canteen.core.account.service.IAccCardService;
import com.bonus.canteen.core.common.utils.MqUtil;
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.houqin.mq.constant.LeMqConstant;
import com.bonus.common.security.utils.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,7 +40,7 @@ public class AccCardServiceImpl implements IAccCardService {
private AccInfoMapper accInfoMapper;
@Autowired
private AccCardHisMapper accCardHisMapper;
private static final Logger log = LoggerFactory.getLogger(AccCardServiceImpl.class);
/**
* 查询人员卡片资料
*
@ -85,6 +90,12 @@ public class AccCardServiceImpl implements IAccCardService {
}
int count = accCardMapper.insertAccCard(accountCard);
saveAccCardChangeRecord(accountCard);
try {
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(Math.toIntExact(accountInfo.getUserId()), "update");
MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
} catch (Exception e) {
log.error("发送MQ消息失败", e);
}
return count;
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -153,6 +164,12 @@ public class AccCardServiceImpl implements IAccCardService {
accountCard.setCardStatus(CardStatusEnum.REFUND.getKey());
saveAccCardChangeRecord(accountCard);
}
try {
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePersonPhoto(Math.toIntExact(accountInfo.getUserId()), "update");
MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
} catch (Exception e) {
log.error("发送MQ消息失败", e);
}
return count;
} catch (Exception e) {
throw new ServiceException(e.getMessage());