Compare commits

...

4 Commits

Author SHA1 Message Date
xiaofajia
559e20bc61 补充SQL字段 2024-12-04 16:51:36 +08:00
xiaofajia
a27dcd63dd Merge branch 'repair' of http://122.51.230.86:3000/dianliang/lanan-system into repair 2024-12-04 16:20:41 +08:00
xiaofajia
0f49280628 两个提醒走站内信 2024-12-04 10:59:14 +08:00
xiaofajia
fcb91e2f38 两个提醒走站内信 2024-12-04 10:58:51 +08:00
6 changed files with 26 additions and 145 deletions

View File

@ -19,8 +19,6 @@ 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;
@ -70,11 +68,6 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
@Lazy @Lazy
private RepairWorkerService workerService; private RepairWorkerService workerService;
@Resource
@Lazy
private WarnMessageByRepairService warnMessageByRepairService;
/** /**
* 保存配件库 * 保存配件库
* *
@ -246,12 +239,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 +257,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 +273,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 +289,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 +303,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)) {

View File

@ -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;
}

View File

@ -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> {
}

View File

@ -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> {
}

View File

@ -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 {
}

View File

@ -107,6 +107,8 @@
<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>
@ -160,7 +162,9 @@
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>