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
c3aba19e
Commit
c3aba19e
authored
Feb 05, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 更新
parent
302bb61d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
PurchaseDetailsServiceImpl.java
...in/java/com/bailuntec/job/PurchaseDetailsServiceImpl.java
+6
-6
const.properties
...se/base-sync-purchase/src/main/resources/const.properties
+2
-2
SyncPurchaseTest.java
...se/base-sync-purchase/src/test/java/SyncPurchaseTest.java
+10
-3
No files found.
data-base/base-sync-purchase/src/main/java/com/bailuntec/job/PurchaseDetailsServiceImpl.java
View file @
c3aba19e
...
...
@@ -27,6 +27,7 @@ import java.util.List;
public
class
PurchaseDetailsServiceImpl
{
private
static
PropertiesUtil
propertiesUtil
=
PropertiesUtil
.
getInstance
(
"const"
);
private
static
OkHttpClient
client
=
OkHttpUtil
.
getInstance
();
public
static
void
syncPurchaseDetails
(
JobPointLog
jobPointLog
)
{
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
LinkedHashMap
<
String
,
Object
>
map
=
new
LinkedHashMap
<>(
3
);
...
...
@@ -35,7 +36,7 @@ public class PurchaseDetailsServiceImpl {
map
.
put
(
"type"
,
jobPointLog
.
getType
());
map
.
put
(
"pagesize"
,
jobPointLog
.
getPageSize
());
do
{
map
.
put
(
"page"
,
jobPointLog
.
getPageIndex
()
>
0
?
jobPointLog
.
getPageIndex
()
:
1
);
map
.
put
(
"page"
,
jobPointLog
.
getPageIndex
()
>
0
?
jobPointLog
.
getPageIndex
()
:
1
);
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSON
.
toJSONString
(
map
));
String
purchaseStr
=
null
;
Response
response
=
null
;
...
...
@@ -90,7 +91,7 @@ public class PurchaseDetailsServiceImpl {
if
(
dcBasePurchaseSelected
!=
null
&&
dcBasePurchaseSelected
.
getParentId
()
<=
dcBasePurchase
.
getParentId
())
{
dcBasePurchase
.
setId
(
dcBasePurchaseSelected
.
getId
());
mapper1
.
updateByPrimaryKeySelective
(
dcBasePurchase
);
}
else
if
(
dcBasePurchaseSelected
==
null
){
}
else
if
(
dcBasePurchaseSelected
==
null
)
{
mapper1
.
insertSelective
(
dcBasePurchase
);
}
SessionUtil
.
getSession
().
commit
();
...
...
@@ -145,8 +146,7 @@ public class PurchaseDetailsServiceImpl {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"MYbatis操作DB失败"
,
e
);
}
finally
{
}
finally
{
SessionUtil
.
closeSession
();
}
}
...
...
@@ -201,10 +201,10 @@ public class PurchaseDetailsServiceImpl {
break
;
}
}
}
else
{
}
else
{
throw
new
RuntimeException
(
"调用采购单sku流水接口失败"
);
}
}
else
{
}
else
{
throw
new
RuntimeException
(
"调用采购单sku流水接口失败"
);
}
jobPointLog
.
setPageIndex
(
jobPointLog
.
getPageIndex
()
-
1
);
...
...
data-base/base-sync-purchase/src/main/resources/const.properties
View file @
c3aba19e
#
PURCHASE_DETAILS_URL=http://purchase.bailuntec.com/Api/GetPurchaseSkuForDataCenter
PURCHASE_DETAILS_URL
=
http://10.0.6.15:3333/Api/GetPurchaseSkuForDataCenter
PURCHASE_DETAILS_URL
=
http://purchase.bailuntec.com/Api/GetPurchaseSkuForDataCenter
#
PURCHASE_DETAILS_URL=http://10.0.6.15:3333/Api/GetPurchaseSkuForDataCenter
data-base/base-sync-purchase/src/test/java/SyncPurchaseTest.java
View file @
c3aba19e
import
com.bailuntec.domain.entity.JobPointLog
;
import
com.bailuntec.job.PurchaseDetailsServiceImpl
;
import
org.junit.jupiter.api.Test
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
public
class
SyncPurchaseTest
{
public
static
void
main
(
String
[]
args
)
{
@Test
public
void
test
()
{
JobPointLog
jobPointLog
=
new
JobPointLog
();
jobPointLog
.
setType
(
3
);
jobPointLog
.
setStartTime
(
LocalDateTime
.
parse
(
"20
19-02-21 16:50:14
"
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
jobPointLog
.
setEndTime
(
LocalDateTime
.
parse
(
"20
19-02-21 16:50:15
"
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
jobPointLog
.
setStartTime
(
LocalDateTime
.
parse
(
"20
20-12-11 20:50:10
"
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
jobPointLog
.
setEndTime
(
LocalDateTime
.
parse
(
"20
20-12-14 20:50:57
"
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
jobPointLog
.
setPageSize
(
1000
);
jobPointLog
.
setPageIndex
(
1
);
jobPointLog
.
setIntervalTime
(
1
);
PurchaseDetailsServiceImpl
.
syncPurchaseDetails
(
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