package com.product.saas.controller;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.product.admin.config.SystemCode;
|
import com.product.core.controller.support.AbstractBaseController;
|
import com.product.core.entity.FieldSetEntity;
|
import com.product.module.sys.version.ApiVersion;
|
import com.product.saas.config.SaasCode;
|
import com.product.saas.config.SaasConst;
|
import com.product.saas.service.SaasClientService;
|
import com.product.util.BaseUtil;
|
|
/**
|
* SAAS系统租户
|
*
|
*/
|
@RequestMapping("/api/saas-client")
|
@RestController
|
public class SaasClientController extends AbstractBaseController{
|
|
@Autowired
|
SaasClientService saasClientService;
|
|
/**
|
* 租户列表
|
* @param request
|
* @return
|
*/
|
@RequestMapping("/list-client/{version}")
|
@ApiVersion(1)
|
public String listClient(HttpServletRequest request) {
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CLIENTS);
|
if(BaseUtil.strIsNull(fse.getString(SaasConst.CPAGE)) || BaseUtil.strIsNull(fse.getString(SaasConst.PAGESIZE))) {
|
return error(SystemCode.SYSTEM_CPAGES_NOT_NULL.getValue(), SystemCode.SYSTEM_CPAGES_NOT_NULL.getText());
|
}
|
return OK_List(saasClientService.listClient(fse));
|
} catch (Exception e) {
|
e.printStackTrace();
|
return error(SaasCode.TENANT_INFO_GET_LIST_FAIL.getValue(), SaasCode.TENANT_INFO_GET_LIST_FAIL.getText() + e.getMessage());
|
}
|
}
|
|
/**
|
* 租户列表
|
* @param request
|
* @return
|
*/
|
@RequestMapping("/find-client/{version}")
|
@ApiVersion(1)
|
public String findClient(HttpServletRequest request) {
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CLIENTS);
|
if(BaseUtil.strIsNull(fse.getUUID())) {
|
return error(SystemCode.SYSTEM_FORM_COUNT.getValue(), SystemCode.SYSTEM_FORM_COUNT.getText());
|
}
|
return OK_List(saasClientService.findClient(fse.getUUID()));
|
} catch (Exception e) {
|
e.printStackTrace();
|
return error(SaasCode.TENANT_INFO_GET_LIST_FAIL.getValue(), SaasCode.TENANT_INFO_GET_LIST_FAIL.getText() + e.getMessage());
|
}
|
}
|
}
|