Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
reyun
manager
Commits
b85d4d23
Commit
b85d4d23
authored
Jul 13, 2020
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同上传校验合同编号
parent
63cf5fa6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
7 deletions
+29
-7
pom.xml
pom.xml
+1
-1
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+3
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+18
-2
ResultModel.java
src/main/java/util/ResultModel.java
+4
-0
ResultStatus.java
src/main/java/util/ResultStatus.java
+3
-1
applicationContext.xml
src/main/resources/spring/applicationContext.xml
+0
-3
No files found.
pom.xml
View file @
b85d4d23
...
...
@@ -92,7 +92,7 @@
<profile>
<id>
test
</id>
<properties>
<label>
product
</label>
<label>
dev
</label>
<!--数据源配置-->
<datasource.driver>
com.mysql.jdbc.Driver
</datasource.driver>
<!--//office-->
...
...
src/main/java/common/repository/ContractRepository.java
View file @
b85d4d23
...
...
@@ -119,4 +119,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select contract_code from contract where customer_body =?1 and contract_code <> ?2 and status in ('backfirst','normal','late') limit 3 "
,
nativeQuery
=
true
)
List
<
String
>
findContractBodyNames
(
String
customerBody
,
String
contractCode
);
@Query
(
value
=
"select count(*) from contract where contract_code=?1 "
,
nativeQuery
=
true
)
int
checkByCode
(
String
code
);
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
b85d4d23
...
...
@@ -1341,7 +1341,6 @@ public class ContractServiceImpl implements ContractService {
}
// if (c.getType().equals(ContractTypeEnum.MAIN.getKey()) && platform.contains("io")) {
//
// } else if (c.getType().equals(ContractTypeEnum.MAIN.getKey())) {
...
...
@@ -2247,6 +2246,7 @@ public class ContractServiceImpl implements ContractService {
int
rowNumber
=
sheet
.
getLastRowNum
();
List
<
Object
[]>
args_data
=
new
ArrayList
<>();
Map
<
String
,
String
>
codeUniqueDic
=
new
HashMap
<>();
for
(
int
j
=
1
;
j
<=
rowNumber
;
j
++)
{
Row
row_data
=
sheet
.
getRow
(
j
);
Object
[]
s_data
=
new
Object
[
titleKey
.
size
()
+
extend_size
];
...
...
@@ -2261,9 +2261,25 @@ public class ContractServiceImpl implements ContractService {
Cell
cell
=
row_data
.
getCell
(
w
);
int
line_num
=
j
+
1
;
if
(
null
==
cell
||
cell
.
getCellTypeEnum
().
equals
(
CellType
.
BLANK
))
{
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行["
+
SHEET_TITLE_RESERVE
.
get
(
sheetTitle
)
+
"]不能为空"
);
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行["
+
SHEET_TITLE_RESERVE
.
get
(
sheetTitle
)
+
"]不能为空,请重新上传"
);
}
else
{
String
dataSTR
=
formatter
.
formatCellValue
(
cell
).
trim
();
//校验合同编号
if
(
"contract_code"
.
equals
(
sheetTitle
))
{
if
(!
codeUniqueDic
.
containsKey
(
dataSTR
))
{
codeUniqueDic
.
put
(
dataSTR
,
"1"
);
}
else
{
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
"合同编号["
+
dataSTR
+
"]已存在,请重新上传"
);
}
int
countCode
=
contractRepository
.
checkByCode
(
dataSTR
);
if
(
countCode
>
0
)
{
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
"合同编号["
+
dataSTR
+
"]已存在,请重新上传"
);
}
}
if
(
"my_body_name"
.
equals
(
sheetTitle
))
{
if
(!
cBodyMap
.
containsKey
(
dataSTR
))
{
...
...
src/main/java/util/ResultModel.java
View file @
b85d4d23
...
...
@@ -67,6 +67,10 @@ public class ResultModel {
return
new
ResultModel
(
errorMessage
);
}
public
static
ResultModel
ERROR
(
int
code
,
String
errorMessage
)
{
return
new
ResultModel
(
code
,
errorMessage
);
}
public
int
getCode
()
{
return
code
;
}
...
...
src/main/java/util/ResultStatus.java
View file @
b85d4d23
...
...
@@ -55,7 +55,9 @@ public enum ResultStatus {
EXP_INVALID
(
11000
,
"自定义表达式错误"
),
NONE_FILE_EXIST
(-
1000
,
"上传文件为空"
),
FORMAT_FILE_ERRO
(-
10001
,
"模板文件格式错误"
),
UPLOAD_CONTENT_ERRO
(-
10002
,
"模板文件内容错误"
);
UPLOAD_CONTENT_ERRO
(-
10002
,
"模板文件内容错误"
),
CCODE_EXITS
(-
10003
,
"合同编号已存在"
);
/**
...
...
src/main/resources/spring/applicationContext.xml
View file @
b85d4d23
...
...
@@ -45,15 +45,12 @@
<bean
id=
"parentDataSource"
class=
"com.alibaba.druid.pool.DruidDataSource"
destroy-method=
"close"
>
<property
name=
"driverClassName"
value=
"${dataSource.driverClassName}"
/>
<!-- 配置初始化大小、最小、最大 -->
<property
name=
"initialSize"
value=
"1"
/>
<property
name=
"minIdle"
value=
"1"
/>
<property
name=
"maxActive"
value=
"20"
/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property
name=
"timeBetweenEvictionRunsMillis"
value=
"60000"
/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property
name=
"minEvictableIdleTimeMillis"
value=
"300000"
/>
</bean>
...
...
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