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
52af2507
Commit
52af2507
authored
Sep 27, 2021
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2580_fix2' into 2580_fix
parents
50f5e68c
065258b1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
172 additions
and
35 deletions
+172
-35
DmpIncomeController.java
src/main/java/common/controller/DmpIncomeController.java
+3
-4
Contract.java
src/main/java/common/model/Contract.java
+2
-0
DmpIncome.java
src/main/java/common/model/DmpIncome.java
+11
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+3
-0
DmpIncomeRepository.java
src/main/java/common/repository/DmpIncomeRepository.java
+0
-1
DmpIncomeService.java
src/main/java/common/service/DmpIncomeService.java
+2
-1
DmpIncomeServiceImpl.java
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
+65
-13
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+14
-10
CASIPSendTimeTask.java
src/main/java/track/task/CASIPSendTimeTask.java
+72
-6
No files found.
src/main/java/common/controller/DmpIncomeController.java
View file @
52af2507
...
@@ -38,17 +38,16 @@ public class DmpIncomeController {
...
@@ -38,17 +38,16 @@ public class DmpIncomeController {
}
}
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
public
ResultModel
deleteItem
(
Long
id
)
{
public
ResultModel
deleteItem
(
@RequestBody
DmpIncome
dmpIncome
)
{
//删除数据
//删除数据
return
ResultModel
.
OK
(
dmpIncomeService
.
delete
(
id
));
return
ResultModel
.
OK
(
dmpIncomeService
.
delete
(
dmpIncome
));
}
}
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
public
ResultModel
uploadList
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@CurrentAccount
User
loginAccount
)
{
public
ResultModel
uploadList
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@CurrentAccount
User
loginAccount
)
{
//上传收入数据
//上传收入数据
dmpIncomeService
.
uploadFile
(
file
,
"dmp"
,
loginAccount
);
return
dmpIncomeService
.
uploadFile
(
file
,
"dmp"
,
loginAccount
);
return
ResultModel
.
OK
();
}
}
...
...
src/main/java/common/model/Contract.java
View file @
52af2507
...
@@ -198,6 +198,8 @@ public class Contract {
...
@@ -198,6 +198,8 @@ public class Contract {
this
.
contractType
=
contractType
;
this
.
contractType
=
contractType
;
}
}
public
String
getStartDate
()
{
public
String
getStartDate
()
{
return
startDate
;
return
startDate
;
}
}
...
...
src/main/java/common/model/DmpIncome.java
View file @
52af2507
...
@@ -9,6 +9,7 @@ import java.util.Date;
...
@@ -9,6 +9,7 @@ import java.util.Date;
@Entity
@Entity
public
class
DmpIncome
{
public
class
DmpIncome
{
private
Long
id
;
// ID
private
Long
id
;
// ID
private
String
contractCode
;
//合同编号
private
String
contractCode
;
//合同编号
private
String
incomeMonth
;
//收入月份
private
String
incomeMonth
;
//收入月份
...
@@ -20,6 +21,7 @@ public class DmpIncome {
...
@@ -20,6 +21,7 @@ public class DmpIncome {
private
Date
createTime
;
private
Date
createTime
;
private
Date
modifyTime
;
private
Date
modifyTime
;
private
String
uploadUser
;
private
String
uploadUser
;
private
int
index
;
private
String
myBodyCode
;
private
String
myBodyCode
;
//contract_code, my_body_name, customer_body, customer_short, business_type, agreement_type
//contract_code, my_body_name, customer_body, customer_short, business_type, agreement_type
...
@@ -166,6 +168,15 @@ public class DmpIncome {
...
@@ -166,6 +168,15 @@ public class DmpIncome {
this
.
agreementType
=
agreementType
;
this
.
agreementType
=
agreementType
;
}
}
@Transient
public
int
getIndex
()
{
return
index
;
}
public
void
setIndex
(
int
index
)
{
this
.
index
=
index
;
}
public
String
getMyBodyCode
()
{
public
String
getMyBodyCode
()
{
return
myBodyCode
;
return
myBodyCode
;
}
}
...
...
src/main/java/common/repository/ContractRepository.java
View file @
52af2507
...
@@ -165,4 +165,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
...
@@ -165,4 +165,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Modifying
@Modifying
@Query
(
value
=
"delete from contract where contract_code = ?1 and platform=?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"delete from contract where contract_code = ?1 and platform=?2"
,
nativeQuery
=
true
)
void
deleteByCode
(
String
contractCode
,
String
platform
);
void
deleteByCode
(
String
contractCode
,
String
platform
);
@Query
(
value
=
"select * from contract where platform=?1 and email =?2"
,
nativeQuery
=
true
)
List
<
Contract
>
findbyEmailAndPlatform
(
String
cas
,
String
originEmail
);
}
}
src/main/java/common/repository/DmpIncomeRepository.java
View file @
52af2507
...
@@ -17,5 +17,4 @@ public interface DmpIncomeRepository extends JpaRepository<DmpIncome, Long> {
...
@@ -17,5 +17,4 @@ public interface DmpIncomeRepository extends JpaRepository<DmpIncome, Long> {
@Query
(
value
=
"select * from dmp_income where contract_code = ?1 and income_month =?2 limit 1 "
,
nativeQuery
=
true
)
@Query
(
value
=
"select * from dmp_income where contract_code = ?1 and income_month =?2 limit 1 "
,
nativeQuery
=
true
)
DmpIncome
findByCodeMonth
(
String
contractCode
,
String
incomeMonth
);
DmpIncome
findByCodeMonth
(
String
contractCode
,
String
incomeMonth
);
}
}
src/main/java/common/service/DmpIncomeService.java
View file @
52af2507
...
@@ -22,7 +22,7 @@ public interface DmpIncomeService {
...
@@ -22,7 +22,7 @@ public interface DmpIncomeService {
DmpIncome
update
(
DmpIncome
dmpIncome
);
DmpIncome
update
(
DmpIncome
dmpIncome
);
Long
delete
(
Long
id
);
Long
delete
(
DmpIncome
dmpIncome
);
ResultModel
uploadFile
(
MultipartFile
file
,
String
platform
,
User
loginAccount
);
ResultModel
uploadFile
(
MultipartFile
file
,
String
platform
,
User
loginAccount
);
...
@@ -45,4 +45,5 @@ public interface DmpIncomeService {
...
@@ -45,4 +45,5 @@ public interface DmpIncomeService {
List
pdListByDs
(
String
startDate
,
String
endDate
);
List
pdListByDs
(
String
startDate
,
String
endDate
);
HSSFWorkbook
exportPdIncomeList
(
String
startDate
,
String
endDate
,
String
bodyCode
,
String
serchName
);
HSSFWorkbook
exportPdIncomeList
(
String
startDate
,
String
endDate
,
String
bodyCode
,
String
serchName
);
}
}
src/main/java/common/service/impl/DmpIncomeServiceImpl.java
View file @
52af2507
...
@@ -70,6 +70,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -70,6 +70,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
PdAttachmentRepository
pdAttachmentRepository
;
PdAttachmentRepository
pdAttachmentRepository
;
public
static
final
Map
<
String
,
String
>
SHEET_NAMES
=
new
HashMap
();
public
static
final
Map
<
String
,
String
>
SHEET_NAMES
=
new
HashMap
();
private
static
final
Map
<
String
,
String
>
CONTRACT_TYPE_NAME
=
new
HashMap
();
private
static
final
Map
<
String
,
String
>
CONTRACT_TYPE_NAME
=
new
HashMap
();
private
static
final
Map
<
String
,
String
>
BUSINESS_TYPE_NAME
=
new
HashMap
();
private
static
final
Map
<
String
,
String
>
BUSINESS_TYPE_NAME
=
new
HashMap
();
...
@@ -89,6 +90,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -89,6 +90,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
CONTRACT_TYPE_NAME
.
put
(
"补充协议"
,
"2"
);
CONTRACT_TYPE_NAME
.
put
(
"补充协议"
,
"2"
);
BUSINESS_TYPE_NAME
.
put
(
"VIP"
,
"1"
);
//业务类型 1 VIP 2 共管
BUSINESS_TYPE_NAME
.
put
(
"VIP"
,
"1"
);
//业务类型 1 VIP 2 共管
BUSINESS_TYPE_NAME
.
put
(
"共管"
,
"2"
);
BUSINESS_TYPE_NAME
.
put
(
"共管"
,
"2"
);
BUSINESS_TYPE_NAME
.
put
(
"前置机"
,
"3"
);
SETAGREEMENT_TYPE_NAME
.
put
(
"普通协议"
,
"1"
);
//协议类型 1 普通协议 2 框架协议
SETAGREEMENT_TYPE_NAME
.
put
(
"普通协议"
,
"1"
);
//协议类型 1 普通协议 2 框架协议
SETAGREEMENT_TYPE_NAME
.
put
(
"框架协议"
,
"2"
);
SETAGREEMENT_TYPE_NAME
.
put
(
"框架协议"
,
"2"
);
}
}
...
@@ -223,7 +225,8 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -223,7 +225,8 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
row
.
createCell
(
i
).
setCellValue
(
title
[
i
]);
row
.
createCell
(
i
).
setCellValue
(
title
[
i
]);
}
}
String
[]
bussinesName
=
new
String
[]{
""
,
"VIP"
,
"共管"
};
String
[]
bussinesName
=
new
String
[]{
""
,
"VIP"
,
"共管"
,
"前置机"
};
for
(
int
j
=
0
;
j
<
dmpIncomes
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
dmpIncomes
.
size
();
j
++)
{
HSSFRow
rowBody
=
sheet
.
createRow
(
j
+
1
);
HSSFRow
rowBody
=
sheet
.
createRow
(
j
+
1
);
DmpIncome
income
=
dmpIncomes
.
get
(
j
);
DmpIncome
income
=
dmpIncomes
.
get
(
j
);
...
@@ -261,12 +264,13 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -261,12 +264,13 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
}
}
@Override
@Override
public
Long
delete
(
Long
id
)
{
if
(
id
==
null
)
{
public
Long
delete
(
DmpIncome
dmpIncome
)
{
if
(
dmpIncome
.
getId
()
==
null
)
{
return
null
;
return
null
;
}
}
dmpIncomeRepository
.
delete
(
id
);
dmpIncomeRepository
.
delete
(
dmpIncome
.
getId
()
);
return
id
;
return
dmpIncome
.
getId
()
;
}
}
@Override
@Override
...
@@ -285,27 +289,56 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -285,27 +289,56 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
Sheet
sheet
=
workbook
.
getSheetAt
(
0
);
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
CompletableFuture
.
runAsync
(()
->
{
StringBuffer
erroMessage
=
new
StringBuffer
();
StopWatch
stopWatch
=
new
StopWatch
();
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
stopWatch
.
start
();
Map
<
String
,
String
>
incomeMap
=
new
HashMap
<>();
List
<
DmpIncome
>
dmpIncomeList
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
{
DmpIncome
income
=
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
);
String
key
=
income
.
getIncomeMonth
()
+
income
.
getContractCode
();
if
(
incomeMap
.
containsKey
(
key
))
{
return
null
;
}
incomeMap
.
put
(
key
,
"1"
);
return
income
;
}).
filter
(
in
->
in
!=
null
).
collect
(
Collectors
.
toList
());
if
(
dmpIncomeList
.
isEmpty
())
{
return
ResultModel
.
OK
();
}
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
30
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
30
);
CompletableFuture
[]
futures
=
Stream
.
iterate
(
1
,
n
->
n
+
1
).
limit
(
rowNumber
-
1
).
map
(
index
->
final
int
[]
indexLine
=
{
0
};
CompletableFuture
[]
futures
=
dmpIncomeList
.
stream
().
map
(
income
->
CompletableFuture
.
runAsync
(
CompletableFuture
.
runAsync
(
()
->
{
()
->
{
DmpIncome
income
=
saveDmpIncomeItem
(
sheet
,
index
,
loginAccount
);
if
(
income
!=
null
)
{
DmpIncome
one
=
dmpIncomeRepository
.
findByCodeMonth
(
income
.
getContractCode
(),
income
.
getIncomeMonth
());
if
(
one
!=
null
)
{
// 同一合同同一月份不重复保存
return
;
}
indexLine
[
0
]
=
income
.
getIndex
();
if
(
"erro"
.
equals
(
income
.
getIncomeMonth
()))
{
erroMessage
.
append
(
income
.
getIndex
()).
append
(
" 行 收入月份错误"
).
append
(
";\n"
);
}
else
{
income
.
setConfirmSettlement
(
new
BigDecimal
(
income
.
getConfirmSettlement
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
income
.
setConfirmSettlement
(
new
BigDecimal
(
income
.
getConfirmSettlement
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
dmpIncomeRepository
.
save
(
income
);
dmpIncomeRepository
.
save
(
income
);
}
}
},
executorService
)
},
executorService
)
.
exceptionally
((
t
)
->
null
)
.
exceptionally
((
t
)
->
{
erroMessage
.
append
(
indexLine
[
0
]).
append
(
" 行 错误"
).
append
(
t
.
getMessage
()).
append
(
";\n"
);
logger
.
error
(
"the line "
+
indexLine
[
0
],
t
);
return
null
;
})
).
toArray
(
size
->
new
CompletableFuture
[
size
]);
).
toArray
(
size
->
new
CompletableFuture
[
size
]);
CompletableFuture
.
allOf
(
futures
).
join
();
CompletableFuture
.
allOf
(
futures
).
join
();
executorService
.
shutdownNow
();
executorService
.
shutdownNow
();
stopWatch
.
stop
();
stopWatch
.
stop
();
logger
.
info
(
"dmp income upload {} line data use all {}s "
,
rowNumber
-
1
,
stopWatch
.
getTotalTimeSeconds
());
logger
.
info
(
"dmp income upload {} line data use all {}s "
,
rowNumber
-
1
,
stopWatch
.
getTotalTimeSeconds
());
});
if
(
erroMessage
.
length
()
>
0
)
{
return
ResultModel
.
ERROR
(
erroMessage
.
toString
());
}
return
ResultModel
.
OK
();
return
ResultModel
.
OK
();
}
}
...
@@ -354,8 +387,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -354,8 +387,20 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
contract
.
setDs
(
DateTime
.
now
().
toString
(
"yyyy-MM-dd"
));
contract
.
setDs
(
DateTime
.
now
().
toString
(
"yyyy-MM-dd"
));
String
sysErro
=
null
;
try
{
//填充数据
//填充数据
fillDataByRow
(
contract
,
rowItem
);
fillDataByRow
(
contract
,
rowItem
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"the line "
+
i
,
e
);
sysErro
=
e
.
getMessage
();
}
if
(
sysErro
!=
null
)
{
return
erroValueTip
(
i
,
sysErro
);
}
//校验数据有效性
//校验数据有效性
if
(
"erro"
.
equals
(
contract
.
getStartDate
())
||
"erro"
.
equals
(
contract
.
getEndDate
()))
{
if
(
"erro"
.
equals
(
contract
.
getStartDate
())
||
"erro"
.
equals
(
contract
.
getEndDate
()))
{
return
erroValueTip
(
i
,
"开始时间或结束时间"
);
return
erroValueTip
(
i
,
"开始时间或结束时间"
);
...
@@ -400,10 +445,14 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -400,10 +445,14 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
}
}
}
}
if
(!
CONTRACT_TYPE_NAME
.
containsKey
(
contract
.
getContractType
()))
{
if
(!
CONTRACT_TYPE_NAME
.
containsKey
(
contract
.
getContractType
())
&&
!
"续签"
.
equals
(
contract
.
getContractType
()))
{
return
erroValueTip
(
i
,
"签约类型"
);
return
erroValueTip
(
i
,
"签约类型"
);
}
else
{
}
else
{
contract
.
setContractType
(
CONTRACT_TYPE_NAME
.
get
(
contract
.
getContractType
()));
contract
.
setContractType
(
CONTRACT_TYPE_NAME
.
get
(
contract
.
getContractType
()));
if
(
"续签"
.
equals
(
contract
.
getContractType
()))
{
contract
.
setContractType
(
"1"
);
}
}
}
if
(!
BUSINESS_TYPE_NAME
.
containsKey
(
contract
.
getBusinessTypeName
()))
{
if
(!
BUSINESS_TYPE_NAME
.
containsKey
(
contract
.
getBusinessTypeName
()))
{
...
@@ -521,6 +570,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -521,6 +570,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
Row
rowItem
=
sheet
.
getRow
(
index
);
Row
rowItem
=
sheet
.
getRow
(
index
);
//合同编号 收入月份 结算周期 系统结算 按月结算 税率 确认收入
//合同编号 收入月份 结算周期 系统结算 按月结算 税率 确认收入
DmpIncome
income
=
new
DmpIncome
();
DmpIncome
income
=
new
DmpIncome
();
income
.
setIndex
(
index
);
income
.
setContractCode
(
getCellStringValue
(
rowItem
,
0
));
income
.
setContractCode
(
getCellStringValue
(
rowItem
,
0
));
income
.
setIncomeMonth
(
getCellDateValue
(
rowItem
,
1
,
"yyyy-MM"
));
income
.
setIncomeMonth
(
getCellDateValue
(
rowItem
,
1
,
"yyyy-MM"
));
income
.
setPeriod
(
getCellStringValue
(
rowItem
,
2
));
income
.
setPeriod
(
getCellStringValue
(
rowItem
,
2
));
...
@@ -545,6 +595,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -545,6 +595,7 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
// 同一合同同一月份不重复保存
// 同一合同同一月份不重复保存
return
null
;
return
null
;
}
}
return
income
;
return
income
;
}
}
...
@@ -729,4 +780,5 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
...
@@ -729,4 +780,5 @@ public class DmpIncomeServiceImpl implements DmpIncomeService {
pdAttachmentRepository
.
delete
(
id
);
pdAttachmentRepository
.
delete
(
id
);
return
attachment
;
return
attachment
;
}
}
}
}
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
52af2507
...
@@ -535,16 +535,16 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -535,16 +535,16 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
//if(contract==null){
//if(contract==null){
List
<
Contract
>
contractList
=
contractRepository
.
findByCreateTimeAndCodeNotOwn
(
groupContract
.
getRelationCode
(),
DateUtil
.
format
(
groupContract
.
getCreateTime
(),
DateUtil
.
C_TIME_PATTON_DEFAULT
),
groupContract
.
getId
());
List
<
Contract
>
contractList
=
contractRepository
.
findByCreateTimeAndCodeNotOwn
(
groupContract
.
getRelationCode
(),
DateUtil
.
format
(
groupContract
.
getCreateTime
(),
DateUtil
.
C_TIME_PATTON_DEFAULT
),
groupContract
.
getId
());
for
(
Contract
contract1
:
contractList
)
{
for
(
Contract
contract1
:
contractList
)
{
if
(
StringUtils
.
isEmpty
(
map
.
get
(
contract1
.
getContractCode
())))
{
if
(
StringUtils
.
isEmpty
(
map
.
get
(
contract1
.
getContractCode
())))
{
map
.
put
(
contract1
.
getContractCode
(),
contract1
);
map
.
put
(
contract1
.
getContractCode
(),
contract1
);
}
}
}
}
groupContracts
=
map
.
values
();
//只要不加入传进来的那个list里面就不会影响查询的列表
groupContracts
=
map
.
values
();
//只要不加入传进来的那个list里面就不会影响查询的列表
break
;
break
;
}
else
if
((
groupContracts
.
size
()==
1
&&!
StringUtils
.
isEmpty
(
groupContract
.
getNextSignedDate
()))||(!
"2"
.
equals
(
groupContract
.
getContractType
())
&&
map
.
get
(
groupContract
.
getNextSignedContractCode
())==
null
))
{
}
else
if
((
groupContracts
.
size
()
==
1
&&
!
StringUtils
.
isEmpty
(
groupContract
.
getNextSignedDate
()))
||
(!
"2"
.
equals
(
groupContract
.
getContractType
())
&&
map
.
get
(
groupContract
.
getNextSignedContractCode
())
==
null
))
{
List
<
Contract
>
contractList
=
contractRepository
.
findByRelationCode
(
groupContract
.
getContractCode
());
List
<
Contract
>
contractList
=
contractRepository
.
findByRelationCode
(
groupContract
.
getContractCode
());
for
(
Contract
contract1
:
contractList
)
{
for
(
Contract
contract1
:
contractList
)
{
if
(
StringUtils
.
isEmpty
(
map
.
get
(
contract1
.
getContractCode
())))
{
if
(
StringUtils
.
isEmpty
(
map
.
get
(
contract1
.
getContractCode
())))
{
map
.
put
(
contract1
.
getContractCode
(),
contract1
);
map
.
put
(
contract1
.
getContractCode
(),
contract1
);
}
}
}
}
...
@@ -1895,7 +1895,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -1895,7 +1895,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
@Override
@Override
public
boolean
checkLateContract
(
DateTime
dateTime
,
DateTime
creatTime
)
{
public
boolean
checkLateContract
(
DateTime
dateTime
,
DateTime
creatTime
)
{
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
9
;
//int aferDays = dateTime.monthOfYear().get() == 12 ? 29 : 9;
//修改晚录判断逻辑
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
1
;
return
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
return
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
}
}
...
@@ -1962,12 +1964,14 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -1962,12 +1964,14 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
DateTime
dateTime
=
new
DateTime
(
"2020-10-30"
);
DateTime
dateTime
=
new
DateTime
(
"2020-10-30"
);
DateTime
creatTime
=
new
DateTime
(
"2020-11-9"
);
DateTime
creatTime
=
new
DateTime
(
"2020-11-02"
);
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
9
;
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
1
;
System
.
out
.
println
(
dateTime
.
monthOfYear
().
get
());
System
.
out
.
println
(
"合同开始时间"
+
dateTime
);
System
.
out
.
println
(
dateTime
.
dayOfMonth
().
withMaximumValue
());
System
.
out
.
println
(
"合同录入时间"
+
creatTime
);
System
.
out
.
println
(
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
));
System
.
out
.
println
(
"合同开始时间在第"
+
dateTime
.
monthOfYear
().
get
()
+
"月"
);
System
.
out
.
println
(
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
));
System
.
out
.
println
(
"合同录入当月的最后一天日期:"
+
dateTime
.
dayOfMonth
().
withMaximumValue
());
System
.
out
.
println
(
"合同录入当月的最后一天日期后第"
+
aferDays
+
"天"
+
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
));
System
.
out
.
println
(
"是否是晚录:"
+
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
));
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
}
}
...
...
src/main/java/track/task/CASIPSendTimeTask.java
View file @
52af2507
...
@@ -8,12 +8,17 @@ import common.repository.ContractRepository;
...
@@ -8,12 +8,17 @@ import common.repository.ContractRepository;
import
common.repository.PackageBaseRepository
;
import
common.repository.PackageBaseRepository
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
import
org.joda.time.Days
;
import
org.joda.time.Days
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
util.Constant
;
import
util.DateUtil
;
import
util.DateUtil
;
import
util.HttpClientUtil
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -34,23 +39,23 @@ public class CASIPSendTimeTask {
...
@@ -34,23 +39,23 @@ public class CASIPSendTimeTask {
PackageBaseRepository
packageBaseRepository
;
PackageBaseRepository
packageBaseRepository
;
public
void
task
(){
public
void
task
()
{
logger
.
info
(
"CAS的IP定制发送日定时任务"
);
logger
.
info
(
"CAS的IP定制发送日定时任务"
);
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
"cas"
,
1
);
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
"cas"
,
1
);
Map
<
Long
,
PackageBase
>
packageBaseMap
=
new
HashMap
<>();
Map
<
Long
,
PackageBase
>
packageBaseMap
=
new
HashMap
<>();
for
(
PackageBase
base
:
packageBases
)
{
for
(
PackageBase
base
:
packageBases
)
{
packageBaseMap
.
put
(
base
.
getId
(),
base
);
packageBaseMap
.
put
(
base
.
getId
(),
base
);
}
}
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndShareSign
(
"cas"
,
0
);
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndShareSign
(
"cas"
,
0
);
for
(
Contract
contract
:
contracts
)
{
for
(
Contract
contract
:
contracts
)
{
PackageBase
packageBase
=
packageBaseMap
.
get
(
contract
.
getPriceLevel
());
PackageBase
packageBase
=
packageBaseMap
.
get
(
contract
.
getPriceLevel
());
ADIUser
adiUser
=
adiAccountService
.
findOne
(
contract
.
getEmail
(),
packageBase
==
null
?
""
:
packageBase
.
getPackageName
());
ADIUser
adiUser
=
adiAccountService
.
findOne
(
contract
.
getEmail
(),
packageBase
==
null
?
""
:
packageBase
.
getPackageName
());
if
(
adiUser
!=
null
&&!
StringUtils
.
isEmpty
(
adiUser
.
getSendTime
()))
{
if
(
adiUser
!=
null
&&
!
StringUtils
.
isEmpty
(
adiUser
.
getSendTime
()))
{
contract
.
setShareSign
(
1
);
contract
.
setShareSign
(
1
);
DateTime
sendTime
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser
.
getSendTime
()));
DateTime
sendTime
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser
.
getSendTime
()));
DateTime
startDate
=
new
DateTime
(
contract
.
getStartDate
());
DateTime
startDate
=
new
DateTime
(
contract
.
getStartDate
());
if
(
sendTime
.
isBefore
(
startDate
))
{
if
(
sendTime
.
isBefore
(
startDate
))
{
sendTime
=
startDate
;
sendTime
=
startDate
;
}
}
DateTime
endDate
=
new
DateTime
(
contract
.
getEndDate
());
DateTime
endDate
=
new
DateTime
(
contract
.
getEndDate
());
...
@@ -62,5 +67,66 @@ public class CASIPSendTimeTask {
...
@@ -62,5 +67,66 @@ public class CASIPSendTimeTask {
contractRepository
.
save
(
contract
);
contractRepository
.
save
(
contract
);
}
}
}
}
//定时同步变更的账号到对应合同
syncChangedAccount
(
packageBaseMap
);
}
//定时同步变更的账号到对应合同 (packType: 国内 海外)
public
void
syncChangedAccount
(
Map
<
Long
,
PackageBase
>
packageBaseMap
)
{
String
ds
=
DateTime
.
now
().
plusDays
(-
1
).
toString
(
"yyyy-MM-dd"
);
//国内
String
url
=
Constant
.
adiUrl
.
split
(
","
)[
0
]
+
"/adi/api/user/change/day?date="
+
ds
;
syncChangedAccount
(
packageBaseMap
,
url
,
"国内"
);
//海外
url
=
Constant
.
adiUrl
.
split
(
","
)[
1
]
+
"/adi/api/user/overseas/change/day?date="
+
ds
;
syncChangedAccount
(
packageBaseMap
,
url
,
"海外"
);
}
//定时同步变更的账号到对应合同 (packType: 国内 海外)
public
void
syncChangedAccount
(
Map
<
Long
,
PackageBase
>
packageBaseMap
,
String
url
,
String
packType
)
{
String
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
try
{
JSONObject
rs
=
new
JSONObject
(
request
);
if
(
"200"
.
equals
(
rs
.
get
(
"code"
)
+
""
))
{
if
(
rs
.
get
(
"content"
)
!=
null
&&
!
rs
.
get
(
"content"
).
toString
().
startsWith
(
"["
))
{
return
;
}
JSONArray
array
=
(
JSONArray
)
rs
.
get
(
"content"
);
for
(
int
i
=
0
;
i
<
array
.
length
();
i
++)
{
JSONObject
object
=
(
JSONObject
)
array
.
get
(
i
);
String
newEmail
=
object
.
getString
(
"newEmail"
);
String
originEmail
=
object
.
getString
(
"originEmail"
);
if
(
StringUtils
.
isEmpty
(
newEmail
)
||
StringUtils
.
isEmpty
(
originEmail
))
{
continue
;
}
List
<
Contract
>
contracts
=
contractRepository
.
findbyEmailAndPlatform
(
"cas"
,
originEmail
);
if
(
contracts
==
null
)
{
continue
;
}
List
<
Contract
>
updateList
=
new
ArrayList
<>();
for
(
Contract
contract
:
contracts
)
{
PackageBase
packageBase
=
packageBaseMap
.
get
(
contract
.
getPriceLevel
());
if
(
packageBase
.
getPackageName
().
contains
(
packType
))
{
contract
.
setEmail
(
newEmail
);
updateList
.
add
(
contract
);
}
}
if
(!
updateList
.
isEmpty
())
{
//更新账号
contractRepository
.
save
(
contracts
);
}
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"syncChangedAccount erro "
+
packType
,
e
);
}
}
}
}
}
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