提交 c4657c70 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 部署微服务接口

上级 24220dc5
......@@ -37,6 +37,11 @@
git clone -b master $para2 ibzuaa/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzuaa/
mvn clean package -Papi
cd ibzuaa-provider/ibzuaa-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzuaa-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -7,6 +7,10 @@ logging:
#zuul网关路由设置
zuul:
routes:
sys_open_access:
path: /sysopenaccesses/**
serviceId: ${ibiz.ref.service.ibzuaa-api:ibzuaa-api}
stripPrefix: false
sys_authlog:
path: /sysauthlogs/**
serviceId: ${ibiz.ref.service.ibzuaa-api:ibzuaa-api}
......
......@@ -32,7 +32,7 @@
<!--输出实体[SYS_OPEN_ACCESS]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_open_access-17-2">
<changeSet author="a_A_5d9d78509" id="tab-sys_open_access-28-2">
<createTable tableName="IBZOPENACCESS">
<column name="ACCESSID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_OPEN_ACCESS_ACCESSID"/>
......
......@@ -4,6 +4,14 @@
],
"entities":[
{
"dename":"SysOpenAccess",
"delogicname":"第三方认证平台",
"sysmoudle":{"id":"UAA","name":"uaa"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
"dename":"SysAuthLog",
"delogicname":"认证日志",
"sysmoudle":{"id":"UAA","name":"uaa"},
......@@ -65,7 +73,7 @@
{
"appid":"web",
"appname":"UAA鉴权",
"appmenu":[{"menuid":"Main", "menuname":"MAIN", "menuitem":[{ "id":"menuitem3" , "name":"用户" },{ "id":"menuitem6" , "name":"角色" },{ "id":"menuitem1" , "name":"认证日志" },{ "id":"menuitem2" , "name":"接入应用" }] }]
"appmenu":[{"menuid":"Main", "menuname":"MAIN", "menuitem":[{ "id":"menuitem3" , "name":"用户" },{ "id":"menuitem6" , "name":"角色" },{ "id":"menuitem1" , "name":"认证日志" },{ "id":"menuitem2" , "name":"接入应用" },{ "id":"menuitem4" , "name":"第三方认证" }] }]
}
]
}
......@@ -12,6 +12,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-provider-api.jar
EXPOSE 8081
EXPOSE 40002
ADD ibzuaa-provider-api.jar /ibzuaa-provider-api.jar
......@@ -3,9 +3,22 @@ services:
ibzuaa-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-provider-api:latest
ports:
- "8081:8081"
- "40002:40002"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40002
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- NACOS=172.16.102.211:8848
deploy:
resources:
limits:
......
package cn.ibizlab.api.dto;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient;
import lombok.Data;
/**
* 服务DTO对象[SysOpenAccessDTO]
*/
@Data
public class SysOpenAccessDTO extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 属性 [ACCESSID]
*
*/
@JSONField(name = "id")
@JsonProperty("id")
private String id;
/**
* 属性 [ACCESSNAME]
*
*/
@JSONField(name = "name")
@JsonProperty("name")
private String name;
/**
* 属性 [OPEN_TYPE]
*
*/
@JSONField(name = "open_type")
@JsonProperty("open_type")
private String openType;
/**
* 属性 [ACCESS_KEY]
*
*/
@JSONField(name = "access_key")
@JsonProperty("access_key")
private String accessKey;
/**
* 属性 [SECRET_KEY]
*
*/
@JSONField(name = "secret_key")
@JsonProperty("secret_key")
private String secretKey;
/**
* 属性 [REGION_ID]
*
*/
@JSONField(name = "region_id")
@JsonProperty("region_id")
private String regionId;
/**
* 属性 [ACCESS_TOKEN]
*
*/
@JSONField(name = "access_token")
@JsonProperty("access_token")
private String accessToken;
/**
* 属性 [EXPIRES_TIME]
*
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "expires_time" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("expires_time")
private Timestamp expiresTime;
/**
* 属性 [DISABLED]
*
*/
@JSONField(name = "disabled")
@JsonProperty("disabled")
private Integer disabled;
/**
* 属性 [REDIRECT_URI]
*
*/
@JSONField(name = "redirect_uri")
@JsonProperty("redirect_uri")
private String redirectUri;
/**
* 设置 [ACCESSNAME]
*/
public void setName(String name){
this.name = name ;
this.modify("accessname",name);
}
/**
* 设置 [OPEN_TYPE]
*/
public void setOpenType(String openType){
this.openType = openType ;
this.modify("open_type",openType);
}
/**
* 设置 [ACCESS_KEY]
*/
public void setAccessKey(String accessKey){
this.accessKey = accessKey ;
this.modify("access_key",accessKey);
}
/**
* 设置 [SECRET_KEY]
*/
public void setSecretKey(String secretKey){
this.secretKey = secretKey ;
this.modify("secret_key",secretKey);
}
/**
* 设置 [REGION_ID]
*/
public void setRegionId(String regionId){
this.regionId = regionId ;
this.modify("region_id",regionId);
}
/**
* 设置 [ACCESS_TOKEN]
*/
public void setAccessToken(String accessToken){
this.accessToken = accessToken ;
this.modify("access_token",accessToken);
}
/**
* 设置 [EXPIRES_TIME]
*/
public void setExpiresTime(Timestamp expiresTime){
this.expiresTime = expiresTime ;
this.modify("expires_time",expiresTime);
}
/**
* 设置 [DISABLED]
*/
public void setDisabled(Integer disabled){
this.disabled = disabled ;
this.modify("disabled",disabled);
}
/**
* 设置 [REDIRECT_URI]
*/
public void setRedirectUri(String redirectUri){
this.redirectUri = redirectUri ;
this.modify("redirect_uri",redirectUri);
}
}
package cn.ibizlab.api.mapping;
import org.mapstruct.*;
import cn.ibizlab.core.uaa.domain.SysOpenAccess;
import cn.ibizlab.api.dto.SysOpenAccessDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiSysOpenAccessMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface SysOpenAccessMapping extends MappingBase<SysOpenAccessDTO, SysOpenAccess> {
}
package cn.ibizlab.api.rest;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.api.dto.*;
import cn.ibizlab.api.mapping.*;
import cn.ibizlab.core.uaa.domain.SysOpenAccess;
import cn.ibizlab.core.uaa.service.ISysOpenAccessService;
import cn.ibizlab.core.uaa.filter.SysOpenAccessSearchContext;
import cn.ibizlab.util.annotation.VersionCheck;
@Slf4j
@Api(tags = {"第三方认证平台" })
@RestController("api-sysopenaccess")
@RequestMapping("")
public class SysOpenAccessResource {
@Autowired
public ISysOpenAccessService sysopenaccessService;
@Autowired
@Lazy
public SysOpenAccessMapping sysopenaccessMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Create-all')")
@ApiOperation(value = "新建第三方认证平台", tags = {"第三方认证平台" }, notes = "新建第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses")
@Transactional
public ResponseEntity<SysOpenAccessDTO> create(@RequestBody SysOpenAccessDTO sysopenaccessdto) {
SysOpenAccess domain = sysopenaccessMapping.toDomain(sysopenaccessdto);
sysopenaccessService.create(domain);
SysOpenAccessDTO dto = sysopenaccessMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Create-all')")
@ApiOperation(value = "批量新建第三方认证平台", tags = {"第三方认证平台" }, notes = "批量新建第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<SysOpenAccessDTO> sysopenaccessdtos) {
sysopenaccessService.createBatch(sysopenaccessMapping.toDomain(sysopenaccessdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Update-all')")
@ApiOperation(value = "更新第三方认证平台", tags = {"第三方认证平台" }, notes = "更新第三方认证平台")
@RequestMapping(method = RequestMethod.PUT, value = "/sysopenaccesses/{sysopenaccess_id}")
@Transactional
public ResponseEntity<SysOpenAccessDTO> update(@PathVariable("sysopenaccess_id") String sysopenaccess_id, @RequestBody SysOpenAccessDTO sysopenaccessdto) {
SysOpenAccess domain = sysopenaccessMapping.toDomain(sysopenaccessdto);
domain .setId(sysopenaccess_id);
sysopenaccessService.update(domain );
SysOpenAccessDTO dto = sysopenaccessMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Update-all')")
@ApiOperation(value = "批量更新第三方认证平台", tags = {"第三方认证平台" }, notes = "批量更新第三方认证平台")
@RequestMapping(method = RequestMethod.PUT, value = "/sysopenaccesses/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<SysOpenAccessDTO> sysopenaccessdtos) {
sysopenaccessService.updateBatch(sysopenaccessMapping.toDomain(sysopenaccessdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Remove-all')")
@ApiOperation(value = "删除第三方认证平台", tags = {"第三方认证平台" }, notes = "删除第三方认证平台")
@RequestMapping(method = RequestMethod.DELETE, value = "/sysopenaccesses/{sysopenaccess_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("sysopenaccess_id") String sysopenaccess_id) {
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessService.remove(sysopenaccess_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Remove-all')")
@ApiOperation(value = "批量删除第三方认证平台", tags = {"第三方认证平台" }, notes = "批量删除第三方认证平台")
@RequestMapping(method = RequestMethod.DELETE, value = "/sysopenaccesses/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
sysopenaccessService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Get-all')")
@ApiOperation(value = "获取第三方认证平台", tags = {"第三方认证平台" }, notes = "获取第三方认证平台")
@RequestMapping(method = RequestMethod.GET, value = "/sysopenaccesses/{sysopenaccess_id}")
public ResponseEntity<SysOpenAccessDTO> get(@PathVariable("sysopenaccess_id") String sysopenaccess_id) {
SysOpenAccess domain = sysopenaccessService.get(sysopenaccess_id);
SysOpenAccessDTO dto = sysopenaccessMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取第三方认证平台草稿", tags = {"第三方认证平台" }, notes = "获取第三方认证平台草稿")
@RequestMapping(method = RequestMethod.GET, value = "/sysopenaccesses/getdraft")
public ResponseEntity<SysOpenAccessDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessMapping.toDto(sysopenaccessService.getDraft(new SysOpenAccess())));
}
@ApiOperation(value = "检查第三方认证平台", tags = {"第三方认证平台" }, notes = "检查第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody SysOpenAccessDTO sysopenaccessdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessService.checkKey(sysopenaccessMapping.toDomain(sysopenaccessdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Save-all')")
@ApiOperation(value = "保存第三方认证平台", tags = {"第三方认证平台" }, notes = "保存第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses/save")
public ResponseEntity<Boolean> save(@RequestBody SysOpenAccessDTO sysopenaccessdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysopenaccessService.save(sysopenaccessMapping.toDomain(sysopenaccessdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-Save-all')")
@ApiOperation(value = "批量保存第三方认证平台", tags = {"第三方认证平台" }, notes = "批量保存第三方认证平台")
@RequestMapping(method = RequestMethod.POST, value = "/sysopenaccesses/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<SysOpenAccessDTO> sysopenaccessdtos) {
sysopenaccessService.saveBatch(sysopenaccessMapping.toDomain(sysopenaccessdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-searchDefault-all')")
@ApiOperation(value = "获取DEFAULT", tags = {"第三方认证平台" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/sysopenaccesses/fetchdefault")
public ResponseEntity<List<SysOpenAccessDTO>> fetchDefault(SysOpenAccessSearchContext context) {
Page<SysOpenAccess> domains = sysopenaccessService.searchDefault(context) ;
List<SysOpenAccessDTO> list = sysopenaccessMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzuaa-SysOpenAccess-searchDefault-all')")
@ApiOperation(value = "查询DEFAULT", tags = {"第三方认证平台" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/sysopenaccesses/searchdefault")
public ResponseEntity<Page<SysOpenAccessDTO>> searchDefault(@RequestBody SysOpenAccessSearchContext context) {
Page<SysOpenAccess> domains = sysopenaccessService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(sysopenaccessMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册