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
22d4a229
Commit
22d4a229
authored
4 years ago
by
lzxry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CAS的ip地址发送日
parent
1b317c20
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
22 deletions
+146
-22
pom.xml
pom.xml
+3
-3
ADIAccountService.java
src/main/java/adi/service/ADIAccountService.java
+1
-1
ADIAccountServiceImpl.java
src/main/java/adi/service/impl/ADIAccountServiceImpl.java
+58
-17
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+3
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+21
-1
CASIPSendTimeTask.java
src/main/java/track/task/CASIPSendTimeTask.java
+54
-0
applicationContext-schedule.xml
src/main/resources/spring/applicationContext-schedule.xml
+6
-0
No files found.
pom.xml
View file @
22d4a229
...
...
@@ -89,7 +89,7 @@
<report.url>
http://10.3.20.41:9010
</report.url>
<import.temp.url>
http://10.3.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.114.198
</adi.url>
<adi.url>
http://39.104.114.198
,http://129.226.187.229:8080
</adi.url>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -163,7 +163,7 @@
<!--<report.url>http://localhost:9010</report.url>-->
<report.url>
http://10.3.20.41:9010
</report.url>
<import.temp.url>
http://10.3.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.114.198
</adi.url>
<adi.url>
http://39.104.114.198
,http://129.226.187.229:8080
</adi.url>
<contract.uppath></contract.uppath>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -265,7 +265,7 @@
<report.url>
http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn
</report.url>
<import.temp.url>
http://172.31.25.137:9001
</import.temp.url>
<adi.url>
http://
www.adinsights.cn
</adi.url>
<adi.url>
http://
39.104.114.198,http://129.226.187.229:8080
</adi.url>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/adi/service/ADIAccountService.java
View file @
22d4a229
...
...
@@ -18,7 +18,7 @@ public interface ADIAccountService {
List
<
ADIUser
>
findAll
(
User
user
);
ADIUser
findOne
(
String
email
);
ADIUser
findOne
(
String
email
,
String
contractType
);
List
<
ReminderLevel
>
findReminderlevel
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/adi/service/impl/ADIAccountServiceImpl.java
View file @
22d4a229
...
...
@@ -17,13 +17,13 @@ import office.model.BussinessMan;
import
office.repository.ADISaleMapRepository
;
import
office.repository.BussinessManRepository
;
import
org.apache.commons.collections4.list.TreeList
;
import
org.joda.time.DateTime
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
tkio.model.PackageType
;
import
userio.repository.IOPackageTypeRepository
;
import
userio.repository.IOSalesManLeaderRepository
;
import
util.Constant
;
...
...
@@ -135,7 +135,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
//暂时 注释改代码
if
(
true
)
return
;
ADIUser
adiUser
=
findOne
(
contract
.
getEmail
());
ADIUser
adiUser
=
findOne
(
contract
.
getEmail
(),
contract
.
getContractType
());
if
(
null
!=
adiUser
){
String
url
=
Constant
.
adiUrl
.
split
(
","
)[
0
]
+
"adi/api/user/web/update"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
...
...
@@ -321,31 +321,72 @@ public class ADIAccountServiceImpl implements ADIAccountService {
return
result
;
}
@Override
public
ADIUser
findOne
(
String
email
)
{
String
url
=
Constant
.
adiUrl
.
split
(
","
)[
0
]
+
"/adi/api/user/web/one?email="
+
email
;
String
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
public
ADIUser
findOne
(
String
email
,
String
contractType
)
{
ADIUser
adiUser1
=
null
;
ADIUser
adiUser2
=
null
;
ADIUser
adiUser
=
null
;
try
{
if
(
contractType
.
contains
(
"国内"
)){
String
url
=
Constant
.
adiUrl
.
split
(
","
)[
0
]
+
"/adi/api/user/web/one?email="
+
email
;
String
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
JSONObject
rs
=
new
JSONObject
(
request
);
String
content
=
rs
.
get
(
"content"
).
toString
();
if
(
StringUtils
.
isEmpty
(
content
)){
url
=
Constant
.
adiUrl
.
split
(
","
)[
1
]
+
"/adi/api/user/web/one?email="
+
email
;
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
rs
=
new
JSONObject
(
request
);
content
=
rs
.
get
(
"content"
).
toString
();
if
(!
StringUtils
.
isEmpty
(
content
)){
JSONArray
jsonArray
=
new
JSONArray
(
content
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
adiUser1
=
new
ADIUser
();
adiUser1
.
setCompany
(
jsonObject
.
getString
(
"company"
));
adiUser1
.
setAccountStatus
(
jsonObject
.
getString
(
"accountStatus"
));
adiUser1
.
setSendStatus
(
jsonObject
.
getString
(
"sendStatus"
));
adiUser1
.
setEmail
(
jsonObject
.
getString
(
"email"
));
adiUser1
.
setSendTime
(
jsonObject
.
getString
(
"sendTime"
));
}
}
if
(
contractType
.
contains
(
"海外"
)){
String
url
=
Constant
.
adiUrl
.
split
(
","
)[
1
]
+
"/adi/api/user/web/one?email="
+
email
;
String
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
JSONObject
rs
=
new
JSONObject
(
request
);
String
content
=
rs
.
get
(
"content"
).
toString
();
if
(!
StringUtils
.
isEmpty
(
content
)){
JSONArray
jsonArray
=
new
JSONArray
(
content
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
adiUser
=
new
ADIUser
();
adiUser
.
setCompany
(
jsonObject
.
getString
(
"company"
));
adiUser
.
setAccountStatus
(
jsonObject
.
getString
(
"accountStatus"
));
adiUser
.
setSendStatus
(
jsonObject
.
getString
(
"sendStatus"
));
adiUser
.
setEmail
(
jsonObject
.
getString
(
"email"
));
adiUser
.
setSendTime
(
jsonObject
.
getString
(
"sendTime"
));
//adiUser = new ObjectMapper().readValue(content, ADIUser.class);
adiUser2
=
new
ADIUser
();
adiUser2
.
setCompany
(
jsonObject
.
getString
(
"company"
));
adiUser2
.
setAccountStatus
(
jsonObject
.
getString
(
"accountStatus"
));
adiUser2
.
setSendStatus
(
jsonObject
.
getString
(
"sendStatus"
));
adiUser2
.
setEmail
(
jsonObject
.
getString
(
"email"
));
adiUser2
.
setSendTime
(
jsonObject
.
getString
(
"sendTime"
));
}
}
if
(
contractType
.
contains
(
"国内"
)
&&
contractType
.
contains
(
"海外"
)){
if
(
StringUtils
.
isEmpty
(
adiUser1
.
getSendTime
())&&
StringUtils
.
isEmpty
(
adiUser2
.
getSendTime
())){
adiUser
=
adiUser1
;
}
else
if
(!
StringUtils
.
isEmpty
(
adiUser1
.
getSendTime
())&&
StringUtils
.
isEmpty
(
adiUser2
.
getSendTime
())){
adiUser
=
adiUser1
;
}
else
if
(
StringUtils
.
isEmpty
(
adiUser1
.
getSendTime
())&&!
StringUtils
.
isEmpty
(
adiUser2
.
getSendTime
())){
adiUser
=
adiUser2
;
}
else
{
DateTime
dateTime1
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser1
.
getSendTime
()));
DateTime
dateTime2
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser2
.
getSendTime
()));
if
(
dateTime1
.
isBefore
(
dateTime2
)){
adiUser
=
adiUser2
;
}
else
{
adiUser
=
adiUser1
;
}
}
}
else
if
(
contractType
.
contains
(
"国内"
)){
adiUser
=
adiUser1
;
}
else
{
adiUser
=
adiUser2
;
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/common/repository/ContractRepository.java
View file @
22d4a229
...
...
@@ -141,4 +141,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select * from contract where next_signed_contract_code=?1 limit 1 "
,
nativeQuery
=
true
)
Contract
findByNextSignedContractCode
(
String
contractCode
);
@Query
(
value
=
"select * from contract where platform=?1 and share_sign = ?2 "
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatformAndShareSign
(
String
platform
,
int
share_sign
);
}
This diff is collapsed.
Click to expand it.
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
22d4a229
...
...
@@ -261,7 +261,7 @@ public class ContractServiceImpl implements ContractService {
}
else
if
(
"io"
.
equals
(
platfrom
))
{
ioAccount4Web
=
ioAccount4WebRepository
.
findByEmail
(
email
);
}
else
if
(
"adi"
.
equals
(
platfrom
)
||
"cas"
.
equals
(
platfrom
)
)
{
adiUser
=
adiAccountService
.
findOne
(
email
);
adiUser
=
adiAccountService
.
findOne
(
email
,
"国内"
);
}
if
(
null
==
account
&&
null
==
ioAccount4Web
&&
null
==
adiUser
)
{
map
.
put
(
"result"
,
0
);
...
...
@@ -599,6 +599,7 @@ public class ContractServiceImpl implements ContractService {
//this.calculateShareIncome(resource);//判断是否计算调整金
//判断库里是否已有合同的主账号
if
(
"tkio"
.
equals
(
resource
.
getPlatform
()))
{
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndEmail
(
resource
.
getPlatform
(),
resource
.
getEmail
());
...
...
@@ -650,6 +651,25 @@ public class ContractServiceImpl implements ContractService {
}
}
}
else
if
(
"cas"
.
equals
(
resource
.
getPlatform
())){
ADIUser
adiUser
=
adiAccountService
.
findOne
(
resource
.
getEmail
(),
resource
.
getContractType
());
if
(
StringUtils
.
isEmpty
(
adiUser
.
getSendTime
())){
resource
.
setShareSign
(
0
);
}
else
{
resource
.
setShareSign
(
1
);
DateTime
sendTime
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser
.
getSendTime
()));
DateTime
startDate
=
new
DateTime
(
resource
.
getStartDate
());
if
(
sendTime
.
isBefore
(
startDate
)){
sendTime
=
startDate
;
}
DateTime
endDate
=
new
DateTime
(
resource
.
getEndDate
());
String
validStartDateStr
=
sendTime
.
toString
(
DateUtil
.
C_DATE_PATTON_DEFAULT
);
int
contractAllDay
=
Days
.
daysBetween
(
startDate
,
endDate
).
getDays
();
//合同总天数-1 ,用于计算结束日期
String
validEndDateStr
=
sendTime
.
plusDays
(
contractAllDay
).
toString
(
"yyyy-MM-dd"
);
resource
.
setValidStartDate
(
validStartDateStr
);
resource
.
setValidEndDate
(
validEndDateStr
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/track/task/CASIPSendTimeTask.java
0 → 100644
View file @
22d4a229
package
track
.
task
;
import
adi.model.ADIUser
;
import
adi.service.ADIAccountService
;
import
common.model.Contract
;
import
common.repository.ContractRepository
;
import
org.joda.time.DateTime
;
import
org.joda.time.Days
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
util.DateUtil
;
import
java.util.List
;
/**
* @author liyin
* @description
* @date
*/
public
class
CASIPSendTimeTask
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CASIPSendTimeTask
.
class
);
@Autowired
ADIAccountService
adiAccountService
;
@Autowired
ContractRepository
contractRepository
;
public
void
task
(){
logger
.
info
(
"CAS的IP定制发送日定时任务"
);
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndShareSign
(
"cas"
,
0
);
for
(
Contract
contract
:
contracts
)
{
ADIUser
adiUser
=
adiAccountService
.
findOne
(
contract
.
getEmail
(),
contract
.
getContractType
());
if
(!
StringUtils
.
isEmpty
(
adiUser
.
getSendTime
())){
contract
.
setShareSign
(
1
);
DateTime
sendTime
=
new
DateTime
(
DateUtil
.
parseDate
(
DateUtil
.
C_TIME_PATTON_DEFAULT
,
adiUser
.
getSendTime
()));
DateTime
startDate
=
new
DateTime
(
contract
.
getStartDate
());
if
(
sendTime
.
isBefore
(
startDate
)){
sendTime
=
startDate
;
}
DateTime
endDate
=
new
DateTime
(
contract
.
getEndDate
());
String
validStartDateStr
=
sendTime
.
toString
(
DateUtil
.
C_DATE_PATTON_DEFAULT
);
int
contractAllDay
=
Days
.
daysBetween
(
startDate
,
endDate
).
getDays
();
//合同总天数-1 ,用于计算结束日期
String
validEndDateStr
=
sendTime
.
plusDays
(
contractAllDay
).
toString
(
"yyyy-MM-dd"
);
contract
.
setValidStartDate
(
validStartDateStr
);
contract
.
setValidEndDate
(
validEndDateStr
);
contractRepository
.
save
(
contract
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/spring/applicationContext-schedule.xml
View file @
22d4a229
...
...
@@ -75,4 +75,10 @@
<task:scheduled
ref=
"syncCalculationFlowTask"
method=
"syncFlow"
cron=
"0 0/7 * * * ? "
/>
</task:scheduled-tasks>
<bean
id=
"syncIPSendTime"
class=
"track.task.CASIPSendTimeTask"
></bean>
<task:scheduled-tasks>
<!--定时同步CAS的IP发送日(每天A.M八点执行一次)-->
<task:scheduled
ref=
"syncIPSendTime"
method=
"task"
cron=
"0 0 8 * * ? "
/>
</task:scheduled-tasks>
</beans>
This diff is collapsed.
Click to expand it.
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