Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-hook
gic-cloud
Commits
b00e96d7
Commit
b00e96d7
authored
Nov 16, 2022
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!58
parents
92a6d7bd
e6dffe24
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
116 additions
and
13 deletions
+116
-13
.flattened-pom.xml
gic-cloud-data-hook-api/.flattened-pom.xml
+4
-4
DecryptUtils.java
...in/java/com/gic/cloud/data/hook/service/DecryptUtils.java
+29
-0
CsvResultSetHelper.java
...ic/cloud/data/hook/service/entity/CsvResultSetHelper.java
+3
-3
DownloadTaskServiceImpl.java
...cloud/data/hook/service/impl/DownloadTaskServiceImpl.java
+1
-1
FlatQueryResultServiceImpl.java
...ud/data/hook/service/impl/FlatQueryResultServiceImpl.java
+6
-4
FreeQueryServiceImpl.java
...ic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
+1
-0
DownloadTaskDao.xml
...ook-service/src/main/resources/mapper/DownloadTaskDao.xml
+2
-1
ExceTest2.java
gic-cloud-data-hook-service/src/test/java/ExceTest2.java
+18
-0
ExcelTest.java
gic-cloud-data-hook-service/src/test/java/ExcelTest.java
+52
-0
No files found.
gic-cloud-data-hook-api/.flattened-pom.xml
View file @
b00e96d7
...
...
@@ -4,12 +4,12 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.gic
</groupId>
<artifactId>
gic-cloud-data-hook-api
</artifactId>
<version>
3.0-SNAPSHOT
</version>
<version>
2.40
</version>
<dependencies>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-cloud-web-service-api
</artifactId>
<version>
3.
0-SNAPSHOT
</version>
<version>
3.
80
</version>
<scope>
compile
</scope>
<exclusions>
<exclusion>
...
...
@@ -25,7 +25,7 @@
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-cloud-commons
</artifactId>
<version>
3.
0-SNAPSHOT
</version>
<version>
3.
64
</version>
<scope>
compile
</scope>
<exclusions>
<exclusion>
...
...
@@ -41,7 +41,7 @@
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-platform-config
</artifactId>
<version>
3.0-SNAPSHOT
</version>
<version>
2.26
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/DecryptUtils.java
View file @
b00e96d7
package
com
.
gic
.
cloud
.
data
.
hook
.
service
;
import
com.alibaba.dubbo.common.utils.StringUtils
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigService
;
import
com.gic.cloud.data.hook.api.entity.FlatQueryCondition
;
import
com.gic.cloud.data.hook.service.impl.FreeQueryServiceImpl
;
import
com.gic.data.shield.SdkEnv
;
...
...
@@ -50,6 +52,14 @@ public class DecryptUtils {
}
}
public
static
String
decrypt
(
String
enterpriseId
,
String
encryptString
)
{
if
(
DecryptUtils
.
checkDecrypt
(
enterpriseId
)){
return
DecryptUtils
.
decrypt
(
encryptString
);
}
else
{
return
encryptString
;
}
}
public
static
String
dataSecurityProcessUserName
(
String
userName
){
if
(
StringUtils
.
isBlank
(
userName
)){
return
userName
;
...
...
@@ -73,4 +83,23 @@ public class DecryptUtils {
return
false
;
}
/**
* 是否需要解密
* @param enterpriseId
* @return
*/
public
static
boolean
checkDecrypt
(
String
enterpriseId
)
{
Config
appConfig
=
ConfigService
.
getAppConfig
();
String
entIds
=
appConfig
.
getProperty
(
"decrypt-enterprise"
,
"1"
);
if
(
entIds
.
equals
(
"-1"
))
{
return
false
;
}
else
if
(
entIds
.
equals
(
"1"
))
{
return
true
;
}
else
if
(
entIds
.
contains
(
enterpriseId
))
{
return
false
;
}
else
{
return
true
;
}
}
}
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/entity/CsvResultSetHelper.java
View file @
b00e96d7
...
...
@@ -169,14 +169,14 @@ public class CsvResultSetHelper implements ResultSetHelper {
// 数据处理
if
(
doDesensi
)
{
// 如果需要脱敏处理
if
(
allFields
!=
null
&&
isName
(
columnName
)){
result
.
add
(
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
resultSet
.
getString
(
columnName
))));
result
.
add
(
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
enterpriseId
,
resultSet
.
getString
(
columnName
))));
}
else
if
(
allFields
==
null
&&
FilterFieldUtils
.
FILETERS_USER_NAME
.
contains
(
columnName
))
{
result
.
add
(
DecryptUtils
.
dataSecurityProcessUserName
(
resultSet
.
getString
(
i
+
1
)));
}
else
{
result
.
add
(
"******"
);
if
(
needDecryptByEnt
&&
isPhoneNumber
(
columnName
)){
//导出数据中需要增加加密列,先解密再加密
String
value
=
DecryptUtils
.
getInstance
().
decrypt
(
resultSet
.
getString
(
i
+
1
));
String
value
=
DecryptUtils
.
getInstance
().
decrypt
(
enterpriseId
,
resultSet
.
getString
(
i
+
1
));
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotBlank
(
value
)){
byte
[]
bytes
=
rsa
.
encrypt
(
StrUtil
.
bytes
(
value
,
CharsetUtil
.
UTF_8
),
KeyType
.
PublicKey
);
String
encode
=
Base64
.
encode
(
bytes
);
...
...
@@ -190,7 +190,7 @@ public class CsvResultSetHelper implements ResultSetHelper {
String
tmpResult
=
resultSet
.
getString
(
i
+
1
);
if
(
tmpResult
!=
null
&&
tmpResult
.
length
()
>
0
)
{
//tmpResult = DecryptUtils.getInstance().decrypt(tmpResult);
tmpResult
=
DecryptUtils
.
getInstance
().
decrypt
(
tmpResult
);
tmpResult
=
DecryptUtils
.
getInstance
().
decrypt
(
enterpriseId
,
tmpResult
);
if
(
tmpResult
.
startsWith
(
"0"
)){
tmpResult
=
tmpResult
+
"\t"
;
}
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/DownloadTaskServiceImpl.java
View file @
b00e96d7
...
...
@@ -160,7 +160,7 @@ public class DownloadTaskServiceImpl implements IDownloadTaskService {
public
void
run
()
{
Calendar
calc
=
Calendar
.
getInstance
();
//calc.add(Calendar.DATE, -1);
calc
.
add
(
Calendar
.
HOUR
,
-
12
);
// 从一天改为 12 小时
calc
.
add
(
Calendar
.
HOUR
,
-
48
);
// 从一天改为 12 小时
Date
expireDate
=
calc
.
getTime
();
List
<
DownloadTask
>
expiredTasks
=
downloadTaskDao
.
getExpiredDownloadTaskList
(
expireDate
);
if
(
expiredTasks
.
size
()
>
0
)
{
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FlatQueryResultServiceImpl.java
View file @
b00e96d7
...
...
@@ -241,6 +241,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
log
.
debug
(
"getFlatQueryResult"
,
"自助指标查询来自 "
+
enterpriseIds
.
get
(
0
));
// 定义返回值
FlatQueryResult
result
=
new
FlatQueryResult
();
String
enterpriseId
=
enterpriseIds
.
get
(
0
);
// 定义查询语句
String
queryFull
=
this
.
buildFlatQuerySQL
(
true
,
// 查询用途
...
...
@@ -324,11 +325,11 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
if
(
queryDataType
==
QueryDataType
.
FULL
){
String
preResult
=
rs
.
getString
(
fieldColumnIndex
);
if
(
dataPermission
==
1
&&
FilterFieldUtils
.
FILTERS_PHONE_ONLY
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
decrypt
(
preResult
);
fieldResult
=
DecryptUtils
.
decrypt
(
enterpriseId
,
preResult
);
}
else
if
(
dataPermission
==
2
&&
FilterFieldUtils
.
FILTERS_PHONE_AND_CARD
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
decrypt
(
preResult
);
fieldResult
=
DecryptUtils
.
decrypt
(
enterpriseId
,
preResult
);
}
else
if
(
FilterFieldUtils
.
FILETERS_USER_NAME
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
decrypt
(
preResult
);
fieldResult
=
DecryptUtils
.
decrypt
(
enterpriseId
,
preResult
);
}
else
fieldResult
=
rs
.
getObject
(
fieldColumnIndex
);
}
else
{
if
(
dataPermission
==
1
&&
FilterFieldUtils
.
FILTERS_PHONE_ONLY
.
contains
(
fieldName
)){
...
...
@@ -336,7 +337,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
else
if
(
dataPermission
==
2
&&
FilterFieldUtils
.
FILTERS_PHONE_AND_CARD
.
contains
(
fieldName
)){
fieldResult
=
"******"
;
}
else
if
(
FilterFieldUtils
.
FILETERS_USER_NAME
.
contains
(
fieldName
)){
fieldResult
=
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
rs
.
getObject
(
fieldColumnIndex
)+
""
));
fieldResult
=
DecryptUtils
.
dataSecurityProcessUserName
(
DecryptUtils
.
decrypt
(
enterpriseId
,
rs
.
getObject
(
fieldColumnIndex
)+
""
));
}
else
fieldResult
=
rs
.
getObject
(
fieldColumnIndex
);
}
...
...
@@ -1097,6 +1098,7 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
}
else
if
(
applyStatusText
.
indexOf
(
"\"checkStatus\":1"
)
>
0
)
{
// 如果审核超时
task
.
setApplyStatus
(
DownloadApplyStatus
.
TIMEOUT
);
task
.
setApplyPermitted
(
Global
.
NO
);
task
.
setOverTime
(
new
Date
());
conditionRemove
=
true
;
}
if
(
conditionRemove
||
conditionUpdate
)
{
...
...
gic-cloud-data-hook-service/src/main/java/com/gic/cloud/data/hook/service/impl/FreeQueryServiceImpl.java
View file @
b00e96d7
...
...
@@ -750,6 +750,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
conditionUpdate
=
true
;
}
else
if
(
applyStatusText
.
indexOf
(
"\"checkStatus\":1"
)
>
0
)
{
// 如果审核超时
task
.
setApplyStatus
(
DownloadApplyStatus
.
TIMEOUT
);
task
.
setOverTime
(
new
Date
());
task
.
setApplyPermitted
(
Global
.
NO
);
conditionRemove
=
true
;
}
...
...
gic-cloud-data-hook-service/src/main/resources/mapper/DownloadTaskDao.xml
View file @
b00e96d7
...
...
@@ -198,7 +198,8 @@
<update
id=
"updateTaskStatusError"
>
UPDATE
<include
refid=
"updateTable"
/>
SET
status = 'error'
status = 'error',
over_time=now()
WHERE
id in
<foreach
collection=
"idList"
item=
"item"
open=
"("
close=
")"
separator=
","
>
...
...
gic-cloud-data-hook-service/src/test/java/ExceTest2.java
0 → 100644
View file @
b00e96d7
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
java.io.FileOutputStream
;
import
java.util.Date
;
public
class
ExceTest2
{
public
static
void
main
(
String
[]
args
)
{
int
n
=
25
;
int
c
=
100
;
Double
aDouble
=
Double
.
valueOf
((
double
)
n
/
c
);
System
.
out
.
println
(
aDouble
);
}
}
gic-cloud-data-hook-service/src/test/java/ExcelTest.java
0 → 100644
View file @
b00e96d7
import
org.apache.poi.hssf.usermodel.HSSFCellStyle
;
import
org.apache.poi.hssf.usermodel.HSSFDataFormat
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
java.io.FileOutputStream
;
import
java.util.Date
;
public
class
ExcelTest
{
public
static
void
main
(
String
[]
args
)
{
try
{
// String originalFilePath = SAVE_FOLDER + "/" + condition.getTaskId() + ".xlsx";
SXSSFWorkbook
wb
=
new
SXSSFWorkbook
(
100
);
// 内存中保留 100 行
Sheet
sheet
=
wb
.
createSheet
();
CellStyle
cellStyle
=
wb
.
createCellStyle
();
DataFormat
format
=
wb
.
createDataFormat
();
cellStyle
.
setDataFormat
(
format
.
getFormat
(
"yyyy-MM-dd HH:mm:ss"
));
// CellStyle cellStyle = wb.createCellStyle();
// DataFormat format = wb.createDataFormat();
// cellStyle.setDataFormat(format.getFormat("yyyy-MM-dd HH:mm:ss"));
int
n
=
0
;
do
{
Row
row
=
sheet
.
createRow
(
n
);
{
Cell
midCell
=
row
.
createCell
(
0
);
midCell
.
setCellStyle
(
cellStyle
);
midCell
.
setCellValue
(
new
Date
());
}
{
Cell
midCell
=
row
.
createCell
(
1
);
// midCell.setCellStyle(cellStyle);
midCell
.
setCellValue
(
Math
.
random
());
}
}
while
(
n
++<
10
);
FileOutputStream
fileOut
=
new
FileOutputStream
(
"d://test.xlsx"
);
wb
.
write
(
fileOut
);
//fileOut.flush(); // SXSSFWorkbook 使用 auto-flush 模式
fileOut
.
close
();
//wb.close();
wb
.
dispose
();
// SXSSFWorkbook 没有 close 方法
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
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