Commit 878e4e34 authored by tianyiming's avatar tianyiming

Merge remote-tracking branch 'origin/develop_tzs' into develop_tzs

parents c3c32719 3cf6a524
...@@ -209,27 +209,30 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -209,27 +209,30 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
throw new BadRequest("UGP信息同步失败"); throw new BadRequest("UGP信息同步失败");
} }
watch.stop(); watch.stop();
if(log.isDebugEnabled()){ if(logger.isDebugEnabled()){
log.debug("注册总耗时:==》" + watch.getTotalTimeSeconds()); logger.debug("注册总耗时:==》{}", watch.getTotalTimeSeconds());
} }
} catch (Exception e) { }catch (Exception e) {
log.error(e.getMessage(), e); logger.error(e.getMessage(), e);
// 失败后回滚:删除已经创建的企业信息 try {
if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) { // 失败后回滚:删除已经创建的企业信息
FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient if (StringUtils.isNotEmpty(regUnitInfo.getAmosCompanySeq())) {
.seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq())); FeignClientResult<CompanyModel> feignClientResult = Privilege.companyClient.seleteOne(Long.parseLong(regUnitInfo.getAmosCompanySeq()));
if (feignClientResult != null && feignClientResult.getResult() !=null) { if (feignClientResult != null && feignClientResult.getResult() != null) {
Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq()); Privilege.companyClient.deleteCompany(regUnitInfo.getAmosCompanySeq());
}
} }
} // 失败后回滚:删除已经创建的管理员账号
// 失败后回滚:删除已经创建的管理员账号 if (StringUtils.isNotEmpty(regUnitInfo.getAdminUserId())) {
if (StringUtils.isNotEmpty(regUnitInfo.getAdminUserId())) { FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient.queryByUserId(regUnitInfo.getAdminUserId());
FeignClientResult<AgencyUserModel> feignClientResult = Privilege.agencyUserClient if (feignClientResult != null && feignClientResult.getResult() != null) {
.queryByUserId(regUnitInfo.getAdminUserId()); Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
if (feignClientResult != null && feignClientResult.getResult() !=null) { }
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
} }
} catch (Exception rollbackException) {
logger.error("回滚操作发生异常: {}", rollbackException.getMessage(), rollbackException);
} }
throw new RuntimeException("企业注册失败,请联系管理员!"); throw new RuntimeException("企业注册失败,请联系管理员!");
} }
return model; return model;
...@@ -238,13 +241,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -238,13 +241,13 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}") @Scheduled(cron = "${async.set.qr-code.cron:0 0/1 * * * ?}")
public void asyncSetQrCode() { public void asyncSetQrCode() {
// 给所有新注册的企业创建二维码,每次处理100个,不排序 // 给所有新注册的企业创建二维码,每次处理100个,不排序
if (log.isDebugEnabled()) { if (logger.isDebugEnabled()) {
log.debug("新注册企业二维码生成开始"); logger.debug("新注册企业二维码生成开始");
} }
List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode(); List<TzBaseEnterpriseInfo> noQrCodeList = tzBaseEnterpriseInfoMapper.listNoQrCode();
if (noQrCodeList.isEmpty()) { if (noQrCodeList.isEmpty()) {
if (log.isDebugEnabled()) { if (logger.isDebugEnabled()) {
log.debug("暂无待生成二维码的企业"); logger.debug("暂无待生成二维码的企业");
} }
return; return;
} }
...@@ -255,8 +258,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -255,8 +258,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList); tzBaseEnterpriseInfoService.saveOrUpdateBatch(noQrCodeList);
if (log.isDebugEnabled()) { if (logger.isDebugEnabled()) {
log.debug("新注册企业二维码生成结束"); logger.debug("新注册企业二维码生成结束");
} }
} }
...@@ -524,7 +527,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -524,7 +527,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId()); Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
// 3.企业注册表删除 // 3.企业注册表删除
this.remove(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode)); this.remove(new LambdaQueryWrapper<RegUnitInfo>().eq(RegUnitInfo::getUnitCode, unitCode));
...@@ -620,8 +623,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -620,8 +623,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
watch1.start(); watch1.start();
List<RoleModel> allRoleList = startPlatformTokenService.getAllRole(); List<RoleModel> allRoleList = startPlatformTokenService.getAllRole();
watch1.stop(); watch1.stop();
if(log.isDebugEnabled()){ if(logger.isDebugEnabled()){
log.debug("平台查询角色接口耗时:==》" + watch1.getTotalTimeSeconds()); logger.debug("平台查询角色接口耗时:==>{}",watch1.getTotalTimeSeconds());
} }
List<RoleModel> userRoleList = new ArrayList<>(); List<RoleModel> userRoleList = new ArrayList<>();
List<Long> roleIds = new ArrayList<>(); List<Long> roleIds = new ArrayList<>();
...@@ -643,8 +646,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -643,8 +646,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
watch2.start(); watch2.start();
FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo); FeignClientResult<CompanyModel> companyResult = Privilege.companyClient.create(companyInfo);
watch2.stop(); watch2.stop();
if(log.isDebugEnabled()){ if(logger.isDebugEnabled()){
log.debug("创建amos公司耗时:==》" + watch2.getTotalTimeSeconds()); logger.debug("创建amos公司耗时:==>{}",watch2.getTotalTimeSeconds());
} }
if (companyResult == null || companyResult.getResult() == null) { if (companyResult == null || companyResult.getResult() == null) {
throw new BadRequest("单位注册失败"); throw new BadRequest("单位注册失败");
...@@ -694,8 +697,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -694,8 +697,8 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
watch3.start(); watch3.start();
userResult = Privilege.agencyUserClient.create(agencyUserModel); userResult = Privilege.agencyUserClient.create(agencyUserModel);
watch3.stop(); watch3.stop();
if(log.isDebugEnabled()){ if(logger.isDebugEnabled()){
log.debug("创建amos人员耗时:==》" + watch3.getTotalTimeSeconds()); logger.debug("创建amos人员耗时:==>{}",watch3.getTotalTimeSeconds());
} }
if (userResult == null || userResult.getResult() == null) { if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败"); throw new BadRequest("单位注册失败");
...@@ -722,7 +725,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -722,7 +725,7 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
&& StringUtils.isNotEmpty(userResult.getResult().getUserId())) { && StringUtils.isNotEmpty(userResult.getResult().getUserId())) {
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
log.error(e.getMessage(), e); logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
} }
......
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