Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
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
huluobin
dc-java
Commits
5c8b2561
Commit
5c8b2561
authored
Aug 20, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账户信息
parent
484fbd3e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
47 deletions
+51
-47
CompanyAccountSyncJob.java
...rc/main/java/com/bailuntec/job/CompanyAccountSyncJob.java
+45
-42
const.properties
...ase/base-sync-company/src/main/resources/const.properties
+2
-2
SyncCostFirstJob.java
...rst/src/main/java/com/bailuntec/job/SyncCostFirstJob.java
+2
-1
SyncCostFirstTest.java
...base-sync-cost-first/src/test/java/SyncCostFirstTest.java
+2
-2
No files found.
data-base/base-sync-company/src/main/java/com/bailuntec/job/CompanyAccountSyncJob.java
View file @
5c8b2561
...
@@ -31,57 +31,60 @@ public class CompanyAccountSyncJob extends PointJob {
...
@@ -31,57 +31,60 @@ public class CompanyAccountSyncJob extends PointJob {
@Override
@Override
public
void
executeJob
(
ShardingContext
shardingContext
,
JobPointLog
jobPointLog
)
{
public
void
executeJob
(
ShardingContext
shardingContext
,
JobPointLog
jobPointLog
)
{
Request
request
=
new
Request
.
Builder
()
Request
request
=
new
Request
.
Builder
()
.
url
(
propertiesUtil
.
getPropertyAsString
(
"COMPANY_ACCOUNT_URL"
))
.
url
(
propertiesUtil
.
getPropertyAsString
(
"COMPANY_ACCOUNT_URL"
))
.
get
()
.
get
()
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
.
build
();
Response
response
=
null
;
Response
response
=
null
;
String
resultStr
=
null
;
String
resultStr
=
null
;
try
{
try
{
response
=
client
.
newCall
(
request
).
execute
();
response
=
client
.
newCall
(
request
).
execute
();
resultStr
=
response
.
body
().
string
();
resultStr
=
response
.
body
().
string
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"调用公司账户授权信息接口失败"
,
e
);
throw
new
RuntimeException
(
"调用公司账户授权信息接口失败"
,
e
);
}
finally
{
}
finally
{
if
(
response
!=
null
)
{
if
(
response
!=
null
)
{
response
.
close
();
response
.
close
();
}
}
}
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
}
AccountResult
<
CompanyAccountInfo
>
companyAccountInfoResult
=
JSONObject
.
parseObject
(
resultStr
,
new
TypeReference
<
AccountResult
<
CompanyAccountInfo
>>(){});
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
if
(
companyAccountInfoResult
.
getSuccess
()!=
null
&&
companyAccountInfoResult
.
getSuccess
())
{
AccountResult
<
CompanyAccountInfo
>
companyAccountInfoResult
=
JSONObject
.
parseObject
(
resultStr
,
new
TypeReference
<
AccountResult
<
CompanyAccountInfo
>>()
{
List
<
CompanyAccountInfo
>
result
=
companyAccountInfoResult
.
getData
();
});
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
if
(
companyAccountInfoResult
.
getSuccess
()
!=
null
&&
companyAccountInfoResult
.
getSuccess
())
{
DcBaseCompanyAccountMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseCompanyAccountMapper
.
class
);
List
<
CompanyAccountInfo
>
result
=
companyAccountInfoResult
.
getData
();
DcBaseCompanyAccount
dcBaseCompanyAccount
=
new
DcBaseCompanyAccount
();
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
DcBaseCompanyAccountMapper
mapper
=
SessionUtil
.
getSession
().
getMapper
(
DcBaseCompanyAccountMapper
.
class
);
DcBaseCompanyAccount
dcBaseCompanyAccount
=
new
DcBaseCompanyAccount
();
try
{
try
{
// Add by Allan at 20200718
// Add by Allan at 20200718
mapper
.
updatesetstatusoff
();
mapper
.
updatesetstatusoff
();
for
(
CompanyAccountInfo
companyAccountInfo
:
result
)
{
for
(
CompanyAccountInfo
companyAccountInfo
:
result
)
{
BeanUtils
.
copyProperties
(
dcBaseCompanyAccount
,
companyAccountInfo
);
BeanUtils
.
copyProperties
(
dcBaseCompanyAccount
,
companyAccountInfo
);
dcBaseCompanyAccount
.
setBjModified
(
LocalDateTime
.
now
());
dcBaseCompanyAccount
.
setBjModified
(
LocalDateTime
.
now
());
int
i
=
mapper
.
updateByExampleSelective
(
dcBaseCompanyAccount
,
DcBaseCompanyAccountExample
.
newAndCreateCriteria
()
int
i
=
mapper
.
updateByExampleSelective
(
dcBaseCompanyAccount
,
DcBaseCompanyAccountExample
.
newAndCreateCriteria
()
.
andCompanyIdEqualTo
(
companyAccountInfo
.
getCompanyId
())
.
andCompanyIdEqualTo
(
companyAccountInfo
.
getCompanyId
())
.
andAccountIdEqualTo
(
companyAccountInfo
.
getAccountId
()).
example
());
.
andAccountIdEqualTo
(
companyAccountInfo
.
getAccountId
()).
example
());
if
(
i
==
0
)
{
if
(
i
==
0
)
{
mapper
.
insertSelective
(
dcBaseCompanyAccount
);
mapper
.
insertSelective
(
dcBaseCompanyAccount
);
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Mybatis操作DB失败"
,
e
);
}
finally
{
SessionUtil
.
closeSession
();
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"Mybatis操作DB失败"
,
e
);
}
finally
{
SessionUtil
.
closeSession
();
}
}
}
else
{
throw
new
RuntimeException
(
"调用公司账户授权信息接口返回错误"
);
}
}
log
.
info
(
"授权账户信息完成"
);
}
else
{
}
else
{
throw
new
RuntimeException
(
"调用公司账户授权信息接口返回
null
"
);
throw
new
RuntimeException
(
"调用公司账户授权信息接口返回
错误
"
);
}
}
}
else
{
throw
new
RuntimeException
(
"调用公司账户授权信息接口返回null"
);
}
}
}
}
}
data-base/base-sync-company/src/main/resources/const.properties
View file @
5c8b2561
#COMPANY_INFO_URL=http://sso.bailuntec.com/GetCompanys
#COMPANY_INFO_URL=http://sso.bailuntec.com/GetCompanys
#COMPANY_STAFF_URL=http://sso.bailuntec.com/GetUserByCompany
#COMPANY_STAFF_URL=http://sso.bailuntec.com/GetUserByCompany
#
COMPANY_ACCOUNT_URL=http://pams.bailuntec.com/Api/GetAccountToken
COMPANY_ACCOUNT_URL
=
http://pams.bailuntec.com/Api/GetAccountToken
COMPANY_INFO_URL
=
http://172.31.255.10/GetCompanys
COMPANY_INFO_URL
=
http://172.31.255.10/GetCompanys
COMPANY_STAFF_URL
=
http://172.31.255.10/GetUserByCompany
COMPANY_STAFF_URL
=
http://172.31.255.10/GetUserByCompany
COMPANY_ACCOUNT_URL
=
http://10.0.6.17:8090/Api/GetAccountToken
#
COMPANY_ACCOUNT_URL=http://10.0.6.17:8090/Api/GetAccountToken
PAYPAL_ACCOUNT_URL
=
http://pams.bailuntec.com/Api/GetPayPalAccounts
PAYPAL_ACCOUNT_URL
=
http://pams.bailuntec.com/Api/GetPayPalAccounts
data-base/base-sync-cost-first/src/main/java/com/bailuntec/job/SyncCostFirstJob.java
View file @
5c8b2561
...
@@ -124,7 +124,8 @@ public class SyncCostFirstJob extends PointJob {
...
@@ -124,7 +124,8 @@ public class SyncCostFirstJob extends PointJob {
DcBaseCostFirstExample
.
newAndCreateCriteria
()
DcBaseCostFirstExample
.
newAndCreateCriteria
()
.
andBailunSkuEqualTo
(
dcBaseCostFirst
.
getBailunSku
())
.
andBailunSkuEqualTo
(
dcBaseCostFirst
.
getBailunSku
())
.
andChannelOrderIdEqualTo
(
dcBaseCostFirst
.
getChannelOrderId
())
.
andChannelOrderIdEqualTo
(
dcBaseCostFirst
.
getChannelOrderId
())
.
andBoxIdEqualTo
(
dcBaseCostFirst
.
getBoxId
()).
andTransferOrderIdEqualTo
(
dcBaseCostFirst
.
getTransferOrderId
())
.
andBoxIdEqualTo
(
dcBaseCostFirst
.
getBoxId
())
.
andTransferOrderIdEqualTo
(
dcBaseCostFirst
.
getTransferOrderId
())
.
andWarehouseCodeEqualTo
(
dcBaseCostFirst
.
getWarehouseCode
())
.
andWarehouseCodeEqualTo
(
dcBaseCostFirst
.
getWarehouseCode
())
.
example
());
.
example
());
if
(
i
==
0
)
{
if
(
i
==
0
)
{
...
...
data-base/base-sync-cost-first/src/test/java/SyncCostFirstTest.java
View file @
5c8b2561
...
@@ -10,8 +10,8 @@ public class SyncCostFirstTest {
...
@@ -10,8 +10,8 @@ public class SyncCostFirstTest {
public
void
test
()
{
public
void
test
()
{
SyncCostFirstJob
syncCostFirstJob
=
new
SyncCostFirstJob
();
SyncCostFirstJob
syncCostFirstJob
=
new
SyncCostFirstJob
();
JobPointLog
jobPointLog
=
new
JobPointLog
(
"base-sync-cost-first"
,
1
,
1
,
1
,
1
,
JobPointLog
jobPointLog
=
new
JobPointLog
(
"base-sync-cost-first"
,
1
,
1
,
1
,
1
,
LocalDateTime
.
of
(
2020
,
8
,
14
,
9
,
0
,
0
),
LocalDateTime
.
of
(
2020
,
1
,
1
,
9
,
0
,
0
),
LocalDateTime
.
of
(
2020
,
8
,
17
,
13
,
0
,
0
));
LocalDateTime
.
of
(
2020
,
8
,
20
,
0
,
0
,
0
));
syncCostFirstJob
.
executeJob
(
null
,
jobPointLog
);
syncCostFirstJob
.
executeJob
(
null
,
jobPointLog
);
}
}
}
}
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