Merge branches 'dev' and 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project

This commit is contained in:
lvleigang 2024-06-11 09:56:48 +08:00
commit 22b32ce6dc
30 changed files with 613 additions and 6025 deletions

View File

@ -87,6 +87,12 @@
<profile.active>ydc</profile.active>
</properties>
</profile>
<profile>
<id>yc</id> <!--越城区-->
<properties>
<profile.active>yc</profile.active>
</properties>
</profile>
</profiles>
<build>
<finalName>kangarooDataCenterV3</finalName>

View File

@ -5,24 +5,31 @@ logging:
root: info
encodings: UTF-8
file:
# 日志保存路径
# 日志保存路径
path: /Users/apple/Desktop/log/local
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
# url: jdbc:mysql://hzya.ufyct.com:9096/businesscenternew?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# url: jdbc:mysql://hzya.ufyct.com:9096/businesscenterauto?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: bd993088e8a7c3dc5f44441617f9b4bf
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
driver-class-name: dm.jdbc.driver.DmDriver
# type: com.alibaba.druid.pool.DruidDataSource
# url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
savefile:
# 文件保存路径
# 文件保存路径
path: /Users/apple/Desktop/log/local
ax:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -0,0 +1,27 @@
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/apple/Desktop/log/local
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local
ax:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface

View File

@ -0,0 +1,25 @@
#######################本地环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn

File diff suppressed because one or more lines are too long

View File

@ -1,3 +0,0 @@
ALTER TABLE sys_data_source ADD COLUMN data_state char(1) DEFAULT NULL COMMENT '数据源状态 0校验失败 1校验成功';
UPDATE sys_data_source SET data_state = '1';
COMMIT;

View File

@ -11,6 +11,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Component;
@ -26,103 +27,10 @@ import java.util.Properties;
* @Date: 2020/3/31 10:25
* 数据源工具类
*/
//@Component
//@Lazy(value = false)
@Component
public class DataSourceUtil {
//DATASOURCECODE
public static final ThreadLocal<BaseEntity> myContextThreadLocal = new ThreadLocal<>();
private static final Logger logger = LoggerFactory.getLogger(DataSourceUtil.class);
//SqlSessionFactory容器
private static final Map<String, SqlSessionFactory> SQLSESSIONFACTORYMAP = new HashMap<>();
//dataSource容器
private final Map<String, DruidDataSource> DATASOURCEMAP = new HashMap<>();
// 通过依赖注入获取 DynamicRoutingDataSource 对象
@Resource
private DynamicRoutingDataSource ds;
/****
* 根据dataSourceKey 打开 SqlSession ,如果获取不到SqlSessionFactory 会抛出异常
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2024-02-22 14:50
* @param
* @return org.apache.ibatis.session.SqlSession
**/
public synchronized static SqlSession getSqlSession() {
String dsKey = "master"; // 根据业务逻辑确定要使用的数据源名称
BaseEntity entity = DataSourceUtil.myContextThreadLocal.get();
if(null != entity ){
dsKey = entity.getDataSourceCode();
}
// 通过 DynamicRoutingDataSource 获取当前数据源
// ds.getDataSource(dsKey);
SqlSessionFactory factory = getSqlSessionFactoryByCache(dsKey);
if (null == factory) {
throw new BaseSystemException("根据dataSourceKey获取SqlSessionFactory 失败!请联系管理员");
} else {
return factory.openSession();
}
}
/****
* 根据dataSourceKey获取缓存内的SqlSessionFactory,如果获取不到会抛出异常信息
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2024-02-22 14:44
* @param
* @return org.apache.ibatis.session.SqlSessionFactory
**/
public static SqlSessionFactory getSqlSessionFactoryByCache(String dataSourceKey) {
SqlSessionFactory sqlSessionFactory = SQLSESSIONFACTORYMAP.get(dataSourceKey);
if (null == sqlSessionFactory) {
throw new BaseSystemException("根据当前dataSourceKey获取SqlSessionFactory失败,请联系系统管理员dataSourceKey:" + dataSourceKey);
}
return sqlSessionFactory;
}
/****
* 根据 dataSource 创建SqlSessionFactory,并放入map缓存 dataSourceKey
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2024-02-22 14:38
* @param
* @return org.apache.ibatis.session.SqlSessionFactory
**/
public static SqlSessionFactory createSqlSessionFactoryToCache(String dataSourceKey, DataSource dataSource) {
SqlSessionFactory sqlSessionFactory = createSqlSessionFactory(dataSource);
SQLSESSIONFACTORYMAP.put(dataSourceKey, sqlSessionFactory);
return sqlSessionFactory;
}
//创建sqlSessionFactory
public static SqlSessionFactory createSqlSessionFactory(DataSource dataSource) throws BaseSystemException {
try {
if (null != dataSource) {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//数据源
sqlSessionFactoryBean.setDataSource(dataSource);
//mybatis的config文件
PathMatchingResourcePatternResolver configLocationResolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setConfigLocation(configLocationResolver.getResource("classpath:mybatis/mybatis-config.xml"));
//xml
PathMatchingResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resourcePatternResolver.getResources("classpath*:com/hzya/**/*.xml"));
sqlSessionFactoryBean.setDatabaseIdProvider(getDatabaseIdProvider());
return sqlSessionFactoryBean.getObject();
} else {
logger.info("======================创建sqlSessionFactory失败===========================");
throw new BaseSystemException("创建sqlSessionFactory失败");
}
} catch (Exception e) {
logger.info("======================创建sqlSessionFactory失败===========================");
throw new BaseSystemException("创建sqlSessionFactory失败" + e.getMessage());
}
}
public static DatabaseIdProvider getDatabaseIdProvider() {
@Bean
public DatabaseIdProvider getDatabaseIdProvider() {
//DBMS 后缀
//Oracle oracle
//DB2 db2
@ -144,9 +52,4 @@ public class DataSourceUtil {
dbProvider.setProperties(setPro);
return dbProvider;
}
public Map<String, DruidDataSource> getDataSourceMap() {
return DATASOURCEMAP;
}
}

13
pom.xml
View File

@ -29,7 +29,7 @@
<gson.version>2.8.5</gson.version>
<zxing.version>3.3.0</zxing.version>
<hutool.version>5.8.19</hutool.version>
<druid.version>1.1.22</druid.version>
<druid.version>1.2.0</druid.version>
<!-- <mybatis-spring-boot-starter.version>2.2.2</mybatis-spring-boot-starter.version>-->
<mybatis-plus-boot-starter.version>3.5.6</mybatis-plus-boot-starter.version>
<!-- <mysql-connector-j.version>8.0.33</mysql-connector-j.version>-->
@ -235,7 +235,8 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid-spring-boot-starter.version}</version>
<version>1.2.23</version>
<!-- <version>${druid-spring-boot-starter.version}</version>-->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
@ -245,6 +246,12 @@
</dependency>
<!-- 添加dm8 jdbc jar 包依赖-->
<!-- <dependency>-->
<!-- <groupId>com.dameng</groupId>-->
<!-- <artifactId>DmJdbcDriver18</artifactId>-->
<!-- <version>8.1.1.193</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>Dm8JdbcDriver18</artifactId>
@ -252,6 +259,7 @@
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
@ -383,6 +391,7 @@
<artifactId>flyway-mysql</artifactId>
<version>8.5.13</version>
</dependency>
</dependencies>
<build>

View File

@ -21,6 +21,36 @@
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java}</version>
</dependency>
<dependency>
<groupId>com.hzya.bip</groupId>
<artifactId>pubbaseapp_nccloud_rtLevel</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/pubbaseapp_nccloud_rtLevel-1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.hzya.bipyonyoulog</groupId>
<artifactId>yonyoulog</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/yonyoulog.jar</systemPath>
</dependency>
<dependency>
<groupId>com.hzya.bcprov</groupId>
<artifactId>bcprov</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/bcprov-jdk15on-1.57.jar</systemPath>
</dependency>
<dependency>
<groupId>com.hzya.DataApiSdk</groupId>
<artifactId>DataApiSdk</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/DataApiSdk-jar-with-dependencies.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -0,0 +1,13 @@
package com.hzya.frame.bip.v3.v2207.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* com.hzya.frame.bip.v3.v2207.entity
*
* @author makejava
* @date 2024-05 -27 11:24
*/
public class BipTokenVo extends BaseEntity {
}

