This commit is contained in:
Lx 2025-08-07 09:41:51 +08:00
parent f0a5d5ad47
commit a88b06107a
15 changed files with 140 additions and 5 deletions

View File

@ -68,7 +68,6 @@ public interface IInspectionFileService extends IService<InspectionFile> {
/**
* 分页查询 InspectionFile 列表
*
* @param page 分页对象
* @param inspectionFile 查询条件
* @return 分页结果
*/

View File

@ -209,4 +209,13 @@ public class DriveSchoolCoachClockController {
return success(coachClockService.getClockCarInfoByUserId(userId, carNo));
}
@GetMapping("/errorPage")
@Operation(summary = "获得教练异常打卡记录分页")
public CommonResult<IPage<?>> queryErrorClockListPage(DriveSchoolCoachClockVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DriveSchoolCoachClockVO> page = new Page<>(pageNo, pageSize);
return success(coachClockService.queryErrorClockListPage(pageReqVO, page));
}
}

View File

@ -253,6 +253,14 @@ public class TrainController {
return success(trainService.getTrainStudentList(coachClockId));
}
/**
* 根据教练打卡id获取对应异常学员列表信息
*/
@GetMapping("getTrainErrorStudentList")
public CommonResult<List<Train>> getTrainErrorStudentList(@RequestParam(value = "coachClockId") String coachClockId){
return success(trainService.getTrainErrorStudentList(coachClockId));
}
/**
* 获取学员导出数据列表
*/

View File

@ -63,5 +63,8 @@ public interface DriveSchoolCoachClockMapper extends BaseMapper<DriveSchoolCoach
List<String> getClockCarNoByUserId(@Param("userId") Long userId);
DriveSchoolCoachClock getClockCarInfoByUserId(@Param("userId") Long userId, @Param("carNo") String carNo);
IPage<DriveSchoolCoachClockVO> queryErrorClockListPage(@Param("entity") DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page);
}

View File

@ -99,4 +99,12 @@ public interface IDriveSchoolCoachClockService extends IService<DriveSchoolCoach
List<String> getClockCarNoByUserId(Long userId);
DriveSchoolCoachClock getClockCarInfoByUserId(Long userId, String carNo);
/**
* 获得教练异常打卡记录分页
* @param pageReqVO
* @param page
* @return
*/
IPage<DriveSchoolCoachClockVO> queryErrorClockListPage(DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page);
}

View File

@ -98,6 +98,7 @@ public interface TrainService extends IService<Train> {
* 根据教练打卡id获取对应学员列表信息
*/
List<Train> getTrainStudentList(String coachClockId);
List<Train> getTrainErrorStudentList(String coachClockId);
/**
* 获取学员导出数据列表

View File

@ -466,5 +466,36 @@ public class DriveSchoolCoachClockServiceImpl extends ServiceImpl<DriveSchoolCoa
return driveSchoolCoachClockMapper.getClockCarInfoByUserId(userId, carNo);
}
/**
* 获得教练异常打卡记录分页
*
* @param pageReqVO
* @param page
* @return
*/
@Override
public IPage<DriveSchoolCoachClockVO> queryErrorClockListPage(DriveSchoolCoachClockVO pageReqVO, Page<DriveSchoolCoachClockVO> page) {
String startTime = "";
String endTime = "";
if ("more".equals(pageReqVO.getTimeType())) {
if (org.apache.commons.lang3.StringUtils.isNotEmpty(pageReqVO.getStartTimeStr())) {
startTime = pageReqVO.getStartTimeStr();
}
if (org.apache.commons.lang3.StringUtils.isNotEmpty(pageReqVO.getEndTimeStr())) {
endTime = pageReqVO.getEndTimeStr();
}
} else if ("month".equals(pageReqVO.getTimeType())) {
//当月
startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()), "yyyy-MM-dd");
endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()), "yyyy-MM-dd");
} else if ("day".equals(pageReqVO.getTimeType())) {
//当天
startTime = DateUtil.formatDate(DateUtil.date());
endTime = DateUtil.formatDate(DateUtil.date());
}
pageReqVO.setStartTimeStr(startTime);
pageReqVO.setEndTimeStr(endTime);
return driveSchoolCoachClockMapper.queryErrorClockListPage(pageReqVO, page);
}
}

View File

