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

zhouweidong 部署微服务接口 [ibz-wf,microservice]

上级 e58069a5
......@@ -37,6 +37,11 @@
git clone -b master $para2 ibzwf/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzwf/
mvn clean package -Papi
cd ibzwf-provider/ibzwf-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -112,10 +112,10 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
"/**/svg/**",
"/"
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 放行登录请求
.antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
// 放行注销请求
.antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
......
......@@ -30,13 +30,13 @@ import java.util.List;
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
})
public class webApplication extends WebMvcConfigurerAdapter{
public class webApplication extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(webApplication.class,args);
SpringApplication.run(webApplication.class, args);
}
@Override
......
......@@ -25,8 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
@SpringBootApplication(exclude = {
})
@ComponentScan(basePackages = {"cn.ibizlab"}
// ,excludeFilters={
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="cn.ibizlab.xxx.rest.xxx"),
// ,excludeFilters = {
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX, pattern="cn.ibizlab.xxx.rest.xxx"),
// }
)
@Import({
......@@ -34,13 +34,13 @@ import org.springframework.beans.factory.annotation.Autowired;
})
@EnableAsync
@EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter{
public class DevBootApplication extends WebMvcConfigurerAdapter {
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class,args);
SpringApplication.run(DevBootApplication.class, args);
}
@Override
......
......@@ -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 /ibzwf-provider-api.jar
EXPOSE 8081
EXPOSE 40003
ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar
......@@ -3,9 +3,23 @@ services:
ibzwf-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest
ports:
- "8081:8081"
- "40003:40003"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40003
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.100.243: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.100.243:8848
- SPRING_CLOUD_NACOS_DISCOVERY_GROUP=ibizdev
deploy:
resources:
limits:
......
......@@ -19,7 +19,7 @@ import org.springframework.context.annotation.Import;
@ConditionalOnClass(apiRestConfiguration.class)
@ConditionalOnWebApplication
@EnableConfigurationProperties(apiServiceProperties.class)
public class apiAutoConfiguration implements ApplicationContextAware{
public class apiAutoConfiguration implements ApplicationContextAware {
protected ApplicationContext applicationContext;
......
......@@ -15,12 +15,12 @@ public interface AuthenticationUserService extends UserDetailsService {
@Override
@Cacheable( value="ibzuaa_users",key = "'getByUsername:'+#p0")
@Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByUsername(String username);
@Cacheable( value="ibzuaa_users",key = "'getByUsername:'+#p0")
@Cacheable( value="ibzuaa_users", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByLogin(String username,String password);
@CacheEvict( value="ibzuaa_users",key = "'getByUsername:'+#p0")
@CacheEvict( value="ibzuaa_users", key = "'getByUsername:'+#p0")
void resetByUsername(String username);
}
......@@ -26,39 +26,39 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@Value("${ibiz.admin.userid:0100}")
private String adminuserid;
@Cacheable( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
@Cacheable(value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public JSONObject getConfig(String cfgType,String targetType,String userId)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("获取配置失败,参数缺失","IBZConfig",cfgType);
}
IBZConfig config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()),false);
if(config==null) {
config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(adminuserid).build()),false);
if(config==null) {
IBZConfig config = this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()), false);
if(config == null) {
config = this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(adminuserid).build()), false);
if(config == null) {
return new JSONObject();
}
}
return JSON.parseObject(config.getCfg());
}
@CacheEvict( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public boolean saveConfig(String cfgType,String targetType,String userId,JSONObject config)
@CacheEvict(value="ibzrt_configs", key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public boolean saveConfig(String cfgType, String targetType, String userId, JSONObject config)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("保存配置失败,参数缺失","IBZConfig",cfgType);
}
String cfg="{}";
if(config!=null){
cfg=JSONObject.toJSONString(config);
String cfg = "{}";
if(config != null) {
cfg = JSONObject.toJSONString(config);
}
return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build());
}
@CacheEvict( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public void resetConfig(String cfgType,String targetType,String userId)
@CacheEvict(value = "ibzrt_configs", key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public void resetConfig(String cfgType, String targetType, String userId)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("重置配置失败,参数缺失","IBZConfig",cfgType);
}
this.remove(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()));
......
......@@ -11,9 +11,9 @@ import java.util.Map;
*/
public interface IBZDataAuditService {
@Async("asyncExecutor")
void createAudit(HttpServletRequest request,EntityBase entity,Object idValue,Map<String, Audit> auditFields);
void createAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields);
@Async("asyncExecutor")
void updateAudit(HttpServletRequest request, EntityBase beforeEntity, Object serviceObj, Object idValue, Map<String, Audit> auditFields);
@Async("asyncExecutor")
void removeAudit(HttpServletRequest request,EntityBase entity,Object idValue,Map<String, Audit> auditFields);
void removeAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields);
}
\ No newline at end of file
......@@ -26,8 +26,8 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override
public AuthenticationUser loadUserByUsername(String username) {
AuthenticationUser user=uaaFeignClient.loginByUsername(username);
if(user==null){
AuthenticationUser user = uaaFeignClient.loginByUsername(username);
if(user == null) {
throw new BadRequestAlertException("登录失败","IBZUAAUser",username);
}
return user;
......@@ -35,9 +35,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override
public AuthenticationUser loadUserByLogin(String username, String password) {
String[] data=username.split("[|]");
String loginname=username;
String domains="";
String[] data = username.split("[|]");
String loginname = username;
String domains = "";
if(data.length==2) {
loginname=data[0].trim();
......@@ -47,9 +47,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
logininfo.setDomain(domains);
logininfo.setLoginname(loginname);
logininfo.setPassword(password);
AuthenticationUser user=uaaFeignClient.login(logininfo);
if(user==null){
throw new BadRequestAlertException("登录失败","IBZUAAUser",username);
AuthenticationUser user = uaaFeignClient.login(logininfo);
if(user == null){
throw new BadRequestAlertException("登录失败","IBZUAAUser", username);
}
return user;
}
......
......@@ -49,10 +49,10 @@ public class RemoteService {
*/
public interface RemoteFeignClient {
@RequestMapping(method = RequestMethod.POST, value = "/{path}")
JSONObject post( @PathVariable("path") String path, @RequestHeader("Authorization") String token,@RequestBody Map param);
JSONObject post( @PathVariable("path") String path, @RequestHeader("Authorization") String token, @RequestBody Map param);
@RequestMapping(method = RequestMethod.GET, value = "/{path}")
JSONObject request( @PathVariable("path") String path, @RequestHeader("Authorization") String token,Map param);
JSONObject request( @PathVariable("path") String path, @RequestHeader("Authorization") String token, Map param);
@RequestMapping(method = RequestMethod.GET, value = "/{path}")
JSONObject get( @PathVariable("path") String path, @RequestHeader("Authorization") String token);
......@@ -61,7 +61,7 @@ public class RemoteService {
JSONObject put( @PathVariable("path") String path, @RequestHeader("Authorization") String token,@RequestBody Map param);
@RequestMapping(method = RequestMethod.DELETE, value = "/{path}")
JSONObject delete( @PathVariable("path") String path, @RequestHeader("Authorization") String token);
JSONObject delete(@PathVariable("path") String path, @RequestHeader("Authorization") String token);
}
/**
......@@ -115,6 +115,4 @@ public class RemoteService {
final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(jsonConverter);
return () -> httpMessageConverters;
}
}
\ No newline at end of file
......@@ -68,7 +68,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
public void createAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields) {
IBZDataAudit dataAudit = new IBZDataAudit();
dataAudit.setOppersonid(AuthenticationUser.getAuthenticationUser().getUserid());
dataAudit.setOppersonname(String.format("%s[%s]",AuthenticationUser.getAuthenticationUser().getPersonname(),AuthenticationUser.getAuthenticationUser().getOrgname()));
dataAudit.setOppersonname(String.format("%s[%s]", AuthenticationUser.getAuthenticationUser().getPersonname(), AuthenticationUser.getAuthenticationUser().getOrgname()));
dataAudit.setAudittype("CREATE");
dataAudit.setAuditobject(entity.getClass().getSimpleName());
dataAudit.setAuditobjectdata(idValue);
......
......@@ -27,7 +27,7 @@ public class SimpleFileService implements FileService {
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String extname ="."+getExtensionName(fileName);
String extname = "."+getExtensionName(fileName);
try {
String fileid = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
String fileFullPath = this.fileRoot+"ibizutil"+File.separator+fileid+File.separator+fileName;
......
......@@ -31,14 +31,14 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Map<String, String[]> params = webRequest.getParameterMap();
LinkedHashMap<String,Object> set=new LinkedHashMap<>();
LinkedHashMap<String,Object> set = new LinkedHashMap<>();
for (String key : params.keySet()) {
set.put(key,params.get(key)[0]);
}
if((!set.containsKey("size")) ){
set.put("size",pageLimit);
set.put("size", pageLimit);
}
String json=objectMapper.writeValueAsString(set);
return objectMapper.readValue(json,parameter.getParameterType());
String json = objectMapper.writeValueAsString(set);
return objectMapper.readValue(json, parameter.getParameterType());
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ spring:
cloud:
nacos:
discovery:
server-addr: 172.16.102.211:8848
server-addr: 172.16.100.243:8848
enabled: true
eureka:
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册