初始化项目
This commit is contained in:
parent
e6d4f03c2a
commit
e632ca7cc1
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>product</artifactId>
|
||||
<groupId>com.nflg</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nflg-bom-new</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.nflg.product.starter</groupId>
|
||||
<artifactId>nflg-boot-starter</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nflg.product.base.core</groupId>
|
||||
<artifactId>nflg.boot.core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ttzero</groupId>
|
||||
<artifactId>eec</artifactId>
|
||||
<version>${eec.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sap.cloud.db.jdbc</groupId>
|
||||
<artifactId>ngdbc</artifactId>
|
||||
<version>2.4.64</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>jcifs</groupId>
|
||||
<artifactId>jcifs</artifactId>
|
||||
<version>${jcifs.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hierynomus</groupId>
|
||||
<artifactId>smbj</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool-version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
<version>2.6.4</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.nflg;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement(proxyTargetClass = true)
|
||||
@ComponentScan(basePackages = {"com.nflg.product.bomnew","com.nflg.product.base.core.config","com.nflg.product.base.core.exception"})
|
||||
@EnableOpenApi
|
||||
@EnableDiscoveryClient
|
||||
@EnableScheduling
|
||||
public class BomnewApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.SHORT_IDS.get("CTT")));
|
||||
final ConfigurableApplicationContext run = SpringApplication.run(BomnewApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nflg.product.bomnew.config;
|
||||
|
||||
import com.alibaba.druid.support.http.WebStatFilter;
|
||||
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.annotation.WebInitParam;
|
||||
|
||||
@WebFilter(filterName = "druidWebStatFilter", urlPatterns = "/*",
|
||||
initParams = {
|
||||
@WebInitParam(name = "exclusions", value = "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*")// 忽略资源
|
||||
}
|
||||
)
|
||||
public class DruidStatFilter extends WebStatFilter {
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.nflg.product.bomnew.config;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.nflg.product.base.core.config.MybatisPlusHandler;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 主数据源配置
|
||||
* @Author 大米
|
||||
* @Date 2022-04-27
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@MapperScan(basePackages = MasterDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "masterSqlSessionFactory")
|
||||
public class MasterDataSourceConfig {
|
||||
|
||||
/**
|
||||
* Mapper.java包扫描路径
|
||||
*/
|
||||
static final String PACKAGE = "com.nflg.product.material.mapper.master";
|
||||
/**
|
||||
* Mapper.xml包扫描路径
|
||||
*/
|
||||
static final String MAPPER_LOCATION = "classpath*:mapper/master/**/*.xml";
|
||||
|
||||
/**
|
||||
* 主数据源地址
|
||||
*/
|
||||
@Value("${master.datasource.url}")
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 主数据源账号
|
||||
*/
|
||||
@Value("${master.datasource.username}")
|
||||
private String user;
|
||||
|
||||
/**
|
||||
* 主数据源密码
|
||||
*/
|
||||
@Value("${master.datasource.password}")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 数据库驱动类
|
||||
*/
|
||||
@Value("${master.datasource.driverClassName}")
|
||||
private String driverClass;
|
||||
|
||||
|
||||
/**
|
||||
* mybatis 拦截器
|
||||
*/
|
||||
@Resource
|
||||
MybatisPlusHandler mybatisPlusHandler;
|
||||
/**
|
||||
* 加载主数据源信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Primary
|
||||
@Bean(name = "masterDataSource")
|
||||
public DataSource masterDataSource() {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
dataSource.setDriverClassName(driverClass);
|
||||
dataSource.setUrl(url);
|
||||
dataSource.setName(user);
|
||||
dataSource.setPassword(password);
|
||||
dataSource.setMaxActive(500);
|
||||
dataSource.setMinIdle(2);
|
||||
dataSource.setInitialSize(2);
|
||||
dataSource.setDefaultAutoCommit(false);
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务管理
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Primary
|
||||
@Bean(name = "masterTransactionManager")
|
||||
public DataSourceTransactionManager masterManager() {
|
||||
return new DataSourceTransactionManager(masterDataSource());
|
||||
}
|
||||
|
||||
/**
|
||||
* SqlSession工厂
|
||||
*
|
||||
* @param masterDataSource
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Primary
|
||||
@Bean(name = "masterSqlSessionFactory")
|
||||
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) throws Exception {
|
||||
final MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
|
||||
MybatisConfiguration configuration = new MybatisConfiguration();
|
||||
configuration.setMapUnderscoreToCamelCase(true);
|
||||
configuration.setCallSettersOnNulls(true);
|
||||
sqlSessionFactoryBean.setConfiguration(configuration);
|
||||
sqlSessionFactoryBean.setDataSource(masterDataSource);
|
||||
// 配置拦截器
|
||||
sqlSessionFactoryBean.setPlugins(mybatisPlusInterceptor());
|
||||
// 配置自动填充功能
|
||||
sqlSessionFactoryBean.setGlobalConfig(new GlobalConfig().setMetaObjectHandler(mybatisPlusHandler));
|
||||
sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MasterDataSourceConfig.MAPPER_LOCATION));
|
||||
return sqlSessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
package com.nflg.product.bomnew.config;
|
||||
|
||||
import com.nflg.product.base.core.config.SpringContextUtils;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @decription
|
||||
* @Author 大米
|
||||
* @Date 2022/9/2 14:35
|
||||
**/
|
||||
@Configuration
|
||||
@Getter
|
||||
@RefreshScope
|
||||
public class NacosConfig {
|
||||
|
||||
@Value("${ad.user.default.pwd}")
|
||||
private String defaultPwd;
|
||||
|
||||
@Value("${nflg.dpt.rowid}")
|
||||
private Long nflgDeptRowId;
|
||||
|
||||
|
||||
@Value("${plm.url}")
|
||||
private String plmUrl;
|
||||
@Value("${plm.user}")
|
||||
private String plmUserName;
|
||||
@Value("${plm.password}")
|
||||
private String plmPassWord;
|
||||
@Value("${plm.vault}")
|
||||
private String plmVault;
|
||||
|
||||
|
||||
@Value("${plm.file.path}")
|
||||
private String plmFilePath;
|
||||
|
||||
@Value("${oa.url}")
|
||||
private String oaUrl;
|
||||
|
||||
@Value("${oa.material.state.url}")
|
||||
private String oaGetStateUrl;
|
||||
|
||||
@Value("${oa.material.update.url}")
|
||||
private String oaUpMaterialUrl;
|
||||
|
||||
@Value("${oa.material.update.state}")
|
||||
private String oaUpStateQueryUrl;
|
||||
|
||||
@Value("${oa.material.summary}")
|
||||
private String summary;
|
||||
|
||||
// @Value("${model.type}")
|
||||
// private String modelCategory;
|
||||
//
|
||||
// @Value("${model.struct}")
|
||||
// private String modelStruct;
|
||||
|
||||
@Value("${ini.file.ip}")
|
||||
private String iniIp;
|
||||
|
||||
@Value("${ini.username}")
|
||||
private String iniUserName;
|
||||
|
||||
@Value("${ini.pwd}")
|
||||
private String iniPwd;
|
||||
|
||||
@Value("${ini.share.name}")
|
||||
private String shareName;
|
||||
|
||||
@Value("${ini.file.name}")
|
||||
private String iniFileNameTemplate;
|
||||
|
||||
@Value("${ini.file.local.path}")
|
||||
private String localFilePath;
|
||||
|
||||
@Value("${ini.domain}")
|
||||
private String iniDomain;
|
||||
|
||||
@Value("${ini.share.path}")
|
||||
private String sharePath;
|
||||
|
||||
|
||||
|
||||
|
||||
public static NacosConfig getNacosConfig(){
|
||||
return SpringContextUtils.getBean(NacosConfig.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.nflg.product.bomnew.fallback;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @decription
|
||||
* @Author 大米
|
||||
* @Date 2022/7/14 18:44
|
||||
**/
|
||||
@Slf4j
|
||||
@RequestMapping("fallback")
|
||||
@RestController
|
||||
public class ValideUserApi {
|
||||
@PostMapping("authorize/fail")
|
||||
@ApiOperation("用户验证失败")
|
||||
public ResultVO<String> authorizeFail(Integer stateCode) {
|
||||
if(!Objects.isNull(stateCode) && stateCode.equals(STATE.PassportErr.getState())){
|
||||
|
||||
return ResultVO.error(STATE.PassportErr,STATE.PassportErr.getMsg());
|
||||
}
|
||||
|
||||
return ResultVO.error(STATE.LoginError,STATE.LoginError.getMsg());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#nacos.server-addr=114.132.64.230:8123
|
||||
nacos.server-addr=192.168.0.194:8848
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
nacos.server-addr=192.168.0.191:8848
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#nacos.server-addr=114.132.64.230:8123
|
||||
nacos.server-addr=192.168.0.194:8848
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
spring.application.name=bom-new
|
||||
spring.profiles.active=dev
|
||||
|
||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
spring.cloud.nacos.config.namespace=nflg_dev
|
||||
spring.cloud.nacos.discovery.namespace=nflg_dev
|
||||
spring.cloud.nacos.config.file-extension=properties
|
||||
nacos.plugin.namespace=nflg_dev
|
||||
|
||||
#configuration
|
||||
spring.cloud.nacos.config.server-addr=${nacos.server-addr}
|
||||
spring.cloud.nacos.config.group=${spring.profiles.active}
|
||||
|
||||
spring.cloud.nacos.config.extension-configs[0].data-id=application-${spring.profiles.active}.properties
|
||||
spring.cloud.nacos.config.extension-configs[0].group=${spring.profiles.active}
|
||||
spring.cloud.nacos.config.extension-configs[0].refresh=true
|
||||
spring.cloud.nacos.config.extension-configs[1].data-id=mysql-${spring.profiles.active}.properties
|
||||
spring.cloud.nacos.config.extension-configs[1].group=${spring.profiles.active}
|
||||
spring.cloud.nacos.config.extension-configs[1].refresh=true
|
||||
|
||||
#discovery
|
||||
spring.cloud.nacos.discovery.server-addr=${nacos.server-addr}
|
||||
spring.cloud.nacos.discovery.group=${spring.profiles.active}
|
||||
spring.cloud.nacos.discovery.metadata.group=${spring.profiles.active}
|
||||
spring.cloud.nacos.discovery.metadata.region=${env_region:blue}
|
||||
spring.cloud.nacos.discovery.metadata.env=${spring.profiles.active}
|
||||
|
||||
logging.level.com.nflg.product.material.mapper.master=INFO
|
||||
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#nacos.server-addr=114.132.64.230:8123
|
||||
nacos.server-addr=192.168.0.194:8848
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
nacos.server-addr=192.168.0.191:8848
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#nacos.server-addr=114.132.64.230:8123
|
||||
nacos.server-addr=192.168.0.194:8848
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
spring.application.name=bom-new
|
||||
spring.profiles.active=dev
|
||||
|
||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||
|
||||
spring.cloud.nacos.config.namespace=nflg_dev
|
||||
spring.cloud.nacos.discovery.namespace=nflg_dev
|
||||
spring.cloud.nacos.config.file-extension=properties
|
||||
nacos.plugin.namespace=nflg_dev
|
||||
|
||||
#configuration
|
||||
spring.cloud.nacos.config.server-addr=${nacos.server-addr}
|
||||
spring.cloud.nacos.config.group=${spring.profiles.active}
|
||||
|
||||
spring.cloud.nacos.config.extension-configs[0].data-id=application-${spring.profiles.active}.properties
|
||||
spring.cloud.nacos.config.extension-configs[0].group=${spring.profiles.active}
|
||||
spring.cloud.nacos.config.extension-configs[0].refresh=true
|
||||
spring.cloud.nacos.config.extension-configs[1].data-id=mysql-${spring.profiles.active}.properties
|
||||
spring.cloud.nacos.config.extension-configs[1].group=${spring.profiles.active}
|
||||
spring.cloud.nacos.config.extension-configs[1].refresh=true
|
||||
|
||||
#discovery
|
||||
spring.cloud.nacos.discovery.server-addr=${nacos.server-addr}
|
||||
spring.cloud.nacos.discovery.group=${spring.profiles.active}
|
||||
spring.cloud.nacos.discovery.metadata.group=${spring.profiles.active}
|
||||
spring.cloud.nacos.discovery.metadata.region=${env_region:blue}
|
||||
spring.cloud.nacos.discovery.metadata.env=${spring.profiles.active}
|
||||
|
||||
logging.level.com.nflg.product.material.mapper.master=INFO
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue