Toggle navigation
Toggle navigation
This project
Loading...
Sign in
yoho-search
/
yoho-search-consumer
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
wangnan
8 years ago
Commit
3ee6699a57d4b4b1ca1c9b20541af372532fe31c
1 parent
162e7ad8
fix
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
consumer/src/main/java/com/yoho/search/mq/ProductMqListener.java
consumer/src/main/java/com/yoho/search/mq/ProductPriceMqListener.java
consumer/src/main/java/com/yoho/search/mq/ProductMqListener.java
View file @
3ee6699
...
...
@@ -21,6 +21,7 @@ import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -120,10 +121,10 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
int
dateCount
=
DateUtil
.
getIntervalDays
(
now
,
shelve_time
);
if
(
dateCount
<=
7
)
{
//计算折扣
DecimalFormat
df
=
new
DecimalFormat
(
"0.0"
);
String
str
=
df
.
format
(
productPrice
.
getSalesPrice
().
divide
(
productPrice
.
getMarketPrice
(),
1
));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
String
str
=
df
.
format
(
productPrice
.
getSalesPrice
().
divide
(
productPrice
.
getMarketPrice
(),
2
,
RoundingMode
.
DOWN
));
Double
discount
=
Double
.
valueOf
(
str
);
if
(
discount
<
0.88
)
if
(
discount
<
=
0.88
)
productI
.
setIsnew
(
"Y"
);
}
}
...
...
consumer/src/main/java/com/yoho/search/mq/ProductPriceMqListener.java
View file @
3ee6699
...
...
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.*
;
...
...
@@ -172,10 +173,10 @@ public class ProductPriceMqListener extends AbstractMqListener implements Channe
int
dateCount
=
DateUtil
.
getIntervalDays
(
now
,
shelve_time
);
if
(
dateCount
<=
7
)
{
//计算折扣
DecimalFormat
df
=
new
DecimalFormat
(
"0.0"
);
String
str
=
df
.
format
(
productPrice
.
getSalesPrice
().
divide
(
productPrice
.
getMarketPrice
(),
1
));
DecimalFormat
df
=
new
DecimalFormat
(
"0.00"
);
String
str
=
df
.
format
(
productPrice
.
getSalesPrice
().
divide
(
productPrice
.
getMarketPrice
(),
2
,
RoundingMode
.
DOWN
));
Double
discount
=
Double
.
valueOf
(
str
);
if
(
discount
<
0.88
)
if
(
discount
<
=
0.88
)
indexData
.
put
(
"isnew"
,
"Y"
);
}
}
...
...
Please
register
or
login
to post a comment