|
|
|
|
@ -2,13 +2,18 @@ package cn.iocoder.yudao.module.base.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
|
import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket;
|
|
|
|
|
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
|
|
|
|
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
|
|
|
|
|
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
|
|
|
|
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
|
|
|
|
|
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
|
|
|
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
|
|
|
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
|
|
|
|
@ -16,14 +21,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.common.BaseConstants.TICKET_EMPLOY;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 维修工人 Service 实现类
|
|
|
|
|
*
|
|
|
|
|
@ -39,6 +48,12 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
|
|
|
|
@Resource
|
|
|
|
|
@Lazy
|
|
|
|
|
private DlRepairTitemService dlRepairTitemService;
|
|
|
|
|
@Resource
|
|
|
|
|
private NotifyMessageSendApi sendApi;
|
|
|
|
|
@Autowired
|
|
|
|
|
private NotifyMessageSocket notifyMessageSocket;
|
|
|
|
|
@Resource
|
|
|
|
|
private AdminUserApi userApi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -104,9 +119,9 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
|
|
|
|
/**
|
|
|
|
|
* 通过工单ID查到工单ID中所选择的员工信息
|
|
|
|
|
*
|
|
|
|
|
* @param ticketId 工单ID
|
|
|
|
|
* @author 小李
|
|
|
|
|
* @date 15:53 2024/10/14
|
|
|
|
|
* @param ticketId 工单ID
|
|
|
|
|
**/
|
|
|
|
|
@Override
|
|
|
|
|
public List<RepairWorker> listByTicketId(String ticketId) {
|
|
|
|
|
@ -122,6 +137,34 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 向指定用户发送消息
|
|
|
|
|
*
|
|
|
|
|
* @param userId 用户id
|
|
|
|
|
* @param text 消息通知内容
|
|
|
|
|
* @author PQZ
|
|
|
|
|
* @date 16:27 2024/10/18
|
|
|
|
|
**/
|
|
|
|
|
@Override
|
|
|
|
|
public void sentMessage(Long userId, String text) {
|
|
|
|
|
try {
|
|
|
|
|
//获取当前登录用户
|
|
|
|
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
|
|
|
|
// 准备发送参数
|
|
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
|
// 发送模版内容
|
|
|
|
|
templateParams.put("text", text);
|
|
|
|
|
// 发送站内信
|
|
|
|
|
sendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
|
|
.setUserId(userId)
|
|
|
|
|
.setTemplateCode(TICKET_EMPLOY).setTemplateParams(templateParams));
|
|
|
|
|
//发送语音提醒
|
|
|
|
|
notifyMessageSocket.sendMessage(text, loginUser.getTenantId().toString(), userId.toString());
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过班组长的id查该班组的员工
|
|
|
|
|
*
|
|
|
|
|
|