|
|
@@ -5,8 +5,13 @@ import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
+import com.zhongzheng.common.core.domain.entity.SysDictData;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.modules.company.service.ICompanyTradeService;
|
|
|
+import com.zhongzheng.modules.company.vo.CompanyTradeVo;
|
|
|
+import com.zhongzheng.modules.system.service.ISysDictDataService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
@@ -28,7 +33,7 @@ import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
-import java.util.Date;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -36,11 +41,17 @@ import java.util.stream.Collectors;
|
|
|
* 公司管理列Service业务层处理
|
|
|
*
|
|
|
* @author ruoyi
|
|
|
- * @date 2021-08-12
|
|
|
+ * @date 2021-08-16
|
|
|
*/
|
|
|
@Service
|
|
|
public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements ICompanyService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDictDataService dictDataService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICompanyTradeService iCompanyTradeService;
|
|
|
+
|
|
|
@Override
|
|
|
public CompanyVo queryById(Long companyId){
|
|
|
Company db = this.baseMapper.selectById(companyId);
|
|
|
@@ -51,10 +62,11 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
public List<CompanyVo> queryList(CompanyQueryBo bo) {
|
|
|
LambdaQueryWrapper<Company> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getCompanyName()), Company::getCompanyName, bo.getCompanyName());
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getCompanyType()), Company::getCompanyType, bo.getCompanyType());
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getCompanySize()), Company::getCompanySize, bo.getCompanySize());
|
|
|
- lqw.eq(bo.getIndustryType()!=null, Company::getIndustryType, bo.getIndustryType());
|
|
|
+ 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());
|
|
|
@@ -64,9 +76,16 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
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());
|
|
|
- return entity2Vo(this.list(lqw));
|
|
|
+ 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) {
|
|
|
+ SysDictData sysDictData = dictDataService.selectDictDataById(companyVo.getCompanyTypeId());
|
|
|
+ SysDictData sysDictData1 = dictDataService.selectDictDataById(companyVo.getCompanySizeId());
|
|
|
+ companyVo.setCompanyType(sysDictData.getDictLabel());
|
|
|
+ companyVo.setCompanySize(sysDictData1.getDictLabel());
|
|
|
+ }
|
|
|
+ return companyVos;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -95,6 +114,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
|
add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ add.setStatus(1);
|
|
|
+ CompanyTradeVo companyTradeVo = iCompanyTradeService.queryById(bo.getIndustryTypeId());
|
|
|
+ add.setIndustryTypeName(companyTradeVo.getTradeName());
|
|
|
return this.save(add);
|
|
|
}
|
|
|
|
|
|
@@ -137,14 +159,23 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
for (int i = 0; i < readAll.size(); i++) {
|
|
|
Company company = new Company();
|
|
|
company.setCompanyName(readAll.get(i).get(0).toString());
|
|
|
- company.setCompanyType(readAll.get(i).get(1).toString());
|
|
|
- Integer industryId = baseMapper.selectIndustry(readAll.get(i).get(2).toString());
|
|
|
+ LambdaQueryWrapper<Company> lqw = Wrappers.lambdaQuery();
|
|
|
+ Long sysDictData = dictDataService.selectDictLabelType("company_type",readAll.get(i).get(1).toString());
|
|
|
+ if (sysDictData == null){
|
|
|
+ throw new RuntimeException("第"+i+1+"行公司类型存在错误,请仔细检查再上传。");
|
|
|
+ }
|
|
|
+ company.setCompanyTypeId(sysDictData);
|
|
|
+ Long industryId = baseMapper.selectIndustry(readAll.get(i).get(2).toString());
|
|
|
if (industryId == null){
|
|
|
- throw new RuntimeException("第"+i+1+"行存在错误,请仔细检查再上传。");
|
|
|
+ throw new RuntimeException("第"+i+1+"行行业类别存在错误,请仔细检查再上传。");
|
|
|
}
|
|
|
- company.setIndustryType(industryId);
|
|
|
+ company.setIndustryTypeId(industryId);
|
|
|
company.setIndustryTypeName(readAll.get(i).get(2).toString());
|
|
|
- company.setCompanySize(readAll.get(i).get(3).toString());
|
|
|
+ Long sysDictLong = dictDataService.selectDictLabelType("company_size",readAll.get(i).get(3).toString());
|
|
|
+ if (sysDictLong == null){
|
|
|
+ throw new RuntimeException("第"+i+1+"行公司规模存在错误,请仔细检查再上传。");
|
|
|
+ }
|
|
|
+ company.setCompanySizeId(sysDictLong);
|
|
|
company.setCompanyIntroduce(readAll.get(i).get(4).toString());
|
|
|
company.setSocietyCode(readAll.get(i).get(5).toString());
|
|
|
company.setProvince(readAll.get(i).get(6).toString());
|