Commit aa9d7eb9 authored by wujiang's avatar wujiang

修改注册逻辑

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