This commit is contained in:
KongChengwen
2025-04-12 14:42:36 +08:00
parent 2683dc539a
commit f48367a7b1
2 changed files with 45 additions and 6 deletions

View File

@@ -0,0 +1,37 @@
package com.kkz.kpersonalre.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* @ClassName MyMetaObjectHandler
* @Description 自动填充功能
* @Author 孔成文
* @Date 2022/9/7 15:12
* @Version 1.0
*/
@Slf4j
@Component
public class MyBatisPlusMetaObjectHandler implements MetaObjectHandler {
/**
* 默认未逻辑删除
*/
private final boolean DEL_FLAG = false;
@Override
public void insertFill(MetaObject metaObject) {
//此项自动填充,但数据库内也会自动填充,双重保险
this.strictInsertFill(metaObject, "deleted", boolean.class, DEL_FLAG);
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
}
@Override
public void updateFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "updatedTime", LocalDateTime.class, LocalDateTime.now());
}
}

View File

@@ -121,11 +121,11 @@ public class AlarmServiceImpl implements AlarmService {
public R<LocalTime> getAlarm(String username) { public R<LocalTime> getAlarm(String username) {
//判断今天是不是工作日 //判断今天是不是工作日
DateWeekdayEntity dateWeekdayEntity = dateWeekdayMapper.selectOne(new LambdaQueryWrapper<DateWeekdayEntity>() // DateWeekdayEntity dateWeekdayEntity = dateWeekdayMapper.selectOne(new LambdaQueryWrapper<DateWeekdayEntity>()
.eq(DateWeekdayEntity::getDate, LocalDate.now())); // .eq(DateWeekdayEntity::getDate, LocalDate.now()));
if (BeanUtil.isEmpty(dateWeekdayEntity) || dateWeekdayEntity.getHolidayFlag()) { // if (BeanUtil.isEmpty(dateWeekdayEntity) || dateWeekdayEntity.getHolidayFlag()) {
return R.failed("今天放假"); // return R.failed("今天放假");
} // }
//找到人 //找到人
PersonConfigEntity personConfigEntity = personConfigMapper.selectOne(new LambdaQueryWrapper<PersonConfigEntity>() PersonConfigEntity personConfigEntity = personConfigMapper.selectOne(new LambdaQueryWrapper<PersonConfigEntity>()
.eq(PersonConfigEntity::getPerson, username)); .eq(PersonConfigEntity::getPerson, username));
@@ -193,7 +193,9 @@ public class AlarmServiceImpl implements AlarmService {
LambdaQueryWrapper<LocationUploadEntity> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LocationUploadEntity> query = new LambdaQueryWrapper<>();
query query
.eq(LocationUploadEntity::getLocationConfigId, locationId) .eq(LocationUploadEntity::getLocationConfigId, locationId)
.eq(LocationUploadEntity::getPersonConfigId, personId); .eq(LocationUploadEntity::getPersonConfigId, personId)
.ge(LocationUploadEntity::getCreateTime, LocalDate.now())
;
List<LocationUploadEntity> locationUploadEntities = locationUploadMapper.selectList(query); List<LocationUploadEntity> locationUploadEntities = locationUploadMapper.selectList(query);
if (locationUploadEntities.isEmpty()) { if (locationUploadEntities.isEmpty()) {
return false; return false;