@ -205,6 +205,22 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
}
/**
* 根据教练打卡id获取对应学员列表信息
*/
@Override
public List<Train> getTrainErrorStudentList(String coachClockId) {
return lambdaQuery().eq(Train::getCoachClockId,coachClockId)
.eq(Train::getDeleted,0)
.isNull(Train::getEndTime)
.isNotNull(Train::getUserId)
.isNotNull(Train::getCoachId)
.isNotNull(Train::getSubject)
.orderByDesc(Train::getCreateTime)
.list();
}
/**
* 获取学员导出数据列表

View File

@ -367,4 +367,35 @@
AND subject = #{entity.subject}
</if>
</select>-->
<select id="queryErrorClockListPage" resultType="cn.iocoder.yudao.module.train.vo.DriveSchoolCoachClockVO">
SELECT
dscc.*
FROM
drive_school_coach_clock dscc
WHERE
dscc.end_time IS NULL
AND dscc.train_day &lt; CURDATE()
AND dscc.deleted = 0
<if test="entity.userId!= null and entity.userId!= ''">
and dscc.user_id = #{entity.userId}
</if>
<if test="entity.carNo!= null and entity.carNo!= ''">
and dscc.car_no like concat('%', #{entity.carNo},'%')
</if>
<if test="entity.subject!= null and entity.subject!= ''">
and dscc.subject = #{entity.subject}
</if>
<if test="entity.id!= null and entity.id!= ''">
and dscc.id = #{entity.id}
</if>
<if test="entity.startTimeStr != null and entity.startTimeStr != ''">
AND dscc.train_day &gt;= #{entity.startTimeStr}
</if>
<if test="entity.endTimeStr != null and entity.endTimeStr != ''">
AND dscc.train_day &lt;= #{entity.endTimeStr}
</if>
ORDER BY dscc.train_day DESC
</select>
</mapper>

View File

@ -151,7 +151,7 @@ public class SysLoginController {
@TenantIgnore
public CommonResult loginApp(@RequestBody LoginBody loginBody) throws Exception {
String userName = loginBody.getUsername();
AdminUserDO user = userService.getUserByUsername(userName);
AdminUserDO user = userService.getUserByUsernameRescue(userName);
if (ObjectUtil.isEmpty(user)) {
return error(CommonErrorCodeConstants.LOGIN_ACCOUNT_NOT_EXIST);
}

View File

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.bpm.framework.web.core;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.FlowableUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.filter.OncePerRequestFilter;
import javax.servlet.FilterChain;
@ -17,6 +19,8 @@ import java.io.IOException;
*/
public class FlowableWebFilter extends OncePerRequestFilter {
private static final Logger log = LoggerFactory.getLogger(FlowableWebFilter.class);
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
@ -24,14 +28,24 @@ public class FlowableWebFilter extends OncePerRequestFilter {
// 设置工作流的用户
Long userId = SecurityFrameworkUtils.getLoginUserId();
if (userId != null) {
FlowableUtils.setAuthenticatedUserId(userId);
try {
FlowableUtils.setAuthenticatedUserId(userId);
} catch (Exception e) {
// 忽略设置用户 ID 时的异常避免影响主流程
log.warn("设置 Flowable 认证用户 ID 失败", e);
}
}
// 过滤
chain.doFilter(request, response);
} finally {
// 清理
FlowableUtils.clearAuthenticatedUserId();
try {
FlowableUtils.clearAuthenticatedUserId();
} catch (Exception e) {
// 忽略清理时的异常
log.warn("清理 Flowable 认证用户 ID 失败", e);
}
}
}
}
}

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthLoginReqVO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
import cn.iocoder.yudao.module.system.controller.app.user.UserInfoVO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -29,6 +30,13 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
return selectOne(AdminUserDO::getUsername, username);
}
default AdminUserDO selectByUsernameRescue(String username) {
QueryWrapper<AdminUserDO> wrapper = new QueryWrapper<>();
wrapper.eq("username", username)
.ne("user_type", "02");
return selectOne(wrapper);
}
default AdminUserDO selectByUsername(String username, Long tenantId,String userType) {
return selectOne(new LambdaQueryWrapperX<AdminUserDO>().eq(AdminUserDO::getUsername, username).eq(ObjectUtil.isNotEmpty(tenantId),TenantBaseDO::getTenantId, tenantId)
.eq(ObjectUtil.isNotEmpty(userType), AdminUserDO::getUserType, userType).last("limit 1"));

View File

@ -145,6 +145,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
// 创建 Token 令牌记录登录日志
return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME);
}
@Override
public AuthLoginRespVO loginApp(AuthLoginReqVO reqVO,Long tenantId) {
// 校验验证码

View File

@ -128,6 +128,7 @@ public interface AdminUserService extends IService<AdminUserDO> {
* @return 用户对象信息
*/
AdminUserDO getUserByUsername(String username);
AdminUserDO getUserByUsernameRescue(String username);
/**
* 通过用户名查询用户

View File

@ -293,6 +293,11 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
public AdminUserDO getUserByUsername(String username) {
return userMapper.selectByUsername(username);
}
@Override
public AdminUserDO getUserByUsernameRescue(String username) {
return userMapper.selectByUsernameRescue(username);
}
@Override
public AdminUserDO getUserByUsername(String username,Long tenantId) {
return userMapper.selectByUsername(username,tenantId,null);