Commit c9ddd67b authored by tianyiming's avatar tianyiming

单位注册校验修改

parent 2f8e3a67
...@@ -32,7 +32,7 @@ public interface IRegUnitInfoService { ...@@ -32,7 +32,7 @@ public interface IRegUnitInfoService {
* @param unitType 单位类型 * @param unitType 单位类型
* @return RegUnitInfoDto * @return RegUnitInfoDto
*/ */
RegUnitInfoDto unitCheck(String unitCode, String unitType, String companyName); RegUnitInfoDto unitCheck(String unitCode, String unitType, String companyName,String registerType, String cardType);
/** /**
* 单位类型列表字典 * 单位类型列表字典
......
...@@ -115,12 +115,14 @@ public class RegUnitInfoController extends BaseController { ...@@ -115,12 +115,14 @@ public class RegUnitInfoController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "单位注册校验", notes = "单位注册校验") @ApiOperation(httpMethod = "GET", value = "单位注册校验", notes = "单位注册校验")
public ResponseModel<RegUnitInfoDto> unitCheck(@PathVariable String unitCode, public ResponseModel<RegUnitInfoDto> unitCheck(@PathVariable String unitCode,
@RequestParam String unitType, @RequestParam String unitType,
@RequestParam String registerType,
@RequestParam(required = false) String cardType,
@RequestParam(required = false) String companyName) { @RequestParam(required = false) String companyName) {
if (ValidationUtil.isEmpty(unitCode)) { if (ValidationUtil.isEmpty(unitCode)) {
throw new BadRequest("单位编码不能为空"); throw new BadRequest("注册编码不能为空");
} }
try { try {
RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType, companyName); RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType, companyName,registerType,cardType);
return ResponseHelper.buildResponse(regUnitInfoDto); return ResponseHelper.buildResponse(regUnitInfoDto);
} catch (Exception e) { } catch (Exception e) {
ResponseModel<RegUnitInfoDto> response = new ResponseModel<>(); ResponseModel<RegUnitInfoDto> response = new ResponseModel<>();
......
...@@ -347,23 +347,22 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -347,23 +347,22 @@ 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,String registerType, String cardType) {
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto(); 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 BadRequest("重复的公司名称");
throw new BadRequest("重复的公司名称"); // }
// }
if (!ValidationUtil.isEmpty(unitCode)) {
unitCode = ObjectUtils.isEmpty(cardType) ? unitCode : cardType + "_" + unitCode;
FeignClientResult<CompanyModel> result = Privilege.companyClient.queryByCompanyCode(unitCode);
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.校验重复性 // 1.校验重复性
// RegUnitInfo regUnitInfo = this // RegUnitInfo regUnitInfo = this
// .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); // .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
...@@ -371,65 +370,67 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -371,65 +370,67 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// throw new RuntimeException("该单位已注册,请联系企业管理员!"); // throw new RuntimeException("该单位已注册,请联系企业管理员!");
// } // }
// 2.组织返回数据 // 2.组织返回数据
//2.1 工商信息查询 if(ObjectUtils.isEmpty(registerType)){
Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult(); //2.1 工商信息查询
if (resultMap == null){ Map<String, Object> resultMap = accessFeignService.getData(unitCode).getResult();
throw new BadRequest("工商信息接口查询失败,请稍后再试!"); if (resultMap == null){
} throw new BadRequest("工商信息接口查询失败,请稍后再试!");
if (ObjectUtils.isEmpty(resultMap)) { }
throw new BadRequest("未查询到企业信息,请核对!"); if (ObjectUtils.isEmpty(resultMap)) {
} throw new BadRequest("未查询到企业信息,请核对!");
if(!ValidationUtil.isEmpty(resultMap)){ }
// 2.2 工商信息组装 if(!ValidationUtil.isEmpty(resultMap)){
String area = String.valueOf(resultMap.get("area")); // 2.2 工商信息组装
String city = area.substring(0,area.indexOf("市")+1); String area = String.valueOf(resultMap.get("area"));
String district = area.substring(city.length()); String city = area.substring(0,area.indexOf("市")+1);
if("高新区".equals(district)){ String district = area.substring(city.length());
district = "雁塔区"; if("高新区".equals(district)){
} district = "雁塔区";
regUnitInfoDto.setCity(city); }
regUnitInfoDto.setDistrict(district); regUnitInfoDto.setCity(city);
regUnitInfoDto.setStree(String.valueOf(resultMap.get("street"))); regUnitInfoDto.setDistrict(district);
regUnitInfoDto.setCommunity(String.valueOf(resultMap.get("community"))); regUnitInfoDto.setStree(String.valueOf(resultMap.get("street")));
regUnitInfoDto.setAddress(String.valueOf(resultMap.get("address"))); regUnitInfoDto.setCommunity(String.valueOf(resultMap.get("community")));
regUnitInfoDto.setUnitCode(String.valueOf(resultMap.get("creditCode"))); regUnitInfoDto.setAddress(String.valueOf(resultMap.get("address")));
regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName"))); regUnitInfoDto.setUnitCode(String.valueOf(resultMap.get("creditCode")));
regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople"))); regUnitInfoDto.setName(String.valueOf(resultMap.get("unitName")));
String industryName = ""; regUnitInfoDto.setLegalPerson(String.valueOf(resultMap.get("legalPeople")));
if(ObjectUtils.isNotEmpty(resultMap.get("industryCode"))){ String industryName = "";
List<DataDictionary> dictionaries = this.initAllDataDictionaryList(); if(ObjectUtils.isNotEmpty(resultMap.get("industryCode"))){
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(); List<DataDictionary> dictionaries = this.initAllDataDictionaryList();
if(op.isPresent()) { 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();
DataDictionary dataDictionary = op.get(); if(op.isPresent()) {
industryName = dataDictionary.getName(); DataDictionary dataDictionary = op.get();
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;
approveDate = approveDate.contains("日")?approveDate.replace("日","-"):approveDate; approveDate = approveDate.contains("日")?approveDate.replace("日","-"):approveDate;
RegUnitIcDto regUnitIcDto = new RegUnitIcDto(); RegUnitIcDto regUnitIcDto = new RegUnitIcDto();
regUnitIcDto.setUnitCode(regUnitInfoDto.getUnitCode()); regUnitIcDto.setUnitCode(regUnitInfoDto.getUnitCode());
try { try {
regUnitIcDto.setApprovedDate(DateUtils.dateParse(approveDate,"yyyy-MM-dd")); regUnitIcDto.setApprovedDate(DateUtils.dateParse(approveDate,"yyyy-MM-dd"));
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
regUnitIcDto.setUnitName(regUnitInfoDto.getName()); regUnitIcDto.setUnitName(regUnitInfoDto.getName());
regUnitIcDto.setRegisteredOrgan(String.valueOf(resultMap.get("registration_authority"))); regUnitIcDto.setRegisteredOrgan(String.valueOf(resultMap.get("registration_authority")));
regUnitIcDto.setBusinessState(String.valueOf(resultMap.get("operating_status"))); regUnitIcDto.setBusinessState(String.valueOf(resultMap.get("operating_status")));
regUnitIcDto.setProvince("陕西省"); regUnitIcDto.setProvince("陕西省");
regUnitIcDto.setCity(regUnitInfoDto.getCity()); regUnitIcDto.setCity(regUnitInfoDto.getCity());
regUnitIcDto.setDistrict(regUnitInfoDto.getDistrict()); regUnitIcDto.setDistrict(regUnitInfoDto.getDistrict());
regUnitIcDto.setStree(regUnitInfoDto.getStree()); regUnitIcDto.setStree(regUnitInfoDto.getStree());
regUnitIcDto.setCommunity(regUnitInfoDto.getCommunity()); regUnitIcDto.setCommunity(regUnitInfoDto.getCommunity());
regUnitIcDto.setAddress(regUnitInfoDto.getAddress()); regUnitIcDto.setAddress(regUnitInfoDto.getAddress());
regUnitIcDto.setLegalPerson(regUnitInfoDto.getLegalPerson()); regUnitIcDto.setLegalPerson(regUnitInfoDto.getLegalPerson());
regUnitIcDto.setIndustryName(industryName); regUnitIcDto.setIndustryName(industryName);
regUnitInfoDto.setRegUnitIc(regUnitIcDto); regUnitInfoDto.setRegUnitIc(regUnitIcDto);
} else { } else {
regUnitInfoDto.setRegUnitIc(new RegUnitIcDto()); regUnitInfoDto.setRegUnitIc(new RegUnitIcDto());
}
} }
// 2.3 许可信息组装 // 2.3 许可信息组装
......
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