专题数据统计
Showing
48 changed files
with
141 additions
and
1187 deletions
| 1 | package com.topdraw.business.config; | ||
| 2 | |||
| 3 | public class Constant { | ||
| 4 | |||
| 5 | public final String SUBJECT_PV = "SUBJECT_PV"; | ||
| 6 | public final String SUBJECT_UV = "SUBJECT_UV"; | ||
| 7 | |||
| 8 | public final String SUBJECT_BTN_CLICK_PV = "SUBJECT_BTN_CLICK_PV"; | ||
| 9 | public final String SUBJECT_BTN_CLICK_UV = "SUBJECT_BTN_CLICK_UV"; | ||
| 10 | |||
| 11 | } |
| ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; | ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_tpl_param_click") | 23 | @Table(name="sub_tpl_param_click") |
| 24 | public class ActTplParamClick implements Serializable { | 24 | public class ActTplParamClick implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,12 @@ public class ActTplParamClick implements Serializable { | ... | @@ -29,13 +29,12 @@ public class ActTplParamClick implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | // subject id |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | @Column(name = "subject_id", nullable = false) |
| 34 | private Long marketingActivityId; | 34 | private Long subjectId; |
| 35 | 35 | ||
| 36 | // 活动事件id | 36 | @Column(name = "subject_code", nullable = false) |
| 37 | @Column(name = "activity_id", nullable = false) | 37 | private String subjectCode; |
| 38 | private Long activityId; | ||
| 39 | 38 | ||
| 40 | // 活动按钮id | 39 | // 活动按钮id |
| 41 | @Column(name = "template_param_value_id", nullable = false) | 40 | @Column(name = "template_param_value_id", nullable = false) |
| ... | @@ -53,6 +52,12 @@ public class ActTplParamClick implements Serializable { | ... | @@ -53,6 +52,12 @@ public class ActTplParamClick implements Serializable { |
| 53 | @Column(name = "uv", nullable = false) | 52 | @Column(name = "uv", nullable = false) |
| 54 | private Integer uv; | 53 | private Integer uv; |
| 55 | 54 | ||
| 55 | @Column(name = "lp_id") | ||
| 56 | private Long lpId; | ||
| 57 | |||
| 58 | @Column(name = "site_id") | ||
| 59 | private Long siteId; | ||
| 60 | |||
| 56 | // 创建时间 | 61 | // 创建时间 |
| 57 | @CreatedDate | 62 | @CreatedDate |
| 58 | @Column(name = "create_time") | 63 | @Column(name = "create_time") | ... | ... |
| ... | @@ -12,5 +12,5 @@ import java.util.Optional; | ... | @@ -12,5 +12,5 @@ import java.util.Optional; |
| 12 | */ | 12 | */ |
| 13 | public interface ActivityBtnPvUvRepository extends JpaRepository<ActTplParamClick, Long>, JpaSpecificationExecutor<ActTplParamClick> { | 13 | public interface ActivityBtnPvUvRepository extends JpaRepository<ActTplParamClick, Long>, JpaSpecificationExecutor<ActTplParamClick> { |
| 14 | 14 | ||
| 15 | Optional<ActTplParamClick> findByMarketingActivityIdAndActivityIdAndTemplateParamValueId(Long marketingActivityId, Long activityId, Long templateParamValueId); | 15 | Optional<ActTplParamClick> findBySubjectIdAndTemplateParamValueId(Long subjectId, Long templateParamValueId); |
| 16 | } | 16 | } | ... | ... |
| ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvService { | ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvService { |
| 12 | 12 | ||
| 13 | void update(ActTplParamClick resources); | 13 | void update(ActTplParamClick resources); |
| 14 | 14 | ||
| 15 | ActTplParamClick findByMarketingActivityIdAndActivityIdAndTemplateParamValueId(Long marketingActivityId, Long activityId, Long templateParamValueId); | 15 | ActTplParamClick findBySubjectIdAndTemplateParamValueId(Long subjectId, Long templateParamValueId); |
| 16 | } | 16 | } | ... | ... |
| 1 | package com.topdraw.business.module.activitybtn.all.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import javax.persistence.Column; | ||
| 6 | import java.io.Serializable; | ||
| 7 | import java.sql.Timestamp; | ||
| 8 | |||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-02-26 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class ActTplParamClickDTO implements Serializable { | ||
| 16 | |||
| 17 | // ID | ||
| 18 | private Long id; | ||
| 19 | |||
| 20 | // 营销活动ID | ||
| 21 | private Long marketingActivityId; | ||
| 22 | |||
| 23 | // 活动事件id | ||
| 24 | private Long activityId; | ||
| 25 | |||
| 26 | // 活动按钮id | ||
| 27 | private Long templateParamValueId; | ||
| 28 | |||
| 29 | // 显示用名称,表示哪个按钮或者内容 | ||
| 30 | private String name; | ||
| 31 | |||
| 32 | // pv值 | ||
| 33 | private Long pv; | ||
| 34 | |||
| 35 | // uv值 | ||
| 36 | private Long uv; | ||
| 37 | |||
| 38 | // 创建时间 | ||
| 39 | private Timestamp createTime; | ||
| 40 | |||
| 41 | // 更新时间 | ||
| 42 | private Timestamp updateTime; | ||
| 43 | } |
| ... | @@ -36,8 +36,8 @@ public class ActivityBtnPvUvServiceImpl implements ActivityBtnPvUvService { | ... | @@ -36,8 +36,8 @@ public class ActivityBtnPvUvServiceImpl implements ActivityBtnPvUvService { |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | @Override | 38 | @Override |
| 39 | public ActTplParamClick findByMarketingActivityIdAndActivityIdAndTemplateParamValueId(Long marketingActivityId, Long activityId, Long templateParamValueId) { | 39 | public ActTplParamClick findBySubjectIdAndTemplateParamValueId(Long subjectId, Long templateParamValueId) { |
| 40 | return PvUvRepository.findByMarketingActivityIdAndActivityIdAndTemplateParamValueId(marketingActivityId, activityId, templateParamValueId).orElseGet(ActTplParamClick::new); | 40 | return PvUvRepository.findBySubjectIdAndTemplateParamValueId(subjectId, templateParamValueId).orElseGet(ActTplParamClick::new); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | } | 43 | } | ... | ... |
| ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; | ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_tpl_param_click_day") | 23 | @Table(name="sub_tpl_param_click_day") |
| 24 | public class ActTplParamClickDay implements Serializable { | 24 | public class ActTplParamClickDay implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,13 @@ public class ActTplParamClickDay implements Serializable { | ... | @@ -29,13 +29,13 @@ public class ActTplParamClickDay implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | // subject id |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | @Column(name = "subject_id", nullable = false) |
| 34 | private Long marketingActivityId; | 34 | private Long subjectId; |
| 35 | |||
| 36 | @Column(name = "subject_code", nullable = false) | ||
| 37 | private String subjectCode; | ||
| 35 | 38 | ||
| 36 | // 活动事件id | ||
| 37 | @Column(name = "activity_id", nullable = false) | ||
| 38 | private Long activityId; | ||
| 39 | 39 | ||
| 40 | // 显示用名称,表示哪个按钮或者内容 | 40 | // 显示用名称,表示哪个按钮或者内容 |
| 41 | @Column(name = "name", nullable = false) | 41 | @Column(name = "name", nullable = false) |
| ... | @@ -57,6 +57,12 @@ public class ActTplParamClickDay implements Serializable { | ... | @@ -57,6 +57,12 @@ public class ActTplParamClickDay implements Serializable { |
| 57 | @Column(name = "uv", nullable = false) | 57 | @Column(name = "uv", nullable = false) |
| 58 | private Integer uv; | 58 | private Integer uv; |
| 59 | 59 | ||
| 60 | @Column(name = "lp_id") | ||
| 61 | private Long lpId; | ||
| 62 | |||
| 63 | @Column(name = "site_id") | ||
| 64 | private Long siteId; | ||
| 65 | |||
| 60 | // 创建时间 | 66 | // 创建时间 |
| 61 | @CreatedDate | 67 | @CreatedDate |
| 62 | @Column(name = "create_time") | 68 | @Column(name = "create_time") | ... | ... |
| ... | @@ -12,6 +12,6 @@ import java.util.Optional; | ... | @@ -12,6 +12,6 @@ import java.util.Optional; |
| 12 | */ | 12 | */ |
| 13 | public interface ActivityBtnPvUvDayRepository extends JpaRepository<ActTplParamClickDay, Long>, JpaSpecificationExecutor<ActTplParamClickDay> { | 13 | public interface ActivityBtnPvUvDayRepository extends JpaRepository<ActTplParamClickDay, Long>, JpaSpecificationExecutor<ActTplParamClickDay> { |
| 14 | 14 | ||
| 15 | Optional<ActTplParamClickDay> findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDay(Long marketingActivityId, Long activityId, Long paramValueId, String day); | 15 | Optional<ActTplParamClickDay> findBySubjectIdAndTemplateParamValueIdAndDay(Long subjectId, Long paramValueId, String day); |
| 16 | 16 | ||
| 17 | } | 17 | } | ... | ... |
| ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvDayService { | ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvDayService { |
| 12 | 12 | ||
| 13 | void update(ActTplParamClickDay resources); | 13 | void update(ActTplParamClickDay resources); |
| 14 | 14 | ||
| 15 | ActTplParamClickDay findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDay(Long marketingActivityId, Long activityId, Long templateParamValueId, String toString); | 15 | ActTplParamClickDay findBySubjectIdAndTemplateParamValueIdAndDay(Long subjectId, Long templateParamValueId, String toString); |
| 16 | } | 16 | } | ... | ... |
| 1 | package com.topdraw.business.module.activitybtn.day.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-02-26 | ||
| 12 | */ | ||
| 13 | @Data | ||
| 14 | public class ActTplParamClickDTO implements Serializable { | ||
| 15 | |||
| 16 | // ID | ||
| 17 | private Long id; | ||
| 18 | |||
| 19 | // 营销活动ID | ||
| 20 | private Long marketingActivityId; | ||
| 21 | |||
| 22 | // 活动事件id | ||
| 23 | private Long activityId; | ||
| 24 | |||
| 25 | // 活动按钮id | ||
| 26 | private Long templateParamValueId; | ||
| 27 | |||
| 28 | // 显示用名称,表示哪个按钮或者内容 | ||
| 29 | private String name; | ||
| 30 | |||
| 31 | // 日期 | ||
| 32 | private String day; | ||
| 33 | |||
| 34 | // pv值 | ||
| 35 | private Integer pv; | ||
| 36 | |||
| 37 | // uv值 | ||
| 38 | private Integer uv; | ||
| 39 | |||
| 40 | // 创建时间 | ||
| 41 | private Timestamp createTime; | ||
| 42 | |||
| 43 | // 更新时间 | ||
| 44 | private Timestamp updateTime; | ||
| 45 | } |
| ... | @@ -36,9 +36,9 @@ public class ActivityBtnPvUvDayServiceImpl implements ActivityBtnPvUvDayService | ... | @@ -36,9 +36,9 @@ public class ActivityBtnPvUvDayServiceImpl implements ActivityBtnPvUvDayService |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | @Override | 38 | @Override |
| 39 | public ActTplParamClickDay findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDay(Long marketingActivityId, Long activityId, Long templateParamValueId, String day) { | 39 | public ActTplParamClickDay findBySubjectIdAndTemplateParamValueIdAndDay(Long subjectId, Long templateParamValueId, String day) { |
| 40 | return this.pvUvDayRepository.findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDay(marketingActivityId, | 40 | return this.pvUvDayRepository.findBySubjectIdAndTemplateParamValueIdAndDay(subjectId, |
| 41 | activityId, templateParamValueId, day).orElseGet(ActTplParamClickDay::new); | 41 | templateParamValueId, day).orElseGet(ActTplParamClickDay::new); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | 44 | ... | ... |
| ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; | ... | @@ -20,7 +20,7 @@ import java.sql.Timestamp; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_tpl_param_click_hour") | 23 | @Table(name="sub_tpl_param_click_hour") |
| 24 | public class ActTplParamClickHour implements Serializable { | 24 | public class ActTplParamClickHour implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,12 @@ public class ActTplParamClickHour implements Serializable { | ... | @@ -29,13 +29,12 @@ public class ActTplParamClickHour implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | // subject id |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | @Column(name = "subject_id", nullable = false) |
| 34 | private Long marketingActivityId; | 34 | private Long subjectId; |
| 35 | 35 | ||
| 36 | // 活动事件id | 36 | @Column(name = "subject_code", nullable = false) |
| 37 | @Column(name = "activity_id", nullable = false) | 37 | private String subjectCode; |
| 38 | private Long activityId; | ||
| 39 | 38 | ||
| 40 | // 显示用名称,表示哪个按钮或者内容 | 39 | // 显示用名称,表示哪个按钮或者内容 |
| 41 | @Column(name = "name", nullable = false) | 40 | @Column(name = "name", nullable = false) |
| ... | @@ -61,6 +60,12 @@ public class ActTplParamClickHour implements Serializable { | ... | @@ -61,6 +60,12 @@ public class ActTplParamClickHour implements Serializable { |
| 61 | @Column(name = "uv", nullable = false) | 60 | @Column(name = "uv", nullable = false) |
| 62 | private Integer uv; | 61 | private Integer uv; |
| 63 | 62 | ||
| 63 | @Column(name = "lp_id") | ||
| 64 | private Long lpId; | ||
| 65 | |||
| 66 | @Column(name = "site_id") | ||
| 67 | private Long siteId; | ||
| 68 | |||
| 64 | // 创建时间 | 69 | // 创建时间 |
| 65 | @CreatedDate | 70 | @CreatedDate |
| 66 | @Column(name = "create_time") | 71 | @Column(name = "create_time") | ... | ... |
| ... | @@ -12,5 +12,5 @@ import java.util.Optional; | ... | @@ -12,5 +12,5 @@ import java.util.Optional; |
| 12 | */ | 12 | */ |
| 13 | public interface ActivityBtnPvUvHourRepository extends JpaRepository<ActTplParamClickHour, Long>, JpaSpecificationExecutor<ActTplParamClickHour> { | 13 | public interface ActivityBtnPvUvHourRepository extends JpaRepository<ActTplParamClickHour, Long>, JpaSpecificationExecutor<ActTplParamClickHour> { |
| 14 | 14 | ||
| 15 | Optional<ActTplParamClickHour> findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDayAndHour(Long marketingActivityId, Long activityId, Long paramValueId, String day, int hour); | 15 | Optional<ActTplParamClickHour> findBySubjectIdAndTemplateParamValueIdAndDayAndHour(Long subjectId, Long paramValueId, String day, int hour); |
| 16 | } | 16 | } | ... | ... |
| ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvHourService { | ... | @@ -12,5 +12,5 @@ public interface ActivityBtnPvUvHourService { |
| 12 | 12 | ||
| 13 | void update(ActTplParamClickHour resources); | 13 | void update(ActTplParamClickHour resources); |
| 14 | 14 | ||
| 15 | ActTplParamClickHour findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDayAndHour(Long marketingActivityId, Long activityId, Long paramValueId, String day, int hour); | 15 | ActTplParamClickHour findBySubjectIdAndTemplateParamValueIdAndDayAndHour(Long marketingActivityId, Long paramValueId, String day, int hour); |
| 16 | } | 16 | } | ... | ... |
| 1 | package com.topdraw.business.module.activitybtn.hour.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import javax.persistence.Column; | ||
| 6 | import java.io.Serializable; | ||
| 7 | import java.sql.Timestamp; | ||
| 8 | |||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-02-26 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class ActTplParamClickHourDTO implements Serializable { | ||
| 16 | |||
| 17 | // ID | ||
| 18 | private Long id; | ||
| 19 | |||
| 20 | // 营销活动ID | ||
| 21 | private Long marketingActivityId; | ||
| 22 | |||
| 23 | // 活动事件id | ||
| 24 | private Long activityId; | ||
| 25 | |||
| 26 | // 活动按钮id | ||
| 27 | private Long templateParamValueId; | ||
| 28 | |||
| 29 | // 显示用名称,表示哪个按钮或者内容 | ||
| 30 | private String name; | ||
| 31 | |||
| 32 | // 日期 | ||
| 33 | private String day; | ||
| 34 | |||
| 35 | // 小时(0-23) | ||
| 36 | private Integer hour; | ||
| 37 | |||
| 38 | // pv值 | ||
| 39 | private Integer pv; | ||
| 40 | |||
| 41 | // uv值 | ||
| 42 | private Integer uv; | ||
| 43 | |||
| 44 | // 创建时间 | ||
| 45 | private Timestamp createTime; | ||
| 46 | |||
| 47 | // 更新时间 | ||
| 48 | private Timestamp updateTime; | ||
| 49 | } |
| ... | @@ -37,10 +37,8 @@ public class ActivityBtnPvUvHourServiceImpl implements ActivityBtnPvUvHourServic | ... | @@ -37,10 +37,8 @@ public class ActivityBtnPvUvHourServiceImpl implements ActivityBtnPvUvHourServic |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | @Override | 39 | @Override |
| 40 | public ActTplParamClickHour findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDayAndHour(Long marketingActivityId, | 40 | public ActTplParamClickHour findBySubjectIdAndTemplateParamValueIdAndDayAndHour(Long subjectId, Long paramValueId, String day, int hour) { |
| 41 | Long activityId, Long paramValueId, | 41 | return PvUvHourRepository.findBySubjectIdAndTemplateParamValueIdAndDayAndHour(subjectId, |
| 42 | String day, int hour) { | ||
| 43 | return PvUvHourRepository.findByMarketingActivityIdAndActivityIdAndTemplateParamValueIdAndDayAndHour(marketingActivityId, activityId, | ||
| 44 | paramValueId, day, hour). | 42 | paramValueId, day, hour). |
| 45 | orElseGet(ActTplParamClickHour::new); | 43 | orElseGet(ActTplParamClickHour::new); |
| 46 | } | 44 | } | ... | ... |
src/main/java/com/topdraw/business/module/subscribe/all/domain/SubscribePvUv.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.all.domain; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import cn.hutool.core.bean.BeanUtil; | ||
| 6 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 7 | import javax.persistence.*; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | ||
| 9 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 11 | import java.sql.Timestamp; | ||
| 12 | |||
| 13 | import java.io.Serializable; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-04-20 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="act_subscribe_pv_uv") | ||
| 24 | public class SubscribePvUv implements Serializable { | ||
| 25 | |||
| 26 | // ID | ||
| 27 | @Id | ||
| 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 29 | @Column(name = "id") | ||
| 30 | private Long id; | ||
| 31 | |||
| 32 | // 营销活动ID | ||
| 33 | @Column(name = "marketing_activity_id", nullable = false) | ||
| 34 | private Long marketingActivityId; | ||
| 35 | |||
| 36 | // 营销活动标识 | ||
| 37 | @Column(name = "marketing_activity_code", nullable = false) | ||
| 38 | private String marketingActivityCode; | ||
| 39 | |||
| 40 | // 产品包id | ||
| 41 | @Column(name = "package_id", nullable = false) | ||
| 42 | private String packageId; | ||
| 43 | |||
| 44 | // 产品包标识 | ||
| 45 | @Column(name = "package_code") | ||
| 46 | private String packageCode; | ||
| 47 | |||
| 48 | // 产品包名称 | ||
| 49 | @Column(name = "package_name") | ||
| 50 | private String packageName; | ||
| 51 | |||
| 52 | // 订购按钮总点击量 | ||
| 53 | @Column(name = "btn_click_pv", nullable = false) | ||
| 54 | private Long btnClickPv; | ||
| 55 | |||
| 56 | // 订购按钮总点击人数 | ||
| 57 | @Column(name = "btn_click_uv", nullable = false) | ||
| 58 | private Long btnClickUv; | ||
| 59 | |||
| 60 | // 订购成功人数 | ||
| 61 | @Column(name = "subscribe_num", nullable = false) | ||
| 62 | private Long subscribeNum; | ||
| 63 | |||
| 64 | // 创建时间 | ||
| 65 | @CreatedDate | ||
| 66 | @Column(name = "create_time") | ||
| 67 | private Timestamp createTime; | ||
| 68 | |||
| 69 | // 更新时间 | ||
| 70 | @LastModifiedDate | ||
| 71 | @Column(name = "update_time") | ||
| 72 | private Timestamp updateTime; | ||
| 73 | |||
| 74 | public void copy(SubscribePvUv source){ | ||
| 75 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 76 | } | ||
| 77 | } |
| 1 | package com.topdraw.business.module.subscribe.all.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.all.domain.SubscribePvUv; | ||
| 4 | import com.topdraw.business.module.subscribe.day.domain.SubscribePvUvDay; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | |||
| 8 | import java.util.Optional; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-04-20 | ||
| 13 | */ | ||
| 14 | public interface SubscribePvUvRepository extends JpaRepository<SubscribePvUv, Long>, JpaSpecificationExecutor<SubscribePvUv> { | ||
| 15 | |||
| 16 | Optional<SubscribePvUv> findByMarketingActivityCodeAndPackageId(String code, String packageId); | ||
| 17 | } |
src/main/java/com/topdraw/business/module/subscribe/all/service/SubscribePvUvService.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.all.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.all.domain.SubscribePvUv; | ||
| 4 | import com.topdraw.business.module.subscribe.all.service.dto.SubscribePvUvDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2022-04-20 | ||
| 9 | */ | ||
| 10 | public interface SubscribePvUvService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return SubscribePvUvDTO | ||
| 16 | */ | ||
| 17 | SubscribePvUvDTO findById(Long id); | ||
| 18 | |||
| 19 | void create(SubscribePvUv resources); | ||
| 20 | |||
| 21 | void update(SubscribePvUv resources); | ||
| 22 | |||
| 23 | void delete(Long id); | ||
| 24 | |||
| 25 | SubscribePvUv findByMarketingActivityCodeAndPackageId(String code, String packageId); | ||
| 26 | } |
src/main/java/com/topdraw/business/module/subscribe/all/service/dto/SubscribePvUvDTO.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.all.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import java.sql.Timestamp; | ||
| 5 | import java.io.Serializable; | ||
| 6 | |||
| 7 | |||
| 8 | /** | ||
| 9 | * @author XiangHan | ||
| 10 | * @date 2022-04-20 | ||
| 11 | */ | ||
| 12 | @Data | ||
| 13 | public class SubscribePvUvDTO implements Serializable { | ||
| 14 | |||
| 15 | // ID | ||
| 16 | private Long id; | ||
| 17 | |||
| 18 | // 营销活动ID | ||
| 19 | private Long marketingActivityId; | ||
| 20 | |||
| 21 | // 营销活动标识 | ||
| 22 | private String marketingActivityCode; | ||
| 23 | |||
| 24 | // 产品包id | ||
| 25 | private String packageId; | ||
| 26 | |||
| 27 | // 产品包标识 | ||
| 28 | private String packageCode; | ||
| 29 | |||
| 30 | // 产品包名称 | ||
| 31 | private String packageName; | ||
| 32 | |||
| 33 | // 订购按钮总点击量 | ||
| 34 | private Long btnClickPv; | ||
| 35 | |||
| 36 | // 订购按钮总点击人数 | ||
| 37 | private Long btnClickUv; | ||
| 38 | |||
| 39 | // 订购成功人数 | ||
| 40 | private Long subscribeNum; | ||
| 41 | |||
| 42 | // 创建时间 | ||
| 43 | private Timestamp createTime; | ||
| 44 | |||
| 45 | // 更新时间 | ||
| 46 | private Timestamp updateTime; | ||
| 47 | } |
| 1 | package com.topdraw.business.module.subscribe.all.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.all.domain.SubscribePvUv; | ||
| 4 | import com.topdraw.utils.ValidationUtil; | ||
| 5 | import com.topdraw.business.module.subscribe.all.repository.SubscribePvUvRepository; | ||
| 6 | import com.topdraw.business.module.subscribe.all.service.SubscribePvUvService; | ||
| 7 | import com.topdraw.business.module.subscribe.all.service.dto.SubscribePvUvDTO; | ||
| 8 | import com.topdraw.business.module.subscribe.all.service.mapper.SubscribePvUvMapper; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.stereotype.Service; | ||
| 11 | import org.springframework.transaction.annotation.Propagation; | ||
| 12 | import org.springframework.transaction.annotation.Transactional; | ||
| 13 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 14 | import org.springframework.util.Assert; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-04-20 | ||
| 19 | */ | ||
| 20 | @Service | ||
| 21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 22 | public class SubscribePvUvServiceImpl implements SubscribePvUvService { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private SubscribePvUvRepository SubscribePvUvRepository; | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private SubscribePvUvMapper SubscribePvUvMapper; | ||
| 29 | |||
| 30 | @Override | ||
| 31 | public SubscribePvUvDTO findById(Long id) { | ||
| 32 | SubscribePvUv SubscribePvUv = SubscribePvUvRepository.findById(id).orElseGet(SubscribePvUv::new); | ||
| 33 | ValidationUtil.isNull(SubscribePvUv.getId(),"SubscribePvUv","id",id); | ||
| 34 | return SubscribePvUvMapper.toDto(SubscribePvUv); | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | @Transactional(rollbackFor = Exception.class) | ||
| 39 | public void create(SubscribePvUv resources) { | ||
| 40 | SubscribePvUvRepository.save(resources); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Override | ||
| 44 | @Transactional(rollbackFor = Exception.class) | ||
| 45 | public void update(SubscribePvUv resources) { | ||
| 46 | SubscribePvUv SubscribePvUv = SubscribePvUvRepository.findById(resources.getId()).orElseGet(SubscribePvUv::new); | ||
| 47 | ValidationUtil.isNull( SubscribePvUv.getId(),"SubscribePvUv","id",resources.getId()); | ||
| 48 | SubscribePvUv.copy(resources); | ||
| 49 | SubscribePvUvRepository.save(SubscribePvUv); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | @Transactional(rollbackFor = Exception.class) | ||
| 54 | public void delete(Long id) { | ||
| 55 | Assert.notNull(id, "The given id must not be null!"); | ||
| 56 | SubscribePvUv SubscribePvUv = SubscribePvUvRepository.findById(id).orElseThrow( | ||
| 57 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", SubscribePvUv.class, id), 1)); | ||
| 58 | SubscribePvUvRepository.delete(SubscribePvUv); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Override | ||
| 62 | public SubscribePvUv findByMarketingActivityCodeAndPackageId(String code, String packageId) { | ||
| 63 | SubscribePvUv SubscribePvUvDay = | ||
| 64 | SubscribePvUvRepository.findByMarketingActivityCodeAndPackageId(code, packageId).orElseGet(SubscribePvUv::new); | ||
| 65 | return SubscribePvUvDay; | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | } |
| 1 | package com.topdraw.business.module.subscribe.all.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.subscribe.all.domain.SubscribePvUv; | ||
| 5 | import com.topdraw.business.module.subscribe.all.service.dto.SubscribePvUvDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-04-20 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface SubscribePvUvMapper extends BaseMapper<SubscribePvUvDTO, SubscribePvUv> { | ||
| 15 | |||
| 16 | } |
src/main/java/com/topdraw/business/module/subscribe/day/domain/SubscribePvUvDay.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.day.domain; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import cn.hutool.core.bean.BeanUtil; | ||
| 6 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 7 | import javax.persistence.*; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | ||
| 9 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 11 | import java.sql.Timestamp; | ||
| 12 | |||
| 13 | import java.io.Serializable; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-04-20 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="act_subscribe_pv_uv_day") | ||
| 24 | public class SubscribePvUvDay implements Serializable { | ||
| 25 | |||
| 26 | // ID | ||
| 27 | @Id | ||
| 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 29 | @Column(name = "id") | ||
| 30 | private Long id; | ||
| 31 | |||
| 32 | // 营销活动ID | ||
| 33 | @Column(name = "marketing_activity_id", nullable = false) | ||
| 34 | private Long marketingActivityId; | ||
| 35 | |||
| 36 | // 营销活动标识 | ||
| 37 | @Column(name = "marketing_activity_code", nullable = false) | ||
| 38 | private String marketingActivityCode; | ||
| 39 | |||
| 40 | // 产品包id | ||
| 41 | @Column(name = "package_id", nullable = false) | ||
| 42 | private String packageId; | ||
| 43 | |||
| 44 | // 产品包标识 | ||
| 45 | @Column(name = "package_code") | ||
| 46 | private String packageCode; | ||
| 47 | |||
| 48 | // 产品包名称 | ||
| 49 | @Column(name = "package_name") | ||
| 50 | private String packageName; | ||
| 51 | |||
| 52 | // 日期 | ||
| 53 | @Column(name = "day", nullable = false) | ||
| 54 | private String day; | ||
| 55 | |||
| 56 | // 订购按钮总点击量 | ||
| 57 | @Column(name = "btn_click_pv", nullable = false) | ||
| 58 | private Long btnClickPv; | ||
| 59 | |||
| 60 | // 订购按钮总点击人数 | ||
| 61 | @Column(name = "btn_click_uv", nullable = false) | ||
| 62 | private Long btnClickUv; | ||
| 63 | |||
| 64 | // 订购成功人数 | ||
| 65 | @Column(name = "subscribe_num", nullable = false) | ||
| 66 | private Long subscribeNum; | ||
| 67 | |||
| 68 | // 创建时间 | ||
| 69 | @CreatedDate | ||
| 70 | @Column(name = "create_time") | ||
| 71 | private Timestamp createTime; | ||
| 72 | |||
| 73 | // 更新时间 | ||
| 74 | @LastModifiedDate | ||
| 75 | @Column(name = "update_time") | ||
| 76 | private Timestamp updateTime; | ||
| 77 | |||
| 78 | public void copy(SubscribePvUvDay source){ | ||
| 79 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 80 | } | ||
| 81 | } |
| 1 | package com.topdraw.business.module.subscribe.day.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.day.domain.SubscribePvUvDay; | ||
| 4 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 7 | |||
| 8 | import java.util.Optional; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-04-20 | ||
| 13 | */ | ||
| 14 | public interface SubscribePvUvDayRepository extends JpaRepository<SubscribePvUvDay, Long>, JpaSpecificationExecutor<SubscribePvUvDay> { | ||
| 15 | |||
| 16 | Optional<SubscribePvUvDay> findByMarketingActivityCodeAndPackageIdAndDay(String code, String packageId, String day); | ||
| 17 | } |
src/main/java/com/topdraw/business/module/subscribe/day/service/SubscribePvUvDayService.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.day.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.day.domain.SubscribePvUvDay; | ||
| 4 | import com.topdraw.business.module.subscribe.day.service.dto.SubscribePvUvDayDTO; | ||
| 5 | import com.topdraw.business.module.subscribe.day.service.dto.SubscribePvUvDayQueryCriteria; | ||
| 6 | import org.springframework.data.domain.Pageable; | ||
| 7 | import java.util.Map; | ||
| 8 | import java.util.List; | ||
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author XiangHan | ||
| 14 | * @date 2022-04-20 | ||
| 15 | */ | ||
| 16 | public interface SubscribePvUvDayService { | ||
| 17 | |||
| 18 | /** | ||
| 19 | * 查询数据分页 | ||
| 20 | * @param criteria 条件参数 | ||
| 21 | * @param pageable 分页参数 | ||
| 22 | * @return Map<String,Object> | ||
| 23 | */ | ||
| 24 | Map<String,Object> queryAll(SubscribePvUvDayQueryCriteria criteria, Pageable pageable); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * 查询所有数据不分页 | ||
| 28 | * @param criteria 条件参数 | ||
| 29 | * @return List<SubscribePvUvDayDTO> | ||
| 30 | */ | ||
| 31 | List<SubscribePvUvDayDTO> queryAll(SubscribePvUvDayQueryCriteria criteria); | ||
| 32 | |||
| 33 | /** | ||
| 34 | * 根据ID查询 | ||
| 35 | * @param id ID | ||
| 36 | * @return SubscribePvUvDayDTO | ||
| 37 | */ | ||
| 38 | SubscribePvUvDayDTO findById(Long id); | ||
| 39 | |||
| 40 | void create(SubscribePvUvDay resources); | ||
| 41 | |||
| 42 | void update(SubscribePvUvDay resources); | ||
| 43 | |||
| 44 | void delete(Long id); | ||
| 45 | |||
| 46 | SubscribePvUvDay findByMarketingActivityCodeAndPackageIdAndDay(String code, String packageId, String day); | ||
| 47 | |||
| 48 | void updateByMarketingActivityCodeAndDayAndPackageId(SubscribePvUvDay subscribePvUvDay); | ||
| 49 | |||
| 50 | } |
src/main/java/com/topdraw/business/module/subscribe/day/service/dto/SubscribePvUvDayDTO.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.day.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import java.sql.Timestamp; | ||
| 5 | import java.io.Serializable; | ||
| 6 | |||
| 7 | |||
| 8 | /** | ||
| 9 | * @author XiangHan | ||
| 10 | * @date 2022-04-20 | ||
| 11 | */ | ||
| 12 | @Data | ||
| 13 | public class SubscribePvUvDayDTO implements Serializable { | ||
| 14 | |||
| 15 | // ID | ||
| 16 | private Long id; | ||
| 17 | |||
| 18 | // 营销活动ID | ||
| 19 | private Long marketingActivityId; | ||
| 20 | |||
| 21 | // 营销活动标识 | ||
| 22 | private String marketingActivityCode; | ||
| 23 | |||
| 24 | // 产品包id | ||
| 25 | private String packageId; | ||
| 26 | |||
| 27 | // 产品包标识 | ||
| 28 | private String packageCode; | ||
| 29 | |||
| 30 | // 产品包名称 | ||
| 31 | private String packageName; | ||
| 32 | |||
| 33 | // 日期 | ||
| 34 | private String day; | ||
| 35 | |||
| 36 | // 订购按钮总点击量 | ||
| 37 | private Long btnClickPv; | ||
| 38 | |||
| 39 | // 订购按钮总点击人数 | ||
| 40 | private Long btnClickUv; | ||
| 41 | |||
| 42 | // 订购成功人数 | ||
| 43 | private Long subscribeNum; | ||
| 44 | |||
| 45 | // 创建时间 | ||
| 46 | private Timestamp createTime; | ||
| 47 | |||
| 48 | // 更新时间 | ||
| 49 | private Timestamp updateTime; | ||
| 50 | } |
| 1 | package com.topdraw.business.module.subscribe.day.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.day.domain.SubscribePvUvDay; | ||
| 4 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | ||
| 6 | import com.topdraw.utils.FileUtil; | ||
| 7 | import com.topdraw.business.module.subscribe.day.repository.SubscribePvUvDayRepository; | ||
| 8 | import com.topdraw.business.module.subscribe.day.service.SubscribePvUvDayService; | ||
| 9 | import com.topdraw.business.module.subscribe.day.service.dto.SubscribePvUvDayDTO; | ||
| 10 | import com.topdraw.business.module.subscribe.day.service.dto.SubscribePvUvDayQueryCriteria; | ||
| 11 | import com.topdraw.business.module.subscribe.day.service.mapper.SubscribePvUvDayMapper; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | import org.springframework.stereotype.Service; | ||
| 14 | import org.springframework.transaction.annotation.Propagation; | ||
| 15 | import org.springframework.transaction.annotation.Transactional; | ||
| 16 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 17 | import org.springframework.data.domain.Page; | ||
| 18 | import org.springframework.data.domain.Pageable; | ||
| 19 | import org.springframework.util.Assert; | ||
| 20 | import com.topdraw.utils.PageUtil; | ||
| 21 | import com.topdraw.utils.QueryHelp; | ||
| 22 | import com.topdraw.utils.StringUtils; | ||
| 23 | |||
| 24 | import java.util.List; | ||
| 25 | import java.util.Map; | ||
| 26 | import java.io.IOException; | ||
| 27 | import javax.servlet.http.HttpServletResponse; | ||
| 28 | import java.util.ArrayList; | ||
| 29 | import java.util.LinkedHashMap; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * @author XiangHan | ||
| 33 | * @date 2022-04-20 | ||
| 34 | */ | ||
| 35 | @Service | ||
| 36 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 37 | public class SubscribePvUvDayServiceImpl implements SubscribePvUvDayService { | ||
| 38 | |||
| 39 | @Autowired | ||
| 40 | private SubscribePvUvDayRepository SubscribePvUvDayRepository; | ||
| 41 | |||
| 42 | @Autowired | ||
| 43 | private SubscribePvUvDayMapper SubscribePvUvDayMapper; | ||
| 44 | |||
| 45 | @Override | ||
| 46 | public Map<String, Object> queryAll(SubscribePvUvDayQueryCriteria criteria, Pageable pageable) { | ||
| 47 | Page<SubscribePvUvDay> page = SubscribePvUvDayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
| 48 | return PageUtil.toPage(page.map(SubscribePvUvDayMapper::toDto)); | ||
| 49 | } | ||
| 50 | |||
| 51 | @Override | ||
| 52 | public List<SubscribePvUvDayDTO> queryAll(SubscribePvUvDayQueryCriteria criteria) { | ||
| 53 | return SubscribePvUvDayMapper.toDto(SubscribePvUvDayRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | public SubscribePvUvDayDTO findById(Long id) { | ||
| 58 | SubscribePvUvDay SubscribePvUvDay = SubscribePvUvDayRepository.findById(id).orElseGet(SubscribePvUvDay::new); | ||
| 59 | ValidationUtil.isNull(SubscribePvUvDay.getId(),"SubscribePvUvDay","id",id); | ||
| 60 | return SubscribePvUvDayMapper.toDto(SubscribePvUvDay); | ||
| 61 | } | ||
| 62 | |||
| 63 | @Override | ||
| 64 | @Transactional(rollbackFor = Exception.class) | ||
| 65 | public void create(SubscribePvUvDay resources) { | ||
| 66 | SubscribePvUvDayRepository.save(resources); | ||
| 67 | } | ||
| 68 | |||
| 69 | @Override | ||
| 70 | @Transactional(rollbackFor = Exception.class) | ||
| 71 | public void update(SubscribePvUvDay resources) { | ||
| 72 | SubscribePvUvDay SubscribePvUvDay = SubscribePvUvDayRepository.findById(resources.getId()).orElseGet(SubscribePvUvDay::new); | ||
| 73 | ValidationUtil.isNull( SubscribePvUvDay.getId(),"SubscribePvUvDay","id",resources.getId()); | ||
| 74 | SubscribePvUvDay.copy(resources); | ||
| 75 | SubscribePvUvDayRepository.save(SubscribePvUvDay); | ||
| 76 | } | ||
| 77 | |||
| 78 | @Override | ||
| 79 | @Transactional(rollbackFor = Exception.class) | ||
| 80 | public void delete(Long id) { | ||
| 81 | Assert.notNull(id, "The given id must not be null!"); | ||
| 82 | SubscribePvUvDay SubscribePvUvDay = SubscribePvUvDayRepository.findById(id).orElseThrow( | ||
| 83 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", SubscribePvUvDay.class, id), 1)); | ||
| 84 | SubscribePvUvDayRepository.delete(SubscribePvUvDay); | ||
| 85 | } | ||
| 86 | |||
| 87 | @Override | ||
| 88 | public SubscribePvUvDay findByMarketingActivityCodeAndPackageIdAndDay(String code, String packageId, String day) { | ||
| 89 | SubscribePvUvDay SubscribePvUvDay = | ||
| 90 | SubscribePvUvDayRepository.findByMarketingActivityCodeAndPackageIdAndDay(code, packageId, day).orElseGet(SubscribePvUvDay::new); | ||
| 91 | return SubscribePvUvDay; | ||
| 92 | } | ||
| 93 | |||
| 94 | @Override | ||
| 95 | public void updateByMarketingActivityCodeAndDayAndPackageId(SubscribePvUvDay subscribePvUvDay) { | ||
| 96 | |||
| 97 | } | ||
| 98 | |||
| 99 | |||
| 100 | } |
| 1 | package com.topdraw.business.module.subscribe.day.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.subscribe.day.domain.SubscribePvUvDay; | ||
| 5 | import com.topdraw.business.module.subscribe.day.service.dto.SubscribePvUvDayDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-04-20 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface SubscribePvUvDayMapper extends BaseMapper<SubscribePvUvDayDTO, SubscribePvUvDay> { | ||
| 15 | |||
| 16 | } |
src/main/java/com/topdraw/business/module/subscribe/hour/domain/SubscribePvUvHour.java
deleted
100644 → 0
| 1 | package com.topdraw.business.module.subscribe.hour.domain; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import cn.hutool.core.bean.BeanUtil; | ||
| 6 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 7 | import javax.persistence.*; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | ||
| 9 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 11 | import java.sql.Timestamp; | ||
| 12 | |||
| 13 | import java.io.Serializable; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-04-20 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="act_subscribe_pv_uv_hour") | ||
| 24 | public class SubscribePvUvHour implements Serializable { | ||
| 25 | |||
| 26 | // ID | ||
| 27 | @Id | ||
| 28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 29 | @Column(name = "id") | ||
| 30 | private Long id; | ||
| 31 | |||
| 32 | // 营销活动ID | ||
| 33 | @Column(name = "marketing_activity_id", nullable = false) | ||
| 34 | private Long marketingActivityId; | ||
| 35 | |||
| 36 | // 营销活动标识 | ||
| 37 | @Column(name = "marketing_activity_code", nullable = false) | ||
| 38 | private String marketingActivityCode; | ||
| 39 | |||
| 40 | // 产品包id | ||
| 41 | @Column(name = "package_id", nullable = false) | ||
| 42 | private String packageId; | ||
| 43 | |||
| 44 | // 产品包标识 | ||
| 45 | @Column(name = "package_code") | ||
| 46 | private String packageCode; | ||
| 47 | |||
| 48 | // 产品包名称 | ||
| 49 | @Column(name = "package_name") | ||
| 50 | private String packageName; | ||
| 51 | |||
| 52 | // 日期 | ||
| 53 | @Column(name = "day", nullable = false) | ||
| 54 | private String day; | ||
| 55 | |||
| 56 | // 小时(0-23) | ||
| 57 | @Column(name = "hour", nullable = false) | ||
| 58 | private Integer hour; | ||
| 59 | |||
| 60 | // 订购按钮总点击量 | ||
| 61 | @Column(name = "btn_click_pv", nullable = false) | ||
| 62 | private Long btnClickPv; | ||
| 63 | |||
| 64 | // 订购按钮总点击人数 | ||
| 65 | @Column(name = "btn_click_uv", nullable = false) | ||
| 66 | private Long btnClickUv; | ||
| 67 | |||
| 68 | // 订购成功人数 | ||
| 69 | @Column(name = "subscribe_num", nullable = false) | ||
| 70 | private Long subscribeNum; | ||
| 71 | |||
| 72 | // 创建时间 | ||
| 73 | @CreatedDate | ||
| 74 | @Column(name = "create_time") | ||
| 75 | private Timestamp createTime; | ||
| 76 | |||
| 77 | // 更新时间 | ||
| 78 | @LastModifiedDate | ||
| 79 | @Column(name = "update_time") | ||
| 80 | private Timestamp updateTime; | ||
| 81 | |||
| 82 | public void copy(SubscribePvUvHour source){ | ||
| 83 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 84 | } | ||
| 85 | } |
| 1 | package com.topdraw.business.module.subscribe.hour.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | import java.util.List; | ||
| 8 | import java.util.Optional; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-04-20 | ||
| 13 | */ | ||
| 14 | public interface SubscribePvUvHourRepository extends JpaRepository<SubscribePvUvHour, Long>, JpaSpecificationExecutor<SubscribePvUvHour> { | ||
| 15 | |||
| 16 | Optional<SubscribePvUvHour> findByMarketingActivityCodeAndPackageIdAndDayAndHour(String code, String packageId, String day, int hour); | ||
| 17 | } |
| 1 | package com.topdraw.business.module.subscribe.hour.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 4 | import com.topdraw.business.module.subscribe.hour.service.dto.SubscribePvUvHourDTO; | ||
| 5 | import com.topdraw.business.module.subscribe.hour.service.dto.SubscribePvUvHourQueryCriteria; | ||
| 6 | import org.springframework.data.domain.Pageable; | ||
| 7 | import java.util.Map; | ||
| 8 | import java.util.List; | ||
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @author XiangHan | ||
| 14 | * @date 2022-04-20 | ||
| 15 | */ | ||
| 16 | public interface SubscribePvUvHourService { | ||
| 17 | |||
| 18 | /** | ||
| 19 | * 根据ID查询 | ||
| 20 | * @param id ID | ||
| 21 | * @return SubscribePvUvHourDTO | ||
| 22 | */ | ||
| 23 | SubscribePvUvHourDTO findById(Long id); | ||
| 24 | |||
| 25 | void create(SubscribePvUvHour resources); | ||
| 26 | |||
| 27 | void update(SubscribePvUvHour resources); | ||
| 28 | |||
| 29 | void delete(Long id); | ||
| 30 | |||
| 31 | SubscribePvUvHour findByMarketingActivityCodeAndPackageIdAndDayAndHour(String code, String packageId, String toString, int hour); | ||
| 32 | |||
| 33 | void updateByMarketingActivityCodeAndDayAndHourAndPackageId(SubscribePvUvHour subscribePvUvHour); | ||
| 34 | } |
| 1 | package com.topdraw.business.module.subscribe.hour.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import java.sql.Timestamp; | ||
| 5 | import java.io.Serializable; | ||
| 6 | |||
| 7 | |||
| 8 | /** | ||
| 9 | * @author XiangHan | ||
| 10 | * @date 2022-04-20 | ||
| 11 | */ | ||
| 12 | @Data | ||
| 13 | public class SubscribePvUvHourDTO implements Serializable { | ||
| 14 | |||
| 15 | // ID | ||
| 16 | private Long id; | ||
| 17 | |||
| 18 | // 营销活动ID | ||
| 19 | private Long marketingActivityId; | ||
| 20 | |||
| 21 | // 营销活动标识 | ||
| 22 | private String marketingActivityCode; | ||
| 23 | |||
| 24 | // 产品包id | ||
| 25 | private String packageId; | ||
| 26 | |||
| 27 | // 产品包标识 | ||
| 28 | private String packageCode; | ||
| 29 | |||
| 30 | // 产品包名称 | ||
| 31 | private String packageName; | ||
| 32 | |||
| 33 | // 日期 | ||
| 34 | private String day; | ||
| 35 | |||
| 36 | // 小时(0-23) | ||
| 37 | private Integer hour; | ||
| 38 | |||
| 39 | // 订购按钮总点击量 | ||
| 40 | private Long btnClickPv; | ||
| 41 | |||
| 42 | // 订购按钮总点击人数 | ||
| 43 | private Long btnClickUv; | ||
| 44 | |||
| 45 | // 订购成功人数 | ||
| 46 | private Long subscribeNum; | ||
| 47 | |||
| 48 | // 创建时间 | ||
| 49 | private Timestamp createTime; | ||
| 50 | |||
| 51 | // 更新时间 | ||
| 52 | private Timestamp updateTime; | ||
| 53 | } |
| 1 | package com.topdraw.business.module.subscribe.hour.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 4 | import com.topdraw.utils.ValidationUtil; | ||
| 5 | import com.topdraw.utils.FileUtil; | ||
| 6 | import com.topdraw.business.module.subscribe.hour.repository.SubscribePvUvHourRepository; | ||
| 7 | import com.topdraw.business.module.subscribe.hour.service.SubscribePvUvHourService; | ||
| 8 | import com.topdraw.business.module.subscribe.hour.service.dto.SubscribePvUvHourDTO; | ||
| 9 | import com.topdraw.business.module.subscribe.hour.service.dto.SubscribePvUvHourQueryCriteria; | ||
| 10 | import com.topdraw.business.module.subscribe.hour.service.mapper.SubscribePvUvHourMapper; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 12 | import org.springframework.stereotype.Service; | ||
| 13 | import org.springframework.transaction.annotation.Propagation; | ||
| 14 | import org.springframework.transaction.annotation.Transactional; | ||
| 15 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 16 | import org.springframework.data.domain.Page; | ||
| 17 | import org.springframework.data.domain.Pageable; | ||
| 18 | import org.springframework.util.Assert; | ||
| 19 | import com.topdraw.utils.PageUtil; | ||
| 20 | import com.topdraw.utils.QueryHelp; | ||
| 21 | import com.topdraw.utils.StringUtils; | ||
| 22 | |||
| 23 | import java.util.List; | ||
| 24 | import java.util.Map; | ||
| 25 | import java.io.IOException; | ||
| 26 | import javax.servlet.http.HttpServletResponse; | ||
| 27 | import java.util.ArrayList; | ||
| 28 | import java.util.LinkedHashMap; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * @author XiangHan | ||
| 32 | * @date 2022-04-20 | ||
| 33 | */ | ||
| 34 | @Service | ||
| 35 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 36 | public class SubscribePvUvHourServiceImpl implements SubscribePvUvHourService { | ||
| 37 | |||
| 38 | @Autowired | ||
| 39 | private SubscribePvUvHourRepository SubscribePvUvHourRepository; | ||
| 40 | |||
| 41 | @Autowired | ||
| 42 | private SubscribePvUvHourMapper SubscribePvUvHourMapper; | ||
| 43 | |||
| 44 | @Override | ||
| 45 | public SubscribePvUvHourDTO findById(Long id) { | ||
| 46 | SubscribePvUvHour SubscribePvUvHour = SubscribePvUvHourRepository.findById(id).orElseGet(SubscribePvUvHour::new); | ||
| 47 | ValidationUtil.isNull(SubscribePvUvHour.getId(),"SubscribePvUvHour","id",id); | ||
| 48 | return SubscribePvUvHourMapper.toDto(SubscribePvUvHour); | ||
| 49 | } | ||
| 50 | |||
| 51 | @Override | ||
| 52 | @Transactional(rollbackFor = Exception.class) | ||
| 53 | public void create(SubscribePvUvHour resources) { | ||
| 54 | SubscribePvUvHourRepository.save(resources); | ||
| 55 | } | ||
| 56 | |||
| 57 | @Override | ||
| 58 | @Transactional(rollbackFor = Exception.class) | ||
| 59 | public void update(SubscribePvUvHour resources) { | ||
| 60 | SubscribePvUvHour SubscribePvUvHour = SubscribePvUvHourRepository.findById(resources.getId()).orElseGet(SubscribePvUvHour::new); | ||
| 61 | ValidationUtil.isNull( SubscribePvUvHour.getId(),"SubscribePvUvHour","id",resources.getId()); | ||
| 62 | SubscribePvUvHour.copy(resources); | ||
| 63 | SubscribePvUvHourRepository.save(SubscribePvUvHour); | ||
| 64 | } | ||
| 65 | |||
| 66 | @Override | ||
| 67 | @Transactional(rollbackFor = Exception.class) | ||
| 68 | public void delete(Long id) { | ||
| 69 | Assert.notNull(id, "The given id must not be null!"); | ||
| 70 | SubscribePvUvHour SubscribePvUvHour = SubscribePvUvHourRepository.findById(id).orElseThrow( | ||
| 71 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", SubscribePvUvHour.class, id), 1)); | ||
| 72 | SubscribePvUvHourRepository.delete(SubscribePvUvHour); | ||
| 73 | } | ||
| 74 | |||
| 75 | @Override | ||
| 76 | public SubscribePvUvHour findByMarketingActivityCodeAndPackageIdAndDayAndHour(String code, String packageId, String day, int hour) { | ||
| 77 | SubscribePvUvHour SubscribePvUvHour = | ||
| 78 | SubscribePvUvHourRepository.findByMarketingActivityCodeAndPackageIdAndDayAndHour(code, packageId, day, hour).orElseGet(SubscribePvUvHour::new); | ||
| 79 | return SubscribePvUvHour; | ||
| 80 | } | ||
| 81 | |||
| 82 | @Override | ||
| 83 | public void updateByMarketingActivityCodeAndDayAndHourAndPackageId(SubscribePvUvHour subscribePvUvHour) { | ||
| 84 | |||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | } |
| 1 | package com.topdraw.business.module.subscribe.hour.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.subscribe.hour.domain.SubscribePvUvHour; | ||
| 5 | import com.topdraw.business.module.subscribe.hour.service.dto.SubscribePvUvHourDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-04-20 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface SubscribePvUvHourMapper extends BaseMapper<SubscribePvUvHourDTO, SubscribePvUvHour> { | ||
| 15 | |||
| 16 | } |
| ... | @@ -20,7 +20,7 @@ import java.io.Serializable; | ... | @@ -20,7 +20,7 @@ import java.io.Serializable; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_pv_uv") | 23 | @Table(name="sub_pv_uv") |
| 24 | public class PvUv implements Serializable { | 24 | public class PvUv implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,11 @@ public class PvUv implements Serializable { | ... | @@ -29,13 +29,11 @@ public class PvUv implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | @Column(name = "subject_id", nullable = false) |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | private Long subjectId; |
| 34 | private Long marketingActivityId; | ||
| 35 | 34 | ||
| 36 | // 营销活动标识 | 35 | @Column(name = "subject_code", nullable = false) |
| 37 | @Column(name = "marketing_activity_code", nullable = false) | 36 | private String subjectCode; |
| 38 | private String marketingActivityCode; | ||
| 39 | 37 | ||
| 40 | // pv值 | 38 | // pv值 |
| 41 | @Column(name = "pv", nullable = false) | 39 | @Column(name = "pv", nullable = false) |
| ... | @@ -45,6 +43,12 @@ public class PvUv implements Serializable { | ... | @@ -45,6 +43,12 @@ public class PvUv implements Serializable { |
| 45 | @Column(name = "uv", nullable = false) | 43 | @Column(name = "uv", nullable = false) |
| 46 | private Integer uv; | 44 | private Integer uv; |
| 47 | 45 | ||
| 46 | @Column(name = "lp_id") | ||
| 47 | private Long lpId; | ||
| 48 | |||
| 49 | @Column(name = "site_id") | ||
| 50 | private Long siteId; | ||
| 51 | |||
| 48 | // 创建时间 | 52 | // 创建时间 |
| 49 | @CreatedDate | 53 | @CreatedDate |
| 50 | @Column(name = "create_time") | 54 | @Column(name = "create_time") | ... | ... |
| 1 | package com.topdraw.business.module.uv.all.service.dto; | 1 | package com.topdraw.business.module.uv.all.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | |||
| 4 | import java.sql.Timestamp; | 5 | import java.sql.Timestamp; |
| 5 | import java.io.Serializable; | 6 | import java.io.Serializable; |
| 6 | 7 | ||
| ... | @@ -15,11 +16,13 @@ public class PvUvDTO implements Serializable { | ... | @@ -15,11 +16,13 @@ public class PvUvDTO implements Serializable { |
| 15 | // ID | 16 | // ID |
| 16 | private Long id; | 17 | private Long id; |
| 17 | 18 | ||
| 18 | // 营销活动ID | 19 | private Long subjectId; |
| 19 | private Long marketingActivityId; | 20 | |
| 21 | private String subjectCode; | ||
| 22 | |||
| 23 | private Long lpId; | ||
| 20 | 24 | ||
| 21 | // 营销活动标识 | 25 | private Long siteId; |
| 22 | private String marketingActivityCode; | ||
| 23 | 26 | ||
| 24 | // pv值 | 27 | // pv值 |
| 25 | private Long pv; | 28 | private Long pv; | ... | ... |
| ... | @@ -20,7 +20,7 @@ import java.io.Serializable; | ... | @@ -20,7 +20,7 @@ import java.io.Serializable; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_pv_uv_day") | 23 | @Table(name="sub_pv_uv_day") |
| 24 | public class PvUvDay implements Serializable { | 24 | public class PvUvDay implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,11 @@ public class PvUvDay implements Serializable { | ... | @@ -29,13 +29,11 @@ public class PvUvDay implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | @Column(name = "subject_id", nullable = false) |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | private Long subjectId; |
| 34 | private Long marketingActivityId; | ||
| 35 | 34 | ||
| 36 | // 营销活动标识 | 35 | @Column(name = "subject_code", nullable = false) |
| 37 | @Column(name = "marketing_activity_code", nullable = false) | 36 | private String subjectCode; |
| 38 | private String marketingActivityCode; | ||
| 39 | 37 | ||
| 40 | // 日期 | 38 | // 日期 |
| 41 | @Column(name = "day", nullable = false) | 39 | @Column(name = "day", nullable = false) |
| ... | @@ -49,6 +47,12 @@ public class PvUvDay implements Serializable { | ... | @@ -49,6 +47,12 @@ public class PvUvDay implements Serializable { |
| 49 | @Column(name = "uv", nullable = false) | 47 | @Column(name = "uv", nullable = false) |
| 50 | private Integer uv; | 48 | private Integer uv; |
| 51 | 49 | ||
| 50 | @Column(name = "lp_id") | ||
| 51 | private Long lpId; | ||
| 52 | |||
| 53 | @Column(name = "site_id") | ||
| 54 | private Long siteId; | ||
| 55 | |||
| 52 | // 创建时间 | 56 | // 创建时间 |
| 53 | @CreatedDate | 57 | @CreatedDate |
| 54 | @Column(name = "create_time") | 58 | @Column(name = "create_time") | ... | ... |
| ... | @@ -15,11 +15,13 @@ public class PvUvDayDTO implements Serializable { | ... | @@ -15,11 +15,13 @@ public class PvUvDayDTO implements Serializable { |
| 15 | // ID | 15 | // ID |
| 16 | private Long id; | 16 | private Long id; |
| 17 | 17 | ||
| 18 | // 营销活动ID | 18 | private Long subjectId; |
| 19 | private Long marketingActivityId; | ||
| 20 | 19 | ||
| 21 | // 营销活动标识 | 20 | private String subjectCode; |
| 22 | private String marketingActivityCode; | 21 | |
| 22 | private Long lpId; | ||
| 23 | |||
| 24 | private Long siteId; | ||
| 23 | 25 | ||
| 24 | // 日期 | 26 | // 日期 |
| 25 | private String day; | 27 | private String day; | ... | ... |
| ... | @@ -20,7 +20,7 @@ import java.io.Serializable; | ... | @@ -20,7 +20,7 @@ import java.io.Serializable; |
| 20 | @Data | 20 | @Data |
| 21 | @EntityListeners(AuditingEntityListener.class) | 21 | @EntityListeners(AuditingEntityListener.class) |
| 22 | @Accessors(chain = true) | 22 | @Accessors(chain = true) |
| 23 | @Table(name="act_pv_uv_hour") | 23 | @Table(name="sub_pv_uv_hour") |
| 24 | public class PvUvHour implements Serializable { | 24 | public class PvUvHour implements Serializable { |
| 25 | 25 | ||
| 26 | // ID | 26 | // ID |
| ... | @@ -29,13 +29,11 @@ public class PvUvHour implements Serializable { | ... | @@ -29,13 +29,11 @@ public class PvUvHour implements Serializable { |
| 29 | @Column(name = "id") | 29 | @Column(name = "id") |
| 30 | private Long id; | 30 | private Long id; |
| 31 | 31 | ||
| 32 | // 营销活动ID | 32 | @Column(name = "subject_id", nullable = false) |
| 33 | @Column(name = "marketing_activity_id", nullable = false) | 33 | private Long subjectId; |
| 34 | private Long marketingActivityId; | ||
| 35 | 34 | ||
| 36 | // 营销活动标识 | 35 | @Column(name = "subject_code", nullable = false) |
| 37 | @Column(name = "marketing_activity_code", nullable = false) | 36 | private String subjectCode; |
| 38 | private String marketingActivityCode; | ||
| 39 | 37 | ||
| 40 | // 日期 | 38 | // 日期 |
| 41 | @Column(name = "day", nullable = false) | 39 | @Column(name = "day", nullable = false) |
| ... | @@ -53,6 +51,12 @@ public class PvUvHour implements Serializable { | ... | @@ -53,6 +51,12 @@ public class PvUvHour implements Serializable { |
| 53 | @Column(name = "uv", nullable = false) | 51 | @Column(name = "uv", nullable = false) |
| 54 | private Integer uv; | 52 | private Integer uv; |
| 55 | 53 | ||
| 54 | @Column(name = "lp_id") | ||
| 55 | private Long lpId; | ||
| 56 | |||
| 57 | @Column(name = "site_id") | ||
| 58 | private Long siteId; | ||
| 59 | |||
| 56 | // 创建时间 | 60 | // 创建时间 |
| 57 | @CreatedDate | 61 | @CreatedDate |
| 58 | @Column(name = "create_time") | 62 | @Column(name = "create_time") | ... | ... |
| ... | @@ -15,11 +15,13 @@ public class PvUvHourDTO implements Serializable { | ... | @@ -15,11 +15,13 @@ public class PvUvHourDTO implements Serializable { |
| 15 | // ID | 15 | // ID |
| 16 | private Long id; | 16 | private Long id; |
| 17 | 17 | ||
| 18 | // 营销活动ID | 18 | private Long subjectId; |
| 19 | private Long marketingActivityId; | ||
| 20 | 19 | ||
| 21 | // 营销活动标识 | 20 | private String subjectCode; |
| 22 | private String marketingActivityCode; | 21 | |
| 22 | private Long lpId; | ||
| 23 | |||
| 24 | private Long siteId; | ||
| 23 | 25 | ||
| 24 | // 日期 | 26 | // 日期 |
| 25 | private String day; | 27 | private String day; | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -48,40 +48,18 @@ public class PvUvCalculateTask { | ... | @@ -48,40 +48,18 @@ public class PvUvCalculateTask { |
| 48 | private PvUvHourService pvUvHourService; | 48 | private PvUvHourService pvUvHourService; |
| 49 | 49 | ||
| 50 | public boolean calculateRedisData2Mysql(){ | 50 | public boolean calculateRedisData2Mysql(){ |
| 51 | List<Map<String, Object>> allMarketingActivityCode = this.getAllMarketingActivityCode(); | 51 | List<Map<String, Object>> allSubjectCode = this.getAllSubjectCode(); |
| 52 | 52 | ||
| 53 | if (CollectionUtils.isNotEmpty(allMarketingActivityCode)) { | 53 | if (CollectionUtils.isNotEmpty(allSubjectCode)) { |
| 54 | 54 | ||
| 55 | for (Map<String, Object> map : allMarketingActivityCode) { | 55 | for (Map<String, Object> map : allSubjectCode) { |
| 56 | 56 | ||
| 57 | Object codeObj = map.get("code"); | 57 | Object codeObj = map.get("code"); |
| 58 | Object idObj = map.get("id"); | 58 | Object idObj = map.get("id"); |
| 59 | if (Objects.nonNull(codeObj)&&Objects.nonNull(idObj)) { | 59 | if (Objects.nonNull(codeObj)&&Objects.nonNull(idObj)) { |
| 60 | String code = codeObj.toString(); | 60 | String code = codeObj.toString(); |
| 61 | String id = idObj.toString(); | 61 | String id = idObj.toString(); |
| 62 | log.info("marktingActivity ===>>> code ====>>> [{}]",code); | 62 | log.info("subject ===>>> code ====>>> [{}]",code); |
| 63 | |||
| 64 | LocalDateTime endTime = (LocalDateTime) map.get("endTime"); | ||
| 65 | |||
| 66 | if (Objects.nonNull(endTime)) { | ||
| 67 | log.info("活动结束时间-->>{}",endTime); | ||
| 68 | // 活动结束删除所有的对应的key | ||
| 69 | if (endTime.compareTo(LocalDateTime.now()) <= 0) { | ||
| 70 | log.info("活动结束,活动结束时间30天后删除活动code对应的所有key"); | ||
| 71 | if (endTime.plusDays(30).compareTo(LocalDateTime.now()) <= 0) { | ||
| 72 | |||
| 73 | Set<Object> keys = this.redisUtils.keys("*|"+code+"*"); | ||
| 74 | if (CollectionUtils.isNotEmpty(keys)) { | ||
| 75 | for (Object key : keys) { | ||
| 76 | this.redisUtils.del(key.toString()); | ||
| 77 | log.info("删除活动code对应的所有的key --->>{},成功",key); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | } | ||
| 82 | continue; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | 63 | ||
| 86 | // 小时pv、uv值 | 64 | // 小时pv、uv值 |
| 87 | PvUvHour pvUvHour1 = | 65 | PvUvHour pvUvHour1 = |
| ... | @@ -96,8 +74,8 @@ public class PvUvCalculateTask { | ... | @@ -96,8 +74,8 @@ public class PvUvCalculateTask { |
| 96 | log.info("hourUv ==>> {}", hourUv); | 74 | log.info("hourUv ==>> {}", hourUv); |
| 97 | 75 | ||
| 98 | PvUvHour pvUvHour = new PvUvHour(); | 76 | PvUvHour pvUvHour = new PvUvHour(); |
| 99 | pvUvHour.setMarketingActivityId(Long.parseLong(id)); | 77 | pvUvHour.setSubjectId(Long.parseLong(id)); |
| 100 | pvUvHour.setMarketingActivityCode(code); | 78 | pvUvHour.setSubjectCode(code); |
| 101 | pvUvHour.setDay(LocalDate.now().toString()); | 79 | pvUvHour.setDay(LocalDate.now().toString()); |
| 102 | pvUvHour.setHour(LocalDateTime.now().getHour()); | 80 | pvUvHour.setHour(LocalDateTime.now().getHour()); |
| 103 | pvUvHour.setPv(hourPv); | 81 | pvUvHour.setPv(hourPv); |
| ... | @@ -133,8 +111,8 @@ public class PvUvCalculateTask { | ... | @@ -133,8 +111,8 @@ public class PvUvCalculateTask { |
| 133 | 111 | ||
| 134 | if(Objects.isNull(pvUvDay1.getId())){ | 112 | if(Objects.isNull(pvUvDay1.getId())){ |
| 135 | PvUvDay pvUvDay = new PvUvDay(); | 113 | PvUvDay pvUvDay = new PvUvDay(); |
| 136 | pvUvDay.setMarketingActivityId(Long.parseLong(id)); | 114 | pvUvDay.setSubjectId(Long.parseLong(id)); |
| 137 | pvUvDay.setMarketingActivityCode(code); | 115 | pvUvDay.setSubjectCode(code); |
| 138 | pvUvDay.setDay(LocalDate.now().toString()); | 116 | pvUvDay.setDay(LocalDate.now().toString()); |
| 139 | 117 | ||
| 140 | Integer dayPv = this.getDayPV(code); | 118 | Integer dayPv = this.getDayPV(code); |
| ... | @@ -171,8 +149,8 @@ public class PvUvCalculateTask { | ... | @@ -171,8 +149,8 @@ public class PvUvCalculateTask { |
| 171 | PvUv pvUv1 = this.pvUvService.findByMarketingActivityId(Long.parseLong(id)); | 149 | PvUv pvUv1 = this.pvUvService.findByMarketingActivityId(Long.parseLong(id)); |
| 172 | if(Objects.isNull(pvUv1.getId())){ | 150 | if(Objects.isNull(pvUv1.getId())){ |
| 173 | PvUv pvUv = new PvUv(); | 151 | PvUv pvUv = new PvUv(); |
| 174 | pvUv.setMarketingActivityId(Long.parseLong(id)); | 152 | pvUv.setSubjectId(Long.parseLong(id)); |
| 175 | pvUv.setMarketingActivityCode(code); | 153 | pvUv.setSubjectCode(code); |
| 176 | 154 | ||
| 177 | Integer allPV = this.getAllPV(code); | 155 | Integer allPV = this.getAllPV(code); |
| 178 | Integer allUv = this.getAllUV(code); | 156 | Integer allUv = this.getAllUV(code); |
| ... | @@ -222,8 +200,8 @@ public class PvUvCalculateTask { | ... | @@ -222,8 +200,8 @@ public class PvUvCalculateTask { |
| 222 | } else { | 200 | } else { |
| 223 | hourStr = String.valueOf(hour); | 201 | hourStr = String.valueOf(hour); |
| 224 | } | 202 | } |
| 225 | log.info("getHourPV ==>> key ==>> {}", "MS_PV" + "|" + code +"|" + LocalDate.now()+"|"+hourStr); | 203 | log.info("getHourPV ==>> key ==>> {}", "SUBJECT_PV" + "|" + code +"|" + LocalDate.now()+"|"+hourStr); |
| 226 | Object hourBtnClickPV = this.redisUtils.hget("MS_PV" + "|" + code +"|" + LocalDate.now()+"|"+hourStr, "ALL"); | 204 | Object hourBtnClickPV = this.redisUtils.hget("SUBJECT_PV" + "|" + code +"|" + LocalDate.now()+"|"+hourStr, "ALL"); |
| 227 | if (Objects.nonNull(hourBtnClickPV)) { | 205 | if (Objects.nonNull(hourBtnClickPV)) { |
| 228 | return Integer.valueOf(hourBtnClickPV.toString()); | 206 | return Integer.valueOf(hourBtnClickPV.toString()); |
| 229 | } | 207 | } |
| ... | @@ -232,8 +210,8 @@ public class PvUvCalculateTask { | ... | @@ -232,8 +210,8 @@ public class PvUvCalculateTask { |
| 232 | } | 210 | } |
| 233 | 211 | ||
| 234 | private Integer getDayPV(String code){ | 212 | private Integer getDayPV(String code){ |
| 235 | log.info("getDayPV ==>> key ==>> {}", "MS_PV" + "|" + code + "|" + LocalDate.now()); | 213 | log.info("getDayPV ==>> key ==>> {}", "SUBJECT_PV" + "|" + code + "|" + LocalDate.now()); |
| 236 | Object hourBtnClickPV = this.redisUtils.hget("MS_PV" + "|" + code + "|" + LocalDate.now(), "ALL"); | 214 | Object hourBtnClickPV = this.redisUtils.hget("SUBJECT_PV" + "|" + code + "|" + LocalDate.now(), "ALL"); |
| 237 | if (Objects.nonNull(hourBtnClickPV)) { | 215 | if (Objects.nonNull(hourBtnClickPV)) { |
| 238 | return Integer.valueOf(hourBtnClickPV.toString()); | 216 | return Integer.valueOf(hourBtnClickPV.toString()); |
| 239 | } | 217 | } |
| ... | @@ -242,8 +220,8 @@ public class PvUvCalculateTask { | ... | @@ -242,8 +220,8 @@ public class PvUvCalculateTask { |
| 242 | } | 220 | } |
| 243 | 221 | ||
| 244 | private Integer getAllPV(String code){ | 222 | private Integer getAllPV(String code){ |
| 245 | log.info("getAllPV ==>> key ==>> {}", "MS_PV" + "|" + code); | 223 | log.info("getAllPV ==>> key ==>> {}", "SUBJECT_PV" + "|" + code); |
| 246 | Object hourBtnClickPV = this.redisUtils.hget("MS_PV" + "|" + code, "ALL"); | 224 | Object hourBtnClickPV = this.redisUtils.hget("SUBJECT_PV" + "|" + code, "ALL"); |
| 247 | if (Objects.nonNull(hourBtnClickPV)) { | 225 | if (Objects.nonNull(hourBtnClickPV)) { |
| 248 | return Integer.valueOf(hourBtnClickPV.toString()); | 226 | return Integer.valueOf(hourBtnClickPV.toString()); |
| 249 | } | 227 | } |
| ... | @@ -260,8 +238,8 @@ public class PvUvCalculateTask { | ... | @@ -260,8 +238,8 @@ public class PvUvCalculateTask { |
| 260 | } else { | 238 | } else { |
| 261 | hourStr = String.valueOf(hour); | 239 | hourStr = String.valueOf(hour); |
| 262 | } | 240 | } |
| 263 | log.info("getHourUV ==>> key ==>> {}", "MS_UV" + "|" + code + "|" + LocalDate.now()+"|"+hourStr); | 241 | log.info("getHourUV ==>> key ==>> {}", "SUBJECT_UV" + "|" + code + "|" + LocalDate.now()+"|"+hourStr); |
| 264 | Object hourBtnClickUV = this.redisUtils.hget("MS_UV" + "|" + code + "|" + LocalDate.now()+"|"+hourStr, "ALL"); | 242 | Object hourBtnClickUV = this.redisUtils.hget("SUBJECT_UV" + "|" + code + "|" + LocalDate.now()+"|"+hourStr, "ALL"); |
| 265 | if (Objects.nonNull(hourBtnClickUV)) { | 243 | if (Objects.nonNull(hourBtnClickUV)) { |
| 266 | return Integer.valueOf(hourBtnClickUV.toString()); | 244 | return Integer.valueOf(hourBtnClickUV.toString()); |
| 267 | } | 245 | } |
| ... | @@ -271,8 +249,8 @@ public class PvUvCalculateTask { | ... | @@ -271,8 +249,8 @@ public class PvUvCalculateTask { |
| 271 | 249 | ||
| 272 | 250 | ||
| 273 | private Integer getDayUV(String code){ | 251 | private Integer getDayUV(String code){ |
| 274 | log.info("getDayBtnClickUV ==>> key ==>> {}", "MS_UV" + "|" + code + "|" + LocalDate.now()); | 252 | log.info("getDayBtnClickUV ==>> key ==>> {}", "SUBJECT_UV" + "|" + code + "|" + LocalDate.now()); |
| 275 | Object hourBtnClickUV = this.redisUtils.hget("MS_UV" + "|" + code + "|" + LocalDate.now(), "ALL"); | 253 | Object hourBtnClickUV = this.redisUtils.hget("SUBJECT_UV" + "|" + code + "|" + LocalDate.now(), "ALL"); |
| 276 | if (Objects.nonNull(hourBtnClickUV)) { | 254 | if (Objects.nonNull(hourBtnClickUV)) { |
| 277 | return Integer.valueOf(hourBtnClickUV.toString()); | 255 | return Integer.valueOf(hourBtnClickUV.toString()); |
| 278 | } | 256 | } |
| ... | @@ -282,8 +260,8 @@ public class PvUvCalculateTask { | ... | @@ -282,8 +260,8 @@ public class PvUvCalculateTask { |
| 282 | 260 | ||
| 283 | 261 | ||
| 284 | private Integer getAllUV(String code){ | 262 | private Integer getAllUV(String code){ |
| 285 | log.info("getAllUV ==>> key ==>> {}", "MS_UV" + "|" + code); | 263 | log.info("getAllUV ==>> key ==>> {}", "SUBJECT_UV" + "|" + code); |
| 286 | Object hourBtnClickUV = this.redisUtils.hget("MS_UV" + "|" + code, "ALL"); | 264 | Object hourBtnClickUV = this.redisUtils.hget("SUBJECT_UV" + "|" + code, "ALL"); |
| 287 | if (Objects.nonNull(hourBtnClickUV)) { | 265 | if (Objects.nonNull(hourBtnClickUV)) { |
| 288 | return Integer.valueOf(hourBtnClickUV.toString()); | 266 | return Integer.valueOf(hourBtnClickUV.toString()); |
| 289 | } | 267 | } |
| ... | @@ -291,10 +269,10 @@ public class PvUvCalculateTask { | ... | @@ -291,10 +269,10 @@ public class PvUvCalculateTask { |
| 291 | return 0; | 269 | return 0; |
| 292 | } | 270 | } |
| 293 | 271 | ||
| 294 | private List<Map<String,Object>> getAllMarketingActivityCode(){ | 272 | private List<Map<String,Object>> getAllSubjectCode(){ |
| 295 | 273 | ||
| 296 | String sql = "SELECT adr.`id` AS `id`, adr.`code` AS `code`, adr.`end_time` AS `endTime` FROM " + | 274 | String sql = "SELECT adr.`id` AS `id`, adr.`code` AS `code` FROM " + |
| 297 | " `act_marketing_activity` adr WHERE now() BETWEEN `start_time` AND DATE_ADD(`end_time`,INTERVAL 3 DAY)" + | 275 | " `x_subject` adr " + |
| 298 | " GROUP BY `code`"; | 276 | " GROUP BY `code`"; |
| 299 | return this.jdbcTemplate.queryForList(sql); | 277 | return this.jdbcTemplate.queryForList(sql); |
| 300 | 278 | ... | ... |
src/main/java/com/topdraw/business/process/calculate/task/SubscribeCalculateTask.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
| ... | @@ -35,11 +35,11 @@ public class TransferActivityBtnClickPvUvScheduleTask { | ... | @@ -35,11 +35,11 @@ public class TransferActivityBtnClickPvUvScheduleTask { |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * 统计订购转换数据 | 38 | * 统计按钮点击数据 |
| 39 | */ | 39 | */ |
| 40 | @Scheduled(cron = "#{transferActivityBtnClickPvUvScheduleTask.cron()}") | 40 | @Scheduled(cron = "#{transferActivityBtnClickPvUvScheduleTask.cron()}") |
| 41 | public void calculateSubscribe2Mysql(){ | 41 | public void calculateSubscribe2Mysql(){ |
| 42 | log.info("活动按钮点击次数统计 ===>>> 开始 !!!" + LocalDateTime.now()); | 42 | log.info("专题按钮点击次数统计 ===>>> 开始 !!!" + LocalDateTime.now()); |
| 43 | this.activityBtnClickPvUcCalculateTask.calculateRedisData2Mysql(); | 43 | this.activityBtnClickPvUcCalculateTask.calculateRedisData2Mysql(); |
| 44 | } | 44 | } |
| 45 | 45 | ... | ... |
| ... | @@ -39,7 +39,7 @@ public class TransferScheduleTask { | ... | @@ -39,7 +39,7 @@ public class TransferScheduleTask { |
| 39 | */ | 39 | */ |
| 40 | @Scheduled(cron = "#{transferScheduleTask.cron()}") | 40 | @Scheduled(cron = "#{transferScheduleTask.cron()}") |
| 41 | public void calculatePvUv2Mysql(){ | 41 | public void calculatePvUv2Mysql(){ |
| 42 | log.info("pv、uv统计 ===>>> 开始 !!!" + LocalDateTime.now()); | 42 | log.info("专题pv、uv统计 ===>>> 开始 !!!" + LocalDateTime.now()); |
| 43 | this.pvUvCalculateTask.calculateRedisData2Mysql(); | 43 | this.pvUvCalculateTask.calculateRedisData2Mysql(); |
| 44 | } | 44 | } |
| 45 | 45 | ... | ... |
| 1 | package com.topdraw.schedule; | ||
| 2 | |||
| 3 | import com.topdraw.business.process.calculate.task.SubscribeCalculateTask; | ||
| 4 | import lombok.extern.slf4j.Slf4j; | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | import org.springframework.beans.factory.annotation.Value; | ||
| 7 | import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 8 | import org.springframework.scheduling.annotation.Scheduled; | ||
| 9 | import org.springframework.stereotype.Component; | ||
| 10 | |||
| 11 | import java.time.LocalDateTime; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author : | ||
| 15 | * @description: | ||
| 16 | * @function : | ||
| 17 | * @date :Created in 2022/2/26 19:44 | ||
| 18 | * @version: : | ||
| 19 | * @modified By: | ||
| 20 | * @since : modified in 2022/2/26 19:44 | ||
| 21 | */ | ||
| 22 | @Component | ||
| 23 | @Slf4j | ||
| 24 | @EnableScheduling | ||
| 25 | public class TransferSubscribeScheduleTask { | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private SubscribeCalculateTask subscribeCalculateTask; | ||
| 29 | |||
| 30 | @Value("${cronSubscribe:50 0/5 * * * ?}") | ||
| 31 | // @Value("0/5 * * * * ?") | ||
| 32 | private String cron; | ||
| 33 | |||
| 34 | public String cron(){ | ||
| 35 | return cron; | ||
| 36 | } | ||
| 37 | |||
| 38 | /** | ||
| 39 | * 统计订购转换数据 | ||
| 40 | */ | ||
| 41 | @Scheduled(cron = "#{transferSubscribeScheduleTask.cron()}") | ||
| 42 | // @Scheduled(cron = "0/5 * * * * ?") | ||
| 43 | public void calculateSubscribe2Mysql(){ | ||
| 44 | log.info("订购数据统计 ===>>> 开始 !!!" + LocalDateTime.now()); | ||
| 45 | this.subscribeCalculateTask.calculateSubscribe2Mysql(); | ||
| 46 | } | ||
| 47 | |||
| 48 | } |
-
Please register or sign in to post a comment