Commit ac3728dc authored by suhuiguang's avatar suhuiguang

1.注册code空针bug

parent 3bd50aed
...@@ -60,6 +60,7 @@ import org.springframework.util.StopWatch; ...@@ -60,6 +60,7 @@ import org.springframework.util.StopWatch;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -345,20 +346,20 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -345,20 +346,20 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Override @Override
public RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName) { public RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName) {
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
startPlatformTokenService.getToken(); startPlatformTokenService.getToken();
if (!ValidationUtil.isEmpty(companyName)) { if (!ValidationUtil.isEmpty(companyName)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName); FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null) if(result.getResult()!=null)
{ {
throw new RuntimeException("重复的公司名称"); throw new BadRequest("重复的公司名称");
} }
} }
if (!ValidationUtil.isEmpty(unitCode)) { if (!ValidationUtil.isEmpty(unitCode)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode); FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode);
if(result.getResult()!=null) if(result.getResult()!=null)
{ {
throw new RuntimeException("重复的公司编码"); throw new BadRequest("重复的公司编码");
} }
} }
// 1.校验重复性 // 1.校验重复性
...@@ -368,7 +369,6 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -368,7 +369,6 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// throw new RuntimeException("该单位已注册,请联系企业管理员!"); // throw new RuntimeException("该单位已注册,请联系企业管理员!");
// } // }
// 2.组织返回数据 // 2.组织返回数据
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
//2.1 工商信息查询 //2.1 工商信息查询
Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult(); Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult();
if(!ValidationUtil.isEmpty(resultMap)){ if(!ValidationUtil.isEmpty(resultMap)){
...@@ -376,7 +376,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -376,7 +376,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
String area = String.valueOf(resultMap.get("area")); String area = String.valueOf(resultMap.get("area"));
String city = area.substring(0,area.indexOf("市")+1); String city = area.substring(0,area.indexOf("市")+1);
String district = area.substring(city.length()); String district = area.substring(city.length());
if(district.equals("高新区")){ if("高新区".equals(district)){
district = "雁塔区"; district = "雁塔区";
} }
regUnitInfoDto.setCity(city); regUnitInfoDto.setCity(city);
...@@ -388,12 +388,15 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -388,12 +388,15 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName"))); regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName")));
regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople"))); regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople")));
String industryName = ""; String industryName = "";
if(ObjectUtils.isNotEmpty(resultMap.get("industryCode"))){
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
Optional<DataDictionary> op = dictionaries.stream().filter(d->d.getCode().equals(String.valueOf(resultMap.get("industryCode"))) && "HYXLDM".equals(d.getType())).findFirst(); Optional<DataDictionary> op = dictionaries.stream().filter(d->d.getCode() != null && d.getType() !=null && d.getCode().equals(String.valueOf(resultMap.get("industryCode")))&& "HYXLDM".equals(d.getType())).findFirst();
if(op.isPresent()) { if(op.isPresent()) {
DataDictionary dataDictionary = op.get(); DataDictionary dataDictionary = op.get();
industryName = dataDictionary.getName(); industryName = dataDictionary.getName();
} }
}
String approveDate = String.valueOf(resultMap.get("approval_time")); String approveDate = String.valueOf(resultMap.get("approval_time"));
approveDate = approveDate.contains("年")?approveDate.replace("年","-"):approveDate; approveDate = approveDate.contains("年")?approveDate.replace("年","-"):approveDate;
approveDate = approveDate.contains("月")?approveDate.replace("月","-"):approveDate; approveDate = approveDate.contains("月")?approveDate.replace("月","-"):approveDate;
...@@ -425,6 +428,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -425,6 +428,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
List<BaseUnitLicence> unitLicences = baseUnitLicenceService List<BaseUnitLicence> unitLicences = baseUnitLicenceService
.list(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode)); .list(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode));
regUnitInfoDto.setUnitLicences(Bean.toModels(unitLicences, BaseUnitLicenceDto.class)); regUnitInfoDto.setUnitLicences(Bean.toModels(unitLicences, BaseUnitLicenceDto.class));
return regUnitInfoDto; return regUnitInfoDto;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment