1.修改查询条件regionCode like截取
2.修改给招聘会提供的接口
This commit is contained in:
@@ -124,6 +124,9 @@ public class CmsJobController extends BaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Job job)
|
public AjaxResult add(@RequestBody Job job)
|
||||||
{
|
{
|
||||||
|
if(job==null){
|
||||||
|
return error("参数为空!");
|
||||||
|
}
|
||||||
// 校验描述中的敏感词
|
// 校验描述中的敏感词
|
||||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||||
if (!sensitiveWords.isEmpty()) {
|
if (!sensitiveWords.isEmpty()) {
|
||||||
@@ -147,6 +150,9 @@ public class CmsJobController extends BaseController
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody Job job)
|
public AjaxResult edit(@RequestBody Job job)
|
||||||
{
|
{
|
||||||
|
if(job==null){
|
||||||
|
return error("参数为空!");
|
||||||
|
}
|
||||||
// 校验描述中的敏感词
|
// 校验描述中的敏感词
|
||||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||||
if (!sensitiveWords.isEmpty()) {
|
if (!sensitiveWords.isEmpty()) {
|
||||||
@@ -168,6 +174,9 @@ public class CmsJobController extends BaseController
|
|||||||
@DeleteMapping("/{jobIds}")
|
@DeleteMapping("/{jobIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] jobIds)
|
public AjaxResult remove(@PathVariable Long[] jobIds)
|
||||||
{
|
{
|
||||||
|
if (jobIds == null || jobIds.length == 0) {
|
||||||
|
return error("参数jobIds不能为空");
|
||||||
|
}
|
||||||
return toAjax(jobService.deleteJobByJobIds(jobIds));
|
return toAjax(jobService.deleteJobByJobIds(jobIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package com.ruoyi.cms.controller.cms;
|
|||||||
import com.ruoyi.cms.service.IAppUserService;
|
import com.ruoyi.cms.service.IAppUserService;
|
||||||
import com.ruoyi.cms.service.ICompanyCollectionService;
|
import com.ruoyi.cms.service.ICompanyCollectionService;
|
||||||
import com.ruoyi.cms.util.RoleUtils;
|
import com.ruoyi.cms.util.RoleUtils;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.annotation.BussinessLog;
|
import com.ruoyi.common.annotation.BussinessLog;
|
||||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||||
import com.ruoyi.common.core.domain.entity.Company;
|
import com.ruoyi.common.core.domain.entity.Company;
|
||||||
@@ -88,36 +89,51 @@ public class CompanyController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增公司
|
* 新增公司
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@ApiOperation("新增公司")
|
@ApiOperation("新增公司")
|
||||||
// @PreAuthorize("@ss.hasPermi('app:company:add')")
|
// @PreAuthorize("@ss.hasPermi('app:company:add')")
|
||||||
@Log(title = "公司", businessType = BusinessType.INSERT)
|
@Log(title = "公司", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Company company)
|
public AjaxResult add(@RequestBody Company company)
|
||||||
{
|
{
|
||||||
|
if(company==null){
|
||||||
|
return error("参数为空");
|
||||||
|
}
|
||||||
return toAjax(companyService.insertCompany(company));
|
return toAjax(companyService.insertCompany(company));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公司
|
* 修改公司
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@ApiOperation("修改公司")
|
@ApiOperation("修改公司")
|
||||||
// @PreAuthorize("@ss.hasPermi('app:company:edit')")
|
// @PreAuthorize("@ss.hasPermi('app:company:edit')")
|
||||||
@Log(title = "公司", businessType = BusinessType.UPDATE)
|
@Log(title = "公司", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody Company company)
|
public AjaxResult edit(@RequestBody Company company)
|
||||||
{
|
{
|
||||||
|
if(company==null){
|
||||||
|
return error("参数为空");
|
||||||
|
}
|
||||||
|
if(company.getCompanyId()==null){
|
||||||
|
return error("企业id为空");
|
||||||
|
}
|
||||||
return toAjax(companyService.updateCompany(company));
|
return toAjax(companyService.updateCompany(company));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除公司
|
* 删除公司
|
||||||
*/
|
*/
|
||||||
|
@Anonymous
|
||||||
@ApiOperation("删除公司")
|
@ApiOperation("删除公司")
|
||||||
// @PreAuthorize("@ss.hasPermi('app:company:remove')")
|
// @PreAuthorize("@ss.hasPermi('app:company:remove')")
|
||||||
@Log(title = "公司", businessType = BusinessType.DELETE)
|
@Log(title = "公司", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{companyIds}")
|
@DeleteMapping("/{companyIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] companyIds)
|
public AjaxResult remove(@PathVariable Long[] companyIds)
|
||||||
{
|
{
|
||||||
|
if (companyIds == null || companyIds.length == 0) {
|
||||||
|
return error("参数companyIds不能为空");
|
||||||
|
}
|
||||||
return toAjax(companyService.deleteCompanyByCompanyIds(companyIds));
|
return toAjax(companyService.deleteCompanyByCompanyIds(companyIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.cms.service.ICompanyService;
|
import com.ruoyi.cms.service.ICompanyService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司Service业务层处理
|
* 公司Service业务层处理
|
||||||
@@ -111,6 +112,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int insertCompany(Company company)
|
public int insertCompany(Company company)
|
||||||
{
|
{
|
||||||
Long count = companyMapper.selectCount(Wrappers.<Company>lambdaQuery().eq(Company::getName, company.getName()));
|
Long count = companyMapper.selectCount(Wrappers.<Company>lambdaQuery().eq(Company::getName, company.getName()));
|
||||||
@@ -119,6 +121,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||||||
}
|
}
|
||||||
int insert =companyMapper.insert(company);
|
int insert =companyMapper.insert(company);
|
||||||
if(insert>0){
|
if(insert>0){
|
||||||
|
if(company.getCompanyContactList()!=null){
|
||||||
company.getCompanyContactList().forEach(x->{
|
company.getCompanyContactList().forEach(x->{
|
||||||
CompanyContact companyContact=new CompanyContact();
|
CompanyContact companyContact=new CompanyContact();
|
||||||
BeanUtils.copyProperties(x,companyContact);
|
BeanUtils.copyProperties(x,companyContact);
|
||||||
@@ -126,6 +129,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||||||
companyContactMapper.insert(companyContact);
|
companyContactMapper.insert(companyContact);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return insert;
|
return insert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -554,7 +554,9 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
|
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getRegionCode())){
|
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())){
|
if(!StringUtil.isEmptyOrNull(esJobSearch.getStaffType())){
|
||||||
wrapper.and(x->x.eq(ESJobDocument::getStaffType,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()));
|
wrapper.and(x->x.like(ESJobDocument::getJobLocation,jobQuery.getJobLocation()));
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmptyOrNull(jobQuery.getRegionCode())){
|
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())){
|
if(!StringUtil.isEmptyOrNull(jobQuery.getStaffType())){
|
||||||
wrapper.and(x->x.eq(ESJobDocument::getStaffType,jobQuery.getStaffType()));
|
wrapper.and(x->x.eq(ESJobDocument::getStaffType,jobQuery.getStaffType()));
|
||||||
|
|||||||
@@ -344,4 +344,25 @@ public class StringUtil {
|
|||||||
return "";
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user