WechatGroup
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.AppNotice;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.Notice;
|
||||
import com.ruoyi.cms.domain.vo.AppNoticeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IAppNoticeService
|
||||
{
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
public AppNotice selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
public List<AppNotice> selectNoticeList(AppNotice notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertNotice(AppNotice notice);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateNotice(AppNotice notice);
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteNoticeByIds(Long[] noticeIds);
|
||||
|
||||
List<Notice> listNotRead(Integer isRead);
|
||||
|
||||
List<Job> recommend(String jobTitle);
|
||||
|
||||
void sysNotice(String ids);
|
||||
|
||||
void read(String ids);
|
||||
|
||||
List<Notice> sysNoticeList();
|
||||
|
||||
void recommendJobCron();
|
||||
void fairCompanyCron();
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.AppReviewJob;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.MineJobQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户岗位浏览记录Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
public interface IAppReviewJobService
|
||||
{
|
||||
/**
|
||||
* 查询用户岗位浏览记录
|
||||
*
|
||||
* @param id 用户岗位浏览记录主键
|
||||
* @return 用户岗位浏览记录
|
||||
*/
|
||||
public AppReviewJob selectAppReviewJobById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户岗位浏览记录列表
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 用户岗位浏览记录集合
|
||||
*/
|
||||
public List<AppReviewJob> selectAppReviewJobList(AppReviewJob appReviewJob);
|
||||
|
||||
/**
|
||||
* 新增用户岗位浏览记录
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAppReviewJob(AppReviewJob appReviewJob);
|
||||
|
||||
/**
|
||||
* 修改用户岗位浏览记录
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAppReviewJob(AppReviewJob appReviewJob);
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位浏览记录
|
||||
*
|
||||
* @param ids 需要删除的用户岗位浏览记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppReviewJobByIds(Long[] ids);
|
||||
|
||||
List<Job> review(MineJobQuery jobQuery);
|
||||
|
||||
|
||||
List<String> reviewArray();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.AppUser;
|
||||
|
||||
/**
|
||||
* APP用户Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface IAppUserService
|
||||
{
|
||||
/**
|
||||
* 查询APP用户
|
||||
*
|
||||
* @param userId APP用户主键
|
||||
* @return APP用户
|
||||
*/
|
||||
public AppUser selectAppUserByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 查询APP用户列表
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return APP用户集合
|
||||
*/
|
||||
public List<AppUser> selectAppUserList(AppUser appUser);
|
||||
|
||||
/**
|
||||
* 新增APP用户
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAppUser(AppUser appUser);
|
||||
|
||||
/**
|
||||
* 修改APP用户
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAppUser(AppUser appUser);
|
||||
|
||||
/**
|
||||
* 批量删除APP用户
|
||||
*
|
||||
* @param userIds 需要删除的APP用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppUserByUserIds(Long[] userIds);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IBussinessDictDataService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<BussinessDictData> selectDictDataList(BussinessDictData dictData);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 字典数据
|
||||
*/
|
||||
public BussinessDictData selectDictDataById(Long dictCode);
|
||||
|
||||
/**
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
*/
|
||||
public void deleteDictDataByIds(Long[] dictCodes);
|
||||
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictData(BussinessDictData dictData);
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictData(BussinessDictData dictData);
|
||||
|
||||
List<Long> getSalary(String salaryDict);
|
||||
|
||||
String findCode(List<BussinessDictData> dictData, String type);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.cms.domain.BussinessDictType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IBussinessDictTypeService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<BussinessDictType> selectDictTypeList(BussinessDictType dictType);
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<BussinessDictType> selectDictTypeAll();
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
public List<BussinessDictData> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
public BussinessDictType selectDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
public BussinessDictType selectDictTypeByType(String dictType);
|
||||
|
||||
/**
|
||||
* 批量删除字典信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
public void deleteDictTypeByIds(Long[] dictIds);
|
||||
|
||||
/**
|
||||
* 加载字典缓存数据
|
||||
*/
|
||||
public void loadingDictCache();
|
||||
|
||||
/**
|
||||
* 清空字典缓存数据
|
||||
*/
|
||||
public void clearDictCache();
|
||||
|
||||
/**
|
||||
* 重置字典缓存数据
|
||||
*/
|
||||
public void resetDictCache();
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDictType(BussinessDictType dictType);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDictType(BussinessDictType dictType);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkDictTypeUnique(BussinessDictType dictType);
|
||||
|
||||
Map<String, Object> standarFiled();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessOperLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IBussinessOperLogService
|
||||
{
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public void insertOperlog(BussinessOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
public List<BussinessOperLog> selectOperLogList(BussinessOperLog operLog);
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteOperLogByIds(Long[] operIds);
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
public BussinessOperLog selectOperLogById(Long operId);
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
public void cleanOperLog();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.CommercialArea;
|
||||
|
||||
/**
|
||||
* 商圈Service接口
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
public interface ICommercialAreaService
|
||||
{
|
||||
/**
|
||||
* 查询商圈
|
||||
*
|
||||
* @param commercialAreaId 商圈主键
|
||||
* @return 商圈
|
||||
*/
|
||||
public CommercialArea selectCommercialAreaByCommercialAreaId(Long commercialAreaId);
|
||||
|
||||
/**
|
||||
* 查询商圈列表
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 商圈集合
|
||||
*/
|
||||
public List<CommercialArea> selectCommercialAreaList(CommercialArea commercialArea);
|
||||
|
||||
/**
|
||||
* 新增商圈
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCommercialArea(CommercialArea commercialArea);
|
||||
|
||||
/**
|
||||
* 修改商圈
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCommercialArea(CommercialArea commercialArea);
|
||||
|
||||
/**
|
||||
* 批量删除商圈
|
||||
*
|
||||
* @param commercialAreaIds 需要删除的商圈主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCommercialAreaByCommercialAreaIds(Long[] commercialAreaIds);
|
||||
|
||||
List<CommercialArea> appCommercialArea();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.CompanyCardCollection;
|
||||
|
||||
/**
|
||||
* 公司卡片收藏Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface ICompanyCardCollectionService
|
||||
{
|
||||
/**
|
||||
* 查询公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollectionId 公司卡片收藏主键
|
||||
* @return 公司卡片收藏
|
||||
*/
|
||||
public CompanyCardCollection selectCompanyCardCollectionByCompanyCardCollectionId(Long companyCardCollectionId);
|
||||
|
||||
/**
|
||||
* 查询公司卡片收藏列表
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 公司卡片收藏集合
|
||||
*/
|
||||
public List<CompanyCardCollection> selectCompanyCardCollectionList(CompanyCardCollection companyCardCollection);
|
||||
|
||||
/**
|
||||
* 新增公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCompanyCardCollection(CompanyCardCollection companyCardCollection);
|
||||
|
||||
/**
|
||||
* 修改公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCompanyCardCollection(CompanyCardCollection companyCardCollection);
|
||||
|
||||
/**
|
||||
* 批量删除公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollectionIds 需要删除的公司卡片收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCompanyCardCollectionByCompanyCardCollectionIds(Long[] companyCardCollectionIds);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.vo.CompanyCardVO;
|
||||
|
||||
/**
|
||||
* 公司卡片Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface ICompanyCardService
|
||||
{
|
||||
/**
|
||||
* 查询公司卡片
|
||||
*
|
||||
* @param companyCardId 公司卡片主键
|
||||
* @return 公司卡片
|
||||
*/
|
||||
public CompanyCard selectCompanyCardByCompanyCardId(Long companyCardId);
|
||||
|
||||
/**
|
||||
* 查询公司卡片列表
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 公司卡片集合
|
||||
*/
|
||||
public List<CompanyCard> selectCompanyCardList(CompanyCard companyCard);
|
||||
|
||||
/**
|
||||
* 新增公司卡片
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCompanyCard(CompanyCard companyCard);
|
||||
|
||||
/**
|
||||
* 修改公司卡片
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCompanyCard(CompanyCard companyCard);
|
||||
|
||||
/**
|
||||
* 批量删除公司卡片
|
||||
*
|
||||
* @param companyCardIds 需要删除的公司卡片主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCompanyCardByCompanyCardIds(Long[] companyCardIds);
|
||||
|
||||
List<CompanyCardVO> cardApp();
|
||||
|
||||
void cardCollection(Long companyCardId);
|
||||
|
||||
void cardCancel(Long companyCardId);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCollection;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
|
||||
/**
|
||||
* 用户公司收藏Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
public interface ICompanyCollectionService
|
||||
{
|
||||
/**
|
||||
* 查询用户公司收藏
|
||||
*
|
||||
* @param id 用户公司收藏主键
|
||||
* @return 用户公司收藏
|
||||
*/
|
||||
public CompanyCollection selectCompanyCollectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户公司收藏列表
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 用户公司收藏集合
|
||||
*/
|
||||
public List<CompanyCollection> selectCompanyCollectionList(CompanyCollection companyCollection);
|
||||
|
||||
/**
|
||||
* 新增用户公司收藏
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCompanyCollection(CompanyCollection companyCollection);
|
||||
|
||||
/**
|
||||
* 修改用户公司收藏
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCompanyCollection(CompanyCollection companyCollection);
|
||||
|
||||
/**
|
||||
* 批量删除用户公司收藏
|
||||
*
|
||||
* @param ids 需要删除的用户公司收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCompanyCollectionByIds(Long[] ids);
|
||||
/**
|
||||
* 用户收藏公司
|
||||
*/
|
||||
int companyCollection(Long companyId);
|
||||
/**
|
||||
* 用户取消收藏公司
|
||||
*/
|
||||
int companyCancel(Long companyId);
|
||||
|
||||
List<Company> collectionCompany();
|
||||
|
||||
List<Job> jobCompany(Long companyId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
public interface ICompanyLabelService
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
|
||||
/**
|
||||
* 公司Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
public interface ICompanyService
|
||||
{
|
||||
/**
|
||||
* 查询公司
|
||||
*
|
||||
* @param companyId 公司主键
|
||||
* @return 公司
|
||||
*/
|
||||
public Company selectCompanyByCompanyId(Long companyId);
|
||||
|
||||
/**
|
||||
* 查询公司列表
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 公司集合
|
||||
*/
|
||||
public List<Company> selectCompanyList(Company company);
|
||||
|
||||
/**
|
||||
* 新增公司
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCompany(Company company);
|
||||
|
||||
/**
|
||||
* 修改公司
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCompany(Company company);
|
||||
|
||||
/**
|
||||
* 批量删除公司
|
||||
*
|
||||
* @param companyIds 需要删除的公司主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCompanyByCompanyIds(Long[] companyIds);
|
||||
|
||||
/**
|
||||
* 公司招聘的岗位数量
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
Integer count(Long companyId);
|
||||
|
||||
void updateJobCountOfCompany();
|
||||
|
||||
List<Company> label(CompanyCard companyCard,LabelQuery labelQuery);
|
||||
|
||||
void importLabel();
|
||||
|
||||
void importLabelBank();
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 检索Service
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IESJobSearchService
|
||||
{
|
||||
|
||||
/**
|
||||
* 新增全文检索数据
|
||||
*/
|
||||
Integer addESJobDocument(ESJobDocument ESJobDocument);
|
||||
|
||||
/**
|
||||
* 修改全文检索数据
|
||||
*/
|
||||
Integer updateESJobDocument(ESJobDocument ESJobDocument);
|
||||
|
||||
/**
|
||||
* 根据ID查询全文检索数据
|
||||
*/
|
||||
ESJobDocument getESJobDocument(Long noticeId);
|
||||
|
||||
/**
|
||||
* 根据ID删除全文检索数据
|
||||
*/
|
||||
void deleteESJobDocument(String ids);
|
||||
|
||||
/**
|
||||
* 重置全文检索数据
|
||||
*/
|
||||
void resetTextCache();
|
||||
|
||||
List<ESJobDocument> selectTextListExceptJobId(ESJobSearch esJobSearch, List<Long> jobIds);
|
||||
|
||||
EsPageInfo<ESJobDocument> nearJob(ESJobSearch jobQuery);
|
||||
|
||||
EsPageInfo<ESJobDocument> countyJobList(ESJobSearch job);
|
||||
|
||||
EsPageInfo<ESJobDocument> subway(ESJobSearch jobQuery);
|
||||
|
||||
EsPageInfo<ESJobDocument> commercialArea(ESJobSearch jobQuery);
|
||||
|
||||
EsPageInfo<ESJobDocument> appList(ESJobSearch jobQuery);
|
||||
|
||||
void checkEsAndFix();
|
||||
|
||||
List<ESJobDocument> littleVideo(ESJobSearch esJobSearch);
|
||||
|
||||
List<ESJobDocument> littleVideoRandom(List<Long> cacheList, Integer count,String jobTitle);
|
||||
|
||||
void updateEs();
|
||||
|
||||
ESJobDocument selectById(Long jobId);
|
||||
|
||||
void fix();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.FairCollection;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户招聘会收藏Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface IFairCollectionService
|
||||
{
|
||||
/**
|
||||
* 查询用户招聘会收藏
|
||||
*
|
||||
* @param id 用户招聘会收藏主键
|
||||
* @return 用户招聘会收藏
|
||||
*/
|
||||
public FairCollection selectFairCollectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户招聘会收藏列表
|
||||
*
|
||||
* @param FairCollection 用户招聘会收藏
|
||||
* @return 用户招聘会收藏集合
|
||||
*/
|
||||
public List<FairCollection> selectFairCollectionList(FairCollection FairCollection);
|
||||
|
||||
/**
|
||||
* 新增用户招聘会收藏
|
||||
*
|
||||
* @param FairCollection 用户招聘会收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFairCollection(FairCollection FairCollection);
|
||||
|
||||
/**
|
||||
* 修改用户招聘会收藏
|
||||
*
|
||||
* @param FairCollection 用户招聘会收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFairCollection(FairCollection FairCollection);
|
||||
|
||||
/**
|
||||
* 批量删除用户招聘会收藏
|
||||
*
|
||||
* @param ids 需要删除的用户招聘会收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFairCollectionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 用户收藏招聘会
|
||||
*/
|
||||
int fairCollection(Long fairId);
|
||||
|
||||
|
||||
/**
|
||||
* 用户取消收藏招聘会
|
||||
*/
|
||||
int cancel(Long fairId);
|
||||
|
||||
/**
|
||||
* 用户收藏招聘会列表
|
||||
*/
|
||||
List<JobFair> appCollectionFair(Integer type);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.FairCompany;
|
||||
|
||||
/**
|
||||
* 公司招聘会关联Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
public interface IFairCompanyService
|
||||
{
|
||||
/**
|
||||
* 查询公司招聘会关联
|
||||
*
|
||||
* @param id 公司招聘会关联主键
|
||||
* @return 公司招聘会关联
|
||||
*/
|
||||
public FairCompany selectFairCompanyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询公司招聘会关联列表
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 公司招聘会关联集合
|
||||
*/
|
||||
public List<FairCompany> selectFairCompanyList(FairCompany fairCompany);
|
||||
|
||||
/**
|
||||
* 新增公司招聘会关联
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFairCompany(FairCompany fairCompany);
|
||||
|
||||
/**
|
||||
* 修改公司招聘会关联
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFairCompany(FairCompany fairCompany);
|
||||
|
||||
/**
|
||||
* 批量删除公司招聘会关联
|
||||
*
|
||||
* @param ids 需要删除的公司招聘会关联主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFairCompanyByIds(Long[] ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.File;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件Service接口
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-03-18
|
||||
*/
|
||||
public interface IFileService
|
||||
{
|
||||
/**
|
||||
* 查询文件
|
||||
*
|
||||
* @param id 文件主键
|
||||
* @return 文件
|
||||
*/
|
||||
public File selectFileById(Long id);
|
||||
|
||||
/**
|
||||
* 查询文件列表
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 文件集合
|
||||
*/
|
||||
public List<File> selectFileList(File file);
|
||||
|
||||
/**
|
||||
* 新增文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFile(File file);
|
||||
|
||||
/**
|
||||
* 修改文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFile(File file);
|
||||
|
||||
/**
|
||||
* 批量删除文件
|
||||
*
|
||||
* @param ids 需要删除的文件主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFileByIds(Long[] ids);
|
||||
|
||||
AjaxResult uploadFile(MultipartFile file, Long bussinessId);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.Industry;
|
||||
|
||||
/**
|
||||
* 行业Service接口
|
||||
*
|
||||
* @author LishunDong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
public interface IIndustryService
|
||||
{
|
||||
/**
|
||||
* 查询行业
|
||||
*
|
||||
* @param industryId 行业主键
|
||||
* @return 行业
|
||||
*/
|
||||
public Industry selectIndustryByIndustryId(Long industryId);
|
||||
|
||||
/**
|
||||
* 查询行业列表
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 行业集合
|
||||
*/
|
||||
public List<Industry> selectIndustryList(Industry industry);
|
||||
|
||||
/**
|
||||
* 新增行业
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertIndustry(Industry industry);
|
||||
|
||||
/**
|
||||
* 修改行业
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateIndustry(Industry industry);
|
||||
|
||||
/**
|
||||
* 批量删除行业
|
||||
*
|
||||
* @param industryIds 需要删除的行业主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteIndustryByIndustryIds(Long[] industryIds);
|
||||
|
||||
List<TreeSelect> buildIndustryTreeSelect(List<Industry> industryList);
|
||||
|
||||
boolean hasChildByIndustryId(Long industryId);
|
||||
|
||||
List<TreeSelect> appIndustry();
|
||||
|
||||
void importData();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
|
||||
/**
|
||||
* 岗位申请Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
public interface IJobApplyService
|
||||
{
|
||||
/**
|
||||
* 查询岗位申请
|
||||
*
|
||||
* @param id 岗位申请主键
|
||||
* @return 岗位申请
|
||||
*/
|
||||
public JobApply selectJobApplyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询岗位申请列表
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 岗位申请集合
|
||||
*/
|
||||
public List<JobApply> selectJobApplyList(JobApply jobApply);
|
||||
|
||||
/**
|
||||
* 新增岗位申请
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobApply(JobApply jobApply);
|
||||
|
||||
/**
|
||||
* 修改岗位申请
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJobApply(JobApply jobApply);
|
||||
|
||||
/**
|
||||
* 批量删除岗位申请
|
||||
*
|
||||
* @param ids 需要删除的岗位申请主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobApplyByIds(Long[] ids);
|
||||
|
||||
List<Job> applyJob();
|
||||
|
||||
HashMap<String, Integer> statistics();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobCollection;
|
||||
|
||||
/**
|
||||
* 用户岗位收藏Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface IJobCollectionService
|
||||
{
|
||||
/**
|
||||
* 查询用户岗位收藏
|
||||
*
|
||||
* @param id 用户岗位收藏主键
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
public JobCollection selectJobCollectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户岗位收藏列表
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 用户岗位收藏集合
|
||||
*/
|
||||
public List<JobCollection> selectJobCollectionList(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 新增用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobCollection(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 修改用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJobCollection(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位收藏
|
||||
*
|
||||
* @param ids 需要删除的用户岗位收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobCollectionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 用户收藏岗位
|
||||
*/
|
||||
int jobCollection(Long jobId);
|
||||
|
||||
|
||||
/**
|
||||
* 用户取消收藏岗位
|
||||
*/
|
||||
int cancel(Long jobId);
|
||||
/**
|
||||
* 用户申请岗位
|
||||
*/
|
||||
int apply(Long jobId);
|
||||
|
||||
List<Job> collectionJob();
|
||||
|
||||
String competitiveness(Long jobId);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
|
||||
/**
|
||||
* 招聘会信息Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
public interface IJobFairService
|
||||
{
|
||||
/**
|
||||
* 查询招聘会信息
|
||||
*
|
||||
* @param jobFairId 招聘会信息主键
|
||||
* @return 招聘会信息
|
||||
*/
|
||||
public JobFair selectJobFairByJobFairId(Long jobFairId);
|
||||
|
||||
/**
|
||||
* 查询招聘会信息列表
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 招聘会信息集合
|
||||
*/
|
||||
public List<JobFair> selectJobFairList(JobFair jobFair);
|
||||
/**
|
||||
* 新增招聘会信息
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobFair(JobFair jobFair);
|
||||
|
||||
/**
|
||||
* 修改招聘会信息
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJobFair(JobFair jobFair);
|
||||
|
||||
/**
|
||||
* 批量删除招聘会信息
|
||||
*
|
||||
* @param jobFairIds 需要删除的招聘会信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobFairByJobFairIds(Long[] jobFairIds);
|
||||
|
||||
List<JobFair> appList(JobFair jobFair);
|
||||
|
||||
JobFair appDetail(Long fairId);
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobCollection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户岗位收藏Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface IJobRecommentService
|
||||
{
|
||||
/**
|
||||
* 查询用户岗位收藏
|
||||
*
|
||||
* @param id 用户岗位收藏主键
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
public JobCollection selectJobCollectionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户岗位收藏列表
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 用户岗位收藏集合
|
||||
*/
|
||||
public List<JobCollection> selectJobCollectionList(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 新增用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobCollection(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 修改用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJobCollection(JobCollection jobCollection);
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位收藏
|
||||
*
|
||||
* @param ids 需要删除的用户岗位收藏主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobCollectionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 用户收藏岗位
|
||||
*/
|
||||
int jobCollection(Long jobId);
|
||||
|
||||
|
||||
/**
|
||||
* 用户取消收藏岗位
|
||||
*/
|
||||
int cancel(Long jobId);
|
||||
/**
|
||||
* 用户申请岗位
|
||||
*/
|
||||
int apply(Long jobId);
|
||||
|
||||
List<Job> collectionJob();
|
||||
|
||||
String competitiveness(Long jobId);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.util.AppWechatEntity;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
|
||||
/**
|
||||
* 岗位Service接口
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
public interface IJobService
|
||||
{
|
||||
/**
|
||||
* 查询岗位
|
||||
*
|
||||
* @param jobId 岗位主键
|
||||
* @return 岗位
|
||||
*/
|
||||
public Job selectJobByJobId(Long jobId);
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 岗位集合
|
||||
*/
|
||||
public List<Job> selectJobList(Job job);
|
||||
|
||||
|
||||
/**
|
||||
* 浏览量+1
|
||||
*/
|
||||
int view(Long jobId);
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob(Job job);
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob(Job job);
|
||||
|
||||
/**
|
||||
* 批量删除岗位
|
||||
*
|
||||
* @param jobIds 需要删除的岗位主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobByJobIds(Long[] jobIds);
|
||||
|
||||
|
||||
EsPageInfo<ESJobDocument> appList(ESJobSearch job);
|
||||
|
||||
void importData();
|
||||
|
||||
List<ESJobDocument> recommend(ESJobSearch esJobSearch);
|
||||
|
||||
EsPageInfo<ESJobDocument> countyJobList(ESJobSearch job);
|
||||
|
||||
EsPageInfo<ESJobDocument> subway(ESJobSearch jobQuery);
|
||||
|
||||
EsPageInfo<ESJobDocument> commercialArea(ESJobSearch jobQuery);
|
||||
|
||||
Job selectJobByJobIdApp(Long jobId);
|
||||
|
||||
void importRow();
|
||||
|
||||
List<CandidateVO> candidates(Long jobId);
|
||||
|
||||
void updateLon();
|
||||
|
||||
List<ESJobDocument> littleVideo(ESJobSearch esJobSearch);
|
||||
|
||||
List<ESJobDocument> littleVideoRandom(String uuid, Integer count,String jobTitle);
|
||||
|
||||
void updateEs();
|
||||
|
||||
AppWechatEntity getWechatUrl(String wechatUrl);
|
||||
|
||||
String insertTemp(Job job);
|
||||
|
||||
String htmlGen(Long id);
|
||||
|
||||
void fix();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
|
||||
/**
|
||||
* 岗位Service接口
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
public interface IJobTitleService
|
||||
{
|
||||
/**
|
||||
* 查询岗位
|
||||
*
|
||||
* @param jobId 岗位主键
|
||||
* @return 岗位
|
||||
*/
|
||||
public JobTitle selectJobTitleByJobId(Long jobId);
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 岗位集合
|
||||
*/
|
||||
public List<JobTitle> selectJobTitleList(JobTitle jobTitle);
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJobTitle(JobTitle jobTitle);
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJobTitle(JobTitle jobTitle);
|
||||
|
||||
/**
|
||||
* 批量删除岗位
|
||||
*
|
||||
* @param jobIds 需要删除的岗位主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobTitleByJobIds(Long[] jobIds);
|
||||
|
||||
List<TreeSelect> buildJobTitleTreeSelect(List<JobTitle> jobTitleList);
|
||||
|
||||
boolean hasChildByJobId(Long jobId);
|
||||
|
||||
List<TreeSelect> appJobTitle();
|
||||
|
||||
void importJobTitle();
|
||||
|
||||
List<JobTitle> levelOne();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
public interface INoticeService
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
|
||||
/**
|
||||
* 地铁线路Service接口
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
public interface ISubwayLineService
|
||||
{
|
||||
/**
|
||||
* 查询地铁线路
|
||||
*
|
||||
* @param lineId 地铁线路主键
|
||||
* @return 地铁线路
|
||||
*/
|
||||
public SubwayLine selectSubwayLineByLineId(Long lineId);
|
||||
|
||||
/**
|
||||
* 查询地铁线路列表
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 地铁线路集合
|
||||
*/
|
||||
public List<SubwayLine> selectSubwayLineList(SubwayLine subwayLine);
|
||||
|
||||
/**
|
||||
* 新增地铁线路
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSubwayLine(SubwayLine subwayLine);
|
||||
|
||||
/**
|
||||
* 修改地铁线路
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSubwayLine(SubwayLine subwayLine);
|
||||
|
||||
/**
|
||||
* 批量删除地铁线路
|
||||
*
|
||||
* @param lineIds 需要删除的地铁线路主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSubwayLineByLineIds(Long lineIds);
|
||||
|
||||
List<SubwayLine> appSubway();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.SubwayStation;
|
||||
|
||||
/**
|
||||
* 地铁站点Service接口
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
public interface ISubwayStationService
|
||||
{
|
||||
/**
|
||||
* 查询地铁站点
|
||||
*
|
||||
* @param stationId 地铁站点主键
|
||||
* @return 地铁站点
|
||||
*/
|
||||
public SubwayStation selectSubwayStationByStationId(Long stationId);
|
||||
|
||||
/**
|
||||
* 查询地铁站点列表
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 地铁站点集合
|
||||
*/
|
||||
public List<SubwayStation> selectSubwayStationList(SubwayStation subwayStation);
|
||||
|
||||
/**
|
||||
* 新增地铁站点
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSubwayStation(SubwayStation subwayStation);
|
||||
|
||||
/**
|
||||
* 修改地铁站点
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSubwayStation(SubwayStation subwayStation);
|
||||
|
||||
/**
|
||||
* 批量删除地铁站点
|
||||
*
|
||||
* @param stationIds 需要删除的地铁站点主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSubwayStationByStationIds(Long[] stationIds);
|
||||
|
||||
void importStation();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface StaticsqueryService {
|
||||
Map<String, Object> industry(Staticsquery staticsquery);
|
||||
|
||||
void industryGen();
|
||||
void areaGen();
|
||||
|
||||
Map<String, Object> industryArea(Staticsquery staticsquery);
|
||||
|
||||
void salarysalaryGen();
|
||||
|
||||
Map<String, Object> salary(Staticsquery staticsquery);
|
||||
|
||||
void workYearGen();
|
||||
|
||||
Map<String, Object> workYear(Staticsquery staticsquery);
|
||||
|
||||
void educationGen();
|
||||
|
||||
Map<String, Object> education(Staticsquery staticsquery);
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.IAppNoticeService;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 服务层实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class AppNoticeServiceImpl implements IAppNoticeService
|
||||
{
|
||||
@Autowired
|
||||
private AppNoticeMapper noticeMapper;
|
||||
@Autowired
|
||||
private JobRecommentMapper jobRecommentMapper;
|
||||
@Autowired
|
||||
private FairCollectionMapper fairCollectionMapper;
|
||||
@Autowired
|
||||
private AppNoticeMapper appNoticeMapper;
|
||||
@Autowired
|
||||
private JobFairMapper jobFairMapper;
|
||||
@Autowired
|
||||
private NoticeMapper noticeInfoMapper;
|
||||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
@Override
|
||||
public AppNotice selectNoticeById(Long noticeId)
|
||||
{
|
||||
return noticeMapper.selectNoticeById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<AppNotice> selectNoticeList(AppNotice notice)
|
||||
{
|
||||
return noticeMapper.selectNoticeList(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNotice(AppNotice notice)
|
||||
{
|
||||
return noticeMapper.insertNotice(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNotice(AppNotice notice)
|
||||
{
|
||||
return noticeMapper.updateNotice(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告对象
|
||||
*
|
||||
* @param noticeId 公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeById(Long noticeId)
|
||||
{
|
||||
return noticeMapper.deleteNoticeById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
* @param noticeIds 需要删除的公告ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteNoticeByIds(Long[] noticeIds)
|
||||
{
|
||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recommendJobCron() {
|
||||
List<AppUser> appUsers = appUserMapper.selectList(null);
|
||||
appUsers.forEach(appUser -> {
|
||||
if(appUser.getIsRecommend()==1){
|
||||
//todo complete logic of recommend
|
||||
recommendJobForUser(appUser);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void recommendJobForUser(AppUser appUser) {
|
||||
jobRecommentMapper.delete(Wrappers.<JobRecomment>lambdaQuery().eq(JobRecomment::getUserId, appUser.getUserId()));
|
||||
jobRecommentMapper.recommendJobForUser(appUser.getUserId());
|
||||
noticeInfoMapper.delete(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, appUser.getUserId()).eq(Notice::getTitle,"职位上新"));
|
||||
Notice notice = new Notice();
|
||||
notice.setUserId(appUser.getUserId());
|
||||
notice.setTitle("职位上新");
|
||||
notice.setIsRead(0);
|
||||
notice.setDate(new Date());
|
||||
//todo update number of job
|
||||
notice.setSubTitle("这里有10个岗位很适合你,快来看看吧");
|
||||
notice.setNotReadCount(10);
|
||||
noticeInfoMapper.insert(notice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fairCompanyCron() {
|
||||
List<AppUser> appUsers = appUserMapper.selectList(null);
|
||||
appUsers.forEach(appUser -> {
|
||||
if(appUser.getIsRecommend()==1){
|
||||
//todo complete logic of recommend
|
||||
fairCompany(appUser);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fairCompany(AppUser appUser) {
|
||||
List<FairCollection> fairCollections = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getUserId, appUser.getUserId()).orderByDesc(FairCollection::getCreateTime));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notice> listNotRead(Integer isRead) {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).eq(Notice::getRemark,"notice_bar").orderByDesc(Notice::getCreateTime));
|
||||
return sysNoticeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> recommend(String jobTitle) {
|
||||
return appNoticeMapper.recommend(jobTitle,SecurityUtils.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sysNotice(String ids) {
|
||||
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
||||
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
||||
notices.forEach(notice -> {
|
||||
notice.setIsRead(1);
|
||||
noticeInfoMapper.updateById(notice);
|
||||
});
|
||||
List<Notice> notices1 = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, SecurityUtils.getUserId()).eq(Notice::getRemark, "notice_bar").eq(Notice::getTitle, "系统通知").orderByDesc(Notice::getCreateTime).last("limit 1"));
|
||||
Notice notice = notices1.get(0);
|
||||
notice.setNotReadCount(notice.getNotReadCount() - longs.size());
|
||||
if(notice.getNotReadCount()==0){
|
||||
notice.setIsRead(1);
|
||||
}
|
||||
noticeInfoMapper.updateById(notice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String ids) {
|
||||
List<Long> longs = StringUtil.convertStringToLongList(ids);
|
||||
List<Notice> notices = noticeInfoMapper.selectBatchIds(longs);
|
||||
notices.forEach(notice -> {
|
||||
notice.setIsRead(1);
|
||||
notice.setNotReadCount(0);
|
||||
noticeInfoMapper.updateById(notice);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Notice> sysNoticeList() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<Notice> sysNoticeList = noticeInfoMapper.selectList(Wrappers.<Notice>lambdaQuery().eq(Notice::getUserId, userId).isNotNull(Notice::getNoticeType).notIn(Notice::getNoticeType,"").orderByDesc(Notice::getCreateTime));
|
||||
return sysNoticeList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.AppReviewJob;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.MineJobQuery;
|
||||
import com.ruoyi.cms.mapper.AppReviewJobMapper;
|
||||
import com.ruoyi.cms.service.IAppReviewJobService;
|
||||
import com.ruoyi.cms.service.IJobService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 用户岗位浏览记录Service业务层处理
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Service
|
||||
public class AppReviewJobServiceImpl extends ServiceImpl<AppReviewJobMapper, AppReviewJob> implements IAppReviewJobService
|
||||
{
|
||||
@Autowired
|
||||
private AppReviewJobMapper appReviewJobMapper;
|
||||
@Autowired
|
||||
private IJobService jobService;
|
||||
private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
/**
|
||||
* 查询用户岗位浏览记录
|
||||
*
|
||||
* @param id 用户岗位浏览记录主键
|
||||
* @return 用户岗位浏览记录
|
||||
*/
|
||||
@Override
|
||||
public AppReviewJob selectAppReviewJobById(Long id)
|
||||
{
|
||||
return appReviewJobMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户岗位浏览记录列表
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 用户岗位浏览记录
|
||||
*/
|
||||
@Override
|
||||
public List<AppReviewJob> selectAppReviewJobList(AppReviewJob appReviewJob)
|
||||
{
|
||||
return appReviewJobMapper.selectAppReviewJobList(appReviewJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户岗位浏览记录
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAppReviewJob(AppReviewJob appReviewJob)
|
||||
{
|
||||
return appReviewJobMapper.insert(appReviewJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户岗位浏览记录
|
||||
*
|
||||
* @param appReviewJob 用户岗位浏览记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAppReviewJob(AppReviewJob appReviewJob)
|
||||
{
|
||||
return appReviewJobMapper.updateById(appReviewJob);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位浏览记录
|
||||
*
|
||||
* @param ids 需要删除的用户岗位浏览记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAppReviewJobByIds(Long[] ids)
|
||||
{
|
||||
return appReviewJobMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> review(MineJobQuery jobQuery) {
|
||||
List<Job> jobs = appReviewJobMapper.review(SecurityUtils.getUserId(),jobQuery);
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> reviewArray() {
|
||||
List<AppReviewJob> appReviewJobs = appReviewJobMapper.reviewArray(SecurityUtils.getUserId());
|
||||
return appReviewJobs.stream().map(x -> formatter.format(x.getReviewDate())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.mapper.JobMapper;
|
||||
import com.ruoyi.cms.mapper.JobTitleMapper;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.AppUserMapper;
|
||||
import com.ruoyi.cms.domain.AppUser;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
|
||||
/**
|
||||
* APP用户Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> implements IAppUserService
|
||||
{
|
||||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
/**
|
||||
* 查询APP用户
|
||||
*
|
||||
* @param userId APP用户主键
|
||||
* @return APP用户
|
||||
*/
|
||||
@Override
|
||||
public AppUser selectAppUserByUserId(Long userId)
|
||||
{
|
||||
AppUser appUser = appUserMapper.selectById(userId);
|
||||
if(StringUtils.isNotEmpty(appUser.getJobTitleId())){
|
||||
List<String> list = Arrays.asList(appUser.getJobTitleId().split(","));
|
||||
List<Long> collect = list.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
List<JobTitle> jobs = jobTitleMapper.selectBatchIds(collect);
|
||||
appUser.setJobTitle(jobs.stream().map(JobTitle::getJobName).collect(Collectors.toList()));
|
||||
}
|
||||
return appUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询APP用户列表
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return APP用户
|
||||
*/
|
||||
@Override
|
||||
public List<AppUser> selectAppUserList(AppUser appUser)
|
||||
{
|
||||
return appUserMapper.selectAppUserList(appUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP用户
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAppUser(AppUser appUser)
|
||||
{
|
||||
return appUserMapper.insert(appUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP用户
|
||||
*
|
||||
* @param appUser APP用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAppUser(AppUser appUser)
|
||||
{
|
||||
return appUserMapper.updateById(appUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除APP用户
|
||||
*
|
||||
* @param userIds 需要删除的APP用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAppUserByUserIds(Long[] userIds)
|
||||
{
|
||||
return appUserMapper.deleteBatchIds(Arrays.asList(userIds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.cms.mapper.BussinessDictDataMapper;
|
||||
import com.ruoyi.cms.service.IBussinessDictDataService;
|
||||
import com.ruoyi.cms.util.DictUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class BussinessDictDataServiceImpl implements IBussinessDictDataService
|
||||
{
|
||||
@Autowired
|
||||
private BussinessDictDataMapper dictDataMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<BussinessDictData> selectDictDataList(BussinessDictData dictData)
|
||||
{
|
||||
return dictDataMapper.selectDictDataList(dictData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
@Override
|
||||
public String selectDictLabel(String dictType, String dictValue)
|
||||
{
|
||||
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 字典数据
|
||||
*/
|
||||
@Override
|
||||
public BussinessDictData selectDictDataById(Long dictCode)
|
||||
{
|
||||
return dictDataMapper.selectDictDataById(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictDataByIds(Long[] dictCodes)
|
||||
{
|
||||
for (Long dictCode : dictCodes)
|
||||
{
|
||||
BussinessDictData data = selectDictDataById(dictCode);
|
||||
dictDataMapper.deleteDictDataById(dictCode);
|
||||
List<BussinessDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param data 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDictData(BussinessDictData data)
|
||||
{
|
||||
int row = dictDataMapper.insertDictData(data);
|
||||
if (row > 0)
|
||||
{
|
||||
List<BussinessDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param data 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDictData(BussinessDictData data)
|
||||
{
|
||||
int row = dictDataMapper.updateDictData(data);
|
||||
if (row > 0)
|
||||
{
|
||||
List<BussinessDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
@Override
|
||||
public List<Long> getSalary(String salaryDict)
|
||||
{
|
||||
ArrayList<Long> longs = new ArrayList<>();
|
||||
switch (salaryDict){
|
||||
case "0":
|
||||
longs.add(0l);
|
||||
longs.add(99999l);
|
||||
return longs;
|
||||
case "1":
|
||||
longs.add(0l);
|
||||
longs.add(0l);
|
||||
return longs;
|
||||
case "2":
|
||||
longs.add(2000l);
|
||||
longs.add(5000l);
|
||||
return longs;
|
||||
case "3":
|
||||
longs.add(5000l);
|
||||
longs.add(8000l);
|
||||
return longs;
|
||||
case "4":
|
||||
longs.add(8000l);
|
||||
longs.add(10000l);
|
||||
return longs;
|
||||
case "5":
|
||||
longs.add(10000l);
|
||||
longs.add(15000l);
|
||||
return longs;
|
||||
case "6":
|
||||
longs.add(15000l);
|
||||
longs.add(20000l);
|
||||
return longs;
|
||||
case "7":
|
||||
longs.add(20000l);
|
||||
longs.add(25000l);
|
||||
return longs;
|
||||
case "8":
|
||||
longs.add(25000l);
|
||||
longs.add(30000l);
|
||||
return longs;
|
||||
case "9":
|
||||
longs.add(30000l);
|
||||
longs.add(99999l);
|
||||
return longs;
|
||||
}
|
||||
longs.add(0l);
|
||||
longs.add(99999l);
|
||||
return longs;
|
||||
}
|
||||
@Override
|
||||
public String findCode(List<BussinessDictData> dictData, String type){
|
||||
if(!Objects.equals(type, "不限学历")&&!Objects.equals(type, "学历不限")){
|
||||
type.replace("学历","");
|
||||
}
|
||||
if(Objects.equals(type, "不限学历")||Objects.equals(type, "学历不限")){
|
||||
return "11";
|
||||
}
|
||||
if(Objects.equals(type, "中专")){
|
||||
return "1";
|
||||
}
|
||||
if(Objects.equals(type, "中技")){
|
||||
return "1";
|
||||
}
|
||||
if(Objects.equals(type, "中技/中专")){
|
||||
return "1";
|
||||
}
|
||||
if(Objects.equals(type, "技校")){
|
||||
return "1";
|
||||
}
|
||||
if(Objects.equals(type, "本科及以上")){
|
||||
return "4";
|
||||
}
|
||||
for (BussinessDictData bussinessDictData:dictData){
|
||||
if (bussinessDictData.getDictLabel().equals(type)){
|
||||
return bussinessDictData.getDictValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.cms.domain.BussinessDictType;
|
||||
import com.ruoyi.cms.mapper.BussinessDictDataMapper;
|
||||
import com.ruoyi.cms.mapper.BussinessDictTypeMapper;
|
||||
import com.ruoyi.cms.mapper.JobTitleMapper;
|
||||
import com.ruoyi.cms.service.IBussinessDictTypeService;
|
||||
import com.ruoyi.cms.util.DictUtils;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class BussinessDictTypeServiceImpl implements IBussinessDictTypeService
|
||||
{
|
||||
@Autowired
|
||||
private BussinessDictTypeMapper dictTypeMapper;
|
||||
|
||||
@Autowired
|
||||
private BussinessDictDataMapper dictDataMapper;
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
/**
|
||||
* 项目启动时,初始化字典到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init()
|
||||
{
|
||||
loadingDictCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<BussinessDictType> selectDictTypeList(BussinessDictType dictType)
|
||||
{
|
||||
return dictTypeMapper.selectDictTypeList(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<BussinessDictType> selectDictTypeAll()
|
||||
{
|
||||
return dictTypeMapper.selectDictTypeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<BussinessDictData> selectDictDataByType(String dictType)
|
||||
{
|
||||
List<BussinessDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||
if (StringUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
return dictDatas;
|
||||
}
|
||||
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
DictUtils.setDictCache(dictType, dictDatas);
|
||||
return dictDatas;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
@Override
|
||||
public BussinessDictType selectDictTypeById(Long dictId)
|
||||
{
|
||||
return dictTypeMapper.selectDictTypeById(dictId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@Override
|
||||
public BussinessDictType selectDictTypeByType(String dictType)
|
||||
{
|
||||
return dictTypeMapper.selectDictTypeByType(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictTypeByIds(Long[] dictIds)
|
||||
{
|
||||
for (Long dictId : dictIds)
|
||||
{
|
||||
BussinessDictType dictType = selectDictTypeById(dictId);
|
||||
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
|
||||
{
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||
}
|
||||
dictTypeMapper.deleteDictTypeById(dictId);
|
||||
DictUtils.removeDictCache(dictType.getDictType());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载字典缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void loadingDictCache()
|
||||
{
|
||||
BussinessDictData dictData = new BussinessDictData();
|
||||
dictData.setStatus("0");
|
||||
Map<String, List<BussinessDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(BussinessDictData::getDictType));
|
||||
for (Map.Entry<String, List<BussinessDictData>> entry : dictDataMap.entrySet())
|
||||
{
|
||||
DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(BussinessDictData::getDictSort)).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空字典缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void clearDictCache()
|
||||
{
|
||||
DictUtils.clearDictCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置字典缓存数据
|
||||
*/
|
||||
@Override
|
||||
public void resetDictCache()
|
||||
{
|
||||
clearDictCache();
|
||||
loadingDictCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDictType(BussinessDictType dict)
|
||||
{
|
||||
int row = dictTypeMapper.insertDictType(dict);
|
||||
if (row > 0)
|
||||
{
|
||||
DictUtils.setDictCache(dict.getDictType(), null);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateDictType(BussinessDictType dict)
|
||||
{
|
||||
BussinessDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
|
||||
dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
|
||||
int row = dictTypeMapper.updateDictType(dict);
|
||||
if (row > 0)
|
||||
{
|
||||
List<BussinessDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
|
||||
DictUtils.setDictCache(dict.getDictType(), dictDatas);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dict 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDictTypeUnique(BussinessDictType dict)
|
||||
{
|
||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||
BussinessDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> standarFiled() {
|
||||
HashMap<String, Object> filed = new HashMap<>();
|
||||
filed.put("job_titile","岗位名称");
|
||||
filed.put("min_salary","最小工资");
|
||||
filed.put("max_salary","最大工资");
|
||||
filed.put("education",this.selectDictDataByType("education").stream().map(BussinessDictData::getDictLabel).collect(Collectors.toList()));
|
||||
filed.put("experience",this.selectDictDataByType("experience").stream().map(BussinessDictData::getDictLabel).collect(Collectors.toList()));
|
||||
filed.put("company_name","公司名称");
|
||||
filed.put("job_location","工作地点");
|
||||
filed.put("posting_date","发布日期");
|
||||
filed.put("vacancies","招聘人数");
|
||||
filed.put("job_location_area_code","工作区县");
|
||||
filed.put("description","岗位描述");
|
||||
filed.put("data_source","数据来源");
|
||||
filed.put("job_url","岗位url连接");
|
||||
filed.put("job_category",jobTitleMapper.selectList(null).stream().map(JobTitle::getJobName).collect(Collectors.toList()));
|
||||
return filed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessOperLog;
|
||||
import com.ruoyi.cms.mapper.BussinessOperLogMapper;
|
||||
import com.ruoyi.cms.service.IBussinessOperLogService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 服务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class BussinessOperLogServiceImpl implements IBussinessOperLogService
|
||||
{
|
||||
@Autowired
|
||||
private BussinessOperLogMapper operLogMapper;
|
||||
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
@Override
|
||||
public void insertOperlog(BussinessOperLog operLog)
|
||||
{
|
||||
operLogMapper.insertOperlog(operLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
@Override
|
||||
public List<BussinessOperLog> selectOperLogList(BussinessOperLog operLog)
|
||||
{
|
||||
return operLogMapper.selectOperLogList(operLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteOperLogByIds(Long[] operIds)
|
||||
{
|
||||
return operLogMapper.deleteOperLogByIds(operIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
@Override
|
||||
public BussinessOperLog selectOperLogById(Long operId)
|
||||
{
|
||||
return operLogMapper.selectOperLogById(operId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空操作日志
|
||||
*/
|
||||
@Override
|
||||
public void cleanOperLog()
|
||||
{
|
||||
operLogMapper.cleanOperLog();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.CommercialAreaMapper;
|
||||
import com.ruoyi.cms.domain.CommercialArea;
|
||||
import com.ruoyi.cms.service.ICommercialAreaService;
|
||||
|
||||
/**
|
||||
* 商圈Service业务层处理
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Service
|
||||
public class CommercialAreaServiceImpl extends ServiceImpl<CommercialAreaMapper,CommercialArea> implements ICommercialAreaService
|
||||
{
|
||||
@Autowired
|
||||
private CommercialAreaMapper commercialAreaMapper;
|
||||
|
||||
/**
|
||||
* 查询商圈
|
||||
*
|
||||
* @param commercialAreaId 商圈主键
|
||||
* @return 商圈
|
||||
*/
|
||||
@Override
|
||||
public CommercialArea selectCommercialAreaByCommercialAreaId(Long commercialAreaId)
|
||||
{
|
||||
return commercialAreaMapper.selectById(commercialAreaId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商圈列表
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 商圈
|
||||
*/
|
||||
@Override
|
||||
public List<CommercialArea> selectCommercialAreaList(CommercialArea commercialArea)
|
||||
{
|
||||
return commercialAreaMapper.selectCommercialAreaList(commercialArea);
|
||||
}
|
||||
public static void removeCommercialAreaCache()
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).deleteObject(CommonConstant.COMMERICIAL_AREA);
|
||||
}
|
||||
|
||||
public static void setCommercialAreaCache(List<CommercialArea> commercialAreaCache)
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(CommonConstant.COMMERICIAL_AREA, commercialAreaCache);
|
||||
}
|
||||
|
||||
public static List<CommercialArea> getCommercialAreaCache()
|
||||
{
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(CommonConstant.COMMERICIAL_AREA);
|
||||
if (StringUtils.isNotNull(arrayCache))
|
||||
{
|
||||
return arrayCache.toList(CommercialArea.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 新增商圈
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCommercialArea(CommercialArea commercialArea)
|
||||
{
|
||||
Long aLong = commercialAreaMapper.selectCount(Wrappers.<CommercialArea>lambdaQuery().eq(CommercialArea::getCommercialAreaName, commercialArea.getCommercialAreaName()));
|
||||
if (aLong>0){
|
||||
throw new ServiceException("该商圈名已存在");
|
||||
}
|
||||
int insert = commercialAreaMapper.insert(commercialArea);
|
||||
if(insert>0){
|
||||
removeCommercialAreaCache();
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商圈
|
||||
*
|
||||
* @param commercialArea 商圈
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCommercialArea(CommercialArea commercialArea)
|
||||
{
|
||||
Long aLong = commercialAreaMapper.selectCount(Wrappers.<CommercialArea>lambdaQuery().eq(CommercialArea::getCommercialAreaName, commercialArea.getCommercialAreaName()).notIn(CommercialArea::getCommercialAreaId,commercialArea.getCommercialAreaId()));
|
||||
if (aLong>0){
|
||||
throw new ServiceException("该商圈名已存在");
|
||||
}
|
||||
int i = commercialAreaMapper.updateById(commercialArea);
|
||||
if(i>0){
|
||||
removeCommercialAreaCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商圈
|
||||
*
|
||||
* @param commercialAreaIds 需要删除的商圈主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCommercialAreaByCommercialAreaIds(Long[] commercialAreaIds)
|
||||
{
|
||||
int i = commercialAreaMapper.deleteBatchIds(Arrays.asList(commercialAreaIds));
|
||||
if(i>0){
|
||||
removeCommercialAreaCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommercialArea> appCommercialArea() {
|
||||
List<CommercialArea> commercialAreaCache = getCommercialAreaCache();
|
||||
if(Objects.isNull(commercialAreaCache))
|
||||
{
|
||||
List<CommercialArea> commercialAreaList = commercialAreaMapper.selectCommercialAreaList(null);
|
||||
setCommercialAreaCache(commercialAreaList);
|
||||
return commercialAreaList;
|
||||
}
|
||||
return commercialAreaCache;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.CompanyCardCollectionMapper;
|
||||
import com.ruoyi.cms.domain.CompanyCardCollection;
|
||||
import com.ruoyi.cms.service.ICompanyCardCollectionService;
|
||||
|
||||
/**
|
||||
* 公司卡片收藏Service业务层处理
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class CompanyCardCollectionServiceImpl extends ServiceImpl<CompanyCardCollectionMapper,CompanyCardCollection> implements ICompanyCardCollectionService
|
||||
{
|
||||
@Autowired
|
||||
private CompanyCardCollectionMapper companyCardCollectionMapper;
|
||||
|
||||
/**
|
||||
* 查询公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollectionId 公司卡片收藏主键
|
||||
* @return 公司卡片收藏
|
||||
*/
|
||||
@Override
|
||||
public CompanyCardCollection selectCompanyCardCollectionByCompanyCardCollectionId(Long companyCardCollectionId)
|
||||
{
|
||||
return companyCardCollectionMapper.selectById(companyCardCollectionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公司卡片收藏列表
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 公司卡片收藏
|
||||
*/
|
||||
@Override
|
||||
public List<CompanyCardCollection> selectCompanyCardCollectionList(CompanyCardCollection companyCardCollection)
|
||||
{
|
||||
return companyCardCollectionMapper.selectCompanyCardCollectionList(companyCardCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCompanyCardCollection(CompanyCardCollection companyCardCollection)
|
||||
{
|
||||
return companyCardCollectionMapper.insert(companyCardCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollection 公司卡片收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCompanyCardCollection(CompanyCardCollection companyCardCollection)
|
||||
{
|
||||
return companyCardCollectionMapper.updateById(companyCardCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公司卡片收藏
|
||||
*
|
||||
* @param companyCardCollectionIds 需要删除的公司卡片收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCompanyCardCollectionByCompanyCardCollectionIds(Long[] companyCardCollectionIds)
|
||||
{
|
||||
return companyCardCollectionMapper.deleteBatchIds(Arrays.asList(companyCardCollectionIds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.CompanyCardCollection;
|
||||
import com.ruoyi.cms.domain.vo.CompanyCardVO;
|
||||
import com.ruoyi.cms.mapper.CompanyCardCollectionMapper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.CompanyCardMapper;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.service.ICompanyCardService;
|
||||
|
||||
/**
|
||||
* 公司卡片Service业务层处理
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class CompanyCardServiceImpl extends ServiceImpl<CompanyCardMapper,CompanyCard> implements ICompanyCardService
|
||||
{
|
||||
@Autowired
|
||||
private CompanyCardMapper companyCardMapper;
|
||||
@Autowired
|
||||
private CompanyCardCollectionMapper companyCardCollectionMapper;
|
||||
@Autowired
|
||||
private CompanyCardCollectionServiceImpl companyCardCollectionService;
|
||||
/**
|
||||
* 查询公司卡片
|
||||
*
|
||||
* @param companyCardId 公司卡片主键
|
||||
* @return 公司卡片
|
||||
*/
|
||||
@Override
|
||||
public CompanyCard selectCompanyCardByCompanyCardId(Long companyCardId)
|
||||
{
|
||||
return companyCardMapper.selectById(companyCardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公司卡片列表
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 公司卡片
|
||||
*/
|
||||
@Override
|
||||
public List<CompanyCard> selectCompanyCardList(CompanyCard companyCard)
|
||||
{
|
||||
return companyCardMapper.selectCompanyCardList(companyCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司卡片
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCompanyCard(CompanyCard companyCard)
|
||||
{
|
||||
companyCard.setStatus(0);
|
||||
return companyCardMapper.insert(companyCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司卡片
|
||||
*
|
||||
* @param companyCard 公司卡片
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCompanyCard(CompanyCard companyCard)
|
||||
{
|
||||
return companyCardMapper.updateById(companyCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公司卡片
|
||||
*
|
||||
* @param companyCardIds 需要删除的公司卡片主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCompanyCardByCompanyCardIds(Long[] companyCardIds)
|
||||
{
|
||||
return companyCardMapper.deleteBatchIds(Arrays.asList(companyCardIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompanyCardVO> cardApp() {
|
||||
CompanyCard companyCard = new CompanyCard();
|
||||
companyCard.setStatus(1);
|
||||
List<CompanyCardVO> companyCards = companyCardMapper.selectCompanyCardListVO(companyCard);
|
||||
if(SecurityUtils.isLogin()){
|
||||
CompanyCardCollection companyCardCollection = new CompanyCardCollection();
|
||||
companyCardCollection.setUserId(SecurityUtils.getUserId());
|
||||
List<CompanyCardCollection> companyCardCollections = companyCardCollectionMapper.selectCompanyCardCollectionList(companyCardCollection);
|
||||
for (CompanyCardVO item:companyCards){
|
||||
for(CompanyCardCollection collection:companyCardCollections){
|
||||
if(Objects.equals(item.getCompanyCardId(), collection.getCompanyCardId())){
|
||||
item.setIsCollection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return companyCards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cardCollection(Long companyCardId) {
|
||||
CompanyCardCollection companyCardCollection = new CompanyCardCollection();
|
||||
companyCardCollection.setCompanyCardId(companyCardId);
|
||||
companyCardCollection.setUserId(SecurityUtils.getUserId());
|
||||
companyCardCollectionService.save(companyCardCollection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cardCancel(Long companyCardId) {
|
||||
CompanyCardCollection companyCardCollection = new CompanyCardCollection();
|
||||
companyCardCollection.setCompanyCardId(companyCardId);
|
||||
companyCardCollection.setUserId(SecurityUtils.getUserId());
|
||||
List<CompanyCardCollection> companyCardCollections = companyCardCollectionMapper.selectList(Wrappers.<CompanyCardCollection>lambdaQuery().eq(CompanyCardCollection::getCompanyCardId, companyCardId).eq(CompanyCardCollection::getUserId, SecurityUtils.getUserId()));
|
||||
companyCardCollectionMapper.deleteBatchIds(companyCardCollections.stream().map(CompanyCardCollection::getCompanyCardCollectionId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.mapper.JobMapper;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.CompanyCollectionMapper;
|
||||
import com.ruoyi.cms.domain.CompanyCollection;
|
||||
import com.ruoyi.cms.service.ICompanyCollectionService;
|
||||
|
||||
/**
|
||||
* 用户公司收藏Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class CompanyCollectionServiceImpl extends ServiceImpl<CompanyCollectionMapper,CompanyCollection> implements ICompanyCollectionService
|
||||
{
|
||||
@Autowired
|
||||
private CompanyCollectionMapper companyCollectionMapper;
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
/**
|
||||
* 查询用户公司收藏
|
||||
*
|
||||
* @param id 用户公司收藏主键
|
||||
* @return 用户公司收藏
|
||||
*/
|
||||
@Override
|
||||
public CompanyCollection selectCompanyCollectionById(Long id)
|
||||
{
|
||||
return companyCollectionMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户公司收藏列表
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 用户公司收藏
|
||||
*/
|
||||
@Override
|
||||
public List<CompanyCollection> selectCompanyCollectionList(CompanyCollection companyCollection)
|
||||
{
|
||||
return companyCollectionMapper.selectCompanyCollectionList(companyCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户公司收藏
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCompanyCollection(CompanyCollection companyCollection)
|
||||
{
|
||||
return companyCollectionMapper.insert(companyCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户公司收藏
|
||||
*
|
||||
* @param companyCollection 用户公司收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCompanyCollection(CompanyCollection companyCollection)
|
||||
{
|
||||
return companyCollectionMapper.updateById(companyCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户公司收藏
|
||||
*
|
||||
* @param ids 需要删除的用户公司收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCompanyCollectionByIds(Long[] ids)
|
||||
{
|
||||
return companyCollectionMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
/**
|
||||
* 用户取消收藏公司
|
||||
*/
|
||||
@Override
|
||||
public int companyCancel(Long companyId) {
|
||||
List<CompanyCollection> companyCollections = companyCollectionMapper.selectList(Wrappers.<CompanyCollection>lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, SecurityUtils.getUserId()));
|
||||
if(companyCollections.size()>0){
|
||||
companyCollectionMapper.deleteBatchIds(companyCollections.stream().map(CompanyCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 用户收藏公司
|
||||
*/
|
||||
@Override
|
||||
public int companyCollection(Long companyId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<CompanyCollection> companyCollections = companyCollectionMapper.selectList(Wrappers.<CompanyCollection>lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, userId));
|
||||
if(companyCollections.size()>0){
|
||||
companyCollectionMapper.deleteBatchIds(companyCollections.stream().map(CompanyCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
CompanyCollection companyCollection = new CompanyCollection();
|
||||
companyCollection.setCompanyId(companyId);
|
||||
companyCollection.setUserId(userId);
|
||||
companyCollectionMapper.insert(companyCollection);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Company> collectionCompany() {
|
||||
List<Company> companies = companyCollectionMapper.collectionJob(SecurityUtils.getUserId());
|
||||
return companies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> jobCompany(Long companyId) {
|
||||
Job job = new Job();
|
||||
job.setCompanyId(companyId);
|
||||
job.setIsPublish(1);
|
||||
List<Job> jobs = jobMapper.selectJobList(job);
|
||||
return jobs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.CompanyLabel;
|
||||
import com.ruoyi.cms.mapper.CompanyLabelMapper;
|
||||
import com.ruoyi.cms.service.ICompanyLabelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class CompanyLabelServiceImpl extends ServiceImpl<CompanyLabelMapper, CompanyLabel> implements ICompanyLabelService
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.ICompanyCollectionService;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
|
||||
/**
|
||||
* 公司Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper,Company> implements ICompanyService
|
||||
{
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
@Autowired
|
||||
private CompanyCollectionMapper companyCollectionMapper;
|
||||
@Autowired
|
||||
private CompanyCardMapper companyCardMapper;
|
||||
@Autowired
|
||||
private CompanyLabelMapper companyLabelMapper;
|
||||
/**
|
||||
* 查询公司
|
||||
*
|
||||
* @param companyId 公司主键
|
||||
* @return 公司
|
||||
*/
|
||||
@Override
|
||||
public Company selectCompanyByCompanyId(Long companyId)
|
||||
{
|
||||
Company company = companyMapper.selectById(companyId);
|
||||
if(SecurityUtils.isLogin()){
|
||||
Long l = companyCollectionMapper.selectCount(Wrappers.<CompanyCollection>lambdaQuery().eq(CompanyCollection::getCompanyId, companyId).eq(CompanyCollection::getUserId, SecurityUtils.getUserId()));
|
||||
company.setIsCollection(l>0?1:0);
|
||||
}else {
|
||||
company.setIsCollection(0);
|
||||
}
|
||||
return company;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公司列表
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 公司
|
||||
*/
|
||||
@Override
|
||||
public List<Company> selectCompanyList(Company company)
|
||||
{
|
||||
return companyMapper.selectCompanyList(company);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCompany(Company company)
|
||||
{
|
||||
Long count = companyMapper.selectCount(Wrappers.<Company>lambdaQuery().eq(Company::getName, company.getName()));
|
||||
if(count>0){
|
||||
throw new ServiceException(company.getName()+",该公司已存在");
|
||||
}
|
||||
return companyMapper.insert(company);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司
|
||||
*
|
||||
* @param company 公司
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCompany(Company company)
|
||||
{
|
||||
Long count = companyMapper.selectCount(Wrappers.<Company>lambdaQuery().eq(Company::getName, company.getName()));
|
||||
if(count>1){
|
||||
throw new ServiceException(company.getName()+",该公司已存在");
|
||||
}
|
||||
return companyMapper.updateById(company);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除公司
|
||||
*
|
||||
* @param companyIds 需要删除的公司主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCompanyByCompanyIds(Long[] companyIds)
|
||||
{
|
||||
Long aLong = jobMapper.selectCount(Wrappers.<Job>lambdaQuery().in(Job::getCompanyId, companyIds));
|
||||
if(aLong>0){
|
||||
throw new ServiceException("该公司下存在职位,不能删除");
|
||||
}
|
||||
return companyMapper.deleteBatchIds(Arrays.asList(companyIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公司招聘的岗位数量
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer count(Long companyId) {
|
||||
Integer result = Math.toIntExact(jobMapper.selectCount(Wrappers.<Job>lambdaQuery().eq(Job::getCompanyId, companyId)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateJobCountOfCompany() {
|
||||
companyMapper.updateJobCountOfCompany();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Company> label(CompanyCard companyCard,LabelQuery labelQuery) {
|
||||
List<Company> result = companyMapper.label(companyCard.getCompanyNature(),companyCard.getTarg(),labelQuery.getCompanyName());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public void importLabel() {
|
||||
// 获取所有公司列表
|
||||
List<Company> companyList = companyMapper.selectList(null);
|
||||
|
||||
// 创建用于存储匹配结果的标签列表
|
||||
List<CompanyLabel> labelList = new ArrayList<>();
|
||||
|
||||
// Excel文件路径
|
||||
String filePath = "/home/lapuda/mine_code/backend/2024财富中国500强.xlsx";
|
||||
|
||||
try (InputStream is = new FileInputStream(filePath);
|
||||
Workbook workbook = new XSSFWorkbook(is)) {
|
||||
|
||||
// 获取第一个工作表
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
// 遍历每一行(跳过表头)
|
||||
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
if (row == null) continue;
|
||||
|
||||
// 获取第二列的公司名称
|
||||
Cell cell = row.getCell(1);
|
||||
if (cell == null) continue;
|
||||
|
||||
String companyName = cell.getStringCellValue().trim();
|
||||
|
||||
// 在公司列表中查找匹配的公司
|
||||
companyList.stream()
|
||||
.filter(company -> companyName.equals(company.getName())) // 假设Company类有getName()方法
|
||||
.findFirst()
|
||||
.ifPresent(company -> {
|
||||
// 创建标签对象
|
||||
CompanyLabel label = new CompanyLabel();
|
||||
label.setDictValue("1");
|
||||
label.setCompanyId(company.getCompanyId()); // 假设Company类有getId()方法
|
||||
labelList.add(label);
|
||||
});
|
||||
}
|
||||
|
||||
// 批量保存标签(假设有对应的service或mapper方法)
|
||||
if (!labelList.isEmpty()) {
|
||||
// 这里需要实现批量插入逻辑,例如:
|
||||
// companyLabelService.saveBatch(labelList);
|
||||
// 或者遍历保存
|
||||
for (CompanyLabel label : labelList) {
|
||||
companyLabelMapper.insert(label);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
log.error("导入标签失败", e);
|
||||
throw new RuntimeException("导入标签失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importLabelBank() {
|
||||
List<Company> companyList = companyMapper.selectList(Wrappers.<Company>lambdaQuery().like(Company::getName, "银行"));
|
||||
companyList.forEach(company -> {
|
||||
// 创建标签对象
|
||||
CompanyLabel label = new CompanyLabel();
|
||||
label.setDictValue("3");
|
||||
label.setCompanyId(company.getCompanyId()); // 假设Company类有getId()方法
|
||||
companyLabelMapper.insert(label);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,437 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.AppUser;
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import com.ruoyi.cms.mapper.es.EsJobDocumentMapper;
|
||||
import com.ruoyi.cms.mapper.JobMapper;
|
||||
import com.ruoyi.cms.service.IESJobSearchService;
|
||||
import com.ruoyi.cms.util.Base64Util;
|
||||
import com.ruoyi.cms.util.ListUtil;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper;
|
||||
import org.dromara.easyes.core.conditions.update.LambdaEsUpdateWrapper;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 实体模板Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class ESJobSearchImpl implements IESJobSearchService
|
||||
{
|
||||
@Autowired
|
||||
private EsJobDocumentMapper esJobDocumentMapper;
|
||||
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
|
||||
@Autowired
|
||||
private AppUserServiceImpl appUserService;
|
||||
|
||||
@Autowired
|
||||
private BussinessDictDataServiceImpl bussinessDictDataServicel;
|
||||
Logger logger = LoggerFactory.getLogger(JobServiceImpl.class);
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
// @PostConstruct
|
||||
public void init()
|
||||
{
|
||||
resetTextCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkEsAndFix() {
|
||||
try {
|
||||
esJobDocumentMapper.getIndex();
|
||||
}catch (Exception e){
|
||||
logger.warn("es索引丢失,正在重新刷新");
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置全文检索数据
|
||||
*/
|
||||
//todo 定时任务
|
||||
@Override
|
||||
public void resetTextCache() {
|
||||
logger.info("正在重新刷新es");
|
||||
// 删除并重新创建索引
|
||||
esJobDocumentMapper.deleteIndex("job_document_gt");
|
||||
esJobDocumentMapper.createIndex();
|
||||
|
||||
// 分批次处理数据
|
||||
int batchSize = 1000; // 每批次处理的数据量
|
||||
int offset = 0; // 起始偏移量
|
||||
boolean hasMoreData = true; // 是否还有更多数据
|
||||
|
||||
while (hasMoreData) {
|
||||
// 分页查询数据
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("batchSize", batchSize);
|
||||
params.put("offset", offset*batchSize);
|
||||
List<Job> jobList = jobMapper.selectAllJob(params);
|
||||
|
||||
if (jobList.isEmpty()) {
|
||||
hasMoreData = false; // 没有更多数据,退出循环
|
||||
} else {
|
||||
// 转换数据并插入到 Elasticsearch
|
||||
List<ESJobDocument> esJobDocumentList = new ArrayList<>();
|
||||
for (Job job : jobList) {
|
||||
ESJobDocument esJobDocument = new ESJobDocument();
|
||||
BeanUtils.copyBeanProp(esJobDocument, job);
|
||||
esJobDocument.setAppJobUrl("https://qd.zhaopinzao8dian.com/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
|
||||
if(!StringUtil.isEmptyOrNull(job.getScale())){
|
||||
esJobDocument.setScale(Integer.valueOf(job.getScale()));
|
||||
}else {
|
||||
esJobDocument.setScale(8);
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(job.getExperience())){
|
||||
esJobDocument.setExperience_int(Integer.valueOf(job.getExperience()));
|
||||
}else {
|
||||
esJobDocument.setExperience("8");
|
||||
esJobDocument.setEducation_int(8);
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(job.getEducation())){
|
||||
esJobDocument.setEducation_int(Integer.valueOf(job.getEducation()));
|
||||
}else {
|
||||
esJobDocument.setEducation("11");
|
||||
esJobDocument.setExperience_int(11);
|
||||
}
|
||||
if (esJobDocument.getLatitude() != null) {
|
||||
esJobDocument.setLatAndLon(esJobDocument.getLatitude().toString() + "," + esJobDocument.getLongitude().toString());
|
||||
}
|
||||
if(StringUtil.isEmptyOrNull(job.getCompanyNature())){
|
||||
esJobDocument.setCompanyNature("6");
|
||||
}
|
||||
esJobDocumentList.add(esJobDocument);
|
||||
}
|
||||
|
||||
// 批量插入当前批次的数据
|
||||
esJobDocumentMapper.insertBatch(esJobDocumentList);
|
||||
|
||||
// 更新偏移量
|
||||
offset = offset+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> selectTextListExceptJobId(ESJobSearch esJobSearch, List<Long> jobIds) {
|
||||
|
||||
//查询
|
||||
if(SecurityUtils.isLogin()){
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SecurityUtils.getUserId());
|
||||
if(!ListUtil.isEmptyOrNull(appUser.getJobTitle())&&!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
|
||||
esJobSearch.setJobTitle(String.join(",", appUser.getJobTitle()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(appUser.getEducation())&&!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){
|
||||
esJobSearch.setEducation(appUser.getEducation());
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(appUser.getArea())){
|
||||
esJobSearch.setJobLocationAreaCode(Integer.valueOf(appUser.getArea()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(appUser.getExperience())&&!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
|
||||
esJobSearch.setExperience(appUser.getExperience());
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMax())){
|
||||
esJobSearch.setMaxSalary(Long.valueOf(appUser.getSalaryMax()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMin())){
|
||||
esJobSearch.setMaxSalary(Long.valueOf(appUser.getSalaryMin()));
|
||||
}
|
||||
}
|
||||
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(esJobSearch);
|
||||
if(!ListUtil.isListEmptyOrNull(jobIds)){
|
||||
wrapper.in(ESJobDocument::getJobId, jobIds);
|
||||
}
|
||||
//todo 暂时
|
||||
wrapper.limit(esJobSearch.getPageSize());
|
||||
wrapper.orderByDesc(ESJobDocument::getCompanyId);
|
||||
return esJobDocumentMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public Integer addESJobDocument(ESJobDocument esJobDocument)
|
||||
{
|
||||
return esJobDocumentMapper.insert(esJobDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public Integer updateESJobDocument(ESJobDocument esJobDocument)
|
||||
{
|
||||
|
||||
LambdaEsUpdateWrapper<ESJobDocument> wrapper = new LambdaEsUpdateWrapper<>();
|
||||
wrapper.eq(ESJobDocument::getJobId, esJobDocument.getJobId());
|
||||
return esJobDocumentMapper.update(esJobDocument, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public ESJobDocument getESJobDocument(Long jobId)
|
||||
{
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<ESJobDocument>();
|
||||
wrapper.eq(ESJobDocument::getJobId, jobId);
|
||||
return esJobDocumentMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public void deleteESJobDocument(String ids)
|
||||
{
|
||||
for (Long jobId : Convert.toLongArray(ids))
|
||||
{
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<ESJobDocument>();
|
||||
wrapper.eq(ESJobDocument::getJobId, jobId);
|
||||
esJobDocumentMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> nearJob(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery);
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> countyJobList(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery);
|
||||
if(jobQuery.getCountyIds()!=null){
|
||||
wrapper.and(x->x.in(ESJobDocument::getJobLocationAreaCode,jobQuery.getCountyIds()));
|
||||
}
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> subway(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery);
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> commercialArea(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(jobQuery);
|
||||
if(jobQuery.getLongitude()!=null){
|
||||
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(jobQuery.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(jobQuery.getLatitude().toString()), Double.parseDouble(jobQuery.getLongitude().toString())));
|
||||
}
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> littleVideo(ESJobSearch esJobSearch) {
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
//todo 暂时
|
||||
wrapper.eq(ESJobDocument::getIsExplain, 1);
|
||||
wrapper.orderByDesc(ESJobDocument::getIsExplain);
|
||||
wrapper.limit(esJobSearch.getPageSize());
|
||||
return esJobDocumentMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEs() {
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
esJobDocumentMapper.selectList(wrapper).forEach(esJobDocument -> {
|
||||
esJobDocument.setPostingDate(new Date());
|
||||
this.updateESJobDocument(esJobDocument);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> littleVideoRandom(List<Long> cacheList, Integer count,String jobTitle) {
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
wrapper.eq(ESJobDocument::getIsExplain, 1);
|
||||
if(!ListUtil.isListEmptyOrNull(cacheList)){
|
||||
wrapper.not().in(ESJobDocument::getJobId,cacheList);
|
||||
}
|
||||
if(count==null){
|
||||
count = 1;
|
||||
}
|
||||
if(StringUtil.isEmptyOrNull(jobTitle)){
|
||||
wrapper.or(a -> a.like(ESJobDocument::getJobTitle, jobTitle, 5.0f)
|
||||
.or()
|
||||
.like(ESJobDocument::getDescription, jobTitle, 1.0f)
|
||||
);
|
||||
}
|
||||
wrapper.limit(count);
|
||||
return esJobDocumentMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
private LambdaEsQueryWrapper<ESJobDocument> getWrapper(ESJobSearch esJobSearch){
|
||||
List<String> searchList = new ArrayList<>();
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
|
||||
searchList.add(esJobSearch.getJobTitle());
|
||||
}else {
|
||||
if(SecurityUtils.isLogin()){
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SecurityUtils.getUserId());
|
||||
List<String> jobTitleList = appUser.getJobTitle();
|
||||
if(!jobTitleList.isEmpty()){
|
||||
searchList.addAll(jobTitleList);
|
||||
}
|
||||
}
|
||||
}
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
if (!searchList.isEmpty())
|
||||
{
|
||||
for (String keyWords:searchList){
|
||||
wrapper.or(a -> a.like(ESJobDocument::getJobTitle, keyWords, 5.0f)
|
||||
.or()
|
||||
.like(ESJobDocument::getDescription, keyWords, 1.0f)
|
||||
);
|
||||
}
|
||||
}
|
||||
if(esJobSearch.getLongitude()!=null){
|
||||
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(esJobSearch.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(esJobSearch.getLatitude().toString()), Double.parseDouble(esJobSearch.getLongitude().toString())));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){
|
||||
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getEducation());
|
||||
wrapper.and(x->x.le(ESJobDocument::getEducation_int,maxValue));
|
||||
}
|
||||
if(Objects.nonNull(esJobSearch.getMaxSalary())){
|
||||
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,esJobSearch.getMaxSalary()));
|
||||
}
|
||||
if(Objects.nonNull(esJobSearch.getMinSalary())){
|
||||
wrapper.and(x->x.ge(ESJobDocument::getMinSalary,esJobSearch.getMinSalary()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
|
||||
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
|
||||
wrapper.and(x->x.le(ESJobDocument::getExperience_int,maxValue));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
|
||||
wrapper.and(x->x.eq(ESJobDocument::getJobCategory,esJobSearch.getJobCategory()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){
|
||||
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale());
|
||||
wrapper.and(x->x.le(ESJobDocument::getScale,maxValue));
|
||||
}
|
||||
if(Objects.nonNull(esJobSearch.getOrder())){
|
||||
if(esJobSearch.getOrder()==1){
|
||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||
}
|
||||
if(esJobSearch.getOrder()==2){
|
||||
wrapper.orderByDesc(ESJobDocument::getPostingDate);
|
||||
}
|
||||
}
|
||||
//TODO LIST
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
//todo 存储用户搜索
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> appList(ESJobSearch jobQuery) {
|
||||
Integer pageNum = jobQuery.getCurrent();
|
||||
Integer pageSize = jobQuery.getPageSize();
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getJobTitle())){
|
||||
wrapper.and(a->a.match(ESJobDocument::getJobTitle,jobQuery.getJobTitle(),5.0f)
|
||||
.or()
|
||||
.match(ESJobDocument::getDescription,jobQuery.getJobTitle(),1.0f));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getEducation())){
|
||||
wrapper.and(a->a.le(ESJobDocument::getEducation,jobQuery.getEducation()));
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getExperience())){
|
||||
wrapper.and(a->a.le(ESJobDocument::getExperience,jobQuery.getExperience()));
|
||||
}
|
||||
if(Objects.nonNull(jobQuery.getMaxSalary())){
|
||||
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,jobQuery.getMaxSalary()));
|
||||
}
|
||||
if(Objects.nonNull(jobQuery.getMinSalary())){
|
||||
wrapper.and(x->x.ge(ESJobDocument::getMinSalary,jobQuery.getMinSalary()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getScaleDictCode())){
|
||||
wrapper.and(a->a.eq(ESJobDocument::getScaleDictCode,jobQuery.getScaleDictCode()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getIndustry())){
|
||||
wrapper.and(a->a.eq(ESJobDocument::getIndustry,jobQuery.getIndustry()));
|
||||
}
|
||||
if(jobQuery.getLongitude()!=null){
|
||||
wrapper.geoDistance(ESJobDocument::getLatAndLon,Double.valueOf(jobQuery.getRadius()), DistanceUnit.KILOMETERS,new GeoPoint(Double.parseDouble(jobQuery.getLatitude().toString()), Double.parseDouble(jobQuery.getLongitude().toString())));
|
||||
}
|
||||
if(jobQuery.getJobLocationAreaCode()!=null){
|
||||
wrapper.and(a->a.eq(ESJobDocument::getJobLocationAreaCode,jobQuery.getJobLocationAreaCode()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getScale())){
|
||||
wrapper.and(a->a.eq(ESJobDocument::getScale,jobQuery.getScale()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getSearchValue())){
|
||||
wrapper.and(a->a.match(ESJobDocument::getDescription,jobQuery.getSearchValue(),4.0f));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(jobQuery.getCompanyNature())){
|
||||
wrapper.and(a->a.eq(ESJobDocument::getCompanyNature,jobQuery.getCompanyNature()));
|
||||
}
|
||||
if(Objects.nonNull(jobQuery.getOrder())){
|
||||
if (jobQuery.getOrder()==2){
|
||||
wrapper.orderByDesc(ESJobDocument::getPostingDate);
|
||||
}
|
||||
if (jobQuery.getOrder()==1){
|
||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||
wrapper.orderByDesc(ESJobDocument::getApplyNum);
|
||||
wrapper.orderByDesc(ESJobDocument::getView);
|
||||
}
|
||||
}
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ESJobDocument selectById(Long jobId) {
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
wrapper.eq(ESJobDocument::getJobId,jobId);
|
||||
return esJobDocumentMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fix() {
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
wrapper.eq(ESJobDocument::getIsExplain,1);
|
||||
List<ESJobDocument> esJobDocuments = esJobDocumentMapper.selectList(wrapper);
|
||||
for (ESJobDocument esJobDocument : esJobDocuments) {
|
||||
Job job = new Job();
|
||||
BeanUtils.copyProperties(esJobDocument,job);
|
||||
jobMapper.insert(job);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.FairCollection;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
import com.ruoyi.cms.mapper.FairCollectionMapper;
|
||||
import com.ruoyi.cms.mapper.JobFairMapper;
|
||||
import com.ruoyi.cms.service.IFairCollectionService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户招聘会收藏Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class FairCollectionServiceImpl extends ServiceImpl<FairCollectionMapper, FairCollection> implements IFairCollectionService
|
||||
{
|
||||
@Autowired
|
||||
private FairCollectionMapper fairCollectionMapper;
|
||||
@Autowired
|
||||
private JobFairMapper jobFairMapper;
|
||||
/**
|
||||
* 查询用户招聘会收藏
|
||||
*
|
||||
* @param id 用户招聘会收藏主键
|
||||
* @return 用户招聘会收藏
|
||||
*/
|
||||
@Override
|
||||
public FairCollection selectFairCollectionById(Long id)
|
||||
{
|
||||
return fairCollectionMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户招聘会收藏列表
|
||||
*
|
||||
* @param fairCollection 用户招聘会收藏
|
||||
* @return 用户招聘会收藏
|
||||
*/
|
||||
@Override
|
||||
public List<FairCollection> selectFairCollectionList(FairCollection fairCollection)
|
||||
{
|
||||
List<FairCollection> fairCollections = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getUserId, SecurityUtils.getUserId()));
|
||||
return fairCollections;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户招聘会收藏
|
||||
*
|
||||
* @param fairCollection 用户招聘会收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFairCollection(FairCollection fairCollection)
|
||||
{
|
||||
return fairCollectionMapper.insert(fairCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户招聘会收藏
|
||||
*
|
||||
* @param fairCollection 用户招聘会收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFairCollection(FairCollection fairCollection)
|
||||
{
|
||||
return fairCollectionMapper.updateById(fairCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户招聘会收藏
|
||||
*
|
||||
* @param ids 需要删除的用户招聘会收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFairCollectionByIds(Long[] ids)
|
||||
{
|
||||
return fairCollectionMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
/**
|
||||
* 用户收藏招聘会
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int fairCollection(Long fairId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<FairCollection> fairCollections = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getFairId, fairId).eq(FairCollection::getUserId, userId));
|
||||
if(fairCollections.size()>0){
|
||||
fairCollectionMapper.deleteBatchIds(fairCollections.stream().map(FairCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
FairCollection fairCollection = new FairCollection();
|
||||
fairCollection.setFairId(fairId);
|
||||
fairCollection.setUserId(userId);
|
||||
fairCollectionMapper.insert(fairCollection);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 用户取消收藏招聘会
|
||||
*/
|
||||
@Override
|
||||
public int cancel(Long fairId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<FairCollection> fairCollections = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getFairId, fairId).eq(FairCollection::getUserId, userId));
|
||||
if(fairCollections.size()>0){
|
||||
fairCollectionMapper.deleteBatchIds(fairCollections.stream().map(FairCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 用户收藏招聘会列表
|
||||
*/
|
||||
@Override
|
||||
public List<JobFair> appCollectionFair(Integer type) {
|
||||
return jobFairMapper.selectAppList(SecurityUtils.getUserId(),type);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.FairCompanyMapper;
|
||||
import com.ruoyi.cms.domain.FairCompany;
|
||||
import com.ruoyi.cms.service.IFairCompanyService;
|
||||
|
||||
/**
|
||||
* 公司招聘会关联Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class FairCompanyServiceImpl extends ServiceImpl<FairCompanyMapper,FairCompany> implements IFairCompanyService
|
||||
{
|
||||
@Autowired
|
||||
private FairCompanyMapper fairCompanyMapper;
|
||||
|
||||
/**
|
||||
* 查询公司招聘会关联
|
||||
*
|
||||
* @param id 公司招聘会关联主键
|
||||
* @return 公司招聘会关联
|
||||
*/
|
||||
@Override
|
||||
public FairCompany selectFairCompanyById(Long id)
|
||||
{
|
||||
return fairCompanyMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公司招聘会关联列表
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 公司招聘会关联
|
||||
*/
|
||||
@Override
|
||||
public List<FairCompany> selectFairCompanyList(FairCompany fairCompany)
|
||||
{
|
||||
return fairCompanyMapper.selectFairCompanyList(fairCompany);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司招聘会关联
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFairCompany(FairCompany fairCompany)
|
||||
{
|
||||
return fairCompanyMapper.insert(fairCompany);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司招聘会关联
|
||||
*
|
||||
* @param fairCompany 公司招聘会关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFairCompany(FairCompany fairCompany)
|
||||
{
|
||||
return fairCompanyMapper.updateById(fairCompany);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公司招聘会关联
|
||||
*
|
||||
* @param ids 需要删除的公司招聘会关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFairCompanyByIds(Long[] ids)
|
||||
{
|
||||
return fairCompanyMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import com.ruoyi.cms.domain.File;
|
||||
import com.ruoyi.cms.mapper.FileMapper;
|
||||
import com.ruoyi.cms.service.IFileService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件Service业务层处理
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-03-18
|
||||
*/
|
||||
@Service
|
||||
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IFileService
|
||||
{
|
||||
@Autowired
|
||||
private FileMapper fileMapper;
|
||||
@Value("${file.upload-dir}")
|
||||
private String uploadDir;
|
||||
/**
|
||||
* 查询文件
|
||||
*
|
||||
* @param id 文件主键
|
||||
* @return 文件
|
||||
*/
|
||||
@Override
|
||||
public File selectFileById(Long id)
|
||||
{
|
||||
return fileMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件列表
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 文件
|
||||
*/
|
||||
@Override
|
||||
public List<File> selectFileList(File file)
|
||||
{
|
||||
return fileMapper.selectFileList(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFile(File file)
|
||||
{
|
||||
return fileMapper.insert(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFile(File file)
|
||||
{
|
||||
return fileMapper.updateById(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文件
|
||||
*
|
||||
* @param ids 需要删除的文件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFileByIds(Long[] ids)
|
||||
{
|
||||
return fileMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult uploadFile(MultipartFile file, Long bussinessId) {
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("文件为空,请选择文件上传");
|
||||
}
|
||||
|
||||
try {
|
||||
// 创建上传目录
|
||||
java.io.File dir = new java.io.File(uploadDir);
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
// 生成唯一的文件名
|
||||
String fileName = UUID.randomUUID().toString() + "_" + file.getOriginalFilename();
|
||||
Path filePath = Paths.get(uploadDir, fileName);
|
||||
|
||||
// 保存文件到服务器
|
||||
Files.copy(file.getInputStream(), filePath);
|
||||
|
||||
// 保存文件信息到数据库
|
||||
saveFileInfo(fileName, bussinessId);
|
||||
|
||||
return AjaxResult.success("http://39.98.44.136/file/"+fileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("文件上传失败");
|
||||
}
|
||||
}
|
||||
private void saveFileInfo(String fileName, Long bussinessId) {
|
||||
// 这里假设你已经有了一个FileService来处理数据库操作
|
||||
File file = new File();
|
||||
file.setBussinessId(bussinessId);
|
||||
file.setFileUrl(fileName);
|
||||
this.save(file);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.util.IndustryUtils;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.Industry;
|
||||
import com.ruoyi.common.core.domain.entity.Industry;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.IndustryMapper;
|
||||
import com.ruoyi.cms.service.IIndustryService;
|
||||
|
||||
/**
|
||||
* 行业Service业务层处理
|
||||
*
|
||||
* @author LishunDong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Service
|
||||
public class IndustryServiceImpl extends ServiceImpl<IndustryMapper,Industry> implements IIndustryService
|
||||
{
|
||||
@Autowired
|
||||
private IndustryMapper industryMapper;
|
||||
|
||||
/**
|
||||
* 查询行业
|
||||
*
|
||||
* @param industryId 行业主键
|
||||
* @return 行业
|
||||
*/
|
||||
@Override
|
||||
public Industry selectIndustryByIndustryId(Long industryId)
|
||||
{
|
||||
return industryMapper.selectById(industryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行业列表
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 行业
|
||||
*/
|
||||
@Override
|
||||
public List<Industry> selectIndustryList(Industry industry)
|
||||
{
|
||||
return industryMapper.selectIndustryList(industry);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行业
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertIndustry(Industry industry)
|
||||
{
|
||||
int insert = industryMapper.insert(industry);
|
||||
if(insert>0){
|
||||
removeIndustryCache();
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行业
|
||||
*
|
||||
* @param industry 行业
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateIndustry(Industry industry)
|
||||
{
|
||||
int i = industryMapper.updateById(industry);
|
||||
if(i>0){
|
||||
removeIndustryCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除行业
|
||||
*
|
||||
* @param industryIds 需要删除的行业主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteIndustryByIndustryIds(Long[] industryIds)
|
||||
{
|
||||
int i = industryMapper.deleteBatchIds(Arrays.asList(industryIds));
|
||||
if(i>0){
|
||||
removeIndustryCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelect> buildIndustryTreeSelect(List<Industry> industryList) {
|
||||
List<Industry> industryTree = buildIndustryTree(industryList);
|
||||
return industryTree.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Industry> buildIndustryTree(List<Industry> industryList) {
|
||||
List<Industry> returnList = new ArrayList<Industry>();
|
||||
List<Long> tempList = industryList.stream().map(Industry::getIndustryId).collect(Collectors.toList());
|
||||
for (Iterator<Industry> iterator = industryList.iterator(); iterator.hasNext();)
|
||||
{
|
||||
Industry industry = (Industry) iterator.next();
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(industry.getParentId()))
|
||||
{
|
||||
recursionFn(industryList, industry);
|
||||
returnList.add(industry);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = industryList;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private void recursionFn(List<Industry> list, Industry t)
|
||||
{
|
||||
// 得到子节点列表
|
||||
List<Industry> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (Industry tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<Industry> getChildList(List<Industry> list, Industry t)
|
||||
{
|
||||
List<Industry> tlist = new ArrayList<Industry>();
|
||||
Iterator<Industry> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Industry n = (Industry) it.next();
|
||||
if (n.getParentId().longValue() == t.getIndustryId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<Industry> list, Industry t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildByIndustryId(Long industryId) {
|
||||
return industryMapper.selectCount(Wrappers.<Industry>lambdaQuery().eq(Industry::getParentId, industryId))>0;
|
||||
}
|
||||
public static void removeIndustryCache()
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).deleteObject(CommonConstant.JOB_TITLE);
|
||||
}
|
||||
|
||||
public static void setIndustryCache(List<TreeSelect> industryCache)
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(CommonConstant.JOB_TITLE, industryCache);
|
||||
}
|
||||
|
||||
public static List<TreeSelect> getIndustryCache()
|
||||
{
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(CommonConstant.JOB_TITLE);
|
||||
if (StringUtils.isNotNull(arrayCache))
|
||||
{
|
||||
return arrayCache.toList(TreeSelect.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public List<TreeSelect> appIndustry() {
|
||||
List<TreeSelect> industryCache = getIndustryCache();
|
||||
if(Objects.isNull(industryCache))
|
||||
{
|
||||
List<Industry> jobTitleList = this.selectIndustryList(null);
|
||||
return this.buildIndustryTreeSelect(jobTitleList);
|
||||
}
|
||||
return industryCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importData() {
|
||||
// 读取 Excel 并构建树结构
|
||||
List<Industry> industries = IndustryUtils.readExcel("D:\\indus.xlsx");
|
||||
|
||||
// 存储到数据库
|
||||
this.saveIndustries(industries);
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储 Industry 列表到数据库
|
||||
*/
|
||||
public void saveIndustries(List<Industry> industries) {
|
||||
for (Industry industry : industries) {
|
||||
saveIndustryRecursive(industry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归存储 Industry
|
||||
*/
|
||||
private void saveIndustryRecursive(Industry industry) {
|
||||
industryMapper.insert(industry); // 存储当前节点
|
||||
for (Industry child : industry.getChildren()) {
|
||||
saveIndustryRecursive(child); // 递归存储子节点
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.FairCollection;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.query.MineJobQuery;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.IJobApplyService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位申请Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> implements IJobApplyService
|
||||
{
|
||||
@Autowired
|
||||
private JobApplyMapper jobApplyMapper;
|
||||
@Autowired
|
||||
private JobCollectionMapper jobCollectionMapper;
|
||||
@Autowired
|
||||
private AppReviewJobMapper appReviewJobMapper;
|
||||
@Autowired
|
||||
private FairCollectionMapper fairCollectionMapper;
|
||||
@Autowired
|
||||
private CompanyCollectionMapper companyCollectionMapper;
|
||||
|
||||
/**
|
||||
* 查询岗位申请
|
||||
*
|
||||
* @param id 岗位申请主键
|
||||
* @return 岗位申请
|
||||
*/
|
||||
@Override
|
||||
public JobApply selectJobApplyById(Long id)
|
||||
{
|
||||
return jobApplyMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位申请列表
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 岗位申请
|
||||
*/
|
||||
@Override
|
||||
public List<JobApply> selectJobApplyList(JobApply jobApply)
|
||||
{
|
||||
return jobApplyMapper.selectJobApplyList(jobApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位申请
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertJobApply(JobApply jobApply)
|
||||
{
|
||||
return jobApplyMapper.insert(jobApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位申请
|
||||
*
|
||||
* @param jobApply 岗位申请
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJobApply(JobApply jobApply)
|
||||
{
|
||||
return jobApplyMapper.updateById(jobApply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除岗位申请
|
||||
*
|
||||
* @param ids 需要删除的岗位申请主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobApplyByIds(Long[] ids)
|
||||
{
|
||||
return jobApplyMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> applyJob() {
|
||||
List<Job> jobs = jobApplyMapper.applyJob(SecurityUtils.getUserId());
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Integer> statistics() {
|
||||
Integer applyCount = jobApplyMapper.applyJob(SecurityUtils.getUserId()).size();
|
||||
Integer collectionJobCount = jobCollectionMapper.collectionJob(SecurityUtils.getUserId()).size();
|
||||
Integer collectionCompanyCount = companyCollectionMapper.collectionJob(SecurityUtils.getUserId()).size();
|
||||
Integer jobReviewCount = appReviewJobMapper.review(SecurityUtils.getUserId(),new MineJobQuery()).size();
|
||||
Integer fairCollecitonCount = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getUserId, SecurityUtils.getUserId())).size();
|
||||
HashMap<String, Integer> map = new HashMap<>();
|
||||
map.put("applyCount", applyCount);
|
||||
map.put("collectionCount", collectionJobCount+collectionCompanyCount);
|
||||
map.put("jobReviewCount", jobReviewCount);
|
||||
map.put("fairCollecitonCount", fairCollecitonCount);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.AppUser;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.mapper.AppUserMapper;
|
||||
import com.ruoyi.cms.mapper.JobApplyMapper;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.JobCollectionMapper;
|
||||
import com.ruoyi.cms.domain.JobCollection;
|
||||
import com.ruoyi.cms.service.IJobCollectionService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户岗位收藏Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class JobCollectionServiceImpl extends ServiceImpl<JobCollectionMapper,JobCollection> implements IJobCollectionService
|
||||
{
|
||||
@Autowired
|
||||
private JobCollectionMapper jobCollectionMapper;
|
||||
@Autowired
|
||||
private JobApplyMapper jobApplyMapper;
|
||||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
/**
|
||||
* 查询用户岗位收藏
|
||||
*
|
||||
* @param id 用户岗位收藏主键
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
@Override
|
||||
public JobCollection selectJobCollectionById(Long id)
|
||||
{
|
||||
return jobCollectionMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户岗位收藏列表
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
@Override
|
||||
public List<JobCollection> selectJobCollectionList(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.selectJobCollectionList(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertJobCollection(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.insert(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJobCollection(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.updateById(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位收藏
|
||||
*
|
||||
* @param ids 需要删除的用户岗位收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobCollectionByIds(Long[] ids)
|
||||
{
|
||||
return jobCollectionMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
/**
|
||||
* 用户收藏岗位
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int jobCollection(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<JobCollection> jobCollections = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery().eq(JobCollection::getJobId, jobId).eq(JobCollection::getUserId, userId));
|
||||
if(jobCollections.size()>0){
|
||||
jobCollectionMapper.deleteBatchIds(jobCollections.stream().map(JobCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
JobCollection jobCollection = new JobCollection();
|
||||
jobCollection.setJobId(jobId);
|
||||
jobCollection.setUserId(userId);
|
||||
jobCollectionMapper.insert(jobCollection);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 用户取消收藏岗位
|
||||
*/
|
||||
@Override
|
||||
public int cancel(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<JobCollection> jobCollections = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery().eq(JobCollection::getJobId, jobId).eq(JobCollection::getUserId, userId));
|
||||
if(jobCollections.size()>0){
|
||||
jobCollectionMapper.deleteBatchIds(jobCollections.stream().map(JobCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int apply(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
JobApply jobApply = new JobApply();
|
||||
jobApply.setJobId(jobId);
|
||||
jobApply.setUserId(userId);
|
||||
//todo 计算匹配度
|
||||
jobApply.setMatchingDegree(1L);
|
||||
List<JobApply> jobApplies = jobApplyMapper.selectList(Wrappers.<JobApply>lambdaQuery().eq(JobApply::getJobId, jobId).eq(JobApply::getUserId, userId));
|
||||
if(jobApplies.size()>0){
|
||||
List<Long> ids = jobApplies.stream().map(JobApply::getId).collect(Collectors.toList());
|
||||
jobApplyMapper.deleteBatchIds(ids);
|
||||
}
|
||||
jobApplyMapper.insert(jobApply);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> collectionJob() {
|
||||
List<Job> jobs = jobCollectionMapper.collectionJob(SecurityUtils.getUserId());
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String competitiveness(Long jobId) {
|
||||
AppUser appUser = appUserMapper.selectById(SecurityUtils.getUserId());
|
||||
String education = appUser.getEducation();
|
||||
return "90.5";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.mapper.CompanyMapper;
|
||||
import com.ruoyi.cms.mapper.FairCollectionMapper;
|
||||
import com.ruoyi.cms.mapper.FairCompanyMapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.JobFairMapper;
|
||||
import com.ruoyi.cms.service.IJobFairService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 招聘会信息Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class JobFairServiceImpl extends ServiceImpl<JobFairMapper,JobFair> implements IJobFairService
|
||||
{
|
||||
@Autowired
|
||||
private JobFairMapper jobFairMapper;
|
||||
@Autowired
|
||||
private FairCompanyMapper fairCompanyMapper;
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
@Autowired
|
||||
private FairCollectionMapper fairCollectionMapper;
|
||||
/**
|
||||
* 查询招聘会信息
|
||||
*
|
||||
* @param jobFairId 招聘会信息主键
|
||||
* @return 招聘会信息
|
||||
*/
|
||||
@Override
|
||||
public JobFair selectJobFairByJobFairId(Long jobFairId)
|
||||
{
|
||||
JobFair jobFair = jobFairMapper.selectById(jobFairId);
|
||||
if(Objects.isNull(jobFair)){
|
||||
throw new ServiceException("招聘会不存在");
|
||||
}
|
||||
//查询公司信息
|
||||
List<FairCompany> fairCompanies = fairCompanyMapper.selectList(Wrappers.<FairCompany>lambdaQuery().eq(FairCompany::getJobFairId, jobFairId));
|
||||
if(fairCompanies.size()>0){
|
||||
List<Long> companyIds = fairCompanies.stream().map(FairCompany::getCompanyId).collect(Collectors.toList());
|
||||
List<Company> companyList = companyMapper.selectBatchIds(companyIds);
|
||||
jobFair.setCompanyList(companyList);
|
||||
}
|
||||
return jobFair;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询招聘会信息列表
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 招聘会信息
|
||||
*/
|
||||
@Override
|
||||
public List<JobFair> selectJobFairList(JobFair jobFair)
|
||||
{
|
||||
return jobFairMapper.selectJobFairList(jobFair);
|
||||
}
|
||||
/**
|
||||
* 新增招聘会信息
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertJobFair(JobFair jobFair)
|
||||
{
|
||||
int insert = jobFairMapper.insert(jobFair);
|
||||
if(insert>0){
|
||||
jobFair.getCompanyList().forEach(x -> {
|
||||
FairCompany fairCompany = new FairCompany();
|
||||
fairCompany.setCompanyId(x.getCompanyId());
|
||||
fairCompany.setJobFairId(jobFair.getJobFairId());
|
||||
fairCompanyMapper.insert(fairCompany);
|
||||
});
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改招聘会信息
|
||||
*
|
||||
* @param jobFair 招聘会信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateJobFair(JobFair jobFair)
|
||||
{
|
||||
int i = jobFairMapper.updateById(jobFair);
|
||||
if(i>0){
|
||||
fairCompanyMapper.update(null,Wrappers.<FairCompany>lambdaUpdate()
|
||||
.eq(FairCompany::getJobFairId, jobFair.getJobFairId())
|
||||
.set(FairCompany::getDelFlag, Constants.Del_FLAG_DELETE));
|
||||
if(Objects.isNull(jobFair.getCompanyList())){return i;}
|
||||
jobFair.getCompanyList().forEach(x -> {
|
||||
FairCompany fairCompany = new FairCompany();
|
||||
fairCompany.setCompanyId(x.getCompanyId());
|
||||
fairCompany.setJobFairId(jobFair.getJobFairId());
|
||||
fairCompanyMapper.insert(fairCompany);
|
||||
});
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除招聘会信息
|
||||
*
|
||||
* @param jobFairIds 需要删除的招聘会信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobFairByJobFairIds(Long[] jobFairIds)
|
||||
{
|
||||
int i = jobFairMapper.deleteBatchIds(Arrays.asList(jobFairIds));
|
||||
if(i>0){
|
||||
fairCompanyMapper.update(null,Wrappers.<FairCompany>lambdaUpdate()
|
||||
.in(FairCompany::getJobFairId, Arrays.asList(jobFairIds))
|
||||
.set(FairCompany::getDelFlag, Constants.Del_FLAG_DELETE));
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobFair appDetail(Long fairId) {
|
||||
JobFair jobFair = jobFairMapper.selectById(fairId);
|
||||
if(Objects.isNull(jobFair)){
|
||||
throw new ServiceException("招聘会不存在");
|
||||
}
|
||||
//查询公司信息
|
||||
List<FairCompany> fairCompanies = fairCompanyMapper.selectList(Wrappers.<FairCompany>lambdaQuery().eq(FairCompany::getJobFairId, fairId));
|
||||
if(fairCompanies.size()>0){
|
||||
List<Long> companyIds = fairCompanies.stream().map(FairCompany::getCompanyId).collect(Collectors.toList());
|
||||
List<Company> companyList = companyMapper.selectBatchIds(companyIds);
|
||||
jobFair.setCompanyList(companyList);
|
||||
}
|
||||
if(SecurityUtils.isLogin()){
|
||||
Long count = fairCollectionMapper.selectCount(Wrappers.<FairCollection>lambdaQuery().eq(FairCollection::getFairId, fairId).eq(FairCollection::getUserId, SecurityUtils.getUserId()));
|
||||
jobFair.setIsCollection(count>0?1:null);
|
||||
}
|
||||
return jobFair;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobFair> appList(JobFair jobFair) {
|
||||
List<JobFair> fairCompanies = jobFairMapper.appList(jobFair);
|
||||
if(fairCompanies.isEmpty()){return new ArrayList<>();}
|
||||
if(SecurityUtils.isLogin()){
|
||||
//收藏
|
||||
Set<Long> collectionIds = fairCollectionMapper.selectList(Wrappers.<FairCollection>lambdaQuery()
|
||||
.eq(FairCollection::getUserId, SecurityUtils.getUserId())
|
||||
.in(FairCollection::getFairId, fairCompanies.stream().map(JobFair::getJobFairId).collect(Collectors.toList())))
|
||||
.stream().map(FairCollection::getFairId).collect(Collectors.toSet());
|
||||
for (JobFair j : fairCompanies) {
|
||||
if (collectionIds.contains(j.getJobFairId())) {
|
||||
j.setIsCollection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fairCompanies;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.AppUser;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.JobCollection;
|
||||
import com.ruoyi.cms.mapper.AppUserMapper;
|
||||
import com.ruoyi.cms.mapper.JobApplyMapper;
|
||||
import com.ruoyi.cms.mapper.JobCollectionMapper;
|
||||
import com.ruoyi.cms.service.IJobCollectionService;
|
||||
import com.ruoyi.cms.service.IJobRecommentService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户岗位收藏Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class JobRecommentServiceImpl extends ServiceImpl<JobCollectionMapper,JobCollection> implements IJobRecommentService
|
||||
{
|
||||
@Autowired
|
||||
private JobCollectionMapper jobCollectionMapper;
|
||||
@Autowired
|
||||
private JobApplyMapper jobApplyMapper;
|
||||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
/**
|
||||
* 查询用户岗位收藏
|
||||
*
|
||||
* @param id 用户岗位收藏主键
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
@Override
|
||||
public JobCollection selectJobCollectionById(Long id)
|
||||
{
|
||||
return jobCollectionMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户岗位收藏列表
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 用户岗位收藏
|
||||
*/
|
||||
@Override
|
||||
public List<JobCollection> selectJobCollectionList(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.selectJobCollectionList(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertJobCollection(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.insert(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户岗位收藏
|
||||
*
|
||||
* @param jobCollection 用户岗位收藏
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJobCollection(JobCollection jobCollection)
|
||||
{
|
||||
return jobCollectionMapper.updateById(jobCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户岗位收藏
|
||||
*
|
||||
* @param ids 需要删除的用户岗位收藏主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobCollectionByIds(Long[] ids)
|
||||
{
|
||||
return jobCollectionMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
/**
|
||||
* 用户收藏岗位
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int jobCollection(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<JobCollection> jobCollections = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery().eq(JobCollection::getJobId, jobId).eq(JobCollection::getUserId, userId));
|
||||
if(jobCollections.size()>0){
|
||||
jobCollectionMapper.deleteBatchIds(jobCollections.stream().map(JobCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
JobCollection jobCollection = new JobCollection();
|
||||
jobCollection.setJobId(jobId);
|
||||
jobCollection.setUserId(userId);
|
||||
jobCollectionMapper.insert(jobCollection);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* 用户取消收藏岗位
|
||||
*/
|
||||
@Override
|
||||
public int cancel(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<JobCollection> jobCollections = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery().eq(JobCollection::getJobId, jobId).eq(JobCollection::getUserId, userId));
|
||||
if(jobCollections.size()>0){
|
||||
jobCollectionMapper.deleteBatchIds(jobCollections.stream().map(JobCollection::getId).collect(Collectors.toList()));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int apply(Long jobId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
JobApply jobApply = new JobApply();
|
||||
jobApply.setJobId(jobId);
|
||||
jobApply.setUserId(userId);
|
||||
//todo 计算匹配度
|
||||
jobApply.setMatchingDegree(1L);
|
||||
List<JobApply> jobApplies = jobApplyMapper.selectList(Wrappers.<JobApply>lambdaQuery().eq(JobApply::getJobId, jobId).eq(JobApply::getUserId, userId));
|
||||
if(jobApplies.size()>0){
|
||||
List<Long> ids = jobApplies.stream().map(JobApply::getId).collect(Collectors.toList());
|
||||
jobApplyMapper.deleteBatchIds(ids);
|
||||
}
|
||||
jobApplyMapper.insert(jobApply);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Job> collectionJob() {
|
||||
List<Job> jobs = jobCollectionMapper.collectionJob(SecurityUtils.getUserId());
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String competitiveness(Long jobId) {
|
||||
AppUser appUser = appUserMapper.selectById(SecurityUtils.getUserId());
|
||||
String education = appUser.getEducation();
|
||||
return "90.5";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,885 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.cms.util.*;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
/**
|
||||
* 岗位Service业务层处理
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@Service
|
||||
public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobService
|
||||
{
|
||||
@Autowired
|
||||
private JobMapper jobMapper;
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
@Autowired
|
||||
private JobApplyMapper jobApplyMapper;
|
||||
@Autowired
|
||||
private JobCollectionMapper jobCollectionMapper;
|
||||
@Autowired
|
||||
private AppReviewJobMapper appReviewJobMapper;
|
||||
@Autowired
|
||||
private IBussinessDictTypeService iBussinessDictTypeService;
|
||||
@Autowired
|
||||
private IBussinessDictDataService iBussinessDictDataService;
|
||||
@Autowired
|
||||
private IIndustryService industryService;
|
||||
@Autowired
|
||||
private IESJobSearchService iesJobSearchService;
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
Logger logger = LoggerFactory.getLogger(JobServiceImpl.class);
|
||||
// 高德API配置
|
||||
private static final String API_KEY = "32edd506a411de754d34a0f4ecb72345";
|
||||
private static final String AMAP_URL = "https://restapi.amap.com/v3/place/text";
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 更新工作地址的经纬度信息
|
||||
*/
|
||||
public void updateJobLon() {
|
||||
System.out.println("开始执行工作地址经纬度更新...");
|
||||
|
||||
// 1. 查询需要更新经纬度的工作地址
|
||||
List<Job> jobs = jobMapper.selectList(
|
||||
Wrappers.<Job>lambdaQuery()
|
||||
.isNull(Job::getLongitude) // 查询经度为null的记录
|
||||
.or()
|
||||
.eq(Job::getLongitude, BigDecimal.ZERO) // 或者经度为0的记录
|
||||
// 限制每次处理10条
|
||||
);
|
||||
|
||||
if (jobs.isEmpty()) {
|
||||
System.out.println("没有需要更新经纬度的工作地址");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 遍历处理每个工作地址
|
||||
for (Job job : jobs) {
|
||||
try {
|
||||
System.out.println("\n正在处理工作ID: " + job.getJobId() +
|
||||
", 地址: " + job.getJobLocation());
|
||||
|
||||
// 调用高德API获取经纬度(添加适当延迟)
|
||||
TimeUnit.MILLISECONDS.sleep(500);
|
||||
Map<String, BigDecimal> coordinates = getCoordinates(job.getJobLocation(), "青岛市");
|
||||
|
||||
if (coordinates != null) {
|
||||
// 3. 更新工作记录的经纬度
|
||||
job.setLongitude(coordinates.get("lng"));
|
||||
job.setLatitude(coordinates.get("lat"));
|
||||
|
||||
// 使用MyBatis Plus的update方法
|
||||
jobMapper.updateById(job);
|
||||
System.out.println("成功更新工作ID: " + job.getJobId() +
|
||||
" 的经纬度 -> 经度: " + job.getLongitude() +
|
||||
", 纬度: " + job.getLatitude());
|
||||
} else {
|
||||
System.out.println("无法获取工作地址的经纬度: " + job.getJobLocation());
|
||||
jobMapper.updateById(job);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("处理工作ID " + job.getJobId() + " 时出错: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("工作地址经纬度更新完成,共处理 " + jobs.size() + " 条记录");
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用高德地图API获取地址的经纬度并返回BigDecimal
|
||||
*/
|
||||
private Map<String, BigDecimal> getCoordinates(String placeName, String city) {
|
||||
try {
|
||||
// 构造请求URL
|
||||
String encodedPlaceName = java.net.URLEncoder.encode(placeName, "UTF-8");
|
||||
String encodedCity = java.net.URLEncoder.encode(city, "UTF-8");
|
||||
|
||||
String params = "key=" + API_KEY + "&keywords=" + encodedPlaceName +
|
||||
"&types=190000&city=" + encodedCity + "&output=JSON";
|
||||
String requestUrl = AMAP_URL + "?" + params;
|
||||
|
||||
// 发送HTTP请求
|
||||
URL url = new URL(requestUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
||||
String inputLine;
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
response.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
|
||||
// 解析JSON响应
|
||||
com.alibaba.fastjson.JSONObject jsonResponse =
|
||||
com.alibaba.fastjson.JSON.parseObject(response.toString());
|
||||
|
||||
if ("1".equals(jsonResponse.getString("status"))) {
|
||||
com.alibaba.fastjson.JSONArray pois = jsonResponse.getJSONArray("pois");
|
||||
if (pois != null && !pois.isEmpty()) {
|
||||
com.alibaba.fastjson.JSONObject firstPoi = pois.getJSONObject(0);
|
||||
String location = firstPoi.getString("location");
|
||||
String[] lngLat = location.split(",");
|
||||
|
||||
// 将字符串坐标转换为BigDecimal
|
||||
Map<String, BigDecimal> coordinates = new HashMap<>();
|
||||
coordinates.put("lng", new BigDecimal(lngLat[0]));
|
||||
coordinates.put("lat", new BigDecimal(lngLat[1]));
|
||||
return coordinates;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
System.err.println("调用高德地图API出错: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位
|
||||
*
|
||||
* @param jobId 岗位主键
|
||||
* @return 岗位
|
||||
*/
|
||||
@Override
|
||||
public Job selectJobByJobId(Long jobId)
|
||||
{
|
||||
Job job = jobMapper.selectById(jobId);
|
||||
//查询公司信息
|
||||
if(Objects.nonNull(job.getCompanyId())){
|
||||
Company company = companyMapper.selectById(job.getCompanyId());
|
||||
job.setCompany(company);
|
||||
}
|
||||
return job;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 岗位
|
||||
*/
|
||||
@Override
|
||||
public List<Job> selectJobList(Job job)
|
||||
{
|
||||
List<Job> jobs = jobMapper.selectJobList(job);
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int view(Long jobId) {
|
||||
Job job = jobMapper.selectById(jobId);
|
||||
if(Objects.isNull(job)){
|
||||
throw new ServiceException("岗位不存在");
|
||||
}
|
||||
job.setView(job.getView()+1);
|
||||
jobMapper.updateById(job);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertJob(Job job)
|
||||
{
|
||||
int insert = jobMapper.insert(job);
|
||||
//todo 线程池管理
|
||||
Thread thread = new Thread(() -> {
|
||||
VectorJob jobVector = jobMapper.selectVectorJob(job.getJobId());
|
||||
jobVector.setJobUrl("http://39.98.44.136/app#/packageA/pages/post/post?jobId="+job.getJobId());
|
||||
String jsonBody = JSONUtil.toJsonStr(jobVector);
|
||||
HttpUtil.post("http://39.98.44.136:6004/insert_vector", jsonBody);
|
||||
});
|
||||
thread.start();
|
||||
return insert;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*
|
||||
* @param job 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJob(Job job)
|
||||
{
|
||||
//修改岗位状态
|
||||
if(job.getIsPublish()!=null) {
|
||||
if(job.getIsPublish()==1){
|
||||
job.setPostingDate(new Date());
|
||||
}else {
|
||||
job.setPostingDate(null);
|
||||
}
|
||||
}
|
||||
return jobMapper.updateById(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除岗位
|
||||
*
|
||||
* @param jobIds 需要删除的岗位主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobByJobIds(Long[] jobIds)
|
||||
{
|
||||
return jobMapper.deleteBatchIds(Arrays.asList(jobIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> appList(ESJobSearch jobQuery) {
|
||||
EsPageInfo<ESJobDocument> jobs = iesJobSearchService.appList(jobQuery);
|
||||
List<ESJobDocument> esJobDocuments = userCollection(jobs.getList());
|
||||
jobs.setList(esJobDocuments);
|
||||
return jobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> recommend(ESJobSearch esJobSearch) {
|
||||
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
||||
JSONArray cacheObject = redisCache.getCacheObject(esJobSearch.getSessionId());
|
||||
List<Long> jobList = new ArrayList<>();
|
||||
if(Objects.isNull(cacheObject)){
|
||||
ArrayList<Long> longs = new ArrayList<>();
|
||||
jobList =longs;
|
||||
}else {
|
||||
jobList = cacheObject.toList(Long.class);
|
||||
}
|
||||
//从kafka中消费 bert模型跑出来的结果
|
||||
//从es中查询
|
||||
List<ESJobDocument> jobListResult = iesJobSearchService.selectTextListExceptJobId(esJobSearch,jobList);
|
||||
//存入当前session中查看的岗位 避免重复 todo 定时删除 key上保存用户信息
|
||||
jobList.addAll(jobListResult.stream().map(ESJobDocument::getJobId).collect(Collectors.toList()));
|
||||
redisCache.setCacheObject(esJobSearch.getSessionId(),jobList);
|
||||
List<ESJobDocument> esJobDocuments = userCollection(jobListResult);
|
||||
return esJobDocuments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> countyJobList(ESJobSearch job) {
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = iesJobSearchService.countyJobList(job);
|
||||
List<ESJobDocument> esJobDocuments = userCollection(esJobDocumentEsPageInfo.getList());
|
||||
esJobDocumentEsPageInfo.setList(esJobDocuments);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> subway(ESJobSearch jobQuery) {
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = iesJobSearchService.subway(jobQuery);
|
||||
List<ESJobDocument> esJobDocuments = userCollection(esJobDocumentEsPageInfo.getList());
|
||||
esJobDocumentEsPageInfo.setList(esJobDocuments);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EsPageInfo<ESJobDocument> commercialArea(ESJobSearch jobQuery) {
|
||||
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = iesJobSearchService.commercialArea(jobQuery);
|
||||
List<ESJobDocument> esJobDocuments = userCollection(esJobDocumentEsPageInfo.getList());
|
||||
esJobDocumentEsPageInfo.setList(esJobDocuments);
|
||||
return esJobDocumentEsPageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Job selectJobByJobIdApp(Long jobId) {
|
||||
try {
|
||||
Job job = new Job();
|
||||
ESJobDocument esJobDocument = iesJobSearchService.selectById(jobId);
|
||||
BeanUtils.copyProperties(esJobDocument,job);
|
||||
//查询公司信息
|
||||
if(Objects.nonNull(job.getCompanyId())){
|
||||
Company company = companyMapper.selectById(job.getCompanyId());
|
||||
job.setCompany(company);
|
||||
}
|
||||
// if(SecurityUtils.isLogin()){
|
||||
// //查询申请信息
|
||||
// Long applyCount = jobApplyMapper.selectCount(Wrappers.<JobApply>lambdaQuery().eq(JobApply::getJobId, jobId).eq(JobApply::getUserId, SecurityUtils.getUserId()));
|
||||
// job.setIsApply(applyCount>0?1:0);
|
||||
// //查询收藏信息
|
||||
// Long collectionCount = jobCollectionMapper.selectCount(Wrappers.<JobCollection>lambdaQuery().eq(JobCollection::getJobId, jobId).eq(JobCollection::getUserId, SecurityUtils.getUserId()));
|
||||
// job.setIsCollection(collectionCount>0?1:0);
|
||||
// //todo asyn
|
||||
// //保存浏览记录
|
||||
// List<AppReviewJob> appReviewJobs = appReviewJobMapper.selectList(Wrappers.<AppReviewJob>lambdaQuery().eq(AppReviewJob::getUserId, SecurityUtils.getUserId()).eq(AppReviewJob::getJobId, jobId));
|
||||
// //之前相同岗位的记录删除 保存最新的浏览记录
|
||||
// if(!appReviewJobs.isEmpty()){
|
||||
// appReviewJobMapper.deleteBatchIds(appReviewJobs.stream().map(AppReviewJob::getId).collect(Collectors.toList()));
|
||||
// }
|
||||
// AppReviewJob appReviewJob = new AppReviewJob();
|
||||
// appReviewJob.setUserId(SecurityUtils.getUserId());
|
||||
// appReviewJob.setReviewDate(new Date());
|
||||
// appReviewJob.setJobId(jobId);
|
||||
// appReviewJobMapper.insert(appReviewJob);
|
||||
// }
|
||||
//浏览量+1
|
||||
// this.view(jobId);
|
||||
return job;
|
||||
}catch (Exception e){
|
||||
return this.selectJobByJobId(jobId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CandidateVO> candidates(Long jobId) {
|
||||
List<CandidateVO> jobList = jobApplyMapper.candidates(jobId);
|
||||
List<JobTitle> jobTitles = jobTitleMapper.selectList(new QueryWrapper<>());
|
||||
jobList.forEach(x->x.setJobTitle(wrapperJobTitleList(jobTitles,x.getJobTitleId())));
|
||||
return jobList;
|
||||
}
|
||||
|
||||
private List<String> wrapperJobTitleList(List<JobTitle> jobTitles, String jobTitleId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
if(StringUtil.isEmptyOrNull(jobTitleId)){return result;}
|
||||
// 将 jobTitleId 按逗号分隔,得到 jobId 列表
|
||||
List<String> jobIdList = Arrays.asList(jobTitleId.split(","));
|
||||
// 遍历 jobTitles,比对 jobId
|
||||
for (JobTitle jobTitle : jobTitles) {
|
||||
if (jobIdList.contains(jobTitle.getJobId().toString())) {
|
||||
result.add(jobTitle.getJobName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLon() {
|
||||
updateJobLon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> littleVideo(ESJobSearch esJobSearch) {
|
||||
|
||||
return iesJobSearchService.littleVideo(esJobSearch);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEs() {
|
||||
iesJobSearchService.updateEs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ESJobDocument> littleVideoRandom(String uuid, Integer count,String jobTitle) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Long> cacheList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
// 从Redis获取字符串格式的缓存
|
||||
String cacheJson = redisCache.getCacheObject("random_video:" + uuid);
|
||||
if (cacheJson != null && !cacheJson.isEmpty()) {
|
||||
// 将JSON字符串转换为List<Long>
|
||||
cacheList = objectMapper.readValue(cacheJson, new TypeReference<List<Long>>() {});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 处理转换异常,重置缓存
|
||||
log.error("Failed to parse cache JSON for key: random_video:" + uuid, e);
|
||||
redisCache.deleteObject("random_video:" + uuid);
|
||||
}
|
||||
|
||||
// 从服务获取随机视频
|
||||
List<ESJobDocument> esJobDocuments = iesJobSearchService.littleVideoRandom(cacheList, count,jobTitle);
|
||||
if(esJobDocuments.isEmpty()){
|
||||
esJobDocuments = iesJobSearchService.littleVideoRandom(new ArrayList<>(), count,jobTitle);
|
||||
redisCache.deleteObject("random_video:" + uuid);
|
||||
}
|
||||
|
||||
|
||||
// 提取新视频ID并添加到缓存列表
|
||||
List<Long> newJobIds = esJobDocuments.stream()
|
||||
.map(ESJobDocument::getJobId)
|
||||
.collect(Collectors.toList());
|
||||
cacheList.addAll(newJobIds);
|
||||
|
||||
try {
|
||||
// 将更新后的列表转换为JSON字符串
|
||||
String updatedJson = objectMapper.writeValueAsString(cacheList);
|
||||
// 保存到Redis
|
||||
redisCache.setCacheObject("random_video:" + uuid, updatedJson);
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to serialize cache list for key: random_video:" + uuid, e);
|
||||
}
|
||||
|
||||
return esJobDocuments;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void importRow() {
|
||||
//
|
||||
//
|
||||
// try {
|
||||
// logger.info("开始导入Excel数据...");
|
||||
//
|
||||
// // 读取Excel文件中的数据
|
||||
// List<RowWork> rowWorks = ExcelToObject.readExcelToObjects("D:\\QD\\青岛市近一个月数据.xlsx", RowWork.class);
|
||||
// logger.info("从Excel中读取到 {} 条数据", rowWorks.size());
|
||||
//
|
||||
// // 从数据库中获取已有的数据
|
||||
// List<RowWork> rowWorksInMysql = jobMapper.selectAllRowWork();
|
||||
// logger.info("从数据库中查询到 {} 条已有数据", rowWorksInMysql.size());
|
||||
//
|
||||
// // 创建一个Set来存储数据库中已有的记录的唯一标识
|
||||
// Set<String> existingRecords = new HashSet<>();
|
||||
// for (RowWork rowWork : rowWorksInMysql) {
|
||||
// String uniqueKey = rowWork.getJobCategory() + "_" + rowWork.getAca112() + "_" + rowWork.getAcb202();
|
||||
// existingRecords.add(uniqueKey);
|
||||
// }
|
||||
// logger.info("已加载 {} 条唯一标识到内存", existingRecords.size());
|
||||
//
|
||||
// // 创建一个列表来收集待插入的数据
|
||||
// List<RowWork> batchList = new ArrayList<>();
|
||||
// int batchSize = 100; // 每批次插入的数量
|
||||
// int totalInserted = 0; // 记录总共插入的数据量
|
||||
//
|
||||
// // 遍历Excel中的数据,进行去重并收集待插入的数据
|
||||
// for (RowWork rowWork : rowWorks) {
|
||||
// String uniqueKey = rowWork.getStd_class() + "_" + rowWork.getAca112() + "_" + rowWork.getAcb202();
|
||||
// if (!existingRecords.contains(uniqueKey)) {
|
||||
// batchList.add(rowWork); // 添加到待插入列表
|
||||
// existingRecords.add(uniqueKey); // 添加到已存在集合,避免重复
|
||||
// // 当待插入列表达到批次大小时,执行批量插入
|
||||
// if (batchList.size() >= batchSize) {
|
||||
// try {
|
||||
// jobMapper.insertBatchRowWork(batchList); // 批量插入
|
||||
// totalInserted += batchList.size();
|
||||
// logger.info("成功插入 {} 条数据,当前总共插入 {} 条数据", batchList.size(), totalInserted);
|
||||
// batchList.clear(); // 清空列表,准备下一批次
|
||||
// } catch (Exception e) {
|
||||
// logger.error("批量插入失败: " + e.getMessage(), e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 插入剩余的数据(如果不足100条)
|
||||
// if (!batchList.isEmpty()) {
|
||||
// try {
|
||||
// jobMapper.insertBatchRowWork(batchList); // 插入剩余数据
|
||||
// totalInserted += batchList.size();
|
||||
// logger.info("成功插入剩余的 {} 条数据,当前总共插入 {} 条数据", batchList.size(), totalInserted);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("批量插入剩余数据失败: " + e.getMessage(), e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// logger.info("数据导入完成,总共插入 {} 条数据", totalInserted);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("导入数据过程中发生异常: " + e.getMessage(), e);
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
@Override
|
||||
public void importRow() {
|
||||
try {
|
||||
logger.info("开始导入Excel数据...");
|
||||
// 读取Excel文件中的数据
|
||||
List<RowWork> rowWorks = ExcelToObject.readExcelToObjects("/home/lapuda/Desktop/import.xlsx", RowWork.class);
|
||||
logger.info("从Excel中读取到 {} 条数据", rowWorks.size());
|
||||
|
||||
// 按ORG分类存储数据
|
||||
Map<String, List<RowWork>> orgDataMap = new HashMap<>();
|
||||
orgDataMap.put("智联招聘", new ArrayList<>());
|
||||
orgDataMap.put("58同城", new ArrayList<>());
|
||||
orgDataMap.put("前程无忧", new ArrayList<>());
|
||||
orgDataMap.put("猎聘网", new ArrayList<>());
|
||||
|
||||
// 遍历数据,按ORG分类,每类最多取20000条
|
||||
for (RowWork rowWork : rowWorks) {
|
||||
String org = rowWork.getORG(); // 假设RowWork有getORG()方法
|
||||
if (orgDataMap.containsKey(org)) {
|
||||
List<RowWork> orgList = orgDataMap.get(org);
|
||||
if (orgList.size() < 20000) {
|
||||
orgList.add(rowWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 统计各类数据量
|
||||
int zlCount = orgDataMap.get("智联招聘").size();
|
||||
int tcCount = orgDataMap.get("58同城").size();
|
||||
int qcCount = orgDataMap.get("前程无忧").size();
|
||||
int lpCount = orgDataMap.get("前程无忧").size();
|
||||
logger.info("智联招聘数据量: {}", zlCount);
|
||||
logger.info("58同城数据量: {}", tcCount);
|
||||
logger.info("前程无忧数据量: {}", qcCount);
|
||||
logger.info("猎聘网数据量: {}", lpCount);
|
||||
|
||||
// 合并所有数据(智联招聘 + 58同城 + 前程无忧)
|
||||
List<RowWork> allData = new ArrayList<>();
|
||||
allData.addAll(orgDataMap.get("智联招聘"));
|
||||
allData.addAll(orgDataMap.get("58同城"));
|
||||
allData.addAll(orgDataMap.get("前程无忧"));
|
||||
allData.addAll(orgDataMap.get("猎聘网"));
|
||||
|
||||
// 批量插入数据
|
||||
int batchSize = 50;
|
||||
int totalInserted = 0;
|
||||
List<RowWork> batchList = new ArrayList<>();
|
||||
|
||||
for (RowWork rowWork : allData) {
|
||||
// Thread.sleep(500); // 控制处理速度(可选)
|
||||
batchList.add(rowWork);
|
||||
if (batchList.size() >= batchSize) {
|
||||
try {
|
||||
jobMapper.insertBatchRowWork(batchList);
|
||||
totalInserted += batchList.size();
|
||||
logger.info("成功插入 {} 条数据,当前总共插入 {} 条数据", batchList.size(), totalInserted);
|
||||
batchList.clear();
|
||||
} catch (Exception e) {
|
||||
logger.error("批量插入失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 插入剩余数据
|
||||
if (!batchList.isEmpty()) {
|
||||
try {
|
||||
jobMapper.insertBatchRowWork(batchList);
|
||||
totalInserted += batchList.size();
|
||||
logger.info("成功插入剩余的 {} 条数据,当前总共插入 {} 条数据", batchList.size(), totalInserted);
|
||||
} catch (Exception e) {
|
||||
logger.error("批量插入剩余数据失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("数据导入完成,总共插入 {} 条数据", totalInserted);
|
||||
} catch (Exception e) {
|
||||
logger.error("导入数据过程中发生异常: " + e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void importData() {
|
||||
try {
|
||||
logger.info("开始导入数据...");
|
||||
|
||||
// 获取字典数据
|
||||
List<BussinessDictData> dictData = iBussinessDictTypeService.selectDictDataByType("education");
|
||||
List<BussinessDictData> expData = iBussinessDictTypeService.selectDictDataByType("experience");
|
||||
List<BussinessDictData> areaData = iBussinessDictTypeService.selectDictDataByType("area");
|
||||
logger.info("成功获取字典数据: education={}, experience={}, area={}", dictData.size(), expData.size(), areaData.size());
|
||||
|
||||
// 获取需要插入的行数据
|
||||
List<RowWork> rowWorks = this.baseMapper.selectAllInsertRowWork();
|
||||
logger.info("从数据库中获取到 {} 条待插入的行数据", rowWorks.size());
|
||||
|
||||
// 获取公司数据并转换
|
||||
List<Company> companyRowList = this.baseMapper.selectRowCompany();
|
||||
List<Company> companyList = company2New(companyRowList);
|
||||
logger.info("成功转换 {} 条公司数据", companyList.size());
|
||||
|
||||
// 批量插入公司数据
|
||||
int batchSizeCompany = 50; // 每批次插入50条数据
|
||||
List<Company> companyBatch = new ArrayList<>();
|
||||
int totalCompanyInserted = 0;
|
||||
|
||||
for (Company company : companyList) {
|
||||
companyBatch.add(company);
|
||||
if (companyBatch.size() == batchSizeCompany) {
|
||||
companyMapper.batchInsert(companyBatch); // 批量插入
|
||||
totalCompanyInserted += companyBatch.size();
|
||||
logger.info("成功插入 {} 条公司数据,当前总共插入 {} 条", companyBatch.size(), totalCompanyInserted);
|
||||
companyBatch.clear(); // 清空批次
|
||||
}
|
||||
}
|
||||
|
||||
// 插入剩余的记录
|
||||
if (!companyBatch.isEmpty()) {
|
||||
companyMapper.batchInsert(companyBatch);
|
||||
totalCompanyInserted += companyBatch.size();
|
||||
logger.info("成功插入剩余的 {} 条公司数据,当前总共插入 {} 条", companyBatch.size(), totalCompanyInserted);
|
||||
}
|
||||
|
||||
// 获取所有公司数据
|
||||
List<Company> allCompany = companyMapper.selectCompanyList(new Company());
|
||||
logger.info("从数据库中获取到 {} 条公司数据", allCompany.size());
|
||||
|
||||
// 批量插入职位数据
|
||||
List<Job> jobBatch = new ArrayList<>();
|
||||
int batchSize = 50;
|
||||
int totalJobInserted = 0;
|
||||
String string = UUID.randomUUID().toString();
|
||||
logger.info("生成唯一标识符: {}", string);
|
||||
|
||||
for (RowWork rowWork : rowWorks) {
|
||||
try {
|
||||
Job job = new Job();
|
||||
job.setJobTitle(rowWork.getAca112());
|
||||
job.setMinSalary(Long.valueOf(rowWork.getSalaryLow()));
|
||||
job.setMaxSalary(Long.valueOf(rowWork.getSalaryHight()));
|
||||
job.setEducation(iBussinessDictDataService.findCode(dictData, rowWork.getAac011()));
|
||||
job.setExperience(iBussinessDictDataService.findCode(expData, rowWork.getExperience()));
|
||||
job.setCompanyName(rowWork.getAAB004());
|
||||
job.setJobLocation(rowWork.getAAE006());
|
||||
job.setPostingDate(new Date());
|
||||
job.setJobCategory(rowWork.getJobCategory());
|
||||
if (rowWork.getAcb240() == null) {
|
||||
job.setVacancies(-1L);
|
||||
} else {
|
||||
job.setVacancies(Long.valueOf(rowWork.getAcb240().replace("人", "")));
|
||||
}
|
||||
if (rowWork.getLatitude() != null && !rowWork.getLatitude().isEmpty()) {
|
||||
job.setLatitude(new BigDecimal(rowWork.getLatitude()));
|
||||
job.setLongitude(new BigDecimal(rowWork.getLongitude()));
|
||||
}
|
||||
job.setView(0L);
|
||||
job.setCompanyId(getCompanyId(allCompany, rowWork.getAAB004()));
|
||||
job.setIsHot(0);
|
||||
job.setApplyNum(0);
|
||||
job.setJobLocationAreaCode(Integer.valueOf(Objects.requireNonNull(iBussinessDictDataService.findCode(areaData, rowWork.getCounty()))));
|
||||
job.setDescription(rowWork.getAcb22a());
|
||||
job.setIsPublish(1);
|
||||
job.setDataSource(rowWork.getORG());
|
||||
job.setJobUrl(rowWork.getACE760());
|
||||
job.setRemark(string);
|
||||
job.setDelFlag("0");
|
||||
job.setCreateBy(string);
|
||||
job.setCreateTime(new Date());
|
||||
job.setRowId(Long.valueOf(rowWork.getId()));
|
||||
|
||||
jobBatch.add(job);
|
||||
|
||||
// 当批次达到50条时,执行批量插入
|
||||
if (jobBatch.size() == batchSize) {
|
||||
this.baseMapper.batchInsert(jobBatch);
|
||||
totalJobInserted += jobBatch.size();
|
||||
logger.info("成功插入 {} 条职位数据,当前总共插入 {} 条", jobBatch.size(), totalJobInserted);
|
||||
jobBatch.clear(); // 清空批次
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("处理职位数据时发生异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入剩余的记录
|
||||
if (!jobBatch.isEmpty()) {
|
||||
this.baseMapper.batchInsert(jobBatch);
|
||||
totalJobInserted += jobBatch.size();
|
||||
logger.info("成功插入剩余的 {} 条职位数据,当前总共插入 {} 条", jobBatch.size(), totalJobInserted);
|
||||
}
|
||||
|
||||
logger.info("数据导入完成,总共插入 {} 条公司数据和 {} 条职位数据", totalCompanyInserted, totalJobInserted);
|
||||
} catch (Exception e) {
|
||||
logger.error("导入数据过程中发生异常: {}", e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Long getCompanyId(List<Company> allCompany, String aab004) {
|
||||
for (Company company:allCompany){
|
||||
if(company.getName().equals(aab004)){
|
||||
return company.getCompanyId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Company> company2New(List<Company> companyRowList) {
|
||||
List<BussinessDictData> scaleData = iBussinessDictTypeService.selectDictDataByType("scale");
|
||||
List<BussinessDictData> natureData = iBussinessDictTypeService.selectDictDataByType("company_nature");
|
||||
List<TreeSelect> treeSelects = industryService.appIndustry();
|
||||
List<Company> companyList = new ArrayList<>();
|
||||
for(Company company:companyRowList){
|
||||
Company companyNew = new Company();
|
||||
companyNew.setName(company.getName());
|
||||
companyNew.setLocation(company.getLocation());
|
||||
companyNew.setScale(iBussinessDictDataService.findCode(scaleData,company.getScale()));
|
||||
companyNew.setDelFlag("0");
|
||||
companyNew.setCreateBy("system");
|
||||
companyNew.setCreateTime(new Date());
|
||||
companyNew.setRemark("add");
|
||||
companyNew.setDescription(company.getDescription());
|
||||
companyNew.setIndustry(findIndustry(treeSelects,company));
|
||||
companyNew.setNature(iBussinessDictDataService.findCode(natureData,company.getNature()));
|
||||
companyList.add(companyNew);
|
||||
}
|
||||
return companyList;
|
||||
}
|
||||
|
||||
private String findIndustry(List<TreeSelect> treeSelects, Company company) {
|
||||
if(company.getRemark()==null){return "";}
|
||||
if(Objects.equals(company.getRemark(), "")){return "";}
|
||||
for (TreeSelect treeSelect:treeSelects){
|
||||
if(treeSelect.getLabel().equals(company.getRemark())){
|
||||
if(company.getIndustry()==null){return String.valueOf(treeSelect.getId());}
|
||||
if(Objects.equals(company.getIndustry(), "")){return String.valueOf(treeSelect.getId());}
|
||||
for(TreeSelect treeSelectSub:treeSelect.getChildren()){
|
||||
if(treeSelectSub.getLabel().equals(company.getIndustry())){
|
||||
return String.valueOf(treeSelectSub.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private List<ESJobDocument> userCollection(List<ESJobDocument> jobs){
|
||||
if(jobs.isEmpty()){return new ArrayList<>();}
|
||||
if(SecurityUtils.isLogin()){
|
||||
//收藏
|
||||
Set<Long> collectionIds = jobCollectionMapper.selectList(Wrappers.<JobCollection>lambdaQuery()
|
||||
.eq(JobCollection::getUserId, SecurityUtils.getUserId())
|
||||
.in(JobCollection::getJobId, jobs.stream().map(ESJobDocument::getJobId).collect(Collectors.toList())))
|
||||
.stream().map(JobCollection::getJobId).collect(Collectors.toSet());
|
||||
for (ESJobDocument j : jobs) {
|
||||
if (collectionIds.contains(j.getJobId())) {
|
||||
j.setIsCollection(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobs;
|
||||
}
|
||||
@Autowired
|
||||
private WechatUtil wechatUtil;
|
||||
@Override
|
||||
public AppWechatEntity getWechatUrl(String weChatUrl) {
|
||||
return wechatUtil.sign(weChatUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String insertTemp(Job job) {
|
||||
String companyName = job.getCompanyName();
|
||||
Company company = new Company();
|
||||
company.setName(companyName);
|
||||
companyMapper.insert(company);
|
||||
job.setCompanyId(company.getCompanyId());
|
||||
this.insertJob(job);
|
||||
System.out.println(job.getJobId());
|
||||
String url = "https://qd.zhaopinzao8dian.com/app#/packageA/pages/post/post?jobId="+Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes());
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String htmlGen(Long id) {
|
||||
ESJobDocument esJobDocument = iesJobSearchService.selectById(id);
|
||||
String jobTitle = esJobDocument.getJobTitle();
|
||||
Long maxSalary = esJobDocument.getMaxSalary();
|
||||
Long minSalary = esJobDocument.getMinSalary();
|
||||
String companyName = esJobDocument.getCompanyName();
|
||||
Long vacancies = esJobDocument.getVacancies();
|
||||
|
||||
// 1. 从服务器获取模板文件内容
|
||||
String templateContent = fetchTemplateFromServer();
|
||||
if (templateContent == null || templateContent.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 2. 替换模板中的动态变量
|
||||
String htmlContent = templateContent
|
||||
.replace("${jobTitle}", jobTitle)
|
||||
.replace("${companyName}", companyName)
|
||||
.replace("${minSalary}", String.valueOf(minSalary))
|
||||
.replace("${maxSalary}", String.valueOf(maxSalary))
|
||||
.replace("${vacancies}", String.valueOf(vacancies))
|
||||
.replace("${jobId}", String.valueOf(id));
|
||||
|
||||
// 3. 检查并创建目录
|
||||
String directoryPath = "/data/file/share";
|
||||
String directoryPath_domain = "/file/share";
|
||||
File directory = new File(directoryPath);
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
}
|
||||
|
||||
// 4. 生成HTML文件
|
||||
String fileName = "share_" + id + ".html";
|
||||
String filePath = directoryPath + "/" + fileName;
|
||||
File htmlFile = new File(filePath);
|
||||
|
||||
try {
|
||||
// 如果文件已存在,先删除
|
||||
if (htmlFile.exists()) {
|
||||
return "https://qd.zhaopinzao8dian.com/file/share/"+fileName;
|
||||
}
|
||||
|
||||
// 写入新内容
|
||||
FileWriter writer = new FileWriter(htmlFile);
|
||||
writer.write(htmlContent);
|
||||
writer.close();
|
||||
|
||||
return "https://qd.zhaopinzao8dian.com/file/share/"+fileName;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private String fetchTemplateFromServer() {
|
||||
String templateUrl = "https://qd.zhaopinzao8dian.com/file/share/template.html";
|
||||
try {
|
||||
URL url = new URL(templateUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||
BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
|
||||
StringBuilder response = new StringBuilder();
|
||||
String line;
|
||||
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line).append("\n");
|
||||
}
|
||||
reader.close();
|
||||
return response.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fix() {
|
||||
iesJobSearchService.fix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
import com.ruoyi.cms.util.JobTitleUtils;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.JobTitleMapper;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.cms.service.IJobTitleService;
|
||||
|
||||
/**
|
||||
* 岗位Service业务层处理
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Service
|
||||
public class JobTitleServiceImpl extends ServiceImpl<JobTitleMapper,JobTitle> implements IJobTitleService
|
||||
{
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
|
||||
/**
|
||||
* 查询岗位
|
||||
*
|
||||
* @param jobId 岗位主键
|
||||
* @return 岗位
|
||||
*/
|
||||
@Override
|
||||
public JobTitle selectJobTitleByJobId(Long jobId)
|
||||
{
|
||||
return jobTitleMapper.selectById(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 岗位
|
||||
*/
|
||||
@Override
|
||||
public List<JobTitle> selectJobTitleList(JobTitle jobTitle)
|
||||
{
|
||||
return jobTitleMapper.selectJobTitleList(jobTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertJobTitle(JobTitle jobTitle)
|
||||
{
|
||||
int insert = jobTitleMapper.insert(jobTitle);
|
||||
if(insert>0){
|
||||
removeJobTitleCache();
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*
|
||||
* @param jobTitle 岗位
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJobTitle(JobTitle jobTitle)
|
||||
{
|
||||
int i = jobTitleMapper.updateById(jobTitle);
|
||||
if(i>0){
|
||||
removeJobTitleCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除岗位
|
||||
*
|
||||
* @param jobIds 需要删除的岗位主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobTitleByJobIds(Long[] jobIds)
|
||||
{
|
||||
int i = jobTitleMapper.deleteBatchIds(Arrays.asList(jobIds));
|
||||
if(i>0){
|
||||
removeJobTitleCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelect> buildJobTitleTreeSelect(List<JobTitle> jobTitleList) {
|
||||
List<JobTitle> jobTitleTree = buildJobTitleTree(jobTitleList);
|
||||
return jobTitleTree.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<JobTitle> buildJobTitleTree(List<JobTitle> jobTitleList) {
|
||||
List<JobTitle> returnList = new ArrayList<JobTitle>();
|
||||
List<Long> tempList = jobTitleList.stream().map(JobTitle::getJobId).collect(Collectors.toList());
|
||||
for (Iterator<JobTitle> iterator = jobTitleList.iterator(); iterator.hasNext();)
|
||||
{
|
||||
JobTitle jobTitle = (JobTitle) iterator.next();
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(jobTitle.getParentId()))
|
||||
{
|
||||
recursionFn(jobTitleList, jobTitle);
|
||||
returnList.add(jobTitle);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = jobTitleList;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private void recursionFn(List<JobTitle> list, JobTitle t)
|
||||
{
|
||||
// 得到子节点列表
|
||||
List<JobTitle> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (JobTitle tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
private boolean hasChild(List<JobTitle> list, JobTitle t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<JobTitle> getChildList(List<JobTitle> list, JobTitle t)
|
||||
{
|
||||
List<JobTitle> tlist = new ArrayList<JobTitle>();
|
||||
Iterator<JobTitle> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
JobTitle n = (JobTitle) it.next();
|
||||
if (n.getParentId().longValue() == t.getJobId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
public static void removeJobTitleCache()
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).deleteObject(CommonConstant.JOB_TITLE);
|
||||
}
|
||||
|
||||
public static void setJobTitleCache(List<TreeSelect> jobTitleList)
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(CommonConstant.JOB_TITLE, jobTitleList);
|
||||
}
|
||||
|
||||
public static List<TreeSelect> getJobTitleCache()
|
||||
{
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(CommonConstant.JOB_TITLE);
|
||||
if (StringUtils.isNotNull(arrayCache))
|
||||
{
|
||||
return arrayCache.toList(TreeSelect.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean hasChildByJobId(Long jobId) {
|
||||
return jobTitleMapper.selectCount(Wrappers.<JobTitle>lambdaQuery().eq(JobTitle::getParentId, jobId))>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeSelect> appJobTitle() {
|
||||
List<TreeSelect> jobTitleCache = getJobTitleCache();
|
||||
if(Objects.isNull(jobTitleCache))
|
||||
{
|
||||
List<JobTitle> jobTitleList = this.selectJobTitleList(null);
|
||||
return this.buildJobTitleTreeSelect(jobTitleList);
|
||||
}
|
||||
return jobTitleCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importJobTitle() {
|
||||
// 读取 Excel 并构建树结构
|
||||
List<JobTitle> jobTitles = JobTitleUtils.readExcel("D:\\job_category_standard.xlsx");
|
||||
|
||||
this.saveJobTitles(jobTitles);
|
||||
}
|
||||
/**
|
||||
* 存储 JobTitle 列表到数据库
|
||||
*/
|
||||
public void saveJobTitles(List<JobTitle> jobTitles) {
|
||||
for (JobTitle jobTitle : jobTitles) {
|
||||
saveJobTitleRecursive(jobTitle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归存储 JobTitle
|
||||
*/
|
||||
private void saveJobTitleRecursive(JobTitle jobTitle) {
|
||||
jobTitleMapper.insert(jobTitle); // 存储当前节点
|
||||
for (JobTitle child : jobTitle.getChildren()) {
|
||||
saveJobTitleRecursive(child); // 递归存储子节点
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobTitle> levelOne() {
|
||||
return jobTitleMapper.selectList(Wrappers.<JobTitle>lambdaQuery().eq(JobTitle::getParentId, 0l));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.INoticeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class NoticeServiceImpl implements INoticeService
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cms.domain.CommercialArea;
|
||||
import com.ruoyi.cms.domain.CompanyCardCollection;
|
||||
import com.ruoyi.cms.domain.Statics;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
import com.ruoyi.cms.mapper.CompanyCardCollectionMapper;
|
||||
import com.ruoyi.cms.mapper.StaticsMapper;
|
||||
import com.ruoyi.cms.service.ISubwayLineService;
|
||||
import com.ruoyi.cms.service.StaticsqueryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class StaticsqueryServiceImpl extends ServiceImpl<StaticsMapper, Statics> implements StaticsqueryService {
|
||||
@Autowired
|
||||
private StaticsMapper staticsMapper;
|
||||
@Override
|
||||
public Map<String, Object> industry(Staticsquery staticsquery) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<String> query = staticsquery.generateTimeRange();
|
||||
for (String time : query) {
|
||||
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分行业/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
|
||||
result.put(time, statics);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<String> getQueryTime(Staticsquery staticsquery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> industryArea(Staticsquery staticsquery) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<String> query = staticsquery.generateTimeRange();
|
||||
for (String time : query) {
|
||||
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分区域/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
|
||||
result.put(time, statics);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> salary(Staticsquery staticsquery) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<String> query = staticsquery.generateTimeRange();
|
||||
for (String time : query) {
|
||||
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分薪资/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
|
||||
result.put(time, statics);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> education(Staticsquery staticsquery) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<String> query = staticsquery.generateTimeRange();
|
||||
for (String time : query) {
|
||||
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分学历/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
|
||||
result.put(time, statics);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Object> workYear(Staticsquery staticsquery) {
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<String> query = staticsquery.generateTimeRange();
|
||||
for (String time : query) {
|
||||
List<Statics> statics = staticsMapper.selectList(Wrappers.<Statics>lambdaQuery().eq(Statics::getType, "分工作年限/" + staticsquery.getTimeDimension()+"/"+staticsquery.getType()).eq(Statics::getTime, time));
|
||||
result.put(time, statics);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public void industryGen() {
|
||||
// 定义岗位分类
|
||||
String[] jobCategories = {
|
||||
"销售/商务拓展",
|
||||
"人事/行政/财务/法务",
|
||||
"互联网/通信及硬件",
|
||||
"运维/测试",
|
||||
"视觉/交互/设计",
|
||||
"运营/专业分析",
|
||||
"产品/项目/高级管理",
|
||||
"市场/品牌/公关",
|
||||
"金融/保险",
|
||||
"房地产/工程/建筑",
|
||||
"物流/采购/供应链",
|
||||
"汽车",
|
||||
"生产制造/营运管理",
|
||||
"农业/能源/环保",
|
||||
"医疗/医美/医务",
|
||||
"教育/培训/科研",
|
||||
"编辑/记者/翻译",
|
||||
"影视传媒",
|
||||
"商务服务/生活服务",
|
||||
"管培生/非企业从业者"
|
||||
};
|
||||
|
||||
// 定义时间周期
|
||||
String[] timePeriods = {
|
||||
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
|
||||
"2024-11", "2024-12",
|
||||
"2024-第一季度", "2024-第二季度", "2024-第三季度", "2024-第四季度",
|
||||
"2025-第一季度", "2025-第二季度",
|
||||
"2025", "2024", "2023"
|
||||
};
|
||||
|
||||
// 所有支持的类型
|
||||
Map<String, List<String>> typeMap = new HashMap<>();
|
||||
typeMap.put("month", Arrays.asList(
|
||||
"分行业/月/岗位发布数量",
|
||||
"分行业/月/招聘增长率"
|
||||
));
|
||||
typeMap.put("quarter", Arrays.asList(
|
||||
"分行业/季度/岗位发布数量",
|
||||
"分行业/季度/招聘增长率"
|
||||
));
|
||||
typeMap.put("year", Arrays.asList(
|
||||
"分行业/年/岗位发布数量",
|
||||
"分行业/年/招聘增长率"
|
||||
));
|
||||
|
||||
for (String time : timePeriods) {
|
||||
String granularity;
|
||||
|
||||
// 判断时间粒度:月、季度、年
|
||||
if (time.matches("\\d{4}-\\d{2}")) {
|
||||
granularity = "month"; // 如 "2025-01"
|
||||
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
|
||||
granularity = "quarter"; // 如 "2024-第一季度"
|
||||
} else if (time.matches("\\d{4}")) {
|
||||
granularity = "year"; // 如 "2025"
|
||||
} else {
|
||||
continue; // 非法格式跳过
|
||||
}
|
||||
|
||||
List<String> applicableTypes = typeMap.get(granularity);
|
||||
|
||||
for (String type : applicableTypes) {
|
||||
for (String category : jobCategories) {
|
||||
Statics stat = new Statics();
|
||||
stat.setTime(time);
|
||||
stat.setType(type);
|
||||
stat.setName(category);
|
||||
|
||||
// 设置数据值
|
||||
if (type.contains("岗位发布数量")) {
|
||||
int baseValue = 100;
|
||||
if (granularity.equals("quarter")) baseValue = 300;
|
||||
if (granularity.equals("year")) baseValue = 1200;
|
||||
|
||||
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
|
||||
stat.setData(String.valueOf(baseValue + variation));
|
||||
} else {
|
||||
double baseRate = 0.05;
|
||||
double variation = 0.01 * (Math.random() - 0.5);
|
||||
stat.setData(String.format("%.2f", baseRate + variation));
|
||||
}
|
||||
|
||||
stat.setDelFlag("0");
|
||||
staticsMapper.insert(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void salarysalaryGen() {
|
||||
// 定义岗位分类
|
||||
String[] jobCategories = {
|
||||
"3k-5k",
|
||||
"5k-8k",
|
||||
"10k-15K",
|
||||
"15k-20k",
|
||||
"20k+"
|
||||
};
|
||||
|
||||
// 定义时间周期
|
||||
String[] timePeriods = {
|
||||
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
|
||||
"2024-11", "2024-12"
|
||||
};
|
||||
|
||||
// 所有支持的类型
|
||||
Map<String, List<String>> typeMap = new HashMap<>();
|
||||
typeMap.put("month", Arrays.asList(
|
||||
"分薪资/月/岗位发布数量"
|
||||
));
|
||||
|
||||
for (String time : timePeriods) {
|
||||
String granularity;
|
||||
|
||||
// 判断时间粒度:月、季度、年
|
||||
if (time.matches("\\d{4}-\\d{2}")) {
|
||||
granularity = "month"; // 如 "2025-01"
|
||||
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
|
||||
granularity = "quarter"; // 如 "2024-第一季度"
|
||||
} else if (time.matches("\\d{4}")) {
|
||||
granularity = "year"; // 如 "2025"
|
||||
} else {
|
||||
continue; // 非法格式跳过
|
||||
}
|
||||
|
||||
List<String> applicableTypes = typeMap.get(granularity);
|
||||
|
||||
for (String type : applicableTypes) {
|
||||
for (String category : jobCategories) {
|
||||
Statics stat = new Statics();
|
||||
stat.setTime(time);
|
||||
stat.setType(type);
|
||||
stat.setName(category);
|
||||
|
||||
// 设置数据值
|
||||
if (type.contains("岗位发布数量")) {
|
||||
int baseValue = 694;
|
||||
if (granularity.equals("quarter")) baseValue = 300;
|
||||
if (granularity.equals("year")) baseValue = 1200;
|
||||
|
||||
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
|
||||
stat.setData(String.valueOf(baseValue + variation));
|
||||
} else {
|
||||
double baseRate = 0.05;
|
||||
double variation = 0.01 * (Math.random() - 0.5);
|
||||
stat.setData(String.format("%.2f", baseRate + variation));
|
||||
}
|
||||
|
||||
stat.setDelFlag("0");
|
||||
staticsMapper.insert(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void areaGen() {
|
||||
// 定义岗位分类
|
||||
String[] jobCategories = {
|
||||
"市南区",
|
||||
"市北区",
|
||||
"李沧区",
|
||||
"崂山区",
|
||||
"黄岛区",
|
||||
"城阳区",
|
||||
"即墨区",
|
||||
"胶州市",
|
||||
"平度市",
|
||||
"莱西市"
|
||||
};
|
||||
|
||||
// 定义时间周期
|
||||
String[] timePeriods = {
|
||||
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
|
||||
"2024-11", "2024-12"
|
||||
};
|
||||
|
||||
// 所有支持的类型
|
||||
Map<String, List<String>> typeMap = new HashMap<>();
|
||||
typeMap.put("month", Arrays.asList(
|
||||
"分区域/月/岗位发布数量"
|
||||
));
|
||||
|
||||
|
||||
for (String time : timePeriods) {
|
||||
String granularity;
|
||||
|
||||
// 判断时间粒度:月、季度、年
|
||||
if (time.matches("\\d{4}-\\d{2}")) {
|
||||
granularity = "month"; // 如 "2025-01"
|
||||
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
|
||||
granularity = "quarter"; // 如 "2024-第一季度"
|
||||
} else if (time.matches("\\d{4}")) {
|
||||
granularity = "year"; // 如 "2025"
|
||||
} else {
|
||||
continue; // 非法格式跳过
|
||||
}
|
||||
|
||||
List<String> applicableTypes = typeMap.get(granularity);
|
||||
|
||||
for (String type : applicableTypes) {
|
||||
for (String category : jobCategories) {
|
||||
Statics stat = new Statics();
|
||||
stat.setTime(time);
|
||||
stat.setType(type);
|
||||
stat.setName(category);
|
||||
|
||||
// 设置数据值
|
||||
if (type.contains("岗位发布数量")) {
|
||||
int baseValue = 1000;
|
||||
if (granularity.equals("quarter")) baseValue = 300;
|
||||
if (granularity.equals("year")) baseValue = 1200;
|
||||
|
||||
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
|
||||
stat.setData(String.valueOf(baseValue + variation));
|
||||
} else {
|
||||
double baseRate = 0.05;
|
||||
double variation = 0.01 * (Math.random() - 0.5);
|
||||
stat.setData(String.format("%.2f", baseRate + variation));
|
||||
}
|
||||
|
||||
stat.setDelFlag("0");
|
||||
staticsMapper.insert(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void workYearGen() {
|
||||
// 定义岗位分类
|
||||
String[] jobCategories = {
|
||||
"实习生",
|
||||
"应届毕业生",
|
||||
"1年以下",
|
||||
"1-3年",
|
||||
"3-5年",
|
||||
"5-10年",
|
||||
"10年以上",
|
||||
"经验不限"
|
||||
};
|
||||
|
||||
// 定义时间周期
|
||||
String[] timePeriods = {
|
||||
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
|
||||
"2024-11", "2024-12"
|
||||
};
|
||||
|
||||
// 所有支持的类型
|
||||
Map<String, List<String>> typeMap = new HashMap<>();
|
||||
typeMap.put("month", Arrays.asList(
|
||||
"分工作年限/月/岗位发布数量"
|
||||
));
|
||||
|
||||
|
||||
for (String time : timePeriods) {
|
||||
String granularity;
|
||||
|
||||
// 判断时间粒度:月、季度、年
|
||||
if (time.matches("\\d{4}-\\d{2}")) {
|
||||
granularity = "month"; // 如 "2025-01"
|
||||
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
|
||||
granularity = "quarter"; // 如 "2024-第一季度"
|
||||
} else if (time.matches("\\d{4}")) {
|
||||
granularity = "year"; // 如 "2025"
|
||||
} else {
|
||||
continue; // 非法格式跳过
|
||||
}
|
||||
|
||||
List<String> applicableTypes = typeMap.get(granularity);
|
||||
|
||||
for (String type : applicableTypes) {
|
||||
for (String category : jobCategories) {
|
||||
Statics stat = new Statics();
|
||||
stat.setTime(time);
|
||||
stat.setType(type);
|
||||
stat.setName(category);
|
||||
|
||||
// 设置数据值
|
||||
if (type.contains("岗位发布数量")) {
|
||||
int baseValue = 1000;
|
||||
if (granularity.equals("quarter")) baseValue = 300;
|
||||
if (granularity.equals("year")) baseValue = 1200;
|
||||
|
||||
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
|
||||
stat.setData(String.valueOf(baseValue + variation));
|
||||
} else {
|
||||
double baseRate = 0.05;
|
||||
double variation = 0.01 * (Math.random() - 0.5);
|
||||
stat.setData(String.format("%.2f", baseRate + variation));
|
||||
}
|
||||
|
||||
stat.setDelFlag("0");
|
||||
staticsMapper.insert(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void educationGen() {
|
||||
// 定义岗位分类
|
||||
String[] jobCategories = {
|
||||
"初中及以下",
|
||||
"中专/中技",
|
||||
"高中",
|
||||
"大专",
|
||||
"本科",
|
||||
"硕士",
|
||||
"博士",
|
||||
"MBA/EMBA",
|
||||
"留学-学士",
|
||||
"留学-硕士",
|
||||
"留学-博士",
|
||||
"不限"
|
||||
};
|
||||
|
||||
// 定义时间周期
|
||||
String[] timePeriods = {
|
||||
"2025-01", "2025-02", "2025-03", "2025-04", "2025-05",
|
||||
"2024-11", "2024-12"
|
||||
};
|
||||
|
||||
// 所有支持的类型
|
||||
Map<String, List<String>> typeMap = new HashMap<>();
|
||||
typeMap.put("month", Arrays.asList(
|
||||
"分学历年限/月/岗位发布数量"
|
||||
));
|
||||
|
||||
|
||||
for (String time : timePeriods) {
|
||||
String granularity;
|
||||
|
||||
// 判断时间粒度:月、季度、年
|
||||
if (time.matches("\\d{4}-\\d{2}")) {
|
||||
granularity = "month"; // 如 "2025-01"
|
||||
} else if (time.matches("\\d{4}-第[一二三四]季度")) {
|
||||
granularity = "quarter"; // 如 "2024-第一季度"
|
||||
} else if (time.matches("\\d{4}")) {
|
||||
granularity = "year"; // 如 "2025"
|
||||
} else {
|
||||
continue; // 非法格式跳过
|
||||
}
|
||||
|
||||
List<String> applicableTypes = typeMap.get(granularity);
|
||||
|
||||
for (String type : applicableTypes) {
|
||||
for (String category : jobCategories) {
|
||||
Statics stat = new Statics();
|
||||
stat.setTime(time);
|
||||
stat.setType(type);
|
||||
stat.setName(category);
|
||||
|
||||
// 设置数据值
|
||||
if (type.contains("岗位发布数量")) {
|
||||
int baseValue = 1000;
|
||||
if (granularity.equals("quarter")) baseValue = 300;
|
||||
if (granularity.equals("year")) baseValue = 1200;
|
||||
|
||||
int variation = (int)(baseValue * 0.2 * (Math.random() - 0.5));
|
||||
stat.setData(String.valueOf(baseValue + variation));
|
||||
} else {
|
||||
double baseRate = 0.05;
|
||||
double variation = 0.01 * (Math.random() - 0.5);
|
||||
stat.setData(String.format("%.2f", baseRate + variation));
|
||||
}
|
||||
|
||||
stat.setDelFlag("0");
|
||||
staticsMapper.insert(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.SubwayStation;
|
||||
import com.ruoyi.cms.mapper.SubwayStationMapper;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.SubwayLineMapper;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
import com.ruoyi.cms.service.ISubwayLineService;
|
||||
|
||||
/**
|
||||
* 地铁线路Service业务层处理
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Service
|
||||
public class SubwayLineServiceImpl extends ServiceImpl<SubwayLineMapper,SubwayLine> implements ISubwayLineService
|
||||
{
|
||||
@Autowired
|
||||
private SubwayLineMapper subwayLineMapper;
|
||||
@Autowired
|
||||
private SubwayStationMapper subwayStationMapper;
|
||||
/**
|
||||
* 查询地铁线路
|
||||
*
|
||||
* @param lineId 地铁线路主键
|
||||
* @return 地铁线路
|
||||
*/
|
||||
@Override
|
||||
public SubwayLine selectSubwayLineByLineId(Long lineId)
|
||||
{
|
||||
SubwayLine subwayLine = subwayLineMapper.selectById(lineId);
|
||||
List<SubwayStation> subwayStations = subwayStationMapper.selectList(Wrappers.<SubwayStation>lambdaQuery().eq(SubwayStation::getLineId, subwayLine.getLineId()));
|
||||
subwayLine.setSubwayStationList(subwayStations);
|
||||
return subwayLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地铁线路列表
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 地铁线路
|
||||
*/
|
||||
@Override
|
||||
public List<SubwayLine> selectSubwayLineList(SubwayLine subwayLine)
|
||||
{
|
||||
return subwayLineMapper.selectSubwayLineList(subwayLine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地铁线路
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSubwayLine(SubwayLine subwayLine)
|
||||
{
|
||||
Long count = subwayLineMapper.selectCount(Wrappers.<SubwayLine>lambdaQuery().eq(SubwayLine::getLineName, subwayLine.getLineName()));
|
||||
if(count>0){
|
||||
throw new ServiceException("已存在相同线路名称");
|
||||
}
|
||||
int insert = subwayLineMapper.insert(subwayLine);
|
||||
if(insert>0){
|
||||
removeSubwayCache();
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
public static void removeSubwayCache()
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).deleteObject(CommonConstant.SUBWAY_LINE_CACHE);
|
||||
}
|
||||
|
||||
public static void setSubwayCache(List<SubwayLine> subwayLineList)
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(CommonConstant.SUBWAY_LINE_CACHE, subwayLineList);
|
||||
}
|
||||
|
||||
public static List<SubwayLine> getSubwayCache()
|
||||
{
|
||||
JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(CommonConstant.SUBWAY_LINE_CACHE);
|
||||
if (StringUtils.isNotNull(arrayCache))
|
||||
{
|
||||
return arrayCache.toList(SubwayLine.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 修改地铁线路
|
||||
*
|
||||
* @param subwayLine 地铁线路
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSubwayLine(SubwayLine subwayLine)
|
||||
{
|
||||
Long count = subwayLineMapper.selectCount(Wrappers.<SubwayLine>lambdaQuery().eq(SubwayLine::getLineName, subwayLine.getLineName()));
|
||||
if(count>1){
|
||||
throw new ServiceException("已存在相同线路名称");
|
||||
}
|
||||
int i = subwayLineMapper.updateById(subwayLine);
|
||||
if(i>0){
|
||||
removeSubwayCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地铁线路
|
||||
*
|
||||
* @param lineId 需要删除的地铁线路主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSubwayLineByLineIds(Long lineId)
|
||||
{
|
||||
Long count = subwayStationMapper.selectCount(Wrappers.<SubwayStation>lambdaQuery().eq(SubwayStation::getLineId, lineId));
|
||||
if(count>0){
|
||||
throw new ServiceException("该地铁线路下已有站点,请删除其它站点后再删除该线路");
|
||||
}
|
||||
int i = subwayLineMapper.deleteById(lineId);
|
||||
removeSubwayCache();
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubwayLine> appSubway() {
|
||||
List<SubwayLine> subwayCache = getSubwayCache();
|
||||
if(Objects.isNull(subwayCache))
|
||||
{
|
||||
List<SubwayLine> subwayLineList = subwayLineMapper.appSubway();
|
||||
setSubwayCache(subwayLineList);
|
||||
return subwayLineList;
|
||||
}
|
||||
return subwayCache;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
import com.ruoyi.cms.mapper.SubwayLineMapper;
|
||||
import com.ruoyi.cms.service.ISubwayLineService;
|
||||
import com.ruoyi.cms.util.Station;
|
||||
import com.ruoyi.cms.util.SubwayData;
|
||||
import com.ruoyi.cms.util.SubwayLineJson;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.cms.mapper.SubwayStationMapper;
|
||||
import com.ruoyi.cms.domain.SubwayStation;
|
||||
import com.ruoyi.cms.service.ISubwayStationService;
|
||||
|
||||
import static com.ruoyi.cms.service.impl.SubwayLineServiceImpl.removeSubwayCache;
|
||||
|
||||
|
||||
/**
|
||||
* 地铁站点Service业务层处理
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Service
|
||||
public class SubwayStationServiceImpl extends ServiceImpl<SubwayStationMapper,SubwayStation> implements ISubwayStationService
|
||||
{
|
||||
@Autowired
|
||||
private SubwayStationMapper subwayStationMapper;
|
||||
@Autowired
|
||||
private ISubwayLineService lineService;
|
||||
@Autowired
|
||||
private SubwayLineMapper subwayLineMapper;
|
||||
|
||||
/**
|
||||
* 查询地铁站点
|
||||
*
|
||||
* @param stationId 地铁站点主键
|
||||
* @return 地铁站点
|
||||
*/
|
||||
@Override
|
||||
public SubwayStation selectSubwayStationByStationId(Long stationId)
|
||||
{
|
||||
return subwayStationMapper.selectById(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地铁站点列表
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 地铁站点
|
||||
*/
|
||||
@Override
|
||||
public List<SubwayStation> selectSubwayStationList(SubwayStation subwayStation)
|
||||
{
|
||||
return subwayStationMapper.selectSubwayStationList(subwayStation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地铁站点
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSubwayStation(SubwayStation subwayStation)
|
||||
{
|
||||
Long count = subwayStationMapper.selectCount(Wrappers.<SubwayStation>lambdaQuery().eq(SubwayStation::getStationName, subwayStation.getStationName()));
|
||||
if(count>0){
|
||||
throw new ServiceException("已存在相同站点名称");
|
||||
}
|
||||
int insert = subwayStationMapper.insert(subwayStation);
|
||||
if(insert>0){
|
||||
removeSubwayCache();
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地铁站点
|
||||
*
|
||||
* @param subwayStation 地铁站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSubwayStation(SubwayStation subwayStation)
|
||||
{
|
||||
Long count = subwayStationMapper.selectCount(Wrappers.<SubwayStation>lambdaQuery().eq(SubwayStation::getStationName, subwayStation.getStationName()));
|
||||
if(count>0){
|
||||
throw new ServiceException("已存在相同站点名称");
|
||||
}
|
||||
|
||||
int i = subwayStationMapper.updateById(subwayStation);
|
||||
if(i>0){
|
||||
removeSubwayCache();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地铁站点
|
||||
*
|
||||
* @param stationIds 需要删除的地铁站点主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSubwayStationByStationIds(Long[] stationIds)
|
||||
{
|
||||
return subwayStationMapper.deleteBatchIds(Arrays.asList(stationIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importStation() {
|
||||
//https://map.amap.com/subway/index.html 获取json
|
||||
String jsonFilePath = "D:\\QD\\file.json"; // JSON 文件路径
|
||||
List<SubwayStation> subwayStations = parseJsonToSubwayStations(jsonFilePath);
|
||||
subwayStations.forEach(subwayStationMapper::insert);
|
||||
}
|
||||
/**
|
||||
* 解析 JSON 文件并转换为 SubwayStation 列表
|
||||
*/
|
||||
public List<SubwayStation> parseJsonToSubwayStations(String jsonFilePath) {
|
||||
List<SubwayLine> subwayLines = lineService.selectSubwayLineList(new SubwayLine());
|
||||
List<SubwayStation> subwayStations = new ArrayList<>();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
try {
|
||||
// 读取 JSON 文件
|
||||
SubwayData subwayData = objectMapper.readValue(new File(jsonFilePath), SubwayData.class);
|
||||
|
||||
// 遍历线路和站点
|
||||
for (SubwayLineJson line : subwayData.getLines()) {
|
||||
String lineName = line.getLineName();
|
||||
int orderFlag = 1;
|
||||
//获取line Id
|
||||
Long lineId = null;
|
||||
for(SubwayLine subwayLine:subwayLines){
|
||||
if(subwayLine.getLineName().equals(lineName)){
|
||||
lineId = subwayLine.getLineId();
|
||||
}
|
||||
}
|
||||
for (Station station : line.getStations()) {
|
||||
// 解析经纬度
|
||||
String[] latLng = station.getLocation().split(",");
|
||||
BigDecimal latitude = new BigDecimal(latLng[1]); // 纬度
|
||||
BigDecimal longitude = new BigDecimal(latLng[0]); // 经度
|
||||
|
||||
// 创建 SubwayStation 对象
|
||||
SubwayStation subwayStation = new SubwayStation();
|
||||
subwayStation.setStationName(station.getStationName());
|
||||
subwayStation.setLineName(lineName);
|
||||
subwayStation.setLatitude(latitude);
|
||||
subwayStation.setLongitude(longitude);
|
||||
subwayStation.setStationOrder(orderFlag);
|
||||
subwayStation.setLineId(lineId);
|
||||
orderFlag = orderFlag+1;
|
||||
// 添加到结果列表
|
||||
subwayStations.add(subwayStation);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return subwayStations;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user