Commit aa9d7eb9 authored by wujiang's avatar wujiang

修改注册逻辑

parent 49ff0532
......@@ -54,6 +54,9 @@ public class TzsAuthServiceImpl implements TzsAuthService {
*/
@Value("${redis.cache.failure.time}")
private Long redisRegionTimeSecond;
@Autowired
private StartPlatformTokenService startPlatformTokenService;
@Override
......@@ -75,7 +78,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
@Override
public List<RegionModel> getUserReginTree() {
List<String> regionList = this.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
//AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
startPlatformTokenService.getToken();
List<RegionModel> tree = (List<RegionModel>) Systemctl.regionClient.queryForTree(null).getResult();
// 循环list 将List 封装为 省市区 SET
Set<String> city = new HashSet<>();
......@@ -128,8 +132,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
for(Map.Entry<String, RegionModel> entries : tempCityMap.entrySet()) {
newCity.add(entries.getValue());
}
start.setChildren(newCity);
newTree.add(start);
//start.setChildren(newCity);
newTree.addAll(newCity);
return newTree;
}
......
......@@ -66,9 +66,6 @@ public class RegUnitInfoController extends BaseController {
@Value("${flc.sms.timeout:600}")
private int timeout;
@Autowired
StartPlatformTokenService startPlatformTokenService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......@@ -99,16 +96,8 @@ public class RegUnitInfoController extends BaseController {
@RequestParam String companyName) {
if (ValidationUtil.isEmpty(unitCode)) {
throw new BadRequest("单位编码不能为空");
}
if (!ValidationUtil.isEmpty(companyName)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司名称");
}
}
RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType);
RegUnitInfoDto regUnitInfoDto = iRegUnitInfoService.unitCheck(unitCode, unitType,companyName);
return ResponseHelper.buildResponse(regUnitInfoDto);
}
......
......@@ -40,6 +40,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.BaseUnitLicenceDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.BaseUnitLicence;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.BaseUnitLicenceServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.StartPlatformTokenService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzBaseEnterpriseInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitIcDto;
......@@ -87,7 +88,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
AccessFeignService accessFeignService;
@Autowired
StartPlatformTokenService startPlatformTokenService;
/**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/
......@@ -218,13 +221,31 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
@Override
public RegUnitInfoDto unitCheck(String unitCode, String unitType) {
public RegUnitInfoDto unitCheck(String unitCode, String unitType,String companyName) {
if (!ValidationUtil.isEmpty(companyName)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyName(companyName);
if(result.getResult()!=null)
{
throw new BadRequest("重复的公司名称");
}
}
if (!ValidationUtil.isEmpty(unitCode)) {
startPlatformTokenService.getToken();
FeignClientResult<CompanyModel> result =Privilege.companyClient.queryByCompanyCode(unitCode);
if(result.getResult()!=null)
{
throw new RuntimeException("重复的公司编码");
}
}
// 1.校验重复性
RegUnitInfo regUnitInfo = this
.getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
if (regUnitInfo != null) {
throw new RuntimeException("该单位已注册,请联系企业管理员!");
}
// RegUnitInfo regUnitInfo = this
// .getOne(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
// if (regUnitInfo != null) {
// throw new RuntimeException("该单位已注册,请联系企业管理员!");
// }
// 2.组织返回数据
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
if (USE_UNIT_TYPE_CODE.equals(unitType) || PRODUCT_UNIT_TYPE_CODE.equals(unitType) || FILLING_UNIT_TYPE_CODE.equals(unitType)) {
......
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