V1.1.0-future-UserCenter接口转移
Showing
278 changed files
with
4572 additions
and
1100 deletions
| ... | @@ -12,15 +12,21 @@ | ... | @@ -12,15 +12,21 @@ |
| 12 | <artifactId>member-service-api</artifactId> | 12 | <artifactId>member-service-api</artifactId> |
| 13 | 13 | ||
| 14 | <properties> | 14 | <properties> |
| 15 | 15 | <cronos.version>1.1.0</cronos.version> | |
| 16 | </properties> | 16 | </properties> |
| 17 | 17 | ||
| 18 | <dependencies> | 18 | <dependencies> |
| 19 | <!--系统--> | ||
| 20 | <dependency> | ||
| 21 | <groupId>com.topdraw</groupId> | ||
| 22 | <artifactId>cronos-system</artifactId> | ||
| 23 | <version>${cronos.version}</version> | ||
| 24 | </dependency> | ||
| 19 | <!--代码生成器--> | 25 | <!--代码生成器--> |
| 20 | <dependency> | 26 | <dependency> |
| 21 | <groupId>com.topdraw</groupId> | 27 | <groupId>com.topdraw</groupId> |
| 22 | <artifactId>code-generator</artifactId> | 28 | <artifactId>cronos-generator</artifactId> |
| 23 | <version>3.1.0</version> | 29 | <version>${cronos.version}</version> |
| 24 | </dependency> | 30 | </dependency> |
| 25 | </dependencies> | 31 | </dependencies> |
| 26 | 32 | ... | ... |
| ... | @@ -25,6 +25,8 @@ public class DataSyncMsg implements Serializable { | ... | @@ -25,6 +25,8 @@ public class DataSyncMsg implements Serializable { |
| 25 | // 其他属性 | 25 | // 其他属性 |
| 26 | private String extraData; | 26 | private String extraData; |
| 27 | 27 | ||
| 28 | /** 模板参数 */ | ||
| 29 | private TaskTemplateParam param; | ||
| 28 | 30 | ||
| 29 | /** | 31 | /** |
| 30 | * 消息体 | 32 | * 消息体 |
| ... | @@ -47,6 +49,18 @@ public class DataSyncMsg implements Serializable { | ... | @@ -47,6 +49,18 @@ public class DataSyncMsg implements Serializable { |
| 47 | private Long activityId; | 49 | private Long activityId; |
| 48 | private Long mediaId; | 50 | private Long mediaId; |
| 49 | private Long itemId; | 51 | private Long itemId; |
| 52 | |||
| 53 | |||
| 54 | } | ||
| 55 | |||
| 56 | @Data | ||
| 57 | @AllArgsConstructor | ||
| 58 | @NoArgsConstructor | ||
| 59 | public static class TaskTemplateParam { | ||
| 60 | /** 类别 */ | ||
| 61 | private String category; | ||
| 62 | /** 编码 */ | ||
| 63 | private String code; | ||
| 50 | } | 64 | } |
| 51 | 65 | ||
| 52 | } | 66 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.history.repository; | 1 | package com.topdraw.business.module.coupon.history.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 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 | ||
| 7 | import java.sql.Timestamp; | 7 | import java.sql.Timestamp; |
| 8 | import java.util.Optional; | ||
| 9 | 8 | ||
| 10 | /** | 9 | /** |
| 11 | * @author XiangHan | 10 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.history.rest; | 1 | package com.topdraw.business.module.coupon.history.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 5 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 6 | import com.topdraw.business.basicdata.coupon.history.service.CouponHistoryService; | 6 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
| 7 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria; | 7 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 13 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 13 | ||
| 18 | /** | 14 | /** |
| 19 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.history.service; | 1 | package com.topdraw.business.module.coupon.history.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 4 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO; | 4 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
| 5 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria; | 5 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | 7 | ||
| 8 | import java.sql.Timestamp; | 8 | import java.sql.Timestamp; |
| 9 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | import java.util.List; | 10 | import java.util.List; |
| 11 | import java.io.IOException; | ||
| 12 | import javax.servlet.http.HttpServletResponse; | ||
| 13 | 11 | ||
| 14 | /** | 12 | /** |
| 15 | * @author XiangHan | 13 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.history.service.impl; | 1 | package com.topdraw.business.module.coupon.history.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 4 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.coupon.history.repository.CouponHistoryRepository; | 6 | import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; |
| 7 | import com.topdraw.business.basicdata.coupon.history.service.CouponHistoryService; | 7 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
| 8 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO; | 8 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
| 9 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryQueryCriteria; | 9 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.coupon.history.service.mapper.CouponHistoryMapper; | 10 | import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.history.service.mapper; | 1 | package com.topdraw.business.module.coupon.history.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 4 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 5 | import com.topdraw.business.basicdata.coupon.history.service.dto.CouponHistoryDTO; | 5 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
| 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.basicdata.coupon.repository; | 1 | package com.topdraw.business.module.coupon.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | 3 | import com.topdraw.business.module.coupon.domain.Coupon; |
| 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.business.basicdata.coupon.rest; | 1 | package com.topdraw.business.module.coupon.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | 5 | import com.topdraw.business.module.coupon.domain.Coupon; |
| 6 | import com.topdraw.business.basicdata.coupon.service.CouponService; | 6 | import com.topdraw.business.module.coupon.service.CouponService; |
| 7 | import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria; | 7 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.service; | 1 | package com.topdraw.business.module.coupon.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | 3 | import com.topdraw.business.module.coupon.domain.Coupon; |
| 4 | import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO; | 4 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
| 5 | import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria; | 5 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.service.impl; | 1 | package com.topdraw.business.module.coupon.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | 4 | import com.topdraw.business.module.coupon.domain.Coupon; |
| 5 | import com.topdraw.util.RedissonUtil; | 5 | import com.topdraw.util.RedissonUtil; |
| 6 | import com.topdraw.utils.ValidationUtil; | 6 | import com.topdraw.utils.ValidationUtil; |
| 7 | import com.topdraw.business.basicdata.coupon.repository.CouponRepository; | 7 | import com.topdraw.business.module.coupon.repository.CouponRepository; |
| 8 | import com.topdraw.business.basicdata.coupon.service.CouponService; | 8 | import com.topdraw.business.module.coupon.service.CouponService; |
| 9 | import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO; | 9 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
| 10 | import com.topdraw.business.basicdata.coupon.service.dto.CouponQueryCriteria; | 10 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; |
| 11 | import com.topdraw.business.basicdata.coupon.service.mapper.CouponMapper; | 11 | import com.topdraw.business.module.coupon.service.mapper.CouponMapper; |
| 12 | import org.redisson.api.RLock; | 12 | import org.redisson.api.RLock; |
| 13 | import org.redisson.api.RedissonClient; | 13 | import org.redisson.api.RedissonClient; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.business.basicdata.coupon.service.mapper; | 1 | package com.topdraw.business.module.coupon.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | 4 | import com.topdraw.business.module.coupon.domain.Coupon; |
| 5 | import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO; | 5 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
| 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.basicdata.exp.detail.repository; | 1 | package com.topdraw.business.module.exp.detail.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 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.business.basicdata.exp.detail.rest; | 1 | package com.topdraw.business.module.exp.detail.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 5 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 6 | import com.topdraw.business.basicdata.exp.detail.service.ExpDetailService; | 6 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
| 7 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria; | 7 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.detail.service; | 1 | package com.topdraw.business.module.exp.detail.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 4 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO; | 4 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
| 5 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria; | 5 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.detail.service.impl; | 1 | package com.topdraw.business.module.exp.detail.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 4 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.exp.detail.repository.ExpDetailRepository; | 6 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; |
| 7 | import com.topdraw.business.basicdata.exp.detail.service.ExpDetailService; | 7 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
| 8 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO; | 8 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
| 9 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailQueryCriteria; | 9 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.exp.detail.service.mapper.ExpDetailMapper; | 10 | import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; |
| 11 | import org.redisson.api.RLock; | 11 | import org.redisson.api.RLock; |
| 12 | import org.redisson.api.RedissonClient; | 12 | import org.redisson.api.RedissonClient; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.detail.service.mapper; | 1 | package com.topdraw.business.module.exp.detail.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 4 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 5 | import com.topdraw.business.basicdata.exp.detail.service.dto.ExpDetailDTO; | 5 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
| 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.basicdata.exp.history.repository; | 1 | package com.topdraw.business.module.exp.history.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.exp.history.domain.ExpHistory; | 3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
| 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.business.basicdata.exp.history.rest; | 1 | package com.topdraw.business.module.exp.history.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; |
| 5 | import com.topdraw.business.basicdata.exp.history.domain.ExpHistory; | 5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.exp.history.service.ExpHistoryService; | ||
| 7 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 7 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | 8 | import org.springframework.web.bind.annotation.*; |
| 12 | import io.swagger.annotations.*; | 9 | import io.swagger.annotations.*; |
| 13 | 10 | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.history.service; | 1 | package com.topdraw.business.module.exp.history.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.exp.history.domain.ExpHistory; | 3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
| 4 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO; | 4 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
| 5 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria; | 5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.history.service.impl; | 1 | package com.topdraw.business.module.exp.history.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.exp.history.domain.ExpHistory; | 4 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.exp.history.repository.ExpHistoryRepository; | 6 | import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository; |
| 7 | import com.topdraw.business.basicdata.exp.history.service.ExpHistoryService; | 7 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; |
| 8 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO; | 8 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
| 9 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryQueryCriteria; | 9 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.exp.history.service.mapper.ExpHistoryMapper; | 10 | import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.exp.history.service.mapper; | 1 | package com.topdraw.business.module.exp.history.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.exp.history.domain.ExpHistory; | 4 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
| 5 | import com.topdraw.business.basicdata.exp.history.service.dto.ExpHistoryDTO; | 5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
| 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.basicdata.member.address.repository; | 1 | package com.topdraw.business.module.member.address.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 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.business.basicdata.member.address.rest; | 1 | package com.topdraw.business.module.member.address.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.service.MemberService; | 3 | import com.topdraw.business.module.member.service.MemberService; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | import com.topdraw.common.ResultInfo; | 5 | import com.topdraw.common.ResultInfo; |
| 6 | import com.topdraw.annotation.Log; | 6 | import com.topdraw.annotation.Log; |
| 7 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 7 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 8 | import com.topdraw.business.basicdata.member.address.service.MemberAddressService; | 8 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
| 9 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria; | 9 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.data.domain.Pageable; | 11 | import org.springframework.data.domain.Pageable; |
| 12 | import org.springframework.util.Assert; | 12 | import org.springframework.util.Assert; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.address.service; | 1 | package com.topdraw.business.module.member.address.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 4 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO; | 4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
| 5 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria; | 5 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.address.service.impl; | 1 | package com.topdraw.business.module.member.address.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.member.address.repository.MemberAddressRepository; | 6 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; |
| 7 | import com.topdraw.business.basicdata.member.address.service.MemberAddressService; | 7 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
| 8 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO; | 8 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
| 9 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria; | 9 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.member.address.service.mapper.MemberAddressMapper; | 10 | import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.address.service.mapper; | 1 | package com.topdraw.business.module.member.address.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 5 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressDTO; | 5 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
| 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.basicdata.member.domain; | 1 | package com.topdraw.business.module.member.domain; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.bean.BeanUtil; | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | 4 | import cn.hutool.core.bean.copier.CopyOptions; |
| 5 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | ||
| 6 | import io.swagger.annotations.ApiModelProperty; | ||
| 7 | import lombok.Data; | 5 | import lombok.Data; |
| 8 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
| 9 | import org.springframework.data.annotation.CreatedDate; | 7 | import org.springframework.data.annotation.CreatedDate; |
| ... | @@ -135,6 +133,6 @@ public class Member implements Serializable { | ... | @@ -135,6 +133,6 @@ public class Member implements Serializable { |
| 135 | private Long blackStatus; | 133 | private Long blackStatus; |
| 136 | 134 | ||
| 137 | public void copy(Member source){ | 135 | public void copy(Member source){ |
| 138 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 136 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false)); |
| 139 | } | 137 | } |
| 140 | } | 138 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/member/domain/MemberBuilder.java
0 → 100644
| 1 | package com.topdraw.business.module.member.domain; | ||
| 2 | |||
| 3 | import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 5 | import com.topdraw.util.IdWorker; | ||
| 6 | import lombok.Data; | ||
| 7 | import lombok.experimental.Accessors; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | ||
| 9 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 11 | |||
| 12 | import javax.persistence.*; | ||
| 13 | import java.io.Serializable; | ||
| 14 | import java.sql.Timestamp; | ||
| 15 | import java.time.LocalDateTime; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @author XiangHan | ||
| 19 | * @date 2021-10-22 | ||
| 20 | */ | ||
| 21 | public class MemberBuilder { | ||
| 22 | |||
| 23 | public static Member build(Integer type,String avatarUrl,String nickname,Integer vip){ | ||
| 24 | Member member = new Member(); | ||
| 25 | member.setType(type); | ||
| 26 | member.setBlackStatus(0L); | ||
| 27 | member.setGender(-1); | ||
| 28 | member.setVip(vip==null?0:vip); | ||
| 29 | member.setLevel(1); | ||
| 30 | member.setStatus(1); | ||
| 31 | member.setPoints(0L); | ||
| 32 | member.setDuePoints(0L); | ||
| 33 | member.setExp(0L); | ||
| 34 | member.setCouponAmount(0L); | ||
| 35 | member.setDueCouponAmount(0L); | ||
| 36 | member.setAvatarUrl(avatarUrl); | ||
| 37 | member.setCode(IdWorker.generator() + ""); | ||
| 38 | member.setNickname(nickname); | ||
| 39 | return member; | ||
| 40 | } | ||
| 41 | } |
| 1 | package com.topdraw.business.basicdata.member.group.repository; | 1 | package com.topdraw.business.module.member.group.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.group.domain.MemberGroup; | 3 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
| 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 | ||
| 7 | import java.util.Optional; | ||
| 8 | |||
| 9 | /** | 7 | /** |
| 10 | * @author XiangHan | 8 | * @author XiangHan |
| 11 | * @date 2021-11-17 | 9 | * @date 2021-11-17 | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.group.rest; | 1 | package com.topdraw.business.module.member.group.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.member.group.domain.MemberGroup; | 5 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
| 6 | import com.topdraw.business.basicdata.member.group.service.MemberGroupService; | 6 | import com.topdraw.business.module.member.group.service.MemberGroupService; |
| 7 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupQueryCriteria; | 7 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 13 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 13 | ||
| 18 | /** | 14 | /** |
| 19 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.group.service; | 1 | package com.topdraw.business.module.member.group.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.group.domain.MemberGroup; | 3 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
| 4 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupDTO; | 4 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
| 5 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupQueryCriteria; | 5 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | 9 | ||
| 12 | /** | 10 | /** |
| 13 | * @author XiangHan | 11 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.group.service.impl; | 1 | package com.topdraw.business.module.member.group.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.group.domain.MemberGroup; | 3 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
| 4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.utils.FileUtil; | 5 | import com.topdraw.business.module.member.group.repository.MemberGroupRepository; |
| 6 | import com.topdraw.business.basicdata.member.group.repository.MemberGroupRepository; | 6 | import com.topdraw.business.module.member.group.service.MemberGroupService; |
| 7 | import com.topdraw.business.basicdata.member.group.service.MemberGroupService; | 7 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
| 8 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupDTO; | 8 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupQueryCriteria; | 9 | import com.topdraw.business.module.member.group.service.mapper.MemberGroupMapper; |
| 10 | import com.topdraw.business.basicdata.member.group.service.mapper.MemberGroupMapper; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; | ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; |
| 18 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
| 19 | import com.topdraw.utils.PageUtil; | 18 | import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 19 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | ||
| 22 | 20 | ||
| 23 | import java.util.List; | 21 | import java.util.List; |
| 24 | import java.util.Map; | 22 | 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 | 23 | ||
| 30 | /** | 24 | /** |
| 31 | * @author XiangHan | 25 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.group.service.mapper; | 1 | package com.topdraw.business.module.member.group.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.group.domain.MemberGroup; | 4 | import com.topdraw.business.module.member.group.domain.MemberGroup; |
| 5 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupDTO; | 5 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
| 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.basicdata.member.level.repository; | 1 | package com.topdraw.business.module.member.level.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.level.domain.MemberLevel; | 3 | import com.topdraw.business.module.member.level.domain.MemberLevel; |
| 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.business.basicdata.member.level.rest; | 1 | package com.topdraw.business.module.member.level.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.business.module.member.level.service.MemberLevelService; |
| 5 | import com.topdraw.business.basicdata.member.level.domain.MemberLevel; | 5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.member.level.service.MemberLevelService; | ||
| 7 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 7 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | 8 | import org.springframework.web.bind.annotation.*; |
| 12 | import io.swagger.annotations.*; | 9 | import io.swagger.annotations.*; |
| 13 | 10 | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.level.service; | 1 | package com.topdraw.business.module.member.level.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.level.domain.MemberLevel; | 3 | import com.topdraw.business.module.member.level.domain.MemberLevel; |
| 4 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO; | 4 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
| 5 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria; | 5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.level.service.impl; | 1 | package com.topdraw.business.module.member.level.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.level.domain.MemberLevel; | 4 | import com.topdraw.business.module.member.level.domain.MemberLevel; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.member.level.repository.MemberLevelRepository; | 6 | import com.topdraw.business.module.member.level.repository.MemberLevelRepository; |
| 7 | import com.topdraw.business.basicdata.member.level.service.MemberLevelService; | 7 | import com.topdraw.business.module.member.level.service.MemberLevelService; |
| 8 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO; | 8 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
| 9 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelQueryCriteria; | 9 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.member.level.service.mapper.MemberLevelMapper; | 10 | import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.cache.annotation.Cacheable; | ||
| 13 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 14 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
| 15 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.level.service.mapper; | 1 | package com.topdraw.business.module.member.level.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.level.domain.MemberLevel; | 4 | import com.topdraw.business.module.member.level.domain.MemberLevel; |
| 5 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO; | 5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
| 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.basicdata.member.profile.domain; | 1 | package com.topdraw.business.module.member.profile.domain; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.profile.DoSaveMemberProfileGroup; | 3 | import com.topdraw.business.module.member.profile.DoSaveMemberProfileGroup; |
| 4 | import com.topdraw.business.basicdata.member.profile.DoUpdateMemberProfileGroup; | 4 | import com.topdraw.business.module.member.profile.DoUpdateMemberProfileGroup; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
| 7 | import cn.hutool.core.bean.BeanUtil; | 7 | import cn.hutool.core.bean.BeanUtil; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.profile.repository; | 1 | package com.topdraw.business.module.member.profile.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 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.business.basicdata.member.profile.rest; | 1 | package com.topdraw.business.module.member.profile.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO; | 3 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 4 | import com.topdraw.business.basicdata.member.service.MemberService; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 5 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 6 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 7 | import com.topdraw.annotation.Log; | 7 | import com.topdraw.annotation.Log; |
| 8 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 9 | import com.topdraw.business.basicdata.member.profile.service.MemberProfileService; | 9 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 10 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria; | ||
| 11 | import com.topdraw.utils.StringUtils; | 10 | import com.topdraw.utils.StringUtils; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.data.domain.Pageable; | ||
| 14 | import org.springframework.util.Assert; | 12 | import org.springframework.util.Assert; |
| 15 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
| 16 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.profile.service; | 1 | package com.topdraw.business.module.member.profile.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 4 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO; | 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 5 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| ... | @@ -35,7 +35,7 @@ public interface MemberProfileService { | ... | @@ -35,7 +35,7 @@ public interface MemberProfileService { |
| 35 | */ | 35 | */ |
| 36 | MemberProfileDTO findById(Long id); | 36 | MemberProfileDTO findById(Long id); |
| 37 | 37 | ||
| 38 | void create(MemberProfile resources); | 38 | MemberProfile create(MemberProfile resources); |
| 39 | 39 | ||
| 40 | void update(MemberProfile resources); | 40 | void update(MemberProfile resources); |
| 41 | 41 | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.profile.service.dto; | 1 | package com.topdraw.business.module.member.profile.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
| ... | @@ -21,21 +21,30 @@ public class MemberProfileDTO implements Serializable { | ... | @@ -21,21 +21,30 @@ public class MemberProfileDTO implements Serializable { |
| 21 | // 姓名 | 21 | // 姓名 |
| 22 | private String realname; | 22 | private String realname; |
| 23 | 23 | ||
| 24 | private String nickname; | ||
| 25 | |||
| 24 | // 性别 0:女; 1:男 -1:未知 | 26 | // 性别 0:女; 1:男 -1:未知 |
| 25 | private Integer gender; | 27 | private Integer gender; |
| 26 | 28 | ||
| 27 | // 生日 | 29 | // 生日 |
| 28 | private Timestamp birthday; | 30 | private Timestamp birthday; |
| 29 | 31 | ||
| 32 | // 生日字符串 | ||
| 33 | private String birthdayStr; | ||
| 34 | |||
| 35 | // vip | ||
| 36 | private Integer vip; | ||
| 37 | |||
| 30 | // 星座 | 38 | // 星座 |
| 31 | private String constellation; | 39 | private String constellation; |
| 32 | 40 | ||
| 33 | // 身份证 | 41 | private Long vipExpireTime; |
| 34 | private String idCard; | ||
| 35 | 42 | ||
| 36 | // 电话 | ||
| 37 | private String phone; | 43 | private String phone; |
| 38 | 44 | ||
| 45 | // 身份证 | ||
| 46 | private String idCard; | ||
| 47 | |||
| 39 | // 电子邮件 | 48 | // 电子邮件 |
| 40 | private String email; | 49 | private String email; |
| 41 | 50 | ||
| ... | @@ -48,6 +57,9 @@ public class MemberProfileDTO implements Serializable { | ... | @@ -48,6 +57,9 @@ public class MemberProfileDTO implements Serializable { |
| 48 | // 城市 | 57 | // 城市 |
| 49 | private String city; | 58 | private String city; |
| 50 | 59 | ||
| 60 | // 头像 | ||
| 61 | private String avatarUrl; | ||
| 62 | |||
| 51 | // 区县 | 63 | // 区县 |
| 52 | private String district; | 64 | private String district; |
| 53 | 65 | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.profile.service.impl; | 1 | package com.topdraw.business.module.member.profile.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 5 | import com.topdraw.business.basicdata.member.service.MemberService; | ||
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | ||
| 7 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 8 | import com.topdraw.business.basicdata.member.profile.repository.MemberProfileRepository; | 6 | import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; |
| 9 | import com.topdraw.business.basicdata.member.profile.service.MemberProfileService; | 7 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 10 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO; | 8 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 11 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileQueryCriteria; | 9 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; |
| 12 | import com.topdraw.business.basicdata.member.profile.service.mapper.MemberProfileMapper; | 10 | import com.topdraw.business.module.member.profile.service.mapper.MemberProfileMapper; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 15 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -61,8 +59,9 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -61,8 +59,9 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
| 61 | @Override | 59 | @Override |
| 62 | @Transactional(rollbackFor = Exception.class) | 60 | @Transactional(rollbackFor = Exception.class) |
| 63 | @AsyncMqSend() | 61 | @AsyncMqSend() |
| 64 | public void create(MemberProfile resources) { | 62 | public MemberProfile create(MemberProfile resources) { |
| 65 | MemberProfileRepository.save(resources); | 63 | MemberProfileRepository.save(resources); |
| 64 | return resources; | ||
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | @Override | 67 | @Override | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.profile.service.mapper; | 1 | package com.topdraw.business.module.member.profile.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 5 | import com.topdraw.business.basicdata.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 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.basicdata.member.relatedinfo.repository; | 1 | package com.topdraw.business.module.member.relatedinfo.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 3 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 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.business.basicdata.member.relatedinfo.rest; | 1 | package com.topdraw.business.module.member.relatedinfo.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.service.MemberService; | 3 | import com.topdraw.business.module.member.service.MemberService; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | import com.topdraw.common.ResultInfo; | 5 | import com.topdraw.common.ResultInfo; |
| 6 | import com.topdraw.annotation.Log; | 6 | import com.topdraw.annotation.Log; |
| 7 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 7 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 8 | import com.topdraw.business.basicdata.member.relatedinfo.service.MemberRelatedInfoService; | 8 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; |
| 9 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | 9 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.data.domain.PageRequest; | ||
| 12 | import org.springframework.data.domain.Pageable; | 11 | import org.springframework.data.domain.Pageable; |
| 13 | import org.springframework.util.Assert; | 12 | import org.springframework.util.Assert; |
| 14 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.relatedinfo.service; | 1 | package com.topdraw.business.module.member.relatedinfo.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 3 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 4 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 4 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
| 5 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | 5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.relatedinfo.service.dto; | 1 | package com.topdraw.business.module.member.relatedinfo.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | import javax.persistence.Column; | ||
| 6 | import java.sql.Timestamp; | 5 | import java.sql.Timestamp; |
| 7 | import java.io.Serializable; | 6 | import java.io.Serializable; |
| 8 | import java.time.LocalDate; | 7 | import java.time.LocalDate; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.relatedinfo.service.dto; | 1 | package com.topdraw.business.module.member.relatedinfo.service.dto; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.Query; | 3 | import com.topdraw.annotation.Query; |
| 4 | import lombok.Data; | 4 | import lombok.Data; |
| 5 | 5 | ||
| 6 | import javax.validation.constraints.NotNull; | ||
| 7 | |||
| 8 | /** | 6 | /** |
| 9 | * @author XiangHan | 7 | * @author XiangHan |
| 10 | * @date 2021-10-22 | 8 | * @date 2021-10-22 | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.relatedinfo.service.impl; | 1 | package com.topdraw.business.module.member.relatedinfo.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.member.relatedinfo.repository.MemberRelatedInfoRepository; | 6 | import com.topdraw.business.module.member.relatedinfo.repository.MemberRelatedInfoRepository; |
| 7 | import com.topdraw.business.basicdata.member.relatedinfo.service.MemberRelatedInfoService; | 7 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; |
| 8 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 8 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
| 9 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | 9 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.member.relatedinfo.service.mapper.MemberRelatedInfoMapper; | 10 | import com.topdraw.business.module.member.relatedinfo.service.mapper.MemberRelatedInfoMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.relatedinfo.service.mapper; | 1 | package com.topdraw.business.module.member.relatedinfo.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 5 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
| 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.basicdata.member.repository; | 1 | package com.topdraw.business.module.member.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
| 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.business.basicdata.member.rest; | 1 | package com.topdraw.business.module.member.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.Log; | 3 | import com.topdraw.annotation.Log; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.basicdata.member.service.MemberService; | 5 | import com.topdraw.business.module.member.service.MemberService; |
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 7 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 7 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 8 | import com.topdraw.business.process.service.UserTvOperationService; | 8 | import com.topdraw.business.process.service.UserOperationService; |
| 9 | import com.topdraw.common.ResultInfo; | 9 | import com.topdraw.common.ResultInfo; |
| 10 | import com.topdraw.util.Base64Util; | 10 | import com.topdraw.util.Base64Util; |
| 11 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| ... | @@ -33,7 +33,7 @@ public class MemberController { | ... | @@ -33,7 +33,7 @@ public class MemberController { |
| 33 | private MemberService memberService; | 33 | private MemberService memberService; |
| 34 | 34 | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | private UserTvOperationService userTvOperationService; | 36 | private UserOperationService userTvOperationService; |
| 37 | 37 | ||
| 38 | @Log | 38 | @Log |
| 39 | @GetMapping(value = "/findById/{id}") | 39 | @GetMapping(value = "/findById/{id}") | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.service; | 1 | package com.topdraw.business.module.member.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 5 | import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 6 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 6 | import com.topdraw.business.module.member.service.dto.MemberQueryCriteria; |
| 7 | import org.springframework.data.domain.Pageable; | 7 | import org.springframework.data.domain.Pageable; |
| 8 | 8 | ||
| 9 | import java.util.List; | 9 | import java.util.List; |
| ... | @@ -37,10 +37,23 @@ public interface MemberService { | ... | @@ -37,10 +37,23 @@ public interface MemberService { |
| 37 | */ | 37 | */ |
| 38 | MemberDTO findById(Long id); | 38 | MemberDTO findById(Long id); |
| 39 | 39 | ||
| 40 | /** | ||
| 41 | * | ||
| 42 | * @param resources | ||
| 43 | * @return | ||
| 44 | */ | ||
| 40 | Long create(Member resources); | 45 | Long create(Member resources); |
| 41 | 46 | ||
| 47 | /** | ||
| 48 | * | ||
| 49 | * @param resources | ||
| 50 | */ | ||
| 42 | void update(Member resources); | 51 | void update(Member resources); |
| 43 | 52 | ||
| 53 | /** | ||
| 54 | * | ||
| 55 | * @param id | ||
| 56 | */ | ||
| 44 | void delete(Long id); | 57 | void delete(Long id); |
| 45 | 58 | ||
| 46 | /** | 59 | /** |
| ... | @@ -50,5 +63,9 @@ public interface MemberService { | ... | @@ -50,5 +63,9 @@ public interface MemberService { |
| 50 | */ | 63 | */ |
| 51 | MemberDTO getByCode(String code); | 64 | MemberDTO getByCode(String code); |
| 52 | 65 | ||
| 66 | /** | ||
| 67 | * | ||
| 68 | * @param member | ||
| 69 | */ | ||
| 53 | void doUpdateMemberPoints(Member member); | 70 | void doUpdateMemberPoints(Member member); |
| 54 | } | 71 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.service.impl; | 1 | package com.topdraw.business.module.member.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.basicdata.member.repository.MemberRepository; | 5 | import com.topdraw.business.module.member.repository.MemberRepository; |
| 6 | import com.topdraw.business.basicdata.member.service.MemberService; | 6 | import com.topdraw.business.module.member.service.MemberService; |
| 7 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 8 | import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria; | 8 | import com.topdraw.business.module.member.service.dto.MemberQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.member.service.mapper.MemberMapper; | 9 | import com.topdraw.business.module.member.service.mapper.MemberMapper; |
| 10 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | ||
| 11 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | ||
| 12 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | ||
| 13 | import com.topdraw.common.ResultInfo; | ||
| 14 | import com.topdraw.config.LocalConstants; | ||
| 15 | import com.topdraw.mq.config.RabbitMqConfig; | ||
| 16 | import com.topdraw.util.IdWorker; | 10 | import com.topdraw.util.IdWorker; |
| 17 | import com.topdraw.util.RedissonUtil; | 11 | import com.topdraw.util.RedissonUtil; |
| 18 | import com.topdraw.util.TimestampUtil; | ||
| 19 | import com.topdraw.utils.PageUtil; | 12 | import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 13 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | 14 | import com.topdraw.utils.StringUtils; |
| ... | @@ -23,21 +16,15 @@ import com.topdraw.utils.ValidationUtil; | ... | @@ -23,21 +16,15 @@ import com.topdraw.utils.ValidationUtil; |
| 23 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
| 24 | import org.redisson.api.RLock; | 17 | import org.redisson.api.RLock; |
| 25 | import org.redisson.api.RedissonClient; | 18 | import org.redisson.api.RedissonClient; |
| 26 | import org.springframework.beans.BeanUtils; | ||
| 27 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | import org.springframework.cache.annotation.CacheConfig; | ||
| 29 | import org.springframework.cache.annotation.CacheEvict; | 20 | import org.springframework.cache.annotation.CacheEvict; |
| 30 | import org.springframework.cache.annotation.Cacheable; | ||
| 31 | import org.springframework.dao.EmptyResultDataAccessException; | 21 | import org.springframework.dao.EmptyResultDataAccessException; |
| 32 | import org.springframework.data.domain.Page; | 22 | import org.springframework.data.domain.Page; |
| 33 | import org.springframework.data.domain.Pageable; | 23 | import org.springframework.data.domain.Pageable; |
| 34 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
| 35 | import org.springframework.transaction.PlatformTransactionManager; | 25 | import org.springframework.transaction.PlatformTransactionManager; |
| 36 | import org.springframework.transaction.TransactionDefinition; | ||
| 37 | import org.springframework.transaction.TransactionStatus; | ||
| 38 | import org.springframework.transaction.annotation.Propagation; | 26 | import org.springframework.transaction.annotation.Propagation; |
| 39 | import org.springframework.transaction.annotation.Transactional; | 27 | import org.springframework.transaction.annotation.Transactional; |
| 40 | import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 41 | import org.springframework.util.Assert; | 28 | import org.springframework.util.Assert; |
| 42 | 29 | ||
| 43 | import java.nio.charset.StandardCharsets; | 30 | import java.nio.charset.StandardCharsets; |
| ... | @@ -65,7 +52,7 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -65,7 +52,7 @@ public class MemberServiceImpl implements MemberService { |
| 65 | PlatformTransactionManager platformTransactionManager; | 52 | PlatformTransactionManager platformTransactionManager; |
| 66 | 53 | ||
| 67 | @Autowired | 54 | @Autowired |
| 68 | private com.topdraw.business.basicdata.user.iptv.service.UserTvService UserTvService; | 55 | private com.topdraw.business.module.user.iptv.service.UserTvService UserTvService; |
| 69 | 56 | ||
| 70 | @Override | 57 | @Override |
| 71 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { | 58 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { |
| ... | @@ -80,7 +67,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -80,7 +67,6 @@ public class MemberServiceImpl implements MemberService { |
| 80 | } | 67 | } |
| 81 | 68 | ||
| 82 | @Override | 69 | @Override |
| 83 | // @Cacheable(value = "member::memberId",key = "#p0") | ||
| 84 | public MemberDTO findById(Long id) { | 70 | public MemberDTO findById(Long id) { |
| 85 | Member member = memberRepository.findById(id).orElseGet(Member::new); | 71 | Member member = memberRepository.findById(id).orElseGet(Member::new); |
| 86 | ValidationUtil.isNull(member.getId(),"Member","id",id); | 72 | ValidationUtil.isNull(member.getId(),"Member","id",id); |
| ... | @@ -130,7 +116,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -130,7 +116,6 @@ public class MemberServiceImpl implements MemberService { |
| 130 | @Override | 116 | @Override |
| 131 | @Transactional(rollbackFor = Exception.class) | 117 | @Transactional(rollbackFor = Exception.class) |
| 132 | @AsyncMqSend() | 118 | @AsyncMqSend() |
| 133 | @CacheEvict(value = "member::memberId",key = "#p0.id") | ||
| 134 | public void update(Member resources) { | 119 | public void update(Member resources) { |
| 135 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); | 120 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); |
| 136 | try { | 121 | try { | ... | ... |
| 1 | package com.topdraw.business.basicdata.member.service.mapper; | 1 | package com.topdraw.business.module.member.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 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.member.viphistory.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 | import java.time.LocalDateTime; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @author luerlong | ||
| 18 | * @date 2021-12-10 | ||
| 19 | */ | ||
| 20 | @Entity | ||
| 21 | @Data | ||
| 22 | @EntityListeners(AuditingEntityListener.class) | ||
| 23 | @Accessors(chain = true) | ||
| 24 | @Table(name="uc_member_vip_history") | ||
| 25 | public class MemberVipHistory implements Serializable { | ||
| 26 | |||
| 27 | // 主键 | ||
| 28 | @Id | ||
| 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 30 | @Column(name = "id") | ||
| 31 | private Long id; | ||
| 32 | |||
| 33 | // 会员id | ||
| 34 | @Column(name = "member_id") | ||
| 35 | private Long memberId; | ||
| 36 | |||
| 37 | // 会员vip等级 | ||
| 38 | @Column(name = "vip") | ||
| 39 | private Integer vip; | ||
| 40 | |||
| 41 | // 修改之前vip等级 | ||
| 42 | @Column(name = "before_vip") | ||
| 43 | private Integer beforeVip; | ||
| 44 | |||
| 45 | // vip失效时间 | ||
| 46 | @Column(name = "vip_expire_time") | ||
| 47 | private LocalDateTime vipExpireTime; | ||
| 48 | |||
| 49 | // 状态 1正常 0已过期 | ||
| 50 | @Column(name = "status") | ||
| 51 | private Integer status; | ||
| 52 | |||
| 53 | // 创建时间 | ||
| 54 | @CreatedDate | ||
| 55 | @Column(name = "create_time") | ||
| 56 | private Timestamp createTime; | ||
| 57 | |||
| 58 | // 修改时间 | ||
| 59 | @LastModifiedDate | ||
| 60 | @Column(name = "update_time") | ||
| 61 | private Timestamp updateTime; | ||
| 62 | |||
| 63 | public void copy(MemberVipHistory source){ | ||
| 64 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 65 | } | ||
| 66 | } |
| 1 | package com.topdraw.business.module.member.viphistory.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | import org.springframework.data.jpa.repository.Query; | ||
| 7 | |||
| 8 | import java.time.LocalDateTime; | ||
| 9 | import java.util.Optional; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @author luerlong | ||
| 13 | * @date 2021-12-10 | ||
| 14 | */ | ||
| 15 | public interface MemberVipHistoryRepository extends JpaRepository<MemberVipHistory, Long>, JpaSpecificationExecutor<MemberVipHistory> { | ||
| 16 | |||
| 17 | @Query(value = "SELECT * FROM uc_member_vip_history " + | ||
| 18 | " WHERE vip_expire_time >= ?2 AND member_id = ?1 order by create_time desc limit 1 ", nativeQuery = true) | ||
| 19 | Optional<MemberVipHistory> findByTime(Long memberId, LocalDateTime nowTime); | ||
| 20 | } |
| 1 | package com.topdraw.business.module.member.viphistory.rest; | ||
| 2 | |||
| 3 | import com.topdraw.annotation.Log; | ||
| 4 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 5 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | ||
| 6 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria; | ||
| 7 | import com.topdraw.common.ResultInfo; | ||
| 8 | import io.swagger.annotations.Api; | ||
| 9 | import io.swagger.annotations.ApiOperation; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | import org.springframework.data.domain.Pageable; | ||
| 12 | import org.springframework.validation.annotation.Validated; | ||
| 13 | import org.springframework.web.bind.annotation.*; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author luerlong | ||
| 17 | * @date 2021-12-10 | ||
| 18 | */ | ||
| 19 | @Api(tags = "MemberVipHistory管理") | ||
| 20 | @RestController | ||
| 21 | @RequestMapping("/api/memberVipHistory") | ||
| 22 | public class MemberVipHistoryController { | ||
| 23 | |||
| 24 | @Autowired | ||
| 25 | private MemberVipHistoryService memberVipHistoryService; | ||
| 26 | |||
| 27 | @GetMapping | ||
| 28 | @ApiOperation("查询MemberVipHistory") | ||
| 29 | public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { | ||
| 30 | return ResultInfo.successPage(memberVipHistoryService.queryAll(criteria,pageable)); | ||
| 31 | } | ||
| 32 | |||
| 33 | @GetMapping(value = "/all") | ||
| 34 | @ApiOperation("查询所有MemberVipHistory") | ||
| 35 | public ResultInfo getMemberVipHistorys(MemberVipHistoryQueryCriteria criteria) { | ||
| 36 | return ResultInfo.success(memberVipHistoryService.queryAll(criteria)); | ||
| 37 | } | ||
| 38 | |||
| 39 | @Log | ||
| 40 | @PostMapping | ||
| 41 | @ApiOperation("新增MemberVipHistory") | ||
| 42 | public ResultInfo create(@Validated @RequestBody MemberVipHistory resources) { | ||
| 43 | memberVipHistoryService.create(resources); | ||
| 44 | return ResultInfo.success(); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Log | ||
| 48 | @PutMapping | ||
| 49 | @ApiOperation("修改MemberVipHistory") | ||
| 50 | public ResultInfo update(@Validated @RequestBody MemberVipHistory resources) { | ||
| 51 | memberVipHistoryService.update(resources); | ||
| 52 | return ResultInfo.success(); | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | @Log | ||
| 57 | @DeleteMapping(value = "/{id}") | ||
| 58 | @ApiOperation("删除MemberVipHistory") | ||
| 59 | public ResultInfo delete(@PathVariable Long id) { | ||
| 60 | memberVipHistoryService.delete(id); | ||
| 61 | return ResultInfo.success(); | ||
| 62 | } | ||
| 63 | |||
| 64 | } |
| 1 | package com.topdraw.business.module.member.viphistory.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 4 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; | ||
| 5 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria; | ||
| 6 | import org.springframework.data.domain.Pageable; | ||
| 7 | |||
| 8 | import java.time.LocalDateTime; | ||
| 9 | import java.util.List; | ||
| 10 | import java.util.Map; | ||
| 11 | import java.util.Optional; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author luerlong | ||
| 15 | * @date 2021-12-10 | ||
| 16 | */ | ||
| 17 | public interface MemberVipHistoryService { | ||
| 18 | |||
| 19 | /** | ||
| 20 | * 查询数据分页 | ||
| 21 | * @param criteria 条件参数 | ||
| 22 | * @param pageable 分页参数 | ||
| 23 | * @return Map<String,Object> | ||
| 24 | */ | ||
| 25 | Map<String,Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable); | ||
| 26 | |||
| 27 | /** | ||
| 28 | * 查询所有数据不分页 | ||
| 29 | * @param criteria 条件参数 | ||
| 30 | * @return List<MemberVipHistoryDTO> | ||
| 31 | */ | ||
| 32 | List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * 根据ID查询 | ||
| 36 | * @param id ID | ||
| 37 | * @return MemberVipHistoryDTO | ||
| 38 | */ | ||
| 39 | MemberVipHistoryDTO findById(Long id); | ||
| 40 | |||
| 41 | void create(MemberVipHistory resources); | ||
| 42 | |||
| 43 | void update(MemberVipHistory resources); | ||
| 44 | |||
| 45 | void delete(Long id); | ||
| 46 | |||
| 47 | MemberVipHistory findByTime(Long id, LocalDateTime nowTime); | ||
| 48 | } |
| 1 | package com.topdraw.business.module.member.viphistory.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | |||
| 5 | import java.io.Serializable; | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | import java.time.LocalDateTime; | ||
| 8 | |||
| 9 | |||
| 10 | /** | ||
| 11 | * @author luerlong | ||
| 12 | * @date 2021-12-10 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class MemberVipHistoryDTO implements Serializable { | ||
| 16 | |||
| 17 | // 主键 | ||
| 18 | private Long id; | ||
| 19 | |||
| 20 | // 会员id | ||
| 21 | private Long memberId; | ||
| 22 | |||
| 23 | // 会员vip等级 | ||
| 24 | private Integer vip; | ||
| 25 | |||
| 26 | // 修改之前vip等级 | ||
| 27 | private Integer beforeVip; | ||
| 28 | |||
| 29 | // vip失效时间 | ||
| 30 | private LocalDateTime vipExpireTime; | ||
| 31 | |||
| 32 | // 状态 1正常 0已过期 | ||
| 33 | private Integer status; | ||
| 34 | |||
| 35 | // 创建时间 | ||
| 36 | private Timestamp createTime; | ||
| 37 | |||
| 38 | // 修改时间 | ||
| 39 | private Timestamp updateTime; | ||
| 40 | } |
| 1 | package com.topdraw.business.module.member.viphistory.service.impl; | ||
| 2 | |||
| 3 | |||
| 4 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 5 | import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; | ||
| 6 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | ||
| 7 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; | ||
| 8 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria; | ||
| 9 | import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper; | ||
| 10 | import com.topdraw.utils.PageUtil; | ||
| 11 | import com.topdraw.utils.QueryHelp; | ||
| 12 | import com.topdraw.utils.ValidationUtil; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 15 | import org.springframework.data.domain.Page; | ||
| 16 | import org.springframework.data.domain.Pageable; | ||
| 17 | import org.springframework.stereotype.Service; | ||
| 18 | import org.springframework.transaction.annotation.Propagation; | ||
| 19 | import org.springframework.transaction.annotation.Transactional; | ||
| 20 | import org.springframework.util.Assert; | ||
| 21 | |||
| 22 | import java.time.LocalDateTime; | ||
| 23 | import java.util.List; | ||
| 24 | import java.util.Map; | ||
| 25 | import java.util.Optional; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * @author luerlong | ||
| 29 | * @date 2021-12-10 | ||
| 30 | */ | ||
| 31 | @Service | ||
| 32 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 33 | public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | ||
| 34 | |||
| 35 | @Autowired | ||
| 36 | private MemberVipHistoryRepository memberVipHistoryRepository; | ||
| 37 | |||
| 38 | @Autowired | ||
| 39 | private MemberVipHistoryMapper memberVipHistoryMapper; | ||
| 40 | |||
| 41 | @Override | ||
| 42 | public Map<String, Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { | ||
| 43 | Page<MemberVipHistory> page = memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
| 44 | return PageUtil.toPage(page.map(memberVipHistoryMapper::toDto)); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | public List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria) { | ||
| 49 | return memberVipHistoryMapper.toDto(memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | ||
| 53 | public MemberVipHistoryDTO findById(Long id) { | ||
| 54 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new); | ||
| 55 | ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id); | ||
| 56 | return memberVipHistoryMapper.toDto(memberVipHistory); | ||
| 57 | } | ||
| 58 | |||
| 59 | @Override | ||
| 60 | @Transactional(rollbackFor = Exception.class) | ||
| 61 | public void create(MemberVipHistory resources) { | ||
| 62 | memberVipHistoryRepository.save(resources); | ||
| 63 | } | ||
| 64 | |||
| 65 | @Override | ||
| 66 | @Transactional(rollbackFor = Exception.class) | ||
| 67 | public void update(MemberVipHistory resources) { | ||
| 68 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new); | ||
| 69 | ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId()); | ||
| 70 | memberVipHistory.copy(resources); | ||
| 71 | memberVipHistoryRepository.save(memberVipHistory); | ||
| 72 | } | ||
| 73 | |||
| 74 | @Override | ||
| 75 | @Transactional(rollbackFor = Exception.class) | ||
| 76 | public void delete(Long id) { | ||
| 77 | Assert.notNull(id, "The given id must not be null!"); | ||
| 78 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseThrow( | ||
| 79 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1)); | ||
| 80 | memberVipHistoryRepository.delete(memberVipHistory); | ||
| 81 | } | ||
| 82 | |||
| 83 | @Override | ||
| 84 | public MemberVipHistory findByTime(Long memberId, LocalDateTime nowTime) { | ||
| 85 | MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findByTime(memberId, nowTime).orElseGet(MemberVipHistory::new); | ||
| 86 | return memberVipHistory; | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 90 | } |
| 1 | package com.topdraw.business.module.member.viphistory.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 5 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author luerlong | ||
| 11 | * @date 2021-12-10 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface MemberVipHistoryMapper extends BaseMapper<MemberVipHistoryDTO, MemberVipHistory> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.basicdata.points.available.domain; | 1 | package com.topdraw.business.module.points.available.domain; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 4 | import lombok.Data; | 3 | import lombok.Data; |
| 5 | import lombok.experimental.Accessors; | 4 | import lombok.experimental.Accessors; |
| 6 | import cn.hutool.core.bean.BeanUtil; | 5 | import cn.hutool.core.bean.BeanUtil; |
| ... | @@ -11,7 +10,6 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -11,7 +10,6 @@ import org.springframework.data.annotation.LastModifiedDate; |
| 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
| 12 | import java.sql.Timestamp; | 11 | import java.sql.Timestamp; |
| 13 | import java.time.LocalDateTime; | 12 | import java.time.LocalDateTime; |
| 14 | import java.util.UUID; | ||
| 15 | 13 | ||
| 16 | import java.io.Serializable; | 14 | import java.io.Serializable; |
| 17 | 15 | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.available.repository; | 1 | package com.topdraw.business.module.points.available.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 3 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 4 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 4 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | 5 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; |
| 6 | import org.springframework.data.jpa.repository.JpaRepository; | 6 | import org.springframework.data.jpa.repository.JpaRepository; |
| 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 8 | import org.springframework.data.jpa.repository.Modifying; | 8 | import org.springframework.data.jpa.repository.Modifying; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.available.rest; | 1 | package com.topdraw.business.module.points.available.rest; |
| 2 | |||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | ||
| 6 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | ||
| 7 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | ||
| 13 | import org.springframework.web.bind.annotation.*; | ||
| 14 | import io.swagger.annotations.*; | ||
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 2 | ||
| 18 | /** | 3 | /** |
| 19 | * @author XiangHan | 4 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.available.service; | 1 | package com.topdraw.business.module.points.available.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 3 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 4 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 4 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | 5 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | 7 | ||
| 8 | import java.time.LocalDateTime; | 8 | import java.time.LocalDateTime; |
| 9 | import java.util.Date; | ||
| 10 | import java.util.Map; | 9 | import java.util.Map; |
| 11 | import java.util.List; | 10 | import java.util.List; |
| 12 | 11 | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.available.service.impl; | 1 | package com.topdraw.business.module.points.available.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 4 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 5 | import com.topdraw.util.RedissonUtil; | 5 | import com.topdraw.util.RedissonUtil; |
| 6 | import com.topdraw.utils.ValidationUtil; | 6 | import com.topdraw.utils.ValidationUtil; |
| 7 | import com.topdraw.business.basicdata.points.available.repository.PointsAvailableRepository; | 7 | import com.topdraw.business.module.points.available.repository.PointsAvailableRepository; |
| 8 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | 8 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 9 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 9 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 10 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | 10 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; |
| 11 | import com.topdraw.business.basicdata.points.available.service.mapper.PointsAvailableMapper; | 11 | import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper; |
| 12 | import org.redisson.api.RLock; | 12 | import org.redisson.api.RLock; |
| 13 | import org.redisson.api.RedissonClient; | 13 | import org.redisson.api.RedissonClient; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | @@ -23,11 +23,8 @@ import com.topdraw.utils.PageUtil; | ... | @@ -23,11 +23,8 @@ import com.topdraw.utils.PageUtil; |
| 23 | import com.topdraw.utils.QueryHelp; | 23 | import com.topdraw.utils.QueryHelp; |
| 24 | import com.topdraw.utils.StringUtils; | 24 | import com.topdraw.utils.StringUtils; |
| 25 | 25 | ||
| 26 | import java.sql.Timestamp; | ||
| 27 | import java.time.LocalDateTime; | 26 | import java.time.LocalDateTime; |
| 28 | import java.util.*; | 27 | import java.util.*; |
| 29 | import java.io.IOException; | ||
| 30 | import javax.servlet.http.HttpServletResponse; | ||
| 31 | 28 | ||
| 32 | /** | 29 | /** |
| 33 | * @author XiangHan | 30 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.available.service.mapper; | 1 | package com.topdraw.business.module.points.available.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 4 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 5 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 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.basicdata.points.detail.detailhistory.repository; | 1 | package com.topdraw.business.module.points.detail.detailhistory.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory; | 3 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; |
| 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.business.basicdata.points.detail.detailhistory.rest; | 1 | package com.topdraw.business.module.points.detail.detailhistory.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory; | ||
| 6 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.PointsDetailHistoryService; | ||
| 7 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | ||
| 12 | import io.swagger.annotations.*; | 3 | import io.swagger.annotations.*; |
| 13 | 4 | ||
| 14 | /** | 5 | /** | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.detailhistory.service; | 1 | package com.topdraw.business.module.points.detail.detailhistory.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory; | 3 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; |
| 4 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; | 4 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; |
| 5 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; | 5 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.detailhistory.service.impl; | 1 | package com.topdraw.business.module.points.detail.detailhistory.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory; | 4 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.points.detail.detailhistory.repository.PointsDetailHistoryRepository; | 6 | import com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository; |
| 7 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.PointsDetailHistoryService; | 7 | import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; |
| 8 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; | 8 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; |
| 9 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; | 9 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper; | 10 | import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.detailhistory.service.mapper; | 1 | package com.topdraw.business.module.points.detail.detailhistory.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.points.detail.detailhistory.domain.PointsDetailHistory; | 4 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; |
| 5 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; | 5 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; |
| 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.basicdata.points.detail.repository; | 1 | package com.topdraw.business.module.points.detail.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 3 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 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 | ||
| 7 | import java.util.Date; | ||
| 8 | import java.util.List; | 7 | import java.util.List; |
| 9 | import java.util.Optional; | 8 | import java.util.Optional; |
| 10 | 9 | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.rest; | 1 | package com.topdraw.business.module.points.detail.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | ||
| 6 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | ||
| 7 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | ||
| 12 | import io.swagger.annotations.*; | 3 | import io.swagger.annotations.*; |
| 13 | 4 | ||
| 14 | /** | 5 | /** | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.service; | 1 | package com.topdraw.business.module.points.detail.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 3 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 4 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 4 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO; |
| 5 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO; | 5 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria; | ||
| 7 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 8 | 7 | ||
| 9 | import java.util.Date; | ||
| 10 | import java.util.Map; | 8 | import java.util.Map; |
| 11 | import java.util.List; | 9 | import java.util.List; |
| 12 | 10 | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.service.impl; | 1 | package com.topdraw.business.module.points.detail.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 4 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.points.detail.repository.PointsDetailRepository; | 6 | import com.topdraw.business.module.points.detail.repository.PointsDetailRepository; |
| 7 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | 7 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 8 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO; | 8 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO; |
| 9 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria; | 9 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.points.detail.service.mapper.PointsDetailMapper; | 10 | import com.topdraw.business.module.points.detail.service.mapper.PointsDetailMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -20,7 +20,6 @@ import com.topdraw.utils.PageUtil; | ... | @@ -20,7 +20,6 @@ import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 20 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | 21 | import com.topdraw.utils.StringUtils; |
| 22 | 22 | ||
| 23 | import java.util.Date; | ||
| 24 | import java.util.List; | 23 | import java.util.List; |
| 25 | import java.util.Map; | 24 | import java.util.Map; |
| 26 | import java.util.Objects; | 25 | import java.util.Objects; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.detail.service.mapper; | 1 | package com.topdraw.business.module.points.detail.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 4 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 5 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailDTO; | 5 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO; |
| 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.basicdata.points.repository; | 1 | package com.topdraw.business.module.points.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.domain.Points; | 3 | import com.topdraw.business.module.points.domain.Points; |
| 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.business.basicdata.points.rest; | 1 | package com.topdraw.business.module.points.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.basicdata.points.domain.Points; | ||
| 6 | import com.topdraw.business.basicdata.points.service.PointsService; | ||
| 7 | import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.validation.annotation.Validated; | ||
| 11 | import org.springframework.web.bind.annotation.*; | ||
| 12 | import io.swagger.annotations.*; | 3 | import io.swagger.annotations.*; |
| 13 | 4 | ||
| 14 | /** | 5 | /** | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.service; | 1 | package com.topdraw.business.module.points.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.domain.Points; | 3 | import com.topdraw.business.module.points.domain.Points; |
| 4 | import com.topdraw.business.basicdata.points.service.dto.PointsDTO; | 4 | import com.topdraw.business.module.points.service.dto.PointsDTO; |
| 5 | import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria; | 5 | import com.topdraw.business.module.points.service.dto.PointsQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.service.impl; | 1 | package com.topdraw.business.module.points.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.points.domain.Points; | 4 | import com.topdraw.business.module.points.domain.Points; |
| 5 | import com.topdraw.util.RedissonUtil; | 5 | import com.topdraw.util.RedissonUtil; |
| 6 | import com.topdraw.utils.ValidationUtil; | 6 | import com.topdraw.utils.ValidationUtil; |
| 7 | import com.topdraw.business.basicdata.points.repository.PointsRepository; | 7 | import com.topdraw.business.module.points.repository.PointsRepository; |
| 8 | import com.topdraw.business.basicdata.points.service.PointsService; | 8 | import com.topdraw.business.module.points.service.PointsService; |
| 9 | import com.topdraw.business.basicdata.points.service.dto.PointsDTO; | 9 | import com.topdraw.business.module.points.service.dto.PointsDTO; |
| 10 | import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria; | 10 | import com.topdraw.business.module.points.service.dto.PointsQueryCriteria; |
| 11 | import com.topdraw.business.basicdata.points.service.mapper.PointsMapper; | 11 | import com.topdraw.business.module.points.service.mapper.PointsMapper; |
| 12 | import org.redisson.api.RLock; | 12 | import org.redisson.api.RLock; |
| 13 | import org.redisson.api.RedissonClient; | 13 | import org.redisson.api.RedissonClient; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.service.mapper; | 1 | package com.topdraw.business.module.points.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.points.domain.Points; | 4 | import com.topdraw.business.module.points.domain.Points; |
| 5 | import com.topdraw.business.basicdata.points.service.dto.PointsDTO; | 5 | import com.topdraw.business.module.points.service.dto.PointsDTO; |
| 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.basicdata.points.standingbook.repository; | 1 | package com.topdraw.business.module.points.standingbook.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | 3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; |
| 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 | ||
| 7 | import java.util.Optional; | ||
| 8 | |||
| 9 | /** | 7 | /** |
| 10 | * @author XiangHan | 8 | * @author XiangHan |
| 11 | * @date 2021-10-29 | 9 | * @date 2021-10-29 | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.standingbook.rest; | 1 | package com.topdraw.business.module.points.standingbook.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | 5 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; |
| 6 | import com.topdraw.business.basicdata.points.standingbook.service.PointsStandingBookService; | 6 | import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService; |
| 7 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | 7 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 13 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 13 | ||
| 18 | /** | 14 | /** |
| 19 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.standingbook.service; | 1 | package com.topdraw.business.module.points.standingbook.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | 3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; |
| 4 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO; | 4 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; |
| 5 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | 5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | 9 | ||
| 12 | /** | 10 | /** |
| 13 | * @author XiangHan | 11 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.standingbook.service.impl; | 1 | package com.topdraw.business.module.points.standingbook.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | 3 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; |
| 4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.utils.FileUtil; | 5 | import com.topdraw.business.module.points.standingbook.repository.PointsStandingBookRepository; |
| 6 | import com.topdraw.business.basicdata.points.standingbook.repository.PointsStandingBookRepository; | 6 | import com.topdraw.business.module.points.standingbook.service.PointsStandingBookService; |
| 7 | import com.topdraw.business.basicdata.points.standingbook.service.PointsStandingBookService; | 7 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; |
| 8 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO; | 8 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookQueryCriteria; | 9 | import com.topdraw.business.module.points.standingbook.service.mapper.PointsStandingBookMapper; |
| 10 | import com.topdraw.business.basicdata.points.standingbook.service.mapper.PointsStandingBookMapper; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; | ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; |
| 18 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
| 19 | import com.topdraw.utils.PageUtil; | 18 | import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 19 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | ||
| 22 | 20 | ||
| 23 | import java.util.List; | 21 | import java.util.List; |
| 24 | import java.util.Map; | 22 | 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 | 23 | ||
| 30 | /** | 24 | /** |
| 31 | * @author XiangHan | 25 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.points.standingbook.service.mapper; | 1 | package com.topdraw.business.module.points.standingbook.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | 4 | import com.topdraw.business.module.points.standingbook.domain.PointsStandingBook; |
| 5 | import com.topdraw.business.basicdata.points.standingbook.service.dto.PointsStandingBookDTO; | 5 | import com.topdraw.business.module.points.standingbook.service.dto.PointsStandingBookDTO; |
| 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.basicdata.rights.history.repository; | 1 | package com.topdraw.business.module.rights.history.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 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.business.basicdata.rights.history.rest; | 1 | package com.topdraw.business.module.rights.history.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryType; | ||
| 4 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 5 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; |
| 6 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; |
| 7 | import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService; | ||
| 8 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria; | ||
| 9 | import com.topdraw.util.TimestampUtil; | 6 | import com.topdraw.util.TimestampUtil; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.data.domain.Pageable; | 8 | import org.springframework.data.domain.Pageable; |
| 12 | import org.springframework.validation.annotation.Validated; | ||
| 13 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 10 | import io.swagger.annotations.*; |
| 15 | 11 | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.history.service; | 1 | package com.topdraw.business.module.rights.history.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 4 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO; | 4 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO; |
| 5 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria; | 5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.history.service.dto; | 1 | package com.topdraw.business.module.rights.history.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | import javax.persistence.Column; | ||
| 6 | import java.sql.Timestamp; | 5 | import java.sql.Timestamp; |
| 7 | import java.io.Serializable; | 6 | import java.io.Serializable; |
| 8 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.history.service.impl; | 1 | package com.topdraw.business.module.rights.history.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 4 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.rights.history.repository.RightsHistoryRepository; | 6 | import com.topdraw.business.module.rights.history.repository.RightsHistoryRepository; |
| 7 | import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService; | 7 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; |
| 8 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO; | 8 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO; |
| 9 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria; | 9 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.rights.history.service.mapper.RightsHistoryMapper; | 10 | import com.topdraw.business.module.rights.history.service.mapper.RightsHistoryMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.history.service.mapper; | 1 | package com.topdraw.business.module.rights.history.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 4 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 5 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryDTO; | 5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryDTO; |
| 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.basicdata.rights.permanentrights.repository; | 1 | package com.topdraw.business.module.rights.permanentrights.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights; | 3 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; |
| 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.business.basicdata.rights.permanentrights.rest; | 1 | package com.topdraw.business.module.rights.permanentrights.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights; | 5 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; |
| 6 | import com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService; | 6 | import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService; |
| 7 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; | 7 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.permanentrights.service; | 1 | package com.topdraw.business.module.rights.permanentrights.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights; | 3 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; |
| 4 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO; | 4 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; |
| 5 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; | 5 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.permanentrights.service.impl; | 1 | package com.topdraw.business.module.rights.permanentrights.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; |
| 4 | import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.rights.permanentrights.repository.PermanentRightsRepository; | 5 | import com.topdraw.business.module.rights.permanentrights.repository.PermanentRightsRepository; |
| 7 | import com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService; | 6 | import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService; |
| 8 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO; | 7 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; |
| 9 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; | 8 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.rights.permanentrights.service.mapper.PermanentRightsMapper; | 9 | import com.topdraw.business.module.rights.permanentrights.service.mapper.PermanentRightsMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.permanentrights.service.mapper; | 1 | package com.topdraw.business.module.rights.permanentrights.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.rights.permanentrights.domain.PermanentRights; | 4 | import com.topdraw.business.module.rights.permanentrights.domain.PermanentRights; |
| 5 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO; | 5 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; |
| 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.basicdata.rights.repository; | 1 | package com.topdraw.business.module.rights.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.domain.Rights; | 3 | import com.topdraw.business.module.rights.domain.Rights; |
| 4 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 7 | import org.springframework.data.jpa.repository.Query; | 6 | import org.springframework.data.jpa.repository.Query; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.rest; | 1 | package com.topdraw.business.module.rights.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.service.RightsService; | 3 | import com.topdraw.business.module.rights.service.RightsService; |
| 4 | import com.topdraw.business.basicdata.rights.service.dto.RightsQueryCriteria; | ||
| 5 | import com.topdraw.common.ResultInfo; | 4 | import com.topdraw.common.ResultInfo; |
| 6 | import io.swagger.annotations.Api; | 5 | import io.swagger.annotations.Api; |
| 7 | import io.swagger.annotations.ApiOperation; | 6 | import io.swagger.annotations.ApiOperation; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.web.bind.annotation.GetMapping; | 8 | import org.springframework.web.bind.annotation.GetMapping; |
| 11 | import org.springframework.web.bind.annotation.PathVariable; | 9 | import org.springframework.web.bind.annotation.PathVariable; |
| 12 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.service; | 1 | package com.topdraw.business.module.rights.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.domain.Rights; | 3 | import com.topdraw.business.module.rights.domain.Rights; |
| 4 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | 4 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
| 5 | import com.topdraw.business.basicdata.rights.service.dto.RightsQueryCriteria; | 5 | import com.topdraw.business.module.rights.service.dto.RightsQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.service.impl; | 1 | package com.topdraw.business.module.rights.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.rights.domain.Rights; | 4 | import com.topdraw.business.module.rights.domain.Rights; |
| 5 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.rights.repository.RightsRepository; | 6 | import com.topdraw.business.module.rights.repository.RightsRepository; |
| 7 | import com.topdraw.business.basicdata.rights.service.RightsService; | 7 | import com.topdraw.business.module.rights.service.RightsService; |
| 8 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | 8 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
| 9 | import com.topdraw.business.basicdata.rights.service.dto.RightsQueryCriteria; | 9 | import com.topdraw.business.module.rights.service.dto.RightsQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.rights.service.mapper.RightsMapper; | 10 | import com.topdraw.business.module.rights.service.mapper.RightsMapper; |
| 11 | import org.redisson.api.RLock; | 11 | import org.redisson.api.RLock; |
| 12 | import org.redisson.api.RedissonClient; | 12 | import org.redisson.api.RedissonClient; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.business.basicdata.rights.service.mapper; | 1 | package com.topdraw.business.module.rights.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.rights.domain.Rights; | 4 | import com.topdraw.business.module.rights.domain.Rights; |
| 5 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | 5 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
| 6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 7 | import org.mapstruct.ReportingPolicy; | 7 | import org.mapstruct.ReportingPolicy; |
| 8 | 8 | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/task/attribute/domain/TaskAttr.java
0 → 100644
| 1 | package com.topdraw.business.module.task.attribute.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 | |||
| 12 | import java.io.Serializable; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * @author XiangHan | ||
| 16 | * @date 2022-01-13 | ||
| 17 | */ | ||
| 18 | @Entity | ||
| 19 | @Data | ||
| 20 | @EntityListeners(AuditingEntityListener.class) | ||
| 21 | @Accessors(chain = true) | ||
| 22 | @Table(name="tr_task_attr") | ||
| 23 | public class TaskAttr implements Serializable { | ||
| 24 | |||
| 25 | @Id | ||
| 26 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 27 | @Column(name = "id") | ||
| 28 | private Long id; | ||
| 29 | |||
| 30 | // 任务id(关联task主键) | ||
| 31 | @Column(name = "task_id") | ||
| 32 | private Long taskId; | ||
| 33 | |||
| 34 | // 任务属性字符串 | ||
| 35 | @Column(name = "attr_str") | ||
| 36 | private String attrStr; | ||
| 37 | |||
| 38 | public void copy(TaskAttr source){ | ||
| 39 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 40 | } | ||
| 41 | } |
| 1 | package com.topdraw.business.module.task.attribute.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | |||
| 7 | import java.util.Optional; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-01-13 | ||
| 12 | */ | ||
| 13 | public interface TaskAttrRepository extends JpaRepository<TaskAttr, Long>, JpaSpecificationExecutor<TaskAttr> { | ||
| 14 | |||
| 15 | Optional<TaskAttr> findByTaskId(Long taskId); | ||
| 16 | } |
| 1 | package com.topdraw.business.module.task.attribute.rest; | ||
| 2 | |||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
| 6 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | ||
| 7 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.data.domain.Pageable; | ||
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | ||
| 13 | import org.springframework.web.bind.annotation.*; | ||
| 14 | import io.swagger.annotations.*; | ||
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @author XiangHan | ||
| 20 | * @date 2022-01-13 | ||
| 21 | */ | ||
| 22 | @Api(tags = "TaskAttr管理") | ||
| 23 | @RestController | ||
| 24 | @RequestMapping("/api/TaskAttr") | ||
| 25 | public class TaskAttrController { | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private TaskAttrService TaskAttrService; | ||
| 29 | |||
| 30 | @GetMapping | ||
| 31 | @ApiOperation("查询TaskAttr") | ||
| 32 | public ResultInfo getTaskAttrs(TaskAttrQueryCriteria criteria, Pageable pageable) { | ||
| 33 | return ResultInfo.successPage(TaskAttrService.queryAll(criteria,pageable)); | ||
| 34 | } | ||
| 35 | |||
| 36 | @GetMapping(value = "/all") | ||
| 37 | @ApiOperation("查询所有TaskAttr") | ||
| 38 | public ResultInfo getTaskAttrs(TaskAttrQueryCriteria criteria) { | ||
| 39 | return ResultInfo.success(TaskAttrService.queryAll(criteria)); | ||
| 40 | } | ||
| 41 | |||
| 42 | @Log | ||
| 43 | @PostMapping | ||
| 44 | @ApiOperation("新增TaskAttr") | ||
| 45 | public ResultInfo create(@Validated @RequestBody TaskAttr resources) { | ||
| 46 | TaskAttrService.create(resources); | ||
| 47 | return ResultInfo.success(); | ||
| 48 | } | ||
| 49 | |||
| 50 | @Log | ||
| 51 | @PutMapping | ||
| 52 | @ApiOperation("修改TaskAttr") | ||
| 53 | public ResultInfo update(@Validated @RequestBody TaskAttr resources) { | ||
| 54 | TaskAttrService.update(resources); | ||
| 55 | return ResultInfo.success(); | ||
| 56 | } | ||
| 57 | |||
| 58 | |||
| 59 | @Log | ||
| 60 | @DeleteMapping(value = "/{id}") | ||
| 61 | @ApiOperation("删除TaskAttr") | ||
| 62 | public ResultInfo delete(@PathVariable Long id) { | ||
| 63 | TaskAttrService.delete(id); | ||
| 64 | return ResultInfo.success(); | ||
| 65 | } | ||
| 66 | |||
| 67 | } |
| 1 | package com.topdraw.business.module.task.attribute.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
| 4 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | ||
| 5 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
| 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-01-13 | ||
| 15 | */ | ||
| 16 | public interface TaskAttrService { | ||
| 17 | |||
| 18 | /** | ||
| 19 | * 查询数据分页 | ||
| 20 | * @param criteria 条件参数 | ||
| 21 | * @param pageable 分页参数 | ||
| 22 | * @return Map<String,Object> | ||
| 23 | */ | ||
| 24 | Map<String,Object> queryAll(TaskAttrQueryCriteria criteria, Pageable pageable); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * 查询所有数据不分页 | ||
| 28 | * @param criteria 条件参数 | ||
| 29 | * @return List<TaskAttrDTO> | ||
| 30 | */ | ||
| 31 | List<TaskAttrDTO> queryAll(TaskAttrQueryCriteria criteria); | ||
| 32 | |||
| 33 | /** | ||
| 34 | * 根据ID查询 | ||
| 35 | * @param id ID | ||
| 36 | * @return TaskAttrDTO | ||
| 37 | */ | ||
| 38 | TaskAttrDTO findById(Long id); | ||
| 39 | |||
| 40 | void create(TaskAttr resources); | ||
| 41 | |||
| 42 | void update(TaskAttr resources); | ||
| 43 | |||
| 44 | void delete(Long id); | ||
| 45 | |||
| 46 | TaskAttrDTO findByTaskId(Long taskId); | ||
| 47 | } |
| 1 | package com.topdraw.business.module.task.attribute.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import java.io.Serializable; | ||
| 5 | |||
| 6 | |||
| 7 | /** | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2022-01-13 | ||
| 10 | */ | ||
| 11 | @Data | ||
| 12 | public class TaskAttrDTO implements Serializable { | ||
| 13 | |||
| 14 | private Long id; | ||
| 15 | |||
| 16 | // 任务id(关联task主键) | ||
| 17 | private Long taskId; | ||
| 18 | |||
| 19 | // 任务属性字符串 | ||
| 20 | private String attrStr; | ||
| 21 | } |
| 1 | package com.topdraw.business.module.task.attribute.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
| 4 | import com.topdraw.utils.ValidationUtil; | ||
| 5 | import com.topdraw.utils.FileUtil; | ||
| 6 | import com.topdraw.business.module.task.attribute.repository.TaskAttrRepository; | ||
| 7 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; | ||
| 8 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | ||
| 9 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrQueryCriteria; | ||
| 10 | import com.topdraw.business.module.task.attribute.service.mapper.TaskAttrMapper; | ||
| 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-01-13 | ||
| 33 | */ | ||
| 34 | @Service | ||
| 35 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 36 | public class TaskAttrServiceImpl implements TaskAttrService { | ||
| 37 | |||
| 38 | @Autowired | ||
| 39 | private TaskAttrRepository TaskAttrRepository; | ||
| 40 | |||
| 41 | @Autowired | ||
| 42 | private TaskAttrMapper TaskAttrMapper; | ||
| 43 | |||
| 44 | @Override | ||
| 45 | public Map<String, Object> queryAll(TaskAttrQueryCriteria criteria, Pageable pageable) { | ||
| 46 | Page<TaskAttr> page = TaskAttrRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
| 47 | return PageUtil.toPage(page.map(TaskAttrMapper::toDto)); | ||
| 48 | } | ||
| 49 | |||
| 50 | @Override | ||
| 51 | public List<TaskAttrDTO> queryAll(TaskAttrQueryCriteria criteria) { | ||
| 52 | return TaskAttrMapper.toDto(TaskAttrRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
| 53 | } | ||
| 54 | |||
| 55 | @Override | ||
| 56 | public TaskAttrDTO findById(Long id) { | ||
| 57 | TaskAttr TaskAttr = TaskAttrRepository.findById(id).orElseGet(TaskAttr::new); | ||
| 58 | ValidationUtil.isNull(TaskAttr.getId(),"TaskAttr","id",id); | ||
| 59 | return TaskAttrMapper.toDto(TaskAttr); | ||
| 60 | } | ||
| 61 | |||
| 62 | @Override | ||
| 63 | @Transactional(rollbackFor = Exception.class) | ||
| 64 | public void create(TaskAttr resources) { | ||
| 65 | TaskAttrRepository.save(resources); | ||
| 66 | } | ||
| 67 | |||
| 68 | @Override | ||
| 69 | @Transactional(rollbackFor = Exception.class) | ||
| 70 | public void update(TaskAttr resources) { | ||
| 71 | TaskAttr TaskAttr = TaskAttrRepository.findById(resources.getId()).orElseGet(TaskAttr::new); | ||
| 72 | ValidationUtil.isNull( TaskAttr.getId(),"TaskAttr","id",resources.getId()); | ||
| 73 | TaskAttr.copy(resources); | ||
| 74 | TaskAttrRepository.save(TaskAttr); | ||
| 75 | } | ||
| 76 | |||
| 77 | @Override | ||
| 78 | @Transactional(rollbackFor = Exception.class) | ||
| 79 | public void delete(Long id) { | ||
| 80 | Assert.notNull(id, "The given id must not be null!"); | ||
| 81 | TaskAttr TaskAttr = TaskAttrRepository.findById(id).orElseThrow( | ||
| 82 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", TaskAttr.class, id), 1)); | ||
| 83 | TaskAttrRepository.delete(TaskAttr); | ||
| 84 | } | ||
| 85 | |||
| 86 | @Override | ||
| 87 | public TaskAttrDTO findByTaskId(Long taskId) { | ||
| 88 | TaskAttr TaskAttr = TaskAttrRepository.findByTaskId(taskId).orElseGet(TaskAttr::new); | ||
| 89 | return TaskAttrMapper.toDto(TaskAttr); | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | } |
| 1 | package com.topdraw.business.module.task.attribute.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.task.attribute.domain.TaskAttr; | ||
| 5 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-01-13 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface TaskAttrMapper extends BaseMapper<TaskAttrDTO, TaskAttr> { | ||
| 15 | |||
| 16 | } |
| 1 | package com.topdraw.business.basicdata.task.progress.repository; | 1 | package com.topdraw.business.module.task.progress.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 4 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressDTO; | ||
| 5 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 7 | import org.springframework.data.jpa.repository.Query; | 6 | import org.springframework.data.jpa.repository.Query; |
| 8 | 7 | ||
| 9 | import java.util.List; | 8 | import java.util.List; |
| 10 | import java.util.Optional; | ||
| 11 | 9 | ||
| 12 | /** | 10 | /** |
| 13 | * @author XiangHan | 11 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.progress.rest; | 1 | package com.topdraw.business.module.task.progress.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 5 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 6 | import com.topdraw.business.basicdata.task.progress.service.TrTaskProgressService; | 6 | import com.topdraw.business.module.task.progress.service.TrTaskProgressService; |
| 7 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressQueryCriteria; | 7 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 13 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 13 | ||
| 18 | /** | 14 | /** |
| 19 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.progress.service; | 1 | package com.topdraw.business.module.task.progress.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 4 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressDTO; | 4 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
| 5 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressQueryCriteria; | 5 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | 9 | ||
| 12 | /** | 10 | /** |
| 13 | * @author XiangHan | 11 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.progress.service.dto; | 1 | package com.topdraw.business.module.task.progress.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import com.topdraw.annotation.Query; | 4 | import com.topdraw.annotation.Query; |
| 5 | 5 | ||
| 6 | import java.sql.Timestamp; | ||
| 7 | |||
| 8 | /** | 6 | /** |
| 9 | * @author XiangHan | 7 | * @author XiangHan |
| 10 | * @date 2021-11-02 | 8 | * @date 2021-11-02 | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.progress.service.impl; | 1 | package com.topdraw.business.module.task.progress.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.utils.FileUtil; | 5 | import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository; |
| 6 | import com.topdraw.business.basicdata.task.progress.repository.TrTaskProgressRepository; | 6 | import com.topdraw.business.module.task.progress.service.TrTaskProgressService; |
| 7 | import com.topdraw.business.basicdata.task.progress.service.TrTaskProgressService; | 7 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
| 8 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressDTO; | 8 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressQueryCriteria; | 9 | import com.topdraw.business.module.task.progress.service.mapper.TrTaskProgressMapper; |
| 10 | import com.topdraw.business.basicdata.task.progress.service.mapper.TrTaskProgressMapper; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; | ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; |
| 18 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
| 19 | import com.topdraw.utils.PageUtil; | 18 | import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 19 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | ||
| 22 | 20 | ||
| 23 | import java.util.List; | 21 | import java.util.List; |
| 24 | import java.util.Map; | 22 | 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 | 23 | ||
| 30 | /** | 24 | /** |
| 31 | * @author XiangHan | 25 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.progress.service.mapper; | 1 | package com.topdraw.business.module.task.progress.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 4 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 5 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressDTO; | 5 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
| 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.basicdata.task.repository; | 1 | package com.topdraw.business.module.task.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.domain.Task; | 3 | import com.topdraw.business.module.task.domain.Task; |
| 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.business.basicdata.task.rest; | 1 | package com.topdraw.business.module.task.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.task.domain.Task; | 5 | import com.topdraw.business.module.task.domain.Task; |
| 6 | import com.topdraw.business.basicdata.task.service.TaskService; | 6 | import com.topdraw.business.module.task.service.TaskService; |
| 7 | import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria; | 7 | import com.topdraw.business.module.task.service.dto.TaskQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.service; | 1 | package com.topdraw.business.module.task.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.domain.Task; | 3 | import com.topdraw.business.module.task.domain.Task; |
| 4 | import com.topdraw.business.basicdata.task.service.dto.TaskDTO; | 4 | import com.topdraw.business.module.task.service.dto.TaskDTO; |
| 5 | import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria; | 5 | import com.topdraw.business.module.task.service.dto.TaskQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.service.dto; | 1 | package com.topdraw.business.module.task.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | 4 | ||
| 5 | import javax.persistence.Column; | ||
| 6 | import java.sql.Timestamp; | 5 | import java.sql.Timestamp; |
| 7 | import java.io.Serializable; | 6 | import java.io.Serializable; |
| 8 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.service.impl; | 1 | package com.topdraw.business.module.task.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.domain.Task; | 3 | import com.topdraw.business.module.task.domain.Task; |
| 4 | import com.topdraw.utils.StringUtils; | ||
| 5 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 6 | import com.topdraw.business.basicdata.task.repository.TaskRepository; | 5 | import com.topdraw.business.module.task.repository.TaskRepository; |
| 7 | import com.topdraw.business.basicdata.task.service.TaskService; | 6 | import com.topdraw.business.module.task.service.TaskService; |
| 8 | import com.topdraw.business.basicdata.task.service.dto.TaskDTO; | 7 | import com.topdraw.business.module.task.service.dto.TaskDTO; |
| 9 | import com.topdraw.business.basicdata.task.service.dto.TaskQueryCriteria; | 8 | import com.topdraw.business.module.task.service.dto.TaskQueryCriteria; |
| 10 | import com.topdraw.business.basicdata.task.service.mapper.TaskMapper; | 9 | import com.topdraw.business.module.task.service.mapper.TaskMapper; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.cache.annotation.Cacheable; | ||
| 13 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 14 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| 15 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.service.mapper; | 1 | package com.topdraw.business.module.task.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.task.domain.Task; | 4 | import com.topdraw.business.module.task.domain.Task; |
| 5 | import com.topdraw.business.basicdata.task.service.dto.TaskDTO; | 5 | import com.topdraw.business.module.task.service.dto.TaskDTO; |
| 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.basicdata.task.template.repository; | 1 | package com.topdraw.business.module.task.template.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 3 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 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 | ||
| 7 | import java.util.List; | ||
| 7 | import java.util.Optional; | 8 | import java.util.Optional; |
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| ... | @@ -16,5 +17,5 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long | ... | @@ -16,5 +17,5 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long |
| 16 | 17 | ||
| 17 | TaskTemplate findByEvent(String event); | 18 | TaskTemplate findByEvent(String event); |
| 18 | 19 | ||
| 19 | TaskTemplate findByType(Integer event); | 20 | List<TaskTemplate> findByType(Integer event); |
| 20 | } | 21 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.template.rest; | 1 | package com.topdraw.business.module.task.template.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 5 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 6 | import com.topdraw.business.basicdata.task.template.service.TaskTemplateService; | 6 | import com.topdraw.business.module.task.template.service.TaskTemplateService; |
| 7 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria; | 7 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.template.service; | 1 | package com.topdraw.business.module.task.template.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 3 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 4 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO; | 4 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; |
| 5 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria; | 5 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| ... | @@ -50,5 +50,5 @@ public interface TaskTemplateService { | ... | @@ -50,5 +50,5 @@ public interface TaskTemplateService { |
| 50 | 50 | ||
| 51 | TaskTemplate findByEvent(String event); | 51 | TaskTemplate findByEvent(String event); |
| 52 | 52 | ||
| 53 | TaskTemplate findByType(Integer event); | 53 | List<TaskTemplate> findByType(Integer event); |
| 54 | } | 54 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.template.service.impl; | 1 | package com.topdraw.business.module.task.template.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 3 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.business.basicdata.task.template.repository.TaskTemplateRepository; | 5 | import com.topdraw.business.module.task.template.repository.TaskTemplateRepository; |
| 6 | import com.topdraw.business.basicdata.task.template.service.TaskTemplateService; | 6 | import com.topdraw.business.module.task.template.service.TaskTemplateService; |
| 7 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO; | 7 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; |
| 8 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria; | 8 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.task.template.service.mapper.TaskTemplateMapper; | 9 | import com.topdraw.business.module.task.template.service.mapper.TaskTemplateMapper; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.cache.annotation.Cacheable; | ||
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| 14 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
| ... | @@ -95,7 +94,7 @@ public class TaskTemplateServiceImpl implements TaskTemplateService { | ... | @@ -95,7 +94,7 @@ public class TaskTemplateServiceImpl implements TaskTemplateService { |
| 95 | 94 | ||
| 96 | // @Cacheable(cacheNames = "uc-admin_taskTemplate" , key = "#event") | 95 | // @Cacheable(cacheNames = "uc-admin_taskTemplate" , key = "#event") |
| 97 | @Override | 96 | @Override |
| 98 | public TaskTemplate findByType(Integer event) { | 97 | public List<TaskTemplate> findByType(Integer event) { |
| 99 | return Objects.nonNull(event) ? this.TaskTemplateRepository.findByType(event) : null; | 98 | return Objects.nonNull(event) ? this.TaskTemplateRepository.findByType(event) : null; |
| 100 | } | 99 | } |
| 101 | } | 100 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.task.template.service.mapper; | 1 | package com.topdraw.business.module.task.template.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 4 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 5 | import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO; | 5 | import com.topdraw.business.module.task.template.service.dto.TaskTemplateDTO; |
| 6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 7 | import org.mapstruct.ReportingPolicy; | 7 | import org.mapstruct.ReportingPolicy; |
| 8 | 8 | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/domain/UserConstant.java
0 → 100644
| 1 | package com.topdraw.business.module.user.iptv.domain; | ||
| 2 | |||
| 3 | import java.util.Arrays; | ||
| 4 | import java.util.List; | ||
| 5 | |||
| 6 | public interface UserConstant { | ||
| 7 | |||
| 8 | // 电信 | ||
| 9 | List<String> platform_lt = Arrays.asList("SC.CTCC","SC.CTC","CTC.ChongQing","ChongQing.CTC","CQ.CTC","CQ.CTCC"); | ||
| 10 | // 移动 | ||
| 11 | List<String> platform_yd = Arrays.asList("SC.CMCC","CMCC.SC","ChongQing.CMCC","CMCC.ChongQing"); | ||
| 12 | // 联通 | ||
| 13 | List<String> platform_dx = Arrays.asList("SC.CUCC",""); | ||
| 14 | |||
| 15 | } |
| 1 | package com.topdraw.business.basicdata.user.iptv.domain; | 1 | package com.topdraw.business.module.user.iptv.domain; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import lombok.experimental.Accessors; | 4 | import lombok.experimental.Accessors; |
| ... | @@ -23,6 +23,10 @@ import java.io.Serializable; | ... | @@ -23,6 +23,10 @@ import java.io.Serializable; |
| 23 | @Table(name="uc_user_tv") | 23 | @Table(name="uc_user_tv") |
| 24 | public class UserTv implements Serializable { | 24 | public class UserTv implements Serializable { |
| 25 | 25 | ||
| 26 | /** 绑定的小屏账户会员编码 */ | ||
| 27 | @Column(name = "priority_member_code") | ||
| 28 | private String priorityMemberCode; | ||
| 29 | |||
| 26 | @Transient | 30 | @Transient |
| 27 | private String memberCode; | 31 | private String memberCode; |
| 28 | 32 | ||
| ... | @@ -119,6 +123,6 @@ public class UserTv implements Serializable { | ... | @@ -119,6 +123,6 @@ public class UserTv implements Serializable { |
| 119 | private Long memberId; | 123 | private Long memberId; |
| 120 | 124 | ||
| 121 | public void copy(UserTv source){ | 125 | public void copy(UserTv source){ |
| 122 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 126 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false)); |
| 123 | } | 127 | } |
| 124 | } | 128 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.repository; | 1 | package com.topdraw.business.module.user.iptv.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 3 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 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 | ||
| ... | @@ -13,4 +13,6 @@ import java.util.Optional; | ... | @@ -13,4 +13,6 @@ import java.util.Optional; |
| 13 | public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecificationExecutor<UserTv> { | 13 | public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecificationExecutor<UserTv> { |
| 14 | 14 | ||
| 15 | Optional<UserTv> findByPlatformAccount(String platformAccount); | 15 | Optional<UserTv> findByPlatformAccount(String platformAccount); |
| 16 | |||
| 17 | Optional<UserTv> findByPriorityMemberCode(String memberCode); | ||
| 16 | } | 18 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.rest; | 1 | package com.topdraw.business.module.user.iptv.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.domain.Member; | ||
| 4 | import com.topdraw.business.basicdata.member.service.MemberService; | ||
| 5 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | ||
| 6 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 7 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 8 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 5 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 9 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | 6 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 10 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria; | 7 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 13 | import org.springframework.http.HttpStatus; | ||
| 14 | import org.springframework.http.ResponseEntity; | ||
| 15 | import org.springframework.util.Assert; | ||
| 16 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 17 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 18 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 19 | import java.io.IOException; | ||
| 20 | import java.util.Objects; | ||
| 21 | import javax.servlet.http.HttpServletResponse; | ||
| 22 | 13 | ||
| 23 | /** | 14 | /** |
| 24 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.service; | 1 | package com.topdraw.business.module.user.iptv.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 3 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 4 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | 4 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 5 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria; | 5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.io.IOException; | ||
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | 9 | ||
| 12 | /** | 10 | /** |
| 13 | * @author XiangHan | 11 | * @author XiangHan |
| ... | @@ -45,5 +43,5 @@ public interface UserTvService { | ... | @@ -45,5 +43,5 @@ public interface UserTvService { |
| 45 | 43 | ||
| 46 | UserTvDTO findByPlatformAccount(String platformAccount); | 44 | UserTvDTO findByPlatformAccount(String platformAccount); |
| 47 | 45 | ||
| 48 | 46 | UserTvDTO findByPriorityMemberCode(String memberCode); | |
| 49 | } | 47 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.service.dto; | 1 | package com.topdraw.business.module.user.iptv.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
| ... | @@ -12,6 +12,9 @@ import java.io.Serializable; | ... | @@ -12,6 +12,9 @@ import java.io.Serializable; |
| 12 | @Data | 12 | @Data |
| 13 | public class UserTvDTO implements Serializable { | 13 | public class UserTvDTO implements Serializable { |
| 14 | 14 | ||
| 15 | /** 绑定的小屏账户会员编码 */ | ||
| 16 | private String priorityMemberCode; | ||
| 17 | |||
| 15 | // ID | 18 | // ID |
| 16 | private Long id; | 19 | private Long id; |
| 17 | 20 | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.service.impl; | 1 | package com.topdraw.business.module.user.iptv.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 5 | import com.topdraw.business.basicdata.member.service.MemberService; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 7 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | ||
| 8 | import com.topdraw.config.LocalConstants; | ||
| 9 | import com.topdraw.util.IdWorker; | ||
| 10 | import com.topdraw.util.RedissonUtil; | ||
| 11 | import com.topdraw.util.TimestampUtil; | ||
| 12 | import com.topdraw.utils.StringUtils; | ||
| 13 | import com.topdraw.utils.ValidationUtil; | 7 | import com.topdraw.utils.ValidationUtil; |
| 14 | import com.topdraw.business.basicdata.user.iptv.repository.UserTvRepository; | 8 | import com.topdraw.business.module.user.iptv.repository.UserTvRepository; |
| 15 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | 9 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 16 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | 10 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 17 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvQueryCriteria; | 11 | import com.topdraw.business.module.user.iptv.service.dto.UserTvQueryCriteria; |
| 18 | import com.topdraw.business.basicdata.user.iptv.service.mapper.UserTvMapper; | 12 | import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; |
| 19 | import org.redisson.api.RLock; | ||
| 20 | import org.redisson.api.RedissonClient; | ||
| 21 | import org.springframework.beans.BeanUtils; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
| 24 | import org.springframework.transaction.annotation.Propagation; | 15 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -114,5 +105,15 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -114,5 +105,15 @@ public class UserTvServiceImpl implements UserTvService { |
| 114 | return null; | 105 | return null; |
| 115 | } | 106 | } |
| 116 | 107 | ||
| 108 | @Override | ||
| 109 | public UserTvDTO findByPriorityMemberCode(String memberCode) { | ||
| 110 | Optional<UserTv> userTv = UserTvRepository.findByPriorityMemberCode(memberCode); | ||
| 111 | if (userTv.isPresent()) { | ||
| 112 | ValidationUtil.isNull( userTv.get().getId(),"UserTv","id",userTv.get().getId()); | ||
| 113 | return UserTvMapper.toDto(userTv.get()); | ||
| 114 | } | ||
| 115 | return null; | ||
| 116 | } | ||
| 117 | |||
| 117 | 118 | ||
| 118 | } | 119 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.iptv.service.mapper; | 1 | package com.topdraw.business.module.user.iptv.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 4 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 5 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | 5 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 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.basicdata.user.weixin.repository; | 1 | package com.topdraw.business.module.user.weixin.repository; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin; | 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 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 | ||
| ... | @@ -12,4 +12,13 @@ import java.util.Optional; | ... | @@ -12,4 +12,13 @@ import java.util.Optional; |
| 12 | */ | 12 | */ |
| 13 | public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, JpaSpecificationExecutor<UserWeixin> { | 13 | public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, JpaSpecificationExecutor<UserWeixin> { |
| 14 | 14 | ||
| 15 | Optional<UserWeixin> findFirstByMemberIdAndAppid(Long memberId, String appid); | ||
| 16 | |||
| 17 | Optional<UserWeixin> findFirstByUnionidAndAppidAndOpenid(String unionId, String appId, String openId); | ||
| 18 | |||
| 19 | Optional<UserWeixin> findFirstByAppidAndOpenid(String appId, String openId); | ||
| 20 | |||
| 21 | Optional<UserWeixin> findFirstByUnionid(String unionid); | ||
| 22 | |||
| 23 | Optional<UserWeixin> findFirstByUnionidAndAppid(String unionid, String appId); | ||
| 15 | } | 24 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.rest; | 1 | package com.topdraw.business.module.user.weixin.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.common.ResultInfo; | 3 | import com.topdraw.common.ResultInfo; |
| 4 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
| 5 | import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin; | 5 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 6 | import com.topdraw.business.basicdata.user.weixin.service.UserWeixinService; | 6 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 7 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria; | 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.data.domain.Pageable; | 9 | import org.springframework.data.domain.Pageable; |
| 10 | import org.springframework.http.HttpStatus; | ||
| 11 | import org.springframework.http.ResponseEntity; | ||
| 12 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| 13 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 14 | import io.swagger.annotations.*; | 12 | import io.swagger.annotations.*; |
| 15 | import java.io.IOException; | ||
| 16 | import javax.servlet.http.HttpServletResponse; | ||
| 17 | 13 | ||
| 18 | /** | 14 | /** |
| 19 | * @author XiangHan | 15 | * @author XiangHan | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.service; | 1 | package com.topdraw.business.module.user.weixin.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin; | 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 4 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO; | 4 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 5 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria; | 5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
| 6 | import org.springframework.data.domain.Pageable; | 6 | import org.springframework.data.domain.Pageable; |
| 7 | import java.util.Map; | 7 | import java.util.Map; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.io.IOException; | 9 | import java.util.Optional; |
| 10 | import javax.servlet.http.HttpServletResponse; | ||
| 11 | 10 | ||
| 12 | /** | 11 | /** |
| 13 | * @author XiangHan | 12 | * @author XiangHan |
| ... | @@ -37,10 +36,19 @@ public interface UserWeixinService { | ... | @@ -37,10 +36,19 @@ public interface UserWeixinService { |
| 37 | */ | 36 | */ |
| 38 | UserWeixinDTO findById(Long id); | 37 | UserWeixinDTO findById(Long id); |
| 39 | 38 | ||
| 40 | void create(UserWeixin resources); | 39 | UserWeixin create(UserWeixin resources); |
| 41 | 40 | ||
| 42 | void update(UserWeixin resources); | 41 | void update(UserWeixin resources); |
| 43 | 42 | ||
| 44 | void delete(Long id); | 43 | void delete(Long id); |
| 45 | 44 | ||
| 45 | UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid); | ||
| 46 | |||
| 47 | UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId); | ||
| 48 | |||
| 49 | UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId); | ||
| 50 | |||
| 51 | UserWeixinDTO findFirstByUnionId(String unionid); | ||
| 52 | |||
| 53 | UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId); | ||
| 46 | } | 54 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.service.dto; | 1 | package com.topdraw.business.module.user.weixin.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.AllArgsConstructor; | ||
| 4 | import lombok.Builder; | ||
| 3 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | import lombok.NoArgsConstructor; | ||
| 7 | |||
| 4 | import java.sql.Timestamp; | 8 | import java.sql.Timestamp; |
| 5 | import java.io.Serializable; | 9 | import java.io.Serializable; |
| 6 | 10 | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.service.dto; | 1 | package com.topdraw.business.module.user.weixin.service.dto; |
| 2 | 2 | ||
| 3 | import lombok.Data; | 3 | import lombok.Data; |
| 4 | import com.topdraw.annotation.Query; | ||
| 5 | 4 | ||
| 6 | /** | 5 | /** |
| 7 | * @author XiangHan | 6 | * @author XiangHan |
| ... | @@ -9,4 +8,7 @@ import com.topdraw.annotation.Query; | ... | @@ -9,4 +8,7 @@ import com.topdraw.annotation.Query; |
| 9 | */ | 8 | */ |
| 10 | @Data | 9 | @Data |
| 11 | public class UserWeixinQueryCriteria{ | 10 | public class UserWeixinQueryCriteria{ |
| 11 | |||
| 12 | |||
| 13 | |||
| 12 | } | 14 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.service.impl; | 1 | package com.topdraw.business.module.user.weixin.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin; | 3 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 4 | import com.topdraw.utils.ValidationUtil; | 4 | import com.topdraw.utils.ValidationUtil; |
| 5 | import com.topdraw.utils.FileUtil; | 5 | import com.topdraw.business.module.user.weixin.repository.UserWeixinRepository; |
| 6 | import com.topdraw.business.basicdata.user.weixin.repository.UserWeixinRepository; | 6 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 7 | import com.topdraw.business.basicdata.user.weixin.service.UserWeixinService; | 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 8 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO; | 8 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinQueryCriteria; | 9 | import com.topdraw.business.module.user.weixin.service.mapper.UserWeixinMapper; |
| 10 | import com.topdraw.business.basicdata.user.weixin.service.mapper.UserWeixinMapper; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
| ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; | ... | @@ -18,14 +17,9 @@ import org.springframework.data.domain.Pageable; |
| 18 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
| 19 | import com.topdraw.utils.PageUtil; | 18 | import com.topdraw.utils.PageUtil; |
| 20 | import com.topdraw.utils.QueryHelp; | 19 | import com.topdraw.utils.QueryHelp; |
| 21 | import com.topdraw.utils.StringUtils; | ||
| 22 | 20 | ||
| 23 | import java.util.List; | 21 | import java.util.List; |
| 24 | import java.util.Map; | 22 | 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 | 23 | ||
| 30 | /** | 24 | /** |
| 31 | * @author XiangHan | 25 | * @author XiangHan |
| ... | @@ -61,8 +55,9 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -61,8 +55,9 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 61 | 55 | ||
| 62 | @Override | 56 | @Override |
| 63 | @Transactional(rollbackFor = Exception.class) | 57 | @Transactional(rollbackFor = Exception.class) |
| 64 | public void create(UserWeixin resources) { | 58 | public UserWeixin create(UserWeixin resources) { |
| 65 | UserWeixinRepository.save(resources); | 59 | UserWeixinRepository.save(resources); |
| 60 | return resources; | ||
| 66 | } | 61 | } |
| 67 | 62 | ||
| 68 | @Override | 63 | @Override |
| ... | @@ -83,5 +78,36 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -83,5 +78,36 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
| 83 | UserWeixinRepository.delete(UserWeixin); | 78 | UserWeixinRepository.delete(UserWeixin); |
| 84 | } | 79 | } |
| 85 | 80 | ||
| 81 | @Override | ||
| 82 | public UserWeixinDTO findFirstByMemberIdAndAppid(Long memberId, String appid) { | ||
| 83 | UserWeixin userWeixin = this.UserWeixinRepository.findFirstByMemberIdAndAppid(memberId, appid).orElseGet(UserWeixin::new); | ||
| 84 | ValidationUtil.isNull(userWeixin.getId(),"UserWeixin","id",memberId); | ||
| 85 | return UserWeixinMapper.toDto(userWeixin); | ||
| 86 | } | ||
| 87 | |||
| 88 | @Override | ||
| 89 | public UserWeixinDTO findFirstByUnionIdAndAppIdAndOpenId(String unionId, String appId, String openId) { | ||
| 90 | UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionidAndAppidAndOpenid(unionId, appId,openId).orElseGet(UserWeixin::new); | ||
| 91 | return UserWeixinMapper.toDto(userWeixin); | ||
| 92 | } | ||
| 93 | |||
| 94 | @Override | ||
| 95 | public UserWeixinDTO findFirstByAppIdAndOpenId(String appId, String openId) { | ||
| 96 | UserWeixin userWeixin = this.UserWeixinRepository.findFirstByAppidAndOpenid(appId,openId).orElseGet(UserWeixin::new); | ||
| 97 | return UserWeixinMapper.toDto(userWeixin); | ||
| 98 | } | ||
| 99 | |||
| 100 | @Override | ||
| 101 | public UserWeixinDTO findFirstByUnionId(String unionid) { | ||
| 102 | UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionid(unionid).orElseGet(UserWeixin::new); | ||
| 103 | return UserWeixinMapper.toDto(userWeixin); | ||
| 104 | } | ||
| 105 | |||
| 106 | @Override | ||
| 107 | public UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId) { | ||
| 108 | UserWeixin userWeixin = this.UserWeixinRepository.findFirstByUnionidAndAppid(unionid,appId).orElseGet(UserWeixin::new); | ||
| 109 | return UserWeixinMapper.toDto(userWeixin); | ||
| 110 | } | ||
| 111 | |||
| 86 | 112 | ||
| 87 | } | 113 | } | ... | ... |
| 1 | package com.topdraw.business.basicdata.user.weixin.service.mapper; | 1 | package com.topdraw.business.module.user.weixin.service.mapper; |
| 2 | 2 | ||
| 3 | import com.topdraw.base.BaseMapper; | 3 | import com.topdraw.base.BaseMapper; |
| 4 | import com.topdraw.business.basicdata.user.weixin.domain.UserWeixin; | 4 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 5 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO; | 5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 6 | import org.mapstruct.Mapper; | 6 | import org.mapstruct.Mapper; |
| 7 | import org.mapstruct.ReportingPolicy; | 7 | import org.mapstruct.ReportingPolicy; |
| 8 | 8 | ... | ... |
| ... | @@ -5,6 +5,8 @@ import lombok.Data; | ... | @@ -5,6 +5,8 @@ import lombok.Data; |
| 5 | import lombok.NoArgsConstructor; | 5 | import lombok.NoArgsConstructor; |
| 6 | 6 | ||
| 7 | import javax.persistence.Transient; | 7 | import javax.persistence.Transient; |
| 8 | import javax.validation.constraints.NotNull; | ||
| 9 | import java.sql.Timestamp; | ||
| 8 | 10 | ||
| 9 | @Data | 11 | @Data |
| 10 | @AllArgsConstructor | 12 | @AllArgsConstructor |
| ... | @@ -13,6 +15,7 @@ public class TempIptvUser { | ... | @@ -13,6 +15,7 @@ public class TempIptvUser { |
| 13 | 15 | ||
| 14 | // 账户 | 16 | // 账户 |
| 15 | @Transient | 17 | @Transient |
| 18 | @NotNull(message = "platformAccount can't be null",groups = UnbindGroup.class) | ||
| 16 | private String platformAccount; | 19 | private String platformAccount; |
| 17 | 20 | ||
| 18 | // 分数 | 21 | // 分数 |
| ... | @@ -20,5 +23,72 @@ public class TempIptvUser { | ... | @@ -20,5 +23,72 @@ public class TempIptvUser { |
| 20 | private Long points; | 23 | private Long points; |
| 21 | 24 | ||
| 22 | 25 | ||
| 26 | // ID | ||
| 27 | private Long id; | ||
| 28 | |||
| 29 | // 人ID | ||
| 30 | private Long personId; | ||
| 31 | |||
| 32 | // 运营商平台 | ||
| 33 | private String platform; | ||
| 34 | |||
| 35 | // 手机号 | ||
| 36 | private String cellphone; | ||
| 37 | |||
| 38 | // 用户名 | ||
| 39 | private String username; | ||
| 40 | |||
| 41 | // 密码 MD5 | ||
| 42 | private String password; | ||
| 43 | |||
| 44 | // 昵称 Base64 | ||
| 45 | private String nickname; | ||
| 46 | |||
| 47 | // 头像 | ||
| 48 | private String image; | ||
| 49 | |||
| 50 | // 登录天数(总天数) | ||
| 51 | private Integer loginDays; | ||
| 52 | |||
| 53 | // 连续登录天数 | ||
| 54 | private Integer continueDays; | ||
| 55 | |||
| 56 | // 活跃时间 | ||
| 57 | private Timestamp activeTime; | ||
| 58 | |||
| 59 | // 分组 分组ID用逗号分隔 | ||
| 60 | private String groups; | ||
| 61 | |||
| 62 | // 标签 标签用逗号分隔 | ||
| 63 | private String tags; | ||
| 64 | |||
| 65 | // 登录类型 1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录 | ||
| 66 | private Integer loginType; | ||
| 67 | |||
| 68 | // 状态 0-下线 1-上线 | ||
| 69 | private Integer status; | ||
| 70 | |||
| 71 | // 描述 | ||
| 72 | private String description; | ||
| 73 | |||
| 74 | // 创建者 | ||
| 75 | private String createBy; | ||
| 76 | |||
| 77 | // 创建时间 | ||
| 78 | private Timestamp createTime; | ||
| 79 | |||
| 80 | // 更新者 | ||
| 81 | private String updateBy; | ||
| 82 | |||
| 83 | // 更新时间 | ||
| 84 | private Timestamp updateTime; | ||
| 85 | |||
| 86 | // 会员id | ||
| 87 | private Long memberId; | ||
| 88 | |||
| 89 | // 会员编码 | ||
| 90 | @NotNull(message = "memberCode can't be null",groups = UnbindGroup.class) | ||
| 91 | private String memberCode; | ||
| 92 | |||
| 23 | 93 | ||
| 24 | } | 94 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/SubscribeBean.java
0 → 100644
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | |||
| 4 | import com.alibaba.fastjson.JSONObject; | ||
| 5 | import lombok.Data; | ||
| 6 | |||
| 7 | @Data | ||
| 8 | public class SubscribeBean extends WeiXinUserBean { | ||
| 9 | |||
| 10 | private JSONObject userInfoJson; | ||
| 11 | |||
| 12 | private JSONObject iptvUserInfo; | ||
| 13 | |||
| 14 | private String msgType; | ||
| 15 | |||
| 16 | private String event; | ||
| 17 | |||
| 18 | private String eventKey; | ||
| 19 | |||
| 20 | } |
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/SubscribeBeanEvent.java
0 → 100644
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | import lombok.AllArgsConstructor; | ||
| 4 | import lombok.Data; | ||
| 5 | import lombok.NoArgsConstructor; | ||
| 6 | |||
| 7 | import javax.validation.constraints.NotNull; | ||
| 8 | |||
| 9 | @Data | ||
| 10 | @AllArgsConstructor | ||
| 11 | @NoArgsConstructor | ||
| 12 | public class SubscribeBeanEvent { | ||
| 13 | |||
| 14 | @NotNull(message = "【content】 not be null !!!") | ||
| 15 | private String content; | ||
| 16 | |||
| 17 | } |
member-service-impl/src/main/java/com/topdraw/business/process/domian/weixin/WeiXinUserBean.java
0 → 100644
| 1 | package com.topdraw.business.process.domian.weixin; | ||
| 2 | |||
| 3 | |||
| 4 | import lombok.Data; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * 微信账户信息 | ||
| 8 | * @author XiangHan | ||
| 9 | * @date 2021-01-18 | ||
| 10 | */ | ||
| 11 | @Data | ||
| 12 | public class WeiXinUserBean { | ||
| 13 | |||
| 14 | private Long id; | ||
| 15 | |||
| 16 | private String unionId; | ||
| 17 | |||
| 18 | /** */ | ||
| 19 | private String openId; | ||
| 20 | |||
| 21 | /** */ | ||
| 22 | private String appId; | ||
| 23 | |||
| 24 | /** 加密后的appId,参数 */ | ||
| 25 | private String wxAppid; | ||
| 26 | |||
| 27 | /** 加密后的code,参数 */ | ||
| 28 | private String wxCode; | ||
| 29 | |||
| 30 | /** */ | ||
| 31 | private String userInfo; | ||
| 32 | |||
| 33 | /** 会员id */ | ||
| 34 | private Long memberId; | ||
| 35 | |||
| 36 | /** 加密信息 */ | ||
| 37 | private String encryptedData; | ||
| 38 | |||
| 39 | /** 解析用户电话号码时使用,参数 */ | ||
| 40 | private String iv; | ||
| 41 | |||
| 42 | /** 资源id */ | ||
| 43 | private String sourceId; | ||
| 44 | |||
| 45 | /** 资源类型 */ | ||
| 46 | private String sourceType; | ||
| 47 | |||
| 48 | /** 资源描述,用来表示从哪个地方链接进来的 */ | ||
| 49 | private String sourceDesc; | ||
| 50 | |||
| 51 | /** 资源实例 */ | ||
| 52 | private String sourceEntity; | ||
| 53 | |||
| 54 | /** 推荐者id */ | ||
| 55 | private Long sourceUser; | ||
| 56 | } |
member-service-impl/src/main/java/com/topdraw/business/process/rest/MemberOperationController.java
0 → 100644
| 1 | package com.topdraw.business.process.rest; | ||
| 2 | |||
| 3 | import com.topdraw.annotation.Log; | ||
| 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
| 5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | ||
| 6 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 7 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 8 | import com.topdraw.business.process.service.MemberOperationService; | ||
| 9 | import com.topdraw.common.IResultInfo; | ||
| 10 | import com.topdraw.common.ResultInfo; | ||
| 11 | import io.swagger.annotations.Api; | ||
| 12 | import io.swagger.annotations.ApiOperation; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.web.bind.annotation.*; | ||
| 15 | |||
| 16 | @Api("会员处理") | ||
| 17 | @RestController | ||
| 18 | @RequestMapping(value = "/ucEngine/api/memberOperation") | ||
| 19 | public class MemberOperationController { | ||
| 20 | |||
| 21 | @Autowired | ||
| 22 | private MemberOperationService memberOperationService; | ||
| 23 | |||
| 24 | @Log("获取会员加密信息并且检查vip状态") | ||
| 25 | @GetMapping("/getMemberProfileAndCheckVip/{memberId}/{appid}") | ||
| 26 | @ApiOperation("获取会员加密信息并且检查vip状态") | ||
| 27 | public IResultInfo getMemberProfileAndCheckVip(@PathVariable Long memberId, @PathVariable String appid) { | ||
| 28 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appid); | ||
| 29 | return ResultInfo.success(memberProfileDTO); | ||
| 30 | } | ||
| 31 | |||
| 32 | @Log("购买vip") | ||
| 33 | @PutMapping("/buyVip") | ||
| 34 | @ApiOperation("购买vip") | ||
| 35 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { | ||
| 36 | memberOperationService.buyVip(buyVipBean); | ||
| 37 | return ResultInfo.success(); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 |
| 1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.Log; | 3 | import com.topdraw.annotation.Log; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 5 | import com.topdraw.business.basicdata.member.service.MemberService; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 7 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | 7 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; |
| 8 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | 8 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryType; |
| 9 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryType; | 9 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 10 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | 10 | import com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria; |
| 11 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria; | 11 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 12 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 12 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 13 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | 13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
| 14 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | 14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| 15 | import com.topdraw.business.basicdata.user.weixin.service.UserWeixinService; | ||
| 16 | import com.topdraw.business.basicdata.user.weixin.service.dto.UserWeixinDTO; | ||
| 17 | import com.topdraw.business.process.domian.TempIptvUser; | 15 | import com.topdraw.business.process.domian.TempIptvUser; |
| 18 | import com.topdraw.business.process.domian.TempPoints; | 16 | import com.topdraw.business.process.domian.TempPoints; |
| 19 | import com.topdraw.business.process.domian.result.CustomPointsResult; | 17 | import com.topdraw.business.process.domian.result.CustomPointsResult; |
| 20 | import com.topdraw.business.process.service.PointsOperationService; | 18 | import com.topdraw.business.process.service.PointsOperationService; |
| 21 | import com.topdraw.business.process.service.UserTvOperationService; | ||
| 22 | import com.topdraw.common.ResultCode; | ||
| 23 | import com.topdraw.common.ResultInfo; | 19 | import com.topdraw.common.ResultInfo; |
| 24 | import com.topdraw.config.LocalConstants; | 20 | import com.topdraw.config.LocalConstants; |
| 25 | import com.topdraw.util.TimestampUtil; | 21 | import com.topdraw.util.TimestampUtil; |
| 26 | import io.swagger.annotations.Api; | 22 | import io.swagger.annotations.Api; |
| 27 | import io.swagger.annotations.ApiOperation; | 23 | import io.swagger.annotations.ApiOperation; |
| 28 | import lombok.Data; | ||
| 29 | import org.redisson.api.RedissonClient; | ||
| 30 | import org.slf4j.Logger; | 24 | import org.slf4j.Logger; |
| 31 | import org.slf4j.LoggerFactory; | 25 | import org.slf4j.LoggerFactory; |
| 32 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | import org.springframework.data.domain.Pageable; | 27 | import org.springframework.data.domain.Pageable; |
| 34 | import org.springframework.util.Assert; | 28 | import org.springframework.util.Assert; |
| 35 | import org.springframework.util.CollectionUtils; | ||
| 36 | import org.springframework.validation.annotation.Validated; | 29 | import org.springframework.validation.annotation.Validated; |
| 37 | import org.springframework.web.bind.annotation.*; | 30 | import org.springframework.web.bind.annotation.*; |
| 38 | 31 | ||
| 39 | import java.util.Arrays; | 32 | import java.util.Arrays; |
| 40 | import java.util.List; | ||
| 41 | import java.util.Objects; | 33 | import java.util.Objects; |
| 42 | 34 | ||
| 43 | /** | 35 | /** | ... | ... |
| 1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 4 | import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService; | 4 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; |
| 5 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria; | 5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryType; | 6 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryType; |
| 7 | import com.topdraw.business.process.service.RightsOperationService; | 7 | import com.topdraw.business.process.service.RightsOperationService; |
| 8 | import com.topdraw.common.ResultInfo; | 8 | import com.topdraw.common.ResultInfo; |
| 9 | import com.topdraw.util.TimestampUtil; | 9 | import com.topdraw.util.TimestampUtil; | ... | ... |
| ... | @@ -43,6 +43,7 @@ public class TaskOperationController { | ... | @@ -43,6 +43,7 @@ public class TaskOperationController { |
| 43 | @Log | 43 | @Log |
| 44 | @PostMapping(value = "/createPoint4ChongQing") | 44 | @PostMapping(value = "/createPoint4ChongQing") |
| 45 | @ApiOperation("针对重庆大屏20211220号的积分兑换活动专门定制的接口") | 45 | @ApiOperation("针对重庆大屏20211220号的积分兑换活动专门定制的接口") |
| 46 | @Deprecated | ||
| 46 | public ResultInfo createPoint4ChongQing(@RequestBody TempIptvUser tempIptvUser){ | 47 | public ResultInfo createPoint4ChongQing(@RequestBody TempIptvUser tempIptvUser){ |
| 47 | String platformAccount = tempIptvUser.getPlatformAccount(); | 48 | String platformAccount = tempIptvUser.getPlatformAccount(); |
| 48 | Long points = tempIptvUser.getPoints(); | 49 | Long points = tempIptvUser.getPoints(); | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/process/rest/UserOperationController.java
0 → 100644
| 1 | package com.topdraw.business.process.rest; | ||
| 2 | |||
| 3 | import com.alibaba.druid.support.json.JSONUtils; | ||
| 4 | import com.alibaba.fastjson.JSON; | ||
| 5 | import com.alibaba.fastjson.JSONObject; | ||
| 6 | import com.topdraw.annotation.AnonymousAccess; | ||
| 7 | import com.topdraw.annotation.Log; | ||
| 8 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
| 9 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
| 10 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 11 | import com.topdraw.business.process.domian.TempIptvUser; | ||
| 12 | import com.topdraw.business.process.domian.UnbindGroup; | ||
| 13 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | ||
| 14 | import com.topdraw.business.process.domian.weixin.SubscribeBeanEvent; | ||
| 15 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 16 | import com.topdraw.business.process.service.UserOperationService; | ||
| 17 | import com.topdraw.common.ResultInfo; | ||
| 18 | import com.topdraw.module.mq.DataSyncMsg; | ||
| 19 | import com.topdraw.util.JSONUtil; | ||
| 20 | import io.swagger.annotations.Api; | ||
| 21 | import io.swagger.annotations.ApiOperation; | ||
| 22 | import lombok.extern.slf4j.Slf4j; | ||
| 23 | import org.springframework.beans.BeanUtils; | ||
| 24 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 25 | import org.springframework.validation.annotation.Validated; | ||
| 26 | import org.springframework.web.bind.annotation.*; | ||
| 27 | |||
| 28 | @Api("账户处理") | ||
| 29 | @RestController | ||
| 30 | @RequestMapping(value = "/ucEngine/api/userOperation") | ||
| 31 | @Slf4j | ||
| 32 | public class UserOperationController { | ||
| 33 | |||
| 34 | @Autowired | ||
| 35 | private UserOperationService userTvOperationService; | ||
| 36 | |||
| 37 | @Log("带参二维码") | ||
| 38 | @PostMapping(value = "/sendQrCodeMessage") | ||
| 39 | @ApiOperation("带参二维码") | ||
| 40 | @AnonymousAccess | ||
| 41 | public ResultInfo sendQrCodeMessage(@RequestBody String content) { | ||
| 42 | log.info("resources :[{}]",content); | ||
| 43 | boolean result = true; | ||
| 44 | return ResultInfo.success(result); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Log("删除全部收藏") | ||
| 48 | @PostMapping(value = "/deleteAllCollection") | ||
| 49 | @ApiOperation("删除全部收藏") | ||
| 50 | @AnonymousAccess | ||
| 51 | public ResultInfo deleteAllCollection(@RequestBody String content) { | ||
| 52 | log.info("resources :[{}]",content); | ||
| 53 | boolean result = true; | ||
| 54 | return ResultInfo.success(result); | ||
| 55 | } | ||
| 56 | |||
| 57 | @Log("删除收藏") | ||
| 58 | @PostMapping(value = "/deleteCollection") | ||
| 59 | @ApiOperation("删除收藏") | ||
| 60 | @AnonymousAccess | ||
| 61 | public ResultInfo deleteCollection(@RequestBody String content) { | ||
| 62 | log.info("resources :[{}]",content); | ||
| 63 | boolean result = true; | ||
| 64 | return ResultInfo.success(result); | ||
| 65 | } | ||
| 66 | |||
| 67 | @Log("添加收藏") | ||
| 68 | @PostMapping(value = "/addCollection") | ||
| 69 | @ApiOperation("添加收藏") | ||
| 70 | @AnonymousAccess | ||
| 71 | public ResultInfo addCollection(@RequestBody String content) { | ||
| 72 | log.info("resources :[{}]",content); | ||
| 73 | boolean result = true; | ||
| 74 | return ResultInfo.success(result); | ||
| 75 | } | ||
| 76 | |||
| 77 | @Log("新增大屏账户同时创建会员信息") | ||
| 78 | @PostMapping(value = "/createUserAndCreateMember") | ||
| 79 | @ApiOperation("新增大屏账户同时创建会员信息") | ||
| 80 | public ResultInfo createUserAndCreateMember(@Validated @RequestBody TempIptvUser resources) { | ||
| 81 | UserTv userTv = new UserTv(); | ||
| 82 | BeanUtils.copyProperties(resources,userTv); | ||
| 83 | this.userTvOperationService.createMemberByUserTv(userTv); | ||
| 84 | return ResultInfo.success(); | ||
| 85 | } | ||
| 86 | |||
| 87 | @Log("大屏用户解绑") | ||
| 88 | @PutMapping(value = "/unbind") | ||
| 89 | @ApiOperation("大屏用户解绑") | ||
| 90 | public ResultInfo unbind(@Validated(value = {UnbindGroup.class}) @RequestBody TempIptvUser resources) { | ||
| 91 | UserTv userTv = new UserTv(); | ||
| 92 | BeanUtils.copyProperties(resources,userTv); | ||
| 93 | this.userTvOperationService.unbind(userTv); | ||
| 94 | return ResultInfo.success(); | ||
| 95 | } | ||
| 96 | |||
| 97 | @Log("大屏更换主账号") | ||
| 98 | @PutMapping(value = "/changeMainAccount") | ||
| 99 | @ApiOperation("大屏更换主账号") | ||
| 100 | public ResultInfo changeMainAccount(@Validated(value = {UnbindGroup.class}) @RequestBody TempIptvUser resources) { | ||
| 101 | UserTv userTv = new UserTv(); | ||
| 102 | BeanUtils.copyProperties(resources,userTv); | ||
| 103 | this.userTvOperationService.changeMainAccount(userTv); | ||
| 104 | return ResultInfo.success("update success"); | ||
| 105 | } | ||
| 106 | |||
| 107 | @Log("微信小程序登录") | ||
| 108 | @PostMapping("/appletLogin") | ||
| 109 | @ApiOperation("微信小程序登录") | ||
| 110 | public ResultInfo appletLogin(@Validated @RequestBody WeiXinUserBean resources) { | ||
| 111 | UserWeixinDTO result = this.userTvOperationService.appletLogin(resources); | ||
| 112 | return ResultInfo.success(result); | ||
| 113 | } | ||
| 114 | |||
| 115 | @Log("微信公众号关注") | ||
| 116 | @PostMapping("/subscribe") | ||
| 117 | @ApiOperation("微信公众号关注") | ||
| 118 | @AnonymousAccess | ||
| 119 | public ResultInfo subscribe(@Validated @RequestBody SubscribeBeanEvent data) { | ||
| 120 | String content = data.getContent(); | ||
| 121 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | ||
| 122 | boolean result = this.userTvOperationService.subscribe(subscribeBean); | ||
| 123 | return ResultInfo.success(result); | ||
| 124 | } | ||
| 125 | |||
| 126 | @Log("微信公众号取关") | ||
| 127 | @PostMapping("/unsubscribe") | ||
| 128 | @ApiOperation("微信公众号取关") | ||
| 129 | @AnonymousAccess | ||
| 130 | public ResultInfo unsubscribe(@Validated @RequestBody SubscribeBeanEvent data) { | ||
| 131 | String content = data.getContent(); | ||
| 132 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(content, SubscribeBean.class); | ||
| 133 | boolean result = this.userTvOperationService.unsubscribe(subscribeBean); | ||
| 134 | return ResultInfo.success(result); | ||
| 135 | } | ||
| 136 | |||
| 137 | /** | ||
| 138 | * @param data | ||
| 139 | * @description 通过大屏关注的订阅号,因为订阅号不支持带参二维码, | ||
| 140 | * 所以需要先跳到H5(带大屏参数), | ||
| 141 | * 再做服务号授权(订阅号只能按钮触发获取信息), | ||
| 142 | * 再将服务号信息和大屏参数缓存下来(该接口的功能) | ||
| 143 | * 然后跳转到订阅号关注页 | ||
| 144 | * 关注后回调处理时,根据unionid进行相关逻辑 | ||
| 145 | * @author Hongyan Wang | ||
| 146 | * @date 2021/8/24 4:54 下午 | ||
| 147 | */ | ||
| 148 | @PostMapping(value = "/saveUserInfo") | ||
| 149 | @ApiOperation("保存大屏侧信息") | ||
| 150 | public ResultInfo saveUserInfo(@RequestBody String data) { | ||
| 151 | String s = this.userTvOperationService.saveUserInfo(data); | ||
| 152 | return ResultInfo.success(s); | ||
| 153 | } | ||
| 154 | |||
| 155 | @Log("保存用户手机号信息") | ||
| 156 | @PostMapping(value = "/saveUserWeixinPhone") | ||
| 157 | @ApiOperation("保存用户手机号信息") | ||
| 158 | public ResultInfo saveUserWeixinPhone(@RequestBody WeiXinUserBean resources) { | ||
| 159 | log.info("resources :[{}]",resources); | ||
| 160 | MemberProfile s = this.userTvOperationService.saveUserWeixinPhone(resources); | ||
| 161 | return ResultInfo.success(s); | ||
| 162 | } | ||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | } | ||
| 167 | |||
| 168 |
| 1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.domain.Coupon; | ||
| 4 | import com.topdraw.business.process.domian.TempCoupon; | 3 | import com.topdraw.business.process.domian.TempCoupon; |
| 5 | import com.topdraw.business.process.domian.TempRights; | ||
| 6 | 4 | ||
| 7 | import java.util.List; | 5 | import java.util.List; |
| 8 | 6 | ... | ... |
| 1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 6 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | ||
| 7 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 8 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 5 | 9 | ||
| 6 | public interface MemberOperationService { | 10 | public interface MemberOperationService { |
| 7 | 11 | ||
| ... | @@ -16,4 +20,9 @@ public interface MemberOperationService { | ... | @@ -16,4 +20,9 @@ public interface MemberOperationService { |
| 16 | void doUpdateMemberPoints(Member member); | 20 | void doUpdateMemberPoints(Member member); |
| 17 | 21 | ||
| 18 | void doUpdateMemberCoupon(Member member); | 22 | void doUpdateMemberCoupon(Member member); |
| 23 | |||
| 24 | MemberProfileDTO getMemberProfileAndCheckVip(Long memberId, String appid); | ||
| 25 | |||
| 26 | MemberDTO buyVip(BuyVipBean buyVipBean); | ||
| 27 | |||
| 19 | } | 28 | } | ... | ... |
| 1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.domain.Points; | ||
| 4 | import com.topdraw.business.basicdata.task.domain.Task; | ||
| 5 | import com.topdraw.business.process.domian.TempPoints; | 3 | import com.topdraw.business.process.domian.TempPoints; |
| 6 | import com.topdraw.business.process.domian.result.CustomPointsResult; | 4 | import com.topdraw.business.process.domian.result.CustomPointsResult; |
| 7 | 5 | ||
| 8 | import java.util.List; | 6 | import java.util.List; |
| 9 | import java.util.Map; | ||
| 10 | 7 | ||
| 11 | /** | 8 | /** |
| 12 | * @description 积分操作接口 | 9 | * @description 积分操作接口 | ... | ... |
| 1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 4 | import com.topdraw.business.process.domian.RightType; | 4 | import com.topdraw.business.process.domian.RightType; |
| 5 | 5 | ||
| 6 | import java.util.List; | 6 | import java.util.List; | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/process/service/UserOperationService.java
0 → 100644
| 1 | package com.topdraw.business.process.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
| 4 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
| 5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 6 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 7 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | ||
| 8 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 9 | |||
| 10 | public interface UserOperationService { | ||
| 11 | |||
| 12 | boolean createMemberByUserTv(UserTv resources); | ||
| 13 | |||
| 14 | void unbind(UserTv userTv); | ||
| 15 | |||
| 16 | void changeMainAccount(UserTv userTv); | ||
| 17 | |||
| 18 | UserWeixinDTO appletLogin(WeiXinUserBean resources); | ||
| 19 | |||
| 20 | boolean subscribe(SubscribeBean resources); | ||
| 21 | |||
| 22 | boolean unsubscribe(SubscribeBean resources); | ||
| 23 | |||
| 24 | String saveUserInfo(String data); | ||
| 25 | |||
| 26 | MemberProfile saveUserWeixinPhone(WeiXinUserBean resources); | ||
| 27 | } |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 3 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 4 | import com.topdraw.business.basicdata.task.domain.Task; | 4 | import com.topdraw.business.module.task.domain.Task; |
| 5 | import com.topdraw.util.TimestampUtil; | ||
| 6 | import org.springframework.util.CollectionUtils; | ||
| 7 | 5 | ||
| 8 | import java.util.List; | 6 | import java.util.List; |
| 9 | import java.util.stream.Collectors; | ||
| 10 | 7 | ||
| 11 | @FunctionalInterface | 8 | @FunctionalInterface |
| 12 | public interface CompareTaskCondition { | 9 | public interface CompareTaskCondition { | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
| 4 | import com.topdraw.business.basicdata.coupon.history.service.CouponHistoryService; | 4 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
| 5 | import com.topdraw.business.basicdata.coupon.service.CouponService; | 5 | import com.topdraw.business.module.coupon.service.CouponService; |
| 6 | import com.topdraw.business.basicdata.member.domain.Member; | 6 | import com.topdraw.business.module.member.domain.Member; |
| 7 | import com.topdraw.business.process.service.CouponOperationService; | 7 | import com.topdraw.business.process.service.CouponOperationService; |
| 8 | import com.topdraw.business.process.service.MemberOperationService; | 8 | import com.topdraw.business.process.service.MemberOperationService; |
| 9 | import com.topdraw.business.process.domian.TempCoupon; | 9 | import com.topdraw.business.process.domian.TempCoupon; |
| ... | @@ -19,15 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired; | ... | @@ -19,15 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 19 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 20 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 21 | 21 | ||
| 22 | import javax.annotation.Resource; | ||
| 23 | import java.sql.Timestamp; | 22 | import java.sql.Timestamp; |
| 24 | import java.time.LocalDateTime; | 23 | import java.time.LocalDateTime; |
| 25 | import java.util.HashMap; | ||
| 26 | import java.util.List; | 24 | import java.util.List; |
| 27 | import java.util.Map; | ||
| 28 | import java.util.Objects; | 25 | import java.util.Objects; |
| 29 | import java.util.concurrent.ConcurrentHashMap; | ||
| 30 | import java.util.concurrent.locks.ReentrantLock; | ||
| 31 | 26 | ||
| 32 | 27 | ||
| 33 | @Service | 28 | @Service | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
| 4 | import com.topdraw.business.basicdata.exp.detail.service.ExpDetailService; | 4 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
| 5 | import com.topdraw.business.basicdata.member.domain.Member; | 5 | import com.topdraw.business.module.member.domain.Member; |
| 6 | import com.topdraw.business.basicdata.member.level.service.MemberLevelService; | 6 | import com.topdraw.business.module.member.level.service.MemberLevelService; |
| 7 | import com.topdraw.business.basicdata.member.level.service.dto.MemberLevelDTO; | 7 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
| 8 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 9 | import com.topdraw.business.process.service.ExpOperationService; | 9 | import com.topdraw.business.process.service.ExpOperationService; |
| 10 | import com.topdraw.business.process.service.MemberOperationService; | 10 | import com.topdraw.business.process.service.MemberOperationService; |
| 11 | import com.topdraw.business.process.domian.TempExp; | 11 | import com.topdraw.business.process.domian.TempExp; |
| ... | @@ -23,7 +23,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ... | @@ -23,7 +23,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 23 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 24 | import org.springframework.util.CollectionUtils; | 24 | import org.springframework.util.CollectionUtils; |
| 25 | 25 | ||
| 26 | import javax.annotation.Resource; | ||
| 27 | import java.util.List; | 26 | import java.util.List; |
| 28 | import java.util.Objects; | 27 | import java.util.Objects; |
| 29 | 28 | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.basicdata.member.service.MemberService; | 5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | ||
| 8 | import com.topdraw.business.module.member.service.MemberService; | ||
| 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 10 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 11 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | ||
| 12 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
| 13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
| 14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 15 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | ||
| 16 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 17 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 7 | import com.topdraw.business.process.service.MemberOperationService; | 18 | import com.topdraw.business.process.service.MemberOperationService; |
| 8 | import org.redisson.Redisson; | 19 | import com.topdraw.exception.EntityNotFoundException; |
| 9 | import org.redisson.api.RedissonClient; | 20 | import com.topdraw.util.LocalDateTimeUtil; |
| 21 | import com.topdraw.util.TimestampUtil; | ||
| 22 | import com.topdraw.utils.StringUtils; | ||
| 23 | import com.topdraw.utils.ValidationUtil; | ||
| 24 | import org.springframework.beans.BeanUtils; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 25 | import org.springframework.beans.factory.annotation.Autowired; |
| 26 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
| 11 | import org.springframework.stereotype.Service; | 27 | import org.springframework.stereotype.Service; |
| 12 | import org.springframework.util.Assert; | 28 | import org.springframework.util.Assert; |
| 13 | 29 | ||
| 30 | import java.nio.charset.StandardCharsets; | ||
| 31 | import java.time.LocalDateTime; | ||
| 32 | import java.time.ZoneOffset; | ||
| 33 | import java.util.Base64; | ||
| 14 | import java.util.Objects; | 34 | import java.util.Objects; |
| 35 | import java.util.Optional; | ||
| 36 | |||
| 37 | import static org.bouncycastle.asn1.x500.style.RFC4519Style.member; | ||
| 15 | 38 | ||
| 16 | @Service | 39 | @Service |
| 17 | public class MemberOperationServiceImpl implements MemberOperationService { | 40 | public class MemberOperationServiceImpl implements MemberOperationService { |
| 18 | 41 | ||
| 19 | @Autowired | 42 | @Autowired |
| 20 | MemberService memberService; | 43 | private MemberService memberService; |
| 44 | @Autowired | ||
| 45 | private MemberProfileService memberProfileService; | ||
| 46 | @Autowired | ||
| 47 | private MemberVipHistoryService memberVipHistoryService; | ||
| 48 | @Autowired | ||
| 49 | private UserWeixinService userWeixinService; | ||
| 50 | @Autowired | ||
| 51 | private ThreadPoolTaskExecutor threadPoolTaskExecutor; | ||
| 52 | |||
| 53 | @Override | ||
| 54 | public MemberDTO buyVip(BuyVipBean criteria) { | ||
| 55 | |||
| 56 | // 查询微信账户 | ||
| 57 | UserWeixinDTO userWeixin = this.findWeiXinById(criteria.getId()); | ||
| 58 | |||
| 59 | |||
| 60 | Long memberId = userWeixin.getMemberId(); | ||
| 61 | |||
| 62 | MemberDTO memberDTO = this.findById(memberId); | ||
| 63 | |||
| 64 | Integer vip = memberDTO.getVip(); | ||
| 65 | |||
| 66 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
| 67 | memberVipHistory.setMemberId(memberId).setVip(criteria.getVip()).setBeforeVip(vip); | ||
| 68 | if (ObjectUtil.equal(criteria.getVip(),vip)) { | ||
| 69 | memberVipHistory.setStatus(1); | ||
| 70 | } | ||
| 71 | |||
| 72 | |||
| 73 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); | ||
| 74 | LocalDateTime now = LocalDateTime.now(); | ||
| 75 | //判断之前有没有买过,没买过,失效时间为一年后; | ||
| 76 | if (ObjectUtil.isNull(vipExpireTime)) { | ||
| 77 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 78 | memberDTO.setVipExpireTime(localDateTime); | ||
| 79 | } else { | ||
| 80 | //购买过 判断当前时间有没有过vip过期时间,没有过,失效时间加一年; 过了,当前时间加一年 | ||
| 81 | //区分是当前vip续费 还是买新的vip | ||
| 82 | if (ObjectUtil.equal(criteria.getVip(), memberDTO.getVip())) { | ||
| 83 | if (now.isBefore(vipExpireTime)) { | ||
| 84 | LocalDateTime localDateTime = vipExpireTime.plusYears(1L); | ||
| 85 | memberDTO.setVipExpireTime(localDateTime); | ||
| 86 | } else { | ||
| 87 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 88 | memberDTO.setVipExpireTime(localDateTime); | ||
| 89 | } | ||
| 90 | } else { | ||
| 91 | LocalDateTime localDateTime = now.plusYears(1L); | ||
| 92 | memberDTO.setVipExpireTime(localDateTime); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | memberDTO.setVip(criteria.getVip()); | ||
| 96 | |||
| 97 | Member member = new Member(); | ||
| 98 | BeanUtils.copyProperties(memberDTO,member); | ||
| 99 | Long memberId0 = this.memberService.create(member); | ||
| 100 | |||
| 101 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); | ||
| 102 | memberVipHistoryService.create(memberVipHistory); | ||
| 103 | |||
| 104 | memberService.update(member); | ||
| 105 | return memberDTO; | ||
| 106 | } | ||
| 107 | |||
| 108 | private UserWeixinDTO findWeiXinById(Long id) { | ||
| 109 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); | ||
| 110 | if (Objects.isNull(userWeixinDTO)) { | ||
| 111 | throw new EntityNotFoundException(UserWeixin.class, "id", userWeixinDTO.getId().toString()); | ||
| 112 | } | ||
| 113 | |||
| 114 | return userWeixinDTO; | ||
| 115 | } | ||
| 21 | 116 | ||
| 22 | @Override | 117 | @Override |
| 23 | public void doUpdateMemberInfo(Member member) { | 118 | public void doUpdateMemberInfo(Member member) { |
| ... | @@ -50,4 +145,139 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -50,4 +145,139 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 50 | public void doUpdateMemberCoupon(Member member) { | 145 | public void doUpdateMemberCoupon(Member member) { |
| 51 | this.doUpdateMemberInfo(member); | 146 | this.doUpdateMemberInfo(member); |
| 52 | } | 147 | } |
| 148 | |||
| 149 | @Override | ||
| 150 | public MemberProfileDTO getMemberProfileAndCheckVip(Long memberId, String appid) { | ||
| 151 | |||
| 152 | // 会员加密信息 | ||
| 153 | MemberProfileDTO memberProfileDTO_0 = this.findMemberProfileByMemberId(memberId); | ||
| 154 | |||
| 155 | // 会员信息 | ||
| 156 | MemberDTO memberDTO = this.findById(memberId); | ||
| 157 | |||
| 158 | // 初始化会员加密信息 | ||
| 159 | MemberProfileDTO memberProfileDTO_1 = this.configMemberProfile(memberProfileDTO_0,memberDTO,appid); | ||
| 160 | |||
| 161 | return memberProfileDTO_1; | ||
| 162 | } | ||
| 163 | |||
| 164 | /** | ||
| 165 | * 配置会员信息 | ||
| 166 | * @param memberProfileDTO_0 | ||
| 167 | * @param memberDTO | ||
| 168 | * @return | ||
| 169 | */ | ||
| 170 | private MemberProfileDTO configMemberProfile(MemberProfileDTO memberProfileDTO_0, MemberDTO memberDTO, String appid) { | ||
| 171 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); | ||
| 172 | BeanUtils.copyProperties(memberProfileDTO_0,memberProfileDTO); | ||
| 173 | |||
| 174 | // 真实姓名 | ||
| 175 | String realname = memberProfileDTO.getRealname(); | ||
| 176 | if (StringUtils.isNotBlank(realname)) { | ||
| 177 | realname = new String(Base64.getDecoder().decode(realname.getBytes(StandardCharsets.UTF_8))); | ||
| 178 | } | ||
| 179 | |||
| 180 | // 昵称 | ||
| 181 | String nickname = memberDTO.getNickname(); | ||
| 182 | if (StringUtils.isNotBlank(nickname)) { | ||
| 183 | nickname = new String(Base64.getDecoder().decode(nickname.getBytes(StandardCharsets.UTF_8))); | ||
| 184 | } | ||
| 185 | |||
| 186 | // vip | ||
| 187 | Integer vip = memberDTO.getVip(); | ||
| 188 | // 过期时间 | ||
| 189 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); | ||
| 190 | |||
| 191 | Long timeLong = 0L; | ||
| 192 | if (ObjectUtil.isNotNull(vipExpireTime)) { | ||
| 193 | |||
| 194 | // 检查vip | ||
| 195 | MemberDTO memberDTO1 = this.checkVipStatus(memberDTO,vipExpireTime,appid); | ||
| 196 | |||
| 197 | // 更新会员信息 | ||
| 198 | this.threadPoolTaskExecutor.execute(()->{ | ||
| 199 | Member member = new Member(); | ||
| 200 | BeanUtils.copyProperties(memberDTO1,member); | ||
| 201 | this.memberService.update(member); | ||
| 202 | }); | ||
| 203 | |||
| 204 | vip = memberDTO1.getVip(); | ||
| 205 | LocalDateTime vipExpireTime1 = memberDTO1.getVipExpireTime(); | ||
| 206 | if (Objects.nonNull(vipExpireTime1)) { | ||
| 207 | timeLong = vipExpireTime1.toInstant(ZoneOffset.of("+8")).toEpochMilli(); | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | // 过期时间 | ||
| 212 | memberProfileDTO.setVipExpireTime(timeLong); | ||
| 213 | // 真实姓名 | ||
| 214 | memberProfileDTO.setRealname(realname); | ||
| 215 | // 头像 | ||
| 216 | memberProfileDTO.setAvatarUrl(memberDTO.getAvatarUrl()); | ||
| 217 | // 生日 | ||
| 218 | memberProfileDTO.setBirthdayStr(memberDTO.getBirthday()); | ||
| 219 | // 性别 | ||
| 220 | memberProfileDTO.setGender(memberDTO.getGender()); | ||
| 221 | // 昵称 | ||
| 222 | memberProfileDTO.setNickname(nickname); | ||
| 223 | // 会员id | ||
| 224 | memberProfileDTO.setMemberId(memberDTO.getId()); | ||
| 225 | // vip | ||
| 226 | memberProfileDTO.setVip(vip); | ||
| 227 | |||
| 228 | return memberProfileDTO; | ||
| 229 | } | ||
| 230 | |||
| 231 | /** | ||
| 232 | * 检查vip是否过期 | ||
| 233 | * 1.当前vip如果过期则查看是否有vip历史变动 | ||
| 234 | * 2.如果vip变动历史有记录则获取vip变动记录 | ||
| 235 | * 3.如果vip没有记录则查看是否关注了公众号 | ||
| 236 | * @param vipExpireTime | ||
| 237 | * @return | ||
| 238 | */ | ||
| 239 | private MemberDTO checkVipStatus(MemberDTO memberDTO,LocalDateTime vipExpireTime, String appid) { | ||
| 240 | |||
| 241 | Long memberId = memberDTO.getId(); | ||
| 242 | LocalDateTime nowTime = LocalDateTime.now(); | ||
| 243 | |||
| 244 | //vip过期,回退上个vip状态 同时修改member表vip | ||
| 245 | if (nowTime.compareTo(vipExpireTime) >= 0 ) { | ||
| 246 | |||
| 247 | Integer vip = 0; | ||
| 248 | LocalDateTime vipExpireTime1 = memberDTO.getVipExpireTime(); | ||
| 249 | |||
| 250 | //查询小于失效时间的那条记录 查不到 取微信表里 关注状态 | ||
| 251 | MemberVipHistory memberVipHistory = this.memberVipHistoryService.findByTime(memberId, nowTime); | ||
| 252 | |||
| 253 | if (ObjectUtil.isNull(memberVipHistory.getId())) { | ||
| 254 | |||
| 255 | UserWeixinDTO userWeixin = this.userWeixinService.findFirstByMemberIdAndAppid(memberId, appid); | ||
| 256 | // 微信公众号关注的状态 0:未关注 1:关注 | ||
| 257 | Integer status = userWeixin.getStatus(); | ||
| 258 | |||
| 259 | if (status != 1) vip = 0; else vip = 1; | ||
| 260 | vipExpireTime1 = null; | ||
| 261 | |||
| 262 | } else { | ||
| 263 | |||
| 264 | vip = memberVipHistory.getVip(); | ||
| 265 | vipExpireTime1 = memberVipHistory.getVipExpireTime(); | ||
| 266 | } | ||
| 267 | |||
| 268 | memberDTO.setVipExpireTime(vipExpireTime1); | ||
| 269 | memberDTO.setVip(vip); | ||
| 270 | } | ||
| 271 | |||
| 272 | return memberDTO; | ||
| 273 | } | ||
| 274 | |||
| 275 | /** | ||
| 276 | * 查询会员加密信息 | ||
| 277 | * @param memberId | ||
| 278 | * @return | ||
| 279 | */ | ||
| 280 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { | ||
| 281 | return this.memberProfileService.findByMemberId(memberId); | ||
| 282 | } | ||
| 53 | } | 283 | } | ... | ... |
| ... | @@ -2,18 +2,16 @@ package com.topdraw.business.process.service.impl; | ... | @@ -2,18 +2,16 @@ package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.topdraw.aspect.AsyncMqSend; | 4 | import com.topdraw.aspect.AsyncMqSend; |
| 5 | import com.topdraw.business.basicdata.member.domain.Member; | 5 | import com.topdraw.business.module.member.domain.Member; |
| 6 | import com.topdraw.business.basicdata.member.service.MemberService; | 6 | import com.topdraw.business.module.member.service.MemberService; |
| 7 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 7 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 8 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 8 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 9 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | 9 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 10 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 10 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 11 | import com.topdraw.business.basicdata.points.detail.detailhistory.service.PointsDetailHistoryService; | 11 | import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; |
| 12 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 12 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 13 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | 13 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 14 | import com.topdraw.business.basicdata.points.service.PointsService; | 14 | import com.topdraw.business.module.points.service.PointsService; |
| 15 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | ||
| 16 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | ||
| 17 | import com.topdraw.business.process.domian.result.CustomPointsResult; | 15 | import com.topdraw.business.process.domian.result.CustomPointsResult; |
| 18 | import com.topdraw.business.process.service.MemberOperationService; | 16 | import com.topdraw.business.process.service.MemberOperationService; |
| 19 | import com.topdraw.business.process.service.PointsOperationService; | 17 | import com.topdraw.business.process.service.PointsOperationService; |
| ... | @@ -22,7 +20,6 @@ import com.topdraw.util.IdWorker; | ... | @@ -22,7 +20,6 @@ import com.topdraw.util.IdWorker; |
| 22 | import com.topdraw.util.RedissonUtil; | 20 | import com.topdraw.util.RedissonUtil; |
| 23 | import com.topdraw.util.TimestampUtil; | 21 | import com.topdraw.util.TimestampUtil; |
| 24 | import com.topdraw.utils.StringUtils; | 22 | import com.topdraw.utils.StringUtils; |
| 25 | import lombok.Data; | ||
| 26 | import lombok.extern.slf4j.Slf4j; | 23 | import lombok.extern.slf4j.Slf4j; |
| 27 | import org.redisson.api.RLock; | 24 | import org.redisson.api.RLock; |
| 28 | import org.redisson.api.RedissonClient; | 25 | import org.redisson.api.RedissonClient; |
| ... | @@ -30,20 +27,15 @@ import org.slf4j.Logger; | ... | @@ -30,20 +27,15 @@ import org.slf4j.Logger; |
| 30 | import org.slf4j.LoggerFactory; | 27 | import org.slf4j.LoggerFactory; |
| 31 | import org.springframework.beans.BeanUtils; | 28 | import org.springframework.beans.BeanUtils; |
| 32 | import org.springframework.beans.factory.annotation.Autowired; | 29 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | import org.springframework.data.redis.core.StringRedisTemplate; | ||
| 34 | import org.springframework.data.redis.core.ValueOperations; | ||
| 35 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 30 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 36 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
| 37 | import org.springframework.transaction.annotation.Propagation; | 32 | import org.springframework.transaction.annotation.Propagation; |
| 38 | import org.springframework.transaction.annotation.Transactional; | 33 | import org.springframework.transaction.annotation.Transactional; |
| 39 | import org.springframework.util.CollectionUtils; | 34 | import org.springframework.util.CollectionUtils; |
| 40 | 35 | ||
| 41 | import javax.annotation.Resource; | ||
| 42 | import java.sql.Timestamp; | 36 | import java.sql.Timestamp; |
| 43 | import java.time.LocalDate; | ||
| 44 | import java.time.LocalDateTime; | 37 | import java.time.LocalDateTime; |
| 45 | import java.util.*; | 38 | import java.util.*; |
| 46 | import java.util.concurrent.TimeUnit; | ||
| 47 | import java.util.stream.Collectors; | 39 | import java.util.stream.Collectors; |
| 48 | 40 | ||
| 49 | /** | 41 | /** | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.coupon.service.CouponService; | 3 | import com.topdraw.business.module.coupon.service.CouponService; |
| 4 | import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO; | 4 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
| 5 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 5 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 6 | import com.topdraw.business.basicdata.rights.history.service.RightsHistoryService; | 6 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; |
| 7 | import com.topdraw.business.basicdata.rights.service.RightsService; | 7 | import com.topdraw.business.module.rights.service.RightsService; |
| 8 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | 8 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
| 9 | import com.topdraw.business.process.service.CouponOperationService; | 9 | import com.topdraw.business.process.service.CouponOperationService; |
| 10 | import com.topdraw.business.process.service.ExpOperationService; | 10 | import com.topdraw.business.process.service.ExpOperationService; |
| 11 | import com.topdraw.business.process.service.PointsOperationService; | 11 | import com.topdraw.business.process.service.PointsOperationService; |
| ... | @@ -16,7 +16,6 @@ import lombok.extern.slf4j.Slf4j; | ... | @@ -16,7 +16,6 @@ import lombok.extern.slf4j.Slf4j; |
| 16 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
| 20 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 21 | import org.springframework.util.CollectionUtils; | 20 | import org.springframework.util.CollectionUtils; |
| 22 | import org.springframework.util.StringUtils; | 21 | import org.springframework.util.StringUtils; | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.topdraw.business.basicdata.coupon.service.CouponService; | 4 | import com.topdraw.business.module.coupon.service.CouponService; |
| 5 | import com.topdraw.business.basicdata.coupon.service.dto.CouponDTO; | 5 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
| 6 | import com.topdraw.business.basicdata.member.group.service.MemberGroupService; | 6 | import com.topdraw.business.module.member.group.service.MemberGroupService; |
| 7 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupDTO; | 7 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; |
| 8 | import com.topdraw.business.basicdata.member.group.service.dto.MemberGroupQueryCriteria; | 8 | import com.topdraw.business.module.member.group.service.dto.MemberGroupQueryCriteria; |
| 9 | import com.topdraw.business.basicdata.rights.permanentrights.service.PermanentRightsService; | 9 | import com.topdraw.business.module.rights.permanentrights.service.PermanentRightsService; |
| 10 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsDTO; | 10 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsDTO; |
| 11 | import com.topdraw.business.basicdata.rights.service.RightsService; | 11 | import com.topdraw.business.module.rights.service.RightsService; |
| 12 | import com.topdraw.business.basicdata.rights.service.dto.RightsDTO; | 12 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
| 13 | import com.topdraw.business.basicdata.task.progress.domain.TrTaskProgress; | 13 | import com.topdraw.business.module.task.attribute.service.TaskAttrService; |
| 14 | import com.topdraw.business.basicdata.task.progress.service.TrTaskProgressService; | 14 | import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; |
| 15 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressDTO; | 15 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
| 16 | import com.topdraw.business.basicdata.task.progress.service.dto.TrTaskProgressQueryCriteria; | 16 | import com.topdraw.business.module.task.progress.service.TrTaskProgressService; |
| 17 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | 17 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
| 18 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | 18 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressQueryCriteria; |
| 19 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | 19 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 20 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
| 21 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
| 22 | import com.topdraw.business.process.domian.result.TaskTemplateType; | ||
| 20 | import com.topdraw.business.process.service.PointsOperationService; | 23 | import com.topdraw.business.process.service.PointsOperationService; |
| 21 | import com.topdraw.business.process.service.RightsOperationService; | 24 | import com.topdraw.business.process.service.RightsOperationService; |
| 22 | import com.topdraw.business.process.service.TaskOperationService; | 25 | import com.topdraw.business.process.service.TaskOperationService; |
| 23 | import com.topdraw.business.basicdata.member.service.MemberService; | 26 | import com.topdraw.business.module.member.service.MemberService; |
| 24 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 27 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 25 | import com.topdraw.business.basicdata.task.domain.Task; | 28 | import com.topdraw.business.module.task.domain.Task; |
| 26 | import com.topdraw.business.basicdata.task.service.TaskService; | 29 | import com.topdraw.business.module.task.service.TaskService; |
| 27 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 30 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 28 | import com.topdraw.business.basicdata.task.template.service.TaskTemplateService; | 31 | import com.topdraw.business.module.task.template.service.TaskTemplateService; |
| 29 | import com.topdraw.business.process.domian.*; | 32 | import com.topdraw.business.process.domian.*; |
| 30 | import com.topdraw.business.process.service.UserTvOperationService; | 33 | import com.topdraw.business.process.service.UserOperationService; |
| 31 | import com.topdraw.common.ResultInfo; | 34 | import com.topdraw.common.ResultInfo; |
| 32 | import com.topdraw.module.mq.DataSyncMsg; | 35 | import com.topdraw.module.mq.DataSyncMsg; |
| 33 | import com.topdraw.util.*; | 36 | import com.topdraw.util.*; |
| ... | @@ -76,6 +79,8 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -76,6 +79,8 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 76 | CouponService couponService; | 79 | CouponService couponService; |
| 77 | @Autowired | 80 | @Autowired |
| 78 | MemberGroupService memberGroupService; | 81 | MemberGroupService memberGroupService; |
| 82 | @Autowired | ||
| 83 | TaskAttrService taskAttrService; | ||
| 79 | 84 | ||
| 80 | 85 | ||
| 81 | private static final Integer TASK_FINISH_STATUS = 1; | 86 | private static final Integer TASK_FINISH_STATUS = 1; |
| ... | @@ -91,8 +96,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -91,8 +96,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 91 | Integer event = msgData.getEvent(); | 96 | Integer event = msgData.getEvent(); |
| 92 | Long memberId = msgData.getMemberId(); | 97 | Long memberId = msgData.getMemberId(); |
| 93 | 98 | ||
| 94 | long l = System.currentTimeMillis(); | ||
| 95 | |||
| 96 | // 检查当前会员的黑名单状态 | 99 | // 检查当前会员的黑名单状态 |
| 97 | boolean b = this.validatedMemberBlackStatus(memberId); | 100 | boolean b = this.validatedMemberBlackStatus(memberId); |
| 98 | if (!b) { | 101 | if (!b) { |
| ... | @@ -100,9 +103,9 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -100,9 +103,9 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 100 | } | 103 | } |
| 101 | 104 | ||
| 102 | // 1.通过任务标识获取任务模板,通过模板参数获取具体的模板 | 105 | // 1.通过任务标识获取任务模板,通过模板参数获取具体的模板 |
| 103 | TaskTemplate taskTemplate = this.getTaskTemplate(event); | 106 | TaskTemplate taskTemplate = this.getTaskTemplate(event,dataSyncMsg); |
| 104 | // 2.通过任务模板获取对应的任务列表 | 107 | // 2.通过任务模板获取对应的任务列表 |
| 105 | List<Task> taskList = this.loadListTaskByTaskTemplate(taskTemplate); | 108 | List<Task> taskList = this.loadListTaskByTaskTemplate(taskTemplate,dataSyncMsg); |
| 106 | // 4.判断当前用户是否满足任务完成条件 | 109 | // 4.判断当前用户是否满足任务完成条件 |
| 107 | boolean checkResult = this.checkTaskCompletion(memberId,taskList); | 110 | boolean checkResult = this.checkTaskCompletion(memberId,taskList); |
| 108 | if (checkResult) { | 111 | if (checkResult) { |
| ... | @@ -114,11 +117,8 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -114,11 +117,8 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 114 | 117 | ||
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | long r = System.currentTimeMillis(); | ||
| 118 | log.info("总耗时======>>>>>" + (r-l)); | ||
| 119 | return ResultInfo.success(); | 120 | return ResultInfo.success(); |
| 120 | 121 | ||
| 121 | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | /** | 124 | /** |
| ... | @@ -763,17 +763,77 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -763,17 +763,77 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 763 | * @param taskTemplate 任务模板 | 763 | * @param taskTemplate 任务模板 |
| 764 | * @return List<task> 任务列表 | 764 | * @return List<task> 任务列表 |
| 765 | */ | 765 | */ |
| 766 | private List<Task> loadListTaskByTaskTemplate(TaskTemplate taskTemplate,Map<String,Object> paramMap) { | 766 | private List<Task> loadListTaskByTaskTemplate(TaskTemplate taskTemplate,DataSyncMsg dataSyncMsg) { |
| 767 | 767 | ||
| 768 | if (Objects.nonNull(taskTemplate)) { | 768 | if (Objects.nonNull(taskTemplate)) { |
| 769 | |||
| 769 | Long taskTemplateId = taskTemplate.getId(); | 770 | Long taskTemplateId = taskTemplate.getId(); |
| 770 | return this.taskService.findByTemplateId(taskTemplateId); | 771 | |
| 772 | List<Task> taskList = this.taskService.findByTemplateId(taskTemplateId); | ||
| 773 | |||
| 774 | Integer type = taskTemplate.getType(); | ||
| 775 | switch (type) { | ||
| 776 | // 订购 | ||
| 777 | case TaskTemplateType.TYPE_4: | ||
| 778 | taskList = this.pickUpTask(taskList,dataSyncMsg); | ||
| 779 | break; | ||
| 780 | |||
| 781 | default: | ||
| 782 | break; | ||
| 783 | } | ||
| 784 | |||
| 785 | return taskList; | ||
| 786 | |||
| 771 | } | 787 | } |
| 772 | 788 | ||
| 773 | return null; | 789 | return null; |
| 774 | } | 790 | } |
| 775 | 791 | ||
| 776 | /** | 792 | /** |
| 793 | * 通过参数确定具体任务 | ||
| 794 | * @param taskList | ||
| 795 | * @param dataSyncMsg | ||
| 796 | * @return | ||
| 797 | */ | ||
| 798 | private List<Task> pickUpTask(List<Task> taskList,DataSyncMsg dataSyncMsg) { | ||
| 799 | |||
| 800 | List<Task> taskList1 = new ArrayList<>(); | ||
| 801 | |||
| 802 | DataSyncMsg.TaskTemplateParam param = dataSyncMsg.getParam(); | ||
| 803 | |||
| 804 | if (Objects.nonNull(param)) { | ||
| 805 | |||
| 806 | String code = param.getCode(); | ||
| 807 | for (Task task : taskList) { | ||
| 808 | Long taskId = task.getId(); | ||
| 809 | TaskAttrDTO taskAttrDTO = this.findTaskAttrByTaskId(taskId); | ||
| 810 | String attrStr = taskAttrDTO.getAttrStr(); | ||
| 811 | if (StringUtils.hasText(attrStr)) { | ||
| 812 | DataSyncMsg.TaskTemplateParam taskTemplateParam = JSONObject.parseObject(attrStr, DataSyncMsg.TaskTemplateParam.class); | ||
| 813 | if (Objects.nonNull(taskTemplateParam)) { | ||
| 814 | String code1 = taskTemplateParam.getCode(); | ||
| 815 | if (StringUtils.hasText(code1) && code.equalsIgnoreCase(code1)) { | ||
| 816 | taskList1.add(task); | ||
| 817 | } | ||
| 818 | } | ||
| 819 | |||
| 820 | } | ||
| 821 | } | ||
| 822 | |||
| 823 | } else { | ||
| 824 | return taskList; | ||
| 825 | } | ||
| 826 | |||
| 827 | return taskList1; | ||
| 828 | |||
| 829 | } | ||
| 830 | |||
| 831 | private TaskAttrDTO findTaskAttrByTaskId(Long taskId) { | ||
| 832 | return this.taskAttrService.findByTaskId(taskId); | ||
| 833 | } | ||
| 834 | |||
| 835 | |||
| 836 | /** | ||
| 777 | * 获取任务模板对应的任务列表 | 837 | * 获取任务模板对应的任务列表 |
| 778 | * | 838 | * |
| 779 | * @param taskTemplate 任务模板 | 839 | * @param taskTemplate 任务模板 |
| ... | @@ -794,12 +854,54 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -794,12 +854,54 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 794 | * @param event 任务 | 854 | * @param event 任务 |
| 795 | * @return TaskTemplate 任务模板 | 855 | * @return TaskTemplate 任务模板 |
| 796 | */ | 856 | */ |
| 797 | private TaskTemplate getTaskTemplate(Integer event) { | 857 | private TaskTemplate getTaskTemplate(Integer event,DataSyncMsg msgData) { |
| 798 | return this.taskTemplateService.findByType(event); | 858 | DataSyncMsg.TaskTemplateParam taskTemplateParam = msgData.getParam(); |
| 859 | |||
| 860 | if (Objects.nonNull(taskTemplateParam)) { | ||
| 861 | |||
| 862 | return this.findByTypeAndParam(event,taskTemplateParam); | ||
| 863 | |||
| 864 | } else { | ||
| 865 | |||
| 866 | List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); | ||
| 867 | |||
| 868 | if (!CollectionUtils.isEmpty(taskTemplateList)) { | ||
| 869 | |||
| 870 | return taskTemplateList.get(0); | ||
| 871 | |||
| 872 | } else { | ||
| 873 | |||
| 874 | return null; | ||
| 875 | |||
| 876 | } | ||
| 877 | |||
| 878 | } | ||
| 799 | } | 879 | } |
| 800 | 880 | ||
| 881 | private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.TaskTemplateParam taskTemplateParam) { | ||
| 882 | String category = taskTemplateParam.getCategory(); | ||
| 883 | |||
| 884 | List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); | ||
| 885 | if (!CollectionUtils.isEmpty(taskTemplateList)) { | ||
| 886 | |||
| 887 | for (TaskTemplate taskTemplate : taskTemplateList) { | ||
| 888 | |||
| 889 | String params = taskTemplate.getParams(); | ||
| 890 | if(!StringUtils.isEmpty(params)) { | ||
| 891 | |||
| 892 | DataSyncMsg.TaskTemplateParam taskTemplateParam1 = JSONObject.parseObject(params,DataSyncMsg.TaskTemplateParam.class); | ||
| 893 | String category1 = taskTemplateParam1.getCategory(); | ||
| 894 | if (!StringUtils.isEmpty(category1) && category1.equalsIgnoreCase(category)) | ||
| 895 | return taskTemplate; | ||
| 801 | 896 | ||
| 897 | } | ||
| 898 | |||
| 899 | } | ||
| 900 | |||
| 901 | } | ||
| 802 | 902 | ||
| 903 | return null; | ||
| 904 | } | ||
| 803 | 905 | ||
| 804 | 906 | ||
| 805 | //////////////////////////////////////////////////////////////////////////////////////////////////////////// | 907 | //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | @@ -811,7 +913,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -811,7 +913,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 811 | @Autowired | 913 | @Autowired |
| 812 | private PointsOperationService pointsOperationService; | 914 | private PointsOperationService pointsOperationService; |
| 813 | @Autowired | 915 | @Autowired |
| 814 | private UserTvOperationService userTvOperationService; | 916 | private UserOperationService userTvOperationService; |
| 815 | 917 | ||
| 816 | private UserTv checkUserTv(String platformAccount){ | 918 | private UserTv checkUserTv(String platformAccount){ |
| 817 | UserTv userTv = new UserTv(); | 919 | UserTv userTv = new UserTv(); |
| ... | @@ -825,6 +927,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -825,6 +927,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 825 | } | 927 | } |
| 826 | 928 | ||
| 827 | @Override | 929 | @Override |
| 930 | @Deprecated | ||
| 828 | public boolean createPoint2ChongQing(String platformAccount, Long points) { | 931 | public boolean createPoint2ChongQing(String platformAccount, Long points) { |
| 829 | 932 | ||
| 830 | boolean result = this.verificationActivity(platformAccount); | 933 | boolean result = this.verificationActivity(platformAccount); |
| ... | @@ -847,7 +950,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -847,7 +950,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 847 | tempPoints.setMemberId(memberId); | 950 | tempPoints.setMemberId(memberId); |
| 848 | tempPoints.setMemberCode(code); | 951 | tempPoints.setMemberCode(code); |
| 849 | tempPoints.setPoints(points); | 952 | tempPoints.setPoints(points); |
| 850 | tempPoints.setDescription("重庆重数大屏积分兑换活动,时间:202112"); | 953 | // tempPoints.setDescription("重庆重数大屏积分兑换活动,时间:202112"); |
| 851 | tempPoints.setDeviceType(1); | 954 | tempPoints.setDeviceType(1); |
| 852 | tempPoints.setEvtType(3); | 955 | tempPoints.setEvtType(3); |
| 853 | tempPoints.setPointsType(0); | 956 | tempPoints.setPointsType(0); | ... | ... |
| 1 | package com.topdraw.business.process.service.impl; | ||
| 2 | |||
| 3 | import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.hutool.core.util.ObjectUtil; | ||
| 5 | import cn.hutool.core.util.StrUtil; | ||
| 6 | import cn.hutool.http.HttpUtil; | ||
| 7 | import com.alibaba.druid.util.HttpClientUtils; | ||
| 8 | import com.alibaba.fastjson.JSONObject; | ||
| 9 | import com.topdraw.business.module.member.domain.Member; | ||
| 10 | import com.topdraw.business.module.member.domain.MemberBuilder; | ||
| 11 | import com.topdraw.business.module.member.domain.MemberConstant; | ||
| 12 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
| 13 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | ||
| 14 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | ||
| 15 | import com.topdraw.business.module.member.service.MemberService; | ||
| 16 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
| 17 | import com.topdraw.business.module.member.service.dto.MemberQueryCriteria; | ||
| 18 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | ||
| 19 | import com.topdraw.business.module.user.iptv.domain.UserConstant; | ||
| 20 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
| 21 | import com.topdraw.business.module.user.iptv.service.UserTvService; | ||
| 22 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | ||
| 23 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
| 24 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | ||
| 25 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | ||
| 26 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | ||
| 27 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | ||
| 28 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | ||
| 29 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 30 | import com.topdraw.business.process.service.UserOperationService; | ||
| 31 | import com.topdraw.config.LocalConstants; | ||
| 32 | import com.topdraw.config.RedisKeyUtil; | ||
| 33 | import com.topdraw.exception.BadRequestException; | ||
| 34 | import com.topdraw.exception.EntityNotFoundException; | ||
| 35 | import com.topdraw.security.AESUtil; | ||
| 36 | import com.topdraw.util.IdWorker; | ||
| 37 | import com.topdraw.util.TimestampUtil; | ||
| 38 | import com.topdraw.utils.RedisUtils; | ||
| 39 | import com.topdraw.utils.StringUtils; | ||
| 40 | import com.topdraw.weixin.beans.DefaultWeiXinBeanDefinition; | ||
| 41 | import com.topdraw.weixin.beans.WeiXinBeanDefinition; | ||
| 42 | import com.topdraw.weixin.beans.config.WeiXinAppListConfig; | ||
| 43 | import com.topdraw.weixin.util.WeChatConstants; | ||
| 44 | import com.topdraw.weixin.util.WeiXinRequestUtil; | ||
| 45 | import lombok.extern.slf4j.Slf4j; | ||
| 46 | import org.redisson.api.RedissonClient; | ||
| 47 | import org.springframework.beans.BeanUtils; | ||
| 48 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 49 | import org.springframework.beans.factory.annotation.Value; | ||
| 50 | import org.springframework.http.HttpMethod; | ||
| 51 | import org.springframework.http.ResponseEntity; | ||
| 52 | import org.springframework.stereotype.Service; | ||
| 53 | import org.springframework.transaction.annotation.Propagation; | ||
| 54 | import org.springframework.transaction.annotation.Transactional; | ||
| 55 | import org.springframework.util.Assert; | ||
| 56 | import org.springframework.web.client.RestTemplate; | ||
| 57 | |||
| 58 | import javax.annotation.Resource; | ||
| 59 | import java.io.IOException; | ||
| 60 | import java.time.LocalDateTime; | ||
| 61 | import java.util.List; | ||
| 62 | import java.util.Map; | ||
| 63 | import java.util.Objects; | ||
| 64 | import java.util.Optional; | ||
| 65 | |||
| 66 | @Service | ||
| 67 | @Slf4j | ||
| 68 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 69 | public class UserOperationServiceImpl implements UserOperationService { | ||
| 70 | |||
| 71 | @Autowired | ||
| 72 | private RedissonClient redissonClient; | ||
| 73 | @Autowired | ||
| 74 | private MemberService memberService; | ||
| 75 | @Autowired | ||
| 76 | private UserTvService userTvService; | ||
| 77 | @Autowired | ||
| 78 | private UserWeixinService userWeixinService; | ||
| 79 | @Autowired | ||
| 80 | private RedisUtils redisUtils; | ||
| 81 | @Autowired | ||
| 82 | private WeiXinRequestUtil weixinRequestUtil; | ||
| 83 | @Autowired | ||
| 84 | private WeiXinAppListConfig weiXinAppListConfig; | ||
| 85 | @Autowired | ||
| 86 | private MemberProfileService memberProfileService; | ||
| 87 | |||
| 88 | /** 取消关注 */ | ||
| 89 | private static final Integer UNSUBSCRIBE_STATUS = 0; | ||
| 90 | private static final Integer SUBSCRIBE_STATUS = 1; | ||
| 91 | private static final String SUBSCRIBE = "subscribe"; | ||
| 92 | private static final String UNSUBSCRIBE = "unsubscribe"; | ||
| 93 | private static final Integer[] PLATFORM_LIST = new Integer[]{0,1,2,3}; | ||
| 94 | |||
| 95 | @Value("${uc.service.platform:}") | ||
| 96 | private String platform; | ||
| 97 | |||
| 98 | @Value("${key:}") | ||
| 99 | private String key; | ||
| 100 | |||
| 101 | @Value("${uc.app.subAppId:wx05f35931270014be}") | ||
| 102 | private String subAppId; | ||
| 103 | |||
| 104 | @Value("${uc.app.h5AppId:wxca962918dfeed88c}") | ||
| 105 | private String h5AppId; | ||
| 106 | |||
| 107 | @Value("${uc.app.appletAppid:wxc57d42de3d351cec}") | ||
| 108 | private String appletAppid; | ||
| 109 | |||
| 110 | @Value("${file.upload:upload}") | ||
| 111 | private String filePath; | ||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | /** | ||
| 116 | * 微信公众号关注 | ||
| 117 | * @description 大小屏绑定,大屏账户保存小屏会员编码 | ||
| 118 | * @param resources | ||
| 119 | * @return | ||
| 120 | */ | ||
| 121 | @Override | ||
| 122 | public boolean subscribe(SubscribeBean resources) { | ||
| 123 | String unionId = resources.getUnionId(); | ||
| 124 | String appId = resources.getAppId(); | ||
| 125 | String openId = resources.getOpenId(); | ||
| 126 | |||
| 127 | DefaultWeiXinBeanDefinition weiXinBeanDefinition = this.parseAppletInfo(resources); | ||
| 128 | |||
| 129 | if (Objects.nonNull(weiXinBeanDefinition.getOpenId())) { | ||
| 130 | throw new RuntimeException("微信信息解析失败!"); | ||
| 131 | } | ||
| 132 | |||
| 133 | UserWeixinDTO userWeixinDTO = this.findUserWeiXinByOpenIdAndAppId(appId, openId); | ||
| 134 | |||
| 135 | if (Objects.isNull(userWeixinDTO.getId())) { | ||
| 136 | |||
| 137 | // 创建会员和账户 | ||
| 138 | this.doCreateUserWeiXinAndMember(weiXinBeanDefinition,userWeixinDTO); | ||
| 139 | |||
| 140 | } else { | ||
| 141 | |||
| 142 | // 修改会员和会员信息 | ||
| 143 | this.doUpdateUserWeiXinAndMember(userWeixinDTO,appId,openId); | ||
| 144 | |||
| 145 | } | ||
| 146 | |||
| 147 | // 小屏会员 | ||
| 148 | MemberDTO memberDTO_0 = this.findMemberByAppIdAndOpenId(appId,openId); | ||
| 149 | |||
| 150 | // 从redis中获取大屏信息 | ||
| 151 | UserTvDTO userTvDTO = this.findUserTvFromRedis(unionId); | ||
| 152 | |||
| 153 | // 携带了大屏信息 | ||
| 154 | if (Objects.nonNull(userTvDTO) && StringUtils.isNotEmpty(memberDTO_0.getCode())) { | ||
| 155 | // 绑定主账号会员 | ||
| 156 | this.bondPriorityMember(userTvDTO,memberDTO_0); | ||
| 157 | |||
| 158 | // 小屏会员绑定大屏账户id | ||
| 159 | MemberDTO memberDTO_1 = this.bindIptvId(memberDTO_0,userTvDTO); | ||
| 160 | |||
| 161 | // 修改会员 | ||
| 162 | this.doUpdateMemberByMemberDTO(memberDTO_1); | ||
| 163 | } | ||
| 164 | |||
| 165 | return true; | ||
| 166 | |||
| 167 | } | ||
| 168 | |||
| 169 | /** | ||
| 170 | * | ||
| 171 | * @param userWeixinDTO | ||
| 172 | * @param appId | ||
| 173 | * @param openId | ||
| 174 | */ | ||
| 175 | private void doUpdateUserWeiXinAndMember(UserWeixinDTO userWeixinDTO,String appId,String openId) { | ||
| 176 | // 修改微信账户关注状态 | ||
| 177 | this.doUpdateUserWeiXinStatus(userWeixinDTO,SUBSCRIBE_STATUS); | ||
| 178 | |||
| 179 | // 小屏会员 | ||
| 180 | MemberDTO memberDTO_0 = this.findMemberByAppIdAndOpenId(appId,openId); | ||
| 181 | |||
| 182 | this.doUpdateMemberVip(memberDTO_0,1); | ||
| 183 | } | ||
| 184 | |||
| 185 | /** | ||
| 186 | * 创建会员和账户 | ||
| 187 | * @param weiXinBeanDefinition | ||
| 188 | * @param userWeixinDTO | ||
| 189 | */ | ||
| 190 | private void doCreateUserWeiXinAndMember(DefaultWeiXinBeanDefinition weiXinBeanDefinition,UserWeixinDTO userWeixinDTO) { | ||
| 191 | |||
| 192 | // 创建小屏 | ||
| 193 | UserWeixin userWeixin = this.generateUserWeiXin(weiXinBeanDefinition,SUBSCRIBE_STATUS); | ||
| 194 | if (Objects.isNull(userWeixin.getId())) { | ||
| 195 | throw new BadRequestException("创建小屏账户失败"); | ||
| 196 | } | ||
| 197 | |||
| 198 | // 保存会员 | ||
| 199 | Long memberId = this.doCreateMember(userWeixin,1); | ||
| 200 | |||
| 201 | if (Objects.isNull(memberId)) { | ||
| 202 | throw new BadRequestException("会员创建保存失败"); | ||
| 203 | } | ||
| 204 | |||
| 205 | // 保存或者修改,微信账户信息 | ||
| 206 | this.doCreateUserWeiXin(userWeixin,memberId); | ||
| 207 | |||
| 208 | } | ||
| 209 | |||
| 210 | /** | ||
| 211 | * 获取小屏会员 | ||
| 212 | * @param appId | ||
| 213 | * @param openId | ||
| 214 | * @return | ||
| 215 | */ | ||
| 216 | private MemberDTO findMemberByAppIdAndOpenId(String appId, String openId) { | ||
| 217 | UserWeixinDTO userWeixinDTO = this.findUserWeiXinByOpenIdAndAppId(appId, openId); | ||
| 218 | if (Objects.nonNull(userWeixinDTO)) { | ||
| 219 | Long memberId = userWeixinDTO.getMemberId(); | ||
| 220 | return this.findMemberById(memberId); | ||
| 221 | } | ||
| 222 | return null; | ||
| 223 | } | ||
| 224 | |||
| 225 | /** | ||
| 226 | * 从redis中获取大屏信息 | ||
| 227 | * @param unionId | ||
| 228 | * @return | ||
| 229 | */ | ||
| 230 | private UserTvDTO findUserTvFromRedis(String unionId) { | ||
| 231 | |||
| 232 | // 解析大屏信息 | ||
| 233 | JSONObject iptvUserInfo = this.parseUserTvContent(unionId); | ||
| 234 | |||
| 235 | if (Objects.nonNull(iptvUserInfo)) { | ||
| 236 | |||
| 237 | String platformAccount = iptvUserInfo.getString("platformAccount"); | ||
| 238 | |||
| 239 | UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount); | ||
| 240 | |||
| 241 | if (Objects.nonNull(userTvDTO.getId())) | ||
| 242 | userTvDTO.setPlatformAccount(platformAccount); | ||
| 243 | |||
| 244 | return userTvDTO; | ||
| 245 | } | ||
| 246 | |||
| 247 | return null; | ||
| 248 | } | ||
| 249 | |||
| 250 | /** | ||
| 251 | * 解析大屏用户 | ||
| 252 | * @param unionId | ||
| 253 | * @return | ||
| 254 | */ | ||
| 255 | private JSONObject parseUserTvContent(String unionId) { | ||
| 256 | // 缓存的信息,使用unionid即可 | ||
| 257 | String content = (String) this.redisUtils.get(RedisKeyUtil.genSeSuSubscribeKey(unionId)); | ||
| 258 | // 之后删除缓存信息 | ||
| 259 | redisUtils.del(RedisKeyUtil.genSeSuSubscribeKey(unionId)); | ||
| 260 | |||
| 261 | JSONObject iptvUserInfo = com.alibaba.fastjson.JSONObject.parseObject(content); | ||
| 262 | return iptvUserInfo; | ||
| 263 | } | ||
| 264 | |||
| 265 | /** | ||
| 266 | * 绑定iptvId字段并修改会员vip字段 | ||
| 267 | * @param memberDTO | ||
| 268 | * @param userTvDTO | ||
| 269 | */ | ||
| 270 | private MemberDTO bindIptvIdAndUpdateVip(MemberDTO memberDTO, UserTvDTO userTvDTO) { | ||
| 271 | Integer vip = memberDTO.getVip(); | ||
| 272 | |||
| 273 | if (Objects.nonNull(vip) && vip == 0) { | ||
| 274 | memberDTO.setVip(1); | ||
| 275 | return this.bindIptvId(memberDTO,userTvDTO); | ||
| 276 | |||
| 277 | } | ||
| 278 | return memberDTO; | ||
| 279 | } | ||
| 280 | |||
| 281 | /** | ||
| 282 | * 微信公众号取消关注 | ||
| 283 | * @param resources | ||
| 284 | * @return | ||
| 285 | */ | ||
| 286 | @Override | ||
| 287 | public boolean unsubscribe(SubscribeBean resources) { | ||
| 288 | |||
| 289 | String appId = resources.getAppId(); | ||
| 290 | String openId = resources.getOpenId(); | ||
| 291 | |||
| 292 | // 修改关注状态 0:未关注 | ||
| 293 | UserWeixinDTO userWeixinDTO = this.doUpdateUserWeiXinStatus(appId, openId, UNSUBSCRIBE_STATUS); | ||
| 294 | |||
| 295 | // 会员 | ||
| 296 | MemberDTO memberDTO = this.findMemberByUserWeixinDTO(userWeixinDTO); | ||
| 297 | |||
| 298 | // 修改会员vip,如果没有购买会员则取消团粉 | ||
| 299 | this.doUpdateMemberVip(memberDTO,0); | ||
| 300 | |||
| 301 | return true; | ||
| 302 | } | ||
| 303 | |||
| 304 | /** | ||
| 305 | * 更新大屏信息,同时判断是否已经关注,如果关注了则不跳转H5页面 | ||
| 306 | * @param data | ||
| 307 | * @return | ||
| 308 | */ | ||
| 309 | @Override | ||
| 310 | public String saveUserInfo(String data) { | ||
| 311 | Assert.notNull(data, "用户数据不可为空"); | ||
| 312 | JSONObject json = JSONObject.parseObject(data); | ||
| 313 | String unionid = json.getString("unionid"); | ||
| 314 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | ||
| 315 | String result = ""; | ||
| 316 | // 订阅号appid | ||
| 317 | String appId = json.getString("dyAppid"); | ||
| 318 | try { | ||
| 319 | |||
| 320 | // 过期时间300S | ||
| 321 | this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionid), data, 300); | ||
| 322 | |||
| 323 | // 若未传dyAppId。不走下面的流程 | ||
| 324 | if (StrUtil.isNotBlank(appId)) | ||
| 325 | result = this.checkWeiXinUserAndSubscribeStatus(appId,unionid); | ||
| 326 | } catch (Exception e) { | ||
| 327 | log.error(" saveUserInfo get an error || data: {} || msg: {} ", data, e.getMessage()); | ||
| 328 | } | ||
| 329 | |||
| 330 | return result; | ||
| 331 | } | ||
| 332 | |||
| 333 | |||
| 334 | |||
| 335 | /** | ||
| 336 | * 检查微信账户和关注状态 | ||
| 337 | * @param appId | ||
| 338 | * @param unionid | ||
| 339 | * @return | ||
| 340 | */ | ||
| 341 | private String checkWeiXinUserAndSubscribeStatus(String appId, String unionid) { | ||
| 342 | |||
| 343 | UserWeixinDTO userWeixinDTO = this.findUserWeiXinByUnionIdAndAppId(unionid,appId); | ||
| 344 | |||
| 345 | if (Objects.isNull(userWeixinDTO.getId())) { | ||
| 346 | return UNSUBSCRIBE; | ||
| 347 | } | ||
| 348 | |||
| 349 | Integer status = userWeixinDTO.getStatus(); | ||
| 350 | if (status == UNSUBSCRIBE_STATUS) { | ||
| 351 | return UNSUBSCRIBE; | ||
| 352 | } | ||
| 353 | |||
| 354 | return SUBSCRIBE; | ||
| 355 | } | ||
| 356 | |||
| 357 | private UserWeixinDTO findUserWeiXinByUnionIdAndAppId(String unionid, String appId) { | ||
| 358 | return this.userWeixinService.findFirstByUnionidAndAppid(unionid,appId); | ||
| 359 | } | ||
| 360 | |||
| 361 | /** | ||
| 362 | * 修改会员vip状态 | ||
| 363 | */ | ||
| 364 | private void doUpdateMemberVip(MemberDTO memberDTO,Integer vip1) { | ||
| 365 | |||
| 366 | Integer vip = memberDTO.getVip(); | ||
| 367 | // 未购买付费会员 | ||
| 368 | if (vip <= 1) { | ||
| 369 | |||
| 370 | memberDTO.setVip(vip1); | ||
| 371 | |||
| 372 | Member member = new Member(); | ||
| 373 | BeanUtils.copyProperties(memberDTO,member); | ||
| 374 | this.memberService.update(member); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | |||
| 378 | /** | ||
| 379 | * 获取小屏会员 | ||
| 380 | * @param userWeixinDTO | ||
| 381 | * @return | ||
| 382 | */ | ||
| 383 | private MemberDTO findMemberByUserWeixinDTO(UserWeixinDTO userWeixinDTO) { | ||
| 384 | Long memberId = userWeixinDTO.getMemberId(); | ||
| 385 | if (Objects.nonNull(memberId)) { | ||
| 386 | MemberDTO memberDTO = this.findMemberById(memberId); | ||
| 387 | return memberDTO; | ||
| 388 | } | ||
| 389 | return null; | ||
| 390 | } | ||
| 391 | |||
| 392 | /** | ||
| 393 | * 修改微信公众号关注状态 | ||
| 394 | * @param status 0:取消关注 1:关注 | ||
| 395 | */ | ||
| 396 | private UserWeixinDTO doUpdateUserWeiXinStatus(String appId, String openId, Integer status) { | ||
| 397 | |||
| 398 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId, openId); | ||
| 399 | |||
| 400 | if (Objects.nonNull(userWeixinDTO.getId())) { | ||
| 401 | |||
| 402 | userWeixinDTO.setStatus(status); | ||
| 403 | |||
| 404 | UserWeixin userWeixin = new UserWeixin(); | ||
| 405 | BeanUtils.copyProperties(userWeixinDTO,userWeixin); | ||
| 406 | |||
| 407 | this.userWeixinService.update(userWeixin); | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 411 | return userWeixinDTO; | ||
| 412 | |||
| 413 | } | ||
| 414 | |||
| 415 | /** | ||
| 416 | * 修改微信公众号关注状态 | ||
| 417 | * @param status 0:取消关注 1:关注 | ||
| 418 | */ | ||
| 419 | private UserWeixinDTO doUpdateUserWeiXinStatus(UserWeixinDTO userWeixinDTO, Integer status) { | ||
| 420 | |||
| 421 | userWeixinDTO.setStatus(status); | ||
| 422 | |||
| 423 | UserWeixin userWeixin = new UserWeixin(); | ||
| 424 | BeanUtils.copyProperties(userWeixinDTO,userWeixin); | ||
| 425 | |||
| 426 | this.userWeixinService.update(userWeixin); | ||
| 427 | |||
| 428 | |||
| 429 | return userWeixinDTO; | ||
| 430 | |||
| 431 | } | ||
| 432 | |||
| 433 | /** | ||
| 434 | * 通过openId和appId获取微信信息 | ||
| 435 | * @param appId | ||
| 436 | * @param openId | ||
| 437 | * @return | ||
| 438 | */ | ||
| 439 | private UserWeixinDTO findUserWeiXinByOpenIdAndAppId(String appId, String openId) { | ||
| 440 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId,openId); | ||
| 441 | return userWeixinDTO; | ||
| 442 | } | ||
| 443 | |||
| 444 | /** | ||
| 445 | * 获取会员 | ||
| 446 | * @param memberId | ||
| 447 | * @return | ||
| 448 | */ | ||
| 449 | private MemberDTO findMemberById(Long memberId) { | ||
| 450 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
| 451 | return memberDTO; | ||
| 452 | } | ||
| 453 | |||
| 454 | /** | ||
| 455 | * 小程序登录 | ||
| 456 | * @param resources | ||
| 457 | * @return | ||
| 458 | */ | ||
| 459 | @Override | ||
| 460 | @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = Exception.class) | ||
| 461 | public UserWeixinDTO appletLogin(WeiXinUserBean resources) { | ||
| 462 | |||
| 463 | // 解析 | ||
| 464 | DefaultWeiXinBeanDefinition weiXinBeanDefinition = this.parseAppletInfo(resources); | ||
| 465 | |||
| 466 | if (Objects.isNull(weiXinBeanDefinition.getAppId())) { | ||
| 467 | throw new RuntimeException("微信信息解析失败!"); | ||
| 468 | } | ||
| 469 | |||
| 470 | // 链接微信服务器获取用户信息,创建UserWeixin | ||
| 471 | UserWeixin userWeixin = this.generateUserWeiXin(weiXinBeanDefinition,UNSUBSCRIBE_STATUS); | ||
| 472 | |||
| 473 | // 保存会员 | ||
| 474 | Long memberId = this.doCreateMember(userWeixin,0); | ||
| 475 | |||
| 476 | // 保存或者修改,微信账户信息 | ||
| 477 | UserWeixinDTO userWeixinDTO = this.doCreateUserWeiXin(userWeixin, memberId); | ||
| 478 | |||
| 479 | return userWeixinDTO; | ||
| 480 | } | ||
| 481 | |||
| 482 | /** | ||
| 483 | * 创建会员 | ||
| 484 | * @description 同一用户只有一个会员,通过unionId查询任意账户是否关联了会员,如果关联了就不用再创建 | ||
| 485 | * @param userWeixin | ||
| 486 | * @param vip | ||
| 487 | * @return | ||
| 488 | */ | ||
| 489 | private Long doCreateMember(UserWeixin userWeixin,Integer vip) { | ||
| 490 | |||
| 491 | Long memberId = null; | ||
| 492 | |||
| 493 | if(Objects.nonNull(userWeixin)) { | ||
| 494 | |||
| 495 | String unionid = userWeixin.getUnionid(); | ||
| 496 | |||
| 497 | // 新创建的小屏账户 | ||
| 498 | if(Objects.nonNull(unionid)) { | ||
| 499 | |||
| 500 | // 查询第一个账户是否关联了会员 | ||
| 501 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findFirstByUnionId(unionid); | ||
| 502 | |||
| 503 | // 无账号,没有绑定会员 | ||
| 504 | if (Objects.isNull(userWeixinDTO.getId()) || Objects.isNull(userWeixinDTO.getMemberId())) { | ||
| 505 | // 默认会员 | ||
| 506 | Member member = MemberBuilder.build(LocalConstants.DEVICE_MOBILE,userWeixin.getHeadimgurl(), | ||
| 507 | userWeixin.getNickname(),vip); | ||
| 508 | |||
| 509 | memberId = this.memberService.create(member); | ||
| 510 | |||
| 511 | } | ||
| 512 | |||
| 513 | // 如果绑定了会员 | ||
| 514 | if (Objects.nonNull(userWeixinDTO.getMemberId())) { | ||
| 515 | memberId = userWeixinDTO.getMemberId(); | ||
| 516 | } | ||
| 517 | |||
| 518 | } | ||
| 519 | |||
| 520 | } | ||
| 521 | |||
| 522 | return memberId; | ||
| 523 | } | ||
| 524 | |||
| 525 | /** | ||
| 526 | * 保存微信账户信息 | ||
| 527 | * @param userWeixin | ||
| 528 | * @param memberId | ||
| 529 | */ | ||
| 530 | private UserWeixinDTO doCreateUserWeiXin(UserWeixin userWeixin,Long memberId) { | ||
| 531 | UserWeixinDTO userWeixinDTO = new UserWeixinDTO(); | ||
| 532 | if(Objects.isNull(userWeixin.getId()) && Objects.nonNull(memberId)) { | ||
| 533 | userWeixin.setMemberId(memberId); | ||
| 534 | userWeixin.setStatus(1); | ||
| 535 | userWeixin.setSyncStatus(0); | ||
| 536 | userWeixin.setCreateBy("system"); | ||
| 537 | userWeixin.setUpdateBy("system"); | ||
| 538 | userWeixin.setAuthTime(TimestampUtil.now()); | ||
| 539 | userWeixin = this.userWeixinService.create(userWeixin); | ||
| 540 | } | ||
| 541 | |||
| 542 | BeanUtils.copyProperties(userWeixin,userWeixinDTO); | ||
| 543 | return userWeixinDTO; | ||
| 544 | } | ||
| 545 | |||
| 546 | /** | ||
| 547 | * 链接微信服务器,创建或者修改UserWeiXinDTO | ||
| 548 | * @param weiXinBeanDefinition | ||
| 549 | * @return | ||
| 550 | */ | ||
| 551 | private UserWeixin generateUserWeiXin(WeiXinBeanDefinition weiXinBeanDefinition,Integer status) { | ||
| 552 | |||
| 553 | String appId = weiXinBeanDefinition.getAppId(); | ||
| 554 | String openId = weiXinBeanDefinition.getOpenId(); | ||
| 555 | String unionId = weiXinBeanDefinition.getUnionId(); | ||
| 556 | String nickname = weiXinBeanDefinition.getNickname(); | ||
| 557 | String headImgUrl = weiXinBeanDefinition.getHeadImgUrl(); | ||
| 558 | |||
| 559 | // 微信 | ||
| 560 | UserWeixinDTO weixinDTO = this.userWeixinService.findFirstByAppIdAndOpenId(appId,openId); | ||
| 561 | |||
| 562 | if (Objects.isNull(weixinDTO.getId())) { | ||
| 563 | |||
| 564 | UserWeixin userWeixin = new UserWeixin() | ||
| 565 | .setAppid(appId) | ||
| 566 | .setOpenid(openId) | ||
| 567 | .setUnionid(unionId) | ||
| 568 | .setNickname(nickname) | ||
| 569 | .setHeadimgurl(headImgUrl) | ||
| 570 | .setStatus(status) | ||
| 571 | .setAuthTime(TimestampUtil.now()); | ||
| 572 | |||
| 573 | return userWeixin; | ||
| 574 | |||
| 575 | } | ||
| 576 | |||
| 577 | UserWeixin userWeixin = new UserWeixin(); | ||
| 578 | BeanUtils.copyProperties(weixinDTO,userWeixin); | ||
| 579 | |||
| 580 | return userWeixin; | ||
| 581 | |||
| 582 | } | ||
| 583 | |||
| 584 | /** | ||
| 585 | * 解析小程序 | ||
| 586 | * @param resources | ||
| 587 | * @return | ||
| 588 | */ | ||
| 589 | private DefaultWeiXinBeanDefinition parseAppletInfo(WeiXinUserBean resources) { | ||
| 590 | return this.parse(resources); | ||
| 591 | } | ||
| 592 | |||
| 593 | /** | ||
| 594 | * 解析微信信息 | ||
| 595 | * @param resources | ||
| 596 | * @return | ||
| 597 | */ | ||
| 598 | private DefaultWeiXinBeanDefinition parse(WeiXinUserBean resources) { | ||
| 599 | Map<String, String> weixinInfoMap = null; | ||
| 600 | String appId = resources.getWxAppid(); | ||
| 601 | String code = resources.getWxCode(); | ||
| 602 | String encryptedData = resources.getEncryptedData(); | ||
| 603 | String iv = resources.getIv(); | ||
| 604 | String userInfo = null; | ||
| 605 | |||
| 606 | if (StringUtils.isNotBlank(appId)) { | ||
| 607 | String decrypt = AESUtil.decrypt(appId, this.key); | ||
| 608 | if (decrypt != null) { | ||
| 609 | appId = decrypt.substring(16); | ||
| 610 | } | ||
| 611 | weixinInfoMap = this.getWeixinInfoByAppid(appId); | ||
| 612 | } | ||
| 613 | |||
| 614 | if (StringUtils.isNotBlank(code)) { | ||
| 615 | String decrypt = AESUtil.decrypt(code, this.key); | ||
| 616 | if (decrypt != null) { | ||
| 617 | code = decrypt.substring(16); | ||
| 618 | } | ||
| 619 | } | ||
| 620 | |||
| 621 | /*if (StringUtils.isNotBlank(resources.getEncryptedData())) { | ||
| 622 | String decrypt = AESUtil.decrypt(resources.getEncryptedData(), key); | ||
| 623 | if (decrypt != null) { | ||
| 624 | encryptedData = decrypt.substring(16); | ||
| 625 | } | ||
| 626 | }*/ | ||
| 627 | |||
| 628 | /*if (StringUtils.isNotBlank(resources.getIv())) { | ||
| 629 | String decrypt = AESUtil.decrypt(iv, key); | ||
| 630 | if (decrypt != null) { | ||
| 631 | iv = decrypt.substring(16); | ||
| 632 | } | ||
| 633 | }*/ | ||
| 634 | |||
| 635 | String appId_ = weixinInfoMap.get("appid"); | ||
| 636 | String secret = weixinInfoMap.get("secret"); | ||
| 637 | |||
| 638 | // 链接微信服务器 | ||
| 639 | String url = WeChatConstants.CODE2SESSION.replace("APPID", appId_) | ||
| 640 | .replace("SECRET", secret).replace("JSCODE", code); | ||
| 641 | String entityBody = HttpUtil.get(url); | ||
| 642 | log.info("entityBody [{}]",entityBody); | ||
| 643 | |||
| 644 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
| 645 | |||
| 646 | String errCode = jsonObject.getString("errcode"); | ||
| 647 | |||
| 648 | if (StringUtils.isNotEmpty(errCode)) { | ||
| 649 | String nameStr = jsonObject.getString("errmsg"); | ||
| 650 | throw new BadRequestException(nameStr); | ||
| 651 | } | ||
| 652 | |||
| 653 | String openId = jsonObject.getString("openid"); | ||
| 654 | String unionId = jsonObject.getString("unionid"); | ||
| 655 | String sessionKey = jsonObject.getString("session_key"); | ||
| 656 | |||
| 657 | JSONObject userInfoWxJo = null; | ||
| 658 | |||
| 659 | if (StringUtils.isNotBlank(encryptedData) && StringUtils.isNotBlank(iv) && StringUtils.isNotBlank(sessionKey)) { | ||
| 660 | |||
| 661 | String userInfoWeixin = AESUtil.decryptJsUserInfo(encryptedData, iv, sessionKey); | ||
| 662 | log.info("userInfoWeixin [{}]",userInfoWeixin); | ||
| 663 | |||
| 664 | if (StringUtils.isNotEmpty(userInfoWeixin)) | ||
| 665 | userInfoWxJo = JSONObject.parseObject(userInfoWeixin); | ||
| 666 | |||
| 667 | } | ||
| 668 | |||
| 669 | if (StringUtils.isNotBlank(userInfo)) { | ||
| 670 | |||
| 671 | JSONObject userInfoJo = JSONObject.parseObject(userInfo); | ||
| 672 | if (Objects.nonNull(userInfoJo)) { | ||
| 673 | encryptedData = userInfoJo.getString("encryptedData"); | ||
| 674 | iv = userInfoJo.getString("iv"); | ||
| 675 | String sessionkey = jsonObject.getString("session_key"); | ||
| 676 | String userInfoWeixin = AESUtil.decryptJsUserInfo(encryptedData, iv, sessionkey); | ||
| 677 | log.info("userInfo:" + userInfo); | ||
| 678 | userInfoWxJo = JSONObject.parseObject(userInfoWeixin); | ||
| 679 | } | ||
| 680 | } | ||
| 681 | |||
| 682 | DefaultWeiXinBeanDefinition weiXinBeanDefinition = | ||
| 683 | new DefaultWeiXinBeanDefinition(appId,code,unionId,openId,userInfoWxJo); | ||
| 684 | |||
| 685 | return weiXinBeanDefinition; | ||
| 686 | } | ||
| 687 | |||
| 688 | /** | ||
| 689 | * | ||
| 690 | * @param appid | ||
| 691 | * @return | ||
| 692 | */ | ||
| 693 | private Map<String, String> getWeixinInfoByAppid(String appid) { | ||
| 694 | if (StringUtils.isBlank(appid)) { | ||
| 695 | throw new RuntimeException("wxAppid can not be null"); | ||
| 696 | } | ||
| 697 | List<Map<String, String>> list = this.weiXinAppListConfig.getList(); | ||
| 698 | Optional<Map<String, String>> weixinInfoOptional = list.stream().filter(o -> o.get("appid").equals(appid)).findFirst(); | ||
| 699 | if (!weixinInfoOptional.isPresent()) { | ||
| 700 | throw new RuntimeException("wxAppid error, appid is : " + appid); | ||
| 701 | } | ||
| 702 | return weixinInfoOptional.get(); | ||
| 703 | } | ||
| 704 | |||
| 705 | /** | ||
| 706 | * 大屏更换主账号 | ||
| 707 | * @param resources | ||
| 708 | */ | ||
| 709 | @Override | ||
| 710 | public void changeMainAccount(UserTv resources) { | ||
| 711 | // 会员编码 | ||
| 712 | String memberCode = resources.getMemberCode(); | ||
| 713 | |||
| 714 | // 大屏账户 | ||
| 715 | UserTvDTO userTvDTO = this.findByUserTv(resources); | ||
| 716 | |||
| 717 | // 会员 | ||
| 718 | MemberDTO memberDTO = this.findMemberByMemberCode(memberCode); | ||
| 719 | |||
| 720 | // 设置主会员 | ||
| 721 | this.bondPriorityMember(userTvDTO, memberDTO); | ||
| 722 | |||
| 723 | } | ||
| 724 | |||
| 725 | /** | ||
| 726 | * 设置主会员 | ||
| 727 | * @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中 | ||
| 728 | * @param userTvDTO | ||
| 729 | * @param memberDTO | ||
| 730 | */ | ||
| 731 | private void bondPriorityMember(UserTvDTO userTvDTO, MemberDTO memberDTO) { | ||
| 732 | |||
| 733 | // 绑定的小屏编码 | ||
| 734 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
| 735 | |||
| 736 | if (StringUtils.isNotEmpty(priorityMemberCode)) { | ||
| 737 | return; | ||
| 738 | } | ||
| 739 | |||
| 740 | String memberCode = memberDTO.getCode(); | ||
| 741 | |||
| 742 | // 绑定了小屏,结束 | ||
| 743 | if (StringUtils.isEmpty(priorityMemberCode) && StringUtils.isNotEmpty(memberCode)) { | ||
| 744 | userTvDTO.setPriorityMemberCode(memberCode); | ||
| 745 | } | ||
| 746 | |||
| 747 | UserTv userTv = new UserTv(); | ||
| 748 | BeanUtils.copyProperties(userTvDTO,userTv); | ||
| 749 | this.userTvService.update(userTv); | ||
| 750 | |||
| 751 | } | ||
| 752 | |||
| 753 | /** | ||
| 754 | * 通过账户获取大屏账户 | ||
| 755 | * @param platformAccount | ||
| 756 | * @return | ||
| 757 | */ | ||
| 758 | private UserTvDTO findByPlatformAccount(String platformAccount) { | ||
| 759 | return this.userTvService.findByPlatformAccount(platformAccount); | ||
| 760 | } | ||
| 761 | |||
| 762 | /** | ||
| 763 | * 通过编码获取会员 | ||
| 764 | * @param memberCode | ||
| 765 | * @return | ||
| 766 | */ | ||
| 767 | private MemberDTO findMemberByMemberCode(String memberCode) { | ||
| 768 | return this.memberService.getByCode(memberCode); | ||
| 769 | } | ||
| 770 | |||
| 771 | /** | ||
| 772 | * 大屏解绑 | ||
| 773 | * @param resources | ||
| 774 | */ | ||
| 775 | @Override | ||
| 776 | public void unbind(UserTv resources) { | ||
| 777 | // 大屏账户 | ||
| 778 | UserTvDTO userTvDTO = this.findByUserTv(resources); | ||
| 779 | |||
| 780 | Long id = userTvDTO.getId(); | ||
| 781 | String memberCode = resources.getMemberCode(); | ||
| 782 | |||
| 783 | // 大屏会员 | ||
| 784 | List<MemberDTO> memberDTOS = this.findMemberByCodeAndUserIptvId(id,memberCode); | ||
| 785 | |||
| 786 | // 解绑(置空大屏信息) | ||
| 787 | this.resetIptvColumn(memberDTOS); | ||
| 788 | |||
| 789 | // 置空主账号 | ||
| 790 | this.resetMainAccount(memberCode); | ||
| 791 | } | ||
| 792 | |||
| 793 | /** | ||
| 794 | * 置空主账号 | ||
| 795 | * @param memberCode | ||
| 796 | */ | ||
| 797 | private void resetMainAccount(String memberCode) { | ||
| 798 | UserTvDTO userTvDTO = this.userTvService.findByPriorityMemberCode(memberCode); | ||
| 799 | if (Objects.nonNull(userTvDTO)) { | ||
| 800 | userTvDTO.setPriorityMemberCode(null); | ||
| 801 | |||
| 802 | UserTv userTv = new UserTv(); | ||
| 803 | BeanUtils.copyProperties(userTvDTO,userTv); | ||
| 804 | |||
| 805 | this.userTvService.update(userTv); | ||
| 806 | } | ||
| 807 | } | ||
| 808 | |||
| 809 | /** | ||
| 810 | * 解绑(置空大屏信息) | ||
| 811 | * @param memberDTOS | ||
| 812 | */ | ||
| 813 | private void resetIptvColumn(List<MemberDTO> memberDTOS) { | ||
| 814 | // 若无关系,不做处理 | ||
| 815 | if (CollUtil.isEmpty(memberDTOS)) | ||
| 816 | return; | ||
| 817 | |||
| 818 | Member member = new Member(); | ||
| 819 | memberDTOS.get(0).setBindIptvTime(null); | ||
| 820 | memberDTOS.get(0).setUserIptvId(null); | ||
| 821 | memberDTOS.get(0).setBindIptvPlatformType(null); | ||
| 822 | BeanUtils.copyProperties(memberDTOS.get(0), member); | ||
| 823 | this.memberService.update(member); | ||
| 824 | } | ||
| 825 | |||
| 826 | /** | ||
| 827 | * | ||
| 828 | * @param tvUserId 大屏ic | ||
| 829 | * @param memberCode 会员编码 | ||
| 830 | * @return | ||
| 831 | */ | ||
| 832 | private List<MemberDTO> findMemberByCodeAndUserIptvId(Long tvUserId,String memberCode) { | ||
| 833 | MemberQueryCriteria memberQueryCriteria = new MemberQueryCriteria(); | ||
| 834 | memberQueryCriteria.setCode(memberCode); | ||
| 835 | memberQueryCriteria.setUserIptvId(tvUserId); | ||
| 836 | List<MemberDTO> memberDTOS = memberService.queryAll(memberQueryCriteria); | ||
| 837 | return memberDTOS; | ||
| 838 | } | ||
| 839 | |||
| 840 | /** | ||
| 841 | * 通过大屏账户id查询大屏信息 | ||
| 842 | * @param userTvId | ||
| 843 | * @return | ||
| 844 | */ | ||
| 845 | private UserTvDTO findByUserTvId(Long userTvId) { | ||
| 846 | UserTvDTO userTvDTO = this.userTvService.findById(userTvId); | ||
| 847 | return userTvDTO; | ||
| 848 | } | ||
| 849 | |||
| 850 | /** | ||
| 851 | * 通过大屏账户查询大屏信息 | ||
| 852 | * @param resources | ||
| 853 | * @return | ||
| 854 | */ | ||
| 855 | private UserTvDTO findByUserTv(UserTv resources) { | ||
| 856 | String platformAccount = resources.getPlatformAccount(); | ||
| 857 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 858 | return userTvDTO; | ||
| 859 | } | ||
| 860 | |||
| 861 | /** | ||
| 862 | * 创建大屏会员 | ||
| 863 | * @param resources | ||
| 864 | * @return | ||
| 865 | */ | ||
| 866 | @Override | ||
| 867 | @Transactional | ||
| 868 | public boolean createMemberByUserTv(UserTv resources) { | ||
| 869 | String platformAccount = resources.getPlatformAccount(); | ||
| 870 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 871 | if (Objects.isNull(userTvDTO)) { | ||
| 872 | Member member = new Member(); | ||
| 873 | // 大屏 | ||
| 874 | member.setType(LocalConstants.MEMBER_PLATFORM_TYPE_VIS); | ||
| 875 | String code = member.getCode(); | ||
| 876 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); | ||
| 877 | member.setNickname(platformAccount); | ||
| 878 | member.setType(1); | ||
| 879 | Long memberId = this.memberService.create(member); | ||
| 880 | |||
| 881 | if (Objects.nonNull(memberId)) { | ||
| 882 | UserTv userTv = new UserTv(); | ||
| 883 | BeanUtils.copyProperties(resources,userTv); | ||
| 884 | userTv.setPlatformAccount(platformAccount); | ||
| 885 | userTv.setMemberCode(member.getCode()); | ||
| 886 | |||
| 887 | this.userTvService.create(userTv); | ||
| 888 | |||
| 889 | } | ||
| 890 | |||
| 891 | } else { | ||
| 892 | return false; | ||
| 893 | } | ||
| 894 | |||
| 895 | return true; | ||
| 896 | } | ||
| 897 | |||
| 898 | /** | ||
| 899 | * 绑定会员中的userIptvId字段 | ||
| 900 | * @param resources | ||
| 901 | */ | ||
| 902 | private MemberDTO bindIptvId(MemberDTO resources,UserTvDTO userTvDTO) { | ||
| 903 | String platform = userTvDTO.getPlatform(); | ||
| 904 | // 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 | ||
| 905 | Integer bindIptvPlatformType = 0; | ||
| 906 | |||
| 907 | // 联通 | ||
| 908 | if (UserConstant.platform_lt.contains(platform)) { | ||
| 909 | bindIptvPlatformType = PLATFORM_LIST[3]; | ||
| 910 | } | ||
| 911 | |||
| 912 | // 移动 | ||
| 913 | if (UserConstant.platform_yd.contains(platform)) { | ||
| 914 | bindIptvPlatformType = PLATFORM_LIST[2]; | ||
| 915 | } | ||
| 916 | |||
| 917 | // 电信 | ||
| 918 | if (UserConstant.platform_dx.contains(platform)) { | ||
| 919 | bindIptvPlatformType = PLATFORM_LIST[1]; | ||
| 920 | } | ||
| 921 | |||
| 922 | return this.bindIptvId(resources,userTvDTO.getId(),bindIptvPlatformType); | ||
| 923 | } | ||
| 924 | |||
| 925 | /** | ||
| 926 | * 绑定会员中的userIptvId字段 | ||
| 927 | * @param userIptvId | ||
| 928 | * @param bindIptvPlatformType | ||
| 929 | */ | ||
| 930 | private MemberDTO bindIptvId(MemberDTO memberDTO,Long userIptvId,Integer bindIptvPlatformType) { | ||
| 931 | |||
| 932 | //MemberDTO memberDTO = this.memberService.getByCode(resources.getCode()); | ||
| 933 | if (memberDTO != null) { | ||
| 934 | memberDTO.setUserIptvId(userIptvId); | ||
| 935 | memberDTO.setBindIptvTime(TimestampUtil.now()); | ||
| 936 | memberDTO.setBindIptvPlatformType(bindIptvPlatformType); | ||
| 937 | } | ||
| 938 | |||
| 939 | return memberDTO; | ||
| 940 | } | ||
| 941 | |||
| 942 | /** | ||
| 943 | * 修改会员 | ||
| 944 | * @param memberDTO | ||
| 945 | */ | ||
| 946 | private void doUpdateMemberByMemberDTO(MemberDTO memberDTO){ | ||
| 947 | Member member = new Member(); | ||
| 948 | BeanUtils.copyProperties(memberDTO,member); | ||
| 949 | this.doUpdateMember(member); | ||
| 950 | } | ||
| 951 | |||
| 952 | /** | ||
| 953 | * 修改会员 | ||
| 954 | * @param member | ||
| 955 | */ | ||
| 956 | private void doUpdateMember(Member member){ | ||
| 957 | this.memberService.update(member); | ||
| 958 | } | ||
| 959 | |||
| 960 | /** | ||
| 961 | * 解析微信信息 | ||
| 962 | * @param resources | ||
| 963 | * @return | ||
| 964 | */ | ||
| 965 | @Override | ||
| 966 | public MemberProfile saveUserWeixinPhone(WeiXinUserBean resources) { | ||
| 967 | DefaultWeiXinBeanDefinition weiXinBeanDefinition = this.parseAppletInfo(resources); | ||
| 968 | |||
| 969 | if (Objects.nonNull(weiXinBeanDefinition.getOpenId())) { | ||
| 970 | throw new RuntimeException("微信信息解析失败!"); | ||
| 971 | } | ||
| 972 | |||
| 973 | // 保存、修改会员加密信息 | ||
| 974 | return this.doSaveOrUpdateMemberProfile(weiXinBeanDefinition,resources); | ||
| 975 | } | ||
| 976 | |||
| 977 | /** | ||
| 978 | * 保存、修改会员加密信息 | ||
| 979 | * @param resources | ||
| 980 | * @return | ||
| 981 | */ | ||
| 982 | private MemberProfile doSaveOrUpdateMemberProfile(DefaultWeiXinBeanDefinition resources,WeiXinUserBean weiXinUserBean) { | ||
| 983 | |||
| 984 | // 会员 | ||
| 985 | MemberDTO memberDTO = this.findMemberById(weiXinUserBean.getMemberId()); | ||
| 986 | |||
| 987 | if (Objects.nonNull(memberDTO)) { | ||
| 988 | |||
| 989 | Long memberId = memberDTO.getId(); | ||
| 990 | |||
| 991 | // 会员加密信息 | ||
| 992 | MemberProfileDTO memberProfileDTO = this.findMemberProfileByMemberId(memberId); | ||
| 993 | |||
| 994 | MemberProfile memberProfile = new MemberProfile(); | ||
| 995 | if (Objects.nonNull(memberProfileDTO)) { | ||
| 996 | BeanUtils.copyProperties(memberProfileDTO , memberProfile); | ||
| 997 | } | ||
| 998 | |||
| 999 | memberProfile.setMemberId(memberId); | ||
| 1000 | memberProfile.setPhone(resources.getPhoneNumber()); | ||
| 1001 | |||
| 1002 | // 保存、更新会员加密信息 | ||
| 1003 | MemberProfile memberProfile1 = this.saveMemberProfile(memberProfile); | ||
| 1004 | |||
| 1005 | return memberProfile1; | ||
| 1006 | |||
| 1007 | } | ||
| 1008 | |||
| 1009 | return null; | ||
| 1010 | |||
| 1011 | } | ||
| 1012 | |||
| 1013 | private MemberProfileDTO findMemberProfileByMemberId(Long memberId) { | ||
| 1014 | MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
| 1015 | return memberProfileDTO; | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | private MemberProfile saveMemberProfile(MemberProfile memberProfile) { | ||
| 1019 | return this.memberProfileService.create(memberProfile); | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | |||
| 1023 | |||
| 1024 | |||
| 1025 | |||
| 1026 | } |
| 1 | package com.topdraw.business.process.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.basicdata.member.domain.Member; | ||
| 4 | import com.topdraw.business.basicdata.member.service.MemberService; | ||
| 5 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | ||
| 6 | import com.topdraw.business.basicdata.user.iptv.domain.UserTv; | ||
| 7 | import com.topdraw.business.basicdata.user.iptv.repository.UserTvRepository; | ||
| 8 | import com.topdraw.business.basicdata.user.iptv.service.UserTvService; | ||
| 9 | import com.topdraw.business.basicdata.user.iptv.service.dto.UserTvDTO; | ||
| 10 | import com.topdraw.business.basicdata.user.iptv.service.mapper.UserTvMapper; | ||
| 11 | import com.topdraw.business.process.service.UserTvOperationService; | ||
| 12 | import com.topdraw.config.LocalConstants; | ||
| 13 | import com.topdraw.util.Base64Util; | ||
| 14 | import com.topdraw.util.IdWorker; | ||
| 15 | import com.topdraw.util.RedissonUtil; | ||
| 16 | import com.topdraw.util.TimestampUtil; | ||
| 17 | import com.topdraw.utils.StringUtils; | ||
| 18 | import lombok.extern.slf4j.Slf4j; | ||
| 19 | import org.redisson.api.RLock; | ||
| 20 | import org.redisson.api.RedissonClient; | ||
| 21 | import org.springframework.beans.BeanUtils; | ||
| 22 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 23 | import org.springframework.stereotype.Service; | ||
| 24 | import org.springframework.transaction.annotation.Transactional; | ||
| 25 | |||
| 26 | import java.util.Objects; | ||
| 27 | |||
| 28 | @Service | ||
| 29 | @Slf4j | ||
| 30 | public class UserTvOperationServiceImpl implements UserTvOperationService { | ||
| 31 | |||
| 32 | @Autowired | ||
| 33 | private RedissonClient redissonClient; | ||
| 34 | |||
| 35 | @Autowired | ||
| 36 | private MemberService memberService; | ||
| 37 | |||
| 38 | @Autowired | ||
| 39 | private UserTvService userTvService; | ||
| 40 | |||
| 41 | |||
| 42 | @Override | ||
| 43 | @Transactional | ||
| 44 | public boolean createMemberByUserTv(UserTv resources) { | ||
| 45 | String platformAccount = resources.getPlatformAccount(); | ||
| 46 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 47 | if (Objects.isNull(userTvDTO)) { | ||
| 48 | Member member = new Member(); | ||
| 49 | // 大屏 | ||
| 50 | member.setType(LocalConstants.MEMBER_PLATFORM_TYPE_VIS); | ||
| 51 | String code = member.getCode(); | ||
| 52 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); | ||
| 53 | String platformAccount1 = resources.getPlatformAccount(); | ||
| 54 | member.setNickname(Base64Util.encode(platformAccount1)); | ||
| 55 | member.setBindIptvPlatformType(1); | ||
| 56 | member.setType(1); | ||
| 57 | Long memberId = this.memberService.create(member); | ||
| 58 | |||
| 59 | if (Objects.nonNull(memberId)) { | ||
| 60 | UserTv userTv = new UserTv(); | ||
| 61 | BeanUtils.copyProperties(resources,userTv); | ||
| 62 | userTv.setPlatformAccount(platformAccount); | ||
| 63 | userTv.setMemberCode(member.getCode()); | ||
| 64 | Long userIptvId = this.userTvService.create(userTv); | ||
| 65 | |||
| 66 | if (Objects.nonNull(userIptvId)) { | ||
| 67 | member.setId(memberId); | ||
| 68 | member.setUserIptvId(userIptvId); | ||
| 69 | member.setBindIptvTime(TimestampUtil.now()); | ||
| 70 | member.setPlatformAccount(platformAccount); | ||
| 71 | this.bindIptvId(member); | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | } else { | ||
| 76 | return false; | ||
| 77 | } | ||
| 78 | |||
| 79 | return true; | ||
| 80 | } | ||
| 81 | |||
| 82 | private void bindIptvId(Member resources) { | ||
| 83 | RLock rLock = this.redissonClient.getLock("Member::update::code" + resources.getCode()); | ||
| 84 | try { | ||
| 85 | RedissonUtil.lock(rLock); | ||
| 86 | MemberDTO member = this.memberService.getByCode(resources.getCode()); | ||
| 87 | if (member!=null) { | ||
| 88 | this.memberService.update(resources); | ||
| 89 | } | ||
| 90 | } catch (Exception e) { | ||
| 91 | e.printStackTrace(); | ||
| 92 | throw e; | ||
| 93 | } finally { | ||
| 94 | RedissonUtil.unlock(rLock); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | } |
| 1 | package com.topdraw.config; | ||
| 2 | |||
| 3 | import cn.hutool.core.util.StrUtil; | ||
| 4 | |||
| 5 | public class RedisKeyUtil { | ||
| 6 | |||
| 7 | |||
| 8 | /** | ||
| 9 | * @return java.lang.String | ||
| 10 | * @description 订阅号大屏扫码关注 | ||
| 11 | * @author Hongyan Wang | ||
| 12 | * @date 2021/8/24 1:36 下午 | ||
| 13 | */ | ||
| 14 | public static String genSeSuSubscribeKey(String unionid) { | ||
| 15 | return StrUtil.format("BMSubscribe_unionid_{}", unionid); | ||
| 16 | } | ||
| 17 | |||
| 18 | } |
| ... | @@ -19,7 +19,7 @@ public class MessageProducer { | ... | @@ -19,7 +19,7 @@ public class MessageProducer { |
| 19 | private AmqpTemplate amqpTemplate; | 19 | private AmqpTemplate amqpTemplate; |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | @Value("${service.platform}") | 22 | @Value("${uc.service.platform}") |
| 23 | private String platformType; | 23 | private String platformType; |
| 24 | 24 | ||
| 25 | public void sendMessage(String msg,String exchangeName){ | 25 | public void sendMessage(String msg,String exchangeName){ | ... | ... |
| 1 | package com.topdraw.resttemplate; | 1 | package com.topdraw.resttemplate; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 5 | import com.topdraw.business.basicdata.member.domain.Member; | 5 | import com.topdraw.business.module.member.domain.Member; |
| 6 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 6 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.core.env.Environment; | 9 | import org.springframework.core.env.Environment; |
| ... | @@ -17,7 +17,7 @@ import java.util.Map; | ... | @@ -17,7 +17,7 @@ import java.util.Map; |
| 17 | 17 | ||
| 18 | @Slf4j | 18 | @Slf4j |
| 19 | @Component | 19 | @Component |
| 20 | public class ApiUtil { | 20 | public class RestTemplateClient { |
| 21 | 21 | ||
| 22 | private static RestTemplate restTemplate; | 22 | private static RestTemplate restTemplate; |
| 23 | 23 | ... | ... |
| 1 | package com.topdraw.schedule; | 1 | package com.topdraw.schedule; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | ||
| 4 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | ||
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | ||
| 6 | import com.topdraw.business.basicdata.points.standingbook.domain.PointsStandingBook; | ||
| 7 | import com.topdraw.business.basicdata.points.standingbook.service.PointsStandingBookService; | ||
| 8 | import com.topdraw.business.process.service.PointsOperationService; | 3 | import com.topdraw.business.process.service.PointsOperationService; |
| 9 | import com.topdraw.util.DateUtil; | ||
| 10 | import lombok.extern.slf4j.Slf4j; | ||
| 11 | import org.aspectj.lang.annotation.After; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 14 | import org.springframework.scheduling.annotation.Scheduled; | ||
| 15 | import org.springframework.stereotype.Component; | ||
| 16 | import org.springframework.util.CollectionUtils; | ||
| 17 | |||
| 18 | import java.sql.Timestamp; | ||
| 19 | import java.time.LocalDate; | ||
| 20 | import java.util.List; | ||
| 21 | 5 | ||
| 22 | /** | 6 | /** |
| 23 | * 积分台账 | 7 | * 积分台账 | ... | ... |
| 1 | package com.topdraw.security; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.topdraw.utils.StringUtils; | ||
| 5 | import lombok.extern.slf4j.Slf4j; | ||
| 6 | import org.bouncycastle.jce.provider.BouncyCastleProvider; | ||
| 7 | |||
| 8 | import javax.crypto.Cipher; | ||
| 9 | import javax.crypto.SecretKey; | ||
| 10 | import javax.crypto.spec.IvParameterSpec; | ||
| 11 | import javax.crypto.spec.SecretKeySpec; | ||
| 12 | import java.security.AlgorithmParameters; | ||
| 13 | import java.security.Key; | ||
| 14 | import java.security.Security; | ||
| 15 | import java.security.spec.AlgorithmParameterSpec; | ||
| 16 | import java.util.Arrays; | ||
| 17 | |||
| 18 | @Slf4j | ||
| 19 | public class AESUtil { | ||
| 20 | |||
| 21 | public static String encrypt(String data, String key) { | ||
| 22 | String strResult = null; | ||
| 23 | try { | ||
| 24 | SecretKey secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); | ||
| 25 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||
| 26 | AlgorithmParameterSpec aps = new IvParameterSpec("0123456789ABCDEF".getBytes("UTF-8")); | ||
| 27 | cipher.init(Cipher.ENCRYPT_MODE, secretKey, aps); | ||
| 28 | byte[] result = cipher.doFinal(data.getBytes("UTF-8")); | ||
| 29 | StringBuilder sb_hex = new StringBuilder(); | ||
| 30 | for (byte b : result) { | ||
| 31 | sb_hex.append(String.format("%02x", b)); | ||
| 32 | } | ||
| 33 | strResult = sb_hex.toString(); | ||
| 34 | } catch (Exception e) { | ||
| 35 | |||
| 36 | } | ||
| 37 | return strResult; | ||
| 38 | } | ||
| 39 | |||
| 40 | public static String decrypt(String encryptedData, String key) { | ||
| 41 | String strResult = null; | ||
| 42 | try { | ||
| 43 | int len = encryptedData.length() / 2; | ||
| 44 | byte[] data = new byte[len]; | ||
| 45 | for (int i = 0; i < len; i++) { | ||
| 46 | String str = encryptedData.substring(i * 2, i * 2 + 2); | ||
| 47 | data[i] = Integer.valueOf(str, 16).byteValue(); | ||
| 48 | } | ||
| 49 | SecretKey secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); | ||
| 50 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); | ||
| 51 | AlgorithmParameterSpec aps = new IvParameterSpec("0123456789ABCDEF".getBytes("UTF-8")); | ||
| 52 | cipher.init(Cipher.DECRYPT_MODE, secretKey, aps); | ||
| 53 | byte[] result = cipher.doFinal(data); | ||
| 54 | strResult = new String(result, "UTF-8"); | ||
| 55 | } catch (Exception e) { | ||
| 56 | |||
| 57 | } | ||
| 58 | return strResult; | ||
| 59 | } | ||
| 60 | |||
| 61 | private static final String AES ="AES"; | ||
| 62 | private static final String AES_CBC_PKCS7 ="AES/CBC/PKCS7Padding"; | ||
| 63 | public static String decryptJsUserInfo(String encryptedData,String iv,String sessionKey) { | ||
| 64 | try { | ||
| 65 | byte[] data = java.util.Base64.getDecoder().decode(encryptedData); | ||
| 66 | byte[] aseKey = java.util.Base64.getDecoder().decode(sessionKey); | ||
| 67 | byte[] ivData = java.util.Base64.getDecoder().decode(iv); | ||
| 68 | Security.addProvider(new BouncyCastleProvider()); | ||
| 69 | Cipher cipher = Cipher.getInstance(AES_CBC_PKCS7); | ||
| 70 | |||
| 71 | Key sKeySpec = new SecretKeySpec(aseKey, AES); | ||
| 72 | AlgorithmParameterSpec aps = new IvParameterSpec(ivData); | ||
| 73 | cipher.init(Cipher.DECRYPT_MODE, sKeySpec, aps);// 初始化 | ||
| 74 | byte[] result = cipher.doFinal(data); | ||
| 75 | return new String(result); | ||
| 76 | } catch (Exception e) { | ||
| 77 | log.error("decryptJsUserInfo:"+ e); | ||
| 78 | return null; | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | public static JSONObject decryptJsUserPhone(String encryptedData, String iv, String key) { | ||
| 83 | byte[] dataByte = java.util.Base64.getDecoder().decode(encryptedData); | ||
| 84 | // 加密秘钥 | ||
| 85 | byte[] keyByte = java.util.Base64.getDecoder().decode(key); | ||
| 86 | // 偏移量 | ||
| 87 | byte[] ivByte = java.util.Base64.getDecoder().decode(iv); | ||
| 88 | try { | ||
| 89 | // 如果密钥不足16位,那么就补足. 这个if 中的内容很重要 | ||
| 90 | int base = 16; | ||
| 91 | if (keyByte.length % base != 0) { | ||
| 92 | int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0); | ||
| 93 | byte[] temp = new byte[groups * base]; | ||
| 94 | Arrays.fill(temp, (byte) 0); | ||
| 95 | System.arraycopy(keyByte, 0, temp, 0, keyByte.length); | ||
| 96 | keyByte = temp; | ||
| 97 | } | ||
| 98 | // 初始化 | ||
| 99 | Security.addProvider(new BouncyCastleProvider()); | ||
| 100 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding","BC"); | ||
| 101 | SecretKeySpec spec = new SecretKeySpec(keyByte, "AES"); | ||
| 102 | AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES"); | ||
| 103 | parameters.init(new IvParameterSpec(ivByte)); | ||
| 104 | cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化 | ||
| 105 | byte[] resultByte = cipher.doFinal(dataByte); | ||
| 106 | if (null != resultByte && resultByte.length > 0) { | ||
| 107 | String result = new String(resultByte, "UTF-8"); | ||
| 108 | return JSONObject.parseObject(result); | ||
| 109 | } | ||
| 110 | } catch (Exception e) { | ||
| 111 | e.printStackTrace(); | ||
| 112 | } | ||
| 113 | return null; | ||
| 114 | } | ||
| 115 | } |
| 1 | package com.topdraw.weixin.applet; | ||
| 2 | |||
| 3 | import cn.hutool.http.HttpUtil; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | ||
| 5 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 6 | import com.topdraw.security.AESUtil; | ||
| 7 | import com.topdraw.utils.StringUtils; | ||
| 8 | import com.topdraw.weixin.beans.DefaultWeiXinBeanDefinition; | ||
| 9 | import com.topdraw.weixin.beans.WeiXinUserParser; | ||
| 10 | import com.topdraw.weixin.beans.config.WeiXinAppListConfig; | ||
| 11 | import com.topdraw.weixin.util.WeChatConstants; | ||
| 12 | import com.topdraw.weixin.util.WeiXinRequestUtil; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.beans.factory.annotation.Value; | ||
| 15 | import org.springframework.http.HttpMethod; | ||
| 16 | import org.springframework.http.ResponseEntity; | ||
| 17 | import org.springframework.stereotype.Component; | ||
| 18 | import org.springframework.web.client.RestTemplate; | ||
| 19 | |||
| 20 | import java.util.List; | ||
| 21 | import java.util.Map; | ||
| 22 | import java.util.Optional; | ||
| 23 | |||
| 24 | @Component | ||
| 25 | public class WeiXinAppletUserParser implements WeiXinUserParser { | ||
| 26 | |||
| 27 | @Autowired | ||
| 28 | private WeiXinAppListConfig weiXinAppListConfig; | ||
| 29 | |||
| 30 | @Autowired | ||
| 31 | private WeiXinRequestUtil weixinRequestUtil; | ||
| 32 | |||
| 33 | @Value("${uc.service.platform:}") | ||
| 34 | private String platform; | ||
| 35 | |||
| 36 | @Value("${key:}") | ||
| 37 | private String key; | ||
| 38 | |||
| 39 | @Value("${uc.app.subAppId:wx05f35931270014be}") | ||
| 40 | private String subAppId; | ||
| 41 | |||
| 42 | @Value("${uc.app.h5AppId:wxca962918dfeed88c}") | ||
| 43 | private String h5AppId; | ||
| 44 | |||
| 45 | @Value("${uc.app.appletAppid:wxc57d42de3d351cec}") | ||
| 46 | private String appletAppid; | ||
| 47 | |||
| 48 | @Value("${file.upload:upload}") | ||
| 49 | private String filePath; | ||
| 50 | |||
| 51 | @Override | ||
| 52 | public DefaultWeiXinBeanDefinition parse(WeiXinUserBean resources) { | ||
| 53 | String key = this.key; | ||
| 54 | Map<String, String> weixinInfoMap = null; | ||
| 55 | String appId = resources.getWxAppid(); | ||
| 56 | String code = resources.getWxCode(); | ||
| 57 | String userInfo = null; | ||
| 58 | |||
| 59 | if (StringUtils.isNotBlank(appId)) { | ||
| 60 | |||
| 61 | String decrypt = AESUtil.decrypt(appId, key); | ||
| 62 | |||
| 63 | if (decrypt != null) { | ||
| 64 | appId = decrypt.substring(16); | ||
| 65 | } | ||
| 66 | |||
| 67 | weixinInfoMap = getWeixinInfoByAppid(appId); | ||
| 68 | } | ||
| 69 | |||
| 70 | if (StringUtils.isNotBlank(code)) { | ||
| 71 | String decrypt = AESUtil.decrypt(code, key); | ||
| 72 | if (decrypt != null) { | ||
| 73 | code = decrypt.substring(16); | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | if (StringUtils.isNotBlank(userInfo)) { | ||
| 78 | String decrypt = AESUtil.decrypt(userInfo, key); | ||
| 79 | if (decrypt != null) { | ||
| 80 | userInfo = decrypt.substring(16); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | return this.generateWeiXinBeanDefinition(code,userInfo,weixinInfoMap); | ||
| 85 | } | ||
| 86 | |||
| 87 | /** | ||
| 88 | * | ||
| 89 | * @param code | ||
| 90 | * @param userInfo | ||
| 91 | * @param weixinInfoMap | ||
| 92 | * @return | ||
| 93 | */ | ||
| 94 | private DefaultWeiXinBeanDefinition generateWeiXinBeanDefinition(String code, String userInfo, Map<String, String> weixinInfoMap) { | ||
| 95 | String appId = weixinInfoMap.get("appid"); | ||
| 96 | String secret = weixinInfoMap.get("secret"); | ||
| 97 | JSONObject userInfoWxJo = null; | ||
| 98 | |||
| 99 | // 链接微信服务器 | ||
| 100 | /*ResponseEntity<String> responseEntity1 = null;*//*restTemplate.exchange(WeChatConstants.CODE2SESSION.replace("APPID", appId) | ||
| 101 | .replace("SECRET", secret).replace("JSCODE", code), | ||
| 102 | HttpMethod.GET, null, String.class);*//* | ||
| 103 | |||
| 104 | String entityBody1 = responseEntity1.getBody();*/ | ||
| 105 | |||
| 106 | String url = WeChatConstants.CODE2SESSION.replace("APPID", appId) | ||
| 107 | .replace("SECRET", secret).replace("JSCODE", code); | ||
| 108 | String entityBody = HttpUtil.get(url); | ||
| 109 | |||
| 110 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | ||
| 111 | |||
| 112 | String openId = jsonObject.getString("openid"); | ||
| 113 | String unionId = jsonObject.getString("unionid"); | ||
| 114 | |||
| 115 | if (StringUtils.isEmpty(unionId)) { | ||
| 116 | try { | ||
| 117 | userInfoWxJo = this.weixinRequestUtil.getUserInfo(weixinInfoMap, openId,code); | ||
| 118 | } catch (Exception e) { | ||
| 119 | e.printStackTrace(); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | if (StringUtils.isNotBlank(userInfo)) { | ||
| 124 | |||
| 125 | JSONObject userInfoJo = JSONObject.parseObject(userInfo); | ||
| 126 | String encryptedData = userInfoJo.getString("encryptedData"); | ||
| 127 | String iv = userInfoJo.getString("iv"); | ||
| 128 | String key = jsonObject.getString("session_key"); | ||
| 129 | String userInfoWeixin = AESUtil.decryptJsUserInfo(encryptedData, iv, key); | ||
| 130 | if (StringUtils.isNotEmpty(userInfoWeixin)) | ||
| 131 | userInfoWxJo = JSONObject.parseObject(userInfoWeixin); | ||
| 132 | } | ||
| 133 | |||
| 134 | DefaultWeiXinBeanDefinition weiXinBeanDefinition = | ||
| 135 | new DefaultWeiXinBeanDefinition(appId,code,unionId,openId,userInfoWxJo); | ||
| 136 | return weiXinBeanDefinition; | ||
| 137 | } | ||
| 138 | |||
| 139 | /** | ||
| 140 | * | ||
| 141 | * @param appid | ||
| 142 | * @return | ||
| 143 | */ | ||
| 144 | private Map<String, String> getWeixinInfoByAppid(String appid) { | ||
| 145 | if (StringUtils.isBlank(appid)) { | ||
| 146 | throw new RuntimeException("wxAppid can not be null"); | ||
| 147 | } | ||
| 148 | List<Map<String, String>> list = this.weiXinAppListConfig.getList(); | ||
| 149 | Optional<Map<String, String>> weixinInfoOptional = list.stream().filter(o -> o.get("appid").equals(appid)).findFirst(); | ||
| 150 | if (!weixinInfoOptional.isPresent()) { | ||
| 151 | throw new RuntimeException("wxAppid error, appid is : " + appid); | ||
| 152 | } | ||
| 153 | return weixinInfoOptional.get(); | ||
| 154 | } | ||
| 155 | |||
| 156 | } |
member-service-impl/src/main/java/com/topdraw/weixin/beans/DefaultWeiXinBeanDefinition.java
0 → 100644
| 1 | package com.topdraw.weixin.beans; | ||
| 2 | |||
| 3 | import cn.hutool.core.date.DateUtil; | ||
| 4 | import cn.hutool.http.HttpUtil; | ||
| 5 | import com.alibaba.fastjson.JSONObject; | ||
| 6 | import com.topdraw.exception.BadRequestException; | ||
| 7 | import com.topdraw.utils.StringUtils; | ||
| 8 | import lombok.Data; | ||
| 9 | import org.springframework.beans.factory.annotation.Value; | ||
| 10 | import org.springframework.stereotype.Component; | ||
| 11 | |||
| 12 | import java.io.File; | ||
| 13 | import java.nio.charset.StandardCharsets; | ||
| 14 | import java.util.Base64; | ||
| 15 | import java.util.Date; | ||
| 16 | import java.util.UUID; | ||
| 17 | |||
| 18 | @Data | ||
| 19 | @Component | ||
| 20 | public class DefaultWeiXinBeanDefinition implements WeiXinBeanDefinition { | ||
| 21 | |||
| 22 | // | ||
| 23 | private String appid; | ||
| 24 | |||
| 25 | private String openId; | ||
| 26 | |||
| 27 | private String code; | ||
| 28 | |||
| 29 | private String token; | ||
| 30 | |||
| 31 | private String secret; | ||
| 32 | |||
| 33 | private String unionId; | ||
| 34 | |||
| 35 | private String nickname; | ||
| 36 | |||
| 37 | private String headImgUrl; | ||
| 38 | |||
| 39 | private JSONObject userInfo; | ||
| 40 | |||
| 41 | private String phoneNumber; | ||
| 42 | |||
| 43 | @Value("${file.upload:upload}") | ||
| 44 | private String filePath; | ||
| 45 | |||
| 46 | public DefaultWeiXinBeanDefinition() { | ||
| 47 | } | ||
| 48 | |||
| 49 | public DefaultWeiXinBeanDefinition(String appId, String code,String unionId,String openId, JSONObject userInfoWxJo) { | ||
| 50 | |||
| 51 | this.userInfo = userInfoWxJo; | ||
| 52 | if (userInfo != null) { | ||
| 53 | |||
| 54 | if (StringUtils.isNotBlank(userInfoWxJo.getString("unionId"))) { | ||
| 55 | unionId = userInfoWxJo.getString("unionId"); | ||
| 56 | } | ||
| 57 | |||
| 58 | if (StringUtils.isNotBlank(userInfoWxJo.getString("openId"))) { | ||
| 59 | openId = userInfoWxJo.getString("openId"); | ||
| 60 | } | ||
| 61 | |||
| 62 | headImgUrl = userInfoWxJo.getString("avatarUrl"); | ||
| 63 | |||
| 64 | if (StringUtils.isNotBlank(userInfoWxJo.getString("nickName"))) { | ||
| 65 | nickname = Base64.getEncoder().encodeToString(userInfoWxJo.getString("nickName").getBytes(StandardCharsets.UTF_8)); | ||
| 66 | } | ||
| 67 | |||
| 68 | String phoneNumber = userInfoWxJo.getString("phoneNumber"); | ||
| 69 | if (StringUtils.isBlank(phoneNumber)) { | ||
| 70 | throw new BadRequestException("phoneNumber is null..."); | ||
| 71 | } | ||
| 72 | |||
| 73 | this.phoneNumber = phoneNumber; | ||
| 74 | |||
| 75 | if (StringUtils.isNotBlank(headImgUrl)) { | ||
| 76 | |||
| 77 | new Thread(() -> { | ||
| 78 | String s = UUID.randomUUID().toString(); | ||
| 79 | File file = new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd")); | ||
| 80 | if (!file.exists()) { | ||
| 81 | file.mkdirs(); | ||
| 82 | } | ||
| 83 | |||
| 84 | HttpUtil.downloadFile(headImgUrl, new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg")); | ||
| 85 | |||
| 86 | headImgUrl = filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg"; | ||
| 87 | }).start(); | ||
| 88 | |||
| 89 | } | ||
| 90 | |||
| 91 | } | ||
| 92 | |||
| 93 | this.unionId = unionId; | ||
| 94 | this.openId = openId; | ||
| 95 | this.appid = appId; | ||
| 96 | this.code = code; | ||
| 97 | } | ||
| 98 | |||
| 99 | @Override | ||
| 100 | public String getAppId() { | ||
| 101 | return this.appid; | ||
| 102 | } | ||
| 103 | |||
| 104 | @Override | ||
| 105 | public String getCode() { | ||
| 106 | return this.code; | ||
| 107 | } | ||
| 108 | |||
| 109 | @Override | ||
| 110 | public String getToken() { | ||
| 111 | return this.token; | ||
| 112 | } | ||
| 113 | |||
| 114 | @Override | ||
| 115 | public String getSecret() { | ||
| 116 | return this.secret; | ||
| 117 | } | ||
| 118 | |||
| 119 | @Override | ||
| 120 | public String getOpenId() { | ||
| 121 | return this.openId; | ||
| 122 | } | ||
| 123 | |||
| 124 | @Override | ||
| 125 | public String getUnionId() { | ||
| 126 | return this.unionId; | ||
| 127 | } | ||
| 128 | |||
| 129 | @Override | ||
| 130 | public String getNickname() { | ||
| 131 | return this.nickname; | ||
| 132 | } | ||
| 133 | |||
| 134 | @Override | ||
| 135 | public String getHeadImgUrl() { | ||
| 136 | return this.headImgUrl; | ||
| 137 | } | ||
| 138 | |||
| 139 | @Override | ||
| 140 | public JSONObject getUserInfo() { | ||
| 141 | return this.userInfo; | ||
| 142 | } | ||
| 143 | } |
| 1 | package com.topdraw.weixin.beans; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.annotation.JSONField; | ||
| 4 | import lombok.Data; | ||
| 5 | |||
| 6 | @Data | ||
| 7 | public class QrCode { | ||
| 8 | |||
| 9 | @JSONField(name = "action_name") | ||
| 10 | private String actionName; | ||
| 11 | |||
| 12 | @JSONField(name = "expire_seconds") | ||
| 13 | private Integer expireSeconds; | ||
| 14 | |||
| 15 | @JSONField(name = "action_info") | ||
| 16 | private ActionInfo actionInfo; | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | } |
| 1 | package com.topdraw.weixin.beans; | ||
| 2 | |||
| 3 | |||
| 4 | import lombok.AllArgsConstructor; | ||
| 5 | import lombok.Data; | ||
| 6 | import lombok.NoArgsConstructor; | ||
| 7 | |||
| 8 | @Data | ||
| 9 | @NoArgsConstructor | ||
| 10 | @AllArgsConstructor | ||
| 11 | public class WeiXinBean { | ||
| 12 | |||
| 13 | // | ||
| 14 | private String appid; | ||
| 15 | |||
| 16 | private String openId; | ||
| 17 | |||
| 18 | private String code; | ||
| 19 | |||
| 20 | private String token; | ||
| 21 | |||
| 22 | private String secret; | ||
| 23 | |||
| 24 | private String unionId; | ||
| 25 | |||
| 26 | private String nickname; | ||
| 27 | |||
| 28 | private String headImgUrl; | ||
| 29 | |||
| 30 | } |
| 1 | package com.topdraw.weixin.beans; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.JSONObject; | ||
| 4 | |||
| 5 | public interface WeiXinBeanDefinition { | ||
| 6 | |||
| 7 | String getAppId(); | ||
| 8 | |||
| 9 | String getCode(); | ||
| 10 | |||
| 11 | String getToken(); | ||
| 12 | |||
| 13 | String getSecret(); | ||
| 14 | |||
| 15 | String getOpenId(); | ||
| 16 | |||
| 17 | String getUnionId(); | ||
| 18 | |||
| 19 | String getNickname(); | ||
| 20 | |||
| 21 | String getHeadImgUrl(); | ||
| 22 | |||
| 23 | JSONObject getUserInfo(); | ||
| 24 | } |
| 1 | package com.topdraw.weixin.beans; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.annotation.JSONField; | ||
| 4 | import lombok.Data; | ||
| 5 | |||
| 6 | import java.util.Map; | ||
| 7 | |||
| 8 | @Data | ||
| 9 | public class WeiXinNotice { | ||
| 10 | |||
| 11 | @JSONField(serialize=false) | ||
| 12 | private String appid; | ||
| 13 | |||
| 14 | @JSONField(serialize=false) | ||
| 15 | private Long userId; | ||
| 16 | |||
| 17 | //目标用户 | ||
| 18 | @JSONField(name = "touser") | ||
| 19 | private String toUser; | ||
| 20 | |||
| 21 | // 模板code | ||
| 22 | @JSONField(serialize=false) | ||
| 23 | private String code; | ||
| 24 | |||
| 25 | // 模板id | ||
| 26 | @JSONField(name = "template_id") | ||
| 27 | private String templateId; | ||
| 28 | |||
| 29 | // 点击通知跳转页面 | ||
| 30 | private String page; | ||
| 31 | |||
| 32 | // 小程序版本 | ||
| 33 | @JSONField(name = "miniprogram_state") | ||
| 34 | private String miniprogramState; | ||
| 35 | |||
| 36 | // 填充数据 | ||
| 37 | private Map<String, Object> data; | ||
| 38 | } |
member-service-impl/src/main/java/com/topdraw/weixin/beans/config/WeiXinAppListConfig.java
0 → 100644
| 1 | package com.topdraw.weixin.beans.config; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import org.springframework.beans.factory.annotation.Value; | ||
| 5 | import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| 6 | import org.springframework.context.annotation.Configuration; | ||
| 7 | import org.springframework.stereotype.Component; | ||
| 8 | |||
| 9 | import java.util.List; | ||
| 10 | import java.util.Map; | ||
| 11 | |||
| 12 | @Data | ||
| 13 | @Configuration | ||
| 14 | @ConfigurationProperties(prefix = "weixin") | ||
| 15 | public class WeiXinAppListConfig { | ||
| 16 | |||
| 17 | private List<Map<String, String>> list; | ||
| 18 | |||
| 19 | /*@Value("${uc.service.platform:}") | ||
| 20 | private String platform; | ||
| 21 | |||
| 22 | @Value("${key:}") | ||
| 23 | private String key; | ||
| 24 | |||
| 25 | @Value("${uc.app.subAppId:wx05f35931270014be}") | ||
| 26 | private String subAppId; | ||
| 27 | |||
| 28 | @Value("${uc.app.h5AppId:wxca962918dfeed88c}") | ||
| 29 | private String h5AppId; | ||
| 30 | |||
| 31 | @Value("${uc.app.appletAppid:wxc57d42de3d351cec}") | ||
| 32 | private String appletAppid; | ||
| 33 | |||
| 34 | @Value("${file.upload:upload}") | ||
| 35 | private String filePath;*/ | ||
| 36 | |||
| 37 | } | ||
| 38 | |||
| 39 |
| 1 | package com.topdraw.weixin.util; | ||
| 2 | |||
| 3 | public class WeChatConstants { | ||
| 4 | |||
| 5 | public static String HTTPS_AUTHORIZE_WITH_SNSAPI_USERINFO = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; | ||
| 6 | |||
| 7 | public static final String HTTPS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token"; | ||
| 8 | |||
| 9 | public static final String HTTPS_TICKET_GETTICKET = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"; | ||
| 10 | |||
| 11 | public static final String HTTPS_SNS_OAUTH2_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token"; | ||
| 12 | |||
| 13 | public static final String HTTPS_SNS_USERINFO = "https://api.weixin.qq.com/sns/userinfo"; | ||
| 14 | |||
| 15 | public static final String CODE2SESSION = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code"; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * 把媒体文件上传到微信服务器。目前仅支持图片。用于发送客服消息或被动回复用户消息。 | ||
| 19 | */ | ||
| 20 | public static String UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={0}&type=image"; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * 获取客服消息内的临时素材。即下载临时的多媒体文件。 | ||
| 24 | */ | ||
| 25 | public static String GET_MEDIA = "https://api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}"; | ||
| 26 | |||
| 27 | /** | ||
| 28 | * 用于向微信服务端申请二维码的url | ||
| 29 | */ | ||
| 30 | public static String URL_QR_CODE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}"; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * 用于聊天时向用户发送消息的url | ||
| 34 | */ | ||
| 35 | public static String CUSTOM_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}"; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * 发送小程序订阅消息 | ||
| 39 | */ | ||
| 40 | public static final String SUBSCRIBE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={0}"; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * 生成带参数二维码 | ||
| 44 | */ | ||
| 45 | public static final String QR_CODE_URL = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={0}"; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * 获取用户基本信息 | ||
| 49 | */ | ||
| 50 | public static final String GET_USER_INFO = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN"; | ||
| 51 | |||
| 52 | |||
| 53 | // 批量获取关注者列表 | ||
| 54 | public static final String GET_USER_LIST = "https://api.weixin.qq.com/cgi-bin/user/get?access_token={0}&next_openid={1}"; | ||
| 55 | |||
| 56 | /** | ||
| 57 | * 成功 | ||
| 58 | */ | ||
| 59 | public static String SUCCESS = "SUCCESS"; | ||
| 60 | |||
| 61 | /** | ||
| 62 | * 微信系统错误 | ||
| 63 | */ | ||
| 64 | public static String SYSTEMERROR = "SYSTEMERROR"; | ||
| 65 | |||
| 66 | /** | ||
| 67 | * 失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示) | ||
| 68 | */ | ||
| 69 | public static String FAIL = "FAIL"; | ||
| 70 | |||
| 71 | /** | ||
| 72 | * 微信企业付款到个人失败 (注意:微信有的接口返回的失败用FAIL字符串表示,有的接口用FAILED表示) | ||
| 73 | */ | ||
| 74 | public static String FAILED = "FAILED"; | ||
| 75 | |||
| 76 | public static String ACCESS_TOKEN = "access_token"; | ||
| 77 | |||
| 78 | public static String ERR_CODE = "errcode"; | ||
| 79 | |||
| 80 | /** | ||
| 81 | * 微信请求时,返回ACCESS_TOKEN错误码 | ||
| 82 | */ | ||
| 83 | public static final String ACCESS_TOKEN_INVALID_CODE = "40001"; | ||
| 84 | |||
| 85 | |||
| 86 | /** | ||
| 87 | * 文本消息 | ||
| 88 | */ | ||
| 89 | public static String MSG_TYPE_TEXT = "text"; | ||
| 90 | |||
| 91 | public static String MSG_TYPE_MINIPROGRAMPAGE = "miniprogrampage"; | ||
| 92 | |||
| 93 | public static String MSG_TYPE_LINK = "link"; | ||
| 94 | |||
| 95 | public static String MSG_TYPE_IMAGE = "image"; | ||
| 96 | |||
| 97 | /** | ||
| 98 | * 事件消息 | ||
| 99 | */ | ||
| 100 | public static String MSG_TYPE_EVENT = "event"; | ||
| 101 | |||
| 102 | |||
| 103 | /** | ||
| 104 | * 二维码类型,临时的整型参数值 | ||
| 105 | */ | ||
| 106 | public static String QR_SCENE = "QR_SCENE"; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * 二维码类型,临时的字符串参数值 | ||
| 110 | */ | ||
| 111 | public static String QR_STR_SCENE = "QR_STR_SCENE"; | ||
| 112 | |||
| 113 | /** | ||
| 114 | * 二维码类型,永久的整型参数值 | ||
| 115 | */ | ||
| 116 | public static String QR_LIMIT_SCENE = "QR_LIMIT_SCENE"; | ||
| 117 | |||
| 118 | /** | ||
| 119 | * 二维码类型,永久的字符串参数值 | ||
| 120 | */ | ||
| 121 | public static String QR_LIMIT_STR_SCENE = "QR_LIMIT_STR_SCENE"; | ||
| 122 | |||
| 123 | |||
| 124 | /******** 事件推送事件类型BEGIN********/ | ||
| 125 | |||
| 126 | /** | ||
| 127 | * 取消订阅 | ||
| 128 | */ | ||
| 129 | public static final String EVENT_UNSUBSCRIBE = "unsubscribe"; | ||
| 130 | |||
| 131 | |||
| 132 | /** | ||
| 133 | * 订阅 | ||
| 134 | */ | ||
| 135 | public static final String EVENT_SUBSCRIBE = "subscribe"; | ||
| 136 | |||
| 137 | /** | ||
| 138 | * 扫描带参数二维码事件,用户已关注时的事件推送 | ||
| 139 | */ | ||
| 140 | public static final String EVENT_SCAN = "SCAN"; | ||
| 141 | |||
| 142 | /** | ||
| 143 | * 上报地理位置事件 | ||
| 144 | */ | ||
| 145 | public static final String EVENT_LOCATION = "LOCATION"; | ||
| 146 | |||
| 147 | /** | ||
| 148 | * 自定义菜单事件 | ||
| 149 | */ | ||
| 150 | public static final String EVENT_CLICK = "CLICK"; | ||
| 151 | |||
| 152 | /******** 事件推送事件类型END********/ | ||
| 153 | |||
| 154 | |||
| 155 | /** | ||
| 156 | * 微信ACCESS_TOKEN缓存KEY | ||
| 157 | */ | ||
| 158 | public static final String TOKEN_KEY = "GLOBAL_WX_ACCESS_TOKEN_"; | ||
| 159 | |||
| 160 | |||
| 161 | /** | ||
| 162 | * 微信临时素材缓存KEY | ||
| 163 | */ | ||
| 164 | public static final String WEIXIN_MEDIA_KEY = "WEIXIN_MEDIA_KEY_"; | ||
| 165 | |||
| 166 | // 微信应用类型 小程序 服务号 订阅号 | ||
| 167 | // 小程序 | ||
| 168 | public static final String WX_APPLET = "applet"; | ||
| 169 | // 服务号 | ||
| 170 | public static final String WX_SERVICE = "service"; | ||
| 171 | // 订阅号 | ||
| 172 | public static final String WX_SUBSCRIPTION = "subscription"; | ||
| 173 | |||
| 174 | |||
| 175 | } |
| 1 | package com.topdraw.weixin.util; | ||
| 2 | |||
| 3 | import cn.hutool.core.util.StrUtil; | ||
| 4 | import cn.hutool.http.HttpRequest; | ||
| 5 | import cn.hutool.http.HttpResponse; | ||
| 6 | import com.alibaba.fastjson.JSON; | ||
| 7 | import com.alibaba.fastjson.JSONObject; | ||
| 8 | import com.topdraw.utils.RedisUtils; | ||
| 9 | import com.topdraw.utils.StringUtils; | ||
| 10 | import com.topdraw.weixin.beans.QrCode; | ||
| 11 | import com.topdraw.weixin.beans.WeiXinNotice; | ||
| 12 | import lombok.extern.slf4j.Slf4j; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.retry.annotation.Backoff; | ||
| 15 | import org.springframework.retry.annotation.Retryable; | ||
| 16 | import org.springframework.stereotype.Component; | ||
| 17 | |||
| 18 | import java.io.File; | ||
| 19 | import java.io.IOException; | ||
| 20 | import java.net.URLEncoder; | ||
| 21 | import java.text.MessageFormat; | ||
| 22 | import java.util.HashMap; | ||
| 23 | import java.util.Map; | ||
| 24 | import java.util.concurrent.TimeUnit; | ||
| 25 | |||
| 26 | @Component | ||
| 27 | @Slf4j | ||
| 28 | public class WeiXinRequestUtil { | ||
| 29 | |||
| 30 | @Autowired | ||
| 31 | private RedisUtils redisUtils; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * | ||
| 35 | * */ | ||
| 36 | private static String doGet(String url, Map<String, String> param) { | ||
| 37 | String result = null; | ||
| 38 | try { | ||
| 39 | String queryString = ""; | ||
| 40 | if (null != param) { | ||
| 41 | for (Map.Entry<String, String> entry : param.entrySet()) { | ||
| 42 | queryString += entry.getKey() + "=" + URLEncoder.encode("" + entry.getValue(), "UTF-8") + "&"; | ||
| 43 | } | ||
| 44 | if (queryString.length() > 0) { | ||
| 45 | queryString = queryString.substring(0, queryString.length() - 1); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | log.info("weixin request: " + url + "?" + queryString); | ||
| 49 | HttpResponse response = HttpRequest.get(url + "?" + queryString).execute(); | ||
| 50 | if (response.isOk()) { | ||
| 51 | result = response.body(); | ||
| 52 | log.info("weixin response: " + result); | ||
| 53 | } | ||
| 54 | } catch (Exception e) { | ||
| 55 | e.printStackTrace(); | ||
| 56 | } | ||
| 57 | return result; | ||
| 58 | } | ||
| 59 | |||
| 60 | private String wx_token(String appid, String secret) { | ||
| 61 | Map<String, String> param = new HashMap<>(); | ||
| 62 | param.put("grant_type", "client_credential"); | ||
| 63 | param.put("appid", appid); | ||
| 64 | param.put("secret", secret); | ||
| 65 | return this.doGet(WeChatConstants.HTTPS_TOKEN, param); | ||
| 66 | } | ||
| 67 | |||
| 68 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 69 | public String wx_ticket_getticket(String appid, String secret) { | ||
| 70 | String token = getToken(appid, secret,null); | ||
| 71 | Map<String, String> param = new HashMap<>(); | ||
| 72 | param.put("access_token", token); | ||
| 73 | param.put("type", "jsapi"); | ||
| 74 | return doGet(WeChatConstants.HTTPS_TICKET_GETTICKET, param); | ||
| 75 | } | ||
| 76 | |||
| 77 | public String wx_sns_oauth2_access_token(String appid, String secret, String code) { | ||
| 78 | Map<String, String> param = new HashMap<>(); | ||
| 79 | param.put("appid", appid); | ||
| 80 | param.put("secret", secret); | ||
| 81 | param.put("code", code); | ||
| 82 | param.put("grant_type", "authorization_code"); | ||
| 83 | return doGet(WeChatConstants.HTTPS_SNS_OAUTH2_ACCESS_TOKEN, param); | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | public String wx_sns_userinfo(String oauth2_access_token, String openid) { | ||
| 88 | Map<String, String> param = new HashMap<>(); | ||
| 89 | param.put("access_token", oauth2_access_token); | ||
| 90 | param.put("openid", openid); | ||
| 91 | param.put("lang", "zh_CN"); | ||
| 92 | return doGet(WeChatConstants.HTTPS_SNS_USERINFO, param); | ||
| 93 | } | ||
| 94 | |||
| 95 | public String wx_get_userinfo(String oauth2_access_token, String openid) { | ||
| 96 | Map<String, String> param = new HashMap<>(); | ||
| 97 | param.put("access_token", oauth2_access_token); | ||
| 98 | param.put("openid", openid); | ||
| 99 | param.put("lang", "zh_CN"); | ||
| 100 | return doGet(WeChatConstants.GET_USER_INFO, param); | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | public String getToken(String appid, String secret,String code) { | ||
| 105 | String token = (String) redisUtils.get(WeChatConstants.TOKEN_KEY + appid); | ||
| 106 | if (StringUtils.isNotBlank(token)) { | ||
| 107 | return token; | ||
| 108 | } | ||
| 109 | token = this.getTokenNoRedis(appid, secret,code); | ||
| 110 | return token; | ||
| 111 | } | ||
| 112 | |||
| 113 | public String getToken(String appid, String secret) { | ||
| 114 | String token = (String) redisUtils.get(WeChatConstants.TOKEN_KEY + appid); | ||
| 115 | if (StringUtils.isNotBlank(token)) { | ||
| 116 | return token; | ||
| 117 | } | ||
| 118 | token = this.getTokenNoRedis(appid, secret,null); | ||
| 119 | return token; | ||
| 120 | } | ||
| 121 | |||
| 122 | public String getTokenNoRedis(String appid, String secret,String code) { | ||
| 123 | String token = null; | ||
| 124 | String response = this.wx_token(appid, secret); | ||
| 125 | // String response = this.wx_sns_oauth2_access_token(appid, secret,code); | ||
| 126 | try { | ||
| 127 | JSONObject joToken = JSON.parseObject(response); | ||
| 128 | if (null != joToken && null != joToken.getString("access_token")) { | ||
| 129 | token = joToken.getString("access_token"); | ||
| 130 | Integer expiresIn = joToken.getInteger("expires_in"); | ||
| 131 | redisUtils.set(WeChatConstants.TOKEN_KEY + appid, token, expiresIn, TimeUnit.SECONDS); | ||
| 132 | } | ||
| 133 | } catch (Exception e) { | ||
| 134 | e.printStackTrace(); | ||
| 135 | } | ||
| 136 | return token; | ||
| 137 | } | ||
| 138 | |||
| 139 | public String getTokenNoRedis(String appid, String secret) { | ||
| 140 | String token = null; | ||
| 141 | // String response = this.wx_token(appid, secret); | ||
| 142 | String response = this.wx_sns_oauth2_access_token(appid, secret,null); | ||
| 143 | try { | ||
| 144 | JSONObject joToken = JSON.parseObject(response); | ||
| 145 | if (null != joToken && null != joToken.getString("access_token")) { | ||
| 146 | token = joToken.getString("access_token"); | ||
| 147 | Integer expiresIn = joToken.getInteger("expires_in"); | ||
| 148 | redisUtils.set(WeChatConstants.TOKEN_KEY + appid, token, expiresIn, TimeUnit.SECONDS); | ||
| 149 | } | ||
| 150 | } catch (Exception e) { | ||
| 151 | e.printStackTrace(); | ||
| 152 | } | ||
| 153 | return token; | ||
| 154 | } | ||
| 155 | |||
| 156 | /** | ||
| 157 | * 发送订阅消息,access_token错误时,重新获取进行重试 | ||
| 158 | * | ||
| 159 | * @param weixinInfo 微信参数 | ||
| 160 | * @param request 订阅消息内容 | ||
| 161 | */ | ||
| 162 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 163 | public void sendNotice(Map<String, String> weixinInfo, WeiXinNotice request) { | ||
| 164 | String accessToken = getToken(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 165 | String url = MessageFormat.format(WeChatConstants.SUBSCRIBE_SEND_URL, accessToken); | ||
| 166 | log.info("send notice request : " + JSONObject.toJSONString(request)); | ||
| 167 | HttpResponse response = HttpRequest.post(url).body(JSONObject.toJSONString(request), "application/json;charset=utf-8").execute(); | ||
| 168 | if (!response.isOk()) { | ||
| 169 | log.error("send notice error || {}", response); | ||
| 170 | throw new RuntimeException("send notice error"); | ||
| 171 | } | ||
| 172 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 173 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 174 | if (errCode != null && errCode != 0) { | ||
| 175 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 176 | getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 177 | } | ||
| 178 | |||
| 179 | // 返回errCode时,也输出返回的结果信息 | ||
| 180 | log.error("send notice error || {}", response.body()); | ||
| 181 | throw new RuntimeException("send notice error"); | ||
| 182 | } | ||
| 183 | log.info("send notice response : " + response.body()); | ||
| 184 | } | ||
| 185 | |||
| 186 | |||
| 187 | /** | ||
| 188 | * 微信小程序客服发送消息,access_token错误时,重新获取进行重试 | ||
| 189 | * | ||
| 190 | * @param weixinInfo 微信参数 | ||
| 191 | * @param body 消息内容 | ||
| 192 | */ | ||
| 193 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 194 | public void sendMessage(Map<String, String> weixinInfo, String body) { | ||
| 195 | String accessToken = getToken(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 196 | String url = MessageFormat.format(WeChatConstants.CUSTOM_SEND_URL, accessToken); | ||
| 197 | HttpResponse response = HttpRequest.post(url).body(body, "application/json;charset=utf-8").execute(); | ||
| 198 | if (!response.isOk()) { | ||
| 199 | log.error("send message error || {}", response); | ||
| 200 | throw new RuntimeException("send message error"); | ||
| 201 | } | ||
| 202 | log.info("send message response || {}", response.body()); | ||
| 203 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 204 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 205 | if (errCode != null && errCode != 0) { | ||
| 206 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 207 | getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 208 | } | ||
| 209 | throw new RuntimeException("send message error"); | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | /** | ||
| 214 | * 上传临时素材返回mediaId,access_token错误时,重新获取进行重试 | ||
| 215 | * | ||
| 216 | * @param weixinInfo 微信参数 | ||
| 217 | * @param imagePath 素材路径 | ||
| 218 | */ | ||
| 219 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 220 | public String getMediaId(Map<String, String> weixinInfo, String imagePath) throws IOException { | ||
| 221 | String accessToken = getToken(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 222 | String mediaId = (String) redisUtils.get(WeChatConstants.WEIXIN_MEDIA_KEY + weixinInfo.get("appid")); | ||
| 223 | if (StringUtils.isNotBlank(mediaId)) { | ||
| 224 | return mediaId; | ||
| 225 | } | ||
| 226 | String url = MessageFormat.format(WeChatConstants.UPLOAD_URL, accessToken); | ||
| 227 | HttpResponse response = HttpRequest.post(url).form("file", new File(imagePath)).execute(); | ||
| 228 | if (!response.isOk()) { | ||
| 229 | log.error("upload image error || {}", response); | ||
| 230 | throw new RuntimeException("upload image error"); | ||
| 231 | } | ||
| 232 | log.info("upload image response || {}", response.body()); | ||
| 233 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 234 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 235 | if (errCode != null && errCode != 0) { | ||
| 236 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 237 | getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 238 | } | ||
| 239 | throw new RuntimeException("upload image error"); | ||
| 240 | } | ||
| 241 | mediaId = jsonObject.getString("media_id"); | ||
| 242 | redisUtils.set(WeChatConstants.WEIXIN_MEDIA_KEY + weixinInfo.get("appid"), mediaId, 60, TimeUnit.HOURS); | ||
| 243 | return mediaId; | ||
| 244 | } | ||
| 245 | |||
| 246 | /** | ||
| 247 | * 公众号获取带参数二维码,access_token错误时,重新获取进行重试 | ||
| 248 | * | ||
| 249 | * @param weixinInfo 微信参数 | ||
| 250 | * @param qrCode 二维码信息 | ||
| 251 | */ | ||
| 252 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 253 | public JSONObject getQrCode(Map<String, String> weixinInfo, QrCode qrCode) throws IOException { | ||
| 254 | String accessToken = getToken(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 255 | String url = MessageFormat.format(WeChatConstants.QR_CODE_URL, accessToken); | ||
| 256 | HttpResponse response = HttpRequest.post(url).body(JSONObject.toJSONString(qrCode), "application/json;charset=utf-8").execute(); | ||
| 257 | if (!response.isOk()) { | ||
| 258 | log.error("get qrCode error || {}", response); | ||
| 259 | throw new RuntimeException("get qrCode error"); | ||
| 260 | } | ||
| 261 | log.info("get qrCode response || {}", response.body()); | ||
| 262 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 263 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 264 | if (errCode != null && errCode != 0) { | ||
| 265 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 266 | getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 267 | } | ||
| 268 | throw new RuntimeException("get qrCode error"); | ||
| 269 | } | ||
| 270 | return jsonObject; | ||
| 271 | } | ||
| 272 | |||
| 273 | /** | ||
| 274 | * 公众号获取用户信息,access_token错误时,重新获取进行重试 | ||
| 275 | * | ||
| 276 | * @param weixinInfo 微信参数 | ||
| 277 | * @param openid 用户openid | ||
| 278 | */ | ||
| 279 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 280 | public JSONObject getUserInfo(Map<String, String> weixinInfo, String openid,String code) throws IOException { | ||
| 281 | String accessToken = this.getToken(weixinInfo.get("appid"), weixinInfo.get("secret"),code); | ||
| 282 | String url = MessageFormat.format(WeChatConstants.GET_USER_INFO, accessToken, openid); | ||
| 283 | // String url = MessageFormat.format(WeChatConstants.HTTPS_SNS_USERINFO, accessToken, openid); | ||
| 284 | // String url = MessageFormat.format(WeChatConstants.HTTPS_AUTHORIZE_WITH_SNSAPI_USERINFO, accessToken, openid); | ||
| 285 | HttpResponse response = HttpRequest.get(url).execute(); | ||
| 286 | if (!response.isOk()) { | ||
| 287 | log.error("get userInfo error || {}", response); | ||
| 288 | throw new RuntimeException("get userInfo error"); | ||
| 289 | } | ||
| 290 | log.info("get userInfo response || {}", response.body()); | ||
| 291 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 292 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 293 | if (errCode != null && errCode != 0) { | ||
| 294 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 295 | this.getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 296 | } | ||
| 297 | throw new RuntimeException("get userInfo error"); | ||
| 298 | } | ||
| 299 | return jsonObject; | ||
| 300 | } | ||
| 301 | |||
| 302 | /** | ||
| 303 | * @param weixinInfo | ||
| 304 | * @param nextOpenId | ||
| 305 | * @return com.alibaba.fastjson.JSONObject | ||
| 306 | * @description 公众号批量获取关注者列表,不传nextOpenId默认从头开始拉取,引用重试机制 | ||
| 307 | * @author Hongyan Wang | ||
| 308 | * @date 2021/9/2 9:42 上午 | ||
| 309 | */ | ||
| 310 | @Retryable(value = Exception.class, maxAttempts = 2, backoff = @Backoff(delay = 0L, multiplier = 0.0)) | ||
| 311 | public JSONObject getUserList(Map<String, String> weixinInfo, String nextOpenId) { | ||
| 312 | String accessToken = getToken(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 313 | // 不传next_openid,默认从头开始拉取 | ||
| 314 | if (StrUtil.isBlank(nextOpenId)) | ||
| 315 | nextOpenId = ""; | ||
| 316 | String url = MessageFormat.format(WeChatConstants.GET_USER_LIST, accessToken, nextOpenId); | ||
| 317 | HttpResponse response = HttpRequest.get(url).execute(); | ||
| 318 | if (!response.isOk()) { | ||
| 319 | log.error("get userList error || {}", response); | ||
| 320 | throw new RuntimeException("get userList error"); | ||
| 321 | } | ||
| 322 | log.info("get userList response || {}", response.body()); | ||
| 323 | //返回Json样例 | ||
| 324 | // { | ||
| 325 | // "total":2, | ||
| 326 | // "count":2, | ||
| 327 | // "data":{ | ||
| 328 | // "openid":["OPENID1","OPENID2"]}, | ||
| 329 | // "next_openid":"NEXT_OPENID" | ||
| 330 | //} | ||
| 331 | JSONObject jsonObject = JSONObject.parseObject(response.body()); | ||
| 332 | Integer errCode = jsonObject.getInteger(WeChatConstants.ERR_CODE); | ||
| 333 | if (errCode != null && errCode != 0) { | ||
| 334 | if (WeChatConstants.ACCESS_TOKEN_INVALID_CODE.equals(errCode.toString())) { | ||
| 335 | getTokenNoRedis(weixinInfo.get("appid"), weixinInfo.get("secret")); | ||
| 336 | } | ||
| 337 | throw new RuntimeException("get userList error"); | ||
| 338 | } | ||
| 339 | return jsonObject; | ||
| 340 | } | ||
| 341 | |||
| 342 | } |
| ... | @@ -6,14 +6,6 @@ spring: | ... | @@ -6,14 +6,6 @@ spring: |
| 6 | username: root | 6 | username: root |
| 7 | password: Tjlh@2017 | 7 | password: Tjlh@2017 |
| 8 | 8 | ||
| 9 | |||
| 10 | # url: jdbc:log4jdbc:mysql://47.100.212.170:3306/ucs?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
| 11 | # username: root | ||
| 12 | # password: Tjlh@2021 | ||
| 13 | |||
| 14 | # url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | ||
| 15 | # username: root | ||
| 16 | # password: root | ||
| 17 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 9 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
| 18 | #Druid | 10 | #Druid |
| 19 | type: com.alibaba.druid.pool.DruidDataSource | 11 | type: com.alibaba.druid.pool.DruidDataSource |
| ... | @@ -62,20 +54,8 @@ spring: | ... | @@ -62,20 +54,8 @@ spring: |
| 62 | # host: 139.196.4.234 | 54 | # host: 139.196.4.234 |
| 63 | port: 6379 | 55 | port: 6379 |
| 64 | password: redis123 | 56 | password: redis123 |
| 65 | # password: | ||
| 66 | #连接超时时间 | 57 | #连接超时时间 |
| 67 | timeout: 5000 | 58 | timeout: 5000 |
| 68 | # rabbitmq: | ||
| 69 | # host: 47.100.212.170 # rabbitmq的连接地址 | ||
| 70 | ## host: 122.112.214.149 # rabbitmq的连接地址 | ||
| 71 | # #host: 139.196.192.242 # rabbitmq的连接地址 | ||
| 72 | # port: 5672 # rabbitmq的连接端口号 | ||
| 73 | # #virtual-host: /member_center # rabbitmq的虚拟host | ||
| 74 | # #username: member_center # rabbitmq的用户名 | ||
| 75 | # #password: Tjlh@2021 # rabbitmq的密码 | ||
| 76 | # virtual-host: test # rabbitmq的虚拟host | ||
| 77 | # username: omo_test # rabbitmq的用户名 | ||
| 78 | # password: omo_test # rabbitmq的密码 | ||
| 79 | rabbitmq: | 59 | rabbitmq: |
| 80 | host: 139.196.145.150 # rabbitmq的连接地址 | 60 | host: 139.196.145.150 # rabbitmq的连接地址 |
| 81 | port: 5672 # rabbitmq的连接端口号 | 61 | port: 5672 # rabbitmq的连接端口号 |
| ... | @@ -107,3 +87,54 @@ generator: | ... | @@ -107,3 +87,54 @@ generator: |
| 107 | swagger: | 87 | swagger: |
| 108 | enabled: true | 88 | enabled: true |
| 109 | 89 | ||
| 90 | file: | ||
| 91 | path: system/file | ||
| 92 | avatar: system/avatar | ||
| 93 | upload: upload | ||
| 94 | # 文件大小 /M | ||
| 95 | maxSize: 100 | ||
| 96 | avatarMaxSize: 5 | ||
| 97 | |||
| 98 | key: 529ec7fe7bb54c38 | ||
| 99 | |||
| 100 | uc: | ||
| 101 | service: | ||
| 102 | platform: service | ||
| 103 | type: mobile | ||
| 104 | app: | ||
| 105 | subAppId: wx5d88c7fe99f89f32 | ||
| 106 | #服务号:品运营讨论探究创造团 | ||
| 107 | h5AppId: wx37ea49702cdc693b | ||
| 108 | #熊猫小程序:熊猫少儿创造团 | ||
| 109 | appletAppid: wxfaa765183a332521 | ||
| 110 | weixin: | ||
| 111 | list: | ||
| 112 | - appid: wxfaa765183a332521 | ||
| 113 | secret: b5c1c39cb95b45b599a02fd68b5fcf17 | ||
| 114 | token: | ||
| 115 | encodingAesKey: | ||
| 116 | imagePath: | ||
| 117 | content: 长按识别二维码,加入微信群。 | ||
| 118 | miniprogramState: formal | ||
| 119 | # 点击模板卡片后的默认跳转页面 | ||
| 120 | page: pages/index/main | ||
| 121 | # 生成带参数二维码的有效期 | ||
| 122 | qrCodeExpireSeconds: 86400 | ||
| 123 | env: dev | ||
| 124 | # 订阅号 | ||
| 125 | - appid: wx5d88c7fe99f89f32 | ||
| 126 | secret: b213afe99a469d4be576f330dad643b8 | ||
| 127 | token: topdraw | ||
| 128 | encodingAesKey: g3mYB6yx2ZiebxwKcI1H2iw3LlYNBHb7PqsVYFHUQzi | ||
| 129 | # 应用类型 小程序 服务号 订阅号, 当前基于订阅号有特殊逻辑 | ||
| 130 | appType: subscription | ||
| 131 | imagePath: /topdraw/app/user_center_service_te/upload/customer/weChat.png | ||
| 132 | content: 长按识别二维码,关注订阅号。 | ||
| 133 | miniprogramState: formal | ||
| 134 | # 点击模板卡片后的默认跳转页面 | ||
| 135 | page: pages/index/main | ||
| 136 | # 生成带参数二维码的有效期 | ||
| 137 | qrCodeExpireSeconds: 300 | ||
| 138 | env: dev | ||
| 139 | |||
| 140 | ... | ... |
| 1 | package com.topdraw; | 1 | package com.topdraw; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.alibaba.fastjson.JSONObject; | ||
| 5 | import com.topdraw.module.mq.DataSyncMsg; | ||
| 4 | import org.junit.runner.RunWith; | 6 | import org.junit.runner.RunWith; |
| 5 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| ... | @@ -21,16 +23,8 @@ public class BaseTest { | ... | @@ -21,16 +23,8 @@ public class BaseTest { |
| 21 | } | 23 | } |
| 22 | 24 | ||
| 23 | public static void main(String[] args) { | 25 | public static void main(String[] args) { |
| 24 | String a = "<p>gfdsgf <video controls=\"controls\" width=\"300\" height=\"150\">\n" + | 26 | String param = "{\"category\":\"common_member\"}"; |
| 25 | "<source src=\"dddd\" /></video></p>"; | 27 | DataSyncMsg.TaskTemplateParam taskTemplateParam = JSONObject.parseObject(param, DataSyncMsg.TaskTemplateParam.class); |
| 26 | 28 | System.out.println(taskTemplateParam); | |
| 27 | String c = "<p>测试正文<br /><br /><video controls=\"controls\" width=\"360\" height=\"180\">\n" + | ||
| 28 | "<source src=\"test\" /></video></p>"; | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | String b = "{{nas-base-url.cms-upload}}/upload/commonFile/theme_activity/2021-12-15/aebd8dbb-87bb-4523-921f-4354c3298fdd.mp4"; | ||
| 33 | String s = replaceUrl(c, b); | ||
| 34 | System.out.println(s); | ||
| 35 | } | 29 | } |
| 36 | } | 30 | } | ... | ... |
| ... | @@ -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_user_weixin"; | 42 | var dbName = "tr_task_attr"; |
| 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.business.basicdata.user."; | 49 | var preRoute = "com.topdraw.business.module.task."; |
| 50 | StringBuilder builder = new StringBuilder(preRoute); | 50 | StringBuilder builder = new StringBuilder(preRoute); |
| 51 | builder.append("weixin"); | 51 | builder.append("attribute"); |
| 52 | // builder.append(target); | 52 | // builder.append(target); |
| 53 | 53 | ||
| 54 | tableNames.forEach(tableName -> { | 54 | tableNames.forEach(tableName -> { | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.member; | 1 | package com.topdraw.test.business.basicdata.member; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.rest.MemberController; | 3 | import com.topdraw.business.module.member.rest.MemberController; |
| 4 | import com.topdraw.business.basicdata.member.service.MemberService; | 4 | import com.topdraw.business.module.member.service.MemberService; |
| 5 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | ||
| 6 | import com.topdraw.BaseTest; | 5 | import com.topdraw.BaseTest; |
| 7 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 8 | import org.junit.Test; | 7 | import org.junit.Test; | ... | ... |
| ... | @@ -2,10 +2,8 @@ package com.topdraw.test.business.basicdata.member.profile; | ... | @@ -2,10 +2,8 @@ package com.topdraw.test.business.basicdata.member.profile; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.BaseTest; | 4 | import com.topdraw.BaseTest; |
| 5 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 6 | import com.topdraw.business.basicdata.member.profile.service.MemberProfileService; | 6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 7 | import com.topdraw.business.basicdata.member.service.MemberService; | ||
| 8 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | ||
| 9 | import com.topdraw.util.TimestampUtil; | 7 | import com.topdraw.util.TimestampUtil; |
| 10 | import org.junit.Test; | 8 | import org.junit.Test; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.member.rest; | 1 | package com.topdraw.test.business.basicdata.member.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.business.basicdata.member.address.domain.MemberAddress; | 4 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 5 | import com.topdraw.business.basicdata.member.address.rest.MemberAddressController; | 5 | import com.topdraw.business.module.member.address.rest.MemberAddressController; |
| 6 | import com.topdraw.business.basicdata.member.address.service.dto.MemberAddressQueryCriteria; | 6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; |
| 7 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 8 | import com.topdraw.BaseTest; | 8 | import com.topdraw.BaseTest; |
| 9 | import org.junit.Test; | 9 | import org.junit.Test; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.member.rest; | 1 | package com.topdraw.test.business.basicdata.member.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.basicdata.member.rest.MemberController; | 5 | import com.topdraw.business.module.member.rest.MemberController; |
| 6 | import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria; | ||
| 7 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 8 | import com.topdraw.BaseTest; | 7 | import com.topdraw.BaseTest; |
| 9 | import com.topdraw.util.IdWorker; | 8 | import com.topdraw.util.IdWorker; |
| 10 | import com.topdraw.util.TimestampUtil; | 9 | import com.topdraw.util.TimestampUtil; |
| 11 | import org.junit.Test; | 10 | import org.junit.Test; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.data.domain.PageRequest; | ||
| 14 | import org.springframework.data.domain.Pageable; | ||
| 15 | 12 | ||
| 16 | public class MemberControllerTest extends BaseTest { | 13 | public class MemberControllerTest extends BaseTest { |
| 17 | 14 | ... | ... |
| ... | @@ -2,9 +2,8 @@ package com.topdraw.test.business.basicdata.member.rest; | ... | @@ -2,9 +2,8 @@ package com.topdraw.test.business.basicdata.member.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.BaseTest; | 4 | import com.topdraw.BaseTest; |
| 5 | import com.topdraw.business.basicdata.member.profile.domain.MemberProfile; | 5 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
| 6 | import com.topdraw.business.basicdata.member.profile.rest.MemberProfileController; | 6 | import com.topdraw.business.module.member.profile.rest.MemberProfileController; |
| 7 | import com.topdraw.business.basicdata.member.profile.service.MemberProfileService; | ||
| 8 | import com.topdraw.util.TimestampUtil; | 7 | import com.topdraw.util.TimestampUtil; |
| 9 | import org.junit.Test; | 8 | import org.junit.Test; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.member.rest; | 1 | package com.topdraw.test.business.basicdata.member.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.business.basicdata.member.relatedinfo.domain.MemberRelatedInfo; | 4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
| 5 | import com.topdraw.business.basicdata.member.relatedinfo.rest.MemberRelatedInfoController; | 5 | import com.topdraw.business.module.member.relatedinfo.rest.MemberRelatedInfoController; |
| 6 | import com.topdraw.business.basicdata.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | 6 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; |
| 7 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 8 | import com.topdraw.BaseTest; | 8 | import com.topdraw.BaseTest; |
| 9 | import org.junit.Test; | 9 | import org.junit.Test; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.points; | 1 | package com.topdraw.test.business.basicdata.points; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.points.available.domain.PointsAvailable; | 3 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
| 4 | import com.topdraw.business.basicdata.points.available.service.PointsAvailableService; | 4 | import com.topdraw.business.module.points.available.service.PointsAvailableService; |
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO; | 5 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
| 6 | import com.topdraw.business.process.domian.TempPoints; | 6 | import com.topdraw.business.process.domian.TempPoints; |
| 7 | import com.topdraw.BaseTest; | 7 | import com.topdraw.BaseTest; |
| 8 | import com.topdraw.util.DateUtil; | ||
| 9 | import com.topdraw.util.IdWorker; | 8 | import com.topdraw.util.IdWorker; |
| 10 | import com.topdraw.util.TimestampUtil; | ||
| 11 | import org.junit.Test; | 9 | import org.junit.Test; |
| 12 | import org.springframework.beans.BeanUtils; | 10 | import org.springframework.beans.BeanUtils; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.points; | 1 | package com.topdraw.test.business.basicdata.points; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 3 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 4 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 4 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 5 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | 5 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 6 | import com.topdraw.business.process.service.MemberOperationService; | 6 | import com.topdraw.business.process.service.MemberOperationService; |
| 7 | import com.topdraw.business.process.domian.TempPoints; | 7 | import com.topdraw.business.process.domian.TempPoints; |
| 8 | import com.topdraw.BaseTest; | 8 | import com.topdraw.BaseTest; |
| 9 | import com.topdraw.util.IdWorker; | 9 | import com.topdraw.util.IdWorker; |
| 10 | import com.topdraw.util.TimestampUtil; | ||
| 11 | import org.junit.Test; | 10 | import org.junit.Test; |
| 12 | import org.springframework.beans.BeanUtils; | 11 | import org.springframework.beans.BeanUtils; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.rights; | 1 | package com.topdraw.test.business.basicdata.rights; |
| 2 | 2 | ||
| 3 | import com.topdraw.BaseTest; | 3 | import com.topdraw.BaseTest; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 5 | import com.topdraw.business.basicdata.points.detail.domain.PointsDetail; | 5 | import com.topdraw.business.module.points.detail.domain.PointsDetail; |
| 6 | import com.topdraw.business.basicdata.points.detail.service.PointsDetailService; | 6 | import com.topdraw.business.module.points.detail.service.PointsDetailService; |
| 7 | import com.topdraw.business.process.domian.TempPoints; | 7 | import com.topdraw.business.process.domian.TempPoints; |
| 8 | import com.topdraw.business.process.service.MemberOperationService; | 8 | import com.topdraw.business.process.service.MemberOperationService; |
| 9 | import com.topdraw.util.IdWorker; | 9 | import com.topdraw.util.IdWorker; |
| 10 | import com.topdraw.util.TimestampUtil; | ||
| 11 | import org.junit.Test; | 10 | import org.junit.Test; |
| 12 | import org.springframework.beans.BeanUtils; | 11 | import org.springframework.beans.BeanUtils; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.rights.history; | 1 | package com.topdraw.test.business.basicdata.rights.history; |
| 2 | 2 | ||
| 3 | import com.topdraw.BaseTest; | 3 | import com.topdraw.BaseTest; |
| 4 | import com.topdraw.business.basicdata.member.service.dto.MemberQueryCriteria; | 4 | import com.topdraw.business.module.rights.history.rest.RightsHistoryController; |
| 5 | import com.topdraw.business.basicdata.rights.history.rest.RightsHistoryController; | 5 | import com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.rights.history.service.dto.RightsHistoryQueryCriteria; | ||
| 7 | import com.topdraw.business.basicdata.rights.rest.RightsController; | ||
| 8 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 9 | import org.junit.Test; | 7 | import org.junit.Test; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.rights.permanentrights; | 1 | package com.topdraw.test.business.basicdata.rights.permanentrights; |
| 2 | 2 | ||
| 3 | import com.topdraw.BaseTest; | 3 | import com.topdraw.BaseTest; |
| 4 | import com.topdraw.business.basicdata.rights.permanentrights.rest.PermanentRightsController; | 4 | import com.topdraw.business.module.rights.permanentrights.rest.PermanentRightsController; |
| 5 | import com.topdraw.business.basicdata.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; | 5 | import com.topdraw.business.module.rights.permanentrights.service.dto.PermanentRightsQueryCriteria; |
| 6 | import com.topdraw.business.basicdata.rights.rest.RightsController; | ||
| 7 | import com.topdraw.common.ResultInfo; | 6 | import com.topdraw.common.ResultInfo; |
| 8 | import org.junit.Test; | 7 | import org.junit.Test; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.rights.rest; | 1 | package com.topdraw.test.business.basicdata.rights.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.BaseTest; | 3 | import com.topdraw.BaseTest; |
| 4 | import com.topdraw.business.basicdata.rights.rest.RightsController; | 4 | import com.topdraw.business.module.rights.rest.RightsController; |
| 5 | import com.topdraw.common.ResultInfo; | 5 | import com.topdraw.common.ResultInfo; |
| 6 | import org.junit.Test; | 6 | import org.junit.Test; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.basicdata.task; | 1 | package com.topdraw.test.business.basicdata.task; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.basicdata.task.template.domain.TaskTemplate; | 3 | import com.topdraw.business.module.task.template.domain.TaskTemplate; |
| 4 | import com.topdraw.business.basicdata.task.template.service.TaskTemplateService; | 4 | import com.topdraw.business.module.task.template.service.TaskTemplateService; |
| 5 | import com.topdraw.BaseTest; | 5 | import com.topdraw.BaseTest; |
| 6 | import org.junit.Test; | 6 | import org.junit.Test; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
| 1 | package com.topdraw.test.business.process.rest; | 1 | package com.topdraw.test.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryCriteria; | ||
| 5 | import com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableQueryType; | ||
| 6 | import com.topdraw.business.basicdata.points.detail.rest.PointsDetailController; | ||
| 7 | import com.topdraw.BaseTest; | 4 | import com.topdraw.BaseTest; |
| 8 | import com.topdraw.business.basicdata.points.detail.service.dto.PointsDetailQueryCriteria; | ||
| 9 | import com.topdraw.business.process.domian.TempPoints; | 5 | import com.topdraw.business.process.domian.TempPoints; |
| 10 | import com.topdraw.business.process.rest.PointsOperationController; | 6 | import com.topdraw.business.process.rest.PointsOperationController; |
| 11 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 12 | import org.junit.Test; | 8 | import org.junit.Test; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.data.domain.PageRequest; | ||
| 15 | import org.springframework.data.domain.Pageable; | ||
| 16 | 10 | ||
| 17 | import java.sql.Timestamp; | ||
| 18 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
| 19 | 12 | ||
| 20 | public class PointsOperationControllerTest extends BaseTest { | 13 | public class PointsOperationControllerTest extends BaseTest { | ... | ... |
| ... | @@ -2,10 +2,9 @@ package com.topdraw.test.business.process.rest; | ... | @@ -2,10 +2,9 @@ package com.topdraw.test.business.process.rest; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | import com.topdraw.BaseTest; | 4 | import com.topdraw.BaseTest; |
| 5 | import com.topdraw.business.basicdata.rights.history.domain.RightsHistory; | 5 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
| 6 | import com.topdraw.business.process.rest.RightsOperationController; | 6 | import com.topdraw.business.process.rest.RightsOperationController; |
| 7 | import com.topdraw.common.ResultInfo; | 7 | import com.topdraw.common.ResultInfo; |
| 8 | import com.topdraw.util.TimestampUtil; | ||
| 9 | import org.junit.Test; | 8 | import org.junit.Test; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 10 | ... | ... |
| 1 | package com.topdraw.test.business.process.rest; | 1 | package com.topdraw.test.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.topdraw.business.basicdata.points.service.dto.PointsQueryCriteria; | ||
| 5 | import com.topdraw.business.process.rest.TaskOperationController; | 4 | import com.topdraw.business.process.rest.TaskOperationController; |
| 6 | import com.topdraw.business.process.rest.TaskOperationQueryCriteria; | 5 | import com.topdraw.business.process.rest.TaskOperationQueryCriteria; |
| 7 | import com.topdraw.module.mq.DataSyncMsg; | 6 | import com.topdraw.module.mq.DataSyncMsg; |
| 8 | import com.topdraw.module.mq.EntityType; | ||
| 9 | import com.topdraw.module.mq.EventType; | 7 | import com.topdraw.module.mq.EventType; |
| 10 | import com.topdraw.BaseTest; | 8 | import com.topdraw.BaseTest; |
| 11 | import com.topdraw.utils.StringUtils; | ||
| 12 | import org.junit.Test; | 9 | import org.junit.Test; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 11 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 15 | 12 | ||
| 16 | import javax.annotation.Resource; | ||
| 17 | import java.util.List; | ||
| 18 | import java.util.concurrent.ArrayBlockingQueue; | ||
| 19 | import java.util.concurrent.FutureTask; | 13 | import java.util.concurrent.FutureTask; |
| 20 | import java.util.concurrent.ThreadPoolExecutor; | ||
| 21 | import java.util.concurrent.TimeUnit; | ||
| 22 | 14 | ||
| 23 | public class TaskOperationControllerTest extends BaseTest { | 15 | public class TaskOperationControllerTest extends BaseTest { |
| 24 | 16 | ... | ... |
| 1 | package com.topdraw.test.business.process.service; | 1 | package com.topdraw.test.business.process.service; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.topdraw.business.basicdata.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.process.service.MemberOperationService; | 5 | import com.topdraw.business.process.service.MemberOperationService; |
| 6 | import com.topdraw.BaseTest; | 6 | import com.topdraw.BaseTest; |
| 7 | import com.topdraw.util.IdWorker; | 7 | import com.topdraw.util.IdWorker; | ... | ... |
| 1 | package com.topdraw.test.business.process.service; | ||
| 2 | |||
| 3 | import com.alibaba.fastjson.JSON; | ||
| 4 | import com.topdraw.BaseTest; | ||
| 5 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | ||
| 6 | import com.topdraw.business.process.service.UserOperationService; | ||
| 7 | import com.topdraw.module.mq.DataSyncMsg; | ||
| 8 | import com.topdraw.module.mq.EventType; | ||
| 9 | import org.junit.Test; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | |||
| 12 | public class UserOperationServiceTest extends BaseTest { | ||
| 13 | |||
| 14 | @Autowired | ||
| 15 | UserOperationService taskOperationService; | ||
| 16 | |||
| 17 | @Test | ||
| 18 | public void appletLogin() { | ||
| 19 | /* Long memberId = 3L; | ||
| 20 | DataSyncMsg dataSyncMsg = new DataSyncMsg(); | ||
| 21 | // dataSyncMsg.setEntityType(EntityType.MEMBER); | ||
| 22 | dataSyncMsg.setEventType(EventType.LOGIN.name()); | ||
| 23 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); | ||
| 24 | msgData.setEvent(1); | ||
| 25 | msgData.setRemarks("remark"); | ||
| 26 | msgData.setMemberId(memberId); | ||
| 27 | msgData.setDeviceType(2); | ||
| 28 | |||
| 29 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); | ||
| 30 | dataSyncMsg.setMsg(msgData); | ||
| 31 | |||
| 32 | String s = JSON.toJSONString(dataSyncMsg);*/ | ||
| 33 | |||
| 34 | WeiXinUserBean weiXinUserBean = new WeiXinUserBean(); | ||
| 35 | weiXinUserBean.setWxAppid("1"); | ||
| 36 | weiXinUserBean.setWxCode("1"); | ||
| 37 | weiXinUserBean.setSourceType("1"); | ||
| 38 | weiXinUserBean.setSourceId("1"); | ||
| 39 | weiXinUserBean.setIv("1"); | ||
| 40 | weiXinUserBean.setEncryptedData("1"); | ||
| 41 | weiXinUserBean.setSourceEntity("1"); | ||
| 42 | weiXinUserBean.setSourceDesc("1"); | ||
| 43 | weiXinUserBean.setSourceUser(1L); | ||
| 44 | weiXinUserBean.setUserInfo("1"); | ||
| 45 | this.taskOperationService.appletLogin(weiXinUserBean); | ||
| 46 | } | ||
| 47 | |||
| 48 | } |
-
Please register or sign in to post a comment