feat:新增企业入驻接口
parent
d6ff8ad340
commit
78747b7d03
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.auth.controller;
|
||||
|
||||
import com.muyu.auth.form.EnterpriseSettlement;
|
||||
import com.muyu.auth.form.Firm;
|
||||
import com.muyu.auth.form.LoginBody;
|
||||
import com.muyu.auth.form.RegisterBody;
|
||||
|
@ -79,4 +80,10 @@ public class TokenController {
|
|||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("enterprise")
|
||||
public Result<?> enterprise(@RequestBody EnterpriseSettlement enterpriseSettlement){
|
||||
sysLoginService.enterprise(enterpriseSettlement.getDatabaseName(),enterpriseSettlement.getFirmName());
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,23 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业入驻
|
||||
* @author 袁子龙
|
||||
* @package com.muyu.auth.form
|
||||
* @name EnterpriseSettlement
|
||||
* @date 2024/9/30 11:25
|
||||
*/
|
||||
@Data
|
||||
public class EnterpriseSettlement {
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String firmName;
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private String databaseName;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.auth.service;
|
||||
|
||||
import com.muyu.auth.form.EnterpriseSettlement;
|
||||
import com.muyu.common.core.constant.CacheConstants;
|
||||
import com.muyu.common.core.constant.Constants;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
|
@ -12,6 +13,7 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.ip.IpUtils;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.Enterprise;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
|
@ -124,4 +126,32 @@ public class SysLoginService {
|
|||
}
|
||||
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业入驻
|
||||
* @param databaseName
|
||||
* @param fileName
|
||||
*/
|
||||
public void enterprise (String databaseName,String fileName){
|
||||
// 参数校验 数据库名或企业名称不能为空
|
||||
if (StringUtils.isAnyBlank(databaseName,fileName)){
|
||||
throw new ServiceException("数据库名或企业名称不能为空");
|
||||
}
|
||||
|
||||
if (databaseName.length()<UserConstants.PASSWORD_MIN_LENGTH||databaseName.length()>UserConstants.PASSWORD_MAX_LENGTH){
|
||||
throw new ServiceException("数据库名长度必须在5到20个字符之间");
|
||||
}
|
||||
if (fileName.length()<UserConstants.Firm_NAME_MIN_LENGTH||fileName.length()>UserConstants.Firm_NAME_MAX_LENGTH){
|
||||
throw new ServiceException("企业名称长度必须在2到20个字符之间");
|
||||
}
|
||||
Enterprise settlement = new Enterprise();
|
||||
settlement.setDatabaseName(databaseName);
|
||||
settlement.setFirmName(fileName);
|
||||
|
||||
Result<?> registerResult = remoteUserService.settlementEnterpriseInfo(settlement, SecurityConstants.INNER);
|
||||
|
||||
if (Result.FAIL == registerResult.getCode()) {
|
||||
throw new ServiceException(registerResult.getMsg());
|
||||
}
|
||||
recordLogService.recordLogininfor(fileName, Constants.REGISTER, "注册成功"); }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue