Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InternalLogic
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CrossProvincialPlatform
InternalLogic
Commits
846fd74d
Commit
846fd74d
authored
Jun 01, 2021
by
华润
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内置机本地环境,测试环境,正式环境动态参数配置,方便切换和维护
parent
ee24a26a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
7 deletions
+95
-7
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
...j/adapter/controller/ProvidentFundServicesController.java
+16
-7
src/main/java/net/cdkj/gjj/adapter/domain/PropertyqUtil.java
src/main/java/net/cdkj/gjj/adapter/domain/PropertyqUtil.java
+53
-0
src/main/resources/application.properties
src/main/resources/application.properties
+26
-0
No files found.
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
View file @
846fd74d
...
...
@@ -5,6 +5,7 @@ package net.cdkj.gjj.adapter.controller;
import
com.alibaba.fastjson.JSONObject
;
import
net.cdkj.gjj.adapter.domain.BusinessProcessing
;
import
net.cdkj.gjj.adapter.domain.Json
;
import
net.cdkj.gjj.adapter.domain.PropertyqUtil
;
import
net.cdkj.gjj.adapter.domain.UnitAccountOpeningInformation
;
import
oracle.jdbc.OracleTypes
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -36,11 +37,16 @@ public class ProvidentFundServicesController {
@ResponseBody
@PostMapping
(
"ProvidentFundServices"
)
public
static
String
ProvidentFundServices
()
{
Properties
prop
=
PropertyqUtil
.
getConfig
(
"application.properties"
);
JSONObject
jsonObject
=
new
JSONObject
();
String
type
=
PropertyqUtil
.
getPropValue
(
prop
,
"timetype"
);
if
(
"1"
.
equals
(
type
)){
//表示正式环境
jsonObject
.
put
(
"startTime"
,
currenttime
(
0
));
//正式环境
jsonObject
.
put
(
"endTime"
,
currenttime
(
24
));
//正式环境
// jsonObject.put("startTime", "20210520 00:00:00");//测试环境
// jsonObject.put("endTime", "20210520 23:00:00");//测试环境
}
else
if
(
"2"
.
equals
(
type
)){
//表示测试环境或本地环境
jsonObject
.
put
(
"startTime"
,
PropertyqUtil
.
getPropValue
(
prop
,
"startTime"
));
//测试环境或本地环境
jsonObject
.
put
(
"endTime"
,
PropertyqUtil
.
getPropValue
(
prop
,
"endTime"
));
//测试环境或本地环境
}
jsonObject
.
put
(
"app_id"
,
"eb453ca78b354f2c9163a703530f5186"
);
jsonObject
.
put
(
"app_secret"
,
"9a31b84878654a72a999e38ef55aa186"
);
String
str
=
jsonObject
.
toString
();
...
...
@@ -152,6 +158,7 @@ public class ProvidentFundServicesController {
@ResponseBody
@PostMapping
(
"gjjxtfwjk"
)
public
static
void
gjjxtfwjk
()
throws
Exception
{
Properties
prop
=
PropertyqUtil
.
getConfig
(
"application.properties"
);
//1.调用公积金系统服务接口方法,请求前置机,让前置机请求市监接口,拿到市监返回的开户信息json数据,经过前置机zip解压返回给本内置机处理
String
jsoninfom
=
ProvidentFundServices
();
System
.
out
.
println
(
"拿到第一个接口返回的第三方数据,准备调第一个存储过程"
+
jsoninfom
);
...
...
@@ -166,7 +173,7 @@ public class ProvidentFundServicesController {
//得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
// Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:oracle:thin:@192.168.1.33:1596:zfgjj"
,
"gjj80"
,
"HG80_Y9E1C5"
);
//正式环境
Connection
connection
=
DriverManager
.
getConnection
(
PropertyqUtil
.
getPropValue
(
prop
,
"url"
),
PropertyqUtil
.
getPropValue
(
prop
,
"user"
),
PropertyqUtil
.
getPropValue
(
prop
,
"password"
)
);
//正式环境
//得到预编译的Statement对象
CallableStatement
pstm
=
connection
.
prepareCall
(
"{call JGJ_KSYW_DWKH.DWXX_IMP(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"
);
//调完第一个存储过程DWXX_IMP之后再调DWKH_SAVE存储过程
...
...
@@ -476,13 +483,14 @@ public class ProvidentFundServicesController {
@ResponseBody
@PostMapping
(
"zjbmfhywtosj"
)
public
static
List
<
BusinessProcessing
>
zjbmfhywtosj
()
throws
Exception
{
Properties
prop
=
PropertyqUtil
.
getConfig
(
"application.properties"
);
//1.调用oracle存储过程,拿到业务办理进度数据
//加载数据库驱动
Class
.
forName
(
"oracle.jdbc.driver.OracleDriver"
);
//得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
// Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:oracle:thin:@192.168.1.33:1596:zfgjj"
,
"gjj80"
,
"HG80_Y9E1C5"
);
//正式环境
Connection
connection
=
DriverManager
.
getConnection
(
PropertyqUtil
.
getPropValue
(
prop
,
"url"
),
PropertyqUtil
.
getPropValue
(
prop
,
"user"
),
PropertyqUtil
.
getPropValue
(
prop
,
"password"
)
);
//正式环境
//得到预编译的Statement对象
CallableStatement
pstm
=
connection
.
prepareCall
(
"{call JGJ_KSYW_DWKH.DWKH_CX(?)}"
);
//给参数赋值
...
...
@@ -545,13 +553,14 @@ public class ProvidentFundServicesController {
public
static
void
zjbmfhywtosjHX
(
String
uscc
,
Integer
value
)
throws
Exception
{
Properties
prop
=
PropertyqUtil
.
getConfig
(
"application.properties"
);
//1.调用oracle存储过程,拿到业务办理进度数据
//加载数据库驱动
Class
.
forName
(
"oracle.jdbc.driver.OracleDriver"
);
//得到Connection连接
// Connection connection= DriverManager.getConnection("jdbc:oracle:thin:@192.168.101.194:1521:zfgjj", "HG2020", "HG2020");//本地环境
// Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.36:1521:zfgjj", "GJJ80", "GJJ80");//测试环境
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:oracle:thin:@192.168.1.33:1596:zfgjj"
,
"gjj80"
,
"HG80_Y9E1C5"
);
//正式环境
Connection
connection
=
DriverManager
.
getConnection
(
PropertyqUtil
.
getPropValue
(
prop
,
"url"
),
PropertyqUtil
.
getPropValue
(
prop
,
"user"
),
PropertyqUtil
.
getPropValue
(
prop
,
"password"
)
);
//正式环境
//得到预编译的Statement对象
CallableStatement
pstm
=
connection
.
prepareCall
(
"{call JGJ_KSYW_DWKH.DWKH_HX(?,?)}"
);
//给参数赋值
...
...
src/main/java/net/cdkj/gjj/adapter/domain/PropertyqUtil.java
0 → 100644
View file @
846fd74d
package
net.cdkj.gjj.adapter.domain
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.Properties
;
/**
* 获取配置文件application.properties里的属性值所用到的工具类
*/
public
class
PropertyqUtil
{
/**
* 读取 classpath 下 指定的properties配置文件,加载到Properties并返回Properties
* @param name 配置文件名,如:mongo.properties
* @return
*/
public
static
Properties
getConfig
(
String
name
){
Properties
props
=
null
;
try
{
props
=
new
Properties
();
InputStream
in
=
PropertyqUtil
.
class
.
getClassLoader
().
getResourceAsStream
(
name
);
BufferedReader
bf
=
new
BufferedReader
(
new
InputStreamReader
(
in
));
props
.
load
(
bf
);
in
.
close
();
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
return
props
;
}
public
static
String
getPropValue
(
Properties
prop
,
String
key
){
if
(
key
==
null
||
""
.
equals
(
key
.
trim
())){
return
null
;
}
String
value
=
prop
.
getProperty
(
key
);
if
(
value
==
null
){
return
null
;
}
value
=
value
.
trim
();
//判断是否是环境变量配置属性,例如 server.env=${serverEnv:local}
if
(
value
.
startsWith
(
"${"
)
&&
value
.
endsWith
(
"}"
)
&&
value
.
contains
(
":"
)){
int
indexOfColon
=
value
.
indexOf
(
":"
);
String
envName
=
value
.
substring
(
2
,
indexOfColon
);
//获取系统环境变量 envName 的内容,如果没有找到,则返回defaultValue
String
envValue
=
System
.
getenv
(
envName
);
if
(
envValue
==
null
){
//配置的默认值
return
value
.
substring
(
indexOfColon
+
1
,
value
.
length
()-
1
);
}
return
envValue
;
}
return
value
;
}
}
src/main/resources/application.properties
0 → 100644
View file @
846fd74d
#查询日期类型(1表示正式环境,2表示测试环境或者表示本地环境)
#正式环境用的日期类型(取当天一天的时间)
timetype
:
1
#测试环境用的日期类型(配置固定日期)
#timetype:2
#测试环境用的起始时间
#startTime:20210520 00:00:00
#测试环境用的起始时间
#endTime:20210520 23:00:00
#数据库(正式环境)
url
:
jdbc:oracle:thin:@192.168.1.33:1596:zfgjj
user
:
gjj80
password
:
HG80_Y9E1C5
#数据库(测试环境)
#url:jdbc:oracle:thin:@192.168.1.36:1521:zfgjj
#user:GJJ80
#password:GJJ80
#数据库(本地环境)
#url:jdbc:oracle:thin:@192.168.101.194:1521:zfgjj
#user:HG2020
#password:HG2020
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment