Authored by mali

价格走势

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