|
@@ -1,4 +1,4 @@
|
|
|
-package com.zhongzheng.modules.company.service.impl;
|
|
|
|
|
|
|
+package com.zhongzheng.modules.recruit.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
@@ -8,8 +8,9 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import com.zhongzheng.common.core.domain.entity.SysDictData;
|
|
import com.zhongzheng.common.core.domain.entity.SysDictData;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.company.service.ICompanyTradeService;
|
|
|
|
|
-import com.zhongzheng.modules.company.vo.CompanyTradeVo;
|
|
|
|
|
|
|
+import com.zhongzheng.modules.recruit.domain.RecruitCompanyTrade;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.service.IRecruitCompanyTradeService;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.vo.RecruitCompanyTradeVo;
|
|
|
import com.zhongzheng.modules.system.service.ISysDictDataService;
|
|
import com.zhongzheng.modules.system.service.ISysDictDataService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -17,18 +18,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
-import com.zhongzheng.modules.company.bo.CompanyAddBo;
|
|
|
|
|
-import com.zhongzheng.modules.company.bo.CompanyQueryBo;
|
|
|
|
|
-import com.zhongzheng.modules.company.bo.CompanyEditBo;
|
|
|
|
|
-import com.zhongzheng.modules.company.domain.Company;
|
|
|
|
|
-import com.zhongzheng.modules.company.mapper.CompanyMapper;
|
|
|
|
|
-import com.zhongzheng.modules.company.vo.CompanyVo;
|
|
|
|
|
-import com.zhongzheng.modules.company.service.ICompanyService;
|
|
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitCompanyAddBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitCompanyQueryBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.bo.RecruitCompanyEditBo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.domain.RecruitCompany;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.mapper.RecruitCompanyMapper;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.vo.RecruitCompanyVo;
|
|
|
|
|
+import com.zhongzheng.modules.recruit.service.IRecruitCompanyService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
|
-import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -41,45 +41,47 @@ import java.util.stream.Collectors;
|
|
|
* 公司管理列Service业务层处理
|
|
* 公司管理列Service业务层处理
|
|
|
*
|
|
*
|
|
|
* @author ruoyi
|
|
* @author ruoyi
|
|
|
- * @date 2021-08-16
|
|
|
|
|
|
|
+ * @date 2021-08-19
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
-public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
|
|
|
|
|
|
|
+public class RecruitCompanyServiceImpl extends ServiceImpl<RecruitCompanyMapper, RecruitCompany> implements IRecruitCompanyService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISysDictDataService dictDataService;
|
|
private ISysDictDataService dictDataService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private ICompanyTradeService iCompanyTradeService;
|
|
|
|
|
|
|
+ private IRecruitCompanyTradeService iRecruitCompanyTradeService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public CompanyVo queryById(Long companyId){
|
|
|
|
|
- Company db = this.baseMapper.selectById(companyId);
|
|
|
|
|
- return BeanUtil.toBean(db, CompanyVo.class);
|
|
|
|
|
|
|
+ public RecruitCompanyVo queryById(Long companyId){
|
|
|
|
|
+ RecruitCompany db = this.baseMapper.selectById(companyId);
|
|
|
|
|
+ return BeanUtil.toBean(db, RecruitCompanyVo.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public List<CompanyVo> queryList(CompanyQueryBo bo) {
|
|
|
|
|
- LambdaQueryWrapper<Company> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
- lqw.like(StrUtil.isNotBlank(bo.getCompanyName()), Company::getCompanyName, bo.getCompanyName());
|
|
|
|
|
- lqw.eq(bo.getCompanyTypeId() != null, Company::getCompanyTypeId, bo.getCompanyTypeId());
|
|
|
|
|
- lqw.eq(bo.getCompanySizeId() != null, Company::getCompanySizeId, bo.getCompanySizeId());
|
|
|
|
|
- lqw.eq(bo.getIndustryTypeId() != null, Company::getIndustryTypeId, bo.getIndustryTypeId());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getCompanyIntroduce()), Company::getCompanyIntroduce, bo.getCompanyIntroduce());
|
|
|
|
|
- lqw.like(StrUtil.isNotBlank(bo.getIndustryTypeName()), Company::getIndustryTypeName, bo.getIndustryTypeName());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getLogoUrl()), Company::getLogoUrl, bo.getLogoUrl());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getLicenseUrl()), Company::getLicenseUrl, bo.getLicenseUrl());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getSocietyCode()), Company::getSocietyCode, bo.getSocietyCode());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getProvince()), Company::getProvince, bo.getProvince());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getCity()), Company::getCity, bo.getCity());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getAddress()), Company::getAddress, bo.getAddress());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getCompanyPh()), Company::getCompanyPh, bo.getCompanyPh());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getLinkMan()), Company::getLinkMan, bo.getLinkMan());
|
|
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getPostBox()), Company::getPostBox, bo.getPostBox());
|
|
|
|
|
- lqw.eq(Company::getStatus, 1);
|
|
|
|
|
- lqw.eq(bo.getTenantId() != null, Company::getTenantId, bo.getTenantId());
|
|
|
|
|
- List<CompanyVo> companyVos = entity2Vo(this.list(lqw));
|
|
|
|
|
- for (CompanyVo companyVo : companyVos) {
|
|
|
|
|
|
|
+ public List<RecruitCompanyVo> queryList(RecruitCompanyQueryBo bo) {
|
|
|
|
|
+ LambdaQueryWrapper<RecruitCompany> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getCompanyName()), RecruitCompany::getCompanyName, bo.getCompanyName());
|
|
|
|
|
+ lqw.eq(bo.getCompanyTypeId() != null, RecruitCompany::getCompanyTypeId, bo.getCompanyTypeId());
|
|
|
|
|
+ lqw.eq(bo.getCompanySizeId() != null, RecruitCompany::getCompanySizeId, bo.getCompanySizeId());
|
|
|
|
|
+ lqw.eq(bo.getIndustryTypeId() != null, RecruitCompany::getIndustryTypeId, bo.getIndustryTypeId());
|
|
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getIndustryTypeName()), RecruitCompany::getIndustryTypeName, bo.getIndustryTypeName());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getCompanyIntroduce()), RecruitCompany::getCompanyIntroduce, bo.getCompanyIntroduce());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getLogoUrl()), RecruitCompany::getLogoUrl, bo.getLogoUrl());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getLicenseUrl()), RecruitCompany::getLicenseUrl, bo.getLicenseUrl());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getSocietyCode()), RecruitCompany::getSocietyCode, bo.getSocietyCode());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getProvince()), RecruitCompany::getProvince, bo.getProvince());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getCity()), RecruitCompany::getCity, bo.getCity());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getDistrict()), RecruitCompany::getDistrict, bo.getDistrict());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getAddress()), RecruitCompany::getAddress, bo.getAddress());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getCompanyPh()), RecruitCompany::getCompanyPh, bo.getCompanyPh());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getLinkMan()), RecruitCompany::getLinkMan, bo.getLinkMan());
|
|
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getPostBox()), RecruitCompany::getPostBox, bo.getPostBox());
|
|
|
|
|
+ lqw.eq(RecruitCompany::getStatus, 1);
|
|
|
|
|
+ lqw.eq(bo.getTenantId() != null, RecruitCompany::getTenantId, bo.getTenantId());
|
|
|
|
|
+ List<RecruitCompanyVo> companyVos = entity2Vo(this.list(lqw));
|
|
|
|
|
+ for (RecruitCompanyVo companyVo : companyVos) {
|
|
|
SysDictData sysDictData = dictDataService.selectDictDataById(companyVo.getCompanyTypeId());
|
|
SysDictData sysDictData = dictDataService.selectDictDataById(companyVo.getCompanyTypeId());
|
|
|
SysDictData sysDictData1 = dictDataService.selectDictDataById(companyVo.getCompanySizeId());
|
|
SysDictData sysDictData1 = dictDataService.selectDictDataById(companyVo.getCompanySizeId());
|
|
|
companyVo.setCompanyType(sysDictData.getDictLabel());
|
|
companyVo.setCompanyType(sysDictData.getDictLabel());
|
|
@@ -94,13 +96,13 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
* @param collection 实体类集合
|
|
* @param collection 实体类集合
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- private List<CompanyVo> entity2Vo(Collection<Company> collection) {
|
|
|
|
|
- List<CompanyVo> voList = collection.stream()
|
|
|
|
|
- .map(any -> BeanUtil.toBean(any, CompanyVo.class))
|
|
|
|
|
|
|
+ private List<RecruitCompanyVo> entity2Vo(Collection<RecruitCompany> collection) {
|
|
|
|
|
+ List<RecruitCompanyVo> voList = collection.stream()
|
|
|
|
|
+ .map(any -> BeanUtil.toBean(any, RecruitCompanyVo.class))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
if (collection instanceof Page) {
|
|
if (collection instanceof Page) {
|
|
|
- Page<Company> page = (Page<Company>)collection;
|
|
|
|
|
- Page<CompanyVo> pageVo = new Page<>();
|
|
|
|
|
|
|
+ Page<RecruitCompany> page = (Page<RecruitCompany>)collection;
|
|
|
|
|
+ Page<RecruitCompanyVo> pageVo = new Page<>();
|
|
|
BeanUtil.copyProperties(page,pageVo);
|
|
BeanUtil.copyProperties(page,pageVo);
|
|
|
pageVo.addAll(voList);
|
|
pageVo.addAll(voList);
|
|
|
voList = pageVo;
|
|
voList = pageVo;
|
|
@@ -109,23 +111,25 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Boolean insertByAddBo(CompanyAddBo bo) {
|
|
|
|
|
- Company add = BeanUtil.toBean(bo, Company.class);
|
|
|
|
|
|
|
+ public Boolean insertByAddBo(RecruitCompanyAddBo bo) {
|
|
|
|
|
+ RecruitCompany add = BeanUtil.toBean(bo, RecruitCompany.class);
|
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
add.setStatus(1);
|
|
add.setStatus(1);
|
|
|
- CompanyTradeVo companyTradeVo = iCompanyTradeService.queryById(bo.getIndustryTypeId());
|
|
|
|
|
|
|
+ RecruitCompanyTradeVo companyTradeVo = iRecruitCompanyTradeService.queryById(bo.getIndustryTypeId());
|
|
|
add.setIndustryTypeName(companyTradeVo.getTradeName());
|
|
add.setIndustryTypeName(companyTradeVo.getTradeName());
|
|
|
return this.save(add);
|
|
return this.save(add);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Boolean updateByEditBo(CompanyEditBo bo) {
|
|
|
|
|
- Company update = BeanUtil.toBean(bo, Company.class);
|
|
|
|
|
|
|
+ public Boolean updateByEditBo(RecruitCompanyEditBo bo) {
|
|
|
|
|
+ RecruitCompany update = BeanUtil.toBean(bo, RecruitCompany.class);
|
|
|
validEntityBeforeSave(update);
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
- update.setTenantId(null);
|
|
|
|
|
|
|
+ update.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
+ RecruitCompanyTradeVo companyTradeVo = iRecruitCompanyTradeService.queryById(bo.getIndustryTypeId());
|
|
|
|
|
+ update.setIndustryTypeName(companyTradeVo.getTradeName());
|
|
|
return this.updateById(update);
|
|
return this.updateById(update);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -134,7 +138,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
*
|
|
*
|
|
|
* @param entity 实体类数据
|
|
* @param entity 实体类数据
|
|
|
*/
|
|
*/
|
|
|
- private void validEntityBeforeSave(Company entity){
|
|
|
|
|
|
|
+ private void validEntityBeforeSave(RecruitCompany entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -154,16 +158,15 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
ExcelReader reader = ExcelUtil.getReader(inputStream);
|
|
ExcelReader reader = ExcelUtil.getReader(inputStream);
|
|
|
List<List<Object>> readAll = reader.read();
|
|
List<List<Object>> readAll = reader.read();
|
|
|
readAll.remove(0);
|
|
readAll.remove(0);
|
|
|
- List<Company> companyList = new ArrayList<>();
|
|
|
|
|
|
|
+ List<RecruitCompany> companyList = new ArrayList<>();
|
|
|
String TenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
String TenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
Long nowTime = DateUtils.getNowTime();
|
|
Long nowTime = DateUtils.getNowTime();
|
|
|
for (int i = 0; i < readAll.size(); i++) {
|
|
for (int i = 0; i < readAll.size(); i++) {
|
|
|
- Company company = new Company();
|
|
|
|
|
|
|
+ RecruitCompany company = new RecruitCompany();
|
|
|
if(readAll.get(i).get(0).toString().equals("****公司")){
|
|
if(readAll.get(i).get(0).toString().equals("****公司")){
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
company.setCompanyName(readAll.get(i).get(0).toString());
|
|
company.setCompanyName(readAll.get(i).get(0).toString());
|
|
|
- LambdaQueryWrapper<Company> lqw = Wrappers.lambdaQuery();
|
|
|
|
|
Long sysDictData = dictDataService.selectDictLabelType("company_type",readAll.get(i).get(1).toString());
|
|
Long sysDictData = dictDataService.selectDictLabelType("company_type",readAll.get(i).get(1).toString());
|
|
|
if (sysDictData == null){
|
|
if (sysDictData == null){
|
|
|
throw new RuntimeException("第"+i+1+"行公司类型存在错误,请仔细检查再上传。");
|
|
throw new RuntimeException("第"+i+1+"行公司类型存在错误,请仔细检查再上传。");
|