Merge branch 'main' of ssh://124.243.245.42:2222/zkr/shz-backend
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -236,7 +236,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
|
|||||||
@@ -100,22 +100,42 @@ public class InterviewInvitationServiceImpl implements InterviewInvitationServic
|
|||||||
log.info("interview_invitation 表创建成功(序列自增)!");
|
log.info("interview_invitation 表创建成功(序列自增)!");
|
||||||
} else {
|
} else {
|
||||||
log.info("interview_invitation 表结构正常,检查新增列...");
|
log.info("interview_invitation 表结构正常,检查新增列...");
|
||||||
// 为已有数据库添加新列(幂等操作,使用 DO 块兼容不支持 IF NOT EXISTS 的数据库版本)
|
// 为已有数据库添加新列:先查 information_schema 判断列是否存在,存在则跳过
|
||||||
try {
|
// 不使用 IF NOT EXISTS / DO $$ 语法,因为 Druid 1.2.23 StatFilter 无法解析这些 PG 扩展语法
|
||||||
stmt.execute("DO $$ BEGIN ALTER TABLE interview_invitation ADD COLUMN company_name varchar(200) NULL; EXCEPTION WHEN duplicate_column THEN END; $$;");
|
addColumnIfNotExists(stmt, "interview_invitation", "company_name", "varchar(200) NULL");
|
||||||
} catch (Exception e) { log.warn("添加 company_name 列失败: {}", e.getMessage()); }
|
addColumnIfNotExists(stmt, "interview_invitation", "job_name", "varchar(200) NULL");
|
||||||
try {
|
addColumnIfNotExists(stmt, "interview_invitation", "interviewer_name", "varchar(100) NULL");
|
||||||
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) {
|
} catch (Exception e) {
|
||||||
log.error("初始化表失败: {}", e.getMessage());
|
log.error("初始化表失败: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 幂等添加列:先查 information_schema 判断列是否存在,不存在才执行 ALTER TABLE ADD COLUMN
|
||||||
|
* 不使用 IF NOT EXISTS / DO $$ 语法,避免 Druid StatFilter mergeSql 报错
|
||||||
|
*/
|
||||||
|
private void addColumnIfNotExists(Statement stmt, String tableName, String columnName, String columnDef) {
|
||||||
|
try {
|
||||||
|
String checkSql = "SELECT COUNT(*) FROM information_schema.columns WHERE table_name='" + tableName + "' AND column_name='" + columnName + "'";
|
||||||
|
java.sql.ResultSet rs = stmt.executeQuery(checkSql);
|
||||||
|
boolean exists = false;
|
||||||
|
if (rs.next()) {
|
||||||
|
exists = rs.getInt(1) > 0;
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
if (!exists) {
|
||||||
|
String alterSql = "ALTER TABLE " + tableName + " ADD COLUMN " + columnName + " " + columnDef;
|
||||||
|
stmt.execute(alterSql);
|
||||||
|
log.info("成功添加列: {}.{}", tableName, columnName);
|
||||||
|
} else {
|
||||||
|
log.info("列已存在,跳过: {}.{}", tableName, columnName);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("添加列 {}.{} 失败: {}", tableName, columnName, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<InterviewInvitation> getInterviewInvitationList(InterviewInvitation interviewInvitation) {
|
public List<InterviewInvitation> getInterviewInvitationList(InterviewInvitation interviewInvitation) {
|
||||||
return interviewInvitationMapper.getInterviewInvitationList(interviewInvitation);
|
return interviewInvitationMapper.getInterviewInvitationList(interviewInvitation);
|
||||||
|
|||||||
@@ -145,10 +145,10 @@ public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> im
|
|||||||
List<Long> ids = jobApplies.stream().map(JobApply::getId).collect(Collectors.toList());
|
List<Long> ids = jobApplies.stream().map(JobApply::getId).collect(Collectors.toList());
|
||||||
jobApplyMapper.deleteBatchIds(ids);
|
jobApplyMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
jobApplyMapper.insert(jobApply);
|
int num = jobApplyMapper.insert(jobApply);
|
||||||
//添加消息说明
|
//添加消息说明
|
||||||
|
|
||||||
return 0;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -382,6 +382,10 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
|
|||||||
if(!longs.isEmpty()){
|
if(!longs.isEmpty()){
|
||||||
fileMapper.updateBussinessids(longs,job.getJobId());
|
fileMapper.updateBussinessids(longs,job.getJobId());
|
||||||
}
|
}
|
||||||
|
if (job.getIsPublish() == 1) {
|
||||||
|
//同步到es
|
||||||
|
iesJobSearchService.updateJob(job.getJobId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return insert;
|
return insert;
|
||||||
}
|
}
|
||||||
@@ -1094,6 +1098,7 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
|
|||||||
private List<ESJobDocument> sysUserCollection(List<ESJobDocument> jobs){
|
private List<ESJobDocument> sysUserCollection(List<ESJobDocument> jobs){
|
||||||
if(jobs.isEmpty()){return new ArrayList<>();}
|
if(jobs.isEmpty()){return new ArrayList<>();}
|
||||||
if(SecurityUtils.isLogin()){
|
if(SecurityUtils.isLogin()){
|
||||||
|
log.error("--------SecurityUtils.getUserId():" + SecurityUtils.getUserId());
|
||||||
//收藏
|
//收藏
|
||||||
Set<Long> collectionIds = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery()
|
Set<Long> collectionIds = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery()
|
||||||
.eq(JobCollection::getUserId, SecurityUtils.getUserId())
|
.eq(JobCollection::getUserId, SecurityUtils.getUserId())
|
||||||
@@ -1102,7 +1107,7 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
|
|||||||
Set<Long> applyJobIds = new HashSet<>();
|
Set<Long> applyJobIds = new HashSet<>();
|
||||||
List<Job> jobList = jobApplyMapper.applyJob(SecurityUtils.getUserId());
|
List<Job> jobList = jobApplyMapper.applyJob(SecurityUtils.getUserId());
|
||||||
if (CollectionUtils.isNotEmpty(jobList)) {
|
if (CollectionUtils.isNotEmpty(jobList)) {
|
||||||
applyJobIds = jobApplyMapper.applyJob(SecurityUtils.getUserId()).stream().map(Job::getJobId).collect(Collectors.toSet());
|
applyJobIds = jobList.stream().map(Job::getJobId).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
for (ESJobDocument j : jobs) {
|
for (ESJobDocument j : jobs) {
|
||||||
if (collectionIds.contains(j.getJobId())) {
|
if (collectionIds.contains(j.getJobId())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user