Authored by saihide

bigdata monitor

Showing 24 changed files with 355 additions and 1 deletions
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.BigdataSknPricearea;
import org.apache.ibatis.annotations.Param;
... ... @@ -11,4 +12,6 @@ public interface BigdataSknPriceareaMapper {
List<BigdataSknPricearea> selectListByDateId(@Param(value = "list") List<Integer> skns, @Param(value = "dateId") Integer dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.BigdataSortBrandVector;
import org.apache.ibatis.annotations.Param;
... ... @@ -11,4 +12,6 @@ public interface BigdataSortBrandVectorMapper {
List<BigdataSortBrandVector> selectPageLists(@Param(value="start")Integer start, @Param(value="limit")Integer limit);
List<BigdataMonitor> selectCountGroupByDateId();
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.Product15DaySalesNum;
import com.yoho.search.dal.model.Product15DaySalesNumKey;
import org.apache.ibatis.annotations.Param;
... ... @@ -23,4 +24,7 @@ public interface Product15DaySalesNumMapper {
Integer selectLatestDateId();
List<Product15DaySalesNum> selectSalesNumOfLatestDate(@Param(value="skns")List<Integer> skns, @Param(value="dateid")Integer dateid);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.ProductHeatValues;
import org.apache.ibatis.annotations.Param;
... ... @@ -16,4 +17,7 @@ public interface ProductHeatValuesMapper {
List<Long> selectSknByDate(@Param(value = "dateId") String dateId, @Param(value = "pageSize") int pageSize);
void deleteBatch(@Param(value = "sknList") List<Long> sknList, @Param(value = "dateId") String dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.ProductHeatValues;
import org.apache.ibatis.annotations.Param;
... ... @@ -16,4 +17,7 @@ public interface ProductHeatValuesOneDayMapper {
List<Long> selectSknByDate(@Param(value = "dateId") String dateId, @Param(value = "pageSize") int pageSize);
void deleteBatch(@Param(value = "sknList") List<Long> sknList, @Param(value = "dateId") String dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.ProductModelValue;
import org.apache.ibatis.annotations.Param;
... ... @@ -21,4 +22,7 @@ public interface ProductModelValueMapper {
List<Long> selectSknByDate(@Param(value = "dateId") String dateId, @Param(value = "pageSize") int pageSize);
void deleteBatch(@Param(value = "sknList") List<Long> sknList,@Param(value = "dateId") String dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.ProductSalesInfo;
import org.apache.ibatis.annotations.Param;
... ... @@ -14,4 +15,7 @@ public interface ProductSalesInfoMapper {
List<Long> selectSknByDate(@Param(value = "dateId") String dateId, @Param(value = "pageSize") int pageSize);
void deleteBatch(@Param(value = "sknList") List<Long> sknList,@Param(value = "dateId") String dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.ProductVectorFeature;
import org.apache.ibatis.annotations.Param;
... ... @@ -19,4 +20,7 @@ public interface ProductVectorFeatureMapper {
void deleteBatch(List<Long> idList);
void insertBatch(List<ProductVectorFeature> productVectorFeatureList);
List<BigdataMonitor> selectCountGroupByDateId();
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.SimilarSkn;
import org.apache.ibatis.annotations.Param;
... ... @@ -15,5 +16,5 @@ public interface SimilarSknMapper {
void deleteBatchByDateId(@Param(value = "dateId") Integer dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.BigdataMonitor;
import com.yoho.search.dal.model.SknFlow;
import org.apache.ibatis.annotations.Param;
... ... @@ -23,4 +24,7 @@ public interface SknFlowMapper {
List<Long> selectSknByDate(@Param(value = "dateId") String dateId, @Param(value = "pageSize") int pageSize);
void deleteBatch(@Param(value = "sknList") List<Long> sknList,@Param(value = "dateId") String dateId);
List<BigdataMonitor> selectCountGroupByDateId();
}
\ No newline at end of file
... ...
package com.yoho.search.dal.model;
public class BigdataMonitor {
private String dateId;
private Integer num;
private Integer flowType;
public String getDateId() {
return dateId;
}
public void setDateId(String dateId) {
this.dateId = dateId;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
public Integer getFlowType() {
return flowType;
}
public void setFlowType(Integer flowType) {
this.flowType = flowType;
}
}
... ...
... ... @@ -7,6 +7,12 @@
<result column="price_area" property="priceArea" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
product_skn, date_id, price_area, create_time
</sql>
... ... @@ -25,4 +31,8 @@
</foreach>
and date_id = #{dateId,jdbcType=INTEGER}
</select>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM bigdata_skn_pricearea GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -8,6 +8,10 @@
<result column="update_time" property="updateTime" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
brand_id, middle_sort_id, vector, update_time
</sql>
... ... @@ -20,4 +24,8 @@
select <include refid="Base_Column_List" /> from bigdata_sort_brand_vector limit #{start}, #{limit}
</select>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT count(*) num FROM bigdata_sort_brand_vector
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -6,6 +6,10 @@
<id column="date_id" property="dateId" jdbcType="INTEGER" />
<result column="sales_num" property="salesNum" jdbcType="INTEGER" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, sales_num
</sql>
... ... @@ -66,4 +70,7 @@
<select id="selectLatestDateId" resultType="java.lang.Integer">
select max(date_id) from product_15day_salesnum
</select>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM product_15day_salesnum GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -16,6 +16,11 @@
<result column="last_update_time" property="lastUpdateTime" jdbcType="INTEGER" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, shareorder_num, sale_num, cart_num, favorite_num, comments_score,
ctr_value, sale_amount, profit_amount, last_update_time
... ... @@ -62,4 +67,8 @@
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM product_heat_values GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -16,6 +16,11 @@
<result column="last_update_time" property="lastUpdateTime" jdbcType="INTEGER" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, shareorder_num, sale_num, cart_num, favorite_num, comments_score,
ctr_value, sale_amount, profit_amount, last_update_time
... ... @@ -62,4 +67,8 @@
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM product_heat_values_oneday GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -10,6 +10,12 @@
<result column="profit_value" property="profitValue" jdbcType="INTEGER" />
<result column="last_update_time" property="lastUpdateTime" jdbcType="INTEGER" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, active_value, transfer_value, give_value, profit_value, last_update_time
</sql>
... ... @@ -88,4 +94,8 @@
#{item}
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM product_model_value GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -6,6 +6,11 @@
<result column="date_id" property="dateId" jdbcType="INTEGER" />
<result column="sevenday_money" property="sevendayMoney" jdbcType="DECIMAL" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, sevenday_money
</sql>
... ... @@ -42,4 +47,8 @@
#{item}
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM product_sales_info GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -7,6 +7,11 @@
<result column="generate_date" property="generateDate" jdbcType="VARCHAR"/>
<result column="feature_value" property="featureValue" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="generate_date" property="dateId" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, product_skn, generate_date, feature_value
</sql>
... ... @@ -47,4 +52,7 @@
#{item}
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT generate_date, count(*) num FROM product_vector_feature GROUP BY generate_date ORDER BY generate_date desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -14,6 +14,11 @@
<result column="create_time" property="createTime" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
product_skn, date_id, same_shop_action_similar_skns, diff_shop_action_similar_skns, same_shop_img_similar_skns, diff_shop_img_similar_skns, same_shop_collocation_skns, diff_shop_collocation_skns, create_time
</sql>
... ... @@ -34,4 +39,7 @@
DELETE FROM bigdata_similar_skn WHERE date_id = #{dateId}
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
SELECT date_id, count(*) num FROM bigdata_similar_skn GROUP BY date_id ORDER BY date_id desc LIMIT 3
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -7,6 +7,13 @@
<result column="flow_type" property="flowType" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<resultMap id="MonitorResultMap" type="com.yoho.search.dal.model.BigdataMonitor">
<result column="date_id" property="dateId" jdbcType="VARCHAR"/>
<result column="flow_type" property="flowType" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List" >
product_skn, date_id, flow_type, create_time
</sql>
... ... @@ -75,4 +82,7 @@
#{item}
</foreach>
</delete>
<select id="selectCountGroupByDateId" resultMap="MonitorResultMap">
select date_id,flow_type,count(*) num from skn_flow group by date_id,flow_type order by date_id desc limit 6;
</select>
</mapper>
\ No newline at end of file
... ...
/**
* Copyright (C) 2006-2015 Tuniu All rights reserved
*/
package com.yoho.search.consumer.common;
public class ApiResponse<T> {
private String message;
private int code;
private T data;
public static <T> ApiResponse<T> create(int code, T data) {
ApiResponse<T> rsp = new ApiResponse<>();
rsp.setMessage("success");
rsp.setCode(code);
rsp.setData(data);
return rsp;
}
public void setup(String message, int code, T data) {
this.setMessage(message);
this.setCode(code);
this.setData(data);
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
... ...
package com.yoho.search.consumer.index.common;
import com.yoho.search.consumer.common.ApiResponse;
import com.yoho.search.dal.*;
import com.yoho.search.dal.model.BigdataMonitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class BigdataMonitorService {
@Autowired
private SimilarSknMapper similarSknMapper;
@Autowired
private BigdataSknPriceareaMapper bigdataSknPriceareaMapper;
@Autowired
private BigdataSortBrandVectorMapper bigdataSortBrandVectorMapper;
@Autowired
private Product15DaySalesNumMapper product15DaySalesNumMapper;
@Autowired
private ProductSalesInfoMapper productSalesInfoMapper;
@Autowired
private ProductHeatValuesMapper productHeatValuesMapper;
@Autowired
private ProductHeatValuesOneDayMapper productHeatValuesOneDayMapper;
@Autowired
private SknFlowMapper sknFlowMapper;
@Autowired
private ProductVectorFeatureMapper productVectorFeatureMapper;
@Autowired
private ProductModelValueMapper productModelValueMapper;
private static final int SIMILAR_SKN_THRESHOLD = 1;
private static final int SKN_PRICEAREA_THRESHOLD = 1;
private static final int SORTBRAND_VECTOR_THRESHOLD = 1;
private static final int PRODUCT15DAY_SALESUM_THRESHOLD = 1;
private static final int PRODUCT_SALESINFO_THRESHOLD = 1;
private static final int PRODUCTHEAT_VALUES_THRESHOLD = 1;
private static final int PRODUCTHEATVALUES_ONEDAY_THRESHOLD = 1;
private static final int SKN_FLOW_THRESHOLD = 1;
private static final int PRODUCTVECTOR_FEATURE_THRESHOLD = 1;
private static final int PRODUCTMODEL_VALUE_THRESHOLD = 1;
public ApiResponse similarSkn() {
List<BigdataMonitor> result = similarSknMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse sknPricearea() {
List<BigdataMonitor> result = bigdataSknPriceareaMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse sortBrandVector() {
List<BigdataMonitor> result = bigdataSortBrandVectorMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse product15daySalesnum() {
List<BigdataMonitor> result = product15DaySalesNumMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse productSalesInfo() {
List<BigdataMonitor> result = productSalesInfoMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse productHeatValues() {
List<BigdataMonitor> result = productHeatValuesMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse productHeatValuesOneday() {
List<BigdataMonitor> result = productHeatValuesOneDayMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse sknFlow() {
List<BigdataMonitor> result = sknFlowMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result);
}
public ApiResponse productVectorFeature() {
List<BigdataMonitor> result = productVectorFeatureMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
public ApiResponse productModelValue() {
List<BigdataMonitor> result = productModelValueMapper.selectCountGroupByDateId();
return ApiResponse.create(200, result.get(0));
}
}
... ...
package com.yoho.search.consumer.restapi;
import com.yoho.search.consumer.common.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/bigdataMonitor")
public class BigdataMonitorController {
@RequestMapping(value = "/similarSkn")
public ApiResponse similarSkn() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/sknPricearea")
public ApiResponse sknPricearea() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/sortBrandVector")
public ApiResponse sortBrandVector() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/product15daySalesnum")
public ApiResponse product15daySalesnum() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/productSalesInfo")
public ApiResponse productSalesInfo() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/productHeatValues")
public ApiResponse productHeatValues() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/productHeatValuesOneday")
public ApiResponse productHeatValuesOneday() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/sknFlow")
public ApiResponse sknFlow() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/productVectorFeature")
public ApiResponse productVectorFeature() {
return ApiResponse.create(200, null);
}
@RequestMapping(value = "/productModelValue")
public ApiResponse productModelValue() {
return ApiResponse.create(200, null);
}
}
... ...