1.添加消费成长报告mq
Showing
13 changed files
with
462 additions
and
16 deletions
1 | package com.topdraw.business.module.user.iptv.growreport.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-07-07 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="uc_growth_report") | ||
24 | public class GrowthReport implements Serializable { | ||
25 | |||
26 | @Id | ||
27 | @Column(name = "id") | ||
28 | private Long id; | ||
29 | |||
30 | // 用户id | ||
31 | @Column(name = "user_id") | ||
32 | private Long userId; | ||
33 | |||
34 | // 会员id | ||
35 | @Column(name = "member_id") | ||
36 | private Long memberId; | ||
37 | |||
38 | // 会员code | ||
39 | @Column(name = "member_code") | ||
40 | private String memberCode; | ||
41 | |||
42 | // 大屏账号 | ||
43 | @Column(name = "platform_account") | ||
44 | private String platformAccount; | ||
45 | |||
46 | // 开始日期 | ||
47 | @Column(name = "start_date") | ||
48 | private String startDate; | ||
49 | |||
50 | // 结束时间 | ||
51 | @Column(name = "end_date") | ||
52 | private String endDate; | ||
53 | |||
54 | // 栏目播放时长数据 | ||
55 | @Column(name = "data") | ||
56 | private String data; | ||
57 | |||
58 | // 创建时间 | ||
59 | @CreatedDate | ||
60 | @Column(name = "create_time") | ||
61 | private Timestamp createTime; | ||
62 | |||
63 | // 修改时间 | ||
64 | @LastModifiedDate | ||
65 | @Column(name = "update_time") | ||
66 | private Timestamp updateTime; | ||
67 | |||
68 | public void copy(GrowthReport source){ | ||
69 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
70 | } | ||
71 | } |
1 | package com.topdraw.business.module.user.iptv.growreport.repository; | ||
2 | |||
3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
6 | import org.springframework.data.jpa.repository.Modifying; | ||
7 | import org.springframework.data.jpa.repository.Query; | ||
8 | |||
9 | import java.util.Optional; | ||
10 | |||
11 | /** | ||
12 | * @author XiangHan | ||
13 | * @date 2022-07-07 | ||
14 | */ | ||
15 | public interface GrowthReportRepository extends JpaRepository<GrowthReport, Long>, JpaSpecificationExecutor<GrowthReport> { | ||
16 | |||
17 | Optional<GrowthReport> findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String startDate, String endDate); | ||
18 | |||
19 | @Modifying | ||
20 | @Query(value = "UPDATE `uc_growth_report` SET `data` = ?2, `update_time` = now() WHERE `id` =?1", nativeQuery = true) | ||
21 | Integer updateGrowthReportData(Long id, String data); | ||
22 | } |
src/main/java/com/topdraw/business/module/user/iptv/growreport/service/GrowthReportService.java
0 → 100644
1 | package com.topdraw.business.module.user.iptv.growreport.service; | ||
2 | |||
3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
4 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
5 | |||
6 | /** | ||
7 | * @author XiangHan | ||
8 | * @date 2022-07-07 | ||
9 | */ | ||
10 | public interface GrowthReportService { | ||
11 | |||
12 | /** | ||
13 | * 根据ID查询 | ||
14 | * @param id ID | ||
15 | * @return GrowthReportDTO | ||
16 | */ | ||
17 | GrowthReportDTO findById(Long id); | ||
18 | |||
19 | void create(GrowthReport resources); | ||
20 | |||
21 | void update(GrowthReport resources); | ||
22 | |||
23 | void delete(Long id); | ||
24 | |||
25 | GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay); | ||
26 | |||
27 | Integer updateGrowthReportData(Long id, String data); | ||
28 | } |
src/main/java/com/topdraw/business/module/user/iptv/growreport/service/dto/GrowthReportDTO.java
0 → 100644
1 | package com.topdraw.business.module.user.iptv.growreport.service.dto; | ||
2 | |||
3 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
4 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
5 | import lombok.Data; | ||
6 | |||
7 | import java.io.Serializable; | ||
8 | import java.sql.Timestamp; | ||
9 | |||
10 | |||
11 | /** | ||
12 | * @author XiangHan | ||
13 | * @date 2022-07-07 | ||
14 | */ | ||
15 | @Data | ||
16 | public class GrowthReportDTO implements Serializable { | ||
17 | |||
18 | // 处理精度丢失问题 | ||
19 | @JsonSerialize(using= ToStringSerializer.class) | ||
20 | private Long id; | ||
21 | |||
22 | // 用户id | ||
23 | private Long userId; | ||
24 | |||
25 | // 会员id | ||
26 | private Long memberId; | ||
27 | |||
28 | // 会员code | ||
29 | private String memberCode; | ||
30 | |||
31 | // 大屏账号 | ||
32 | private String platformAccount; | ||
33 | |||
34 | // 开始日期 | ||
35 | private String startDate; | ||
36 | |||
37 | // 结束时间 | ||
38 | private String endDate; | ||
39 | |||
40 | // 栏目播放时长数据 | ||
41 | private String data; | ||
42 | |||
43 | // 创建时间 | ||
44 | private Timestamp createTime; | ||
45 | |||
46 | // 修改时间 | ||
47 | private Timestamp updateTime; | ||
48 | } |
1 | package com.topdraw.business.module.user.iptv.growreport.service.impl; | ||
2 | |||
3 | import cn.hutool.core.lang.Snowflake; | ||
4 | import cn.hutool.core.util.IdUtil; | ||
5 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
6 | import com.topdraw.business.module.user.iptv.growreport.repository.GrowthReportRepository; | ||
7 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
8 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
9 | import com.topdraw.business.module.user.iptv.growreport.service.mapper.GrowthReportMapper; | ||
10 | import com.topdraw.utils.ValidationUtil; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | ||
12 | import org.springframework.dao.EmptyResultDataAccessException; | ||
13 | import org.springframework.stereotype.Service; | ||
14 | import org.springframework.transaction.annotation.Propagation; | ||
15 | import org.springframework.transaction.annotation.Transactional; | ||
16 | import org.springframework.util.Assert; | ||
17 | |||
18 | /** | ||
19 | * @author XiangHan | ||
20 | * @date 2022-07-07 | ||
21 | */ | ||
22 | @Service | ||
23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
24 | public class GrowthReportServiceImpl implements GrowthReportService { | ||
25 | |||
26 | @Autowired | ||
27 | private GrowthReportRepository growthReportRepository; | ||
28 | |||
29 | @Autowired | ||
30 | private GrowthReportMapper growthReportMapper; | ||
31 | |||
32 | @Override | ||
33 | public GrowthReportDTO findById(Long id) { | ||
34 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseGet(GrowthReport::new); | ||
35 | ValidationUtil.isNull(growthReport.getId(),"GrowthReport","id",id); | ||
36 | return this.growthReportMapper.toDto(growthReport); | ||
37 | } | ||
38 | |||
39 | @Override | ||
40 | @Transactional(rollbackFor = Exception.class) | ||
41 | public void create(GrowthReport resources) { | ||
42 | Snowflake snowflake = IdUtil.createSnowflake(1, 1); | ||
43 | resources.setId(snowflake.nextId()); | ||
44 | this.growthReportRepository.save(resources); | ||
45 | } | ||
46 | |||
47 | @Override | ||
48 | @Transactional(rollbackFor = Exception.class) | ||
49 | public void update(GrowthReport resources) { | ||
50 | GrowthReport growthReport = this.growthReportRepository.findById(resources.getId()).orElseGet(GrowthReport::new); | ||
51 | ValidationUtil.isNull( growthReport.getId(),"GrowthReport","id",resources.getId()); | ||
52 | growthReport.copy(resources); | ||
53 | this.growthReportRepository.save(growthReport); | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | @Transactional(rollbackFor = Exception.class) | ||
58 | public void delete(Long id) { | ||
59 | Assert.notNull(id, "The given id must not be null!"); | ||
60 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseThrow( | ||
61 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", GrowthReport.class, id), 1)); | ||
62 | this.growthReportRepository.delete(growthReport); | ||
63 | } | ||
64 | |||
65 | @Override | ||
66 | public GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay) { | ||
67 | GrowthReport growthReport = this.growthReportRepository.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay).orElseGet(GrowthReport::new); | ||
68 | return this.growthReportMapper.toDto(growthReport); | ||
69 | } | ||
70 | |||
71 | @Override | ||
72 | @Transactional(rollbackFor = Exception.class) | ||
73 | public Integer updateGrowthReportData(Long id, String data) { | ||
74 | return this.growthReportRepository.updateGrowthReportData(id, data); | ||
75 | } | ||
76 | |||
77 | |||
78 | } |
1 | package com.topdraw.business.module.user.iptv.growreport.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
5 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2022-07-07 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface GrowthReportMapper extends BaseMapper<GrowthReportDTO, GrowthReport> { | ||
15 | |||
16 | } |
... | @@ -8,6 +8,9 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ... | @@ -8,6 +8,9 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
8 | import com.topdraw.business.module.member.service.MemberService; | 8 | import com.topdraw.business.module.member.service.MemberService; |
9 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
10 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 10 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
11 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
12 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
13 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
11 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 14 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
12 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 15 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
13 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 16 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
... | @@ -18,6 +21,7 @@ import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; | ... | @@ -18,6 +21,7 @@ import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; |
18 | import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO; | 21 | import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO; |
19 | import com.topdraw.exception.EntityNotFoundException; | 22 | import com.topdraw.exception.EntityNotFoundException; |
20 | import com.topdraw.exception.GlobeExceptionMsg; | 23 | import com.topdraw.exception.GlobeExceptionMsg; |
24 | import com.topdraw.util.TimestampUtil; | ||
21 | import lombok.extern.slf4j.Slf4j; | 25 | import lombok.extern.slf4j.Slf4j; |
22 | import org.apache.commons.lang3.StringUtils; | 26 | import org.apache.commons.lang3.StringUtils; |
23 | import org.springframework.beans.BeanUtils; | 27 | import org.springframework.beans.BeanUtils; |
... | @@ -42,25 +46,40 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -42,25 +46,40 @@ public class UserOperationServiceImpl implements UserOperationService { |
42 | private UserWeixinService userWeixinService; | 46 | private UserWeixinService userWeixinService; |
43 | @Autowired | 47 | @Autowired |
44 | private MemberProfileService memberProfileService; | 48 | private MemberProfileService memberProfileService; |
49 | @Autowired | ||
50 | private GrowthReportService growthReportService; | ||
51 | |||
52 | |||
53 | public void asyncsaveGrowthReport(GrowthReport growthReport) { | ||
54 | String platformAccount = growthReport.getPlatformAccount(); | ||
55 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
56 | if (Objects.isNull(userTvDTO.getId())){ | ||
57 | log.error("保存成长报告失败,大屏信息不存在[asyncsaveGrowthReport#]"); | ||
58 | return; | ||
59 | } | ||
60 | |||
61 | String weekFirstDay = com.topdraw.util.DateUtil.getWeekFirstDay(); | ||
62 | String weekLastDay = com.topdraw.util.DateUtil.getWeekLastDay(); | ||
63 | GrowthReportDTO growthReportDTO = this.growthReportService.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay); | ||
64 | |||
65 | if (Objects.isNull(growthReportDTO.getId())) { | ||
45 | 66 | ||
67 | Long id = userTvDTO.getId(); | ||
68 | Long memberId = userTvDTO.getMemberId(); | ||
69 | growthReport.setUserId(id); | ||
70 | growthReport.setMemberId(memberId); | ||
71 | growthReport.setStartDate(weekFirstDay); | ||
72 | growthReport.setEndDate(weekLastDay); | ||
46 | 73 | ||
47 | /* {"entityBody":"{\"memberDTO\":{\"birthday\":\"1900-01-01\",\"blackStatus\":0,\"code\":\"1540299597507502080\"," + | 74 | this.growthReportService.create(growthReport); |
48 | "\"couponAmount\":0,\"createTime\":1656071016149,\"dueCouponAmount\":0,\"duePoints\":0,\"exp\":0,\"gender\":-1," + | ||
49 | "\"id\":62515,\"level\":1,\"points\":0,\"status\":1," + | ||
50 | "\"type\":2,\"updateTime\":1656071016149,\"vip\":0}," + | ||
51 | "" + | ||
52 | "\"userWeixinDTO\":{\"accessToken\":\"\",\"appid\":\"wx0f7db04bbc5aa004\"," + | ||
53 | "\"city\":\"\",\"country\":\"\",\"createBy\":\"system\"," + | ||
54 | "\"createTime\":1656071016625,\"description\":\"\"," + | ||
55 | "\"headimgurl\":\"\",\"id\":127987," + | ||
56 | "\"memberCode\":\"1540299597507502080\"," + | ||
57 | "\"memberId\":62515,\"nickname\":\"\"," + | ||
58 | "\"openid\":\"oJ4Pl4rRiLHLfPx2Zey0YUC-89T0\"," + | ||
59 | "\"privilege\":\"\",\"province\":\"\"," + | ||
60 | "\"refreshToken\":\"\",\"sex\":-1,\"sourceDesc\":\"\",\"sourceEntity\":\"\"," + | ||
61 | "\"sourceId\":\"\",\"sourceType\":\"\",\"sourceUser\":0,\"status\":0,\"syncStatus\":0," + | ||
62 | "\"unionid\":\"oqDha5lxMuXYMGgT6gyLIFL7VumM\",\"updateBy\":\"system\",\"updateTime\":1656071016625}}*/ | ||
63 | 75 | ||
76 | } else { | ||
77 | |||
78 | this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData()); | ||
79 | |||
80 | } | ||
81 | |||
82 | } | ||
64 | 83 | ||
65 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 84 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
66 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { | 85 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { | ... | ... |
... | @@ -16,6 +16,26 @@ public class RabbitMqCustomConfig { | ... | @@ -16,6 +16,26 @@ public class RabbitMqCustomConfig { |
16 | private List<Map<String, String>> list; | 16 | private List<Map<String, String>> list; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * growthReport | ||
20 | * @return | ||
21 | */ | ||
22 | public Map<String, String> ucgGrowthReportInfo() { | ||
23 | |||
24 | if (CollectionUtils.isNotEmpty(list)) { | ||
25 | |||
26 | for (Map<String, String> map : list) { | ||
27 | String type = map.get("source"); | ||
28 | if (type.equalsIgnoreCase("growthReport")) { | ||
29 | return map; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | } | ||
34 | |||
35 | return null; | ||
36 | } | ||
37 | |||
38 | /** | ||
19 | * viewRecord | 39 | * viewRecord |
20 | * @return | 40 | * @return |
21 | */ | 41 | */ | ... | ... |
... | @@ -160,6 +160,53 @@ public class RabbitMqSourceConfig { | ... | @@ -160,6 +160,53 @@ public class RabbitMqSourceConfig { |
160 | 160 | ||
161 | /**************************************************uc-getaway 2 uc-consumer*************************************************************/ | 161 | /**************************************************uc-getaway 2 uc-consumer*************************************************************/ |
162 | 162 | ||
163 | |||
164 | |||
165 | @Value("#{rabbitMqCustomConfig.ucgGrowthReportInfo()}") | ||
166 | private Map<String, String> ucgGrowthReportInfo; | ||
167 | |||
168 | public static final String GROWTH_REPORT_EXCHANGE = "growthReport.exchange"; | ||
169 | public static final String GROWTH_REPORT_QUEUE = "growthReport.queue"; | ||
170 | |||
171 | public String getGrowthReportQueue(){ | ||
172 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
173 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
174 | String queue = ucgGrowthReportInfo.get("queue"); | ||
175 | return queue; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | return GROWTH_REPORT_QUEUE; | ||
180 | } | ||
181 | |||
182 | public String getGrowthReportSource(){ | ||
183 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
184 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
185 | String source = ucgGrowthReportInfo.get("active"); | ||
186 | if (StringUtils.isNotBlank(source)) { | ||
187 | return this.chargeSource(source); | ||
188 | } else { | ||
189 | return SERVICE_; | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | |||
194 | return SERVICE_; | ||
195 | } | ||
196 | |||
197 | public String getGrowthReportStartUp(){ | ||
198 | if (Objects.nonNull(ucgGrowthReportInfo)) { | ||
199 | if (MapUtils.isNotEmpty(ucgGrowthReportInfo)) { | ||
200 | String source = ucgGrowthReportInfo.get("active"); | ||
201 | if (StringUtils.isNotBlank(source)) { | ||
202 | return "true"; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | return "false"; | ||
208 | } | ||
209 | |||
163 | public static final String EVENT_EXCHANGE = "event.exchange"; | 210 | public static final String EVENT_EXCHANGE = "event.exchange"; |
164 | public static final String EVENT_QUEUE = "event.queue"; | 211 | public static final String EVENT_QUEUE = "event.queue"; |
165 | 212 | ... | ... |
... | @@ -78,6 +78,47 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -78,6 +78,47 @@ public class UcGatewayIptv2IptvConsumer { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | |||
82 | /** | ||
83 | * @description 删除全部收藏记录 | ||
84 | * @param content 消息内容 | ||
85 | */ | ||
86 | @RabbitHandler | ||
87 | @RabbitListener(queues = "#{rabbitMqSourceConfig.getGrowthReportQueue()}", | ||
88 | containerFactory = "#{rabbitMqSourceConfig.getGrowthReportSource()}", | ||
89 | autoStartup = "#{rabbitMqSourceConfig.getGrowthReportStartUp()}", | ||
90 | ackMode = "AUTO") | ||
91 | public void dealGrowthReport(Channel channel, Message message, String content) throws IOException { | ||
92 | log.info("receive dealGrowthReport add message, content {}", content); | ||
93 | |||
94 | try { | ||
95 | |||
96 | JSONObject jsonObject = JSON.parseObject(content, JSONObject.class); | ||
97 | if (Objects.nonNull(content)) { | ||
98 | Object msgData = jsonObject.get("msgData"); | ||
99 | JSONObject response = this.restTemplateClient.saveGrowthReport(JSON.toJSONString(msgData)); | ||
100 | if (Objects.isNull(response)) { | ||
101 | log.error("同步大屏成长报告失败,uce接口响应超时"); | ||
102 | } | ||
103 | } | ||
104 | |||
105 | } catch (Exception e) { | ||
106 | log.error("同步大屏成长报告失败,cause ==>> {}", e.getMessage()); | ||
107 | |||
108 | if (MapUtils.isNotEmpty(error)) { | ||
109 | String errorStart = this.error.get("start"); | ||
110 | |||
111 | if (errorStart.equalsIgnoreCase("true")) { | ||
112 | String fileName = this.error.get("fileName")+"_"+ LocalDate.now() +".log"; | ||
113 | String filePath = this.error.get("filePath"); | ||
114 | String filePath1 = filePath+fileName; | ||
115 | FileUtil.writeStringToFile2(filePath1, content, e.getMessage()); | ||
116 | } | ||
117 | |||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
81 | /** | 122 | /** |
82 | * @description 添加收藏记录 | 123 | * @description 添加收藏记录 |
83 | * @param content 消息内容 | 124 | * @param content 消息内容 |
... | @@ -348,4 +389,10 @@ public class UcGatewayIptv2IptvConsumer { | ... | @@ -348,4 +389,10 @@ public class UcGatewayIptv2IptvConsumer { |
348 | } | 389 | } |
349 | } | 390 | } |
350 | } | 391 | } |
392 | |||
393 | |||
394 | |||
395 | |||
396 | |||
397 | |||
351 | } | 398 | } | ... | ... |
... | @@ -6,12 +6,14 @@ import com.topdraw.config.ResponseStatus; | ... | @@ -6,12 +6,14 @@ import com.topdraw.config.ResponseStatus; |
6 | import com.topdraw.mq.consumer.UcEventBusIptv2ManagementUcEngine; | 6 | import com.topdraw.mq.consumer.UcEventBusIptv2ManagementUcEngine; |
7 | import com.topdraw.mq.domain.DataSyncMsg; | 7 | import com.topdraw.mq.domain.DataSyncMsg; |
8 | import com.topdraw.mq.domain.SubscribeBean; | 8 | import com.topdraw.mq.domain.SubscribeBean; |
9 | import com.topdraw.util.Base64Util; | ||
9 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.core.env.Environment; | 12 | import org.springframework.core.env.Environment; |
12 | import org.springframework.http.ResponseEntity; | 13 | import org.springframework.http.ResponseEntity; |
13 | import org.springframework.http.client.SimpleClientHttpRequestFactory; | 14 | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
14 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
16 | import org.springframework.util.Base64Utils; | ||
15 | import org.springframework.web.client.RestTemplate; | 17 | import org.springframework.web.client.RestTemplate; |
16 | 18 | ||
17 | import javax.annotation.PostConstruct; | 19 | import javax.annotation.PostConstruct; |
... | @@ -153,6 +155,23 @@ public class RestTemplateClient { | ... | @@ -153,6 +155,23 @@ public class RestTemplateClient { |
153 | return null; | 155 | return null; |
154 | } | 156 | } |
155 | 157 | ||
158 | public JSONObject saveGrowthReport(String content) { | ||
159 | try { | ||
160 | String url = BASE_URL + "/uce/userOperation/saveGrowthReport"; | ||
161 | String encode = Base64Utils.encodeToString(content.getBytes()); | ||
162 | log.info("request url is ==>> {} || param is ==>> {} ", url, encode); | ||
163 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, encode, String.class); | ||
164 | log.info("response ==>> {}", responseEntity); | ||
165 | |||
166 | return getParseResponseResult(responseEntity); | ||
167 | |||
168 | } catch (Exception e) { | ||
169 | log.error("删除所有观影记录(ApiUti.deleteAllCollection)信息时出现异常,cause ==>> {}", e.getMessage()); | ||
170 | } | ||
171 | |||
172 | return null; | ||
173 | } | ||
174 | |||
156 | public JSONObject dealViewRecord(String content) { | 175 | public JSONObject dealViewRecord(String content) { |
157 | try { | 176 | try { |
158 | String url = BASE_URL + "/uce/userOperation/addCollection"; | 177 | String url = BASE_URL + "/uce/userOperation/addCollection"; | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.util; | ... | @@ -2,6 +2,7 @@ package com.topdraw.util; |
2 | 2 | ||
3 | import java.text.ParseException; | 3 | import java.text.ParseException; |
4 | import java.text.SimpleDateFormat; | 4 | import java.text.SimpleDateFormat; |
5 | import java.util.Calendar; | ||
5 | import java.util.Date; | 6 | import java.util.Date; |
6 | 7 | ||
7 | public class DateUtil { | 8 | public class DateUtil { |
... | @@ -27,4 +28,28 @@ public class DateUtil { | ... | @@ -27,4 +28,28 @@ public class DateUtil { |
27 | 28 | ||
28 | return null; | 29 | return null; |
29 | } | 30 | } |
31 | |||
32 | public static String getWeekFirstDay() { | ||
33 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
34 | |||
35 | Calendar calendar1=Calendar.getInstance(); | ||
36 | |||
37 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); | ||
38 | |||
39 | System.out.println("本周日: "+sdf.format(calendar1.getTime())); | ||
40 | |||
41 | return sdf.format(calendar1.getTime()); | ||
42 | } | ||
43 | |||
44 | public static String getWeekLastDay() { | ||
45 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
46 | |||
47 | Calendar calendar1=Calendar.getInstance(); | ||
48 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); | ||
49 | |||
50 | System.out.println("本周六: "+sdf.format(calendar1.getTime())); | ||
51 | |||
52 | return sdf.format(calendar1.getTime()); | ||
53 | } | ||
54 | |||
30 | } | 55 | } | ... | ... |
... | @@ -99,6 +99,12 @@ mutil-mq: | ... | @@ -99,6 +99,12 @@ mutil-mq: |
99 | service: | 99 | service: |
100 | mq: | 100 | mq: |
101 | list: | 101 | list: |
102 | - source: growthReport | ||
103 | exchange: growthReport.exchange | ||
104 | queue: growthReport.queue | ||
105 | exchange-type: direct | ||
106 | routing-key: | ||
107 | active: service | ||
102 | - source: event | 108 | - source: event |
103 | exchange: event.exchange | 109 | exchange: event.exchange |
104 | queue: event.queue | 110 | queue: event.queue | ... | ... |
-
Please register or sign in to post a comment