View File

@ -0,0 +1,30 @@
package com.hzya.frame.bip.v3.v2207.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public interface IBipSsoService extends IBaseService<BipTokenVo,String>{
/**
*
* @content Bip单点统一认证接口
* @author laborer
* @date 2024/5/30 0030 13:45
*
*/
String erpSso(String ticket)throws Exception;
/**
*
* @content 此方法获取sso动态加密heade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity);
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.bip.v3.v2207.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
public interface IBipV32207BillService extends IBaseService<BipTokenVo,String>{
/**
*
* @content 此方法获取BIPtokenheade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity);
}

View File

@ -0,0 +1,22 @@
package com.hzya.frame.bip.v3.v2207.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipSupplierEntity;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
public interface IBipV32207TokenService extends IBaseService<BipTokenVo,String>{
/**
*
* @content 此方法获取BIPtokenheade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
SysExtensionApiEntity getBipToken(SysExtensionApiEntity entity);
}

View File

@ -0,0 +1,111 @@
package com.hzya.frame.bip.v3.v2207.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpException;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.bip.v3.v2207.service.IBipSsoService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import nccloud.security.impl.SignatureTookKit;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service(value = "BipSsoServiceImpl")
public class BipSsoServiceImpl extends BaseService<BipTokenVo, String> implements IBipSsoService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final String BASEURL = "http://192.168.2.237:8099/seeyon/thirdpartyController.do?ticket=";
private final String ESBURL = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface";
/**
*
* @content Bip单点统一认证接口
* @author laborer
* @date 2024/5/30 0030 13:45
*
*/
@Override
public String erpSso(String userCode)throws Exception {
String result = "";
boolean flag = true;
// logger.info("接收到致远OA认证参数的ticket{}",ticket);
//通过ticket获取OA用户信息
// String userCode = HttpUtil.get(BASEURL+ticket);
// String userCode = "yonyou";
logger.info("获取到的OA用户信息{}",userCode);
String dsname = "YonBIPV3";
String client_id = "OAREST";//第三方系统id
StringBuffer sb = new StringBuffer();
if(StrUtil.isNotEmpty(userCode)){
try {
String security = genKey(userCode,userCode + (System.currentTimeMillis() + "").substring(0, 6));
sb.append("type=type_security&dsname="+dsname+"&usercode="+userCode+"&client_id="+client_id+"&security="+security);
String baseUrl = "http://192.168.2.85:8888/service/genThirdPartyAccessToken?"+sb.toString();
// logger.info("请求BIPtokenbaseUrl{}",baseUrl);
result = result = HttpRequest.post(baseUrl)
.header("Content-Type", "application/x-www-form-urlencoded")//头信息多个头信息多次调用此方法即可
.header("Content-Length", "10000")//头信息多个头信息多次调用此方法即可
.header("userid", "admin")//头信息多个头信息多次调用此方法即可
.body("{}")//表单内容
.timeout(20000)//超时毫秒
.execute().body();
// logger.info("获取到的BIPtoken信息{}",result);
} catch (HttpException e) {
flag=false;
e.printStackTrace();
}
}
if(flag){
String indexUR = "http://192.168.2.85:8888/nccloud/resources/uap/rbac/thirdpartylogin/main/index.html?accesstoken="+result+"&redirect_uri=http://192.168.2.85:8888/nccloud/resources/workbench/public/common/main/index.html#";
logger.info(indexUR);
return indexUR;
}else{
return "http://192.168.2.85:8888/nccloud/resources/uap/rbac/login/main/index.html";
}
}
/**
*
* @content 此方法获取sso动态加密heade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
@Override
public SysExtensionApiEntity ssoEncrypt(SysExtensionApiEntity entity) {
try {
Map<String, String> headers = entity.getHeaders();
String userCode = headers.get("usercode");//用户编码
String dsname = headers.get("dsname");//数据源
String client_id = headers.get("client_id");//第三方系统id
StringBuffer sb = new StringBuffer();
String security = genKey(userCode,userCode + (System.currentTimeMillis() + "").substring(0, 6));
StringBuffer querys = new StringBuffer();
querys.append("type=type_security");
querys.append("&dsname="+dsname);
querys.append("&usercode="+userCode);
querys.append("&client_id="+client_id);
querys.append("&security="+security);
entity.setQuerys(querys.toString());
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("userid", "admin");
entity.setHeaders(headers);
} catch (Exception e) {
e.printStackTrace();
}
return entity;
}
/**获取NCC的key*/
private static String genKey(String userid, String key) throws Exception {
return new Base64().encodeToString(SignatureTookKit.digestSign(userid.getBytes(), key.getBytes()));
}
}

