两个提醒走站内信
This commit is contained in:
parent
2db6e63542
commit
fcb91e2f38
@ -246,12 +246,15 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void timeOver() {
|
public void timeOver() {
|
||||||
|
// 取仓管、维修管理员
|
||||||
|
List<UserDTO> warehouse = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.WAREHOUSE.getCode());
|
||||||
|
List<UserDTO> admin = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADMIN.getCode());
|
||||||
// 取配置
|
// 取配置
|
||||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
|
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
|
||||||
|
|
||||||
// 取出第一个
|
// 取出第一个
|
||||||
if (CollUtil.isEmpty(dataList)) {
|
if (CollUtil.isEmpty(dataList)) {
|
||||||
noticeByFlag(true);
|
noticeByFlag(true, admin, warehouse);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DictDataRespDTO dictDataRespDTO = dataList.get(0);
|
DictDataRespDTO dictDataRespDTO = dataList.get(0);
|
||||||
@ -261,17 +264,11 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
|
|
||||||
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getUpdateTime, dateAgo));
|
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getUpdateTime, dateAgo));
|
||||||
if (CollUtil.isNotEmpty(repairWares)) {
|
if (CollUtil.isNotEmpty(repairWares)) {
|
||||||
// 构建对象 todo 表需要做适配
|
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
|
||||||
List<WarnMessageByRepair> warnMessages = repairWares.stream().map(item ->
|
String result = String.join(",", names);
|
||||||
WarnMessageByRepair
|
String message = "以下配件未使用天数超过设定的未使用天数提醒,请及时处理相关事项!" + result;
|
||||||
.builder()
|
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
|
||||||
.title("配件超时未使用")
|
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
|
||||||
.content("名为:" + item.getName() + "的配件未使用天数超过设定的未使用天数提醒,请及时处理相关事项!")
|
|
||||||
.warnTime(new Date())
|
|
||||||
.isRead("0")
|
|
||||||
.build()
|
|
||||||
).collect(Collectors.toList());
|
|
||||||
warnMessageByRepairService.saveBatch(warnMessages);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,12 +280,15 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void stockBelow(){
|
public void stockBelow(){
|
||||||
|
// 取仓管、维修管理员
|
||||||
|
List<UserDTO> warehouse = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.WAREHOUSE.getCode());
|
||||||
|
List<UserDTO> admin = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADMIN.getCode());
|
||||||
// 取配置
|
// 取配置
|
||||||
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
|
List<DictDataRespDTO> dataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_WARES_NOTICE);
|
||||||
|
|
||||||
// 取出第二个
|
// 取出第二个
|
||||||
if (CollUtil.isEmpty(dataList)) {
|
if (CollUtil.isEmpty(dataList)) {
|
||||||
noticeByFlag(false);
|
noticeByFlag(false, admin, warehouse);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DictDataRespDTO dictDataRespDTO = dataList.get(1);
|
DictDataRespDTO dictDataRespDTO = dataList.get(1);
|
||||||
@ -296,17 +296,11 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getStock, count));
|
List<RepairWares> repairWares = baseMapper.selectList(new LambdaQueryWrapper<RepairWares>().le(RepairWares::getStock, count));
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(repairWares)) {
|
if (CollUtil.isNotEmpty(repairWares)) {
|
||||||
// 构建对象 todo 表需要做适配
|
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
|
||||||
List<WarnMessageByRepair> warnMessages = repairWares.stream().map(item ->
|
String result = String.join(",", names);
|
||||||
WarnMessageByRepair
|
String message = "以下配件库存低于设定的库存不足提醒,请及时处理相关事项!\n" + result;
|
||||||
.builder()
|
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
|
||||||
.title("配件库存不足")
|
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
|
||||||
.content("名为:" + item.getName() + "的配件库存低于设定的库存不足提醒,请及时处理相关事项!")
|
|
||||||
.warnTime(new Date())
|
|
||||||
.isRead("0")
|
|
||||||
.build()
|
|
||||||
).collect(Collectors.toList());
|
|
||||||
warnMessageByRepairService.saveBatch(warnMessages);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,12 +310,10 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 15:57 2024/11/30
|
* @date 15:57 2024/11/30
|
||||||
* @param flag 什么通知
|
* @param flag 什么通知
|
||||||
|
* @param admin 维修管理员们
|
||||||
|
* @param warehouse 仓库管理员们
|
||||||
**/
|
**/
|
||||||
private void noticeByFlag(Boolean flag){
|
private void noticeByFlag(Boolean flag, List<UserDTO> admin, List<UserDTO> warehouse){
|
||||||
// 取仓管、维修管理员
|
|
||||||
List<UserDTO> warehouse = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.WAREHOUSE.getCode());
|
|
||||||
List<UserDTO> admin = roleApi.selectUserListByRoleCode(TenantContextHolder.getRequiredTenantId(), RepairRoleEnum.ADMIN.getCode());
|
|
||||||
|
|
||||||
String message = flag ? "检查配件入库是否超时出现故障,请联系开发人员解决" : "检查配件库存是否充足出现故障,请联系开发人员解决";
|
String message = flag ? "检查配件入库是否超时出现故障,请联系开发人员解决" : "检查配件库存是否充足出现故障,请联系开发人员解决";
|
||||||
// 如果为空就通知相关人员出现了问题
|
// 如果为空就通知相关人员出现了问题
|
||||||
if (CollUtil.isNotEmpty(warehouse)) {
|
if (CollUtil.isNotEmpty(warehouse)) {
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.warnMessage.entity;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.annotation.Excel;
|
|
||||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* warnMsg对象 warn_message
|
|
||||||
*
|
|
||||||
* @author 小李
|
|
||||||
* @date 15:11 2024/11/30
|
|
||||||
**/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
public class WarnMessageByRepair extends TenantBaseDO {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
//equ设备提醒file文件提醒
|
|
||||||
private String type;
|
|
||||||
//对应的数据主键
|
|
||||||
private Long objectId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标题
|
|
||||||
*/
|
|
||||||
@Excel(name = "标题")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
@Excel(name = "内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提醒时间
|
|
||||||
*/
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "提醒时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date warnTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺主键
|
|
||||||
*/
|
|
||||||
@Excel(name = "店铺主键")
|
|
||||||
private Long partnerId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已读
|
|
||||||
*/
|
|
||||||
@Excel(name = "是否已读")
|
|
||||||
private String isRead;
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.warnMessage.mapper;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.warnMessage.entity.WarnMessageByRepair;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* warnMsgMapper接口
|
|
||||||
*
|
|
||||||
* @author 小李
|
|
||||||
* @date 15:14 2024/11/30
|
|
||||||
**/
|
|
||||||
@Mapper
|
|
||||||
public interface WarnMessageByRepairMapper extends BaseMapper<WarnMessageByRepair> {
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.warnMessage.service;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.warnMessage.entity.WarnMessageByRepair;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* warnMsgService接口
|
|
||||||
*
|
|
||||||
* @author 小李
|
|
||||||
* @date 15:12 2024/11/30
|
|
||||||
**/
|
|
||||||
public interface WarnMessageByRepairService extends IService<WarnMessageByRepair> {
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.warnMessage.service.impl;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.warnMessage.entity.WarnMessageByRepair;
|
|
||||||
import cn.iocoder.yudao.module.warnMessage.mapper.WarnMessageByRepairMapper;
|
|
||||||
import cn.iocoder.yudao.module.warnMessage.service.WarnMessageByRepairService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* warnMsgService业务层处理
|
|
||||||
*
|
|
||||||
* @author 小李
|
|
||||||
* @date 15:15 2024/11/30
|
|
||||||
**/
|
|
||||||
@Service
|
|
||||||
public class WarnMessageByRepairServiceImpl extends ServiceImpl<WarnMessageByRepairMapper, WarnMessageByRepair> implements WarnMessageByRepairService {
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user