feat: 查询租户注册链接
This commit is contained in:
parent
29880678d2
commit
70f049017f
@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: pengsz
|
* @Author: pengsz
|
||||||
@ -37,7 +38,7 @@ public class TenantController {
|
|||||||
return CommonResult.success(tenantService.saveTenant(tenantSaveRequest));
|
return CommonResult.success(tenantService.saveTenant(tenantSaveRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "我的租户")
|
||||||
@GetMapping("/my-tenants")
|
@GetMapping("/my-tenants")
|
||||||
public CommonResult<List<TenantVo>> getCurrentAdminTenants() {
|
public CommonResult<List<TenantVo>> getCurrentAdminTenants() {
|
||||||
return CommonResult.success(tenantService.getTenantsByCurrentAdmin());
|
return CommonResult.success(tenantService.getTenantsByCurrentAdmin());
|
||||||
@ -77,4 +78,21 @@ public class TenantController {
|
|||||||
return CommonResult.failed();
|
return CommonResult.failed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册二维码
|
||||||
|
* @return CommonResult
|
||||||
|
*/
|
||||||
|
// @ApiOperation(value="注册二维码")
|
||||||
|
// @RequestMapping(value = "/register-qrcode", method = RequestMethod.POST)
|
||||||
|
// public CommonResult<String> generateRegisterUrl(
|
||||||
|
// @RequestParam(required = false, defaultValue = "300") Integer width,
|
||||||
|
// @RequestParam(required = false, defaultValue = "300") Integer height) {
|
||||||
|
// if((width < 50 || height < 50) && (width > 500 || height > 500)){
|
||||||
|
// throw new YztException(Constants.RESULT_QRCODE_PRAMERROR);
|
||||||
|
// }
|
||||||
|
//// return CommonResult.success(tenantService.generateRegisterUrl(width,height));
|
||||||
|
// return CommonResult.success(tenantService.generateRegisterUrl());
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,8 +41,8 @@ public class QRCodeUtil {
|
|||||||
|
|
||||||
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(bitMatrix);
|
||||||
ImageIO.write(bufferedImage, "png", os);
|
ImageIO.write(bufferedImage, "png", os);
|
||||||
/**
|
/*
|
||||||
* 原生转码前面没有 data:image/png;base64 这些字段,返回给前端是无法被解析,可以让前端加,也可以在下面加上
|
原生转码前面没有 data:image/png;base64 这些字段,返回给前端是无法被解析,可以让前端加,也可以在下面加上
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return YztUtil.getBase64Image(Base64.encodeBase64String(os.toByteArray()));
|
return YztUtil.getBase64Image(Base64.encodeBase64String(os.toByteArray()));
|
||||||
|
|||||||
@ -268,14 +268,14 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
// user.setTradePassword(YztUtil.encryptPassword(request.getTradePassword(), request.getPhone())); // 交易密码
|
// user.setTradePassword(YztUtil.encryptPassword(request.getTradePassword(), request.getPhone())); // 交易密码
|
||||||
// user.setSpreadUid(request.getSpreadUid()); // 推广人ID
|
// user.setSpreadUid(request.getSpreadUid()); // 推广人ID
|
||||||
// user.setTenantId(request.getTenantId()); // 公司ID
|
// user.setTenantId(request.getTenantId()); // 公司ID
|
||||||
user.setTenantId(userService.getInfoByUid(user.getSpreadUid()).getTenantId()); // 公司ID
|
user.setTenantId(request.getTenantId()); // 公司ID
|
||||||
Date nowDate = YztDateUtil.nowDateTime();
|
Date nowDate = YztDateUtil.nowDateTime();
|
||||||
user.setCreateTime(nowDate);
|
user.setCreateTime(nowDate);
|
||||||
user.setLastLoginTime(nowDate);
|
user.setLastLoginTime(nowDate);
|
||||||
user.setUserType(Constants.USER_LOGIN_TYPE_H5);
|
user.setUserType(Constants.USER_LOGIN_TYPE_H5);
|
||||||
user.setAvatar(systemConfigService.getValueByKey(Constants.USER_DEFAULT_AVATAR_CONFIG_KEY));
|
user.setAvatar(systemConfigService.getValueByKey(Constants.USER_DEFAULT_AVATAR_CONFIG_KEY));
|
||||||
// user.setOrgName(request.getOrgName());
|
// user.setOrgName(request.getOrgName());
|
||||||
user.setLevel(1);
|
// user.setLevel(1);
|
||||||
|
|
||||||
|
|
||||||
// 推广人
|
// 推广人
|
||||||
|
|||||||
@ -32,4 +32,7 @@ public interface TenantService extends IService<Tenant> {
|
|||||||
* 获取租户列表
|
* 获取租户列表
|
||||||
*/
|
*/
|
||||||
List<TenantVo> getTenantsByCurrentAdmin();
|
List<TenantVo> getTenantsByCurrentAdmin();
|
||||||
|
|
||||||
|
// Map<String, Object> generateRegisterUrl(int width, int height);
|
||||||
|
String generateRegisterUrl();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,7 @@ import com.yzt.common.vo.WechatMerchantConfigVo;
|
|||||||
import com.yzt.service.mapper.SystemAdminMapper;
|
import com.yzt.service.mapper.SystemAdminMapper;
|
||||||
import com.yzt.service.mapper.TenantMapper;
|
import com.yzt.service.mapper.TenantMapper;
|
||||||
|
|
||||||
import com.yzt.service.service.SystemAdminService;
|
import com.yzt.service.service.*;
|
||||||
import com.yzt.service.service.TenantService;
|
|
||||||
import com.yzt.service.service.WechatMerchantConfigService;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -52,6 +50,12 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
@Resource
|
@Resource
|
||||||
private WechatMerchantConfigService wechatMerchantConfigService;
|
private WechatMerchantConfigService wechatMerchantConfigService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SystemAttachmentService systemAttachmentService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private QrCodeService qrCodeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TransactionTemplate transactionTemplate;
|
private TransactionTemplate transactionTemplate;
|
||||||
@Override
|
@Override
|
||||||
@ -64,6 +68,9 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
tenant.setCreatedTime(YztDateUtil.nowDateTime());
|
tenant.setCreatedTime(YztDateUtil.nowDateTime());
|
||||||
tenant.setCreatedBy(SecurityUtil.getLoginUserVo().getUser().getId());
|
tenant.setCreatedBy(SecurityUtil.getLoginUserVo().getUser().getId());
|
||||||
}
|
}
|
||||||
|
if(tenant.getRegisterQrCodeUrl().isBlank()){
|
||||||
|
tenant.setRegisterQrCodeUrl(generateRegisterUrl());
|
||||||
|
}
|
||||||
tenant.setUpdatedTime(YztDateUtil.nowDateTime());
|
tenant.setUpdatedTime(YztDateUtil.nowDateTime());
|
||||||
tenant.setUpdatedBy(SecurityUtil.getLoginUserVo().getUser().getId());
|
tenant.setUpdatedBy(SecurityUtil.getLoginUserVo().getUser().getId());
|
||||||
|
|
||||||
@ -98,6 +105,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
for (Tenant tenant : tenantVoList) {
|
for (Tenant tenant : tenantVoList) {
|
||||||
TenantVo tv = new TenantVo();
|
TenantVo tv = new TenantVo();
|
||||||
BeanUtils.copyProperties(tenant, tv);
|
BeanUtils.copyProperties(tenant, tv);
|
||||||
|
tv.setRegisterQrCodeUrl(generateRegisterUrl());
|
||||||
tenantVos.add(tv);
|
tenantVos.add(tv);
|
||||||
}
|
}
|
||||||
return tenantVos;
|
return tenantVos;
|
||||||
@ -107,6 +115,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
public TenantVo getInfo(Long tenantId) {
|
public TenantVo getInfo(Long tenantId) {
|
||||||
Tenant tenant = getById(tenantId);
|
Tenant tenant = getById(tenantId);
|
||||||
TenantVo tenantVo = BeanUtil.copyProperties(tenant, TenantVo.class);
|
TenantVo tenantVo = BeanUtil.copyProperties(tenant, TenantVo.class);
|
||||||
|
tenantVo.setRegisterQrCodeUrl(generateRegisterUrl());
|
||||||
// tenantVo.setWechatMerchantConfigVo(Objects.requireNonNull(wechatMerchantConfigService.getByTenant(tenantId)));
|
// tenantVo.setWechatMerchantConfigVo(Objects.requireNonNull(wechatMerchantConfigService.getByTenant(tenantId)));
|
||||||
return tenantVo;
|
return tenantVo;
|
||||||
}
|
}
|
||||||
@ -167,6 +176,11 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
|
|||||||
return tenantVos;
|
return tenantVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateRegisterUrl() {
|
||||||
|
return systemAttachmentService.getCdnUrl()+"/#/pages/register/register?tenantId=" + SecurityUtil.getLoginUserVo().getUser().getTenantId();
|
||||||
|
}
|
||||||
|
|
||||||
private void checkNameExist(TenantSaveRequest req) {
|
private void checkNameExist(TenantSaveRequest req) {
|
||||||
LambdaQueryWrapper<Tenant> wrapper = Wrappers.lambdaQuery(Tenant.class)
|
LambdaQueryWrapper<Tenant> wrapper = Wrappers.lambdaQuery(Tenant.class)
|
||||||
.select(Tenant::getTenantId, Tenant::getTenantName, Tenant::getCode, Tenant::getCreditCode)
|
.select(Tenant::getTenantId, Tenant::getTenantName, Tenant::getCode, Tenant::getCreditCode)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user