View File

@ -0,0 +1,62 @@
package com.hzya.frame.bip.v3.v2207.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.bip.v3.v2207.service.IBipV32207BillService;
import com.hzya.frame.bip.v3.v2207.service.IBipV32207TokenService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.util.bipV3.Encryption;
import com.hzya.frame.util.bipV3.SHA256Util;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@Service(value = "BipV32207BillServiceImpl")
public class BipV32207BillServiceImpl extends BaseService<BipTokenVo, String> implements IBipV32207BillService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
*
* @content 此方法获取拼接单据动态加密heade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
@Override
public SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity) {
try {
Map<String, String> headers = entity.getHeaders();
String client_id = headers.get("client_id");
//token信息
String access_token = headers.get("access_token");
//公钥
String pubKey = headers.get("pubKey");
StringBuffer sb = new StringBuffer();
sb.append(client_id);
String parm = entity.getBodys();
if (StringUtils.isNotBlank(parm)) {
sb.append(parm);
}
sb.append(pubKey);
// 签名
String sign = SHA256Util.getSHA256(sb.toString(), pubKey);
StringBuffer querys = new StringBuffer();
querys.append("access_token="+access_token);
querys.append("&signature="+sign);
querys.append("&client_id="+client_id);
entity.setQuerys(querys.toString());
headers.put("signature",sign);
// headers.put("content-type","application/x-www-form-urlencoded");
} catch (Exception e) {
e.printStackTrace();
}
return entity;
}
}

View File

@ -0,0 +1,92 @@
package com.hzya.frame.bip.v3.v2207.service.impl;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDao;
import com.hzya.frame.bip.v3.v2207.dao.IBipOrgsDetailsDao;
import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDao;
import com.hzya.frame.bip.v3.v2207.dao.IBipSupplierDetailsDao;
import com.hzya.frame.bip.v3.v2207.entity.*;
import com.hzya.frame.bip.v3.v2207.service.IBipV32207Service;
import com.hzya.frame.bip.v3.v2207.service.IBipV32207TokenService;
import com.hzya.frame.dateutil.DateUtil;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.util.PluginUtils;
import com.hzya.frame.util.bipV3.Encryption;
import com.hzya.frame.util.bipV3.SHA256Util;
import com.hzya.frame.util.oldNcc.CompressUtil;
import com.hzya.frame.util.oldNcc.Decryption;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.*;
@Service(value = "bipV32207TokenService")
public class BipV32207TokenServiceImpl extends BaseService<BipTokenVo, String> implements IBipV32207TokenService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
*
* @content 此方法获取BIPtokenheade参数动态传入
* @author laborer
* @date 2024/5/27 0027 11:38
*
*/
@Override
public SysExtensionApiEntity getBipToken(SysExtensionApiEntity entity) {
try {
Map<String, String> headers = entity.getHeaders();
String client_id = headers.get("client_id");
Map<String, String> paramMap = new HashMap<String, String>();
// 密码模式认证
paramMap.put("grant_type", "client_credentials");
// 第三方应用id
paramMap.put("client_id", client_id);
// 第三方应用secret]
String client_secret = headers.get("client_secret");
// 账套编码
String busi_center = headers.get("busi_center");
//用户编码
String usercode = headers.get("usercode");
//数据库编码
String dsname = headers.get("dsname");
String pubKey = headers.get("pubKey");
// 第三方应用secret 公钥加密]
paramMap.put("client_secret", URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8"));
// 账套编码
paramMap.put("biz_center", busi_center);
// // TODO 传递数据源和ncc登录用户
paramMap.put("dsname", dsname);
paramMap.put("usercode", usercode);
// 签名
String sign = SHA256Util.getSHA256(client_id + client_secret + pubKey,pubKey);
paramMap.put("signature", sign);
StringBuffer querys = new StringBuffer();
querys.append("biz_center="+busi_center);
querys.append("&grant_type="+"client_credentials");
querys.append("&signature="+sign);
querys.append("&dsname="+dsname);
querys.append("&client_secret="+URLEncoder.encode(Encryption.pubEncrypt(pubKey, client_secret), "utf-8"));
querys.append("&usercode="+usercode);
querys.append("&client_id="+client_id);
entity.setQuerys(querys.toString());
headers.put("content-type","application/x-www-form-urlencoded");
} catch (Exception e) {
e.printStackTrace();
}
return entity;
}
}

