Commit ac3728dc authored by suhuiguang's avatar suhuiguang

1.注册code空针bug

parent 3bd50aed
......@@ -60,6 +60,7 @@ import org.springframework.util.StopWatch;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
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.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -345,22 +346,22 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Override
public RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName) {
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
startPlatformTokenService.getToken();
if (!ValidationUtil.isEmpty(companyName)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new RuntimeException("重复的公司名称");
}
}
if (!ValidationUtil.isEmpty(unitCode)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode);
if(result.getResult()!=null)
{
throw new RuntimeException("重复的公司编码");
}
}
if (!ValidationUtil.isEmpty(companyName)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司名称");
}
}
if (!ValidationUtil.isEmpty(unitCode)) {
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司编码");
}
}
// 1.校验重复性
// RegUnitInfo regUnitInfo = this
// .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
......@@ -368,15 +369,14 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// throw new RuntimeException("该单位已注册,请联系企业管理员!");
// }
// 2.组织返回数据
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
//2.1 工商信息查询
//2.1 工商信息查询
Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult();
if(!ValidationUtil.isEmpty(resultMap)){
// 2.2 工商信息组装
String area = String.valueOf(resultMap.get("area"));
String city = area.substring(0,area.indexOf("市")+1);
String district = area.substring(city.length());
if(district.equals("高新区")){
if("高新区".equals(district)){
district = "雁塔区";
}
regUnitInfoDto.setCity(city);
......@@ -388,12 +388,15 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName")));
regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople")));
String industryName = "";
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();
if(op.isPresent()) {
DataDictionary dataDictionary = op.get();
industryName = dataDictionary.getName();
if(ObjectUtils.isNotEmpty(resultMap.get("industryCode"))){
List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
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()) {
DataDictionary dataDictionary = op.get();
industryName = dataDictionary.getName();
}
}
String approveDate = String.valueOf(resultMap.get("approval_time"));
approveDate = approveDate.contains("年")?approveDate.replace("年","-"):approveDate;
approveDate = approveDate.contains("月")?approveDate.replace("月","-"):approveDate;
......@@ -425,6 +428,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
List<BaseUnitLicence> unitLicences = baseUnitLicenceService
.list(new LambdaQueryWrapper<BaseUnitLicence>().eq(BaseUnitLicence::getUnitCode, unitCode));
regUnitInfoDto.setUnitLicences(Bean.toModels(unitLicences, BaseUnitLicenceDto.class));
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