|
@@ -21,7 +21,6 @@ import com.hz.employmentsite.vo.companyService.PostVo;
|
|
|
import com.hz.employmentsite.vo.dataMap.CompanyPostMapVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -111,7 +110,7 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
return pcCompanyMapper.selectByExample(exp);
|
|
|
}
|
|
|
|
|
|
- private Integer ifHadRepeatData(CompanyVo data){
|
|
|
+ private String ifHadRepeatData(CompanyVo data, boolean isEdit){
|
|
|
var result = 0;
|
|
|
PcCompanyExample companyExp1 = new PcCompanyExample();
|
|
|
companyExp1.or().andCompanyNameEqualTo(data.getCompanyName()).andCompanyIDNotEqualTo(data.getCompanyID());
|
|
@@ -121,7 +120,7 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
var ifRepeatCode = pcCompanyMapper.selectByExample(companyExp2).size()>0;
|
|
|
result += ifRepeatName? 1:0;
|
|
|
result += ifRepeatCode? 2:0;
|
|
|
- if(result > 0) {
|
|
|
+ if(result > 0 ) {
|
|
|
PcCompanyExample companyExp = new PcCompanyExample();
|
|
|
switch (result){
|
|
|
case 1:
|
|
@@ -145,12 +144,15 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
siteExp.or().andSiteIDEqualTo(createSiteUserInfo.getSiteID());
|
|
|
var curSiteInfo= pcSiteMapper.selectByExample(siteExp).stream().findFirst().orElse(null);
|
|
|
if( curSiteInfo != null){
|
|
|
- throw new BaseException("1004","该企业已被"+curSiteInfo.getSiteName()+",工号"+createSiteUserInfo.getUserNo()+"录入!");
|
|
|
+ if(isEdit){
|
|
|
+ throw new BaseException("1004","该企业已被"+curSiteInfo.getSiteName()+",工号"+createSiteUserInfo.getUserNo()+"录入!");
|
|
|
+ }
|
|
|
+ return "该企业已被"+ curSiteInfo.getSiteName()+",工号"+createSiteUserInfo.getUserNo()+"录入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return result;
|
|
|
+ return String.valueOf(result);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -164,7 +166,7 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
cro.andCompanyIDEqualTo(data.getCompanyID());
|
|
|
dbData = pcCompanyMapper.selectByExampleWithBLOBs(exp).stream().findFirst().orElse(null);
|
|
|
}
|
|
|
- if(ifHadRepeatData(data)>0) {
|
|
|
+ if(Integer.valueOf(ifHadRepeatData(data,true))>0) {
|
|
|
throw new BaseException("1004","该企业已被录入!");
|
|
|
}
|
|
|
if (dbData == null) {
|
|
@@ -351,31 +353,18 @@ public class CompanyServiceImpl implements CompanyService {
|
|
|
dataList.forEach(item -> {
|
|
|
String errorInfo = "";
|
|
|
item.companyID = UUID.randomUUID().toString();
|
|
|
-
|
|
|
- var repeatResult = ifHadRepeatData(item);
|
|
|
- switch (repeatResult){
|
|
|
- default:
|
|
|
- case 0:
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- errorInfo += "企业名称已存在!";
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- errorInfo += "统一社会信用代码已存在!";
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- errorInfo += "信用代码、企业名称重复!";
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (stringUtils.IsNullOrEmpty(item.companyName))
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.companyName)){
|
|
|
errorInfo += "请填写企业名称!";
|
|
|
-
|
|
|
- if (stringUtils.IsNullOrEmpty(item.companyCode))
|
|
|
- errorInfo += "请填写统一信用代码!";
|
|
|
- else{
|
|
|
- if(!regexUtils.theCodeIsValid(item.companyCode)){
|
|
|
- errorInfo +="输入的统一信用代码无效";
|
|
|
+ }else{
|
|
|
+ if (stringUtils.IsNullOrEmpty(item.companyCode))
|
|
|
+ errorInfo += "请填写统一信用代码!";
|
|
|
+ else{
|
|
|
+ if(!regexUtils.theCodeIsValid(item.companyCode)){
|
|
|
+ errorInfo +="输入的统一信用代码无效";
|
|
|
+ }else{
|
|
|
+ var result = ifHadRepeatData(item,false);
|
|
|
+ errorInfo += !result.equals("0")? result:"";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|