Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
emport-api
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
刘泽志
emport-api
Commits
ab35a02c
Commit
ab35a02c
authored
Feb 15, 2023
by
刘泽志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
阶段版本问题修改
parent
c394e9c9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
26 deletions
+112
-26
DataImportController.java
...f/his/web/controller/dataImport/DataImportController.java
+12
-11
SysDatasourceController.java
...yf/his/web/controller/system/SysDatasourceController.java
+2
-2
DiConfig.java
.../main/java/com/tbyf/his/web/dataImport/core/DiConfig.java
+19
-7
DiConstants.java
...in/java/com/tbyf/his/web/dataImport/core/DiConstants.java
+8
-0
ExcelDataServiceImpl.java
...his/web/dataImport/service/impl/ExcelDataServiceImpl.java
+11
-5
application-zyy.yml
admin-api/src/main/resources/application-zyy.yml
+59
-0
logback.xml
admin-api/src/main/resources/logback.xml
+1
-1
No files found.
admin-api/src/main/java/com/tbyf/his/web/controller/dataImport/DataImportController.java
View file @
ab35a02c
...
@@ -127,7 +127,7 @@ public class DataImportController {
...
@@ -127,7 +127,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
(
"/templ
ate"
)
@P
ostMapping
(
"/template/upd
ate"
)
@ApiOperation
(
"修改模板"
)
@ApiOperation
(
"修改模板"
)
public
AjaxResult
updateTemplate
(
@RequestBody
@Validated
UpdateTemplateParam
param
)
{
public
AjaxResult
updateTemplate
(
@RequestBody
@Validated
UpdateTemplateParam
param
)
{
DataImportTemplate
template
=
new
DataImportTemplate
();
DataImportTemplate
template
=
new
DataImportTemplate
();
...
@@ -138,7 +138,7 @@ public class DataImportController {
...
@@ -138,7 +138,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"/templa
te"
)
@
GetMapping
(
"/template/dele
te"
)
@ApiOperation
(
"删除模板"
)
@ApiOperation
(
"删除模板"
)
public
AjaxResult
deleteTemplate
(
@RequestParam
String
templateId
)
{
public
AjaxResult
deleteTemplate
(
@RequestParam
String
templateId
)
{
dataImportService
.
removeById
(
templateId
);
dataImportService
.
removeById
(
templateId
);
...
@@ -193,7 +193,7 @@ public class DataImportController {
...
@@ -193,7 +193,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
(
"/dict
"
)
@P
ostMapping
(
"/dict/update
"
)
@ApiOperation
(
"修改字典"
)
@ApiOperation
(
"修改字典"
)
public
AjaxResult
updateDict
(
@RequestBody
@Validated
UpdateDictParam
param
)
{
public
AjaxResult
updateDict
(
@RequestBody
@Validated
UpdateDictParam
param
)
{
DataDict
template
=
new
DataDict
();
DataDict
template
=
new
DataDict
();
...
@@ -203,7 +203,7 @@ public class DataImportController {
...
@@ -203,7 +203,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"/dict
"
)
@
GetMapping
(
"/dict/delete
"
)
@ApiOperation
(
"删除字典"
)
@ApiOperation
(
"删除字典"
)
public
AjaxResult
deleteDict
(
@RequestParam
String
dictId
)
{
public
AjaxResult
deleteDict
(
@RequestParam
String
dictId
)
{
dictService
.
removeById
(
dictId
);
dictService
.
removeById
(
dictId
);
...
@@ -289,7 +289,7 @@ public class DataImportController {
...
@@ -289,7 +289,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
(
"/field
"
)
@P
ostMapping
(
"/field/update
"
)
@ApiOperation
(
"修改字段"
)
@ApiOperation
(
"修改字段"
)
public
AjaxResult
updateField
(
@RequestBody
@Validated
UpdateFieldParam
param
)
{
public
AjaxResult
updateField
(
@RequestBody
@Validated
UpdateFieldParam
param
)
{
DataField
field
=
new
DataField
();
DataField
field
=
new
DataField
();
...
@@ -299,7 +299,7 @@ public class DataImportController {
...
@@ -299,7 +299,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"/field
"
)
@
GetMapping
(
"/field/delete
"
)
@ApiOperation
(
"删除字段"
)
@ApiOperation
(
"删除字段"
)
public
AjaxResult
deleteField
(
@RequestParam
String
fieldId
)
{
public
AjaxResult
deleteField
(
@RequestParam
String
fieldId
)
{
dataFieldService
.
removeById
(
fieldId
);
dataFieldService
.
removeById
(
fieldId
);
...
@@ -341,7 +341,7 @@ public class DataImportController {
...
@@ -341,7 +341,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
(
"/rul
e"
)
@P
ostMapping
(
"/rule/updat
e"
)
@ApiOperation
(
"修改规则"
)
@ApiOperation
(
"修改规则"
)
public
AjaxResult
updateRule
(
@RequestBody
@Validated
UpdateRuleParam
param
)
{
public
AjaxResult
updateRule
(
@RequestBody
@Validated
UpdateRuleParam
param
)
{
DataRule
rule
=
new
DataRule
();
DataRule
rule
=
new
DataRule
();
...
@@ -351,7 +351,7 @@ public class DataImportController {
...
@@ -351,7 +351,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"/rul
e"
)
@
GetMapping
(
"/rule/delet
e"
)
@ApiOperation
(
"删除规则"
)
@ApiOperation
(
"删除规则"
)
public
AjaxResult
deleteRule
(
@RequestParam
String
ruleId
)
{
public
AjaxResult
deleteRule
(
@RequestParam
String
ruleId
)
{
dataRuleService
.
removeById
(
ruleId
);
dataRuleService
.
removeById
(
ruleId
);
...
@@ -534,7 +534,8 @@ public class DataImportController {
...
@@ -534,7 +534,8 @@ public class DataImportController {
dataField
.
setCode
(
code
);
dataField
.
setCode
(
code
);
dataField
.
setTitle
(
title
);
dataField
.
setTitle
(
title
);
dataField
.
setUnit
(
unit
);
dataField
.
setUnit
(
unit
);
dataField
.
setCoordinate
(
"F,"
+
i
);
// TODO 这里坐标修改为i+1是因为excel文件中展示的第一行号是1,符合直觉
dataField
.
setCoordinate
(
"F,"
+
(
i
+
1
));
dataField
.
setSort
(
i
+
1
);
dataField
.
setSort
(
i
+
1
);
dataField
.
createField
();
dataField
.
createField
();
fieldList
.
add
(
dataField
);
fieldList
.
add
(
dataField
);
...
@@ -758,7 +759,7 @@ public class DataImportController {
...
@@ -758,7 +759,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
(
"/rule/templ
ate"
)
@P
ostMapping
(
"/rule/template/upd
ate"
)
@ApiOperation
(
"修改规则By Template"
)
@ApiOperation
(
"修改规则By Template"
)
public
AjaxResult
updateRuleByTemplate
(
@RequestBody
@Validated
UpdateRuleParam
param
)
{
public
AjaxResult
updateRuleByTemplate
(
@RequestBody
@Validated
UpdateRuleParam
param
)
{
DataRule
rule
=
new
DataRule
();
DataRule
rule
=
new
DataRule
();
...
@@ -768,7 +769,7 @@ public class DataImportController {
...
@@ -768,7 +769,7 @@ public class DataImportController {
}
}
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"/rule/templa
te"
)
@
GetMapping
(
"/rule/template/dele
te"
)
@ApiOperation
(
"删除规则By Template"
)
@ApiOperation
(
"删除规则By Template"
)
public
AjaxResult
deleteRuleByTemplate
(
@RequestParam
String
ruleId
,
public
AjaxResult
deleteRuleByTemplate
(
@RequestParam
String
ruleId
,
@RequestParam
String
templateId
)
{
@RequestParam
String
templateId
)
{
...
...
admin-api/src/main/java/com/tbyf/his/web/controller/system/SysDatasourceController.java
View file @
ab35a02c
...
@@ -83,7 +83,7 @@ public class SysDatasourceController extends BaseController {
...
@@ -83,7 +83,7 @@ public class SysDatasourceController extends BaseController {
* 修改数据源配置
* 修改数据源配置
*/
*/
@IgnoreWebSecurity
@IgnoreWebSecurity
@P
utMapping
@P
ostMapping
(
"/update"
)
public
AjaxResult
edit
(
@RequestBody
SysDatasource
sysDatasource
)
{
public
AjaxResult
edit
(
@RequestBody
SysDatasource
sysDatasource
)
{
return
toAjax
(
sysDatasourceService
.
updateSysDatasource
(
sysDatasource
));
return
toAjax
(
sysDatasourceService
.
updateSysDatasource
(
sysDatasource
));
}
}
...
@@ -92,7 +92,7 @@ public class SysDatasourceController extends BaseController {
...
@@ -92,7 +92,7 @@ public class SysDatasourceController extends BaseController {
* 删除数据源配置
* 删除数据源配置
*/
*/
@IgnoreWebSecurity
@IgnoreWebSecurity
@
DeleteMapping
(
"
/{datasourceIds}"
)
@
GetMapping
(
"/delete
/{datasourceIds}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
datasourceIds
)
{
public
AjaxResult
remove
(
@PathVariable
Long
[]
datasourceIds
)
{
return
toAjax
(
sysDatasourceService
.
deleteSysDatasourceByDatasourceIds
(
datasourceIds
));
return
toAjax
(
sysDatasourceService
.
deleteSysDatasourceByDatasourceIds
(
datasourceIds
));
}
}
...
...
admin-api/src/main/java/com/tbyf/his/web/dataImport/core/DiConfig.java
View file @
ab35a02c
...
@@ -11,7 +11,9 @@ import org.springframework.context.annotation.Configuration;
...
@@ -11,7 +11,9 @@ import org.springframework.context.annotation.Configuration;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -50,7 +52,7 @@ public class DiConfig {
...
@@ -50,7 +52,7 @@ public class DiConfig {
flag
++;
flag
++;
}
else
if
(
flag
==
1
&&
StringUtils
.
equals
(
getValue
(
cell
),
vo
.
getTitle
()))
{
}
else
if
(
flag
==
1
&&
StringUtils
.
equals
(
getValue
(
cell
),
vo
.
getTitle
()))
{
// 代表code与title都能对应上
// 代表code与title都能对应上
return
getWord
(
cell
.
getColumnIndex
()
+
1
)
+
","
+
cell
.
getRowIndex
();
return
getWord
(
cell
.
getColumnIndex
()
+
1
)
+
","
+
cell
.
getRowIndex
()
+
1
;
}
}
}
}
}
}
...
@@ -58,22 +60,32 @@ public class DiConfig {
...
@@ -58,22 +60,32 @@ public class DiConfig {
}
}
/**
/**
* 获取
数据长度
* 获取
横坐标数据结果,直接获取columnIndex
*
*
* @param vo
* @param vo
* @param sheet
* @param sheet
* @return
* @return
*/
*/
public
static
int
getLength
(
VerifyVO
vo
,
Sheet
sheet
)
{
public
static
List
<
Integer
>
getLength
(
VerifyVO
vo
,
Sheet
sheet
)
{
final
String
[]
coords
=
vo
.
getCoordinate
().
split
(
","
);
final
String
[]
coords
=
vo
.
getCoordinate
().
split
(
","
);
int
start
=
DiConfig
.
getIndex
(
coords
[
0
]);
int
start
=
DiConfig
.
getIndex
(
coords
[
0
]);
Row
row
=
sheet
.
getRow
(
Integer
.
parseInt
(
coords
[
1
]));
Row
row
=
sheet
.
getRow
(
Integer
.
parseInt
(
coords
[
1
])
-
1
);
for
(
int
i
=
start
;
;
i
++)
{
List
<
Integer
>
list
=
new
ArrayList
<>();
// 空值出现次数,出现次数大于2的时候停止循环
int
flag
=
0
;
for
(
int
i
=
start
;
flag
<=
2
;
i
++)
{
final
Cell
cell
=
row
.
getCell
(
i
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
final
Cell
cell
=
row
.
getCell
(
i
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
if
(
StringUtils
.
isBlank
(
getValue
(
cell
)))
{
final
String
value
=
getValue
(
cell
);
return
i
-
start
;
if
(
StringUtils
.
isBlank
(
value
))
{
flag
++;
}
else
if
(
StringUtils
.
equals
(
value
,
"-"
))
{
flag
=
0
;
}
else
{
flag
=
0
;
list
.
add
(
cell
.
getColumnIndex
());
}
}
}
}
return
list
;
}
}
@PostConstruct
@PostConstruct
...
...
admin-api/src/main/java/com/tbyf/his/web/dataImport/core/DiConstants.java
View file @
ab35a02c
package
com
.
tbyf
.
his
.
web
.
dataImport
.
core
;
package
com
.
tbyf
.
his
.
web
.
dataImport
.
core
;
import
java.util.Arrays
;
import
java.util.List
;
/**
/**
* DataImport常量
* DataImport常量
*
*
...
@@ -64,4 +67,9 @@ public class DiConstants {
...
@@ -64,4 +67,9 @@ public class DiConstants {
*/
*/
public
static
final
String
RULE_COMBINE
=
"组合规则"
;
public
static
final
String
RULE_COMBINE
=
"组合规则"
;
/**
* 默认不处理的数据
*/
public
static
final
List
<
String
>
WHITE
=
Arrays
.
asList
(
"-"
);
}
}
admin-api/src/main/java/com/tbyf/his/web/dataImport/service/impl/ExcelDataServiceImpl.java
View file @
ab35a02c
...
@@ -8,6 +8,7 @@ import com.tbyf.his.common.utils.StringUtils;
...
@@ -8,6 +8,7 @@ import com.tbyf.his.common.utils.StringUtils;
import
com.tbyf.his.common.utils.poi.ExcelUtil
;
import
com.tbyf.his.common.utils.poi.ExcelUtil
;
import
com.tbyf.his.framework.datasource.DataSourceUtil
;
import
com.tbyf.his.framework.datasource.DataSourceUtil
;
import
com.tbyf.his.web.dataImport.core.DiConfig
;
import
com.tbyf.his.web.dataImport.core.DiConfig
;
import
com.tbyf.his.web.dataImport.core.DiConstants
;
import
com.tbyf.his.web.dataImport.core.RuleVO
;
import
com.tbyf.his.web.dataImport.core.RuleVO
;
import
com.tbyf.his.web.dataImport.core.RuleValidator
;
import
com.tbyf.his.web.dataImport.core.RuleValidator
;
import
com.tbyf.his.web.dataImport.domain.vo.ExcelVO
;
import
com.tbyf.his.web.dataImport.domain.vo.ExcelVO
;
...
@@ -64,7 +65,8 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
...
@@ -64,7 +65,8 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
.
filter
(
item
->
StringUtils
.
isNotBlank
(
item
.
getCoordinate
()))
.
filter
(
item
->
StringUtils
.
isNotBlank
(
item
.
getCoordinate
()))
.
findFirst
();
.
findFirst
();
// 数据长度/条数
// 数据长度/条数
final
int
length
=
DiConfig
.
getLength
(
first
.
get
(),
sheet
);
final
List
<
Integer
>
columnList
=
DiConfig
.
getLength
(
first
.
get
(),
sheet
);
final
int
length
=
columnList
.
size
();
// 第一步解析数据到values
// 第一步解析数据到values
for
(
int
a
=
0
;
a
<
verifyList
.
size
();
a
++)
{
for
(
int
a
=
0
;
a
<
verifyList
.
size
();
a
++)
{
final
VerifyVO
vo
=
verifyList
.
get
(
a
);
final
VerifyVO
vo
=
verifyList
.
get
(
a
);
...
@@ -77,12 +79,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
...
@@ -77,12 +79,12 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
vo
.
setCoordinate
(
s
);
vo
.
setCoordinate
(
s
);
}
}
final
String
[]
coords
=
vo
.
getCoordinate
().
split
(
","
);
final
String
[]
coords
=
vo
.
getCoordinate
().
split
(
","
);
int
columnStart
=
DiConfig
.
getIndex
(
coords
[
0
]);
// TODO 这里减1的原因是excel表名的行号1实际上的下标为0
int
rowStart
=
Integer
.
parseInt
(
coords
[
1
]);
int
rowStart
=
Integer
.
parseInt
(
coords
[
1
])
-
1
;
final
Row
row
=
sheet
.
getRow
(
rowStart
);
final
Row
row
=
sheet
.
getRow
(
rowStart
);
for
(
int
b
=
columnStart
;
b
<
columnStart
+
length
;
b
++
)
{
for
(
Integer
column
:
columnList
)
{
try
{
try
{
final
Cell
cell
=
row
.
getCell
(
b
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
final
Cell
cell
=
row
.
getCell
(
column
,
Row
.
MissingCellPolicy
.
RETURN_BLANK_AS_NULL
);
vo
.
addValue
(
DiConfig
.
getValue
(
cell
));
vo
.
addValue
(
DiConfig
.
getValue
(
cell
));
}
catch
(
Exception
ignore
)
{
}
catch
(
Exception
ignore
)
{
}
}
...
@@ -118,6 +120,10 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
...
@@ -118,6 +120,10 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
vo
.
setValue
(
item
.
getValues
().
get
(
i
));
vo
.
setValue
(
item
.
getValues
().
get
(
i
));
// 置空错误信息
// 置空错误信息
vo
.
setResult
(
null
);
vo
.
setResult
(
null
);
// TODO 特殊数据无需做错误校验
if
(
DiConstants
.
WHITE
.
contains
(
vo
.
getValue
()))
{
break
;
}
final
RuleValidator
validator
=
DiConfig
.
getValidator
(
vo
.
getMode
());
final
RuleValidator
validator
=
DiConfig
.
getValidator
(
vo
.
getMode
());
validator
.
validate
(
vo
);
validator
.
validate
(
vo
);
if
(
StringUtils
.
isNotBlank
(
vo
.
getResult
()))
{
if
(
StringUtils
.
isNotBlank
(
vo
.
getResult
()))
{
...
...
admin-api/src/main/resources/application-zyy.yml
0 → 100644
View file @
ab35a02c
# 数据源配置
spring
:
datasource
:
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://10.18.103.101:3306/his_base?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
esb@123456
driverClassName
:
com.mysql.cj.jdbc.Driver
# 从库数据源
slave
:
# 从数据源开关/默认关闭
enabled
:
true
# url: jdbc:oracle:thin:@192.168.0.39:1521:orcl
url
:
jdbc:oracle:thin:@10.18.103.111:1521:ORCL
# username: xhyy
username
:
DATACENTER
password
:
data
driverClassName
:
oracle.jdbc.OracleDriver
# 初始连接数
initialSize
:
5
# 最小连接池数量
minIdle
:
10
# 最大连接池数量
maxActive
:
20
# 配置获取连接等待超时的时间
maxWait
:
60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis
:
60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis
:
300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis
:
900000
# 配置检测连接是否有效
validationQuery
:
SELECT 1 FROM DUAL
testWhileIdle
:
true
testOnBorrow
:
false
testOnReturn
:
false
webStatFilter
:
enabled
:
true
statViewServlet
:
enabled
:
true
# 设置白名单,不填则允许所有访问
allow
:
url-pattern
:
/druid/*
# 控制台管理用户名和密码
login-username
:
admin
login-password
:
123456
filter
:
stat
:
enabled
:
true
# 慢SQL记录
log-slow-sql
:
true
slow-sql-millis
:
1000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
admin-api/src/main/resources/logback.xml
View file @
ab35a02c
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configuration>
<!-- 日志存放路径 -->
<!-- 日志存放路径 -->
<property
name=
"log.path"
value=
"
C:/his
/logs"
/>
<property
name=
"log.path"
value=
"
.
/logs"
/>
<!-- 日志输出格式 -->
<!-- 日志输出格式 -->
<property
name=
"log.pattern"
value=
"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
<property
name=
"log.pattern"
value=
"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"
/>
<!-- 引入spring boot默认的logback配置文件,使用CONSOLE_LOG_PATTERN就可以打印默认的彩色日志-->
<!-- 引入spring boot默认的logback配置文件,使用CONSOLE_LOG_PATTERN就可以打印默认的彩色日志-->
...
...
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