Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
task-kolon
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
piplus-v3
task-kolon
Commits
8b45c19a
Commit
8b45c19a
authored
Jun 06, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excel转换
parent
4353c979
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
40 deletions
+48
-40
KolonMemberDTO.java
src/main/java/com/hdp/pi/dto/kolon/KolonMemberDTO.java
+18
-11
KolonMemberServiceImpl.java
...java/com/hdp/pi/service/kolon/KolonMemberServiceImpl.java
+17
-28
FtpScheduledTask.java
src/main/java/com/hdp/pi/utils/kolon/FtpScheduledTask.java
+3
-1
Util.java
src/main/java/com/hdp/pi/utils/kolon/Util.java
+10
-0
No files found.
src/main/java/com/hdp/pi/dto/kolon/KolonMemberDTO.java
View file @
8b45c19a
...
@@ -2,7 +2,10 @@ package com.hdp.pi.dto.kolon;
...
@@ -2,7 +2,10 @@ package com.hdp.pi.dto.kolon;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
org.apache.commons.lang.StringUtils
;
import
com.hdp.pi.utils.kolon.CONSTANTS
;
import
com.hdp.pi.utils.kolon.CONSTANTS
;
import
com.hdp.pi.utils.kolon.Util
;
public
class
KolonMemberDTO
implements
Serializable
{
public
class
KolonMemberDTO
implements
Serializable
{
...
@@ -35,18 +38,22 @@ public class KolonMemberDTO implements Serializable {
...
@@ -35,18 +38,22 @@ public class KolonMemberDTO implements Serializable {
public
KolonMemberDTO
(){
public
KolonMemberDTO
(){
}
}
public
KolonMemberDTO
(
String
[]
s
)
{
public
KolonMemberDTO
(
String
[]
row
)
{
super
();
super
();
this
.
csNo
=
Long
.
valueOf
(
s
[
1
]);
this
.
csNo
=
Long
.
valueOf
(
Util
.
getByIndex
(
row
,
1
));
this
.
status
=
CONSTANTS
.
STATUS
.
get
(
s
[
2
]);
this
.
status
=
CONSTANTS
.
STATUS
.
get
(
Util
.
getByIndex
(
row
,
2
));
this
.
bonus
=
Integer
.
valueOf
(
s
[
3
]);
String
b_str
=
Util
.
getByIndex
(
row
,
3
);
this
.
cardNo
=
s
[
4
];
if
(
StringUtils
.
isNotEmpty
(
b_str
)){
this
.
lifecycle
=
s
[
5
];
this
.
bonus
=
Integer
.
valueOf
(
b_str
);
this
.
customerType
=
CONSTANTS
.
CUSTERMERTYPE
.
get
(
s
[
6
]);
}
this
.
lastName
=
s
[
7
];
this
.
cardNo
=
Util
.
getByIndex
(
row
,
4
);
this
.
firstName
=
s
[
8
];
this
.
lifecycle
=
Util
.
getByIndex
(
row
,
5
);
this
.
email
=
s
[
9
];
this
.
customerType
=
CONSTANTS
.
CUSTERMERTYPE
.
get
(
Util
.
getByIndex
(
row
,
6
));
this
.
phone
=
s
[
10
];
this
.
lastName
=
Util
.
getByIndex
(
row
,
7
);
this
.
firstName
=
Util
.
getByIndex
(
row
,
8
);
this
.
email
=
Util
.
getByIndex
(
row
,
9
);
this
.
phone
=
Util
.
getByIndex
(
row
,
10
);
this
.
wechatLastName
=
this
.
lastName
;
this
.
wechatLastName
=
this
.
lastName
;
this
.
wechatFirstName
=
this
.
firstName
;
this
.
wechatFirstName
=
this
.
firstName
;
}
}
...
...
src/main/java/com/hdp/pi/service/kolon/KolonMemberServiceImpl.java
View file @
8b45c19a
...
@@ -202,31 +202,20 @@ public class KolonMemberServiceImpl implements KolonMemberService {
...
@@ -202,31 +202,20 @@ public class KolonMemberServiceImpl implements KolonMemberService {
saleRepository
.
save
(
sale
);
saleRepository
.
save
(
sale
);
}
}
private
String
getByIndex
(
String
[]
row
,
int
index
){
if
(
row
==
null
){
return
""
;
}
if
(
index
<
0
||
index
>=
row
.
length
){
return
""
;
}
return
row
[
index
];
}
private
Product
newProduct
(
String
[]
row
){
private
Product
newProduct
(
String
[]
row
){
Product
p
=
new
Product
();
Product
p
=
new
Product
();
try
{
try
{
p
.
id
=
getByIndex
(
row
,
0
);
p
.
id
=
Util
.
getByIndex
(
row
,
0
);
p
.
title
=
getByIndex
(
row
,
1
);
p
.
title
=
Util
.
getByIndex
(
row
,
1
);
p
.
category
=
getByIndex
(
row
,
2
);
p
.
category
=
Util
.
getByIndex
(
row
,
2
);
p
.
image
=
getByIndex
(
row
,
3
);
p
.
image
=
Util
.
getByIndex
(
row
,
3
);
p
.
link
=
getByIndex
(
row
,
4
);
p
.
link
=
Util
.
getByIndex
(
row
,
4
);
p
.
avaliable
=
getByIndex
(
row
,
5
);
p
.
avaliable
=
Util
.
getByIndex
(
row
,
5
);
p
.
dept
=
getByIndex
(
row
,
6
);
p
.
dept
=
Util
.
getByIndex
(
row
,
6
);
p
.
seaons
=
getByIndex
(
row
,
7
);
p
.
seaons
=
Util
.
getByIndex
(
row
,
7
);
p
.
planyy
=
getByIndex
(
row
,
8
);
p
.
planyy
=
Util
.
getByIndex
(
row
,
8
);
p
.
color
=
getByIndex
(
row
,
9
);
p
.
color
=
Util
.
getByIndex
(
row
,
9
);
p
.
price
=
getByIndex
(
row
,
10
);
p
.
price
=
Util
.
getByIndex
(
row
,
10
);
}
catch
(
Throwable
e
){
}
catch
(
Throwable
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -236,12 +225,12 @@ public class KolonMemberServiceImpl implements KolonMemberService {
...
@@ -236,12 +225,12 @@ public class KolonMemberServiceImpl implements KolonMemberService {
private
Sale
newSale
(
String
[]
row
){
private
Sale
newSale
(
String
[]
row
){
Sale
s
=
new
Sale
();
Sale
s
=
new
Sale
();
try
{
try
{
s
.
oId
=
getByIndex
(
row
,
0
);
s
.
oId
=
Util
.
getByIndex
(
row
,
0
);
s
.
oDate
=
Integer
.
valueOf
(
getByIndex
(
row
,
1
));
s
.
oDate
=
Integer
.
valueOf
(
Util
.
getByIndex
(
row
,
1
));
s
.
customer
=
getByIndex
(
row
,
2
);
s
.
customer
=
Util
.
getByIndex
(
row
,
2
);
s
.
item
=
getByIndex
(
row
,
3
);
s
.
item
=
Util
.
getByIndex
(
row
,
3
);
s
.
quantity
=
Integer
.
valueOf
(
getByIndex
(
row
,
4
));
s
.
quantity
=
Integer
.
valueOf
(
Util
.
getByIndex
(
row
,
4
));
s
.
amount
=
Double
.
valueOf
(
getByIndex
(
row
,
5
));
s
.
amount
=
Double
.
valueOf
(
Util
.
getByIndex
(
row
,
5
));
}
catch
(
Throwable
e
){
}
catch
(
Throwable
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
src/main/java/com/hdp/pi/utils/kolon/FtpScheduledTask.java
View file @
8b45c19a
...
@@ -55,7 +55,9 @@ public class FtpScheduledTask {
...
@@ -55,7 +55,9 @@ public class FtpScheduledTask {
* 同步数据
* 同步数据
*/
*/
public
void
readCSVFile
()
{
public
void
readCSVFile
()
{
kolonMemberService
.
syncData
();
kolonMemberService
.
syncMemberData
();
kolonMemberService
.
syncProductData
();
kolonMemberService
.
syncSaleData
();
}
}
/**
/**
...
...
src/main/java/com/hdp/pi/utils/kolon/Util.java
View file @
8b45c19a
...
@@ -19,4 +19,14 @@ public class Util {
...
@@ -19,4 +19,14 @@ public class Util {
return
(
s
==
null
||
""
.
equals
(
s
))
?
false
:
true
;
return
(
s
==
null
||
""
.
equals
(
s
))
?
false
:
true
;
}
}
public
static
String
getByIndex
(
String
[]
row
,
int
index
){
if
(
row
==
null
){
return
""
;
}
if
(
index
<
0
||
index
>=
row
.
length
){
return
""
;
}
return
row
[
index
];
}
}
}
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