内容访问统计
Showing
18 changed files
with
641 additions
and
0 deletions
1 | package com.topdraw.business.module.content.all.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-02-26 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="content_pv_uv") | ||
24 | public class ContentPVUV 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 = "template_param_value_id", nullable = false) | ||
34 | private Long templateParamValueId; | ||
35 | |||
36 | @Column(name = "btn_name", nullable = false) | ||
37 | private String btnName; | ||
38 | |||
39 | // 显示用名称,表示哪个按钮或者内容 | ||
40 | @Column(name = "code", nullable = false) | ||
41 | private String code; | ||
42 | |||
43 | // 显示用名称,表示哪个按钮或者内容 | ||
44 | @Column(name = "name", nullable = false) | ||
45 | private String name; | ||
46 | |||
47 | // pv值 | ||
48 | @Column(name = "pv", nullable = false) | ||
49 | private Integer pv; | ||
50 | |||
51 | // uv值 | ||
52 | @Column(name = "uv", nullable = false) | ||
53 | private Integer uv; | ||
54 | |||
55 | @Column(name = "lp_id") | ||
56 | private Long lpId; | ||
57 | |||
58 | @Column(name = "site_id") | ||
59 | private Long siteId; | ||
60 | |||
61 | // 创建时间 | ||
62 | @CreatedDate | ||
63 | @Column(name = "create_time") | ||
64 | private Timestamp createTime; | ||
65 | |||
66 | // 更新时间 | ||
67 | @LastModifiedDate | ||
68 | @Column(name = "update_time") | ||
69 | private Timestamp updateTime; | ||
70 | |||
71 | public void copy(ContentPVUV source){ | ||
72 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
73 | } | ||
74 | } |
src/main/java/com/topdraw/business/module/content/all/repository/ContentPVUVRepository.java
0 → 100644
1 | package com.topdraw.business.module.content.all.repository; | ||
2 | |||
3 | import com.topdraw.business.module.content.all.domain.ContentPVUV; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.Optional; | ||
8 | |||
9 | public interface ContentPVUVRepository extends JpaRepository<ContentPVUV, Long>, JpaSpecificationExecutor<ContentPVUV> { | ||
10 | |||
11 | Optional<ContentPVUV> findByTemplateParamValueIdAndCode(Long templateParamValueId, String code); | ||
12 | } |
1 | package com.topdraw.business.module.content.all.service; | ||
2 | |||
3 | import com.topdraw.business.module.content.all.domain.ContentPVUV; | ||
4 | |||
5 | public interface ContentPVUVService { | ||
6 | |||
7 | void create(ContentPVUV resources); | ||
8 | |||
9 | void update(ContentPVUV resources); | ||
10 | |||
11 | ContentPVUV findByBtnIdAndCode(Long btnId, String code); | ||
12 | |||
13 | } |
src/main/java/com/topdraw/business/module/content/all/service/impl/ContentPVUVServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.content.all.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.content.all.domain.ContentPVUV; | ||
4 | import com.topdraw.business.module.content.all.repository.ContentPVUVRepository; | ||
5 | import com.topdraw.business.module.content.all.service.ContentPVUVService; | ||
6 | import com.topdraw.utils.ValidationUtil; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.stereotype.Service; | ||
9 | import org.springframework.transaction.annotation.Transactional; | ||
10 | |||
11 | @Service | ||
12 | public class ContentPVUVServiceImpl implements ContentPVUVService { | ||
13 | |||
14 | @Autowired | ||
15 | private ContentPVUVRepository contentPVUVRepository; | ||
16 | |||
17 | @Override | ||
18 | @Transactional(rollbackFor = Exception.class) | ||
19 | public void create(ContentPVUV resources) { | ||
20 | contentPVUVRepository.save(resources); | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | @Transactional(rollbackFor = Exception.class) | ||
25 | public void update(ContentPVUV resources) { | ||
26 | ContentPVUV PvUv = contentPVUVRepository.findById(resources.getId()).orElseGet(ContentPVUV::new); | ||
27 | ValidationUtil.isNull( PvUv.getId(),"PvUv","id",resources.getId()); | ||
28 | PvUv.copy(resources); | ||
29 | contentPVUVRepository.save(PvUv); | ||
30 | } | ||
31 | |||
32 | public ContentPVUV findByBtnIdAndCode(Long btnId, String code){ | ||
33 | return contentPVUVRepository.findByTemplateParamValueIdAndCode(btnId, code).orElseGet(ContentPVUV::new); | ||
34 | } | ||
35 | |||
36 | } |
1 | package com.topdraw.business.module.content.day.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-02-26 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="content_pv_uv_day") | ||
24 | public class ContentPVUVDay 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 = "template_param_value_id", nullable = false) | ||
34 | private Long templateParamValueId; | ||
35 | |||
36 | @Column(name = "btn_name", nullable = false) | ||
37 | private String btnName; | ||
38 | |||
39 | // 显示用名称,表示哪个按钮或者内容 | ||
40 | @Column(name = "code", nullable = false) | ||
41 | private String code; | ||
42 | |||
43 | // 显示用名称,表示哪个按钮或者内容 | ||
44 | @Column(name = "name", nullable = false) | ||
45 | private String name; | ||
46 | |||
47 | // pv值 | ||
48 | @Column(name = "pv", nullable = false) | ||
49 | private Integer pv; | ||
50 | |||
51 | // uv值 | ||
52 | @Column(name = "uv", nullable = false) | ||
53 | private Integer uv; | ||
54 | |||
55 | @Column(name = "lp_id") | ||
56 | private Long lpId; | ||
57 | |||
58 | @Column(name = "site_id") | ||
59 | private Long siteId; | ||
60 | |||
61 | @Column(name = "day") | ||
62 | private String day; | ||
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(ContentPVUVDay source){ | ||
75 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
76 | } | ||
77 | } |
src/main/java/com/topdraw/business/module/content/day/repository/ContentPVUVDayRepository.java
0 → 100644
1 | package com.topdraw.business.module.content.day.repository; | ||
2 | |||
3 | import com.topdraw.business.module.content.day.domain.ContentPVUVDay; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.Optional; | ||
8 | |||
9 | public interface ContentPVUVDayRepository extends JpaRepository<ContentPVUVDay, Long>, JpaSpecificationExecutor<ContentPVUVDay> { | ||
10 | |||
11 | Optional<ContentPVUVDay> findByTemplateParamValueIdAndCodeAndDay(Long templateParamValueId, String code, String day); | ||
12 | } |
1 | package com.topdraw.business.module.content.day.service; | ||
2 | |||
3 | import com.topdraw.business.module.content.day.domain.ContentPVUVDay; | ||
4 | |||
5 | public interface ContentPVUVDayService { | ||
6 | |||
7 | void create(ContentPVUVDay resources); | ||
8 | |||
9 | void update(ContentPVUVDay resources); | ||
10 | |||
11 | ContentPVUVDay findByBtnIdAndCodeAndDay(Long btnId, String code, String day); | ||
12 | |||
13 | } |
src/main/java/com/topdraw/business/module/content/day/service/impl/ContentPVUVDayServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.content.day.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.content.day.domain.ContentPVUVDay; | ||
4 | import com.topdraw.business.module.content.day.repository.ContentPVUVDayRepository; | ||
5 | import com.topdraw.business.module.content.day.service.ContentPVUVDayService; | ||
6 | import com.topdraw.utils.ValidationUtil; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.stereotype.Service; | ||
9 | import org.springframework.transaction.annotation.Transactional; | ||
10 | |||
11 | @Service | ||
12 | public class ContentPVUVDayServiceImpl implements ContentPVUVDayService { | ||
13 | |||
14 | @Autowired | ||
15 | private ContentPVUVDayRepository contentPVUVRepository; | ||
16 | |||
17 | @Override | ||
18 | @Transactional(rollbackFor = Exception.class) | ||
19 | public void create(ContentPVUVDay resources) { | ||
20 | contentPVUVRepository.save(resources); | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | @Transactional(rollbackFor = Exception.class) | ||
25 | public void update(ContentPVUVDay resources) { | ||
26 | ContentPVUVDay PvUv = contentPVUVRepository.findById(resources.getId()).orElseGet(ContentPVUVDay::new); | ||
27 | ValidationUtil.isNull( PvUv.getId(),"PvUv","id",resources.getId()); | ||
28 | PvUv.copy(resources); | ||
29 | contentPVUVRepository.save(PvUv); | ||
30 | } | ||
31 | |||
32 | public ContentPVUVDay findByBtnIdAndCodeAndDay(Long btnId, String code, String day){ | ||
33 | return contentPVUVRepository.findByTemplateParamValueIdAndCodeAndDay(btnId, code, day).orElseGet(ContentPVUVDay::new); | ||
34 | } | ||
35 | |||
36 | } |
1 | package com.topdraw.business.module.content.hour.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2022-02-26 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="content_pv_uv_hour") | ||
24 | public class ContentPVUVHour 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 = "template_param_value_id", nullable = false) | ||
34 | private Long templateParamValueId; | ||
35 | |||
36 | @Column(name = "btn_name", nullable = false) | ||
37 | private String btnName; | ||
38 | |||
39 | // 显示用名称,表示哪个按钮或者内容 | ||
40 | @Column(name = "code", nullable = false) | ||
41 | private String code; | ||
42 | |||
43 | // 显示用名称,表示哪个按钮或者内容 | ||
44 | @Column(name = "name", nullable = false) | ||
45 | private String name; | ||
46 | |||
47 | // pv值 | ||
48 | @Column(name = "pv", nullable = false) | ||
49 | private Integer pv; | ||
50 | |||
51 | // uv值 | ||
52 | @Column(name = "uv", nullable = false) | ||
53 | private Integer uv; | ||
54 | |||
55 | @Column(name = "lp_id") | ||
56 | private Long lpId; | ||
57 | |||
58 | @Column(name = "site_id") | ||
59 | private Long siteId; | ||
60 | |||
61 | @Column(name = "day") | ||
62 | private String day; | ||
63 | |||
64 | @Column(name = "hour") | ||
65 | private Integer hour; | ||
66 | |||
67 | // 创建时间 | ||
68 | @CreatedDate | ||
69 | @Column(name = "create_time") | ||
70 | private Timestamp createTime; | ||
71 | |||
72 | // 更新时间 | ||
73 | @LastModifiedDate | ||
74 | @Column(name = "update_time") | ||
75 | private Timestamp updateTime; | ||
76 | |||
77 | public void copy(ContentPVUVHour source){ | ||
78 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
79 | } | ||
80 | } |
src/main/java/com/topdraw/business/module/content/hour/repository/ContentPVUVHourRepository.java
0 → 100644
1 | package com.topdraw.business.module.content.hour.repository; | ||
2 | |||
3 | import com.topdraw.business.module.content.hour.domain.ContentPVUVHour; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.Optional; | ||
8 | |||
9 | public interface ContentPVUVHourRepository extends JpaRepository<ContentPVUVHour, Long>, JpaSpecificationExecutor<ContentPVUVHour> { | ||
10 | |||
11 | Optional<ContentPVUVHour> findByTemplateParamValueIdAndCodeAndDayAndHour(Long templateParamValueId, String code, String day, Integer hour); | ||
12 | } |
src/main/java/com/topdraw/business/module/content/hour/service/ContentPVUVHourService.java
0 → 100644
1 | package com.topdraw.business.module.content.hour.service; | ||
2 | |||
3 | import com.topdraw.business.module.content.hour.domain.ContentPVUVHour; | ||
4 | |||
5 | public interface ContentPVUVHourService { | ||
6 | |||
7 | void create(ContentPVUVHour resources); | ||
8 | |||
9 | void update(ContentPVUVHour resources); | ||
10 | |||
11 | ContentPVUVHour findByBtnIdAndCodeAndDayAndHour(Long btnId, String code, String day, Integer hour); | ||
12 | |||
13 | } |
src/main/java/com/topdraw/business/module/content/hour/service/impl/ContentPVUVHourServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.content.hour.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.content.hour.domain.ContentPVUVHour; | ||
4 | import com.topdraw.business.module.content.hour.repository.ContentPVUVHourRepository; | ||
5 | import com.topdraw.business.module.content.hour.service.ContentPVUVHourService; | ||
6 | import com.topdraw.utils.ValidationUtil; | ||
7 | import org.springframework.beans.factory.annotation.Autowired; | ||
8 | import org.springframework.stereotype.Service; | ||
9 | import org.springframework.transaction.annotation.Transactional; | ||
10 | |||
11 | @Service | ||
12 | public class ContentPVUVHourServiceImpl implements ContentPVUVHourService { | ||
13 | |||
14 | @Autowired | ||
15 | private ContentPVUVHourRepository contentPVUVRepository; | ||
16 | |||
17 | @Override | ||
18 | @Transactional(rollbackFor = Exception.class) | ||
19 | public void create(ContentPVUVHour resources) { | ||
20 | contentPVUVRepository.save(resources); | ||
21 | } | ||
22 | |||
23 | @Override | ||
24 | @Transactional(rollbackFor = Exception.class) | ||
25 | public void update(ContentPVUVHour resources) { | ||
26 | ContentPVUVHour PvUv = contentPVUVRepository.findById(resources.getId()).orElseGet(ContentPVUVHour::new); | ||
27 | ValidationUtil.isNull( PvUv.getId(),"PvUv","id",resources.getId()); | ||
28 | PvUv.copy(resources); | ||
29 | contentPVUVRepository.save(PvUv); | ||
30 | } | ||
31 | |||
32 | public ContentPVUVHour findByBtnIdAndCodeAndDayAndHour(Long btnId, String code, String day, Integer hour){ | ||
33 | return contentPVUVRepository.findByTemplateParamValueIdAndCodeAndDayAndHour(btnId, code, day, hour).orElseGet(ContentPVUVHour::new); | ||
34 | } | ||
35 | |||
36 | } |
1 | package com.topdraw.business.module.template.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author zhang sheng xiang | ||
17 | * @date 2021-09-07 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name = "tp_template_param_value") | ||
24 | public class TemplateParamValue implements Serializable { | ||
25 | |||
26 | // ID | ||
27 | @Id | ||
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
29 | @Column(name = "id") | ||
30 | private Long id; | ||
31 | |||
32 | // 名称 | ||
33 | @Column(name = "name") | ||
34 | private String name; | ||
35 | |||
36 | // 标识 | ||
37 | @Column(name = "code") | ||
38 | private String code; | ||
39 | |||
40 | //模板参数id | ||
41 | @Column(name = "template_param_id") | ||
42 | private Long templateParamId; | ||
43 | |||
44 | // 模板关联实体类型 1: 活动类型;2:专题类型;3:页面类型 | ||
45 | @Column(name = "content_type") | ||
46 | private Integer contentType; | ||
47 | |||
48 | // 模板关联实体id | ||
49 | @Column(name = "content_id") | ||
50 | private Long contentId; | ||
51 | |||
52 | // 参数类型 0:实体;1:常量;2:虚拟实体;3:图片 | ||
53 | @Column(name = "type", nullable = false) | ||
54 | private Integer type; | ||
55 | |||
56 | // 组键 | ||
57 | @Column(name = "`group`") | ||
58 | private String group; | ||
59 | |||
60 | // 组名称 | ||
61 | @Column(name = "group_name") | ||
62 | private String groupName; | ||
63 | |||
64 | // 实体类型(仅当参数类型为实体时有效) | ||
65 | @Column(name = "entity") | ||
66 | private String entity; | ||
67 | |||
68 | // 值(实体类型下为实体id,常量类型下为常量值,虚拟实体和图片此属性无效) | ||
69 | @Column(name = "`value`") | ||
70 | private String value; | ||
71 | |||
72 | // 资源标志符,供模板引擎识别调度 | ||
73 | @Column(name = "`uri`") | ||
74 | private String uri; | ||
75 | |||
76 | // 对象标识 | ||
77 | @Column(name = "obj_code") | ||
78 | private String objCode; | ||
79 | |||
80 | // 描述 | ||
81 | @Column(name = "description") | ||
82 | private String description; | ||
83 | |||
84 | // 图片 | ||
85 | @Column(name = "image") | ||
86 | private String image; | ||
87 | |||
88 | // 图片 | ||
89 | @Column(name = "images") | ||
90 | private String images; | ||
91 | |||
92 | // 顺序 | ||
93 | @Column(name = "sequence", nullable = false) | ||
94 | private Integer sequence; | ||
95 | |||
96 | @Column(name = "component_data") | ||
97 | private String componentData; | ||
98 | |||
99 | // 组内顺序 | ||
100 | @Column(name = "group_index") | ||
101 | private Integer groupIndex; | ||
102 | |||
103 | //事件类型 0:抽奖;1:投票;2:答题;3:闯关;4:签到(当entity是activity时生效) | ||
104 | @Column(name = "activity_type") | ||
105 | private Integer activity_type; | ||
106 | |||
107 | //当前页面标识 | ||
108 | @Column(name = "page_code") | ||
109 | private String pageCode; | ||
110 | |||
111 | @Column(name = "page_title") | ||
112 | private String pageTitle; | ||
113 | |||
114 | //展现形式 | ||
115 | @Column(name = "display_form") | ||
116 | private Integer displayForm; | ||
117 | |||
118 | @Column(name = "top") | ||
119 | private Integer top; | ||
120 | |||
121 | @Column(name = "`left`") | ||
122 | private Integer left; | ||
123 | |||
124 | @Column(name = "width") | ||
125 | private Integer width; | ||
126 | |||
127 | @Column(name = "height") | ||
128 | private Integer height; | ||
129 | |||
130 | // 创建时间 | ||
131 | @CreatedDate | ||
132 | @Column(name = "create_time") | ||
133 | private Timestamp createTime; | ||
134 | |||
135 | // 更新时间 | ||
136 | @LastModifiedDate | ||
137 | @Column(name = "update_time") | ||
138 | private Timestamp updateTime; | ||
139 | |||
140 | public void copy(TemplateParamValue source){ | ||
141 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
142 | } | ||
143 | } |
src/main/java/com/topdraw/business/module/template/repository/TemplateParamValueRepository.java
0 → 100644
1 | package com.topdraw.business.module.template.repository; | ||
2 | |||
3 | import com.topdraw.business.module.template.domain.TemplateParamValue; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | |||
7 | import java.util.List; | ||
8 | |||
9 | public interface TemplateParamValueRepository extends JpaRepository<TemplateParamValue, Long>, JpaSpecificationExecutor<TemplateParamValue> { | ||
10 | |||
11 | List<TemplateParamValue> findByIdIn(List<Long> ids); | ||
12 | } |
src/main/java/com/topdraw/business/module/template/service/impl/TemplateParamValueServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.template.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.template.domain.TemplateParamValue; | ||
4 | import com.topdraw.business.module.template.repository.TemplateParamValueRepository; | ||
5 | import com.topdraw.business.module.template.service.TemplateParamValueService; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Service; | ||
8 | |||
9 | import java.util.List; | ||
10 | import java.util.Map; | ||
11 | import java.util.stream.Collectors; | ||
12 | |||
13 | @Service | ||
14 | public class TemplateParamValueServiceImpl implements TemplateParamValueService { | ||
15 | |||
16 | @Autowired | ||
17 | private TemplateParamValueRepository templateParamValueRepository; | ||
18 | |||
19 | public Map<Long, String> btnNames(List<Long> btnIds){ | ||
20 | List<TemplateParamValue> list = templateParamValueRepository.findByIdIn(btnIds); | ||
21 | Map<Long, String> result = list.stream().collect(Collectors.toMap(TemplateParamValue::getId, TemplateParamValue::getName)); | ||
22 | return result; | ||
23 | } | ||
24 | |||
25 | } |
This diff is collapsed.
Click to expand it.
1 | package com.topdraw.schedule; | ||
2 | |||
3 | import com.topdraw.business.process.calculate.task.ContentCalculateTask; | ||
4 | import com.topdraw.business.process.calculate.task.PvUvCalculateTask; | ||
5 | import lombok.extern.slf4j.Slf4j; | ||
6 | import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.beans.factory.annotation.Value; | ||
8 | import org.springframework.scheduling.annotation.EnableScheduling; | ||
9 | import org.springframework.scheduling.annotation.Scheduled; | ||
10 | import org.springframework.stereotype.Component; | ||
11 | |||
12 | import java.time.LocalDateTime; | ||
13 | |||
14 | @Component | ||
15 | @Slf4j | ||
16 | @EnableScheduling | ||
17 | public class TransferContentScheduleTask { | ||
18 | |||
19 | @Autowired | ||
20 | private ContentCalculateTask contentCalculateTask; | ||
21 | |||
22 | @Value("${cronContent:0 0/5 * * * ?}") | ||
23 | private String cron; | ||
24 | |||
25 | public String cron(){ | ||
26 | return cron; | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * 统计pv、uv | ||
31 | */ | ||
32 | @Scheduled(cron = "#{transferContentScheduleTask.cron()}") | ||
33 | public void calculatePvUv2Mysql(){ | ||
34 | log.info("专题内容pv、uv统计 ===>>> 开始 !!!" + LocalDateTime.now()); | ||
35 | this.contentCalculateTask.calculateRedisData2Mysql(); | ||
36 | } | ||
37 | |||
38 | } |
-
Please register or sign in to post a comment