| | |
| | | package org.jeecg.modules.andon.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.andon.entity.AndonResponseConfig; |
| | | import org.jeecg.modules.andon.mapper.AndonResponseConfigMapper; |
| | | import org.jeecg.modules.andon.service.IAndonOrderService; |
| | | import org.jeecg.modules.andon.entity.AndonOrder; |
| | | import org.jeecg.modules.andon.mapper.AndonOrderMapper; |
| | | import org.jeecg.modules.feishu.service.FeishuUserService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Service |
| | | public class AndonOrderServiceImpl extends ServiceImpl<AndonOrderMapper, AndonOrder> implements IAndonOrderService { |
| | | @Autowired |
| | | private FeishuUserService feishuService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | private AndonResponseConfigMapper andonResponseConfigMapper; |
| | | |
| | | @Override |
| | | public List<AndonOrder> getAndonOrdersExceptYWC() { |
| | | return baseMapper.getAndonOrdersExceptYWC(); |
| | | } |
| | | |
| | | @Override |
| | | public String getPrimaryResponder(AndonOrder andonOrder) { |
| | | // 1. 校验必要参数 |
| | | if (StringUtils.isBlank(andonOrder.getFactoryId()) || StringUtils.isBlank(andonOrder.getButtonId())) { |
| | | |
| | | return null; |
| | | } |
| | | |
| | | // 2. 查询响应人配置(假设存在响应人配置实体和Mapper) |
| | | // 构建查询条件:匹配产线ID、安灯类型ID,且配置为启用状态 |
| | | QueryWrapper<AndonResponseConfig> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("factory_id", andonOrder.getFactoryId()) |
| | | .eq("button_id", andonOrder.getButtonId()) |
| | | .eq("status", 1) // 1表示启用状态 |
| | | .last("limit 1"); // 只取一条有效配置 |
| | | |
| | | // 3. 执行查询 |
| | | AndonResponseConfig config = andonResponseConfigMapper.selectOne(queryWrapper); |
| | | if (config == null) { |
| | | return null; |
| | | } |
| | | return config.getFirsterResponder(); |
| | | } |
| | | |
| | | } |