| | |
| | | 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.common.api.vo.Result; |
| | | 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.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | return config.getFirsterResponder(); |
| | | } |
| | | |
| | | @Override |
| | | public Result<String> handleAndonOrder(AndonOrder andonOrder) { |
| | | |
| | | // 设置工单状态为处理中 |
| | | andonOrder.setOrderStatus("3"); |
| | | |
| | | // 获取响应者用户名 |
| | | String responderUsername = andonOrder.getResponder(); |
| | | |
| | | // 验证响应者用户名不为空 |
| | | if (StringUtils.isBlank(responderUsername)) { |
| | | return Result.error("响应者信息不能为空"); |
| | | } |
| | | |
| | | // 根据用户名查询用户信息 |
| | | SysUser sysUser = sysUserService.getOne( |
| | | new QueryWrapper<SysUser>().eq("username", responderUsername) |
| | | ); |
| | | |
| | | // 验证用户是否存在 |
| | | if (sysUser == null) { |
| | | return Result.error("找不到用户名为 " + responderUsername + " 的用户"); |
| | | } |
| | | // 设置响应者ID |
| | | andonOrder.setResponder(sysUser.getId()); |
| | | andonOrder.setProcessor(sysUser.getId()); |
| | | // 更新工单信息 |
| | | this.updateById(andonOrder); |
| | | |
| | | return Result.OK("处理成功"); |
| | | } |
| | | |
| | | } |