first commit
This commit is contained in:
@ -33,6 +33,7 @@ qiaoba:
|
|||||||
- /register
|
- /register
|
||||||
- /captchaImage
|
- /captchaImage
|
||||||
- /tenant/normal-list
|
- /tenant/normal-list
|
||||||
|
- /tenant/test
|
||||||
|
|
||||||
springdoc:
|
springdoc:
|
||||||
swagger-ui:
|
swagger-ui:
|
||||||
|
@ -5,6 +5,7 @@ import com.qiaoba.common.base.result.AjaxResult;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResponseUtil
|
* ResponseUtil
|
||||||
@ -18,7 +19,9 @@ public class ResponseUtil {
|
|||||||
public static void response(HttpServletResponse response, String msg) throws IOException {
|
public static void response(HttpServletResponse response, String msg) throws IOException {
|
||||||
response.setStatus(HttpServletResponse.SC_OK);
|
response.setStatus(HttpServletResponse.SC_OK);
|
||||||
response.setContentType("text/plain; charset=UTF-8");
|
response.setContentType("text/plain; charset=UTF-8");
|
||||||
response.getWriter().write(msg);
|
PrintWriter writer = response.getWriter();
|
||||||
|
writer.write(msg);
|
||||||
|
writer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void errorAuth(HttpServletResponse response, Integer code, String msg) throws IOException {
|
public static void errorAuth(HttpServletResponse response, Integer code, String msg) throws IOException {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.qiaoba.module.tenant.controller;
|
package com.qiaoba.module.tenant.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.qiaoba.common.base.enums.BaseEnum;
|
|
||||||
import com.qiaoba.common.base.result.AjaxResult;
|
import com.qiaoba.common.base.result.AjaxResult;
|
||||||
import com.qiaoba.common.base.validate.AddGroup;
|
import com.qiaoba.common.base.validate.AddGroup;
|
||||||
import com.qiaoba.common.base.validate.EditGroup;
|
import com.qiaoba.common.base.validate.EditGroup;
|
||||||
@ -19,7 +18,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户管理 Web层
|
* 租户管理 Web层
|
||||||
@ -37,7 +38,6 @@ public class SysTenantController {
|
|||||||
private final SysTenantService sysTenantService;
|
private final SysTenantService sysTenantService;
|
||||||
private final MysqlHandler mysqlHandler;
|
private final MysqlHandler mysqlHandler;
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('tenant:add')")
|
@PreAuthorize("hasAuthority('tenant:add')")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "新增租户")
|
@Operation(summary = "新增租户")
|
||||||
@ -68,12 +68,8 @@ public class SysTenantController {
|
|||||||
|
|
||||||
@GetMapping("/normal-list")
|
@GetMapping("/normal-list")
|
||||||
@Operation(summary = "获取正常列表")
|
@Operation(summary = "获取正常列表")
|
||||||
public TableDataInfo<SysTenant> normalPageList(SysTenantParam param, PageQuery pageQuery) {
|
public TableDataInfo<SysTenant> normalPageList(PageQuery pageQuery) {
|
||||||
param.setTime(new Date());
|
return sysTenantService.selectPageList(SysTenantParam.buildNormalSelectParam(), pageQuery);
|
||||||
param.setStatus(BaseEnum.NORMAL.getCode());
|
|
||||||
param.setType(SysTenantParam.TYPE_NOT_EXPIRED);
|
|
||||||
param.setIsLogin(true);
|
|
||||||
return sysTenantService.selectPageList(param, pageQuery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getSetting/{tenantId}")
|
@GetMapping("/getSetting/{tenantId}")
|
||||||
@ -90,4 +86,24 @@ public class SysTenantController {
|
|||||||
return AjaxResult.success(sysTenantService.update(BeanUtil.copyProperties(dto, SysTenant.class)));
|
return AjaxResult.success(sysTenantService.update(BeanUtil.copyProperties(dto, SysTenant.class)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public void test(HttpServletResponse response) throws Exception {
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
response.setContentType("text/html;charset=UTF-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
int i = 0;
|
||||||
|
while (i < 101) {
|
||||||
|
String text = null;
|
||||||
|
if (i == 100) {
|
||||||
|
text = "<div style=\"color:#00FF00\"><h3>恭喜!升级完成</h3></div>";
|
||||||
|
} else {
|
||||||
|
text = "<div style=\"color:#FF0000\"><h3>升级进度:[" + i + "]</h3></div>";
|
||||||
|
}
|
||||||
|
writer.write(text);
|
||||||
|
writer.flush();
|
||||||
|
i = i + 10;
|
||||||
|
Thread.sleep(1000);
|
||||||
|
}
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.qiaoba.module.tenant.entity.param;
|
package com.qiaoba.module.tenant.entity.param;
|
||||||
|
|
||||||
|
import com.qiaoba.common.base.enums.BaseEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -40,5 +41,17 @@ public class SysTenantParam implements Serializable {
|
|||||||
@Schema(description = "类型(1正常 2过期)")
|
@Schema(description = "类型(1正常 2过期)")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是登陆接口
|
||||||
|
*/
|
||||||
private Boolean isLogin = false;
|
private Boolean isLogin = false;
|
||||||
|
|
||||||
|
public static SysTenantParam buildNormalSelectParam() {
|
||||||
|
SysTenantParam param = new SysTenantParam();
|
||||||
|
param.setTime(new Date());
|
||||||
|
param.setStatus(BaseEnum.NORMAL.getCode());
|
||||||
|
param.setType(SysTenantParam.TYPE_NOT_EXPIRED);
|
||||||
|
param.setIsLogin(true);
|
||||||
|
return param;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class SysTenantServiceImpl implements SysTenantService {
|
|||||||
wrapper.lambda().lt(Objects.nonNull(param.getTime()), SysTenant::getExpireTime, param.getTime());
|
wrapper.lambda().lt(Objects.nonNull(param.getTime()), SysTenant::getExpireTime, param.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登录接口
|
// 登录接口, 只返回ID和名字两个字段
|
||||||
if (param.getIsLogin()) {
|
if (param.getIsLogin()) {
|
||||||
wrapper.lambda()
|
wrapper.lambda()
|
||||||
.select(SysTenant::getCompanyName, SysTenant::getTenantId);
|
.select(SysTenant::getCompanyName, SysTenant::getTenantId);
|
||||||
|
Reference in New Issue
Block a user