Authored by peuei

Merge branch 'dev_bigScreen_priceCurve' into test6.8.6

... ... @@ -6,6 +6,11 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PriceTrendMonthMapper {
List<PriceTrendModel> selectByProductId(@Param(value = "productId")Integer productId, @Param(value = "sizeId")Integer sizeId,
@Param(value = "startTime")Integer startTime, @Param(value = "endTime")Integer endTime);
List<PriceTrendModel> selectByProductIdAndSizeId(@Param(value = "productId") Integer productId,
@Param(value = "sizeId") Integer skuSizeId,
@Param(value = "limit") int i);
List<PriceTrendModel> selectByProductId(@Param(value = "productId") Integer productId, @Param(value = "sizeId") Integer sizeId,
@Param(value = "startTime") Integer startTime, @Param(value = "endTime") Integer endTime);
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.product.PriceTrendMonthMapper" >
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.PriceTrendModel" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="size_id" property="sizeId" jdbcType="INTEGER" />
<result column="skn_price" property="sknPrice" jdbcType="DECIMAL" />
<result column="sku_price" property="skuPrice" jdbcType="DECIMAL" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
<mapper namespace="com.yohoufo.dal.product.PriceTrendMonthMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.PriceTrendModel">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="product_id" property="productId" jdbcType="INTEGER"/>
<result column="size_id" property="sizeId" jdbcType="INTEGER"/>
<result column="skn_price" property="sknPrice" jdbcType="DECIMAL"/>
<result column="sku_price" property="skuPrice" jdbcType="DECIMAL"/>
<result column="create_time" property="createTime" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, product_id, size_id, skn_price, sku_price, create_time
</sql>
<select id="selectByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from price_trend_month
where product_id = #{productId, jdbcType=INTEGER}
<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}
<if test="sizeId == null or sizeId == ''">
GROUP BY product_id, create_time
</if>
ORDER BY create_time ASC
</select>
<select id="selectByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from price_trend_month
where product_id = #{productId, jdbcType=INTEGER}
<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}
<if test="sizeId == null or sizeId == ''">
GROUP BY product_id, create_time
</if>
ORDER BY create_time ASC
</select>
<select id="selectByProductIdAndSizeId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from price_trend_month
where product_id = #{productId, jdbcType=INTEGER}
and size_id = #{sizeId, jdbcType=INTEGER}
order by create_time asc
limit #{limit}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -506,6 +506,7 @@ public class ProductController {
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.shopScreen.skuPDetail")
// @Cachable(expire = 180)
public ApiResponse getSkuPDetailForShopsScreen(@RequestParam(value = "skuP") Integer skuP) {
if (skuP == null) {
LOG.info("in method=ufo.product.shopScreen.skuPDetail skuP is null");
... ... @@ -520,9 +521,9 @@ public class ProductController {
}
}
/**
* erp导入后同步
*
* @param imPrds
* @return
*/
... ... @@ -530,15 +531,15 @@ public class ProductController {
@IgnoreSignature
@IgnoreSession
@RequestMapping(value = "/erp/batchAdd", params = "method=ufo.product.batchAdd")
public Boolean batchAdd(List<ProductImportTranItemBo> imPrds){
public Boolean batchAdd(List<ProductImportTranItemBo> imPrds) {
LOG.info("in ufo.product.batchAdd imPrds {}", imPrds);
boolean result = true;
try{
try {
productBatchService.batchAdd(imPrds);
}catch (Exception ex){
} catch (Exception ex) {
LOG.warn("in ufo.product.batchAdd fail imPrds {}", imPrds);
result = false;
}finally {
} finally {
return result;
}
}
... ...
... ... @@ -78,6 +78,9 @@ public class ProductServiceImpl implements ProductService {
private PriceTrendSixtyDayMapper priceTrendSixtyDayMapper;
@Autowired
private PriceTrendMonthMapper priceTrendMonthMapper;
@Autowired
private SellerStoreMapUtil sellerStoreMapUtil;
@Override
... ... @@ -877,6 +880,8 @@ public class ProductServiceImpl implements ProductService {
private static final String GOODS_IMAGE_BUCKET = "goodsimg";
private static final Integer DEFAULT_LIMIT = 60;
public SkupDetailForScreenResp getSkuPDetailForShopsScreen(Integer skuP) {
// 结果集
SkupDetailForScreenResp result = new SkupDetailForScreenResp();
... ... @@ -1005,12 +1010,14 @@ public class ProductServiceImpl implements ProductService {
* 获取价格走势
*/
if (productId != null && skuSizeId != null) {
List<PriceTrendModel> priceTrendList = priceTrendSixtyDayMapper.selectByProductIdAndSizeId(productId, skuSizeId);
// List<PriceTrendModel> priceTrendList = priceTrendSixtyDayMapper.selectByProductIdAndSizeId(productId, skuSizeId);
List<PriceTrendModel> priceTrendList = priceTrendMonthMapper.selectByProductIdAndSizeId(productId, skuSizeId, DEFAULT_LIMIT);
// PriceTrendBO
List<PriceTrendBO> priceResultList = new ArrayList<>();
priceTrendList.stream().forEach(ele -> {
PriceTrendBO bo = new PriceTrendBO();
bo.setDate(DateUtil.getDateString(ele.getCreateTime(), DateUtil.YYYY_MM_DD_DOT));
bo.setDate(DateUtil.getDateString(ele.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
bo.setPrice(String.valueOf(ele.getSkuPrice()));
priceResultList.add(bo);
});
... ...