Showing
9 changed files
with
14 additions
and
14 deletions
@@ -20,8 +20,8 @@ | @@ -20,8 +20,8 @@ | ||
20 | <if test="sizeId != null and sizeId !=''"> | 20 | <if test="sizeId != null and sizeId !=''"> |
21 | AND size_id = #{sizeId, jdbcType=INTEGER} | 21 | AND size_id = #{sizeId, jdbcType=INTEGER} |
22 | </if> | 22 | </if> |
23 | - AND create_time >= #{startTime, jdbcType=INTEGER} | ||
24 | - AND create_time < #{endTime, jdbcType=INTEGER} | 23 | + AND create_time > #{startTime, jdbcType=INTEGER} |
24 | + AND create_time <= #{endTime, jdbcType=INTEGER} | ||
25 | <if test="sizeId == null or sizeId == ''"> | 25 | <if test="sizeId == null or sizeId == ''"> |
26 | GROUP BY product_id, create_time | 26 | GROUP BY product_id, create_time |
27 | </if> | 27 | </if> |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | AND size_id = #{sizeId, jdbcType=INTEGER} | 22 | AND size_id = #{sizeId, jdbcType=INTEGER} |
23 | </if> | 23 | </if> |
24 | AND create_time >= #{startTime, jdbcType=INTEGER} | 24 | AND create_time >= #{startTime, jdbcType=INTEGER} |
25 | - AND create_time < #{endTime, jdbcType=INTEGER} | 25 | + AND create_time <= #{endTime, jdbcType=INTEGER} |
26 | <if test="sizeId == null or sizeId == ''"> | 26 | <if test="sizeId == null or sizeId == ''"> |
27 | GROUP BY product_id, create_time | 27 | GROUP BY product_id, create_time |
28 | </if> | 28 | </if> |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | AND size_id = #{sizeId, jdbcType=INTEGER} | 22 | AND size_id = #{sizeId, jdbcType=INTEGER} |
23 | </if> | 23 | </if> |
24 | AND create_time >= #{startTime, jdbcType=INTEGER} | 24 | AND create_time >= #{startTime, jdbcType=INTEGER} |
25 | - AND create_time < #{endTime, jdbcType=INTEGER} | 25 | + AND create_time <= #{endTime, jdbcType=INTEGER} |
26 | <if test="sizeId == null or sizeId == ''"> | 26 | <if test="sizeId == null or sizeId == ''"> |
27 | GROUP BY product_id, create_time | 27 | GROUP BY product_id, create_time |
28 | </if> | 28 | </if> |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | AND size_id = #{sizeId, jdbcType=INTEGER} | 23 | AND size_id = #{sizeId, jdbcType=INTEGER} |
24 | </if> | 24 | </if> |
25 | AND create_time >= #{startTime, jdbcType=INTEGER} | 25 | AND create_time >= #{startTime, jdbcType=INTEGER} |
26 | - AND create_time < #{endTime, jdbcType=INTEGER} | 26 | + AND create_time <= #{endTime, jdbcType=INTEGER} |
27 | <if test="sizeId == null or sizeId == ''"> | 27 | <if test="sizeId == null or sizeId == ''"> |
28 | GROUP BY product_id, create_time | 28 | GROUP BY product_id, create_time |
29 | </if> | 29 | </if> |
@@ -7,6 +7,7 @@ import com.yohoufo.common.ApiResponse; | @@ -7,6 +7,7 @@ import com.yohoufo.common.ApiResponse; | ||
7 | import com.yohoufo.common.annotation.IgnoreSession; | 7 | import com.yohoufo.common.annotation.IgnoreSession; |
8 | import com.yohoufo.common.annotation.IgnoreSignature; | 8 | import com.yohoufo.common.annotation.IgnoreSignature; |
9 | import com.yohoufo.common.cache.Cachable; | 9 | import com.yohoufo.common.cache.Cachable; |
10 | +import com.yohoufo.common.utils.DateUtil; | ||
10 | import com.yohoufo.product.model.PriceTrendResp; | 11 | import com.yohoufo.product.model.PriceTrendResp; |
11 | import com.yohoufo.product.service.impl.ProductPriceService; | 12 | import com.yohoufo.product.service.impl.ProductPriceService; |
12 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
@@ -38,7 +39,7 @@ public class ProductPriceController { | @@ -38,7 +39,7 @@ public class ProductPriceController { | ||
38 | @RequestParam(value = "trend_type")Integer trendType) { | 39 | @RequestParam(value = "trend_type")Integer trendType) { |
39 | LOG.info("in method=ufo.product.priceTrend product_id={}, size_id is {}, trend_type is {}", productId, sizeId, trendType); | 40 | LOG.info("in method=ufo.product.priceTrend product_id={}, size_id is {}, trend_type is {}", productId, sizeId, trendType); |
40 | List<PriceTrendResp> resp = productPriceService.queryProductPriceTrend(productId, sizeId, trendType); | 41 | List<PriceTrendResp> resp = productPriceService.queryProductPriceTrend(productId, sizeId, trendType); |
41 | - return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); | 42 | + return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message(DateUtil.getDate(DateUtil.yyyy_MM_dd_HH_mm_SS)).build(); |
42 | } | 43 | } |
43 | 44 | ||
44 | @ApiOperation(name = "ufo.product.sizes", desc="商品的尺码列表") | 45 | @ApiOperation(name = "ufo.product.sizes", desc="商品的尺码列表") |
@@ -24,12 +24,11 @@ public class PriceTrendDayService implements PriceTrendServiceInf{ | @@ -24,12 +24,11 @@ public class PriceTrendDayService implements PriceTrendServiceInf{ | ||
24 | 24 | ||
25 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { | 25 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { |
26 | if (null != productId) { | 26 | if (null != productId) { |
27 | - int currentSecond = DateUtil.getTimeSecondOfDay(0); | ||
28 | - int tomorrowSecond = DateUtil.getTimeSecondOfDay(1); | 27 | + int currentSecond = DateUtil.getCurrentTimeSecond(); |
29 | 28 | ||
30 | - LOG.info("method priceTrendDayMapper.selectByProductId in, productId:{},sizeId:{},currentSecond:{},tomorrowSecond:{}", productId, sizeId, currentSecond, tomorrowSecond); | 29 | + LOG.info("method priceTrendDayMapper.selectByProductId in, productId:{},sizeId:{},currentSecond:{}", productId, sizeId, currentSecond); |
31 | 30 | ||
32 | - List<PriceTrendModel> priceTrendModels = priceTrendDayMapper.selectByProductId(productId, sizeId, currentSecond, tomorrowSecond); | 31 | + List<PriceTrendModel> priceTrendModels = priceTrendDayMapper.selectByProductId(productId, sizeId, currentSecond - 86400, currentSecond); |
33 | 32 | ||
34 | priceTrendModels.stream().forEach(item -> { | 33 | priceTrendModels.stream().forEach(item -> { |
35 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); | 34 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); |
@@ -30,8 +30,8 @@ public class PriceTrendHalfYearService implements PriceTrendServiceInf{ | @@ -30,8 +30,8 @@ public class PriceTrendHalfYearService implements PriceTrendServiceInf{ | ||
30 | // 180天(最小颗粒度:3天); | 30 | // 180天(最小颗粒度:3天); |
31 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { | 31 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { |
32 | if (null != productId) { | 32 | if (null != productId) { |
33 | - int timeSecondOfHalfYear = DateUtil.getTimeSecondOfDay(-180); | ||
34 | - List<PriceTrendModel> priceTrendModels = priceTrendHalfYearMapper.selectByProductId(productId, sizeId, timeSecondOfHalfYear, DateUtil.getTimeSecondOfDay(0)); | 33 | + int timeSecondOfHalfYear = DateUtil.getTimeSecondOfDay(-179); |
34 | + List<PriceTrendModel> priceTrendModels = priceTrendHalfYearMapper.selectByProductId(productId, sizeId, timeSecondOfHalfYear, DateUtil.getCurrentTimeSecond()); | ||
35 | 35 | ||
36 | //List<PriceTrendModel> completeResult = compeleteZeroPrice(priceTrendModels, timeSecondOfHalfYear, productId, sizeId); | 36 | //List<PriceTrendModel> completeResult = compeleteZeroPrice(priceTrendModels, timeSecondOfHalfYear, productId, sizeId); |
37 | 37 |
@@ -21,7 +21,7 @@ public class PriceTrendMonthService implements PriceTrendServiceInf{ | @@ -21,7 +21,7 @@ public class PriceTrendMonthService implements PriceTrendServiceInf{ | ||
21 | 21 | ||
22 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { | 22 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { |
23 | if (null != productId) { | 23 | if (null != productId) { |
24 | - List<PriceTrendModel> priceTrendModels = priceTrendMonthMapper.selectByProductId(productId, sizeId, DateUtil.getTimeSecondOfDay(-30), DateUtil.getTimeSecondOfDay(0)); | 24 | + List<PriceTrendModel> priceTrendModels = priceTrendMonthMapper.selectByProductId(productId, sizeId, DateUtil.getTimeSecondOfDay(-29), DateUtil.getCurrentTimeSecond()); |
25 | 25 | ||
26 | priceTrendModels.stream().forEach(item -> { | 26 | priceTrendModels.stream().forEach(item -> { |
27 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); | 27 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); |
@@ -19,7 +19,7 @@ public class PriceTrendSixtyDayService implements PriceTrendServiceInf{ | @@ -19,7 +19,7 @@ public class PriceTrendSixtyDayService implements PriceTrendServiceInf{ | ||
19 | 19 | ||
20 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { | 20 | public List<PriceTrendModel> queryProductPriceTrend(Integer productId, Integer sizeId) { |
21 | if (null != productId) { | 21 | if (null != productId) { |
22 | - List<PriceTrendModel> priceTrendModels = priceTrendSixtyDayMapper.selectByProductId(productId, sizeId, DateUtil.getTimeSecondOfDay(-60), DateUtil.getTimeSecondOfDay(0)); | 22 | + List<PriceTrendModel> priceTrendModels = priceTrendSixtyDayMapper.selectByProductId(productId, sizeId, DateUtil.getTimeSecondOfDay(-59), DateUtil.getCurrentTimeSecond()); |
23 | priceTrendModels.stream().forEach(item -> { | 23 | priceTrendModels.stream().forEach(item -> { |
24 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); | 24 | item.setEndTime(null == item.getCreateTime() ? null : item.getCreateTime()); |
25 | item.setStartTime(null == item.getCreateTime() ? null : item.getCreateTime() - 86400); | 25 | item.setStartTime(null == item.getCreateTime() ? null : item.getCreateTime() - 86400); |
-
Please register or login to post a comment