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
a4666868
Commit
a4666868
authored
Mar 16, 2020
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同导入
parent
6f9126b4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
161 additions
and
20 deletions
+161
-20
workspace.xml
.idea/workspace.xml
+0
-0
manage.iml
manage.iml
+15
-0
pom.xml
pom.xml
+16
-13
ContractController.java
src/main/java/common/controller/ContractController.java
+0
-0
ContractService.java
src/main/java/common/service/ContractService.java
+5
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+117
-5
ResultStatus.java
src/main/java/util/ResultStatus.java
+5
-2
applicationContext.xml
src/main/resources/spring/applicationContext.xml
+3
-0
No files found.
.idea/workspace.xml
View file @
a4666868
This diff is collapsed.
Click to expand it.
manage.iml
View file @
a4666868
...
@@ -14,6 +14,21 @@
...
@@ -14,6 +14,21 @@
<facet
type=
"Spring"
name=
"Spring"
>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration
/>
<configuration
/>
</facet>
</facet>
<facet
type=
"jpa"
name=
"JPA"
>
<configuration>
<setting
name=
"validation-enabled"
value=
"true"
/>
<setting
name=
"provider-name"
value=
"Hibernate"
/>
<datasource-mapping>
<factory-entry
name=
"defaultUnit"
/>
<factory-entry
name=
"dmpUnit"
/>
<factory-entry
name=
"ioUnit"
/>
<factory-entry
name=
"officeUnit"
/>
<factory-entry
name=
"tkioUnit"
/>
<factory-entry
name=
"tkrackUnit"
/>
</datasource-mapping>
<naming-strategy-map
/>
</configuration>
</facet>
</component>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
...
...
pom.xml
View file @
a4666868
...
@@ -94,19 +94,22 @@
...
@@ -94,19 +94,22 @@
<label>
product
</label>
<label>
product
</label>
<!--数据源配置-->
<!--数据源配置-->
<datasource.driver>
com.mysql.jdbc.Driver
</datasource.driver>
<datasource.driver>
com.mysql.jdbc.Driver
</datasource.driver>
<default.datasource.url>
jdbc:mysql://10.3.20.32:3306/manager?characterEncoding=utf-8
<!--//office-->
<default.datasource.url>
jdbc:mysql://10.3.20.32:3306/manager?characterEncoding=utf-8
</default.datasource.url>
</default.datasource.url>
<default.datasource.username>
root
</default.datasource.username>
<default.datasource.username>
root
</default.datasource.username>
<default.datasource.password>
reyun.123
</default.datasource.password>
<default.datasource.password>
reyun.123
</default.datasource.password>
<tkio.url>
jdbc:mysql://10.3.20.32:3306/trackingio_test?characterEncoding=utf-8
</tkio.url>
<tkio.username>
root
</tkio.username>
<tkio.password>
reyun.123
</tkio.password>
<office.url>
jdbc:mysql://10.3.20.32:3306/office?characterEncoding=utf-8
</office.url>
<office.url>
jdbc:mysql://10.3.20.32:3306/office?characterEncoding=utf-8
</office.url>
<office.username>
root
</office.username>
<office.username>
root
</office.username>
<office.password>
reyun.123
</office.password>
<office.password>
reyun.123
</office.password>
<tkio.url>
jdbc:mysql://10.3.20.32:3306/trackingio_trans?characterEncoding=utf-8
</tkio.url>
<tkio.username>
root
</tkio.username>
<tkio.password>
reyun.123
</tkio.password>
<track.url>
jdbc:mysql://10.3.20.32:3306/track_test?characterEncoding=utf-8
</track.url>
<track.url>
jdbc:mysql://10.3.20.32:3306/track_test?characterEncoding=utf-8
</track.url>
<track.username>
root
</track.username>
<track.username>
root
</track.username>
<track.password>
reyun.123
</track.password>
<track.password>
reyun.123
</track.password>
...
@@ -129,8 +132,11 @@
...
@@ -129,8 +132,11 @@
<!-- 单位是分钟-->
<!-- 单位是分钟-->
<mail.valid_time>
3
</mail.valid_time>
<mail.valid_time>
3
</mail.valid_time>
<!--<report.url>http://localhost:9010</report.url>-->
<!--<report.url>http://localhost:9010</report.url>-->
<report.url>
http://10.3.20.41:11010
</report.url>
<report.url>
http://10.3.20.41:11010
</report.url>
<contract.uppath></contract.uppath>
<!--Redis setting-->
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
@@ -174,19 +180,17 @@
...
@@ -174,19 +180,17 @@
</default.datasource.url>
</default.datasource.url>
<default.datasource.username>
trackingio
</default.datasource.username>
<default.datasource.username>
trackingio
</default.datasource.username>
<default.datasource.password>
trackingio
</default.datasource.password>
<default.datasource.password>
trackingio
</default.datasource.password>
<office.url>
jdbc:mysql://track.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/office?characterEncoding=utf-8
</office.url>
<office.username>
office
</office.username>
<office.password>
office
</office.password>
<tkio.url>
<tkio.url>
jdbc:mysql://tkio.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/trackingio?characterEncoding=utf-8
jdbc:mysql://tkio.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/trackingio?characterEncoding=utf-8
</tkio.url>
</tkio.url>
<tkio.username>
trackingio
</tkio.username>
<tkio.username>
trackingio
</tkio.username>
<tkio.password>
trackingio
</tkio.password>
<tkio.password>
trackingio
</tkio.password>
<office.url>
jdbc:mysql://track.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/office?characterEncoding=utf-8
</office.url>
<office.username>
office
</office.username>
<office.password>
office
</office.password>
<track.url>
<track.url>
jdbc:mysql://track.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/track?characterEncoding=utf-8
jdbc:mysql://track.cma5jkozme68.rds.cn-north-1.amazonaws.com.cn:3306/track?characterEncoding=utf-8
...
@@ -217,7 +221,6 @@
...
@@ -217,7 +221,6 @@
<mail.valid_time>
3
</mail.valid_time>
<mail.valid_time>
3
</mail.valid_time>
<report.url>
http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn
</report.url>
<report.url>
http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn
</report.url>
<!--Redis setting-->
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
...
src/main/java/common/controller/ContractController.java
View file @
a4666868
This diff is collapsed.
Click to expand it.
src/main/java/common/service/ContractService.java
View file @
a4666868
package
common
.
service
;
package
common
.
service
;
import
common.model.*
;
import
common.model.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
util.ResultModel
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -72,4 +74,6 @@ public interface ContractService {
...
@@ -72,4 +74,6 @@ public interface ContractService {
Contract
findOne
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
);
Contract
findOne
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
);
List
<
ContractMoney
>
findPayAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
moneyType
,
String
packageType
,
String
money_ids
);
List
<
ContractMoney
>
findPayAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
moneyType
,
String
packageType
,
String
money_ids
);
ResultModel
uploadBatchInfo
(
MultipartFile
file
,
String
platform
);
}
}
\ No newline at end of file
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
a4666868
...
@@ -11,10 +11,13 @@ import dic.ContractStatusEnum;
...
@@ -11,10 +11,13 @@ import dic.ContractStatusEnum;
import
dic.ContractTypeEnum
;
import
dic.ContractTypeEnum
;
import
dic.RoleEnum
;
import
dic.RoleEnum
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONArray
;
import
org.apache.poi.ss.usermodel.*
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
tkio.model.Account
;
import
tkio.model.Account
;
import
tkio.model.IncrementFlow
;
import
tkio.model.IncrementFlow
;
import
tkio.model.PackageType
;
import
tkio.model.PackageType
;
...
@@ -26,11 +29,13 @@ import tkio.service.TkioAccountService;
...
@@ -26,11 +29,13 @@ import tkio.service.TkioAccountService;
import
userio.service.AccountIOService
;
import
userio.service.AccountIOService
;
import
userio.service.IOAccountService
;
import
userio.service.IOAccountService
;
import
util.*
;
import
util.*
;
import
util.DateUtil
;
import
java.beans.BeanInfo
;
import
java.beans.BeanInfo
;
import
java.beans.IntrospectionException
;
import
java.beans.IntrospectionException
;
import
java.beans.Introspector
;
import
java.beans.Introspector
;
import
java.beans.PropertyDescriptor
;
import
java.beans.PropertyDescriptor
;
import
java.io.InputStream
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -59,6 +64,16 @@ public class ContractServiceImpl implements ContractService {
...
@@ -59,6 +64,16 @@ public class ContractServiceImpl implements ContractService {
put
(
"4"
,
"合同管理"
);
put
(
"4"
,
"合同管理"
);
}};
}};
public
static
final
String
UPLOAD_TITLE
=
"我方签约主体,客户签约主体,行业分类,合同开始日期,合同结束日期,"
+
"签约销售,客户主账号,合同编号,签约类型,套餐,合同金额"
;
public
static
final
Map
<
String
,
String
>
SHEET_NAMES
=
new
HashMap
()
{{
put
(
"TrackingIO"
,
"tkio"
);
put
(
"DMP"
,
"dmp"
);
put
(
"防作弊卫士"
,
"fake"
);
put
(
"ADI"
,
"adi"
);
}};
@Autowired
@Autowired
ContractRepository
contractRepository
;
ContractRepository
contractRepository
;
@Autowired
@Autowired
...
@@ -125,6 +140,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -125,6 +140,9 @@ public class ContractServiceImpl implements ContractService {
@Autowired
@Autowired
AuthService
authService
;
AuthService
authService
;
@Autowired
JdbcTemplate
jdbcTemplate
;
@Override
@Override
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
...
@@ -1811,14 +1829,14 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1811,14 +1829,14 @@ public class ContractServiceImpl implements ContractService {
if
(
RoleEnum
.
FINANCE
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
if
(
RoleEnum
.
FINANCE
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
1
);
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
1
);
}
else
if
(
RoleEnum
.
SALSEMAN
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
}
else
if
(
RoleEnum
.
SALSEMAN
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
2
);
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
2
);
}
else
if
(
RoleEnum
.
PM
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
}
else
if
(
RoleEnum
.
PM
.
getKey
().
equals
(
loginAccount
.
getRole
()))
{
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
3
);
list
=
filterContractMoney
(
codesList
,
authdata
,
list
,
3
);
}
}
}
}
...
@@ -1863,17 +1881,16 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1863,17 +1881,16 @@ public class ContractServiceImpl implements ContractService {
collect
(
Collectors
.
toMap
(
p
->
p
[
0
].
toString
(),
p
->
p
[
nextIndex
]
==
null
?
"all"
:
p
[
nextIndex
].
toString
(),
(
key1
,
key2
)
->
key1
));
collect
(
Collectors
.
toMap
(
p
->
p
[
0
].
toString
(),
p
->
p
[
nextIndex
]
==
null
?
"all"
:
p
[
nextIndex
].
toString
(),
(
key1
,
key2
)
->
key1
));
return
list
.
stream
().
filter
(
p
->
return
list
.
stream
().
filter
(
p
->
authdata
.
get
(
dicdata
.
get
(
p
.
getContractCode
()))
==
null
?
false
:
true
authdata
.
get
(
dicdata
.
get
(
p
.
getContractCode
()))
==
null
?
false
:
true
||
"all"
.
equals
(
authdata
.
get
(
dicdata
.
get
(
p
.
getContractCode
())))).
collect
(
Collectors
.
toList
());
||
"all"
.
equals
(
authdata
.
get
(
dicdata
.
get
(
p
.
getContractCode
())))).
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
return
list
;
return
list
;
}
}
}
}
@Override
@Override
...
@@ -2019,4 +2036,99 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2019,4 +2036,99 @@ public class ContractServiceImpl implements ContractService {
}
}
@Override
public
ResultModel
uploadBatchInfo
(
MultipartFile
file
,
String
platform
)
{
InputStream
stream
=
null
;
try
{
int
row_length
=
11
;
stream
=
file
.
getInputStream
();
Workbook
workbook
=
WorkbookFactory
.
create
(
stream
);
// Iterator<Sheet> sheetIter = workbook.sheetIterator();
// while (sheetIter.hasNext()) {
// Sheet sheet = sheetIter.next();
// }
saveDataBySheet
(
workbook
.
getSheetAt
(
0
),
row_length
);
}
catch
(
Exception
ex
)
{
return
ResultModel
.
ERROR
(
ResultStatus
.
NONE_FILE_EXIST
);
}
return
null
;
}
public
ResultModel
saveDataBySheet
(
Sheet
sheet
,
int
row_length
)
{
String
sheetName
=
sheet
.
getSheetName
();
if
(!
SHEET_NAMES
.
containsKey
(
sheetName
))
{
return
ResultModel
.
ERROR
(
"模板标签页名称错误"
);
}
String
platform
=
SHEET_NAMES
.
get
(
sheetName
);
Map
<
String
,
Long
>
tradTypeMap
=
tradeTypeRepsitory
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
TradeType:
:
getName
,
TradeType:
:
getId
));
Map
<
String
,
Long
>
salseMap
=
salesRepository
.
findSaleByStatus
(
0
).
stream
().
collect
(
Collectors
.
toMap
(
Sales:
:
getName
,
Sales:
:
getId
));
Row
row
=
sheet
.
getRow
(
0
);
if
(!
UPLOAD_TITLE
.
equals
(
parseRowData
(
row
,
row_length
,
null
)))
{
return
ResultModel
.
ERROR
(
ResultStatus
.
FORMAT_FILE_ERRO
);
}
DataFormatter
formatter
=
new
DataFormatter
();
int
rowNumber
=
sheet
.
getLastRowNum
();
List
<
Object
[]>
args_data
=
new
ArrayList
<>();
for
(
int
j
=
1
;
j
<=
rowNumber
;
j
++)
{
Row
row_data
=
sheet
.
getRow
(
j
);
Object
[]
s_data
=
new
Object
[
row_length
];
for
(
int
w
=
0
;
w
<
row_length
;
w
++)
{
Cell
cell
=
row_data
.
getCell
(
w
);
if
(
null
!=
cell
&&
!
cell
.
getCellTypeEnum
().
equals
(
CellType
.
BLANK
))
{
return
ResultModel
.
ERROR
(
ResultStatus
.
UPLOAD_CONTENT_ERRO
);
}
else
{
String
dataSTR
=
formatter
.
formatCellValue
(
cell
);
int
line_num
=
j
+
1
;
if
(
w
==
2
&&
!
tradTypeMap
.
containsKey
(
dataSTR
))
{
return
ResultModel
.
ERROR
(
"第"
+
(
j
+
1
)
+
"行[行业分类]错误"
);
}
else
if
(
w
==
5
&&
!
salseMap
.
containsKey
(
dataSTR
))
{
return
ResultModel
.
ERROR
(
"第"
+
(
j
+
1
)
+
"行[签约销售]错误"
);
}
s_data
[
w
]
=
dataSTR
;
}
}
args_data
.
add
(
s_data
);
}
jdbcTemplate
.
batchUpdate
(
"insert into contract (my_body_name,customer_body,trade_type,start_date,end_date,sale,email,contract_code, type_id,price_level,money) "
+
"values (?,?,?,?,?,?,?,?,?,?,?)"
,
args_data
);
return
null
;
}
private
Object
parseRowData
(
Row
row
,
int
length
,
StringBuffer
content
)
{
if
(
row
==
null
)
{
return
null
;
}
if
(
content
==
null
)
{
content
=
new
StringBuffer
();
}
DataFormatter
formatter
=
new
DataFormatter
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
Cell
cell
=
row
.
getCell
(
i
);
if
(
null
!=
cell
&&
!
cell
.
getCellTypeEnum
().
equals
(
CellType
.
BLANK
))
{
if
(
content
.
length
()
==
0
)
{
content
.
append
(
formatter
.
formatCellValue
(
cell
));
}
else
{
content
.
append
(
","
+
formatter
.
formatCellValue
(
cell
));
}
}
}
return
content
;
}
}
}
src/main/java/util/ResultStatus.java
View file @
a4666868
...
@@ -39,7 +39,7 @@ public enum ResultStatus {
...
@@ -39,7 +39,7 @@ public enum ResultStatus {
SURL_NULL
(-
1105
,
"短链为空"
),
SURL_NULL
(-
1105
,
"短链为空"
),
CAMPAIGN_NULL
(-
1106
,
"推广活动不存在"
),
CAMPAIGN_NULL
(-
1106
,
"推广活动不存在"
),
CAMPAIGN_EXISTS
(-
1107
,
"此分包渠道的活动已存在"
),
CAMPAIGN_EXISTS
(-
1107
,
"此分包渠道的活动已存在"
),
CAMPAIGN_REPEAT
(-
1008
,
"批量创建推广活动时名称重复"
),
CAMPAIGN_REPEAT
(-
1008
,
"批量创建推广活动时名称重复"
),
MSG_SMS_OUTOFTIME
(-
4001
,
"验证码过时,重新获取"
),
MSG_SMS_OUTOFTIME
(-
4001
,
"验证码过时,重新获取"
),
MSG_SMS_REQUESTTIMES
(-
4002
,
"今天请求验证码次数过多"
),
MSG_SMS_REQUESTTIMES
(-
4002
,
"今天请求验证码次数过多"
),
...
@@ -52,7 +52,10 @@ public enum ResultStatus {
...
@@ -52,7 +52,10 @@ public enum ResultStatus {
CHANNELACCOUNT_EXIST
(-
5003
,
"该账号ID已创建投放账号,不可重复创建"
),
CHANNELACCOUNT_EXIST
(-
5003
,
"该账号ID已创建投放账号,不可重复创建"
),
CHANNEL_LINKID_NOEXIST
(-
5004
,
"link_id不存在"
),
CHANNEL_LINKID_NOEXIST
(-
5004
,
"link_id不存在"
),
COMMON_IP_EXISTS
(-
7000
,
"公共ip已存在"
),
COMMON_IP_EXISTS
(-
7000
,
"公共ip已存在"
),
EXP_INVALID
(
11000
,
"自定义表达式错误"
);
EXP_INVALID
(
11000
,
"自定义表达式错误"
),
NONE_FILE_EXIST
(-
1000
,
"上传文件为空"
),
FORMAT_FILE_ERRO
(-
10001
,
"模板文件格式错误"
),
UPLOAD_CONTENT_ERRO
(-
10002
,
"模板文件内容错误"
);
/**
/**
...
...
src/main/resources/spring/applicationContext.xml
View file @
a4666868
...
@@ -339,4 +339,7 @@
...
@@ -339,4 +339,7 @@
</bean>
</bean>
<bean
id=
"appUtils"
class=
"common.context.AppUtils"
lazy-init=
"false"
/>
<bean
id=
"appUtils"
class=
"common.context.AppUtils"
lazy-init=
"false"
/>
<bean
id=
"jdbcTemplate"
class=
"org.springframework.jdbc.core.JdbcTemplate"
>
<property
name=
"dataSource"
ref=
"dataSource"
></property>
</bean>
</beans>
</beans>
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