Authored by wujiexiang

统计添加更新时间

... ... @@ -16,4 +16,6 @@ public class SellerOrderStatsResult {
private int endTime;
//订单数量
private int quantity;
//更新时间
private int updateTime;
}
... ...
... ... @@ -8,9 +8,10 @@
<result column="begin_time" property="beginTime" jdbcType="INTEGER"/>
<result column="end_time" property="endTime" jdbcType="INTEGER"/>
<result column="quantity" property="quantity" jdbcType="INTEGER"/>
<result column="update_time" property="updateTime" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, stats_code, uid, begin_time, end_time, quantity
id, stats_code, uid, begin_time, end_time, quantity, update_time
</sql>
<select id="selectStatsResult" resultMap="BaseResultMap">
... ... @@ -25,9 +26,9 @@
</select>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.SellerOrderStatsResult">
insert into seller_order_stats_result (id, uid, stats_code,begin_time, end_time, quantity)
insert into seller_order_stats_result (id, uid, stats_code,begin_time, end_time, quantity, update_time)
values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=INTEGER}, #{statsCode,jdbcType=VARCHAR},
#{beginTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER})
ON DUPLICATE KEY UPDATE quantity = #{quantity,jdbcType=INTEGER} + quantity
#{beginTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER})
ON DUPLICATE KEY UPDATE quantity = #{quantity,jdbcType=INTEGER} + quantity,update_time = #{updateTime,jdbcType=INTEGER}
</insert>
</mapper>
\ No newline at end of file
... ...
... ... @@ -49,7 +49,7 @@ public class SellerOrderStatsConfigCacheService {
try {
List<SellerOrderStatsConfig> configs = sellerOrderStatsConfigMapper.selectEnabledStatsConfig();
if (CollectionUtils.isEmpty(configs)) {
logger.info("there is no seller order stats config");
logger.info("key {}, old value is {}, new value is empty", key, oldValue);
return Lists.newArrayList();
}
List<SellerOrderStatsConfiguration> configurations = new ArrayList<>(configs.size());
... ...
package com.yohoufo.order.service.stats.impl;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.SellerOrderStatsResultMapper;
import com.yohoufo.dal.order.model.SellerOrderStatsResult;
import com.yohoufo.order.model.bo.PlatformServiceFeeDefinition;
... ... @@ -40,6 +41,7 @@ public class SellerOrderQuantityStatsProcessor implements StatsProcessor<SellerO
quantityResult.setBeginTime(timeTuple.getKey());
quantityResult.setEndTime(timeTuple.getValue());
quantityResult.setQuantity(1);
quantityResult.setUpdateTime(DateUtil.getCurrentTimeSecond());
logger.info("[{}] db update seller order stats result:{}", entry.getSellerUid(), quantityResult);
//插入或更新
... ...