Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
@@ -56,6 +57,15 @@ public class SysLoginController
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@PostMapping("/app/appLogin")
|
||||
public AjaxResult appLogin(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax=loginService.appLogin(loginBody);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
@@ -277,6 +277,7 @@ public class SysUserController extends BaseController
|
||||
sysUser.setPhonenumber(company1.getContactPersonPhone());
|
||||
sysUser.setNickName(company1.getContactPersonPhone());
|
||||
}else{
|
||||
sysUser.setPassword("123456");
|
||||
sysUser.setUserName(company1.getName());
|
||||
sysUser.setNickName(company1.getName());
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.CompanyCardMapper;
|
||||
|
@@ -0,0 +1,81 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.AppSkillService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/appskill/list")
|
||||
@Api(tags = "移动端:用户技能")
|
||||
public class AppSkillController extends BaseController {
|
||||
@Autowired
|
||||
private AppSkillService appSkillService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppSkill appSkill){
|
||||
startPage();
|
||||
List<AppSkill> list=appSkillService.getList(appSkill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult info(@PathVariable("id") Long id){
|
||||
return success(appSkillService.getAppskillById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody AppSkill appSkill){
|
||||
return toAjax(appSkillService.insertAppskill(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult update(@RequestBody AppSkill appSkill){
|
||||
return toAjax(appSkillService.updateAppskillById(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult delete(@ApiParam("主键id") @PathVariable Long id){
|
||||
return toAjax(appSkillService.removeAppskillIds(new Long[]{id}));
|
||||
}
|
||||
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
import com.ruoyi.cms.domain.query.MineJobQuery;
|
||||
@@ -9,6 +9,7 @@ import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -45,6 +46,15 @@ public class AppUserController extends BaseController
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("保存注册信息")
|
||||
@PostMapping("/registerUser")
|
||||
@BussinessLog(title = "保存简历")
|
||||
public AjaxResult saveResume(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
appUserService.registerAppUser(registerBody);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("保存简历")
|
||||
@PostMapping("/resume")
|
||||
@BussinessLog(title = "保存简历")
|
||||
@@ -54,6 +64,7 @@ public class AppUserController extends BaseController
|
||||
appUserService.updateAppUser(appUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查看简历")
|
||||
@GetMapping("/resume")
|
||||
public AjaxResult getResume()
|
||||
@@ -116,4 +127,12 @@ public class AppUserController extends BaseController
|
||||
HashMap<String,Integer> result = jobApplyService.statistics();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据条件查询用户信息")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult getUserList(AppUser appUser)
|
||||
{
|
||||
List<AppUser> list = appUserService.selectAppUserList(appUser);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.domain.UserWorkExperiences;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
import com.ruoyi.cms.service.UserWorkExperiencesService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -36,6 +36,9 @@ public class AppUserWorkExperiencesController extends BaseController {
|
||||
@ApiOperation("工作经历列表信息")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UserWorkExperiences userWorkExperiences){
|
||||
if(userWorkExperiences.getUserId()==null){
|
||||
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
startPage();
|
||||
List<UserWorkExperiences> list=userWorkExperiencesService.getWorkExperiencesList(userWorkExperiences);
|
||||
return getDataTable(list);
|
||||
@@ -57,7 +60,9 @@ public class AppUserWorkExperiencesController extends BaseController {
|
||||
@ApiOperation("新增工作经历")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody UserWorkExperiences userWorkExperiences){
|
||||
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
|
||||
if(userWorkExperiences.getUserId()==null){
|
||||
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
return toAjax(userWorkExperiencesService.insertWorkExperiences(userWorkExperiences));
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,7 @@ public class CmsAppUserController extends BaseController
|
||||
* 查询APP用户列表
|
||||
*/
|
||||
@ApiOperation("查询APP用户列表")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:user:list')")
|
||||
@PreAuthorize("@ss.hasPermi('cms:appUser:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppUser appUser)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ public class CmsAppUserController extends BaseController
|
||||
* 导出APP用户列表
|
||||
*/
|
||||
@ApiOperation("导出APP用户列表")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:user:export')")
|
||||
@PreAuthorize("@ss.hasPermi('cms:appUser:export')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AppUser appUser)
|
||||
|
@@ -3,6 +3,7 @@ package com.ruoyi.cms.controller.cms;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.service.IJobService;
|
||||
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
@@ -33,11 +34,13 @@ public class CmsJobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobService jobService;
|
||||
@Autowired
|
||||
SensitiveWordChecker sensitiveWordChecker;
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("查询岗位列表")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:job:list')")
|
||||
@PreAuthorize("@ss.hasPermi('cms:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Job job)
|
||||
{
|
||||
@@ -79,6 +82,13 @@ public class CmsJobController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Job job)
|
||||
{
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg);
|
||||
}
|
||||
// 无敏感词,执行插入
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
|
||||
@@ -91,6 +101,12 @@ public class CmsJobController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Job job)
|
||||
{
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg);
|
||||
}
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyContact;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
import com.ruoyi.cms.service.CompanyContactService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
@@ -1,8 +1,7 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.service.ICompanyCollectionService;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
@@ -12,7 +11,6 @@ import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -38,7 +36,7 @@ public class CompanyController extends BaseController
|
||||
* 查询公司列表
|
||||
*/
|
||||
@ApiOperation("查询公司列表")
|
||||
@PreAuthorize("@ss.hasPermi('app:company:list')")
|
||||
@PreAuthorize("@ss.hasPermi('cms:company:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Company company)
|
||||
{
|
||||
|
@@ -1,16 +1,23 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.service.IJobApplyService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/jobApply")
|
||||
@@ -26,4 +33,18 @@ public class JobApplyController extends BaseController {
|
||||
HashMap<String,Integer> result = iJobApplyService.trendChart(jobApply);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP用户列表
|
||||
*/
|
||||
@ApiOperation("导出岗位申请APP用户")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobApply:export')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Job job)
|
||||
{
|
||||
List<CandidateVO> list = iJobApplyService.selectAppUserList(job);
|
||||
ExcelUtil<CandidateVO> util = new ExcelUtil<CandidateVO>(CandidateVO.class);
|
||||
util.exportExcel(response, list, "APP用户数据");
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.SensitiveWordData;
|
||||
import com.ruoyi.cms.service.SensitiveWordDataService;
|
||||
import com.ruoyi.cms.util.EasyExcelUtils;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -12,7 +13,9 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -88,4 +91,24 @@ public class SensitiveWordDataController extends BaseController {
|
||||
return toAjax(sensitiveWordDataService.deleteSensitiveworddataIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/exoprt")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream inputStream = file.getInputStream();
|
||||
EasyExcelUtils.readExcelByBatch(inputStream, SensitiveWordData.class, 100, list -> {
|
||||
// 处理逻辑:如批量保存到数据库
|
||||
sensitiveWordDataService.batchInsert(list);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.UserWorkExperiences;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
import com.ruoyi.cms.service.UserWorkExperiencesService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
@@ -2,6 +2,7 @@ package com.ruoyi.cms.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexField;
|
||||
@@ -142,4 +143,7 @@ public class ESJobDocument
|
||||
|
||||
@ApiModelProperty("岗位类型 0疆内 1疆外")
|
||||
private String jobType;
|
||||
|
||||
@ApiModelProperty("类型 0常规岗位 1就业见习岗位 2实习实训岗位 3社区实践岗位 对应字段字典position_type")
|
||||
private String type;
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -162,6 +163,9 @@ public class Job extends BaseEntity
|
||||
@ApiModelProperty("岗位类型 0疆内 1疆外")
|
||||
private String jobType;
|
||||
|
||||
@ApiModelProperty("类型 0常规岗位 1就业见习岗位 2实习实训岗位 3社区实践岗位 对应字段字典position_type")
|
||||
private String type;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("岗位联系人列表")
|
||||
private List<JobContact> jobContactList;
|
||||
|
@@ -5,6 +5,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -31,11 +32,13 @@ public class SensitiveWordData extends BaseEntity {
|
||||
/**
|
||||
* 敏感词
|
||||
*/
|
||||
@ExcelProperty(value = "敏感词", index = 0)
|
||||
@ApiModelProperty("敏感词")
|
||||
private String sensitiveWord;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ExcelProperty(value = "类型", index = 1)
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.cms.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,4 +13,9 @@ public class CandidateVO extends AppUser {
|
||||
private Date applyDate;
|
||||
private Integer matchingDegree;
|
||||
private String applyId;
|
||||
|
||||
@Excel(name = "公司名称", sort = 0)
|
||||
private String companyName;
|
||||
@Excel(name = "岗位名称", sort = 1)
|
||||
private String jobName;
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
public interface AppSkillMapper extends BaseMapper<AppSkill> {
|
||||
|
||||
List<AppSkill> getList(AppSkill appSkill);
|
||||
|
||||
int batchInsert(List<AppSkill> list);
|
||||
}
|
@@ -2,7 +2,10 @@ package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
|
||||
/**
|
||||
* APP用户Mapper接口
|
||||
@@ -20,4 +23,10 @@ public interface AppUserMapper extends BaseMapper<AppUser>
|
||||
public List<AppUser> selectAppUserList(AppUser appUser);
|
||||
|
||||
List<AppUser> selectByJobId(Long jobId);
|
||||
|
||||
AppUser selectByOpenid(String openid);
|
||||
|
||||
int insertSysUserRole(Map<String,Object> map);
|
||||
|
||||
int insertSysUser(SysUser sysUser);
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ package com.ruoyi.cms.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCollection;
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.CompanyContact;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,4 +15,6 @@ import java.util.List;
|
||||
public interface CompanyContactMapper extends BaseMapper<CompanyContact> {
|
||||
|
||||
List<CompanyContact> getSelectList(CompanyContact companyContact);
|
||||
|
||||
int batchInsert(List<CompanyContact> list);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
@@ -30,4 +30,6 @@ public interface JobApplyMapper extends BaseMapper<JobApply>
|
||||
List<CandidateVO> candidates(Long jobId);
|
||||
|
||||
HashMap<String,Integer> trendChart(JobApply jobApply);
|
||||
|
||||
List<CandidateVO> selectAppUserList(Job job);
|
||||
}
|
||||
|
@@ -4,13 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.RowWork;
|
||||
import com.ruoyi.cms.domain.VectorJob;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
/**
|
||||
* 岗位Mapper接口
|
||||
|
@@ -16,4 +16,6 @@ import java.util.List;
|
||||
public interface SensitiveWordDataMapper extends BaseMapper<SensitiveWordData> {
|
||||
|
||||
List<SensitiveWordData> selectSensitiveworddataList(SensitiveWordData sensitiveWordData);
|
||||
|
||||
int batchInsert(List<SensitiveWordData> list);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.cms.domain.UserWorkExperiences;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,4 +15,6 @@ import java.util.List;
|
||||
public interface UserWorkExperiencesMapper extends BaseMapper<UserWorkExperiences> {
|
||||
|
||||
List<UserWorkExperiences> getWorkExperiencesList(UserWorkExperiences userWorkExperiences);
|
||||
|
||||
int batchInsert(List<UserWorkExperiences> list);
|
||||
}
|
||||
|
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
public interface AppSkillService{
|
||||
|
||||
List<AppSkill> getList(AppSkill appSkill);
|
||||
|
||||
int insertAppskill(AppSkill appSkill);
|
||||
|
||||
int updateAppskillById(AppSkill appSkill);
|
||||
|
||||
int removeAppskillIds(Long[] ids);
|
||||
|
||||
AppSkill getAppskillById(Long id);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyContact;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
|
||||
/**
|
||||
* APP用户Service接口
|
||||
@@ -51,4 +52,9 @@ public interface IAppUserService
|
||||
*/
|
||||
public int deleteAppUserByUserIds(Long[] userIds);
|
||||
|
||||
public AppUser getPhone(String phone);
|
||||
|
||||
AppUser selectByOpenid(String openid);
|
||||
|
||||
public int registerAppUser(RegisterBody registerBody);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCollection;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
|
||||
|
@@ -1,11 +1,9 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
|
||||
/**
|
||||
* 公司Service接口
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.Company;
|
||||
import com.ruoyi.cms.domain.FairCollection;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
|
||||
/**
|
||||
* 岗位申请Service接口
|
||||
@@ -59,4 +60,6 @@ public interface IJobApplyService
|
||||
HashMap<String, Integer> statistics();
|
||||
|
||||
HashMap<String,Integer> trendChart(JobApply jobApply);
|
||||
|
||||
List<CandidateVO> selectAppUserList(Job job);
|
||||
}
|
||||
|
@@ -22,5 +22,7 @@ public interface SensitiveWordDataService {
|
||||
int updateSensitiveworddata(SensitiveWordData sensitiveWordData);
|
||||
|
||||
int deleteSensitiveworddataIds(Long[] ids);
|
||||
|
||||
int batchInsert(List<SensitiveWordData> list);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.UserWorkExperiences;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.mapper.AppSkillMapper;
|
||||
import com.ruoyi.cms.service.AppSkillService;
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
|
||||
@Service
|
||||
public class AppSkillServiceImpl extends ServiceImpl<AppSkillMapper, AppSkill> implements AppSkillService {
|
||||
|
||||
@Autowired
|
||||
AppSkillMapper appSkillMapper;
|
||||
|
||||
public List<AppSkill> getList(AppSkill appSkill){
|
||||
return appSkillMapper.getList(appSkill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertAppskill(AppSkill appSkill) {
|
||||
return appSkillMapper.insert(appSkill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAppskillById(AppSkill appSkill) {
|
||||
return appSkillMapper.updateById(appSkill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeAppskillIds(Long[] ids) {
|
||||
return appSkillMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppSkill getAppskillById(Long id) {
|
||||
return appSkillMapper.selectById(id);
|
||||
}
|
||||
}
|
@@ -1,17 +1,23 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.cms.mapper.JobTitleMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
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.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
|
||||
@@ -28,6 +34,14 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
private AppUserMapper appUserMapper;
|
||||
@Autowired
|
||||
private JobTitleMapper jobTitleMapper;
|
||||
@Autowired
|
||||
private CompanyContactMapper companyContactMapper;
|
||||
@Autowired
|
||||
private UserWorkExperiencesMapper userWorkExperiencesMapper;
|
||||
@Autowired
|
||||
private AppSkillMapper appSkillMapper;
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
/**
|
||||
* 查询APP用户
|
||||
*
|
||||
@@ -102,4 +116,63 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper,AppUser> imple
|
||||
return appUserMapper.deleteBatchIds(Arrays.asList(userIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUser getPhone(String phone) {
|
||||
return appUserMapper.selectOne(new LambdaQueryWrapper<AppUser>()
|
||||
.eq(AppUser::getPhone, phone));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppUser selectByOpenid(String openid) {
|
||||
return appUserMapper.selectByOpenid(openid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int registerAppUser(RegisterBody registerBody) {
|
||||
AppUser appUser=registerBody.getAppUser();
|
||||
appUser.setUserId(SiteSecurityUtils.getUserId());
|
||||
//角色集合
|
||||
Map mapUserRole=new HashMap<>();
|
||||
switch (appUser.getIsCompanyUser()){
|
||||
case "0"://企业
|
||||
if(registerBody.getCompany()!=null){
|
||||
Long companyId=registerBody.getCompany().getCompanyId();
|
||||
if(companyId==null){
|
||||
companyMapper.insert(registerBody.getCompany());
|
||||
registerBody.getCompany().getCompanyContactList().forEach(it->{
|
||||
it.setCompanyId(registerBody.getCompany().getCompanyId());
|
||||
});
|
||||
}
|
||||
if(registerBody.getCompany().getCompanyContactList()!=null){
|
||||
companyContactMapper.batchInsert(registerBody.getCompany().getCompanyContactList());
|
||||
}
|
||||
}
|
||||
mapUserRole.put("roleId",100);
|
||||
break;
|
||||
default://求职者
|
||||
if(registerBody.getExperiencesList()!=null){
|
||||
userWorkExperiencesMapper.batchInsert(registerBody.getExperiencesList());
|
||||
}
|
||||
if(registerBody.getAppSkillsList()!=null){
|
||||
appSkillMapper.batchInsert(registerBody.getAppSkillsList());
|
||||
}
|
||||
mapUserRole.put("roleId",1);
|
||||
}
|
||||
//保存sys_user
|
||||
SysUser sysUser=new SysUser();
|
||||
sysUser.setUserId(appUser.getUserId());
|
||||
sysUser.setUserName(appUser.getPhone());
|
||||
sysUser.setNickName(appUser.getName());
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword("123456"));
|
||||
sysUser.setPhonenumber(appUser.getPhone());
|
||||
sysUser.setSex(appUser.getSex());
|
||||
sysUser.setStatus("0");
|
||||
sysUser.setLoginIp(appUser.getLoginIp());
|
||||
sysUser.setLoginDate(appUser.getLoginDate());
|
||||
appUserMapper.insertSysUser(sysUser);
|
||||
//保存sys_user_role
|
||||
mapUserRole.put("userId",appUser.getUserId());
|
||||
appUserMapper.insertSysUserRole(mapUserRole);
|
||||
return appUserMapper.updateById(appUser);
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ 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.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.mapper.JobMapper;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.CompanyContact;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
import com.ruoyi.cms.mapper.CompanyContactMapper;
|
||||
import com.ruoyi.cms.service.CompanyContactService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@@ -10,6 +10,8 @@ import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
import com.ruoyi.common.core.domain.model.LoginSiteUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
@@ -33,7 +35,7 @@ import com.ruoyi.cms.service.ICompanyService;
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@Service
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper,Company> implements ICompanyService
|
||||
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService
|
||||
{
|
||||
@Autowired
|
||||
private CompanyMapper companyMapper;
|
||||
|
@@ -175,6 +175,9 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobType())){
|
||||
newSearch.setJobType(esJobSearch.getJobType());
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getType())){
|
||||
newSearch.setType(esJobSearch.getType());
|
||||
}
|
||||
}
|
||||
|
||||
LambdaEsQueryWrapper<ESJobDocument> wrapper = getWrapper(newSearch,jobIds);
|
||||
@@ -399,6 +402,9 @@ public class ESJobSearchImpl implements IESJobSearchService
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobType())){
|
||||
wrapper.and(x->x.eq(ESJobDocument::getJobType,esJobSearch.getJobType()));
|
||||
}
|
||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getType())){
|
||||
wrapper.and(x->x.eq(ESJobDocument::getType,esJobSearch.getType()));
|
||||
}
|
||||
if(Objects.nonNull(esJobSearch.getOrder())){
|
||||
if(esJobSearch.getOrder()==1){
|
||||
wrapper.orderByDesc(ESJobDocument::getIsHot);
|
||||
|
@@ -2,7 +2,6 @@ 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;
|
||||
|
@@ -6,6 +6,7 @@ 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.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.mapper.*;
|
||||
import com.ruoyi.cms.service.IJobApplyService;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
@@ -121,4 +122,9 @@ public class JobApplyServiceImpl extends ServiceImpl<JobApplyMapper,JobApply> im
|
||||
public HashMap<String, Integer> trendChart(JobApply jobApply) {
|
||||
return jobApplyMapper.trendChart(jobApply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CandidateVO> selectAppUserList(Job job) {
|
||||
return jobApplyMapper.selectAppUserList(job);
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ 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.core.domain.entity.Company;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@@ -16,6 +16,7 @@ import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.cms.util.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
|
@@ -40,4 +40,9 @@ public class SensitiveWordDataServiceImpl implements SensitiveWordDataService {
|
||||
public int deleteSensitiveworddataIds(Long[] ids) {
|
||||
return sensitiveWordDataMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<SensitiveWordData> list) {
|
||||
return sensitiveWordDataMapper.batchInsert(list);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.UserWorkExperiences;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
import com.ruoyi.cms.mapper.UserWorkExperiencesMapper;
|
||||
import com.ruoyi.cms.service.UserWorkExperiencesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@@ -0,0 +1,198 @@
|
||||
package com.ruoyi.cms.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* EasyExcel 工具类(基于 alibaba easyexcel 3.x+)
|
||||
*/
|
||||
public class EasyExcelUtils {
|
||||
|
||||
/**
|
||||
* 读取 Excel 文件(一次性读取所有数据)
|
||||
*
|
||||
* @param file 上传的 Excel 文件
|
||||
* @param head 实体类字节码(需使用 @ExcelProperty 注解映射表头)
|
||||
* @param <T> 实体类泛型
|
||||
* @return 解析后的数据集
|
||||
*/
|
||||
public static <T> List<T> readExcel(File file, Class<T> head) {
|
||||
return EasyExcel.read(file)
|
||||
.head(head)
|
||||
.sheet()
|
||||
.doReadSync();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取 Excel 输入流(一次性读取所有数据)
|
||||
*
|
||||
* @param inputStream Excel 输入流(如 MultipartFile 的 getInputStream())
|
||||
* @param head 实体类字节码
|
||||
* @param <T> 实体类泛型
|
||||
* @return 解析后的数据集
|
||||
*/
|
||||
public static <T> List<T> readExcel(InputStream inputStream, Class<T> head) {
|
||||
return EasyExcel.read(inputStream)
|
||||
.head(head)
|
||||
.sheet()
|
||||
.doReadSync();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分批读取 Excel(适用于大数据量,避免内存溢出)
|
||||
*
|
||||
* @param inputStream Excel 输入流
|
||||
* @param head 实体类字节码
|
||||
* @param batchSize 每批处理的数据量
|
||||
* @param consumer 数据处理函数(如批量保存到数据库)
|
||||
* @param <T> 实体类泛型
|
||||
*/
|
||||
public static <T> void readExcelByBatch(InputStream inputStream, Class<T> head, int batchSize, Consumer<List<T>> consumer) {
|
||||
EasyExcel.read(inputStream)
|
||||
.head(head)
|
||||
.sheet()
|
||||
.registerReadListener(new AnalysisEventListener<T>() {
|
||||
private List<T> batchList; // 临时存储批数据
|
||||
|
||||
@Override
|
||||
public void invoke(T data, AnalysisContext context) {
|
||||
if (batchList == null) {
|
||||
batchList = new java.util.ArrayList<>(batchSize);
|
||||
}
|
||||
batchList.add(data);
|
||||
// 达到批处理量时执行消费逻辑
|
||||
if (batchList.size() >= batchSize) {
|
||||
consumer.accept(batchList);
|
||||
batchList.clear(); // 清空集合,释放内存
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
// 处理剩余不足一批的数据
|
||||
if (batchList != null && !batchList.isEmpty()) {
|
||||
consumer.accept(batchList);
|
||||
}
|
||||
}
|
||||
})
|
||||
.doRead();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 Excel 并写入到输出流(通用样式)
|
||||
*
|
||||
* @param outputStream 输出流(如 HttpServletResponse 的 getOutputStream())
|
||||
* @param data 数据集
|
||||
* @param head 实体类字节码
|
||||
* @param sheetName 工作表名称
|
||||
* @param <T> 实体类泛型
|
||||
*/
|
||||
public static <T> void writeExcel(OutputStream outputStream, List<T> data, Class<T> head, String sheetName) {
|
||||
// 构建通用样式策略(表头居中加粗,内容居中)
|
||||
HorizontalCellStyleStrategy styleStrategy = getDefaultStyleStrategy();
|
||||
|
||||
ExcelWriterSheetBuilder writerBuilder = EasyExcel.write(outputStream, head)
|
||||
.sheet(sheetName)
|
||||
.registerWriteHandler(styleStrategy);
|
||||
|
||||
writerBuilder.doWrite(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 Excel 并通过 HttpServletResponse 下载(前端直接触发下载)
|
||||
*
|
||||
* @param response HttpServletResponse
|
||||
* @param data 数据集
|
||||
* @param head 实体类字节码
|
||||
* @param sheetName 工作表名称
|
||||
* @param fileName 下载的文件名(不带后缀)
|
||||
* @param <T> 实体类泛型
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
public static <T> void downloadExcel(HttpServletResponse response, List<T> data, Class<T> head,
|
||||
String sheetName, String fileName) throws IOException {
|
||||
// 设置响应头,触发前端下载
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
// 文件名编码,避免中文乱码
|
||||
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=UTF-8''" + encodedFileName + ".xlsx");
|
||||
|
||||
// 写入数据到响应流
|
||||
writeExcel(response.getOutputStream(), data, head, sheetName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充 Excel 模板(适用于带固定格式的模板文件)
|
||||
*
|
||||
* @param templateInputStream 模板文件输入流
|
||||
* @param outputStream 输出流(如响应流或文件流)
|
||||
* @param dataMap 填充数据(key为模板中的占位符,value为填充值)
|
||||
* @param sheetName 工作表名称
|
||||
*/
|
||||
public static void fillTemplate(InputStream templateInputStream, OutputStream outputStream,
|
||||
Map<String, Object> dataMap, String sheetName) {
|
||||
EasyExcel.write(outputStream)
|
||||
.withTemplate(templateInputStream)
|
||||
.sheet(sheetName)
|
||||
.doFill(dataMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认单元格样式策略(表头加粗居中,内容居中)
|
||||
*/
|
||||
private static HorizontalCellStyleStrategy getDefaultStyleStrategy() {
|
||||
// 表头样式
|
||||
WriteCellStyle headStyle = new WriteCellStyle();
|
||||
WriteFont headFont = new WriteFont();
|
||||
headFont.setBold(true); // 加粗
|
||||
headFont.setFontHeightInPoints((short) 11);
|
||||
headStyle.setWriteFont(headFont);
|
||||
headStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); // 水平居中
|
||||
headStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中
|
||||
|
||||
// 内容样式
|
||||
WriteCellStyle contentStyle = new WriteCellStyle();
|
||||
WriteFont contentFont = new WriteFont();
|
||||
contentFont.setFontHeightInPoints((short) 11);
|
||||
contentStyle.setWriteFont(contentFont);
|
||||
contentStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
contentStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
|
||||
// 返回样式策略
|
||||
return new HorizontalCellStyleStrategy(headStyle, contentStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭流(工具类内部使用)
|
||||
*/
|
||||
private static void closeStream(Closeable... closeables) {
|
||||
if (closeables != null) {
|
||||
for (Closeable closeable : closeables) {
|
||||
if (Objects.nonNull(closeable)) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (IOException e) {
|
||||
// 日志记录(建议替换为实际项目的日志框架)
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,10 +11,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Base64;
|
||||
import java.util.Formatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -24,8 +28,8 @@ public class WechatUtil {
|
||||
/**
|
||||
* 生成signature
|
||||
**/
|
||||
private static String appid = "wx7cab1155e849fe18";
|
||||
private static String secret = "0263f34d422d24588d6c2df8f09500ab";
|
||||
private static String appid = "wxee0d0655e464f184";
|
||||
private static String secret = "38a71cb90ea12c6b2eee4434ae7932cf";
|
||||
public AppWechatEntity sign(String url) {
|
||||
Map<String, String> ret = new HashMap();
|
||||
String nonceStr = create_nonce_str();
|
||||
@@ -168,6 +172,7 @@ public class WechatUtil {
|
||||
private String getAccessTokenData(String url) {
|
||||
String str = "";
|
||||
String result = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8);
|
||||
System.out.println("result=============="+result);
|
||||
if (StringUtils.isEmpty(result))
|
||||
return str;
|
||||
str = parseData("access_token", "expires_in", result);
|
||||
@@ -200,6 +205,20 @@ public class WechatUtil {
|
||||
return tokenConent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取appid和session_key
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private String getAccessData(String url) {
|
||||
String str = "";
|
||||
String result = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8);
|
||||
System.out.println("result=============="+result);
|
||||
if (StringUtils.isEmpty(result))
|
||||
return str;
|
||||
return result;
|
||||
}
|
||||
|
||||
private String byteToHex(final byte[] hash) {
|
||||
Formatter formatter = new Formatter();
|
||||
for (byte b : hash) {
|
||||
@@ -210,6 +229,69 @@ public class WechatUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获取微信用户的openid和session_key
|
||||
*
|
||||
* @param code 登录凭证code
|
||||
* @return 包含openid、session_key、unionid的JSON对象
|
||||
*/
|
||||
public JSONObject code2Session(String code) {
|
||||
try {
|
||||
System.out.println("appid==============="+appid);
|
||||
System.out.println("secret================"+secret);
|
||||
String response = getAccessData("https://api.weixin.qq.com/sns/jscode2session?appid="+appid+"&secret="+secret+"&js_code="+code+"&grant_type=authorization_code");
|
||||
JSONObject result = JSONObject.parseObject(response);
|
||||
// 微信返回错误码处理
|
||||
if (result.containsKey("errcode") && result.getInteger("errcode") != 0) {
|
||||
throw new RuntimeException("微信授权失败:" + result.getString("errmsg"));
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("调用微信接口失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密微信用户手机号(用户通过 getPhoneNumber 组件授权后返回的加密数据)
|
||||
* @param encryptedData 微信返回的加密手机号数据
|
||||
* @param sessionKey 从 code2Session 接口获取的会话密钥
|
||||
* @param iv 微信返回的加密向量(与 encryptedData 配套)
|
||||
* @return 解密后的 JSON 对象(包含 phoneNumber、purePhoneNumber 等字段)
|
||||
* @throws RuntimeException 解密失败时抛出
|
||||
*/
|
||||
public JSONObject decryptPhoneNumber(String encryptedData, String sessionKey, String iv) {
|
||||
try {
|
||||
// 1. Base64 解码(encryptedData、sessionKey、iv 均为 Base64 编码)
|
||||
byte[] encryptedDataBytes = Base64.getDecoder().decode(encryptedData);
|
||||
byte[] sessionKeyBytes = Base64.getDecoder().decode(sessionKey);
|
||||
byte[] ivBytes = Base64.getDecoder().decode(iv);
|
||||
|
||||
// 2. 验证session_key长度(AES-128要求密钥长度为16字节)
|
||||
if (sessionKeyBytes.length != 16) {
|
||||
throw new RuntimeException("session_key长度错误,应为16字节");
|
||||
}
|
||||
// 验证iv长度(CBC模式下iv长度必须与块大小一致,AES为16字节)
|
||||
if (ivBytes.length != 16) {
|
||||
throw new RuntimeException("iv长度错误,应为16字节");
|
||||
}
|
||||
|
||||
// 2. 初始化 AES-128-CBC 解密器(使用PKCS5Padding替换PKCS7Padding,两者在AES中效果一致)
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
SecretKeySpec keySpec = new SecretKeySpec(sessionKeyBytes, "AES");
|
||||
IvParameterSpec ivSpec = new IvParameterSpec(ivBytes);
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||
|
||||
// 3. 执行解密并转换为字符串
|
||||
byte[] decryptedBytes = cipher.doFinal(encryptedDataBytes);
|
||||
String decryptedStr = new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
|
||||
// 4. 解析为 JSON 并返回(包含手机号等信息)
|
||||
return JSONObject.parseObject(decryptedStr);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("解密用户手机号失败:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private String create_nonce_str() {
|
||||
return IdUtil.simpleUUID();
|
||||
}
|
||||
|
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.cms.util.sensitiveWord;
|
||||
|
||||
import com.ruoyi.cms.domain.SensitiveWordData;
|
||||
import com.ruoyi.cms.mapper.SensitiveWordDataMapper;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class SensitiveWordChecker {
|
||||
|
||||
@Autowired
|
||||
private SensitiveWordDataMapper sensitiveWordDataMapper;
|
||||
|
||||
@Autowired
|
||||
private SensitiveWordTrie trie; // 注入前缀树
|
||||
// 缓存键常量
|
||||
private static final String SENSITIVE_WORD_CACHE_KEY = "sensitive:words";
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 项目启动时初始化敏感词库到前缀树
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
List<String> sensitiveWords = getSensitiveWordsFromCache();
|
||||
if (sensitiveWords.isEmpty()) {
|
||||
// 缓存未命中,从数据库加载
|
||||
sensitiveWords = loadSensitiveWordsFromDbAndCache();
|
||||
}
|
||||
// 初始化前缀树
|
||||
trie.batchAddWords(sensitiveWords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测文本中的敏感词
|
||||
* @param text 待检测文本(如job.getDescription())
|
||||
* @return 敏感词列表(空列表表示无敏感词)
|
||||
*/
|
||||
public List<String> checkSensitiveWords(String text) {
|
||||
return trie.findAllSensitiveWords(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从缓存获取敏感词列表
|
||||
*/
|
||||
@Cacheable(value = SENSITIVE_WORD_CACHE_KEY)
|
||||
public List<String> getSensitiveWordsFromCache() {
|
||||
// 从Redis获取
|
||||
Object cachedWords = redisCache.getCacheObject(SENSITIVE_WORD_CACHE_KEY);
|
||||
if (cachedWords instanceof List<?>) {
|
||||
return ((List<?>) cachedWords).stream()
|
||||
.filter(obj -> obj instanceof String)
|
||||
.map(obj -> (String) obj)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从数据库加载敏感词并更新缓存
|
||||
*/
|
||||
public List<String> loadSensitiveWordsFromDbAndCache() {
|
||||
List<SensitiveWordData> wordList = sensitiveWordDataMapper.selectSensitiveworddataList(new SensitiveWordData());
|
||||
List<String> sensitiveWords = wordList.stream()
|
||||
.map(SensitiveWordData::getSensitiveWord)
|
||||
.collect(Collectors.toList());
|
||||
// 缓存有效期设置为24小时,可根据实际需求调整
|
||||
redisCache.setCacheObject(SENSITIVE_WORD_CACHE_KEY, sensitiveWords, 24, TimeUnit.HOURS);
|
||||
return sensitiveWords;
|
||||
}
|
||||
|
||||
/**
|
||||
* 敏感词更新时清除缓存(需在敏感词管理服务中调用)
|
||||
*/
|
||||
@CacheEvict(value = SENSITIVE_WORD_CACHE_KEY, allEntries = true)
|
||||
public void clearSensitiveWordCache() {
|
||||
// 清除缓存后可重新加载
|
||||
loadSensitiveWordsFromDbAndCache();
|
||||
// 重新初始化前缀树
|
||||
trie.clear();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增/修改敏感词后更新缓存和前缀树
|
||||
*/
|
||||
public void updateCacheAfterModify() {
|
||||
// 1. 清除旧缓存
|
||||
redisCache.deleteObject(SENSITIVE_WORD_CACHE_KEY);
|
||||
// 2. 从数据库重新加载最新数据并更新缓存
|
||||
List<String> latestWords = loadSensitiveWordsFromDbAndCache();
|
||||
// 3. 重建前缀树
|
||||
trie.clear();
|
||||
trie.batchAddWords(latestWords);
|
||||
}
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.cms.util.sensitiveWord;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 前缀树(Trie树)节点
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 前缀树(Trie树)工具类
|
||||
*/
|
||||
@Component
|
||||
public class SensitiveWordTrie {
|
||||
// 根节点(无实际字符)
|
||||
private final TrieNode root = new TrieNode();
|
||||
|
||||
/**
|
||||
* 向前缀树中添加敏感词
|
||||
*/
|
||||
public void addWord(String word) {
|
||||
if (word == null || word.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
TrieNode current = root;
|
||||
for (char c : word.toCharArray()) {
|
||||
// 若子节点中不存在该字符,则创建新节点
|
||||
current.getChildren().putIfAbsent(c, new TrieNode());
|
||||
// 移动到子节点
|
||||
current = current.getChildren().get(c);
|
||||
}
|
||||
// 标记当前节点为敏感词结尾
|
||||
current.setEnd(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测文本中所有敏感词(去重)
|
||||
* @param text 待检测文本
|
||||
* @return 敏感词列表
|
||||
*/
|
||||
public List<String> findAllSensitiveWords(String text) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Set<String> sensitiveWords = new HashSet<>();
|
||||
TrieNode current = root;
|
||||
StringBuilder currentWord = new StringBuilder(); // 记录当前匹配的字符
|
||||
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
|
||||
// 若当前字符不在子节点中,重置匹配状态
|
||||
if (!current.getChildren().containsKey(c)) {
|
||||
current = root; // 回到根节点
|
||||
currentWord.setLength(0); // 清空当前匹配的字符
|
||||
continue;
|
||||
}
|
||||
|
||||
// 匹配到字符,移动到子节点
|
||||
current = current.getChildren().get(c);
|
||||
currentWord.append(c);
|
||||
|
||||
// 若当前节点是敏感词结尾,记录该敏感词
|
||||
if (current.isEnd()) {
|
||||
sensitiveWords.add(currentWord.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>(sensitiveWords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加敏感词到前缀树
|
||||
* @param words 敏感词列表
|
||||
*/
|
||||
public void batchAddWords(List<String> words) {
|
||||
if (words == null || words.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 批量处理比循环单次添加更高效,减少重复判断
|
||||
for (String word : words) {
|
||||
addWord(word);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空前缀树所有节点
|
||||
*/
|
||||
public void clear() {
|
||||
// 清空根节点的子节点映射,达到清空整个前缀树的效果
|
||||
root.getChildren().clear();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.cms.util.sensitiveWord;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
class TrieNode {
|
||||
// 子节点:key=字符,value=子节点
|
||||
private final Map<Character, TrieNode> children = new HashMap<>();
|
||||
// 标记当前节点是否为敏感词的结尾
|
||||
private boolean isEnd = false;
|
||||
|
||||
public Map<Character, TrieNode> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public boolean isEnd() {
|
||||
return isEnd;
|
||||
}
|
||||
|
||||
public void setEnd(boolean end) {
|
||||
isEnd = end;
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.ruoyi.cms.mapper.AppSkillMapper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="AppSkill" id="AppSkillResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="levels" column="levels"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectAppSkillVo">
|
||||
select id, user_id, name, levels, del_flag, create_by, create_time, update_by, update_time, remark from app_skill
|
||||
</sql>
|
||||
|
||||
<select id="getList" resultType="AppSkill" resultMap="AppSkillResult">
|
||||
<include refid="selectAppSkillVo"/>
|
||||
<where> del_flag = '0'
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="levels != null and levels != ''"> and levels = #{levels}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO app_skill (
|
||||
user_id, name, levels, create_by, create_time, del_flag
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.userId}, #{item.name}, #{item.levels},
|
||||
#{item.createBy}, #{item.createTime}, #{item.delFlag}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@@ -29,11 +29,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="jobTitleId" column="job_title_id" />
|
||||
<result property="isRecommend" column="is_recommend" />
|
||||
<result property="idCard" column="id_card" />
|
||||
<result property="hire" column="hire" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppUserVo">
|
||||
select user_id, name, age, sex, birth_date, education, political_affiliation, phone, avatar, salary_min, salary_max, area, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark,job_title_id,is_recommend,id_card,hire from app_user
|
||||
select user_id, name, age, sex, birth_date, education, political_affiliation, phone, avatar, salary_min, salary_max, area, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark,job_title_id,is_recommend,id_card from app_user
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserList" parameterType="AppUser" resultMap="AppUserResult">
|
||||
@@ -63,4 +62,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
INNER JOIN JOB_APPLY ja ON ja.USER_ID = au.USER_ID
|
||||
WHERE au.DEL_FLAG = '0' AND ja.DEL_FLAG = '0' AND ja.JOB_Id = #{jobId})
|
||||
</select>
|
||||
|
||||
<select id="selectByOpenid" resultType="com.ruoyi.common.core.domain.entity.AppUser">
|
||||
SELECT * FROM app_user WHERE DEL_FLAG = '0' and openid=#{openid} LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserRole" parameterType="java.util.Map">
|
||||
insert into sys_user_role (user_id,role_id) values (#{userId},#{roleId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSysUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="collectionJob" resultType="com.ruoyi.cms.domain.Company">
|
||||
<select id="collectionJob" resultType="com.ruoyi.common.core.domain.entity.Company">
|
||||
select *
|
||||
from company
|
||||
where del_flag = '0'
|
||||
|
@@ -36,4 +36,17 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO company_contact (
|
||||
company_id, contact_person, contact_person_phone,
|
||||
create_by, create_time, del_flag,remark
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.companyId}, #{item.contactPerson}, #{item.contactPersonPhone},
|
||||
#{item.createBy}, #{item.createTime}, #{item.delFlag},#{item.remark}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
@@ -55,4 +55,50 @@
|
||||
group by a.job_title
|
||||
</select>
|
||||
|
||||
<sql id="selectAppUserVo">
|
||||
select user_id, name, age, sex, birth_date, education, political_affiliation, phone, avatar, salary_min, salary_max, area, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark,job_title_id,is_recommend,id_card,hire from app_user
|
||||
</sql>
|
||||
|
||||
<select id="selectAppUserList" parameterType="com.ruoyi.cms.domain.Job" resultType="com.ruoyi.cms.domain.vo.CandidateVO">
|
||||
select b.job_title jobName,l.name companyName,e.* from job_apply a
|
||||
INNER join job b on a.job_id=b.job_id and b.del_flag='0'
|
||||
INNER join app_user e on a.user_id =e.user_id and e.del_flag='0'
|
||||
INNER join company l on b.company_id =l.company_id and l.del_flag='0'
|
||||
where a.del_flag='0' and a.hire='0'
|
||||
<if test="jobTitle != null and jobTitle != ''"> and b.job_title like concat('%', cast(#{jobTitle, jdbcType=VARCHAR} as varchar), '%')</if>
|
||||
<if test="education != null and education != ''"> and b.education = #{education}</if>
|
||||
<if test="experience != null and experience != ''"> and b.experience = #{experience}</if>
|
||||
<if test="companyName != null and companyName != ''"> and b.company_name like concat('%', cast(#{companyName, jdbcType=VARCHAR} as varchar), '%')</if>
|
||||
<if test="jobLocation != null and jobLocation != ''"> and b.job_location = #{jobLocation}</if>
|
||||
<if test="postingDate != null and postingDate!=''"> and b.posting_date = #{postingDate}</if>
|
||||
<if test="vacancies != null "> and b.vacancies = #{vacancies}</if>
|
||||
<if test="latitude != null "> and b.latitude = #{latitude}</if>
|
||||
<if test="longitude != null "> and b.longitude = #{longitude}</if>
|
||||
<if test="view != null "> and b."view" = #{view}</if>
|
||||
<if test="companyId != null "> and b.company_id = #{companyId}</if>
|
||||
<if test="isHot != null "> and b.is_hot = #{isHot}</if>
|
||||
<if test="applyNum != null "> and b.apply_num = #{applyNum}</if>
|
||||
<if test="code != null "> and b.company_id in(select company_id from company where code=#{code})</if>
|
||||
<if test="compensation!=null ">
|
||||
<if test="compensation==0 ">
|
||||
and b.min_salary < 1750
|
||||
</if>
|
||||
<if test="compensation==1 ">
|
||||
and b.max_salary < 2000 and b.min_salary >= 1750
|
||||
</if>
|
||||
<if test="compensation==2 ">
|
||||
and b.max_salary < 3000 and b.min_salary >= 2000
|
||||
</if>
|
||||
<if test="compensation==3 ">
|
||||
and b.max_salary < 4000 and b.min_salary >= 3000
|
||||
</if>
|
||||
<if test="compensation==4 ">
|
||||
and b.max_salary < 5000 and b.min_salary >= 4000
|
||||
</if>
|
||||
<if test="compensation==5 ">
|
||||
and b.min_salary > 5000
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@@ -194,7 +194,7 @@
|
||||
Collect_time, ClearFlag, Province, City, County, importdate, YearMonth,
|
||||
IsRepeat, latitude, longitude,Std_class as JobCategory from row_work
|
||||
</select>
|
||||
<select id="selectRowCompany" resultType="com.ruoyi.cms.domain.Company">
|
||||
<select id="selectRowCompany" resultType="com.ruoyi.common.core.domain.entity.Company">
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
|
@@ -29,4 +29,12 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO sensitive_word_data (sensitive_word, type, create_time,create_by,del_flag,remark)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.sensitiveWord}, #{item.type}, #{item.createTime},#{item.createBy},#{item.delFlag},#{item.remark})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
@@ -31,7 +31,21 @@
|
||||
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
||||
<if test="position != null and position != ''"> and position = #{position}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO user_work_experiences (
|
||||
company_name, position, user_id, start_date, end_date, description,
|
||||
create_by, create_time, del_flag,remark
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.companyName}, #{item.position}, #{item.userId},#{item.startDate},#{item.endDate},
|
||||
#{item.description},#{item.createBy}, #{item.createTime}, #{item.delFlag},#{item.remark}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
@Data
|
||||
@TableName("app_skill")
|
||||
public class AppSkill extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "user_id",type = IdType.AUTO)
|
||||
@ApiModelProperty("用户ID")
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 技能名称
|
||||
*/
|
||||
@ApiModelProperty("技能名称")
|
||||
private String name;
|
||||
/**
|
||||
* 技能等级
|
||||
*/
|
||||
@ApiModelProperty("技能等级")
|
||||
private String levels;
|
||||
}
|
@@ -104,13 +104,27 @@ public class AppUser extends BaseEntity
|
||||
@ApiModelProperty("身份证")
|
||||
private String idCard;
|
||||
|
||||
@ApiModelProperty("是否录用 0录用,1未录用")
|
||||
private String hire;
|
||||
|
||||
@ApiModelProperty("是否企业用户 0是,1否")
|
||||
/**
|
||||
* 是否企业用户 0是,1否改为(0企业,1求职者,2网格员)
|
||||
*/
|
||||
@ApiModelProperty("app角色:0企业,1求职者,2网格员 3内部政府人员")
|
||||
private String isCompanyUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 微信小程序用户唯一标识
|
||||
*/
|
||||
@ApiModelProperty("微信小程序用户唯一标识")
|
||||
private String openid;
|
||||
/**
|
||||
* 微信开放平台全局标识
|
||||
*/
|
||||
@ApiModelProperty("微信开放平台全局标识")
|
||||
private String unionid;
|
||||
|
||||
@ApiModelProperty("民族")
|
||||
private String nation;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
@@ -105,4 +105,10 @@ public class Company extends BaseEntity
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("驳回时间")
|
||||
private String rejectTime;
|
||||
|
||||
@ApiModelProperty("是否本地重点企业")
|
||||
private String isImpCompany;
|
||||
|
||||
@ApiModelProperty("本地重点发展产业")
|
||||
private String impCompanyType;
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
@@ -26,6 +26,18 @@ public class LoginBody
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
/**
|
||||
* 微信加密的手机号数据
|
||||
*/
|
||||
private String encryptedData;
|
||||
/**
|
||||
* 加密向量
|
||||
*/
|
||||
private String iv;
|
||||
/**
|
||||
* 0企业,1求职者
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
@@ -66,4 +78,28 @@ public class LoginBody
|
||||
{
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getEncryptedData() {
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
public void setEncryptedData(String encryptedData) {
|
||||
this.encryptedData = encryptedData;
|
||||
}
|
||||
|
||||
public String getIv() {
|
||||
return iv;
|
||||
}
|
||||
|
||||
public void setIv(String iv) {
|
||||
this.iv = iv;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,29 @@
|
||||
package com.ruoyi.common.core.domain.model;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.*;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户注册对象
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class RegisterBody extends LoginBody
|
||||
{
|
||||
|
||||
@ApiModelProperty("工作经历列表")
|
||||
private List<UserWorkExperiences> experiencesList;
|
||||
|
||||
@ApiModelProperty("技能列表")
|
||||
private List<AppSkill> appSkillsList;
|
||||
|
||||
@ApiModelProperty("公司信息")
|
||||
private Company company;
|
||||
|
||||
@ApiModelProperty("用户信息")
|
||||
private AppUser appUser;
|
||||
}
|
||||
|
@@ -2,7 +2,13 @@ package com.ruoyi.framework.web.service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.cms.util.WechatUtil;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||
import com.ruoyi.common.core.domain.model.LoginSiteUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
@@ -57,6 +63,10 @@ public class SysLoginService
|
||||
|
||||
@Autowired
|
||||
private TokenSiteService tokenSiteService;
|
||||
@Autowired
|
||||
WechatUtil wechatUtil;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
@@ -118,6 +128,24 @@ public class SysLoginService
|
||||
// 生成token
|
||||
return tokenSiteService.createToken(loginSiteUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据微信生成的
|
||||
* @param appUser
|
||||
* @return
|
||||
*/
|
||||
public String loginUserIdApp(AppUser appUser)
|
||||
{
|
||||
LoginSiteUser loginSiteUser = new LoginSiteUser();
|
||||
loginSiteUser.setUserId(appUser.getUserId());
|
||||
loginSiteUser.setUser(appUser);
|
||||
recordLoginInfo(appUser);
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(appUser.getName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
recordLoginInfo(appUser);
|
||||
// 生成token
|
||||
return tokenSiteService.createToken(loginSiteUser);
|
||||
}
|
||||
|
||||
//单点登录
|
||||
public String loginOss(String ticket)
|
||||
{
|
||||
@@ -209,4 +237,55 @@ public class SysLoginService
|
||||
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||
userService.updateUserProfile(sysUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序微信授权登录
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult appLogin(LoginBody dto){
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
System.out.println("小程序微信授权登录---------参数列表========dto========"+ JSON.toJSONString(dto));
|
||||
JSONObject sessionInfo = wechatUtil.code2Session(dto.getCode());
|
||||
String openid = sessionInfo.getString("openid");
|
||||
String unionid = sessionInfo.getString("unionid");
|
||||
String sessionKey = sessionInfo.getString("session_key");
|
||||
if (openid == null) {
|
||||
return AjaxResult.error("微信授权失败");
|
||||
}
|
||||
//验证是否登录过
|
||||
AppUser existingUser=appUserService.selectByOpenid(openid);
|
||||
if(existingUser!=null){
|
||||
String token = loginUserIdApp(existingUser);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
ajax.put("isNewUser", false);
|
||||
return ajax;
|
||||
}else {
|
||||
JSONObject phoneInfo = wechatUtil.decryptPhoneNumber(dto.getEncryptedData(), sessionKey, dto.getIv());
|
||||
String phone = phoneInfo.getString("phoneNumber");
|
||||
if (phone == null) {
|
||||
return AjaxResult.error("获取手机号失败");
|
||||
}
|
||||
|
||||
// 3. 检查手机号是否已被绑定
|
||||
AppUser existUser = appUserService.getPhone(phone);
|
||||
if (existUser != null) {
|
||||
return AjaxResult.error("该手机号已注册");
|
||||
}
|
||||
|
||||
// 4. 创建用户并存储所有信息
|
||||
AppUser appUser = new AppUser();
|
||||
appUser.setOpenid(openid);
|
||||
appUser.setUnionid(unionid);
|
||||
appUser.setPhone(phone);
|
||||
appUser.setIsCompanyUser(dto.getUserType());//保存角色
|
||||
appUserService.insertAppUser(appUser);
|
||||
|
||||
// 5. 生成系统令牌
|
||||
String token = loginUserIdApp(appUser);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
ajax.put("isNewUser", true);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user