Merge branch 'main' of http://124.243.245.42:3000/zkr/shz-backend into main
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cms.domain.OutdoorFair;
|
||||
|
||||
/**
|
||||
* 户外招聘会Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface IOutdoorFairService extends IService<OutdoorFair>
|
||||
{
|
||||
/**
|
||||
* 查询户外招聘会列表
|
||||
*
|
||||
* @param outdoorFair 户外招聘会
|
||||
* @return 户外招聘会集合
|
||||
*/
|
||||
List<OutdoorFair> selectOutdoorFairList(OutdoorFair outdoorFair);
|
||||
|
||||
/**
|
||||
* 新增户外招聘会相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertOutdoorFairDictData(String dictType, String dictLabel, String createBy);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cms.domain.VenueInfo;
|
||||
|
||||
/**
|
||||
* 场地信息Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
public interface IVenueInfoService extends IService<VenueInfo>
|
||||
{
|
||||
/**
|
||||
* 查询场地信息列表
|
||||
*
|
||||
* @param venueInfo 场地信息
|
||||
* @return 场地信息集合
|
||||
*/
|
||||
List<VenueInfo> selectVenueInfoList(VenueInfo venueInfo);
|
||||
|
||||
/**
|
||||
* 新增场地信息相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertVenueInfoDictData(String dictType, String dictLabel, String createBy);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
@PostConstruct
|
||||
// @PostConstruct
|
||||
public void init()
|
||||
{
|
||||
boolean isLockAcquired = false;
|
||||
|
||||
@@ -17,12 +17,14 @@ import com.ruoyi.common.core.domain.entity.Company;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -43,8 +45,9 @@ public class InterviewInvitationServiceImpl implements InterviewInvitationServic
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@PostConstruct
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void initTable() {
|
||||
log.info("开始检查并初始化 interview_invitation 表...");
|
||||
try (Connection conn = dataSource.getConnection();
|
||||
Statement stmt = conn.createStatement()) {
|
||||
// Check if id column has auto-increment (BIGSERIAL or sequence default)
|
||||
@@ -80,6 +83,7 @@ public class InterviewInvitationServiceImpl implements InterviewInvitationServic
|
||||
+ "meeting_password varchar(100) NULL,"
|
||||
+ "interview_location varchar(500) NULL,"
|
||||
+ "contact_phone varchar(50) NULL,"
|
||||
+ "interviewer_name varchar(100) NULL,"
|
||||
+ "company_name varchar(200) NULL,"
|
||||
+ "job_name varchar(200) NULL,"
|
||||
+ "status varchar(20) DEFAULT 'pending' NULL,"
|
||||
@@ -96,9 +100,16 @@ public class InterviewInvitationServiceImpl implements InterviewInvitationServic
|
||||
log.info("interview_invitation 表创建成功(序列自增)!");
|
||||
} else {
|
||||
log.info("interview_invitation 表结构正常,检查新增列...");
|
||||
// 为已有数据库添加新列(幂等操作)
|
||||
try { stmt.execute("ALTER TABLE interview_invitation ADD COLUMN IF NOT EXISTS company_name varchar(200) NULL"); } catch (Exception ignored) {}
|
||||
try { stmt.execute("ALTER TABLE interview_invitation ADD COLUMN IF NOT EXISTS job_name varchar(200) NULL"); } catch (Exception ignored) {}
|
||||
// 为已有数据库添加新列(幂等操作,使用 DO 块兼容不支持 IF NOT EXISTS 的数据库版本)
|
||||
try {
|
||||
stmt.execute("DO $$ BEGIN ALTER TABLE interview_invitation ADD COLUMN company_name varchar(200) NULL; EXCEPTION WHEN duplicate_column THEN END; $$;");
|
||||
} catch (Exception e) { log.warn("添加 company_name 列失败: {}", e.getMessage()); }
|
||||
try {
|
||||
stmt.execute("DO $$ BEGIN ALTER TABLE interview_invitation ADD COLUMN job_name varchar(200) NULL; EXCEPTION WHEN duplicate_column THEN END; $$;");
|
||||
} catch (Exception e) { log.warn("添加 job_name 列失败: {}", e.getMessage()); }
|
||||
try {
|
||||
stmt.execute("DO $$ BEGIN ALTER TABLE interview_invitation ADD COLUMN interviewer_name varchar(100) NULL; EXCEPTION WHEN duplicate_column THEN END; $$;");
|
||||
} catch (Exception e) { log.warn("添加 interviewer_name 列失败: {}", e.getMessage()); }
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("初始化表失败: {}", e.getMessage());
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.OutdoorFair;
|
||||
import com.ruoyi.cms.mapper.OutdoorFairMapper;
|
||||
import com.ruoyi.cms.service.IOutdoorFairService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 户外招聘会Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Service
|
||||
public class OutdoorFairServiceImpl extends ServiceImpl<OutdoorFairMapper, OutdoorFair> implements IOutdoorFairService
|
||||
{
|
||||
private static final String OUTDOOR_FAIR_TYPE_DICT = "outdoor_fair_type";
|
||||
|
||||
private static final String OUTDOOR_FAIR_REGION_DICT = "outdoor_fair_region";
|
||||
|
||||
/**
|
||||
* 查询户外招聘会列表
|
||||
*
|
||||
* @param outdoorFair 户外招聘会
|
||||
* @return 户外招聘会集合
|
||||
*/
|
||||
@Override
|
||||
public List<OutdoorFair> selectOutdoorFairList(OutdoorFair outdoorFair)
|
||||
{
|
||||
LambdaQueryWrapper<OutdoorFair> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(outdoorFair.getTitle()), OutdoorFair::getTitle, outdoorFair.getTitle());
|
||||
queryWrapper.like(StringUtils.isNotBlank(outdoorFair.getHostUnit()), OutdoorFair::getHostUnit, outdoorFair.getHostUnit());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outdoorFair.getFairType()), OutdoorFair::getFairType, outdoorFair.getFairType());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(outdoorFair.getRegion()), OutdoorFair::getRegion, outdoorFair.getRegion());
|
||||
queryWrapper.eq(outdoorFair.getVenueId() != null, OutdoorFair::getVenueId, outdoorFair.getVenueId());
|
||||
queryWrapper.orderByDesc(OutdoorFair::getHoldTime);
|
||||
queryWrapper.orderByDesc(OutdoorFair::getCreateTime);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增户外招聘会相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
@Override
|
||||
public int insertOutdoorFairDictData(String dictType, String dictLabel, String createBy)
|
||||
{
|
||||
if (!OUTDOOR_FAIR_TYPE_DICT.equals(dictType) && !OUTDOOR_FAIR_REGION_DICT.equals(dictType)) {
|
||||
throw new ServiceException("只允许维护户外招聘会类型和举办区域字典");
|
||||
}
|
||||
String trimmedLabel = StringUtils.trim(dictLabel);
|
||||
if (StringUtils.isBlank(trimmedLabel)) {
|
||||
throw new ServiceException("字典名称不能为空");
|
||||
}
|
||||
if (trimmedLabel.length() > 100) {
|
||||
throw new ServiceException("字典名称长度不能超过100个字符");
|
||||
}
|
||||
if (baseMapper.countDictDataByTypeAndValue(dictType, trimmedLabel) > 0) {
|
||||
return 1;
|
||||
}
|
||||
Long dictSort = baseMapper.selectNextDictSort(dictType);
|
||||
int rows = baseMapper.insertDictData(dictSort, trimmedLabel, trimmedLabel, dictType, createBy);
|
||||
if (rows > 0) {
|
||||
DictUtils.removeDictCache(dictType);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.VenueInfo;
|
||||
import com.ruoyi.cms.mapper.VenueInfoMapper;
|
||||
import com.ruoyi.cms.service.IVenueInfoService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 场地信息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-06-25
|
||||
*/
|
||||
@Service
|
||||
public class VenueInfoServiceImpl extends ServiceImpl<VenueInfoMapper, VenueInfo> implements IVenueInfoService
|
||||
{
|
||||
private static final String VENUE_TYPE_DICT = "venue_info_type";
|
||||
|
||||
/**
|
||||
* 查询场地信息列表
|
||||
*
|
||||
* @param venueInfo 场地信息
|
||||
* @return 场地信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<VenueInfo> selectVenueInfoList(VenueInfo venueInfo)
|
||||
{
|
||||
LambdaQueryWrapper<VenueInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(venueInfo.getVenueType()), VenueInfo::getVenueType, venueInfo.getVenueType());
|
||||
queryWrapper.like(StringUtils.isNotBlank(venueInfo.getVenueName()), VenueInfo::getVenueName, venueInfo.getVenueName());
|
||||
queryWrapper.like(StringUtils.isNotBlank(venueInfo.getVenueAddress()), VenueInfo::getVenueAddress, venueInfo.getVenueAddress());
|
||||
queryWrapper.orderByDesc(VenueInfo::getCreateTime);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增场地信息相关字典项
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictLabel 字典标签
|
||||
* @param createBy 创建人
|
||||
* @return 影响行数
|
||||
*/
|
||||
@Override
|
||||
public int insertVenueInfoDictData(String dictType, String dictLabel, String createBy)
|
||||
{
|
||||
if (!VENUE_TYPE_DICT.equals(dictType)) {
|
||||
throw new ServiceException("只允许维护场地类型字典");
|
||||
}
|
||||
String trimmedLabel = StringUtils.trim(dictLabel);
|
||||
if (StringUtils.isBlank(trimmedLabel)) {
|
||||
throw new ServiceException("字典名称不能为空");
|
||||
}
|
||||
if (trimmedLabel.length() > 100) {
|
||||
throw new ServiceException("字典名称长度不能超过100个字符");
|
||||
}
|
||||
if (baseMapper.countDictDataByTypeAndValue(dictType, trimmedLabel) > 0) {
|
||||
return 1;
|
||||
}
|
||||
Long dictSort = baseMapper.selectNextDictSort(dictType);
|
||||
int rows = baseMapper.insertDictData(dictSort, trimmedLabel, trimmedLabel, dictType, createBy);
|
||||
if (rows > 0) {
|
||||
DictUtils.removeDictCache(dictType);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user