|
@@ -1,11 +1,14 @@
|
|
package com.xy.service;
|
|
package com.xy.service;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.xy.dto.MsgSysMonitorNoticeDto;
|
|
import com.xy.dto.MsgSysMonitorNoticeDto;
|
|
import com.xy.dto.MsgUserMessageDto;
|
|
import com.xy.dto.MsgUserMessageDto;
|
|
|
|
+import com.xy.dto.UserInfoDto;
|
|
import com.xy.entity.MsgSysMonitorNotice;
|
|
import com.xy.entity.MsgSysMonitorNotice;
|
|
import com.xy.mapper.MsgSysMonitorNoticeMapper;
|
|
import com.xy.mapper.MsgSysMonitorNoticeMapper;
|
|
import com.xy.utils.Emptys;
|
|
import com.xy.utils.Emptys;
|
|
@@ -17,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
@@ -41,6 +45,7 @@ import static com.xy.utils.PlusBeans.toPageBean;
|
|
public class MsgSysMonitorNoticeServiceImpl extends ServiceImpl<MsgSysMonitorNoticeMapper, MsgSysMonitorNotice> implements MsgSysMonitorNoticeService {
|
|
public class MsgSysMonitorNoticeServiceImpl extends ServiceImpl<MsgSysMonitorNoticeMapper, MsgSysMonitorNotice> implements MsgSysMonitorNoticeService {
|
|
|
|
|
|
private MsgUserMessageServiceImpl msgUserMessageService;
|
|
private MsgUserMessageServiceImpl msgUserMessageService;
|
|
|
|
+ private UserInfoService userInfoService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@ApiOperation("对象查询")
|
|
@ApiOperation("对象查询")
|
|
@@ -72,11 +77,22 @@ public class MsgSysMonitorNoticeServiceImpl extends ServiceImpl<MsgSysMonitorNot
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@ApiOperation("添加")
|
|
@ApiOperation("添加")
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public R save(@RequestBody @Validated MsgSysMonitorNoticeDto.Save save) {
|
|
public R save(@RequestBody @Validated MsgSysMonitorNoticeDto.Save save) {
|
|
MsgSysMonitorNotice saveInfo = copy(MsgSysMonitorNotice.class, save);
|
|
MsgSysMonitorNotice saveInfo = copy(MsgSysMonitorNotice.class, save);
|
|
save(saveInfo);
|
|
save(saveInfo);
|
|
Long userId = save.getUserId();
|
|
Long userId = save.getUserId();
|
|
if (userId != null) {
|
|
if (userId != null) {
|
|
|
|
+ String sendTargets = saveInfo.getSendTargets();
|
|
|
|
+ if (StrUtil.isNotEmpty(sendTargets)) {
|
|
|
|
+ //更新发送目标名字
|
|
|
|
+ UserInfoDto.SelectListDto selectListDto = new UserInfoDto.SelectListDto();
|
|
|
|
+ selectListDto.setUserIds(CollUtil.newArrayList(userId));
|
|
|
|
+ List<UserInfoDto.Vo> userInfoList = R.feignCheckData(userInfoService.list(selectListDto));
|
|
|
|
+ if (CollUtil.isNotEmpty(userInfoList)) {
|
|
|
|
+ updateById(saveInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
String channelType = save.getChannelType();
|
|
String channelType = save.getChannelType();
|
|
|
|
|
|
MsgUserMessageDto.Save mum = new MsgUserMessageDto.Save();
|
|
MsgUserMessageDto.Save mum = new MsgUserMessageDto.Save();
|
|
@@ -91,6 +107,7 @@ public class MsgSysMonitorNoticeServiceImpl extends ServiceImpl<MsgSysMonitorNot
|
|
mum.setPopUp(BooleanUtil.isTrue(save.getPopUp()) ? Boolean.TRUE : Boolean.FALSE);
|
|
mum.setPopUp(BooleanUtil.isTrue(save.getPopUp()) ? Boolean.TRUE : Boolean.FALSE);
|
|
msgUserMessageService.save(mum);
|
|
msgUserMessageService.save(mum);
|
|
}
|
|
}
|
|
|
|
+
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|