View File

@ -0,0 +1,12 @@
package com.hzya.frame.bip.v3.v2207.util;
/**
* com.hzya.frame.bip.v3.v2207.util
*
* @author makejava
* @date 2024-05 -30 14:20
*/
public class BipUtil {
}

View File

@ -74,7 +74,7 @@ WHERE
<!-- 查询 采用==查询 -->
<select id="sevenerrornum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
<select id="sevenerrornum" databaseId="mysql" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
SELECT
count( id ) as abnormalNum,
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
@ -90,7 +90,23 @@ WHERE
'%Y-%m-%d')
</select>
<!-- 查询 采用==查询 -->
<select id="sevensuccessnum" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
<select id="sevenerrornum" databaseId="oracle" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
SELECT
count( id ) as abnormalNum,
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
FROM
sys_message_manage_log
WHERE sts = 'Y' and status = '4' and
create_time between add_days( NOW(), -6 ) AND NOW()
GROUP BY
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE_FORMAT(
create_time,
'%Y-%m-%d')
</select>
<!-- 查询 采用==查询 -->
<select id="sevensuccessnum" databaseId="mysql" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
SELECT
count( id ) as normalNum,
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
@ -105,5 +121,21 @@ WHERE
create_time,
'%Y-%m-%d')
</select>
<!-- 查询 采用==查询 -->
<select id="sevensuccessnum" databaseId="oracle" resultType="com.hzya.frame.home.entity.HomeEntity" parameterType="com.hzya.frame.home.entity.HomeEntity">
SELECT
count( id ) as normalNum,
DATE_FORMAT( create_time, '%Y-%m-%d' ) as name
FROM
sys_message_manage_log_success
WHERE sts = 'Y' and status = '3' and
create_time between add_days( NOW(), -6 ) AND NOW()
GROUP BY
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE_FORMAT(
create_time,
'%Y-%m-%d')
</select>
</mapper>

View File

