1.修改任务处理消息结构
2.新增分享数据统计功能
Showing
19 changed files
with
400 additions
and
35 deletions
| 1 | package com.topdraw.weixin.subscribe.domain; | 1 | package com.topdraw.business.module.user.weixin.subscribe.domain; |
| 2 | 2 | ||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 6 | import cn.hutool.core.bean.copier.CopyOptions; | 4 | import cn.hutool.core.bean.copier.CopyOptions; |
| 7 | import javax.persistence.*; | 5 | import lombok.Data; |
| 6 | import lombok.experimental.Accessors; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | 7 | import org.springframework.data.annotation.CreatedDate; |
| 9 | import org.springframework.data.annotation.LastModifiedDate; | 8 | import org.springframework.data.annotation.LastModifiedDate; |
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
| 11 | import java.sql.Timestamp; | ||
| 12 | import java.util.UUID; | ||
| 13 | 10 | ||
| 11 | import javax.persistence.*; | ||
| 14 | import java.io.Serializable; | 12 | import java.io.Serializable; |
| 13 | import java.sql.Timestamp; | ||
| 15 | 14 | ||
| 16 | /** | 15 | /** |
| 17 | * @author XiangHan | 16 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.weixin.subscribe.repository; | 1 | package com.topdraw.business.module.user.weixin.subscribe.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.weixin.subscribe.domain.WechatSubscribeRecord; | 3 | import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord; |
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 6 | 6 | ... | ... |
| 1 | package com.topdraw.weixin.subscribe.service; | 1 | package com.topdraw.business.module.user.weixin.subscribe.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.weixin.subscribe.domain.WechatSubscribeRecord; | 3 | import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord; |
| 4 | 4 | ||
| 5 | /** | 5 | /** |
| 6 | * @author XiangHan | 6 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.weixin.subscribe.service.dto; | 1 | package com.topdraw.business.module.user.weixin.subscribe.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import java.sql.Timestamp; | 4 | |
| 5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
| 6 | import java.sql.Timestamp; | ||
| 6 | 7 | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** | ... | ... |
| 1 | package com.topdraw.weixin.subscribe.service.impl; | 1 | package com.topdraw.business.module.user.weixin.subscribe.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.weixin.subscribe.domain.WechatSubscribeRecord; | 3 | import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord; |
| 4 | import com.topdraw.weixin.subscribe.repository.WechatSubscribeRecordRepository; | 4 | import com.topdraw.business.module.user.weixin.subscribe.repository.WechatSubscribeRecordRepository; |
| 5 | import com.topdraw.weixin.subscribe.service.WechatSubscribeRecordService; | 5 | import com.topdraw.business.module.user.weixin.subscribe.service.WechatSubscribeRecordService; |
| 6 | import com.topdraw.weixin.subscribe.service.mapper.WechatSubscribeRecordMapper; | 6 | import com.topdraw.business.module.user.weixin.subscribe.service.mapper.WechatSubscribeRecordMapper; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
| 9 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.weixin.subscribe.service.mapper; | 1 | package com.topdraw.business.module.user.weixin.subscribe.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.weixin.subscribe.domain.WechatSubscribeRecord; | 4 | import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord; |
| 5 | import com.topdraw.weixin.subscribe.service.dto.WechatSubscribeRecordDTO; | 5 | import com.topdraw.business.module.user.weixin.subscribe.service.dto.WechatSubscribeRecordDTO; |
| 6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 7 | import org.mapstruct.ReportingPolicy; | 7 | import org.mapstruct.ReportingPolicy; |
| 8 | 8 | ... | ... |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.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 | import java.util.UUID; | ||
| 13 | |||
| 14 | import java.io.Serializable; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author XiangHan | ||
| 18 | * @date 2022-06-06 | ||
| 19 | */ | ||
| 20 | @Entity | ||
| 21 | @Data | ||
| 22 | @EntityListeners(AuditingEntityListener.class) | ||
| 23 | @Accessors(chain = true) | ||
| 24 | @Table(name="uc_wechat_share_record") | ||
| 25 | public class WechatShareRecord implements Serializable { | ||
| 26 | |||
| 27 | // ID | ||
| 28 | @Id | ||
| 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 30 | @Column(name = "id") | ||
| 31 | private Long id; | ||
| 32 | |||
| 33 | // 标识 | ||
| 34 | @Column(name = "code", nullable = false) | ||
| 35 | private String code; | ||
| 36 | |||
| 37 | // 微信账号id | ||
| 38 | @Column(name = "user_id") | ||
| 39 | private Long userId; | ||
| 40 | |||
| 41 | // 会员id | ||
| 42 | @Column(name = "member_id", nullable = false) | ||
| 43 | private Long memberId; | ||
| 44 | |||
| 45 | // 会员code | ||
| 46 | @Column(name = "member_code", nullable = false) | ||
| 47 | private String memberCode; | ||
| 48 | |||
| 49 | // 实例id | ||
| 50 | @Column(name = "entity_id") | ||
| 51 | private Long entityId; | ||
| 52 | |||
| 53 | // 实例code | ||
| 54 | @Column(name = "entity_code") | ||
| 55 | private String entityCode; | ||
| 56 | |||
| 57 | // 实例类型 1:营销活动;2:小程序;3:商品;4:投票对象;5:文章;6:视频;99:其他; | ||
| 58 | @Column(name = "entity_type") | ||
| 59 | private Long entityType; | ||
| 60 | |||
| 61 | // 分享对象 1:朋友;2:朋友圈;99:其他; | ||
| 62 | @Column(name = "share_type") | ||
| 63 | private Integer shareType; | ||
| 64 | |||
| 65 | // 分享对象昵称 | ||
| 66 | @Column(name = "share_to") | ||
| 67 | private String shareTo; | ||
| 68 | |||
| 69 | // 分享对象查看次数 | ||
| 70 | @Column(name = "click_count") | ||
| 71 | private Long clickCount; | ||
| 72 | |||
| 73 | // 分享对象查看次数 | ||
| 74 | @Column(name = "share_count") | ||
| 75 | private Long shareCount; | ||
| 76 | |||
| 77 | // 来源描述 | ||
| 78 | @Column(name = "source_info") | ||
| 79 | private String sourceInfo; | ||
| 80 | |||
| 81 | // 创建时间 | ||
| 82 | @CreatedDate | ||
| 83 | @Column(name = "create_time") | ||
| 84 | private Timestamp createTime; | ||
| 85 | |||
| 86 | // 更新时间 | ||
| 87 | @LastModifiedDate | ||
| 88 | @Column(name = "update_time") | ||
| 89 | private Timestamp updateTime; | ||
| 90 | |||
| 91 | public void copy(WechatShareRecord source){ | ||
| 92 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 93 | } | ||
| 94 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord; | ||
| 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-06-06 | ||
| 14 | */ | ||
| 15 | public interface WechatShareRecordRepository extends JpaRepository<WechatShareRecord, Long>, JpaSpecificationExecutor<WechatShareRecord> { | ||
| 16 | |||
| 17 | Optional<WechatShareRecord> findFirstByCode(String code); | ||
| 18 | |||
| 19 | Optional<WechatShareRecord> findFirstByMemberCodeAndEntityCode(String memberCode, String entityCode); | ||
| 20 | |||
| 21 | @Modifying | ||
| 22 | @Query(value = "UPDATE uc_wechat_share_record SET `share_count` = ?2 WHERE id = ?1", nativeQuery = true) | ||
| 23 | void updateShareCount(Long id, long l); | ||
| 24 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.rest; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.topdraw.common.ResultInfo; | ||
| 5 | import com.topdraw.annotation.Log; | ||
| 6 | import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord; | ||
| 7 | import com.topdraw.business.module.user.weixin.wechatshare.service.WechatShareRecordService; | ||
| 8 | import lombok.extern.slf4j.Slf4j; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | ||
| 12 | import io.swagger.annotations.*; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * @author XiangHan | ||
| 16 | * @date 2022-06-06 | ||
| 17 | */ | ||
| 18 | @Api(tags = "WechatShareRecord管理") | ||
| 19 | @RestController | ||
| 20 | @RequestMapping("/uce/wechatShareRecord/") | ||
| 21 | @Slf4j | ||
| 22 | public class WechatShareRecordController { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private WechatShareRecordService wechatShareRecordService; | ||
| 26 | |||
| 27 | @Log | ||
| 28 | @PostMapping(value = "/create") | ||
| 29 | @ApiOperation("新增WechatShareRecord") | ||
| 30 | public ResultInfo create(@Validated @RequestBody WechatShareRecord resources) { | ||
| 31 | this.wechatShareRecordService.create(resources); | ||
| 32 | return ResultInfo.success(); | ||
| 33 | } | ||
| 34 | |||
| 35 | @Log | ||
| 36 | @PostMapping(value = "/update") | ||
| 37 | @ApiOperation("修改WechatShareRecord") | ||
| 38 | public ResultInfo update(@Validated @RequestBody WechatShareRecord resources) { | ||
| 39 | this.wechatShareRecordService.update(resources); | ||
| 40 | return ResultInfo.success(); | ||
| 41 | } | ||
| 42 | |||
| 43 | @Log | ||
| 44 | @PostMapping(value = "/createOrUpdate") | ||
| 45 | @ApiOperation("修改WechatShareRecord") | ||
| 46 | public ResultInfo createOrUpdate(@Validated @RequestBody String content) { | ||
| 47 | log.info("wechatShareRecord ==>> createOrUpdate ==>> {}",content); | ||
| 48 | WechatShareRecord wechatShareRecord = JSONObject.parseObject(content, WechatShareRecord.class); | ||
| 49 | this.wechatShareRecordService.createOrUpdate(wechatShareRecord); | ||
| 50 | return ResultInfo.success(); | ||
| 51 | } | ||
| 52 | |||
| 53 | @GetMapping(value = "/getByCode") | ||
| 54 | @ApiOperation(value = "根据标识查询") | ||
| 55 | public ResultInfo getByCode(@RequestParam(value = "code") String code) { | ||
| 56 | return ResultInfo.success(this.wechatShareRecordService.getByCode(code)); | ||
| 57 | } | ||
| 58 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord; | ||
| 4 | import com.topdraw.business.module.user.weixin.wechatshare.service.dto.WechatShareRecordDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2022-06-06 | ||
| 9 | */ | ||
| 10 | public interface WechatShareRecordService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return WechatShareRecordDTO | ||
| 16 | */ | ||
| 17 | WechatShareRecordDTO findById(Long id); | ||
| 18 | |||
| 19 | /** | ||
| 20 | * | ||
| 21 | * @param resources | ||
| 22 | */ | ||
| 23 | void create(WechatShareRecord resources); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * | ||
| 27 | * @param resources | ||
| 28 | */ | ||
| 29 | void update(WechatShareRecord resources); | ||
| 30 | |||
| 31 | /** | ||
| 32 | * Code校验 | ||
| 33 | * @param code | ||
| 34 | * @return WechatShareRecordDTO | ||
| 35 | */ | ||
| 36 | WechatShareRecordDTO getByCode(String code); | ||
| 37 | |||
| 38 | void createOrUpdate(WechatShareRecord resources); | ||
| 39 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.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-06-06 | ||
| 11 | */ | ||
| 12 | @Data | ||
| 13 | public class WechatShareRecordDTO implements Serializable { | ||
| 14 | |||
| 15 | // ID | ||
| 16 | private Long id; | ||
| 17 | |||
| 18 | // 标识 | ||
| 19 | private String code; | ||
| 20 | |||
| 21 | // 微信账号id | ||
| 22 | private Long userId; | ||
| 23 | |||
| 24 | // 会员id | ||
| 25 | private Long memberId; | ||
| 26 | |||
| 27 | // 会员code | ||
| 28 | private String memberCode; | ||
| 29 | |||
| 30 | // 实例id | ||
| 31 | private Long entityId; | ||
| 32 | |||
| 33 | // 实例code | ||
| 34 | private String entityCode; | ||
| 35 | |||
| 36 | // 实例类型 1:营销活动;2:小程序;3:商品;4:投票对象;5:文章;6:视频;99:其他; | ||
| 37 | private Long entityType; | ||
| 38 | |||
| 39 | // 分享对象 1:朋友;2:朋友圈;99:其他; | ||
| 40 | private Integer shareType; | ||
| 41 | |||
| 42 | // 分享对象昵称 | ||
| 43 | private String shareTo; | ||
| 44 | |||
| 45 | // 分享对象查看次数 | ||
| 46 | private Long clickCount; | ||
| 47 | |||
| 48 | // 分享次数 | ||
| 49 | private Long shareCount; | ||
| 50 | |||
| 51 | // 来源描述 | ||
| 52 | private String sourceInfo; | ||
| 53 | |||
| 54 | // 创建时间 | ||
| 55 | private Timestamp createTime; | ||
| 56 | |||
| 57 | // 更新时间 | ||
| 58 | private Timestamp updateTime; | ||
| 59 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord; | ||
| 4 | import com.topdraw.util.IdWorker; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | ||
| 6 | import com.topdraw.business.module.user.weixin.wechatshare.repository.WechatShareRecordRepository; | ||
| 7 | import com.topdraw.business.module.user.weixin.wechatshare.service.WechatShareRecordService; | ||
| 8 | import com.topdraw.business.module.user.weixin.wechatshare.service.dto.WechatShareRecordDTO; | ||
| 9 | import com.topdraw.business.module.user.weixin.wechatshare.service.mapper.WechatShareRecordMapper; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | import org.springframework.stereotype.Service; | ||
| 12 | import org.springframework.transaction.annotation.Propagation; | ||
| 13 | import org.springframework.transaction.annotation.Transactional; | ||
| 14 | import com.topdraw.utils.StringUtils; | ||
| 15 | |||
| 16 | import java.util.*; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @author XiangHan | ||
| 20 | * @date 2022-06-06 | ||
| 21 | */ | ||
| 22 | @Service | ||
| 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 24 | public class WechatShareRecordServiceImpl implements WechatShareRecordService { | ||
| 25 | |||
| 26 | @Autowired | ||
| 27 | private WechatShareRecordRepository wechatShareRecordRepository; | ||
| 28 | |||
| 29 | @Autowired | ||
| 30 | private WechatShareRecordMapper wechatShareRecordMapper; | ||
| 31 | |||
| 32 | @Override | ||
| 33 | public WechatShareRecordDTO findById(Long id) { | ||
| 34 | WechatShareRecord wechatShareRecord = this.wechatShareRecordRepository.findById(id).orElseGet(WechatShareRecord::new); | ||
| 35 | ValidationUtil.isNull(wechatShareRecord.getId(),"WechatShareRecord","id",id); | ||
| 36 | return this.wechatShareRecordMapper.toDto(wechatShareRecord); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Override | ||
| 40 | @Transactional(rollbackFor = Exception.class) | ||
| 41 | public void create(WechatShareRecord resources) { | ||
| 42 | this.wechatShareRecordRepository.save(resources); | ||
| 43 | } | ||
| 44 | |||
| 45 | @Override | ||
| 46 | @Transactional(rollbackFor = Exception.class) | ||
| 47 | public void update(WechatShareRecord resources) { | ||
| 48 | WechatShareRecord wechatShareRecord = this.wechatShareRecordRepository.findById(resources.getId()).orElseGet(WechatShareRecord::new); | ||
| 49 | ValidationUtil.isNull( wechatShareRecord.getId(),"WechatShareRecord","id",resources.getId()); | ||
| 50 | wechatShareRecord.copy(resources); | ||
| 51 | this.wechatShareRecordRepository.save(wechatShareRecord); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Override | ||
| 55 | public WechatShareRecordDTO getByCode(String code) { | ||
| 56 | return StringUtils.isNotEmpty(code) ? | ||
| 57 | this.wechatShareRecordMapper.toDto(this.wechatShareRecordRepository.findFirstByCode(code).orElseGet(WechatShareRecord::new)) | ||
| 58 | : new WechatShareRecordDTO(); | ||
| 59 | } | ||
| 60 | |||
| 61 | @Transactional(rollbackFor = Exception.class) | ||
| 62 | @Override | ||
| 63 | public void createOrUpdate(WechatShareRecord resources) { | ||
| 64 | String memberCode = resources.getMemberCode(); | ||
| 65 | Long memberId = resources.getMemberId(); | ||
| 66 | String entityCode = resources.getEntityCode(); | ||
| 67 | Long entityId = resources.getEntityId(); | ||
| 68 | WechatShareRecord wechatShareRecord = | ||
| 69 | this.wechatShareRecordRepository.findFirstByMemberCodeAndEntityCode(memberCode, entityCode).orElseGet(WechatShareRecord::new); | ||
| 70 | if (Objects.isNull(wechatShareRecord.getId())) { | ||
| 71 | resources.setCode(IdWorker.generatorString()); | ||
| 72 | resources.setShareCount(1L); | ||
| 73 | resources.setClickCount(0L); | ||
| 74 | this.create(resources); | ||
| 75 | } else { | ||
| 76 | Long id = wechatShareRecord.getId(); | ||
| 77 | Long shareCount = wechatShareRecord.getShareCount(); | ||
| 78 | if (Objects.isNull(shareCount)) | ||
| 79 | shareCount = 0L; | ||
| 80 | this.wechatShareRecordRepository.updateShareCount(id, shareCount+1); | ||
| 81 | } | ||
| 82 | |||
| 83 | } | ||
| 84 | } |
| 1 | package com.topdraw.business.module.user.weixin.wechatshare.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.weixin.wechatshare.domain.WechatShareRecord; | ||
| 5 | import com.topdraw.business.module.user.weixin.wechatshare.service.dto.WechatShareRecordDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-06-06 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface WechatShareRecordMapper extends BaseMapper<WechatShareRecordDTO, WechatShareRecord> { | ||
| 15 | |||
| 16 | } |
| ... | @@ -26,6 +26,8 @@ import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; | ... | @@ -26,6 +26,8 @@ import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; |
| 26 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 26 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 27 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 27 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 28 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | 28 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
| 29 | import com.topdraw.business.module.user.weixin.subscribe.domain.WechatSubscribeRecord; | ||
| 30 | import com.topdraw.business.module.user.weixin.subscribe.service.WechatSubscribeRecordService; | ||
| 29 | import com.topdraw.business.process.domian.weixin.*; | 31 | import com.topdraw.business.process.domian.weixin.*; |
| 30 | import com.topdraw.business.process.service.UserOperationService; | 32 | import com.topdraw.business.process.service.UserOperationService; |
| 31 | import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; | 33 | import com.topdraw.business.process.service.dto.MemberAndUserTvDTO; |
| ... | @@ -37,13 +39,10 @@ import com.topdraw.exception.BadRequestException; | ... | @@ -37,13 +39,10 @@ import com.topdraw.exception.BadRequestException; |
| 37 | import com.topdraw.exception.EntityNotFoundException; | 39 | import com.topdraw.exception.EntityNotFoundException; |
| 38 | import com.topdraw.exception.GlobeExceptionMsg; | 40 | import com.topdraw.exception.GlobeExceptionMsg; |
| 39 | import com.topdraw.resttemplate.RestTemplateClient; | 41 | import com.topdraw.resttemplate.RestTemplateClient; |
| 40 | import com.topdraw.util.Base64Util; | ||
| 41 | import com.topdraw.util.IdWorker; | 42 | import com.topdraw.util.IdWorker; |
| 42 | import com.topdraw.util.TimestampUtil; | 43 | import com.topdraw.util.TimestampUtil; |
| 43 | import com.topdraw.utils.QueryHelp; | 44 | import com.topdraw.utils.QueryHelp; |
| 44 | import com.topdraw.utils.RedisUtils; | 45 | import com.topdraw.utils.RedisUtils; |
| 45 | import com.topdraw.weixin.subscribe.domain.WechatSubscribeRecord; | ||
| 46 | import com.topdraw.weixin.subscribe.service.WechatSubscribeRecordService; | ||
| 47 | import lombok.extern.slf4j.Slf4j; | 46 | import lombok.extern.slf4j.Slf4j; |
| 48 | import org.apache.commons.lang3.StringUtils; | 47 | import org.apache.commons.lang3.StringUtils; |
| 49 | import org.springframework.aop.framework.AopContext; | 48 | import org.springframework.aop.framework.AopContext; |
| ... | @@ -58,7 +57,6 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -58,7 +57,6 @@ import org.springframework.transaction.annotation.Transactional; |
| 58 | import org.springframework.util.Assert; | 57 | import org.springframework.util.Assert; |
| 59 | import org.springframework.util.Base64Utils; | 58 | import org.springframework.util.Base64Utils; |
| 60 | import org.springframework.util.CollectionUtils; | 59 | import org.springframework.util.CollectionUtils; |
| 61 | import springfox.documentation.spring.web.json.Json; | ||
| 62 | 60 | ||
| 63 | import java.net.URLDecoder; | 61 | import java.net.URLDecoder; |
| 64 | import java.nio.charset.StandardCharsets; | 62 | import java.nio.charset.StandardCharsets; | ... | ... |
| ... | @@ -39,13 +39,9 @@ public class DataSyncMsg implements Serializable { | ... | @@ -39,13 +39,9 @@ public class DataSyncMsg implements Serializable { |
| 39 | public static class MsgData { | 39 | public static class MsgData { |
| 40 | private String remarks; //备注 | 40 | private String remarks; //备注 |
| 41 | @NotNull | 41 | @NotNull |
| 42 | private Integer event; // 具体事件 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 43 | @NotNull | ||
| 44 | private Long memberId; // 会员id | 42 | private Long memberId; // 会员id |
| 45 | private Long userId; // 账户id | 43 | private Long userId; // 账户id |
| 46 | @NotNull | 44 | @NotNull |
| 47 | private Integer deviceType; //设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | ||
| 48 | @NotNull | ||
| 49 | private String appCode; //用户对应的应用code | 45 | private String appCode; //用户对应的应用code |
| 50 | private String memberCode; | 46 | private String memberCode; |
| 51 | private Long accountId; // 账号id | 47 | private Long accountId; // 账号id | ... | ... |
| ... | @@ -39,16 +39,16 @@ public class GeneratorCode extends BaseTest { | ... | @@ -39,16 +39,16 @@ public class GeneratorCode extends BaseTest { |
| 39 | @Rollback(value = false) | 39 | @Rollback(value = false) |
| 40 | @Transactional(rollbackFor = Exception.class) | 40 | @Transactional(rollbackFor = Exception.class) |
| 41 | public void generator() { | 41 | public void generator() { |
| 42 | var dbName = "uc_wechat_subscribe_record"; | 42 | var dbName = "uc_wechat_share_record"; |
| 43 | // 表名称,支持多表 | 43 | // 表名称,支持多表 |
| 44 | var tableNames = Arrays.asList(dbName); | 44 | var tableNames = Arrays.asList(dbName); |
| 45 | String[] s = dbName.split("_"); | 45 | String[] s = dbName.split("_"); |
| 46 | 46 | ||
| 47 | var pre = s[0]; | 47 | var pre = s[0]; |
| 48 | var target1 = s[s.length-1]; | 48 | var target1 = s[s.length-1]; |
| 49 | var preRoute = "com.topdraw.weixin."; | 49 | var preRoute = "com.topdraw.business.module.user.weixin."; |
| 50 | StringBuilder builder = new StringBuilder(preRoute); | 50 | StringBuilder builder = new StringBuilder(preRoute); |
| 51 | builder.append("subscribe"); | 51 | builder.append("wechatshare"); |
| 52 | // builder.append(target); | 52 | // builder.append(target); |
| 53 | 53 | ||
| 54 | tableNames.forEach(tableName -> { | 54 | tableNames.forEach(tableName -> { | ... | ... |
| ... | @@ -20,10 +20,8 @@ public class TaskOperationServiceTest extends BaseTest { | ... | @@ -20,10 +20,8 @@ public class TaskOperationServiceTest extends BaseTest { |
| 20 | // dataSyncMsg.setEntityType(EntityType.MEMBER); | 20 | // dataSyncMsg.setEntityType(EntityType.MEMBER); |
| 21 | dataSyncMsg.setEvt(EventType.LOGIN.name()); | 21 | dataSyncMsg.setEvt(EventType.LOGIN.name()); |
| 22 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); | 22 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); |
| 23 | msgData.setEvent(1); | ||
| 24 | msgData.setRemarks("remark"); | 23 | msgData.setRemarks("remark"); |
| 25 | msgData.setMemberId(memberId); | 24 | msgData.setMemberId(memberId); |
| 26 | msgData.setDeviceType(2); | ||
| 27 | 25 | ||
| 28 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); | 26 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); |
| 29 | dataSyncMsg.setMsg(msgData); | 27 | dataSyncMsg.setMsg(msgData); | ... | ... |
| ... | @@ -23,10 +23,8 @@ public class MqTest extends BaseTest { | ... | @@ -23,10 +23,8 @@ public class MqTest extends BaseTest { |
| 23 | // dataSyncMsg.setEventType(EventType.LOGIN.name()); | 23 | // dataSyncMsg.setEventType(EventType.LOGIN.name()); |
| 24 | dataSyncMsg.setEvt(EventType.LOGIN.name()); | 24 | dataSyncMsg.setEvt(EventType.LOGIN.name()); |
| 25 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); | 25 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); |
| 26 | msgData.setEvent(1); | ||
| 27 | msgData.setRemarks("remark"); | 26 | msgData.setRemarks("remark"); |
| 28 | msgData.setMemberId(1L); | 27 | msgData.setMemberId(1L); |
| 29 | msgData.setDeviceType(2); | ||
| 30 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); | 28 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); |
| 31 | dataSyncMsg.setMsg(msgData); | 29 | dataSyncMsg.setMsg(msgData); |
| 32 | String s = JSON.toJSONString(dataSyncMsg); | 30 | String s = JSON.toJSONString(dataSyncMsg); | ... | ... |
-
Please register or sign in to post a comment