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.saas.config.SaasCode;
|
import com.product.saas.config.SaasConst;
|
import com.product.saas.service.TenantContractService;
|
import com.product.core.controller.support.AbstractBaseController;
|
import com.product.core.entity.FieldSetEntity;
|
import com.product.core.exception.BaseException;
|
import com.product.module.sys.version.ApiVersion;
|
import com.product.util.BaseUtil;
|
|
|
@RequestMapping("/api/tenant-contract")
|
@RestController
|
public class TenantContractController extends AbstractBaseController{
|
|
@Autowired
|
TenantContractService tenantContractService;
|
|
/**
|
* 获取合同信息
|
* @param request
|
* @return
|
*/
|
@RequestMapping("/list-contract/{version}")
|
@ApiVersion(1)
|
public String listContract(HttpServletRequest request){
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CONTRACT);
|
return OK_List(tenantContractService.listContract(fse));
|
} catch (BaseException e) {
|
e.printStackTrace();
|
return this.error(e);
|
}catch (Exception e){
|
e.printStackTrace();
|
return error(SaasCode.CLIENT_CONTRACT_GET_LIST_FAIL.getValue(), SaasCode.CLIENT_CONTRACT_GET_LIST_FAIL.getText()+e.getMessage());
|
}
|
}
|
|
/**
|
* 获取租户最新合同信息
|
* @param request
|
* @return
|
*/
|
@RequestMapping("/find-contract/{version}")
|
@ApiVersion(1)
|
public String findContract(HttpServletRequest request){
|
try {
|
FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, SaasConst.PRODUCT_SYS_CONTRACT);
|
return OK_List(tenantContractService.findContract(fse.getString("uuid")));
|
} catch (BaseException e) {
|
e.printStackTrace();
|
return this.error(e);
|
}catch (Exception e){
|
e.printStackTrace();
|
return error(SaasCode.CLIENT_CONTRACT_GET_FIND_FAIL.getValue(), SaasCode.CLIENT_CONTRACT_GET_FIND_FAIL.getText()+e.getMessage());
|
}
|
}
|
}
|