@ -28,6 +28,8 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
return o;
}
@Override
public MdmModuleEntity getByMdmCode(Long mdmCode) {
MdmModuleEntity mdmModuleEntity = (MdmModuleEntity) super.selectOne(getSqlIdPrifx() + "getByMdmCode",mdmCode);

View File

@ -13,7 +13,6 @@ import com.hzya.frame.sysnew.userRoles.entity.SysUserRolesEntity;
import com.hzya.frame.util.AESUtil;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import dm.jdbc.d.U;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;

View File

@ -56,7 +56,7 @@
<include refid="FileDownloadEntity_Base_Column_List" />
from sys_file
<trim prefix="where" prefixOverrides="and">
<if test="id != null ">id=#{id}</if>
<if test="id != null and id !='' ">id=#{id}</if>
<if test="filename != null and filename !='' "> and filename = #{filename}</if>
<if test="filesavename != null and filesavename !='' "> and filesavename = #{filesavename}</if>
<if test="type != null and type !='' "> and type = #{type}</if>

View File

@ -702,7 +702,7 @@ where id = #{id}
<!-- </trim>-->
<!-- order by a.sorts asc-->
<!-- </select>-->
<select id="queryVoList" resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
<select id="queryVoList" databaseId="mysql" resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
select
a.id,
a.catalogue_id AS catalogueId,
@ -744,6 +744,48 @@ where id = #{id}
</trim>
order by a.sorts asc
</select>
<select id="queryVoList" databaseId="oracle" resultType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiVo" parameterType="com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity">
select
a.id,
a.catalogue_id AS catalogueId,
(
SELECT
b.NAME
FROM
sys_application_api_type b
WHERE
b.sts = 'Y'
AND b.id = a.catalogue_id
) AS catalogueName,
a.api_name AS apiName,
a.api_code AS apiCode,
a.api_path AS apiPath,
a.destination_address AS destinationAddress,
a.api_remark AS apiRemark,
0 AS errorCount,
a.api_status AS apiStatus,
(
SELECT
WM_CONCAT( d.tripartite_system_id )
FROM
sys_application_api_auth_detail d
WHERE
d.app_id = a.app_id
AND d.api_id = a.id
and d.sts = 'Y'
) as authDetail
FROM
sys_application_api a
<trim prefix="where" prefixOverrides="and">
<if test="appId != null and appId != ''">and a.app_id = #{appId}</if>
<if test="catalogueId != null and catalogueId != ''">and a.catalogue_id = #{catalogueId}</if>
<if test="nameOrRemark != null and nameOrRemark != ''">and (a.api_name like concat('%',#{nameOrRemark},'%')
or a.api_remark like concat('%',#{nameOrRemark},'%') )
</if>
and a.sts='Y'
</trim>
order by a.sorts asc
</select>
<!-- 查询 采用==查询 -->
<select id="queryBaseName" resultMap="get-SysApplicationApiEntity-result"

View File

@ -12,6 +12,24 @@ public class VoucherDetails {
private String localdebitamount;
private String pk_accsubj;
private String pk_currtype;
private String debitquantity;
private String price;
public String getDebitquantity() {
return debitquantity;
}
public void setDebitquantity(String debitquantity) {
this.debitquantity = debitquantity;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public List<Ass> getAss() {
return ass;

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>

View File

@ -1,5 +1,6 @@
package com.hzya.frame.webapp.entrance.controler;
import com.hzya.frame.bip.v3.v2207.service.IBipSsoService;
import com.hzya.frame.sysnew.application.service.ISysApplicationService;
import com.hzya.frame.sys.entity.EsbReturnEntity;
import com.hzya.frame.sys.file.download.entity.FileDownloadEntity;
@ -29,6 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -49,6 +51,8 @@ public class EntranceController {
private IEntranceService entranceService;
@Autowired
protected IFileDownloadService filedownloadService;
@Autowired
protected IBipSsoService bipSsoService;
@Resource
protected ISysApplicationService sysApplicationService;
@RequestMapping(value = "/option")
@ -164,5 +168,13 @@ public class EntranceController {
public JsonResultEntity externalCallInterface(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
return sysApplicationService.externalCallInterface(servletRequest,servletResponse);
}
@RequestMapping(value = "/erpSso")
@ResponseBody
public String erpSso(HttpServletResponse response, String ticket) throws Exception {
String indexUrl = bipSsoService.erpSso(ticket);
response.sendRedirect(indexUrl);
// response.sendRedirect("https://www.sojson.com/aaa");
// response.sendRedirect("http://127.0.0.1:8888/nccloud/resources/uap/rbac/login/main/index.html");
return indexUrl;
}
}

View File

@ -1,4 +1,5 @@
package com.hzya.frame.webapp.web.init;
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import com.hzya.frame.util.AESUtil;
import lombok.RequiredArgsConstructor;
import org.flywaydb.core.Flyway;
@ -7,10 +8,12 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.sql.DataSource;
@Configuration
@RequiredArgsConstructor
@EnableTransactionManagement
//@Configuration
//@RequiredArgsConstructor
//@EnableTransactionManagement
public class FlywayConfig {
@Value("${spring.flyway.enabled}")
@ -39,13 +42,21 @@ public class FlywayConfig {
private String username;
@Value("${spring.datasource.dynamic.datasource.master.password}")
private String password;
@Resource
private DataSource dataSource;
@PostConstruct
//@PostConstruct
public void migrateOrder() {
String pwd = AESUtil.decrypt(password);
DynamicRoutingDataSource ds = (DynamicRoutingDataSource) dataSource;
DataSource dsDatasource = null;
dsDatasource = ds.getDataSource("master");
// 将路径转换
Flyway flyway = Flyway.configure()
.dataSource(url,username,pwd)
//.dataSource(url,username,pwd)
.dataSource(dsDatasource)
.cleanDisabled(cleanDisabled)
.locations(locations)
.table(table)