Compare commits
No commits in common. "559e20bc616293d83b6576f0b2026f1399f5441a" and "070534b2c236985276747d2190b13f899c23c8fa" have entirely different histories.
559e20bc61
...
070534b2c2
@ -19,6 +19,8 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||||
|
import cn.iocoder.yudao.module.warnMessage.entity.WarnMessageByRepair;
|
||||||
|
import cn.iocoder.yudao.module.warnMessage.service.WarnMessageByRepairService;
|
||||||
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.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -68,6 +70,11 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
|||||||
@Lazy
|
@Lazy
|
||||||
private RepairWorkerService workerService;
|
private RepairWorkerService workerService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private WarnMessageByRepairService warnMessageByRepairService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存配件库
|
* 保存配件库
|
||||||
*
|
*
|
||||||
@ -239,15 +246,12 @@ 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, admin, warehouse);
|
noticeByFlag(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DictDataRespDTO dictDataRespDTO = dataList.get(0);
|
DictDataRespDTO dictDataRespDTO = dataList.get(0);
|
||||||
@ -257,11 +261,17 @@ 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)) {
|
||||||
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
|
// 构建对象 todo 表需要做适配
|
||||||
String result = String.join(",", names);
|
List<WarnMessageByRepair> warnMessages = repairWares.stream().map(item ->
|
||||||
String message = "以下配件未使用天数超过设定的未使用天数提醒,请及时处理相关事项!" + result;
|
WarnMessageByRepair
|
||||||
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
|
.builder()
|
||||||
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
|
.title("配件超时未使用")
|
||||||
|
.content("名为:" + item.getName() + "的配件未使用天数超过设定的未使用天数提醒,请及时处理相关事项!")
|
||||||
|
.warnTime(new Date())
|
||||||
|
.isRead("0")
|
||||||
|
.build()
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
warnMessageByRepairService.saveBatch(warnMessages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,15 +283,12 @@ 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, admin, warehouse);
|
noticeByFlag(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DictDataRespDTO dictDataRespDTO = dataList.get(1);
|
DictDataRespDTO dictDataRespDTO = dataList.get(1);
|
||||||
@ -289,11 +296,17 @@ 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)) {
|
||||||
List<String> names = repairWares.stream().map(RepairWares::getName).collect(Collectors.toList());
|
// 构建对象 todo 表需要做适配
|
||||||
String result = String.join(",", names);
|
List<WarnMessageByRepair> warnMessages = repairWares.stream().map(item ->
|
||||||
String message = "以下配件库存低于设定的库存不足提醒,请及时处理相关事项!\n" + result;
|
WarnMessageByRepair
|
||||||
warehouse.forEach(item -> workerService.sentMessage(item.getId(), message));
|
.builder()
|
||||||
admin.forEach(item -> workerService.sentMessage(item.getId(), message));
|
.title("配件库存不足")
|
||||||
|
.content("名为:" + item.getName() + "的配件库存低于设定的库存不足提醒,请及时处理相关事项!")
|
||||||
|
.warnTime(new Date())
|
||||||
|
.isRead("0")
|
||||||
|
.build()
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
warnMessageByRepairService.saveBatch(warnMessages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,10 +316,12 @@ 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, List<UserDTO> admin, List<UserDTO> warehouse){
|
private void noticeByFlag(Boolean flag){
|
||||||
|
// 取仓管、维修管理员
|
||||||
|
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)) {
|
||||||
|
|||||||
@ -0,0 +1,62 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
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> {
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
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> {
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
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 {
|
||||||
|
}
|
||||||
@ -107,8 +107,6 @@
|
|||||||
<result property="confirmFaultMoney" column="confirm_fault_money" />
|
<result property="confirmFaultMoney" column="confirm_fault_money" />
|
||||||
<result property="billingRemark" column="billing_remark" />
|
<result property="billingRemark" column="billing_remark" />
|
||||||
<result property="canOperate" column="can_operate" />
|
<result property="canOperate" column="can_operate" />
|
||||||
<result property="handleName" column="handle_name" />
|
|
||||||
<result property="handleMobile" column="handle_mobile" />
|
|
||||||
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
|
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
|
||||||
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
|
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@ -162,9 +160,7 @@
|
|||||||
rescue_money,
|
rescue_money,
|
||||||
three_pack_money,
|
three_pack_money,
|
||||||
confirm_fault_money,
|
confirm_fault_money,
|
||||||
billing_remark,
|
billing_remark
|
||||||
handle_name,
|
|
||||||
handle_mobile
|
|
||||||
from dl_repair_tickets drt
|
from dl_repair_tickets drt
|
||||||
where drt.deleted = '0'
|
where drt.deleted = '0'
|
||||||
</sql>
|
</sql>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user