1.修改查询条件regionCode like截取

2.修改给招聘会提供的接口
This commit is contained in:
sh
2026-03-18 19:31:44 +08:00
parent 3d69e3d262
commit 7664af7251
5 changed files with 62 additions and 8 deletions

View File

@@ -124,6 +124,9 @@ public class CmsJobController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody Job job)
{
if(job==null){
return error("参数为空!");
}
// 校验描述中的敏感词
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
if (!sensitiveWords.isEmpty()) {
@@ -147,6 +150,9 @@ public class CmsJobController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody Job job)
{
if(job==null){
return error("参数为空!");
}
// 校验描述中的敏感词
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
if (!sensitiveWords.isEmpty()) {
@@ -168,6 +174,9 @@ public class CmsJobController extends BaseController
@DeleteMapping("/{jobIds}")
public AjaxResult remove(@PathVariable Long[] jobIds)
{
if (jobIds == null || jobIds.length == 0) {
return error("参数jobIds不能为空");
}
return toAjax(jobService.deleteJobByJobIds(jobIds));
}

View File

@@ -4,6 +4,7 @@ package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.service.IAppUserService;
import com.ruoyi.cms.service.ICompanyCollectionService;
import com.ruoyi.cms.util.RoleUtils;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.BussinessLog;
import com.ruoyi.common.core.domain.entity.AppUser;
import com.ruoyi.common.core.domain.entity.Company;
@@ -88,36 +89,51 @@ public class CompanyController extends BaseController
/**
* 新增公司
*/
@Anonymous
@ApiOperation("新增公司")
// @PreAuthorize("@ss.hasPermi('app:company:add')")
@Log(title = "公司", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Company company)
{
if(company==null){
return error("参数为空");
}
return toAjax(companyService.insertCompany(company));
}
/**
* 修改公司
*/
@Anonymous
@ApiOperation("修改公司")
// @PreAuthorize("@ss.hasPermi('app:company:edit')")
@Log(title = "公司", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Company company)
{
if(company==null){
return error("参数为空");
}
if(company.getCompanyId()==null){
return error("企业id为空");
}
return toAjax(companyService.updateCompany(company));
}
/**
* 删除公司
*/
@Anonymous
@ApiOperation("删除公司")
// @PreAuthorize("@ss.hasPermi('app:company:remove')")
@Log(title = "公司", businessType = BusinessType.DELETE)
@DeleteMapping("/{companyIds}")
public AjaxResult remove(@PathVariable Long[] companyIds)
{
if (companyIds == null || companyIds.length == 0) {
return error("参数companyIds不能为空");
}
return toAjax(companyService.deleteCompanyByCompanyIds(companyIds));
}

View File

@@ -29,6 +29,7 @@ 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;
import org.springframework.transaction.annotation.Transactional;
/**
* 公司Service业务层处理
@@ -111,6 +112,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertCompany(Company company)
{
Long count = companyMapper.selectCount(Wrappers.<Company>lambdaQuery().eq(Company::getName, company.getName()));
@@ -119,12 +121,14 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
}
int insert =companyMapper.insert(company);
if(insert>0){
company.getCompanyContactList().forEach(x->{
CompanyContact companyContact=new CompanyContact();
BeanUtils.copyProperties(x,companyContact);
companyContact.setCompanyId(company.getCompanyId());
companyContactMapper.insert(companyContact);
});
if(company.getCompanyContactList()!=null){
company.getCompanyContactList().forEach(x->{
CompanyContact companyContact=new CompanyContact();
BeanUtils.copyProperties(x,companyContact);
companyContact.setCompanyId(company.getCompanyId());
companyContactMapper.insert(companyContact);
});
}
}
return insert;
}

View File

@@ -554,7 +554,9 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getRegionCode())){
wrapper.and(x->x.like(ESJobDocument::getRegionCode,esJobSearch.getRegionCode()));
//截取行政区划
String xzqh=StringUtil.autoXzqh(esJobSearch.getRegionCode());
wrapper.and(x->x.likeRight(ESJobDocument::getRegionCode,xzqh));
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getStaffType())){
wrapper.and(x->x.eq(ESJobDocument::getStaffType,esJobSearch.getStaffType()));
@@ -666,7 +668,9 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(x->x.like(ESJobDocument::getJobLocation,jobQuery.getJobLocation()));
}
if(!StringUtil.isEmptyOrNull(jobQuery.getRegionCode())){
wrapper.and(x->x.eq(ESJobDocument::getRegionCode,jobQuery.getRegionCode()));
//截取行政区划
String xzqh=StringUtil.autoXzqh(jobQuery.getRegionCode());
wrapper.and(x->x.likeRight(ESJobDocument::getRegionCode,xzqh));
}
if(!StringUtil.isEmptyOrNull(jobQuery.getStaffType())){
wrapper.and(x->x.eq(ESJobDocument::getStaffType,jobQuery.getStaffType()));

View File

@@ -344,4 +344,25 @@ public class StringUtil {
return "";
}
}
/**
* 截取行政区划
* @param code
* @return
*/
public static String autoXzqh(String code) {
if (code == null || code.length() != 12) return code;
int zeroCount = 0;
for (int i = 11; i >= 0; i--) {
if (code.charAt(i) == '0') zeroCount++;
else break;
}
switch (zeroCount) {
case 10: return code.substring(0, 2);
case 8: return code.substring(0, 4);
case 6: return code.substring(0, 6);
case 3: return code.substring(0, 9);
default: return code;
}
}
}