Merge branch '2'
# Conflicts: # src/main/java/com/topdraw/business/module/member/profile/service/impl/MemberProfileServiceImpl.java # src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java # src/main/java/com/topdraw/business/module/user/iptv/domain/UserTv.java # src/main/java/com/topdraw/business/module/user/iptv/service/dto/UserTvDTO.java # src/main/java/com/topdraw/business/module/user/weixin/service/impl/UserWeixinServiceImpl.java # src/main/java/com/topdraw/mq/consumer/WeiXinEventConsumer.java # src/main/resources/config/application-dev.yml
Showing
221 changed files
with
1995 additions
and
1125 deletions
... | @@ -23,12 +23,12 @@ | ... | @@ -23,12 +23,12 @@ |
23 | 23 | ||
24 | <dependencies> | 24 | <dependencies> |
25 | 25 | ||
26 | <!--redisson--> | 26 | <!--wechat-util--> |
27 | <dependency> | 27 | <!--<dependency> |
28 | <groupId>org.redisson</groupId> | 28 | <groupId>com.topdraw</groupId> |
29 | <artifactId>redisson</artifactId> | 29 | <artifactId>wechat-util</artifactId> |
30 | <version>3.16.3</version> | 30 | <version>0.0.1-SNAPSHOT</version> |
31 | </dependency> | 31 | </dependency>--> |
32 | 32 | ||
33 | <!--代码生成器--> | 33 | <!--代码生成器--> |
34 | <dependency> | 34 | <dependency> | ... | ... |
1 | package com.topdraw.business.module.common.domain; | 1 | package com.topdraw.business.module.common.domain; |
2 | 2 | ||
3 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
3 | import lombok.Data; | 4 | import lombok.Data; |
4 | import lombok.experimental.Accessors; | 5 | import lombok.experimental.Accessors; |
5 | 6 | ||
6 | import javax.persistence.Transient; | 7 | import javax.persistence.Transient; |
8 | import javax.validation.constraints.NotNull; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * @author : | 11 | * @author : |
... | @@ -16,9 +18,13 @@ import javax.persistence.Transient; | ... | @@ -16,9 +18,13 @@ import javax.persistence.Transient; |
16 | */ | 18 | */ |
17 | @Data | 19 | @Data |
18 | @Accessors(chain = true) | 20 | @Accessors(chain = true) |
19 | public class DefaultAsyncMqModule { | 21 | public class AsyncMqModule { |
20 | 22 | ||
21 | @Transient | 23 | @Transient |
24 | @NotNull(message = "memberCode can't be null" , groups = {UpdateGroup.class}) | ||
22 | private String memberCode; | 25 | private String memberCode; |
23 | 26 | ||
27 | /** 运营商平台账号 */ | ||
28 | @Transient | ||
29 | private String platformAccount; | ||
24 | } | 30 | } | ... | ... |
... | @@ -12,6 +12,7 @@ import javax.persistence.*; | ... | @@ -12,6 +12,7 @@ import javax.persistence.*; |
12 | import java.io.Serializable; | 12 | import java.io.Serializable; |
13 | import java.math.BigDecimal; | 13 | import java.math.BigDecimal; |
14 | import java.sql.Timestamp; | 14 | import java.sql.Timestamp; |
15 | import java.time.LocalDateTime; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -24,94 +25,94 @@ import java.sql.Timestamp; | ... | @@ -24,94 +25,94 @@ import java.sql.Timestamp; |
24 | @Table(name="m_coupon") | 25 | @Table(name="m_coupon") |
25 | public class Coupon implements Serializable { | 26 | public class Coupon implements Serializable { |
26 | 27 | ||
27 | // id | 28 | /** id */ |
28 | @Id | 29 | @Id |
29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 30 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
30 | @Column(name = "id") | 31 | @Column(name = "id") |
31 | private Long id; | 32 | private Long id; |
32 | 33 | ||
33 | // 标识 | 34 | /** 标识 */ |
34 | @Column(name = "code", nullable = false) | 35 | @Column(name = "code", nullable = false) |
35 | private String code; | 36 | private String code; |
36 | 37 | ||
37 | // 名称 | 38 | /** 名称 */ |
38 | @Column(name = "title", nullable = false) | 39 | @Column(name = "title", nullable = false) |
39 | private String title; | 40 | private String title; |
40 | 41 | ||
41 | // 图片 | 42 | /** 图片 */ |
42 | @Column(name = "images") | 43 | @Column(name = "images") |
43 | private String images; | 44 | private String images; |
44 | 45 | ||
45 | // 发行量,-1代表不限量 | 46 | /** 发行量,-1代表不限量 */ |
46 | @Column(name = "stock") | 47 | @Column(name = "stock") |
47 | private Integer stock; | 48 | private Integer stock; |
48 | 49 | ||
49 | // 剩余量,-1代表不限量 | 50 | /** 剩余量,-1代表不限量 */ |
50 | @Column(name = "remain_stock") | 51 | @Column(name = "remain_stock") |
51 | private Integer remainStock; | 52 | private Integer remainStock; |
52 | 53 | ||
53 | // 优惠形式:1:现金;2:折扣 | 54 | /** 优惠形式:1:现金;2:折扣 */ |
54 | @Column(name = "use_type") | 55 | @Column(name = "use_type") |
55 | private Integer useType; | 56 | private Integer useType; |
56 | 57 | ||
57 | // 面额 | 58 | /** 面额 */ |
58 | @Column(name = "denomination") | 59 | @Column(name = "denomination") |
59 | private BigDecimal denomination; | 60 | private BigDecimal denomination; |
60 | 61 | ||
61 | // 折扣 | 62 | /** 折扣 */ |
62 | @Column(name = "discount") | 63 | @Column(name = "discount") |
63 | private BigDecimal discount; | 64 | private BigDecimal discount; |
64 | 65 | ||
65 | // 适用用户范围:1:新用户;2:全体用户 | 66 | /** 适用用户范围:1:新用户;2:全体用户 */ |
66 | @Column(name = "user_range") | 67 | @Column(name = "user_range") |
67 | private Integer userRange; | 68 | private Integer userRange; |
68 | 69 | ||
69 | // 限领次数 -1:无限次; >0:具体次数 | 70 | /** 限领次数 -1:无限次; >0:具体次数 */ |
70 | @Column(name = "collect_limit") | 71 | @Column(name = "collect_limit") |
71 | private Integer collectLimit; | 72 | private Integer collectLimit; |
72 | 73 | ||
73 | // 适用门槛:1:无门槛;2:满减形式 | 74 | /** 适用门槛:1:无门槛;2:满减形式 */ |
74 | @Column(name = "threshold_type") | 75 | @Column(name = "threshold_type") |
75 | private Integer thresholdType; | 76 | private Integer thresholdType; |
76 | 77 | ||
77 | // 满减门槛 | 78 | /** 满减门槛 */ |
78 | @Column(name = "amount_threshold") | 79 | @Column(name = "amount_threshold") |
79 | private BigDecimal amountThreshold; | 80 | private BigDecimal amountThreshold; |
80 | 81 | ||
81 | // 产品范围:1:全部商品;2:指定商品 | 82 | /** 产品范围:1:全部商品;2:指定商品 */ |
82 | @Column(name = "item_range") | 83 | @Column(name = "item_range") |
83 | private Integer itemRange; | 84 | private Integer itemRange; |
84 | 85 | ||
85 | // 生效形式:1:固定日期;2:相对日期 | 86 | /** 生效形式:1:固定日期;2:相对日期 */ |
86 | @Column(name = "effect_type") | 87 | @Column(name = "effect_type") |
87 | private Integer effectType; | 88 | private Integer effectType; |
88 | 89 | ||
89 | // 生效时间 | 90 | /** 生效时间 */ |
90 | @Column(name = "start_time") | 91 | @Column(name = "start_time") |
91 | private Timestamp startTime; | 92 | private Timestamp startTime; |
92 | 93 | ||
93 | // 过期时间 | 94 | /** 过期时间 */ |
94 | @Column(name = "expire_time") | 95 | @Column(name = "expire_time") |
95 | private Timestamp expireTime; | 96 | private LocalDateTime expireTime; |
96 | 97 | ||
97 | // 自领取当日,几天内有效 | 98 | /** 自领取当日,几天内有效 */ |
98 | @Column(name = "valid_days") | 99 | @Column(name = "valid_days") |
99 | private Integer validDays; | 100 | private Integer validDays; |
100 | 101 | ||
101 | // 使用说明 | 102 | /** 使用说明 */ |
102 | @Column(name = "description") | 103 | @Column(name = "description") |
103 | private String description; | 104 | private String description; |
104 | 105 | ||
105 | // 状态0:未开始,1:启用;2:停用 | 106 | /** 状态0:未开始,1:启用;2:停用 */ |
106 | @Column(name = "status") | 107 | @Column(name = "status") |
107 | private Integer status; | 108 | private Integer status; |
108 | 109 | ||
109 | // 创建时间 | 110 | /** 创建时间 */ |
110 | @CreatedDate | 111 | @CreatedDate |
111 | @Column(name = "create_time") | 112 | @Column(name = "create_time") |
112 | private Timestamp createTime; | 113 | private Timestamp createTime; |
113 | 114 | ||
114 | // 更新时间 | 115 | /** 更新时间 */ |
115 | @LastModifiedDate | 116 | @LastModifiedDate |
116 | @Column(name = "update_time") | 117 | @Column(name = "update_time") |
117 | private Timestamp updateTime; | 118 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.coupon.domain; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | ||
4 | import com.topdraw.util.IdWorker; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.beans.BeanUtils; | ||
7 | |||
8 | import java.math.BigDecimal; | ||
9 | import java.sql.Timestamp; | ||
10 | import java.time.LocalDateTime; | ||
11 | import java.util.Objects; | ||
12 | |||
13 | /** | ||
14 | * 优惠券 | ||
15 | */ | ||
16 | public class CouponBuilder { | ||
17 | |||
18 | public static Coupon build(CouponDTO couponDTO){ | ||
19 | Coupon coupon = new Coupon(); | ||
20 | BeanUtils.copyProperties(couponDTO,coupon); | ||
21 | return build(coupon.getId(), | ||
22 | coupon.getCode(), | ||
23 | coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(), | ||
24 | coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(), | ||
25 | coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(), | ||
26 | coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus()); | ||
27 | } | ||
28 | |||
29 | public static Coupon build(Coupon coupon){ | ||
30 | return build(coupon.getId(), | ||
31 | coupon.getCode(), | ||
32 | coupon.getTitle(),coupon.getImages(),coupon.getStock(),coupon.getRemainStock(),coupon.getUseType(), | ||
33 | coupon.getDenomination(),coupon.getDiscount(),coupon.getUserRange(),coupon.getCollectLimit(), | ||
34 | coupon.getThresholdType(),coupon.getAmountThreshold(),coupon.getItemRange(),coupon.getEffectType(), | ||
35 | coupon.getStartTime(),coupon.getExpireTime(),coupon.getValidDays(),coupon.getDescription(),coupon.getStatus()); | ||
36 | } | ||
37 | |||
38 | public static Coupon build(Long id , String code , String title, | ||
39 | String images, | ||
40 | Integer stock, | ||
41 | Integer remainStock, | ||
42 | Integer useType, | ||
43 | BigDecimal denomination, | ||
44 | BigDecimal discount, | ||
45 | Integer userRange, | ||
46 | Integer collectLimit, | ||
47 | Integer thresholdType, | ||
48 | BigDecimal amountThreshold, | ||
49 | Integer itemRange, | ||
50 | Integer effectType, | ||
51 | Timestamp startTime, | ||
52 | LocalDateTime expireTime, | ||
53 | Integer validDays,String description , Integer status){ | ||
54 | |||
55 | Coupon coupon = new Coupon(); | ||
56 | coupon.setId(id); | ||
57 | coupon.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("coupon"):code); | ||
58 | coupon.setTitle(StringUtils.isBlank(title)?null:title); | ||
59 | coupon.setImages(StringUtils.isBlank(images)?null:images); | ||
60 | coupon.setStock(Objects.isNull(stock)?null:stock); | ||
61 | coupon.setRemainStock(Objects.isNull(remainStock)?null:remainStock); | ||
62 | coupon.setUseType(Objects.isNull(useType)?null:useType); | ||
63 | coupon.setDenomination(Objects.isNull(denomination)?null:denomination); | ||
64 | coupon.setDiscount(Objects.isNull(discount)?null:discount); | ||
65 | coupon.setUserRange(Objects.isNull(userRange)?null:userRange); | ||
66 | coupon.setCollectLimit(collectLimit); | ||
67 | coupon.setThresholdType(Objects.isNull(thresholdType)?null:thresholdType); | ||
68 | coupon.setAmountThreshold(Objects.isNull(amountThreshold)?null:amountThreshold); | ||
69 | coupon.setItemRange(Objects.isNull(itemRange)?null:itemRange); | ||
70 | coupon.setEffectType(Objects.isNull(effectType)?null:effectType); | ||
71 | coupon.setStartTime(Objects.isNull(startTime)?null: startTime); | ||
72 | coupon.setExpireTime(Objects.isNull(expireTime)?null:expireTime); | ||
73 | coupon.setValidDays(validDays); | ||
74 | coupon.setDescription(StringUtils.isBlank(description)?"":description); | ||
75 | coupon.setStatus(Objects.nonNull(status)?status:0); | ||
76 | return coupon; | ||
77 | } | ||
78 | |||
79 | } |
... | @@ -10,7 +10,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ... | @@ -10,7 +10,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 10 | ||
11 | import javax.persistence.*; | 11 | import javax.persistence.*; |
12 | import java.io.Serializable; | 12 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | ||
14 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
15 | 14 | ||
16 | /** | 15 | /** |
... | @@ -24,54 +23,57 @@ import java.time.LocalDateTime; | ... | @@ -24,54 +23,57 @@ import java.time.LocalDateTime; |
24 | @Table(name="m_coupon_history") | 23 | @Table(name="m_coupon_history") |
25 | public class CouponHistory implements Serializable { | 24 | public class CouponHistory implements Serializable { |
26 | 25 | ||
27 | // 主键 | 26 | @Transient |
27 | private String memberCode; | ||
28 | |||
29 | /** 主键 */ | ||
28 | @Id | 30 | @Id |
29 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
30 | @Column(name = "id") | 32 | @Column(name = "id") |
31 | private Long id; | 33 | private Long id; |
32 | 34 | ||
33 | // 优惠券id | 35 | /** 优惠券id */ |
34 | @Column(name = "coupon_id") | 36 | @Column(name = "coupon_id") |
35 | private Long couponId; | 37 | private Long couponId; |
36 | 38 | ||
37 | // 领券用户id(对应账号) | 39 | /** 领券用户id(对应账号) */ |
38 | @Column(name = "user_id") | 40 | @Column(name = "user_id") |
39 | private Long userId; | 41 | private Long userId; |
40 | 42 | ||
41 | // 优惠券code | 43 | /** 优惠券code */ |
42 | @Column(name = "coupon_code") | 44 | @Column(name = "coupon_code") |
43 | private String couponCode; | 45 | private String couponCode; |
44 | 46 | ||
45 | // 领取人昵称 | 47 | /** 领取人昵称 */ |
46 | @Column(name = "user_nickname") | 48 | @Column(name = "user_nickname") |
47 | private String userNickname; | 49 | private String userNickname; |
48 | 50 | ||
49 | // 领取时间 | 51 | /** 领取时间 */ |
50 | @Column(name = "receive_time") | 52 | @Column(name = "receive_time") |
51 | private LocalDateTime receiveTime; | 53 | private LocalDateTime receiveTime; |
52 | 54 | ||
53 | // 失效时间 | 55 | /** 失效时间 */ |
54 | @Column(name = "expire_time") | 56 | @Column(name = "expire_time") |
55 | private LocalDateTime expireTime; | 57 | private LocalDateTime expireTime; |
56 | 58 | ||
57 | // 使用状态 0:未使用;1:已使用;-1:已过期 | 59 | /** 使用状态 0:未使用;1:已使用;-1:已过期 */ |
58 | @Column(name = "use_status") | 60 | @Column(name = "use_status") |
59 | private Integer useStatus; | 61 | private Integer useStatus; |
60 | 62 | ||
61 | // 使用时间 | 63 | /** 使用时间 */ |
62 | @Column(name = "use_time") | 64 | @Column(name = "use_time") |
63 | private LocalDateTime useTime; | 65 | private LocalDateTime useTime; |
64 | 66 | ||
65 | // 订单详情id | 67 | /** 订单详情id */ |
66 | @Column(name = "order_detail_id") | 68 | @Column(name = "order_detail_id") |
67 | private Long orderDetailId; | 69 | private Long orderDetailId; |
68 | 70 | ||
69 | // 创建时间 | 71 | /** 创建时间 */ |
70 | @CreatedDate | 72 | @CreatedDate |
71 | @Column(name = "create_time") | 73 | @Column(name = "create_time") |
72 | private LocalDateTime createTime; | 74 | private LocalDateTime createTime; |
73 | 75 | ||
74 | // 更新时间 | 76 | /** 更新时间 */ |
75 | @LastModifiedDate | 77 | @LastModifiedDate |
76 | @Column(name = "update_time") | 78 | @Column(name = "update_time") |
77 | private LocalDateTime updateTime; | 79 | private LocalDateTime updateTime; | ... | ... |
src/main/java/com/topdraw/business/module/coupon/history/domain/CouponHistoryBuilder.java
0 → 100644
1 | package com.topdraw.business.module.coupon.history.domain; | ||
2 | |||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
4 | import org.apache.commons.lang3.StringUtils; | ||
5 | |||
6 | import java.time.LocalDateTime; | ||
7 | import java.util.Objects; | ||
8 | |||
9 | /** | ||
10 | * 优惠券 | ||
11 | */ | ||
12 | public class CouponHistoryBuilder { | ||
13 | |||
14 | public static CouponHistory build(CouponHistory couponHistory){ | ||
15 | return build(couponHistory.getId(), | ||
16 | couponHistory.getCouponId(), | ||
17 | couponHistory.getUserId(), | ||
18 | couponHistory.getCouponCode(), | ||
19 | couponHistory.getUserNickname(), | ||
20 | couponHistory.getReceiveTime(), | ||
21 | couponHistory.getExpireTime(), | ||
22 | couponHistory.getUseStatus(), | ||
23 | couponHistory.getUseTime(), | ||
24 | couponHistory.getOrderDetailId()); | ||
25 | } | ||
26 | |||
27 | public static CouponHistory build(Coupon coupon, Long userId, String userNickname){ | ||
28 | return build(coupon,userId,userNickname,null); | ||
29 | } | ||
30 | |||
31 | public static CouponHistory build(Coupon coupon, Long userId, String userNickname, Long orderDetailId){ | ||
32 | return build(null, | ||
33 | coupon.getId(),userId,coupon.getCode(),userNickname,LocalDateTime.now(), | ||
34 | coupon.getExpireTime(),coupon.getStatus(),null,orderDetailId); | ||
35 | } | ||
36 | |||
37 | public static CouponHistory build(Long id , Long couponId , Long userId, String couponCode, String userNickname, LocalDateTime receiveTime, | ||
38 | LocalDateTime expireTime, Integer useStatus, LocalDateTime useTime, | ||
39 | Long orderDetailId) { | ||
40 | CouponHistory couponHistory = new CouponHistory(); | ||
41 | couponHistory.setId(id); | ||
42 | couponHistory.setCouponId(Objects.isNull(couponId)?null:couponId); | ||
43 | couponHistory.setUserId(Objects.isNull(userId)?null:userId); | ||
44 | couponHistory.setCouponCode(StringUtils.isBlank(couponCode)?null:couponCode); | ||
45 | couponHistory.setUserNickname(StringUtils.isBlank(userNickname)?null:userNickname); | ||
46 | couponHistory.setReceiveTime(Objects.isNull(receiveTime)?null:receiveTime); | ||
47 | couponHistory.setExpireTime(Objects.isNull(expireTime)?null:expireTime); | ||
48 | couponHistory.setUseStatus(Objects.isNull(useStatus)?0:useStatus); | ||
49 | couponHistory.setUseTime(Objects.isNull(useTime)?null:useTime); | ||
50 | couponHistory.setOrderDetailId(Objects.isNull(orderDetailId)?null:orderDetailId); | ||
51 | return couponHistory; | ||
52 | } | ||
53 | |||
54 | } |
... | @@ -4,7 +4,6 @@ import com.topdraw.business.module.coupon.history.domain.CouponHistory; | ... | @@ -4,7 +4,6 @@ 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; | ||
8 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; |
9 | 8 | ||
10 | /** | 9 | /** | ... | ... |
... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.coupon.history.service; | ... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.coupon.history.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
4 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; | 4 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
5 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | 5 | ||
8 | import java.sql.Timestamp; | ||
9 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
10 | import java.util.List; | ||
11 | import java.util.Map; | ||
12 | 7 | ||
13 | /** | 8 | /** |
14 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -16,20 +11,6 @@ import java.util.Map; | ... | @@ -16,20 +11,6 @@ import java.util.Map; |
16 | */ | 11 | */ |
17 | public interface CouponHistoryService { | 12 | public interface CouponHistoryService { |
18 | 13 | ||
19 | /** | ||
20 | * 查询数据分页 | ||
21 | * @param criteria 条件参数 | ||
22 | * @param pageable 分页参数 | ||
23 | * @return Map<String,Object> | ||
24 | */ | ||
25 | Map<String,Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable); | ||
26 | |||
27 | /** | ||
28 | * 查询所有数据不分页 | ||
29 | * @param criteria 条件参数 | ||
30 | * @return List<CouponHistoryDTO> | ||
31 | */ | ||
32 | List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria); | ||
33 | 14 | ||
34 | /** | 15 | /** |
35 | * 根据ID查询 | 16 | * 根据ID查询 |
... | @@ -38,15 +19,33 @@ public interface CouponHistoryService { | ... | @@ -38,15 +19,33 @@ public interface CouponHistoryService { |
38 | */ | 19 | */ |
39 | CouponHistoryDTO findById(Long id); | 20 | CouponHistoryDTO findById(Long id); |
40 | 21 | ||
22 | /** | ||
23 | * | ||
24 | * @param resources | ||
25 | */ | ||
41 | void create(CouponHistory resources); | 26 | void create(CouponHistory resources); |
42 | 27 | ||
43 | void update(CouponHistory resources); | 28 | /** |
44 | 29 | * | |
45 | void delete(Long id); | 30 | * @param userId |
46 | 31 | * @return | |
32 | */ | ||
47 | Long countByUserId(Long userId); | 33 | Long countByUserId(Long userId); |
48 | 34 | ||
35 | /** | ||
36 | * | ||
37 | * @param userId | ||
38 | * @param now | ||
39 | * @return | ||
40 | */ | ||
49 | Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now); | 41 | Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now); |
50 | 42 | ||
43 | /** | ||
44 | * | ||
45 | * @param userId | ||
46 | * @param now | ||
47 | * @param expireTime | ||
48 | * @return | ||
49 | */ | ||
51 | Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime); | 50 | Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime); |
52 | } | 51 | } | ... | ... |
... | @@ -3,7 +3,6 @@ package com.topdraw.business.module.coupon.history.service.dto; | ... | @@ -3,7 +3,6 @@ package com.topdraw.business.module.coupon.history.service.dto; |
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | import java.sql.Timestamp; | ||
7 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
8 | 7 | ||
9 | 8 | ||
... | @@ -14,39 +13,39 @@ import java.time.LocalDateTime; | ... | @@ -14,39 +13,39 @@ import java.time.LocalDateTime; |
14 | @Data | 13 | @Data |
15 | public class CouponHistoryDTO implements Serializable { | 14 | public class CouponHistoryDTO implements Serializable { |
16 | 15 | ||
17 | // 主键 | 16 | /** 主键 */ |
18 | private Long id; | 17 | private Long id; |
19 | 18 | ||
20 | // 优惠券id | 19 | /** 优惠券id */ |
21 | private Long couponId; | 20 | private Long couponId; |
22 | 21 | ||
23 | // 领券用户id(对应账号) | 22 | /** 领券用户id(对应账号) */ |
24 | private Long userId; | 23 | private Long userId; |
25 | 24 | ||
26 | // 优惠券code | 25 | /** 优惠券code */ |
27 | private String couponCode; | 26 | private String couponCode; |
28 | 27 | ||
29 | // 领取人昵称 | 28 | /** 领取人昵称 */ |
30 | private String userNickname; | 29 | private String userNickname; |
31 | 30 | ||
32 | // 领取时间 | 31 | /** 领取时间 */ |
33 | private LocalDateTime receiveTime; | 32 | private LocalDateTime receiveTime; |
34 | 33 | ||
35 | // 失效时间 | 34 | /** 失效时间 */ |
36 | private LocalDateTime expireTime; | 35 | private LocalDateTime expireTime; |
37 | 36 | ||
38 | // 使用状态 0:未使用;1:已使用;-1:已过期 | 37 | /** 使用状态 0:未使用;1:已使用;-1:已过期 */ |
39 | private Integer useStatus; | 38 | private Integer useStatus; |
40 | 39 | ||
41 | // 使用时间 | 40 | /** 使用时间 */ |
42 | private LocalDateTime useTime; | 41 | private LocalDateTime useTime; |
43 | 42 | ||
44 | // 订单详情id | 43 | /** 订单详情id */ |
45 | private Long orderDetailId; | 44 | private Long orderDetailId; |
46 | 45 | ||
47 | // 创建时间 | 46 | /** 创建时间 */ |
48 | private LocalDateTime createTime; | 47 | private LocalDateTime createTime; |
49 | 48 | ||
50 | // 更新时间 | 49 | /** 更新时间 */ |
51 | private LocalDateTime updateTime; | 50 | private LocalDateTime updateTime; |
52 | } | 51 | } | ... | ... |
1 | package com.topdraw.business.module.coupon.history.service.impl; | 1 | package com.topdraw.business.module.coupon.history.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; | 3 | import com.topdraw.business.module.coupon.history.domain.CouponHistory; |
4 | import com.topdraw.business.module.coupon.history.domain.CouponHistoryBuilder; | ||
4 | import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; | 5 | import com.topdraw.business.module.coupon.history.repository.CouponHistoryRepository; |
5 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; | 6 | import com.topdraw.business.module.coupon.history.service.CouponHistoryService; |
6 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; | 7 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryDTO; |
7 | import com.topdraw.business.module.coupon.history.service.dto.CouponHistoryQueryCriteria; | ||
8 | import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; | 8 | import com.topdraw.business.module.coupon.history.service.mapper.CouponHistoryMapper; |
9 | import com.topdraw.utils.PageUtil; | ||
10 | import com.topdraw.utils.QueryHelp; | ||
11 | import com.topdraw.utils.ValidationUtil; | 9 | import com.topdraw.utils.ValidationUtil; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.dao.EmptyResultDataAccessException; | ||
14 | import org.springframework.data.domain.Page; | ||
15 | import org.springframework.data.domain.Pageable; | ||
16 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
17 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
18 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
19 | import org.springframework.util.Assert; | ||
20 | 14 | ||
21 | import java.sql.Timestamp; | ||
22 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | 16 | ||
26 | /** | 17 | /** |
27 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -32,67 +23,38 @@ import java.util.Map; | ... | @@ -32,67 +23,38 @@ import java.util.Map; |
32 | public class CouponHistoryServiceImpl implements CouponHistoryService { | 23 | public class CouponHistoryServiceImpl implements CouponHistoryService { |
33 | 24 | ||
34 | @Autowired | 25 | @Autowired |
35 | private CouponHistoryRepository CouponHistoryRepository; | 26 | private CouponHistoryMapper couponHistoryMapper; |
36 | |||
37 | @Autowired | 27 | @Autowired |
38 | private CouponHistoryMapper CouponHistoryMapper; | 28 | private CouponHistoryRepository couponHistoryRepository; |
39 | |||
40 | @Override | ||
41 | public Map<String, Object> queryAll(CouponHistoryQueryCriteria criteria, Pageable pageable) { | ||
42 | Page<CouponHistory> page = CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
43 | return PageUtil.toPage(page.map(CouponHistoryMapper::toDto)); | ||
44 | } | ||
45 | 29 | ||
46 | @Override | ||
47 | public List<CouponHistoryDTO> queryAll(CouponHistoryQueryCriteria criteria) { | ||
48 | return CouponHistoryMapper.toDto(CouponHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
49 | } | ||
50 | 30 | ||
51 | @Override | 31 | @Override |
52 | public CouponHistoryDTO findById(Long id) { | 32 | public CouponHistoryDTO findById(Long id) { |
53 | CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseGet(CouponHistory::new); | 33 | CouponHistory couponHistory = this.couponHistoryRepository.findById(id).orElseGet(CouponHistory::new); |
54 | ValidationUtil.isNull(CouponHistory.getId(),"CouponHistory","id",id); | 34 | ValidationUtil.isNull(couponHistory.getId(),"CouponHistory","id",id); |
55 | return CouponHistoryMapper.toDto(CouponHistory); | 35 | return this.couponHistoryMapper.toDto(couponHistory); |
56 | } | 36 | } |
57 | 37 | ||
58 | @Override | 38 | @Override |
59 | @Transactional(rollbackFor = Exception.class) | 39 | @Transactional(rollbackFor = Exception.class) |
60 | public void create(CouponHistory resources) { | 40 | public void create(CouponHistory resources) { |
61 | CouponHistoryRepository.save(resources); | 41 | CouponHistory couponHistory = CouponHistoryBuilder.build(resources); |
62 | } | 42 | this.couponHistoryRepository.save(couponHistory); |
63 | |||
64 | @Override | ||
65 | @Transactional(rollbackFor = Exception.class) | ||
66 | public void update(CouponHistory resources) { | ||
67 | CouponHistory CouponHistory = CouponHistoryRepository.findById(resources.getId()).orElseGet(CouponHistory::new); | ||
68 | ValidationUtil.isNull( CouponHistory.getId(),"CouponHistory","id",resources.getId()); | ||
69 | CouponHistory.copy(resources); | ||
70 | CouponHistoryRepository.save(CouponHistory); | ||
71 | } | ||
72 | |||
73 | @Override | ||
74 | @Transactional(rollbackFor = Exception.class) | ||
75 | public void delete(Long id) { | ||
76 | Assert.notNull(id, "The given id must not be null!"); | ||
77 | CouponHistory CouponHistory = CouponHistoryRepository.findById(id).orElseThrow( | ||
78 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", CouponHistory.class, id), 1)); | ||
79 | CouponHistoryRepository.delete(CouponHistory); | ||
80 | } | 43 | } |
81 | 44 | ||
82 | @Override | 45 | @Override |
83 | public Long countByUserId(Long userId) { | 46 | public Long countByUserId(Long userId) { |
84 | return this.CouponHistoryRepository.countByUserId(userId); | 47 | return this.couponHistoryRepository.countByUserId(userId); |
85 | } | 48 | } |
86 | 49 | ||
87 | @Override | 50 | @Override |
88 | public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) { | 51 | public Long countByUserIdAndExpireTimeBefore(Long userId, LocalDateTime now) { |
89 | return this.CouponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now); | 52 | return this.couponHistoryRepository.countByUserIdAndExpireTimeBefore(userId,now); |
90 | } | 53 | } |
91 | 54 | ||
92 | @Override | 55 | @Override |
93 | public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) { | 56 | public Long countByUserIdAndExpireTimeBetween(Long userId, LocalDateTime now, LocalDateTime expireTime) { |
94 | return this.CouponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime); | 57 | return this.couponHistoryRepository.countByUserIdAndExpireTimeBetween(userId,now,expireTime); |
95 | } | 58 | } |
96 | 59 | ||
97 | |||
98 | } | 60 | } | ... | ... |
... | @@ -13,4 +13,5 @@ import java.util.Optional; | ... | @@ -13,4 +13,5 @@ import java.util.Optional; |
13 | public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> { | 13 | public interface CouponRepository extends JpaRepository<Coupon, Long>, JpaSpecificationExecutor<Coupon> { |
14 | 14 | ||
15 | Optional<Coupon> findFirstByCode(String code); | 15 | Optional<Coupon> findFirstByCode(String code); |
16 | |||
16 | } | 17 | } | ... | ... |
1 | package com.topdraw.business.module.coupon.service; | 1 | package com.topdraw.business.module.coupon.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.coupon.domain.Coupon; | ||
4 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | 3 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
5 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 4 | ||
11 | /** | 5 | /** |
12 | * @author XiangHan | 6 | * @author XiangHan |
... | @@ -15,37 +9,18 @@ import java.util.Map; | ... | @@ -15,37 +9,18 @@ import java.util.Map; |
15 | public interface CouponService { | 9 | public interface CouponService { |
16 | 10 | ||
17 | /** | 11 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(CouponQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<CouponDTO> | ||
29 | */ | ||
30 | List<CouponDTO> queryAll(CouponQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 12 | * 根据ID查询 |
34 | * @param id ID | 13 | * @param id ID |
35 | * @return CouponDTO | 14 | * @return CouponDTO |
36 | */ | 15 | */ |
37 | CouponDTO findById(Long id); | 16 | CouponDTO findById(Long id); |
38 | 17 | ||
39 | void create(Coupon resources); | ||
40 | |||
41 | void update(Coupon resources); | ||
42 | |||
43 | void delete(Long id); | ||
44 | |||
45 | /** | 18 | /** |
46 | * Code校验 | 19 | * Code校验 |
47 | * @param code | 20 | * @param code |
48 | * @return CouponDTO | 21 | * @return CouponDTO |
49 | */ | 22 | */ |
50 | CouponDTO getByCode(String code); | 23 | CouponDTO getByCode(String code); |
24 | |||
25 | |||
51 | } | 26 | } | ... | ... |
... | @@ -5,6 +5,7 @@ import lombok.Data; | ... | @@ -5,6 +5,7 @@ import lombok.Data; |
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
7 | import java.sql.Timestamp; | 7 | import java.sql.Timestamp; |
8 | import java.time.LocalDateTime; | ||
8 | 9 | ||
9 | 10 | ||
10 | /** | 11 | /** |
... | @@ -14,69 +15,69 @@ import java.sql.Timestamp; | ... | @@ -14,69 +15,69 @@ import java.sql.Timestamp; |
14 | @Data | 15 | @Data |
15 | public class CouponDTO implements Serializable { | 16 | public class CouponDTO implements Serializable { |
16 | 17 | ||
17 | // id | 18 | /** id */ |
18 | private Long id; | 19 | private Long id; |
19 | 20 | ||
20 | // 标识 | 21 | /** 标识 */ |
21 | private String code; | 22 | private String code; |
22 | 23 | ||
23 | // 名称 | 24 | /** 名称 */ |
24 | private String title; | 25 | private String title; |
25 | 26 | ||
26 | // 图片 | 27 | /** 图片 */ |
27 | private String images; | 28 | private String images; |
28 | 29 | ||
29 | // 发行量,-1代表不限量 | 30 | /** 发行量,-1代表不限量 */ |
30 | private Integer stock; | 31 | private Integer stock; |
31 | 32 | ||
32 | // 剩余量,-1代表不限量 | 33 | /** 剩余量,-1代表不限量 */ |
33 | private Integer remainStock; | 34 | private Integer remainStock; |
34 | 35 | ||
35 | // 优惠形式:1:现金;2:折扣 | 36 | /** 优惠形式:1:现金;2:折扣 */ |
36 | private Integer useType; | 37 | private Integer useType; |
37 | 38 | ||
38 | // 面额 | 39 | /** 面额 */ |
39 | private BigDecimal denomination; | 40 | private BigDecimal denomination; |
40 | 41 | ||
41 | // 折扣 | 42 | /** 折扣 */ |
42 | private BigDecimal discount; | 43 | private BigDecimal discount; |
43 | 44 | ||
44 | // 适用用户范围:1:新用户;2:全体用户 | 45 | /** 适用用户范围:1:新用户;2:全体用户 */ |
45 | private Integer userRange; | 46 | private Integer userRange; |
46 | 47 | ||
47 | // 限领次数 -1:无限次; >0:具体次数 | 48 | /** 限领次数 -1:无限次; >0:具体次数 */ |
48 | private Integer collectLimit; | 49 | private Integer collectLimit; |
49 | 50 | ||
50 | // 适用门槛:1:无门槛;2:满减形式 | 51 | /** 适用门槛:1:无门槛;2:满减形式 */ |
51 | private Integer thresholdType; | 52 | private Integer thresholdType; |
52 | 53 | ||
53 | // 满减门槛 | 54 | /** 满减门槛 */ |
54 | private BigDecimal amountThreshold; | 55 | private BigDecimal amountThreshold; |
55 | 56 | ||
56 | // 产品范围:1:全部商品;2:指定商品 | 57 | /** 产品范围:1:全部商品;2:指定商品 */ |
57 | private Integer itemRange; | 58 | private Integer itemRange; |
58 | 59 | ||
59 | // 生效形式:1:固定日期;2:相对日期 | 60 | /** 生效形式:1:固定日期;2:相对日期 */ |
60 | private Integer effectType; | 61 | private Integer effectType; |
61 | 62 | ||
62 | // 生效时间 | 63 | /** 生效时间 */ |
63 | private Timestamp startTime; | 64 | private Timestamp startTime; |
64 | 65 | ||
65 | // 过期时间 | 66 | /** 过期时间 */ |
66 | private Timestamp expireTime; | 67 | private LocalDateTime expireTime; |
67 | 68 | ||
68 | // 自领取当日,几天内有效 | 69 | /** 自领取当日,几天内有效 */ |
69 | private Integer validDays; | 70 | private Integer validDays; |
70 | 71 | ||
71 | // 使用说明 | 72 | /** 使用说明 */ |
72 | private String description; | 73 | private String description; |
73 | 74 | ||
74 | // 状态0:未开始,1:启用;2:停用 | 75 | /** 状态0:未开始,1:启用;2:停用 */ |
75 | private Integer status; | 76 | private Integer status; |
76 | 77 | ||
77 | // 创建时间 | 78 | /** 创建时间 */ |
78 | private Timestamp createTime; | 79 | private Timestamp createTime; |
79 | 80 | ||
80 | // 更新时间 | 81 | /** 更新时间 */ |
81 | private Timestamp updateTime; | 82 | private Timestamp updateTime; |
82 | } | 83 | } | ... | ... |
... | @@ -4,23 +4,16 @@ import com.topdraw.business.module.coupon.domain.Coupon; | ... | @@ -4,23 +4,16 @@ import com.topdraw.business.module.coupon.domain.Coupon; |
4 | import com.topdraw.business.module.coupon.repository.CouponRepository; | 4 | import com.topdraw.business.module.coupon.repository.CouponRepository; |
5 | import com.topdraw.business.module.coupon.service.CouponService; | 5 | import com.topdraw.business.module.coupon.service.CouponService; |
6 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | 6 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
7 | import com.topdraw.business.module.coupon.service.dto.CouponQueryCriteria; | ||
8 | import com.topdraw.business.module.coupon.service.mapper.CouponMapper; | 7 | import com.topdraw.business.module.coupon.service.mapper.CouponMapper; |
9 | import com.topdraw.utils.PageUtil; | 8 | import com.topdraw.exception.GlobeExceptionMsg; |
10 | import com.topdraw.utils.QueryHelp; | ||
11 | import com.topdraw.utils.StringUtils; | 9 | import com.topdraw.utils.StringUtils; |
12 | import com.topdraw.utils.ValidationUtil; | 10 | import com.topdraw.utils.ValidationUtil; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 11 | 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; | 12 | import org.springframework.stereotype.Service; |
18 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
19 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; |
20 | import org.springframework.util.Assert; | 15 | import org.springframework.util.Assert; |
21 | 16 | ||
22 | import java.util.List; | ||
23 | import java.util.Map; | ||
24 | 17 | ||
25 | /** | 18 | /** |
26 | * @author XiangHan | 19 | * @author XiangHan |
... | @@ -30,58 +23,24 @@ import java.util.Map; | ... | @@ -30,58 +23,24 @@ import java.util.Map; |
30 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
31 | public class CouponServiceImpl implements CouponService { | 24 | public class CouponServiceImpl implements CouponService { |
32 | 25 | ||
33 | @Autowired | ||
34 | private CouponRepository CouponRepository; | ||
35 | 26 | ||
36 | @Autowired | 27 | @Autowired |
37 | private CouponMapper CouponMapper; | 28 | private CouponMapper couponMapper; |
38 | 29 | @Autowired | |
39 | @Override | 30 | private CouponRepository couponRepository; |
40 | public Map<String, Object> queryAll(CouponQueryCriteria criteria, Pageable pageable) { | ||
41 | Page<Coupon> page = CouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
42 | return PageUtil.toPage(page.map(CouponMapper::toDto)); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public List<CouponDTO> queryAll(CouponQueryCriteria criteria) { | ||
47 | return CouponMapper.toDto(CouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
48 | } | ||
49 | 31 | ||
50 | @Override | 32 | @Override |
51 | public CouponDTO findById(Long id) { | 33 | public CouponDTO findById(Long id) { |
52 | Coupon Coupon = CouponRepository.findById(id).orElseGet(Coupon::new); | 34 | Assert.notNull(id, GlobeExceptionMsg.COUPON_ID_IS_NULL); |
53 | ValidationUtil.isNull(Coupon.getId(),"Coupon","id",id); | ||
54 | return CouponMapper.toDto(Coupon); | ||
55 | } | ||
56 | 35 | ||
57 | @Override | 36 | Coupon coupon = this.couponRepository.findById(id).orElseGet(Coupon::new); |
58 | @Transactional(rollbackFor = Exception.class) | 37 | ValidationUtil.isNull(coupon.getId(),"Coupon","id",id); |
59 | public void create(Coupon resources) { | 38 | return this.couponMapper.toDto(coupon); |
60 | CouponRepository.save(resources); | ||
61 | } | ||
62 | |||
63 | @Override | ||
64 | @Transactional(rollbackFor = Exception.class) | ||
65 | public void update(Coupon resources) { | ||
66 | Coupon Coupon = CouponRepository.findById(resources.getId()).orElseGet(Coupon::new); | ||
67 | ValidationUtil.isNull( Coupon.getId(),"Coupon","id",resources.getId()); | ||
68 | Coupon.copy(resources); | ||
69 | CouponRepository.save(Coupon); | ||
70 | } | 39 | } |
71 | 40 | ||
72 | @Override | 41 | @Override |
73 | @Transactional(rollbackFor = Exception.class) | ||
74 | public void delete(Long id) { | ||
75 | Assert.notNull(id, "The given id must not be null!"); | ||
76 | Coupon Coupon = CouponRepository.findById(id).orElseThrow( | ||
77 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", Coupon.class, id), 1)); | ||
78 | CouponRepository.delete(Coupon); | ||
79 | } | ||
80 | |||
81 | |||
82 | @Override | ||
83 | public CouponDTO getByCode(String code) { | 42 | public CouponDTO getByCode(String code) { |
84 | return StringUtils.isNotEmpty(code) ? CouponMapper.toDto(CouponRepository.findFirstByCode(code).orElseGet(Coupon::new)) | 43 | return StringUtils.isNotEmpty(code) ? this.couponMapper.toDto(this.couponRepository.findFirstByCode(code).orElseGet(Coupon::new)) |
85 | : new CouponDTO(); | 44 | : new CouponDTO(); |
86 | } | 45 | } |
87 | } | 46 | } | ... | ... |
... | @@ -23,70 +23,73 @@ import java.sql.Timestamp; | ... | @@ -23,70 +23,73 @@ import java.sql.Timestamp; |
23 | @Table(name="uc_exp_detail") | 23 | @Table(name="uc_exp_detail") |
24 | public class ExpDetail implements Serializable { | 24 | public class ExpDetail implements Serializable { |
25 | 25 | ||
26 | // 主键 | 26 | @Transient |
27 | private String memberCode; | ||
28 | |||
29 | /** 主键 */ | ||
27 | @Id | 30 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 31 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 32 | @Column(name = "id") |
30 | private Long id; | 33 | private Long id; |
31 | 34 | ||
32 | // 标识 | 35 | /** 标识 */ |
33 | @Column(name = "code", nullable = false) | 36 | @Column(name = "code", nullable = false) |
34 | private String code; | 37 | private String code; |
35 | 38 | ||
36 | // 应用code | 39 | /** 应用code */ |
37 | @Column(name = "app_code") | 40 | @Column(name = "app_code") |
38 | private String appCode; | 41 | private String appCode; |
39 | 42 | ||
40 | // 会员id | 43 | /** 会员id */ |
41 | @Column(name = "member_id", nullable = false) | 44 | @Column(name = "member_id", nullable = false) |
42 | private Long memberId; | 45 | private Long memberId; |
43 | 46 | ||
44 | // 账号id | 47 | /** 账号id */ |
45 | @Column(name = "account_id") | 48 | @Column(name = "account_id") |
46 | private Long accountId; | 49 | private Long accountId; |
47 | 50 | ||
48 | // 原始成长值 | 51 | /** 原始成长值 */ |
49 | @Column(name = "original_exp", nullable = false) | 52 | @Column(name = "original_exp", nullable = false) |
50 | private Long originalExp; | 53 | private Long originalExp; |
51 | 54 | ||
52 | // 结果成长值 | 55 | /** 结果成长值 */ |
53 | @Column(name = "result_exp", nullable = false) | 56 | @Column(name = "result_exp", nullable = false) |
54 | private Long resultExp; | 57 | private Long resultExp; |
55 | 58 | ||
56 | // 成长值变化,一般为正数 | 59 | /** 成长值变化,一般为正数 */ |
57 | @Column(name = "exp", nullable = false) | 60 | @Column(name = "exp", nullable = false) |
58 | private Long exp; | 61 | private Long exp; |
59 | 62 | ||
60 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 63 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
61 | @Column(name = "device_type", nullable = false) | 64 | @Column(name = "device_type", nullable = false) |
62 | private Integer deviceType; | 65 | private Integer deviceType; |
63 | 66 | ||
64 | // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 | 67 | /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */ |
65 | @Column(name = "evt_type", nullable = false) | 68 | @Column(name = "evt_type", nullable = false) |
66 | private Integer evtType; | 69 | private Integer evtType; |
67 | 70 | ||
68 | // 订单id(针对订购操作) | 71 | /** 订单id(针对订购操作) */ |
69 | @Column(name = "order_id") | 72 | @Column(name = "order_id") |
70 | private Long orderId; | 73 | private Long orderId; |
71 | 74 | ||
72 | // 节目id(针对观影操作) | 75 | /** 节目id(针对观影操作) */ |
73 | @Column(name = "media_id") | 76 | @Column(name = "media_id") |
74 | private Long mediaId; | 77 | private Long mediaId; |
75 | 78 | ||
76 | // 活动id(针对参与活动) | 79 | /** 活动id(针对参与活动) */ |
77 | @Column(name = "activity_id") | 80 | @Column(name = "activity_id") |
78 | private Long activityId; | 81 | private Long activityId; |
79 | 82 | ||
80 | // 成长值变化描述,用于管理侧显示 | 83 | /** 成长值变化描述,用于管理侧显示 */ |
81 | @Column(name = "description", nullable = false) | 84 | @Column(name = "description", nullable = false) |
82 | private String description; | 85 | private String description; |
83 | 86 | ||
84 | // 创建时间 | 87 | /** 创建时间 */ |
85 | @CreatedDate | 88 | @CreatedDate |
86 | @Column(name = "create_time") | 89 | @Column(name = "create_time") |
87 | private Timestamp createTime; | 90 | private Timestamp createTime; |
88 | 91 | ||
89 | // 更新时间 | 92 | /** 更新时间 */ |
90 | @LastModifiedDate | 93 | @LastModifiedDate |
91 | @Column(name = "update_time") | 94 | @Column(name = "update_time") |
92 | private Timestamp updateTime; | 95 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.exp.detail.domain; | ||
2 | |||
3 | import com.topdraw.exception.GlobeExceptionMsg; | ||
4 | import org.apache.commons.lang3.StringUtils; | ||
5 | import org.springframework.util.Assert; | ||
6 | |||
7 | import java.util.Objects; | ||
8 | |||
9 | public class ExpDetailBuilder { | ||
10 | |||
11 | public static ExpDetail build(Long memberId, Long originalExp, Long resultExp, | ||
12 | Integer deviceType, Integer evtType){ | ||
13 | ExpDetail expDetail = new ExpDetail(); | ||
14 | expDetail.setMemberId(memberId); | ||
15 | expDetail.setOriginalExp(originalExp); | ||
16 | expDetail.setResultExp(resultExp); | ||
17 | expDetail.setDeviceType(deviceType); | ||
18 | expDetail.setEvtType(evtType); | ||
19 | return build(expDetail); | ||
20 | } | ||
21 | |||
22 | public static ExpDetail build(ExpDetail expDetail){ | ||
23 | return build(expDetail.getId(), | ||
24 | expDetail.getCode(), | ||
25 | expDetail.getAppCode(), | ||
26 | expDetail.getMemberId(), | ||
27 | expDetail.getAccountId(), | ||
28 | expDetail.getOriginalExp(),expDetail.getResultExp(), | ||
29 | expDetail.getExp(),expDetail.getDeviceType(), | ||
30 | expDetail.getEvtType(), expDetail.getOrderId(), expDetail.getMediaId(), | ||
31 | expDetail.getActivityId(),expDetail.getDescription()); | ||
32 | } | ||
33 | |||
34 | public static ExpDetail build(Long id, String code, | ||
35 | String appCode, Long memberId, Long accountId, | ||
36 | Long originalExp, Long resultExp, Long exp, | ||
37 | Integer deviceType, Integer evtType, Long orderId, | ||
38 | Long mediaId, Long activityId, String description){ | ||
39 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
40 | |||
41 | ExpDetail expDetail = new ExpDetail(); | ||
42 | expDetail.setId(Objects.isNull(id)?null:id); | ||
43 | expDetail.setCode(StringUtils.isBlank(code)?null:code); | ||
44 | expDetail.setAppCode(StringUtils.isBlank(appCode)?null:appCode); | ||
45 | expDetail.setMemberId(Objects.isNull(memberId)?null:memberId); | ||
46 | expDetail.setAccountId(Objects.isNull(accountId)?null:accountId); | ||
47 | expDetail.setOriginalExp(Objects.isNull(originalExp)?0:originalExp); | ||
48 | expDetail.setResultExp(Objects.isNull(resultExp)?0:resultExp); | ||
49 | expDetail.setExp(Objects.isNull(exp)?0:exp); | ||
50 | expDetail.setDeviceType(Objects.isNull(deviceType)?null:deviceType); | ||
51 | expDetail.setEvtType(Objects.isNull(evtType)?null:evtType); | ||
52 | expDetail.setOrderId(Objects.isNull(orderId)?null:orderId); | ||
53 | expDetail.setMediaId(Objects.isNull(mediaId)?null:mediaId); | ||
54 | expDetail.setActivityId(Objects.isNull(activityId)?null:activityId); | ||
55 | expDetail.setDescription(StringUtils.isBlank(description)?null:description); | ||
56 | return expDetail; | ||
57 | } | ||
58 | |||
59 | } |
... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.exp.detail.service; | ... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.exp.detail.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
4 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; | 4 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
5 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 5 | ||
11 | /** | 6 | /** |
12 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -15,31 +10,28 @@ import java.util.Map; | ... | @@ -15,31 +10,28 @@ import java.util.Map; |
15 | public interface ExpDetailService { | 10 | public interface ExpDetailService { |
16 | 11 | ||
17 | /** | 12 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<ExpDetailDTO> | ||
29 | */ | ||
30 | List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 13 | * 根据ID查询 |
34 | * @param id ID | 14 | * @param id ID |
35 | * @return ExpDetailDTO | 15 | * @return ExpDetailDTO |
36 | */ | 16 | */ |
37 | ExpDetailDTO findById(Long id); | 17 | ExpDetailDTO findById(Long id); |
38 | 18 | ||
19 | /** | ||
20 | * | ||
21 | * @param resources | ||
22 | */ | ||
39 | void create(ExpDetail resources); | 23 | void create(ExpDetail resources); |
40 | 24 | ||
25 | /** | ||
26 | * | ||
27 | * @param resources | ||
28 | */ | ||
41 | void update(ExpDetail resources); | 29 | void update(ExpDetail resources); |
42 | 30 | ||
31 | /** | ||
32 | * | ||
33 | * @param id | ||
34 | */ | ||
43 | void delete(Long id); | 35 | void delete(Long id); |
44 | 36 | ||
45 | /** | 37 | /** | ... | ... |
... | @@ -13,51 +13,51 @@ import java.sql.Timestamp; | ... | @@ -13,51 +13,51 @@ import java.sql.Timestamp; |
13 | @Data | 13 | @Data |
14 | public class ExpDetailDTO implements Serializable { | 14 | public class ExpDetailDTO implements Serializable { |
15 | 15 | ||
16 | // 主键 | 16 | /** 主键 */ |
17 | private Long id; | 17 | private Long id; |
18 | 18 | ||
19 | // 标识 | 19 | /** 标识 */ |
20 | private String code; | 20 | private String code; |
21 | 21 | ||
22 | // 应用code | 22 | /** 应用code */ |
23 | private String appCode; | 23 | private String appCode; |
24 | 24 | ||
25 | // 会员id | 25 | /** 会员id */ |
26 | private Long memberId; | 26 | private Long memberId; |
27 | 27 | ||
28 | // 账号id | 28 | /** 账号id */ |
29 | private Long accountId; | 29 | private Long accountId; |
30 | 30 | ||
31 | // 原始成长值 | 31 | /** 原始成长值 */ |
32 | private Long originalExp; | 32 | private Long originalExp; |
33 | 33 | ||
34 | // 结果成长值 | 34 | /** 结果成长值 */ |
35 | private Long resultExp; | 35 | private Long resultExp; |
36 | 36 | ||
37 | // 成长值变化,一般为正数 | 37 | /** 成长值变化,一般为正数 */ |
38 | private Long exp; | 38 | private Long exp; |
39 | 39 | ||
40 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 40 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
41 | private Integer deviceType; | 41 | private Integer deviceType; |
42 | 42 | ||
43 | // 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 | 43 | /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;98:系统操作;99:其他 */ |
44 | private Integer evtType; | 44 | private Integer evtType; |
45 | 45 | ||
46 | // 订单id(针对订购操作) | 46 | /** 订单id(针对订购操作) */ |
47 | private Long orderId; | 47 | private Long orderId; |
48 | 48 | ||
49 | // 节目id(针对观影操作) | 49 | /** 节目id(针对观影操作) */ |
50 | private Long mediaId; | 50 | private Long mediaId; |
51 | 51 | ||
52 | // 活动id(针对参与活动) | 52 | /** 活动id(针对参与活动) */ |
53 | private Long activityId; | 53 | private Long activityId; |
54 | 54 | ||
55 | // 成长值变化描述,用于管理侧显示 | 55 | /** 成长值变化描述,用于管理侧显示 */ |
56 | private String description; | 56 | private String description; |
57 | 57 | ||
58 | // 创建时间 | 58 | /** 创建时间 */ |
59 | private Timestamp createTime; | 59 | private Timestamp createTime; |
60 | 60 | ||
61 | // 更新时间 | 61 | /** 更新时间 */ |
62 | private Timestamp updateTime; | 62 | private Timestamp updateTime; |
63 | } | 63 | } | ... | ... |
1 | package com.topdraw.business.module.exp.detail.service.impl; | 1 | package com.topdraw.business.module.exp.detail.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; | 3 | import com.topdraw.business.module.exp.detail.domain.ExpDetail; |
4 | import com.topdraw.business.module.exp.detail.domain.ExpDetailBuilder; | ||
4 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; | 5 | import com.topdraw.business.module.exp.detail.repository.ExpDetailRepository; |
5 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; | 6 | import com.topdraw.business.module.exp.detail.service.ExpDetailService; |
6 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; | 7 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailDTO; |
7 | import com.topdraw.business.module.exp.detail.service.dto.ExpDetailQueryCriteria; | ||
8 | import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; | 8 | import com.topdraw.business.module.exp.detail.service.mapper.ExpDetailMapper; |
9 | import com.topdraw.utils.PageUtil; | 9 | import com.topdraw.utils.RedisUtils; |
10 | import com.topdraw.utils.QueryHelp; | ||
11 | import com.topdraw.utils.StringUtils; | 10 | import com.topdraw.utils.StringUtils; |
12 | import com.topdraw.utils.ValidationUtil; | 11 | import com.topdraw.utils.ValidationUtil; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
14 | import org.springframework.dao.EmptyResultDataAccessException; | 13 | 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; | 14 | import org.springframework.stereotype.Service; |
18 | import org.springframework.transaction.annotation.Propagation; | 15 | import org.springframework.transaction.annotation.Propagation; |
19 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
20 | import org.springframework.util.Assert; | 17 | import org.springframework.util.Assert; |
21 | 18 | ||
22 | import java.util.List; | ||
23 | import java.util.Map; | ||
24 | 19 | ||
25 | /** | 20 | /** |
26 | * @author XiangHan | 21 | * @author XiangHan |
... | @@ -31,57 +26,56 @@ import java.util.Map; | ... | @@ -31,57 +26,56 @@ import java.util.Map; |
31 | public class ExpDetailServiceImpl implements ExpDetailService { | 26 | public class ExpDetailServiceImpl implements ExpDetailService { |
32 | 27 | ||
33 | @Autowired | 28 | @Autowired |
34 | private ExpDetailRepository ExpDetailRepository; | 29 | private ExpDetailRepository expDetailRepository; |
35 | |||
36 | @Autowired | 30 | @Autowired |
37 | private ExpDetailMapper ExpDetailMapper; | 31 | private ExpDetailMapper expDetailMapper; |
38 | |||
39 | @Override | ||
40 | public Map<String, Object> queryAll(ExpDetailQueryCriteria criteria, Pageable pageable) { | ||
41 | Page<ExpDetail> page = ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
42 | return PageUtil.toPage(page.map(ExpDetailMapper::toDto)); | ||
43 | } | ||
44 | 32 | ||
45 | @Override | 33 | @Autowired |
46 | public List<ExpDetailDTO> queryAll(ExpDetailQueryCriteria criteria) { | 34 | private RedisUtils redisUtils; |
47 | return ExpDetailMapper.toDto(ExpDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
48 | } | ||
49 | 35 | ||
50 | @Override | 36 | @Override |
51 | public ExpDetailDTO findById(Long id) { | 37 | public ExpDetailDTO findById(Long id) { |
52 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseGet(ExpDetail::new); | 38 | ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseGet(com.topdraw.business.module.exp.detail.domain.ExpDetail::new); |
53 | ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id); | 39 | ValidationUtil.isNull(ExpDetail.getId(),"ExpDetail","id",id); |
54 | return ExpDetailMapper.toDto(ExpDetail); | 40 | return this.expDetailMapper.toDto(ExpDetail); |
55 | } | 41 | } |
56 | 42 | ||
57 | @Override | 43 | @Override |
58 | @Transactional(rollbackFor = Exception.class) | 44 | @Transactional(rollbackFor = Exception.class) |
59 | public void create(ExpDetail resources) { | 45 | public void create(ExpDetail resources) { |
60 | ExpDetailRepository.save(resources); | 46 | ExpDetail expDetail = ExpDetailBuilder.build(resources); |
47 | this.expDetailRepository.save(expDetail); | ||
61 | } | 48 | } |
62 | 49 | ||
63 | @Override | 50 | @Override |
64 | @Transactional(rollbackFor = Exception.class) | 51 | @Transactional(rollbackFor = Exception.class) |
65 | public void update(ExpDetail resources) { | 52 | public void update(ExpDetail resources) { |
66 | ExpDetail ExpDetail = ExpDetailRepository.findById(resources.getId()).orElseGet(ExpDetail::new); | 53 | this.redisUtils.doLock("expDetail::memberId::" + resources.getMemberId()); |
67 | ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId()); | 54 | try { |
68 | ExpDetail.copy(resources); | 55 | ExpDetail ExpDetail = this.expDetailRepository.findById(resources.getId()).orElseGet(com.topdraw.business.module.exp.detail.domain.ExpDetail::new); |
69 | ExpDetailRepository.save(ExpDetail); | 56 | ValidationUtil.isNull( ExpDetail.getId(),"ExpDetail","id",resources.getId()); |
57 | ExpDetail.copy(resources); | ||
58 | this.expDetailRepository.save(ExpDetail); | ||
59 | } catch (Exception e) { | ||
60 | e.printStackTrace(); | ||
61 | throw e; | ||
62 | } finally { | ||
63 | this.redisUtils.doUnLock("expDetail::memberId::" + resources.getMemberId()); | ||
64 | } | ||
70 | } | 65 | } |
71 | 66 | ||
72 | @Override | 67 | @Override |
73 | @Transactional(rollbackFor = Exception.class) | 68 | @Transactional(rollbackFor = Exception.class) |
74 | public void delete(Long id) { | 69 | public void delete(Long id) { |
75 | Assert.notNull(id, "The given id must not be null!"); | 70 | Assert.notNull(id, "The given id must not be null!"); |
76 | ExpDetail ExpDetail = ExpDetailRepository.findById(id).orElseThrow( | 71 | ExpDetail ExpDetail = this.expDetailRepository.findById(id).orElseThrow( |
77 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpDetail.class, id), 1)); | 72 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.exp.detail.domain.ExpDetail.class, id), 1)); |
78 | ExpDetailRepository.delete(ExpDetail); | 73 | this.expDetailRepository.delete(ExpDetail); |
79 | } | 74 | } |
80 | 75 | ||
81 | |||
82 | @Override | 76 | @Override |
83 | public ExpDetailDTO getByCode(String code) { | 77 | public ExpDetailDTO getByCode(String code) { |
84 | return StringUtils.isNotEmpty(code) ? ExpDetailMapper.toDto(ExpDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) | 78 | return StringUtils.isNotEmpty(code) ? this.expDetailMapper.toDto(this.expDetailRepository.findFirstByCode(code).orElseGet(ExpDetail::new)) |
85 | : new ExpDetailDTO(); | 79 | : new ExpDetailDTO(); |
86 | } | 80 | } |
87 | } | 81 | } | ... | ... |
1 | package com.topdraw.business.module.exp.history.domain; | ||
2 | |||
3 | import com.topdraw.exception.GlobeExceptionMsg; | ||
4 | import com.topdraw.util.IdWorker; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.util.Objects; | ||
9 | |||
10 | public class ExpHistoryBuilder { | ||
11 | |||
12 | public ExpHistory build(Long memberId, Long originalExp, Long resultExp, Long exp,Integer deviceType , Integer evtType) { | ||
13 | ExpHistory expHistory = new ExpHistory(); | ||
14 | expHistory.setMemberId(memberId); | ||
15 | expHistory.setOriginalExp(originalExp); | ||
16 | expHistory.setResultExp(resultExp); | ||
17 | expHistory.setDeviceType(deviceType); | ||
18 | expHistory.setEvtType(evtType); | ||
19 | expHistory.setExp(exp); | ||
20 | return build(expHistory); | ||
21 | } | ||
22 | |||
23 | public ExpHistory build(ExpHistory expHistory) { | ||
24 | return build(expHistory.getId(),expHistory.getCode(), | ||
25 | expHistory.getMemberId(),expHistory.getAccountId(), | ||
26 | expHistory.getOriginalExp(),expHistory.getResultExp(),expHistory.getExp(), | ||
27 | expHistory.getDeviceType(),expHistory.getEvtType(),expHistory.getOrderId(), | ||
28 | expHistory.getMediaId(),expHistory.getActivityId(),expHistory.getDescription()); | ||
29 | } | ||
30 | |||
31 | public ExpHistory build(Long id,String code,Long memberId,Long accountId, | ||
32 | Long originalExp,Long resultExp,Long exp, | ||
33 | Integer deviceType,Integer evtType,Long orderId, | ||
34 | Long mediaId,Long activityId,String description) { | ||
35 | |||
36 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
37 | |||
38 | ExpHistory expHistory = new ExpHistory(); | ||
39 | expHistory.setId(Objects.isNull(id)?null:id); | ||
40 | expHistory.setCode(StringUtils.isBlank(code)? IdWorker.generatorCode("exp") :code); | ||
41 | expHistory.setMemberId(memberId); | ||
42 | expHistory.setAccountId(Objects.isNull(accountId)?null:accountId); | ||
43 | expHistory.setOriginalExp(Objects.isNull(originalExp)?0L:originalExp); | ||
44 | expHistory.setResultExp(Objects.isNull(resultExp)?0L:resultExp); | ||
45 | expHistory.setExp(Objects.isNull(exp)?0L:exp); | ||
46 | expHistory.setDeviceType(Objects.isNull(deviceType)?4:deviceType); | ||
47 | expHistory.setEvtType(Objects.isNull(evtType)?98:evtType); | ||
48 | expHistory.setOrderId(Objects.isNull(orderId)?null:orderId); | ||
49 | expHistory.setMediaId(Objects.isNull(mediaId)?null:mediaId); | ||
50 | expHistory.setActivityId(Objects.isNull(activityId)?null:activityId); | ||
51 | expHistory.setDescription(StringUtils.isBlank(description)?null:description); | ||
52 | return expHistory; | ||
53 | } | ||
54 | |||
55 | |||
56 | } |
... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.exp.history.service; | ... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.exp.history.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; | 3 | import com.topdraw.business.module.exp.history.domain.ExpHistory; |
4 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; | 4 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
5 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 5 | ||
11 | /** | 6 | /** |
12 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -15,33 +10,18 @@ import java.util.Map; | ... | @@ -15,33 +10,18 @@ import java.util.Map; |
15 | public interface ExpHistoryService { | 10 | public interface ExpHistoryService { |
16 | 11 | ||
17 | /** | 12 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(ExpHistoryQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<ExpHistoryDTO> | ||
29 | */ | ||
30 | List<ExpHistoryDTO> queryAll(ExpHistoryQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 13 | * 根据ID查询 |
34 | * @param id ID | 14 | * @param id ID |
35 | * @return ExpHistoryDTO | 15 | * @return ExpHistoryDTO |
36 | */ | 16 | */ |
37 | ExpHistoryDTO findById(Long id); | 17 | ExpHistoryDTO findById(Long id); |
38 | 18 | ||
19 | /** | ||
20 | * | ||
21 | * @param resources | ||
22 | */ | ||
39 | void create(ExpHistory resources); | 23 | void create(ExpHistory resources); |
40 | 24 | ||
41 | void update(ExpHistory resources); | ||
42 | |||
43 | void delete(Long id); | ||
44 | |||
45 | /** | 25 | /** |
46 | * Code校验 | 26 | * Code校验 |
47 | * @param code | 27 | * @param code | ... | ... |
... | @@ -4,23 +4,14 @@ import com.topdraw.business.module.exp.history.domain.ExpHistory; | ... | @@ -4,23 +4,14 @@ import com.topdraw.business.module.exp.history.domain.ExpHistory; |
4 | import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository; | 4 | import com.topdraw.business.module.exp.history.repository.ExpHistoryRepository; |
5 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; | 5 | import com.topdraw.business.module.exp.history.service.ExpHistoryService; |
6 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; | 6 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryDTO; |
7 | import com.topdraw.business.module.exp.history.service.dto.ExpHistoryQueryCriteria; | ||
8 | import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper; | 7 | import com.topdraw.business.module.exp.history.service.mapper.ExpHistoryMapper; |
9 | import com.topdraw.utils.PageUtil; | ||
10 | import com.topdraw.utils.QueryHelp; | ||
11 | import com.topdraw.utils.StringUtils; | 8 | import com.topdraw.utils.StringUtils; |
12 | import com.topdraw.utils.ValidationUtil; | 9 | import com.topdraw.utils.ValidationUtil; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 10 | 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; | 11 | import org.springframework.stereotype.Service; |
18 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
19 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
20 | import org.springframework.util.Assert; | ||
21 | 14 | ||
22 | import java.util.List; | ||
23 | import java.util.Map; | ||
24 | 15 | ||
25 | /** | 16 | /** |
26 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -31,57 +22,28 @@ import java.util.Map; | ... | @@ -31,57 +22,28 @@ import java.util.Map; |
31 | public class ExpHistoryServiceImpl implements ExpHistoryService { | 22 | public class ExpHistoryServiceImpl implements ExpHistoryService { |
32 | 23 | ||
33 | @Autowired | 24 | @Autowired |
34 | private ExpHistoryRepository ExpHistoryRepository; | 25 | private ExpHistoryMapper expHistoryMapper; |
35 | |||
36 | @Autowired | 26 | @Autowired |
37 | private ExpHistoryMapper ExpHistoryMapper; | 27 | private ExpHistoryRepository expHistoryRepository; |
38 | 28 | ||
39 | @Override | ||
40 | public Map<String, Object> queryAll(ExpHistoryQueryCriteria criteria, Pageable pageable) { | ||
41 | Page<ExpHistory> page = ExpHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
42 | return PageUtil.toPage(page.map(ExpHistoryMapper::toDto)); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public List<ExpHistoryDTO> queryAll(ExpHistoryQueryCriteria criteria) { | ||
47 | return ExpHistoryMapper.toDto(ExpHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
48 | } | ||
49 | 29 | ||
50 | @Override | 30 | @Override |
51 | public ExpHistoryDTO findById(Long id) { | 31 | public ExpHistoryDTO findById(Long id) { |
52 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseGet(ExpHistory::new); | 32 | ExpHistory ExpHistory = this.expHistoryRepository.findById(id).orElseGet(ExpHistory::new); |
53 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); | 33 | ValidationUtil.isNull(ExpHistory.getId(),"ExpHistory","id",id); |
54 | return ExpHistoryMapper.toDto(ExpHistory); | 34 | return this.expHistoryMapper.toDto(ExpHistory); |
55 | } | 35 | } |
56 | 36 | ||
57 | @Override | 37 | @Override |
58 | @Transactional(rollbackFor = Exception.class) | 38 | @Transactional(rollbackFor = Exception.class) |
59 | public void create(ExpHistory resources) { | 39 | public void create(ExpHistory resources) { |
60 | ExpHistoryRepository.save(resources); | 40 | this.expHistoryRepository.save(resources); |
61 | } | ||
62 | |||
63 | @Override | ||
64 | @Transactional(rollbackFor = Exception.class) | ||
65 | public void update(ExpHistory resources) { | ||
66 | ExpHistory ExpHistory = ExpHistoryRepository.findById(resources.getId()).orElseGet(ExpHistory::new); | ||
67 | ValidationUtil.isNull( ExpHistory.getId(),"ExpHistory","id",resources.getId()); | ||
68 | ExpHistory.copy(resources); | ||
69 | ExpHistoryRepository.save(ExpHistory); | ||
70 | } | ||
71 | |||
72 | @Override | ||
73 | @Transactional(rollbackFor = Exception.class) | ||
74 | public void delete(Long id) { | ||
75 | Assert.notNull(id, "The given id must not be null!"); | ||
76 | ExpHistory ExpHistory = ExpHistoryRepository.findById(id).orElseThrow( | ||
77 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", ExpHistory.class, id), 1)); | ||
78 | ExpHistoryRepository.delete(ExpHistory); | ||
79 | } | 41 | } |
80 | 42 | ||
81 | 43 | ||
82 | @Override | 44 | @Override |
83 | public ExpHistoryDTO getByCode(String code) { | 45 | public ExpHistoryDTO getByCode(String code) { |
84 | return StringUtils.isNotEmpty(code) ? ExpHistoryMapper.toDto(ExpHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) | 46 | return StringUtils.isNotEmpty(code) ? this.expHistoryMapper.toDto(this.expHistoryRepository.findFirstByCode(code).orElseGet(ExpHistory::new)) |
85 | : new ExpHistoryDTO(); | 47 | : new ExpHistoryDTO(); |
86 | } | 48 | } |
87 | } | 49 | } | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.domain; | ... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.address.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.module.common.domain.AsyncMqModule; | ||
5 | import lombok.Data; | 6 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 7 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 8 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -10,7 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ... | @@ -10,7 +11,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 11 | ||
11 | import javax.persistence.*; | 12 | import javax.persistence.*; |
12 | import java.io.Serializable; | 13 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | 14 | import java.time.LocalDateTime; |
14 | 15 | ||
15 | /** | 16 | /** |
16 | * @author XiangHan | 17 | * @author XiangHan |
... | @@ -21,78 +22,75 @@ import java.sql.Timestamp; | ... | @@ -21,78 +22,75 @@ import java.sql.Timestamp; |
21 | @EntityListeners(AuditingEntityListener.class) | 22 | @EntityListeners(AuditingEntityListener.class) |
22 | @Accessors(chain = true) | 23 | @Accessors(chain = true) |
23 | @Table(name="uc_member_address") | 24 | @Table(name="uc_member_address") |
24 | public class MemberAddress implements Serializable { | 25 | public class MemberAddress extends AsyncMqModule implements Serializable { |
25 | 26 | ||
26 | // 主键 | 27 | /** 主键 */ |
27 | @Id | 28 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 30 | @Column(name = "id") |
30 | private Long id; | 31 | private Long id; |
31 | 32 | ||
32 | // 会员id | 33 | /** 会员id */ |
33 | @Column(name = "member_id", nullable = false) | 34 | @Column(name = "member_id", nullable = false) |
34 | private Long memberId; | 35 | private Long memberId; |
35 | 36 | ||
36 | @Transient | 37 | /** 类型 1:家;2:公司;3:学校 */ |
37 | private String memberCode; | ||
38 | |||
39 | // 类型 1:家;2:公司;3:学校 | ||
40 | @Column(name = "type", nullable = false) | 38 | @Column(name = "type", nullable = false) |
41 | private Integer type; | 39 | private Integer type; |
42 | 40 | ||
43 | // 是否默认地址 | 41 | /** 是否默认地址 */ |
44 | @Column(name = "is_default", nullable = false) | 42 | @Column(name = "is_default", nullable = false) |
45 | private Integer isDefault; | 43 | private Integer isDefault; |
46 | 44 | ||
47 | // 显示顺序 | 45 | /** 显示顺序 */ |
48 | @Column(name = "sequence") | 46 | @Column(name = "sequence") |
49 | private Integer sequence; | 47 | private Integer sequence; |
50 | 48 | ||
51 | // 状态 0:不可用;1-可用 | 49 | /** 状态 0:不可用;1-可用 */ |
52 | @Column(name = "status", nullable = false) | 50 | @Column(name = "status", nullable = false) |
53 | private Integer status; | 51 | private Integer status; |
54 | 52 | ||
55 | // 联系人姓名 | 53 | /** 联系人姓名 */ |
56 | @Column(name = "contactor", nullable = false) | 54 | @Column(name = "contactor", nullable = false) |
57 | private String contactor; | 55 | private String contactor; |
58 | 56 | ||
59 | // 联系人电话 | 57 | /** 联系人电话 */ |
60 | @Column(name = "cellphone", nullable = false) | 58 | @Column(name = "cellphone", nullable = false) |
61 | private String cellphone; | 59 | private String cellphone; |
62 | 60 | ||
63 | // 国家 | 61 | /** 国家 */ |
64 | @Column(name = "country", nullable = false) | 62 | @Column(name = "country", nullable = false) |
65 | private String country; | 63 | private String country; |
66 | 64 | ||
67 | // 省份 | 65 | /** 省份 */ |
68 | @Column(name = "province", nullable = false) | 66 | @Column(name = "province", nullable = false) |
69 | private String province; | 67 | private String province; |
70 | 68 | ||
71 | // 城市 | 69 | /** 城市 */ |
72 | @Column(name = "city", nullable = false) | 70 | @Column(name = "city", nullable = false) |
73 | private String city; | 71 | private String city; |
74 | 72 | ||
75 | // 区县 | 73 | /** 区县 */ |
76 | @Column(name = "district", nullable = false) | 74 | @Column(name = "district", nullable = false) |
77 | private String district; | 75 | private String district; |
78 | 76 | ||
79 | // 地址 | 77 | /** 地址 */ |
80 | @Column(name = "address", nullable = false) | 78 | @Column(name = "address", nullable = false) |
81 | private String address; | 79 | private String address; |
82 | 80 | ||
83 | // 邮编 | 81 | /** 邮编 */ |
84 | @Column(name = "zip_code") | 82 | @Column(name = "zip_code") |
85 | private String zipCode; | 83 | private String zipCode; |
86 | 84 | ||
87 | // 创建时间 | 85 | /** 创建时间 */ |
88 | @CreatedDate | 86 | @CreatedDate |
89 | @Column(name = "create_time") | 87 | @Column(name = "create_time") |
90 | private Timestamp createTime; | 88 | private LocalDateTime createTime; |
91 | 89 | ||
92 | // 更新时间 | 90 | /** 更新时间 */ |
93 | @LastModifiedDate | 91 | @LastModifiedDate |
94 | @Column(name = "update_time") | 92 | @Column(name = "update_time") |
95 | private Timestamp updateTime; | 93 | private LocalDateTime updateTime; |
96 | 94 | ||
97 | public void copy(MemberAddress source){ | 95 | public void copy(MemberAddress source){ |
98 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 96 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ... | ... |
src/main/java/com/topdraw/business/module/member/address/domain/MemberAddressBuilder.java
0 → 100644
1 | package com.topdraw.business.module.member.address.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.exception.GlobeExceptionMsg; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.util.Objects; | ||
9 | |||
10 | /** | ||
11 | * @author : | ||
12 | * @description: | ||
13 | * @function : | ||
14 | * @date :Created in 2022/3/11 11:08 | ||
15 | * @version: : | ||
16 | * @modified By: | ||
17 | * @since : modified in 2022/3/11 11:08 | ||
18 | */ | ||
19 | public class MemberAddressBuilder { | ||
20 | |||
21 | private static final Integer DEFAULT_VALUE_0 = 0; | ||
22 | private static final Integer DEFAULT_VALUE_1 = 1; | ||
23 | |||
24 | public static MemberAddress build(MemberAddress memberAddress, Long memberId, String memberCode){ | ||
25 | Long id = memberAddress.getId(); | ||
26 | Integer type = memberAddress.getType(); | ||
27 | Integer isDefault = memberAddress.getIsDefault(); | ||
28 | Integer sequence = memberAddress.getSequence(); | ||
29 | Integer status= memberAddress.getStatus(); | ||
30 | String contactor = memberAddress.getContactor(); | ||
31 | String cellphone = memberAddress.getCellphone(); | ||
32 | String country = memberAddress.getCountry(); | ||
33 | String province = memberAddress.getProvince(); | ||
34 | String city = memberAddress.getCity(); | ||
35 | String district = memberAddress.getDistrict(); | ||
36 | String address = memberAddress.getAddress(); | ||
37 | String zipCode = memberAddress.getZipCode(); | ||
38 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | ||
39 | contactor,cellphone,country,province,city,district,address,zipCode); | ||
40 | } | ||
41 | |||
42 | public static MemberAddress build(MemberAddress memberAddress, Member member){ | ||
43 | Long id = memberAddress.getId(); | ||
44 | Long memberId = member.getId(); | ||
45 | String memberCode = member.getCode(); | ||
46 | Integer type = memberAddress.getType(); | ||
47 | Integer isDefault = memberAddress.getIsDefault(); | ||
48 | Integer sequence = memberAddress.getSequence(); | ||
49 | Integer status= memberAddress.getStatus(); | ||
50 | String contactor = memberAddress.getContactor(); | ||
51 | String cellphone = memberAddress.getCellphone(); | ||
52 | String country = memberAddress.getCountry(); | ||
53 | String province = memberAddress.getProvince(); | ||
54 | String city = memberAddress.getCity(); | ||
55 | String district = memberAddress.getDistrict(); | ||
56 | String address = memberAddress.getAddress(); | ||
57 | String zipCode = memberAddress.getZipCode(); | ||
58 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | ||
59 | contactor,cellphone,country,province,city,district,address,zipCode); | ||
60 | } | ||
61 | |||
62 | public static MemberAddress build(MemberAddress memberAddress){ | ||
63 | Long id = memberAddress.getId(); | ||
64 | Long memberId = memberAddress.getMemberId(); | ||
65 | String memberCode = memberAddress.getMemberCode(); | ||
66 | Integer type = memberAddress.getType(); | ||
67 | Integer isDefault = memberAddress.getIsDefault(); | ||
68 | Integer sequence = memberAddress.getSequence(); | ||
69 | Integer status= memberAddress.getStatus(); | ||
70 | String contactor = memberAddress.getContactor(); | ||
71 | String cellphone = memberAddress.getCellphone(); | ||
72 | String country = memberAddress.getCountry(); | ||
73 | String province = memberAddress.getProvince(); | ||
74 | String city = memberAddress.getCity(); | ||
75 | String district = memberAddress.getDistrict(); | ||
76 | String address = memberAddress.getAddress(); | ||
77 | String zipCode = memberAddress.getZipCode(); | ||
78 | return build(id,memberId,memberCode,type,isDefault,sequence,status, | ||
79 | contactor,cellphone,country,province,city,district,address,zipCode); | ||
80 | } | ||
81 | |||
82 | |||
83 | public static MemberAddress build(Long id , Long memberId, String memberCode, | ||
84 | Integer sequence, Integer type , Integer isDefault , Integer status, | ||
85 | String contactor, String cellphone, | ||
86 | String country, String province, String city, | ||
87 | String district, String address, String zipCode){ | ||
88 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
89 | |||
90 | MemberAddress memberAddress = new MemberAddress(); | ||
91 | memberAddress.setId(Objects.nonNull(id)?null:id); | ||
92 | memberAddress.setMemberId(Objects.isNull(memberId)?null:memberId); | ||
93 | memberAddress.setMemberCode(stringIsNull(memberCode)); | ||
94 | |||
95 | memberAddress.setSequence(Objects.nonNull(sequence)?null:DEFAULT_VALUE_1); | ||
96 | memberAddress.setType(Objects.isNull(type)?null:DEFAULT_VALUE_0); | ||
97 | memberAddress.setIsDefault(Objects.nonNull(isDefault)?null:DEFAULT_VALUE_0); | ||
98 | memberAddress.setStatus(Objects.isNull(status)?null:DEFAULT_VALUE_1); | ||
99 | |||
100 | memberAddress.setContactor(stringIsNull(contactor)); | ||
101 | memberAddress.setCellphone(stringIsNull(cellphone)); | ||
102 | |||
103 | memberAddress.setCountry(stringIsNull(country)); | ||
104 | memberAddress.setProvince(stringIsNull(province)); | ||
105 | memberAddress.setCity(stringIsNull(city)); | ||
106 | memberAddress.setDistrict(stringIsNull(district)); | ||
107 | memberAddress.setAddress(stringIsNull(address)); | ||
108 | memberAddress.setZipCode(stringIsNull(zipCode)); | ||
109 | |||
110 | return memberAddress; | ||
111 | |||
112 | } | ||
113 | |||
114 | private static String stringIsNull(String s){ | ||
115 | return StringUtils.isBlank(s)?"":s; | ||
116 | } | ||
117 | |||
118 | } |
... | @@ -4,13 +4,12 @@ import com.topdraw.business.module.member.address.domain.MemberAddress; | ... | @@ -4,13 +4,12 @@ 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 | ||
7 | import java.util.Optional; | ||
8 | |||
9 | /** | 7 | /** |
10 | * @author XiangHan | 8 | * @author XiangHan |
11 | * @date 2021-10-22 | 9 | * @date 2021-10-22 |
12 | */ | 10 | */ |
13 | public interface MemberAddressRepository extends JpaRepository<MemberAddress, Long>, JpaSpecificationExecutor<MemberAddress> { | 11 | public interface MemberAddressRepository extends JpaRepository<MemberAddress, Long>, JpaSpecificationExecutor<MemberAddress> { |
14 | 12 | ||
15 | Optional<MemberAddress> findByMemberIdAndSequence(Long memberId, Integer sequence); | 13 | |
14 | MemberAddress findByMemberIdAndSequence(Long memberId, Integer sequence); | ||
16 | } | 15 | } | ... | ... |
... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.member.address.service; | ... | @@ -2,11 +2,6 @@ package com.topdraw.business.module.member.address.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 4 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
5 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 5 | ||
11 | /** | 6 | /** |
12 | * @author XiangHan | 7 | * @author XiangHan |
... | @@ -15,31 +10,35 @@ import java.util.Map; | ... | @@ -15,31 +10,35 @@ import java.util.Map; |
15 | public interface MemberAddressService { | 10 | public interface MemberAddressService { |
16 | 11 | ||
17 | /** | 12 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(MemberAddressQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<MemberAddressDTO> | ||
29 | */ | ||
30 | List<MemberAddressDTO> queryAll(MemberAddressQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 13 | * 根据ID查询 |
34 | * @param id ID | 14 | * @param resources ID |
35 | * @return MemberAddressDTO | 15 | * @return MemberAddressDTO |
36 | */ | 16 | */ |
37 | MemberAddressDTO findById(Long id); | 17 | MemberAddressDTO findById(Long resources); |
38 | 18 | ||
39 | void create(MemberAddress resources); | 19 | /** |
20 | * 保存会员地址 | ||
21 | * @param resources | ||
22 | */ | ||
23 | MemberAddressDTO create(MemberAddress resources); | ||
40 | 24 | ||
41 | void update(MemberAddress resources); | 25 | /** |
26 | * 修改会员地址 | ||
27 | * @param resources | ||
28 | */ | ||
29 | MemberAddressDTO update(MemberAddress resources); | ||
42 | 30 | ||
43 | void delete(Long id); | 31 | /** |
32 | * 通过id删除 | ||
33 | * @param resources | ||
34 | */ | ||
35 | void delete(Long resources); | ||
44 | 36 | ||
37 | /** | ||
38 | * | ||
39 | * @param memberId | ||
40 | * @param sequence | ||
41 | * @return | ||
42 | */ | ||
43 | MemberAddressDTO findByMemberIdAndSequence(Long memberId, Integer sequence); | ||
45 | } | 44 | } | ... | ... |
... | @@ -3,7 +3,7 @@ package com.topdraw.business.module.member.address.service.dto; | ... | @@ -3,7 +3,7 @@ package com.topdraw.business.module.member.address.service.dto; |
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | import java.sql.Timestamp; | 6 | import java.time.LocalDateTime; |
7 | 7 | ||
8 | 8 | ||
9 | /** | 9 | /** |
... | @@ -13,51 +13,54 @@ import java.sql.Timestamp; | ... | @@ -13,51 +13,54 @@ import java.sql.Timestamp; |
13 | @Data | 13 | @Data |
14 | public class MemberAddressDTO implements Serializable { | 14 | public class MemberAddressDTO implements Serializable { |
15 | 15 | ||
16 | // 主键 | 16 | /** 会员code */ |
17 | private String memberCode; | ||
18 | |||
19 | /** 主键 */ | ||
17 | private Long id; | 20 | private Long id; |
18 | 21 | ||
19 | // 会员id | 22 | /** 会员id */ |
20 | private Long memberId; | 23 | private Long memberId; |
21 | 24 | ||
22 | // 类型 1:家;2:公司;3:学校 | 25 | /** 类型 1:家;2:公司;3:学校 */ |
23 | private Integer type; | 26 | private Integer type; |
24 | 27 | ||
25 | // 是否默认地址 | 28 | /** 是否默认地址 */ |
26 | private Integer isDefault; | 29 | private Integer isDefault; |
27 | 30 | ||
28 | // 显示顺序 | 31 | /** 显示顺序 */ |
29 | private Integer sequence; | 32 | private Integer sequence; |
30 | 33 | ||
31 | // 状态 0:不可用;1-可用 | 34 | /** 状态 0:不可用;1-可用 */ |
32 | private Integer status; | 35 | private Integer status; |
33 | 36 | ||
34 | // 联系人姓名 | 37 | /** 联系人姓名 */ |
35 | private String contactor; | 38 | private String contactor; |
36 | 39 | ||
37 | // 联系人电话 | 40 | /** 联系人电话 */ |
38 | private String cellphone; | 41 | private String cellphone; |
39 | 42 | ||
40 | // 国家 | 43 | /** 国家 */ |
41 | private String country; | 44 | private String country; |
42 | 45 | ||
43 | // 省份 | 46 | /** 省份 */ |
44 | private String province; | 47 | private String province; |
45 | 48 | ||
46 | // 城市 | 49 | /** 城市 */ |
47 | private String city; | 50 | private String city; |
48 | 51 | ||
49 | // 区县 | 52 | /** 区县 */ |
50 | private String district; | 53 | private String district; |
51 | 54 | ||
52 | // 地址 | 55 | /** 地址 */ |
53 | private String address; | 56 | private String address; |
54 | 57 | ||
55 | // 邮编 | 58 | /** 邮编 */ |
56 | private String zipCode; | 59 | private String zipCode; |
57 | 60 | ||
58 | // 创建时间 | 61 | /** 创建时间 */ |
59 | private Timestamp createTime; | 62 | private LocalDateTime createTime; |
60 | 63 | ||
61 | // 更新时间 | 64 | /** 更新时间 */ |
62 | private Timestamp updateTime; | 65 | private LocalDateTime updateTime; |
63 | } | 66 | } | ... | ... |
1 | package com.topdraw.business.module.member.address.service.impl; | 1 | package com.topdraw.business.module.member.address.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
4 | import com.topdraw.business.module.member.address.domain.MemberAddressBuilder; | ||
4 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; | 5 | import com.topdraw.business.module.member.address.repository.MemberAddressRepository; |
5 | import com.topdraw.business.module.member.address.service.MemberAddressService; | 6 | import com.topdraw.business.module.member.address.service.MemberAddressService; |
6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | 7 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; |
7 | import com.topdraw.business.module.member.address.service.dto.MemberAddressQueryCriteria; | ||
8 | import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper; | 8 | import com.topdraw.business.module.member.address.service.mapper.MemberAddressMapper; |
9 | import com.topdraw.business.module.member.service.MemberService; | 9 | import com.topdraw.business.module.member.service.MemberService; |
10 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 10 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.utils.PageUtil; | ||
12 | import com.topdraw.utils.QueryHelp; | ||
13 | import com.topdraw.utils.ValidationUtil; | 11 | import com.topdraw.utils.ValidationUtil; |
12 | import lombok.extern.slf4j.Slf4j; | ||
13 | import org.springframework.beans.BeanUtils; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.dao.EmptyResultDataAccessException; | 15 | import org.springframework.dao.EmptyResultDataAccessException; |
16 | import org.springframework.data.domain.Page; | ||
17 | import org.springframework.data.domain.Pageable; | ||
18 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
19 | import org.springframework.transaction.annotation.Propagation; | 17 | import org.springframework.transaction.annotation.Propagation; |
20 | import org.springframework.transaction.annotation.Transactional; | 18 | import org.springframework.transaction.annotation.Transactional; |
21 | import org.springframework.util.Assert; | 19 | import org.springframework.util.Assert; |
22 | 20 | ||
23 | import java.util.List; | ||
24 | import java.util.Map; | ||
25 | import java.util.Objects; | ||
26 | import java.util.Optional; | ||
27 | |||
28 | /** | 21 | /** |
29 | * @author XiangHan | 22 | * @author XiangHan |
30 | * @date 2021-10-22 | 23 | * @date 2021-10-22 |
31 | */ | 24 | */ |
32 | @Service | 25 | @Service |
33 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 26 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
27 | @Slf4j | ||
34 | public class MemberAddressServiceImpl implements MemberAddressService { | 28 | public class MemberAddressServiceImpl implements MemberAddressService { |
35 | 29 | ||
36 | @Autowired | 30 | @Autowired |
37 | private MemberAddressRepository MemberAddressRepository; | 31 | private MemberService memberService; |
38 | |||
39 | @Autowired | 32 | @Autowired |
40 | private MemberAddressMapper MemberAddressMapper; | 33 | private MemberAddressMapper memberAddressMapper; |
41 | @Autowired | 34 | @Autowired |
42 | private MemberService memberService; | 35 | private MemberAddressRepository memberAddressRepository; |
43 | 36 | ||
44 | @Override | ||
45 | public Map<String, Object> queryAll(MemberAddressQueryCriteria criteria, Pageable pageable) { | ||
46 | Page<MemberAddress> page = MemberAddressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
47 | return PageUtil.toPage(page.map(MemberAddressMapper::toDto)); | ||
48 | } | ||
49 | |||
50 | @Override | ||
51 | public List<MemberAddressDTO> queryAll(MemberAddressQueryCriteria criteria) { | ||
52 | return MemberAddressMapper.toDto(MemberAddressRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
53 | } | ||
54 | |||
55 | @Override | 37 | @Override |
56 | public MemberAddressDTO findById(Long id) { | 38 | public MemberAddressDTO findById(Long id) { |
57 | MemberAddress MemberAddress = MemberAddressRepository.findById(id).orElseGet(MemberAddress::new); | 39 | Assert.notNull(id,"id can't be null"); |
40 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseGet(MemberAddress::new); | ||
58 | ValidationUtil.isNull(MemberAddress.getId(),"MemberAddress","id",id); | 41 | ValidationUtil.isNull(MemberAddress.getId(),"MemberAddress","id",id); |
59 | return MemberAddressMapper.toDto(MemberAddress); | 42 | return this.memberAddressMapper.toDto(MemberAddress); |
60 | } | 43 | } |
61 | 44 | ||
62 | @Override | 45 | @Override |
63 | @Transactional(rollbackFor = Exception.class) | 46 | @Transactional(rollbackFor = Exception.class) |
64 | public void create(MemberAddress resources) { | 47 | public MemberAddressDTO create(MemberAddress resources) { |
65 | String memberCode = resources.getMemberCode(); | 48 | log.info("MemberAddressServiceImpl ==>> create ==>> param ==>> [{}]",resources); |
66 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | 49 | MemberAddress memberAddress = this.memberAddressRepository.save(resources); |
67 | Long id = memberDTO.getId(); | 50 | |
68 | resources.setMemberId(id); | 51 | log.info("MemberAddressServiceImpl ==>> create ==>> result ==>> [{}]",resources); |
69 | MemberAddressRepository.save(resources); | 52 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); |
53 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); | ||
54 | return memberAddressDTO; | ||
55 | |||
70 | } | 56 | } |
71 | 57 | ||
72 | @Override | 58 | @Override |
73 | @Transactional(rollbackFor = Exception.class) | 59 | @Transactional(rollbackFor = Exception.class) |
74 | public void update(MemberAddress resources) { | 60 | public MemberAddressDTO update(MemberAddress resources) { |
75 | String memberCode = resources.getMemberCode(); | 61 | log.info("MemberAddressServiceImpl ==>> update ==>> param ==>> [{}]",resources); |
76 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | 62 | Assert.notNull(resources.getId(),"id can't be null"); |
77 | if (Objects.nonNull(memberDTO)) { | 63 | try { |
78 | Long memberId = memberDTO.getId(); | 64 | MemberAddress _memberAddress = this.memberAddressRepository.findById(resources.getId()).orElseGet(MemberAddress::new); |
79 | Integer sequence = resources.getSequence(); | 65 | ValidationUtil.isNull( _memberAddress.getId(),"MemberAddress","id",resources.getId()); |
80 | Assert.notNull(sequence,"sequence can't be null!"); | 66 | _memberAddress.copy(resources); |
81 | Optional<MemberAddress> memberAddressOptional = MemberAddressRepository.findByMemberIdAndSequence(memberId,sequence); | 67 | MemberAddress memberAddress = this.memberAddressRepository.save(_memberAddress); |
82 | if (memberAddressOptional.isPresent()) { | 68 | |
83 | MemberAddress memberAddress = memberAddressOptional.get(); | 69 | MemberAddressDTO memberAddressDTO = new MemberAddressDTO(); |
84 | ValidationUtil.isNull(memberAddress.getId(),"MemberAddress","id",resources.getId()); | 70 | BeanUtils.copyProperties(memberAddress, memberAddressDTO); |
85 | resources.setId(memberAddress.getId()); | 71 | |
86 | memberAddress.copy(resources); | 72 | return memberAddressDTO; |
87 | MemberAddressRepository.save(memberAddress); | 73 | |
88 | } | 74 | } catch (Exception e) { |
75 | e.printStackTrace(); | ||
76 | throw e; | ||
89 | } | 77 | } |
78 | |||
90 | } | 79 | } |
91 | 80 | ||
92 | @Override | 81 | @Override |
93 | @Transactional(rollbackFor = Exception.class) | 82 | @Transactional(rollbackFor = Exception.class) |
94 | public void delete(Long id) { | 83 | public void delete(Long id) { |
95 | Assert.notNull(id, "The given id must not be null!"); | 84 | Assert.notNull(id, "The given id must not be null!"); |
96 | MemberAddress MemberAddress = MemberAddressRepository.findById(id).orElseThrow( | 85 | MemberAddress MemberAddress = this.memberAddressRepository.findById(id).orElseThrow( |
97 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberAddress.class, id), 1)); | 86 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberAddress.class, id), 1)); |
98 | MemberAddressRepository.delete(MemberAddress); | 87 | this.memberAddressRepository.delete(MemberAddress); |
99 | } | 88 | } |
100 | 89 | ||
90 | @Override | ||
91 | public MemberAddressDTO findByMemberIdAndSequence(Long memberId, Integer sequence) { | ||
92 | MemberAddress memberAddress = this.memberAddressRepository.findByMemberIdAndSequence(memberId, sequence); | ||
93 | return this.memberAddressMapper.toDto(memberAddress); | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * 检查会员 | ||
98 | * @param memberAddress | ||
99 | * @return | ||
100 | */ | ||
101 | private MemberDTO checkMember(MemberAddress memberAddress){ | ||
102 | Long memberId = memberAddress.getMemberId(); | ||
103 | String memberCode = memberAddress.getMemberCode(); | ||
104 | return this.checkMember(memberId,memberCode); | ||
105 | } | ||
106 | |||
107 | /** | ||
108 | * 检查会员 | ||
109 | * @param memberId 会员id | ||
110 | * @param memberCode 会员code | ||
111 | * @return | ||
112 | */ | ||
113 | private MemberDTO checkMember(Long memberId, String memberCode) { | ||
114 | return this.memberService.checkMember(memberId, memberCode); | ||
115 | } | ||
101 | 116 | ||
102 | } | 117 | } | ... | ... |
... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.domain; | ... | @@ -2,6 +2,7 @@ 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.module.common.validated.UpdateGroup; | ||
5 | import lombok.Data; | 6 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 7 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 8 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -9,8 +10,8 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -9,8 +10,8 @@ import org.springframework.data.annotation.LastModifiedDate; |
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 11 | ||
11 | import javax.persistence.*; | 12 | import javax.persistence.*; |
13 | import javax.validation.constraints.NotNull; | ||
12 | import java.io.Serializable; | 14 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | ||
14 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
15 | 16 | ||
16 | /** | 17 | /** |
... | @@ -24,115 +25,116 @@ import java.time.LocalDateTime; | ... | @@ -24,115 +25,116 @@ import java.time.LocalDateTime; |
24 | @Table(name="uc_member") | 25 | @Table(name="uc_member") |
25 | public class Member implements Serializable { | 26 | public class Member implements Serializable { |
26 | 27 | ||
27 | // 运营商平台账号 | 28 | /** 运营商平台账号 */ |
28 | @Transient | 29 | @Transient |
29 | private String platformAccount; | 30 | private String platformAccount; |
30 | 31 | ||
31 | // 会员过期时间 | 32 | /** 会员过期时间 */ |
32 | @Column(name = "vip_expire_time", nullable = false) | 33 | @Column(name = "vip_expire_time", nullable = false) |
33 | private LocalDateTime vipExpireTime; | 34 | private LocalDateTime vipExpireTime; |
34 | 35 | ||
35 | // 主键 | 36 | /** 主键 */ |
36 | @Id | 37 | @Id |
37 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 38 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
38 | @Column(name = "id") | 39 | @Column(name = "id") |
40 | @NotNull(message = "id can't be null!!",groups = {UpdateGroup.class}) | ||
39 | private Long id; | 41 | private Long id; |
40 | 42 | ||
41 | // 标识 | 43 | /** 标识 */ |
42 | @Column(name = "code", nullable = false) | 44 | @Column(name = "code", nullable = false) |
43 | private String code; | 45 | private String code; |
44 | 46 | ||
45 | // 类型 1:大屏;2:小屏 | 47 | /** 类型 1:大屏;2:小屏 */ |
46 | @Column(name = "`type`", nullable = false) | 48 | @Column(name = "`type`", nullable = false) |
47 | private Integer type; | 49 | private Integer type; |
48 | 50 | ||
49 | // 状态 0:不可用;1:可用 | 51 | /** 状态 0:不可用;1:可用 */ |
50 | @Column(name = "`status`", nullable = false) | 52 | @Column(name = "`status`", nullable = false) |
51 | private Integer status; | 53 | private Integer status; |
52 | 54 | ||
53 | // 昵称 base64 | 55 | /** 昵称 base64 */ |
54 | @Column(name = "nickname") | 56 | @Column(name = "nickname") |
55 | private String nickname; | 57 | private String nickname; |
56 | 58 | ||
57 | // 描述 | 59 | /** 描述 */ |
58 | @Column(name = "description") | 60 | @Column(name = "description") |
59 | private String description; | 61 | private String description; |
60 | 62 | ||
61 | // 性别 0:女;1:男;-1:未知 | 63 | /** 性别 0:女;1:男;-1:未知 */ |
62 | @Column(name = "gender", nullable = false) | 64 | @Column(name = "gender", nullable = false) |
63 | private Integer gender; | 65 | private Integer gender; |
64 | 66 | ||
65 | // 生日 | 67 | /** 生日 */ |
66 | @Column(name = "birthday") | 68 | @Column(name = "birthday") |
67 | private String birthday; | 69 | private String birthday; |
68 | 70 | ||
69 | // 头像 | 71 | /** 头像 */ |
70 | @Column(name = "avatar_url") | 72 | @Column(name = "avatar_url") |
71 | private String avatarUrl; | 73 | private String avatarUrl; |
72 | 74 | ||
73 | // 分组信息 | 75 | /** 分组信息 */ |
74 | @Column(name = "`groups`") | 76 | @Column(name = "`groups`") |
75 | private String groups; | 77 | private String groups; |
76 | 78 | ||
77 | // 标签 | 79 | /** 标签 */ |
78 | @Column(name = "tags") | 80 | @Column(name = "tags") |
79 | private String tags; | 81 | private String tags; |
80 | 82 | ||
81 | // 是否会员 0:非会员;1:会员 | 83 | /** 是否会员 0:非会员;1:会员 */ |
82 | @Column(name = "vip", nullable = false) | 84 | @Column(name = "vip", nullable = false) |
83 | private Integer vip; | 85 | private Integer vip; |
84 | 86 | ||
85 | // 会员等级(对应level表的level字段,非id) | 87 | /** 会员等级(对应level表的level字段,非id) */ |
86 | @Column(name = "`level`", nullable = false) | 88 | @Column(name = "`level`", nullable = false) |
87 | private Integer level; | 89 | private Integer level; |
88 | 90 | ||
89 | // 成长值 | 91 | /** 成长值 */ |
90 | @Column(name = "`exp`") | 92 | @Column(name = "`exp`") |
91 | private Long exp; | 93 | private Long exp; |
92 | 94 | ||
93 | // 当前积分 | 95 | /** 当前积分 */ |
94 | @Column(name = "`points`") | 96 | @Column(name = "`points`") |
95 | private Long points; | 97 | private Long points; |
96 | 98 | ||
97 | // 即将到期积分(一个月内) | 99 | /** 即将到期积分(一个月内) */ |
98 | @Column(name = "due_points") | 100 | @Column(name = "due_points") |
99 | private Long duePoints; | 101 | private Long duePoints; |
100 | 102 | ||
101 | // 优惠券数量 | 103 | /** 优惠券数量 */ |
102 | @Column(name = "coupon_amount") | 104 | @Column(name = "coupon_amount") |
103 | private Long couponAmount; | 105 | private Long couponAmount; |
104 | 106 | ||
105 | // 即将过期优惠券数量 | 107 | /** 即将过期优惠券数量 */ |
106 | @Column(name = "due_coupon_amount") | 108 | @Column(name = "due_coupon_amount") |
107 | private Long dueCouponAmount; | 109 | private Long dueCouponAmount; |
108 | 110 | ||
109 | // iptv账号id | 111 | /** iptv账号id */ |
110 | @Column(name = "user_iptv_id") | 112 | @Column(name = "user_iptv_id") |
111 | private Long userIptvId; | 113 | private Long userIptvId; |
112 | 114 | ||
113 | // 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 | 115 | /** 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 */ |
114 | @Column(name = "bind_iptv_platform_type") | 116 | @Column(name = "bind_iptv_platform_type") |
115 | private Integer bindIptvPlatformType; | 117 | private Integer bindIptvPlatformType; |
116 | 118 | ||
117 | // iptv账号绑定时间 | 119 | /** iptv账号绑定时间 */ |
118 | @Column(name = "bind_iptv_time") | 120 | @Column(name = "bind_iptv_time") |
119 | private LocalDateTime bindIptvTime; | 121 | private LocalDateTime bindIptvTime; |
120 | 122 | ||
121 | // 创建时间 | 123 | /** 创建时间 */ |
122 | @CreatedDate | 124 | @CreatedDate |
123 | @Column(name = "create_time") | 125 | @Column(name = "create_time") |
124 | private LocalDateTime createTime; | 126 | private LocalDateTime createTime; |
125 | 127 | ||
126 | // 更新时间 | 128 | /** 更新时间 */ |
127 | @LastModifiedDate | 129 | @LastModifiedDate |
128 | @Column(name = "update_time") | 130 | @Column(name = "update_time") |
129 | private LocalDateTime updateTime; | 131 | private LocalDateTime updateTime; |
130 | 132 | ||
131 | // 是否在黑名单 1:是;0否 | 133 | /** 是否在黑名单 1:是;0否 */ |
132 | @Column(name = "black_status") | 134 | @Column(name = "black_status") |
133 | private Long blackStatus; | 135 | private Long blackStatus; |
134 | 136 | ||
135 | public void copy(Member source){ | 137 | public void copy(Member source){ |
136 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | 138 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false)); |
137 | } | 139 | } |
138 | } | 140 | } | ... | ... |
1 | package com.topdraw.business.module.member.domain; | ||
2 | |||
3 | |||
4 | import com.topdraw.util.IdWorker; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | |||
7 | import java.nio.charset.StandardCharsets; | ||
8 | import java.util.Base64; | ||
9 | import java.util.Objects; | ||
10 | |||
11 | /** | ||
12 | * @author XiangHan | ||
13 | * @date 2021-10-22 | ||
14 | */ | ||
15 | public class MemberBuilder { | ||
16 | |||
17 | private static final Long DEFAULT_VALUE = 0L; | ||
18 | private static final Integer DEFAULT_VALUE_1 = 1; | ||
19 | private static final Integer DEFAULT_VALUE_ = -1; | ||
20 | |||
21 | public static Member build(Member member){ | ||
22 | Member _member = checkMemberData(member); | ||
23 | return _member; | ||
24 | } | ||
25 | |||
26 | private static Member checkMemberData(Member member) { | ||
27 | String code = member.getCode(); | ||
28 | member.setCode(StringUtils.isEmpty(code)?String.valueOf(IdWorker.generator()):code); | ||
29 | Integer gender = member.getGender(); | ||
30 | member.setGender(Objects.nonNull(gender) ? gender : DEFAULT_VALUE_); | ||
31 | Integer type = member.getType(); | ||
32 | member.setType(Objects.nonNull(type) ? type:DEFAULT_VALUE_); | ||
33 | Integer status = member.getStatus(); | ||
34 | member.setStatus(Objects.nonNull(status) ? status:DEFAULT_VALUE_1); | ||
35 | Integer vip = member.getVip(); | ||
36 | member.setVip(Objects.nonNull(vip) ? vip:0); | ||
37 | Integer level = member.getLevel(); | ||
38 | member.setLevel(Objects.nonNull(level) ? level:DEFAULT_VALUE_1); | ||
39 | member.setExp(DEFAULT_VALUE); | ||
40 | member.setPoints(DEFAULT_VALUE); | ||
41 | member.setDuePoints(DEFAULT_VALUE); | ||
42 | member.setCouponAmount(DEFAULT_VALUE); | ||
43 | member.setDueCouponAmount(DEFAULT_VALUE); | ||
44 | member.setBlackStatus(DEFAULT_VALUE); | ||
45 | member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); | ||
46 | String nickname = member.getNickname(); | ||
47 | if (StringUtils.isNotEmpty(nickname)) { | ||
48 | // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); | ||
49 | member.setNickname(nickname); | ||
50 | } | ||
51 | return member; | ||
52 | } | ||
53 | |||
54 | public static Member build(Integer type, String avatarUrl, String nickname, int vip){ | ||
55 | // todo 原型模式 | ||
56 | Member member = new Member(); | ||
57 | member.setType(type); | ||
58 | member.setAvatarUrl(avatarUrl); | ||
59 | member.setNickname(nickname); | ||
60 | member.setVip(vip); | ||
61 | Member _member = checkMemberData(member); | ||
62 | return _member; | ||
63 | } | ||
64 | } |
1 | package com.topdraw.business.module.member.group.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.jpa.domain.support.AuditingEntityListener; | ||
8 | |||
9 | import javax.persistence.*; | ||
10 | import java.io.Serializable; | ||
11 | |||
12 | /** | ||
13 | * @author luerlong | ||
14 | * @date 2021-09-27 | ||
15 | */ | ||
16 | @Entity | ||
17 | @Data | ||
18 | @EntityListeners(AuditingEntityListener.class) | ||
19 | @Accessors(chain = true) | ||
20 | @Table(name="uc_group") | ||
21 | public class Group implements Serializable { | ||
22 | |||
23 | /** ID */ | ||
24 | @Id | ||
25 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
26 | @Column(name = "id") | ||
27 | private Long id; | ||
28 | |||
29 | /** CODE */ | ||
30 | @Column(name = "code") | ||
31 | private String code; | ||
32 | |||
33 | /** 名称 */ | ||
34 | @Column(name = "name") | ||
35 | private String name; | ||
36 | |||
37 | /** 状态 0-下线 1-上线 */ | ||
38 | @Column(name = "status") | ||
39 | private Integer status; | ||
40 | |||
41 | /** 权限 0-测试分组 1-鉴权通过(白名单) 2-不允许精准(黑名单)3-可以精准(金名单) */ | ||
42 | @Column(name = "permission_type") | ||
43 | private Integer permissionType; | ||
44 | |||
45 | public void copy(Group source){ | ||
46 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
47 | } | ||
48 | } |
1 | package com.topdraw.business.module.member.group.domain; | ||
2 | |||
3 | import cn.hutool.core.bean.BeanUtil; | ||
4 | import cn.hutool.core.bean.copier.CopyOptions; | ||
5 | import lombok.Data; | ||
6 | import lombok.experimental.Accessors; | ||
7 | import org.springframework.data.annotation.CreatedDate; | ||
8 | import org.springframework.data.annotation.LastModifiedDate; | ||
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
10 | |||
11 | import javax.persistence.*; | ||
12 | import java.io.Serializable; | ||
13 | import java.sql.Timestamp; | ||
14 | |||
15 | /** | ||
16 | * @author XiangHan | ||
17 | * @date 2021-11-17 | ||
18 | */ | ||
19 | @Entity | ||
20 | @Data | ||
21 | @EntityListeners(AuditingEntityListener.class) | ||
22 | @Accessors(chain = true) | ||
23 | @Table(name="uc_member_group") | ||
24 | public class MemberGroup implements Serializable { | ||
25 | |||
26 | /** ID */ | ||
27 | @Id | ||
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
29 | @Column(name = "id") | ||
30 | private Long id; | ||
31 | |||
32 | /** 分组ID */ | ||
33 | @Column(name = "group_id") | ||
34 | private Long groupId; | ||
35 | |||
36 | /** 会员ID */ | ||
37 | @Column(name = "member_id") | ||
38 | private Long memberId; | ||
39 | |||
40 | /** 运营商平台账号 */ | ||
41 | @Column(name = "platform_account") | ||
42 | private String platformAccount; | ||
43 | |||
44 | /** 手机号 */ | ||
45 | @Column(name = "cellphone") | ||
46 | private String cellphone; | ||
47 | |||
48 | /** 设备 */ | ||
49 | @Column(name = "stb_id") | ||
50 | private String stbId; | ||
51 | |||
52 | /** 有线MAC地址 */ | ||
53 | @Column(name = "eth_mac") | ||
54 | private String ethMac; | ||
55 | |||
56 | /** 无线MAC地址 */ | ||
57 | @Column(name = "wifi_mac") | ||
58 | private String wifiMac; | ||
59 | |||
60 | /** 描述 */ | ||
61 | @Column(name = "description") | ||
62 | private String description; | ||
63 | |||
64 | /** 创建者 */ | ||
65 | @Column(name = "create_by") | ||
66 | private String createBy; | ||
67 | |||
68 | /** 创建时间 */ | ||
69 | @CreatedDate | ||
70 | @Column(name = "create_time") | ||
71 | private Timestamp createTime; | ||
72 | |||
73 | /** 更新者 */ | ||
74 | @Column(name = "update_by") | ||
75 | private String updateBy; | ||
76 | |||
77 | /** 更新时间 */ | ||
78 | @LastModifiedDate | ||
79 | @Column(name = "update_time") | ||
80 | private Timestamp updateTime; | ||
81 | |||
82 | public void copy(MemberGroup source){ | ||
83 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
84 | } | ||
85 | } |
1 | package com.topdraw.business.module.member.group.repository; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.Group; | ||
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.util.List; | ||
9 | import java.util.Map; | ||
10 | import java.util.Optional; | ||
11 | |||
12 | /** | ||
13 | * @author luerlong | ||
14 | * @date 2021-09-27 | ||
15 | */ | ||
16 | public interface GroupRepository extends JpaRepository<Group, Long>, JpaSpecificationExecutor<Group> { | ||
17 | |||
18 | Optional<Group> findFirstByCode(String code); | ||
19 | |||
20 | List<Group> findByName(String name); | ||
21 | |||
22 | @Query(value = "select t1.id from uc_group t1 left join uc_user__group t2 on t1.id = t2.group_id where t2.user_id = ?1 and t1.permission_type = ?2 ", nativeQuery = true) | ||
23 | List<Map<String, Object>> findByUserIdAndPermissionType(Long userId, Integer type); | ||
24 | } |
src/main/java/com/topdraw/business/module/member/group/repository/MemberGroupRepository.java
0 → 100644
1 | package com.topdraw.business.module.member.group.repository; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.MemberGroup; | ||
4 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | ||
5 | import org.springframework.data.jpa.repository.JpaRepository; | ||
6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
7 | |||
8 | import java.util.List; | ||
9 | |||
10 | /** | ||
11 | * @author XiangHan | ||
12 | * @date 2021-11-17 | ||
13 | */ | ||
14 | public interface MemberGroupRepository extends JpaRepository<MemberGroup, Long>, JpaSpecificationExecutor<MemberGroup> { | ||
15 | |||
16 | List<MemberGroupDTO> findByMemberId(Long memberId); | ||
17 | } |
1 | package com.topdraw.business.module.member.group.service; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
4 | |||
5 | |||
6 | /** | ||
7 | * @author luerlong | ||
8 | * @date 2021-09-27 | ||
9 | */ | ||
10 | public interface GroupService { | ||
11 | |||
12 | |||
13 | /** | ||
14 | * 根据ID查询 | ||
15 | * @param id ID | ||
16 | * @return GroupDTO | ||
17 | */ | ||
18 | GroupDTO findById(Long id); | ||
19 | |||
20 | /** | ||
21 | * Code校验 | ||
22 | * @param code | ||
23 | * @return GroupDTO | ||
24 | */ | ||
25 | GroupDTO getByCode(String code); | ||
26 | } |
1 | package com.topdraw.business.module.member.group.service; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | ||
4 | |||
5 | import java.util.List; | ||
6 | |||
7 | /** | ||
8 | * @author XiangHan | ||
9 | * @date 2021-11-17 | ||
10 | */ | ||
11 | public interface MemberGroupService { | ||
12 | |||
13 | /** | ||
14 | * 通过会员id获取会员分组列表 | ||
15 | * @param memberId | ||
16 | * @return | ||
17 | */ | ||
18 | List<MemberGroupDTO> findByMemberId(Long memberId); | ||
19 | |||
20 | /** | ||
21 | * 根据ID查询 | ||
22 | * @param id ID | ||
23 | * @return MemberGroupDTO | ||
24 | */ | ||
25 | MemberGroupDTO findById(Long id); | ||
26 | |||
27 | } |
1 | package com.topdraw.business.module.member.group.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | |||
7 | |||
8 | /** | ||
9 | * @author luerlong | ||
10 | * @date 2021-09-27 | ||
11 | */ | ||
12 | @Data | ||
13 | public class GroupDTO implements Serializable { | ||
14 | |||
15 | /** ID */ | ||
16 | private Long id; | ||
17 | |||
18 | /** CODE */ | ||
19 | private String code; | ||
20 | |||
21 | /** 名称 */ | ||
22 | private String name; | ||
23 | |||
24 | /** 状态 0-下线 1-上线 */ | ||
25 | private Integer status; | ||
26 | |||
27 | /** 权限 0-测试分组 1-鉴权通过(白名单) 2-不允许精准(黑名单)3-可以精准(金名单) */ | ||
28 | private Integer permissionType; | ||
29 | |||
30 | } |
1 | package com.topdraw.business.module.member.group.service.dto; | ||
2 | |||
3 | import lombok.Data; | ||
4 | |||
5 | import java.io.Serializable; | ||
6 | import java.sql.Timestamp; | ||
7 | |||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2021-11-17 | ||
12 | */ | ||
13 | @Data | ||
14 | public class MemberGroupDTO implements Serializable { | ||
15 | |||
16 | /** ID */ | ||
17 | private Long id; | ||
18 | |||
19 | /** 分组ID */ | ||
20 | private Long groupId; | ||
21 | |||
22 | /** 会员ID */ | ||
23 | private Long memberId; | ||
24 | |||
25 | /** 运营商平台账号 */ | ||
26 | private String platformAccount; | ||
27 | |||
28 | /** 手机号 */ | ||
29 | private String cellphone; | ||
30 | |||
31 | /** 设备 */ | ||
32 | private String stbId; | ||
33 | |||
34 | /** 有线MAC地址 */ | ||
35 | private String ethMac; | ||
36 | |||
37 | /** 无线MAC地址 */ | ||
38 | private String wifiMac; | ||
39 | |||
40 | /** 描述 */ | ||
41 | private String description; | ||
42 | |||
43 | /** 创建者 */ | ||
44 | private String createBy; | ||
45 | |||
46 | /** 创建时间 */ | ||
47 | private Timestamp createTime; | ||
48 | |||
49 | /** 更新者 */ | ||
50 | private String updateBy; | ||
51 | |||
52 | /** 更新时间 */ | ||
53 | private Timestamp updateTime; | ||
54 | |||
55 | } |
src/main/java/com/topdraw/business/module/member/group/service/impl/GroupServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.member.group.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.Group; | ||
4 | import com.topdraw.business.module.member.group.repository.GroupRepository; | ||
5 | import com.topdraw.business.module.member.group.service.GroupService; | ||
6 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
7 | import com.topdraw.business.module.member.group.service.mapper.GroupMapper; | ||
8 | import com.topdraw.utils.StringUtils; | ||
9 | import com.topdraw.utils.ValidationUtil; | ||
10 | import org.springframework.beans.factory.annotation.Autowired; | ||
11 | import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | ||
13 | import org.springframework.transaction.annotation.Transactional; | ||
14 | |||
15 | /** | ||
16 | * @author luerlong | ||
17 | * @date 2021-09-27 | ||
18 | */ | ||
19 | @Service | ||
20 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
21 | public class GroupServiceImpl implements GroupService { | ||
22 | |||
23 | @Autowired | ||
24 | private GroupRepository groupRepository; | ||
25 | |||
26 | @Autowired | ||
27 | private GroupMapper groupMapper; | ||
28 | |||
29 | @Override | ||
30 | public GroupDTO findById(Long id) { | ||
31 | Group group = groupRepository.findById(id).orElseGet(Group::new); | ||
32 | ValidationUtil.isNull(group.getId(),"Group","id",id); | ||
33 | return groupMapper.toDto(group); | ||
34 | } | ||
35 | |||
36 | @Override | ||
37 | public GroupDTO getByCode(String code) { | ||
38 | return StringUtils.isNotEmpty(code) ? groupMapper.toDto(groupRepository.findFirstByCode(code).orElseGet(Group::new)) | ||
39 | : new GroupDTO(); | ||
40 | } | ||
41 | } |
src/main/java/com/topdraw/business/module/member/group/service/impl/MemberGroupServiceImpl.java
0 → 100644
1 | package com.topdraw.business.module.member.group.service.impl; | ||
2 | |||
3 | import com.topdraw.business.module.member.group.domain.MemberGroup; | ||
4 | import com.topdraw.business.module.member.group.repository.MemberGroupRepository; | ||
5 | import com.topdraw.business.module.member.group.service.MemberGroupService; | ||
6 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | ||
7 | import com.topdraw.business.module.member.group.service.mapper.MemberGroupMapper; | ||
8 | import com.topdraw.utils.ValidationUtil; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.stereotype.Service; | ||
11 | import org.springframework.transaction.annotation.Propagation; | ||
12 | import org.springframework.transaction.annotation.Transactional; | ||
13 | |||
14 | import java.util.List; | ||
15 | |||
16 | /** | ||
17 | * @author XiangHan | ||
18 | * @date 2021-11-17 | ||
19 | */ | ||
20 | @Service | ||
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
22 | public class MemberGroupServiceImpl implements MemberGroupService { | ||
23 | |||
24 | @Autowired | ||
25 | private MemberGroupRepository memberGroupRepository; | ||
26 | @Autowired | ||
27 | private MemberGroupMapper memberGroupMapper; | ||
28 | |||
29 | @Override | ||
30 | public List<MemberGroupDTO> findByMemberId(Long memberId) { | ||
31 | return this.memberGroupRepository.findByMemberId(memberId); | ||
32 | } | ||
33 | |||
34 | @Override | ||
35 | public MemberGroupDTO findById(Long id) { | ||
36 | MemberGroup memberGroup = this.memberGroupRepository.findById(id).orElseGet(MemberGroup::new); | ||
37 | ValidationUtil.isNull(memberGroup.getId(),"MemberGroup","id",id); | ||
38 | return this.memberGroupMapper.toDto(memberGroup); | ||
39 | } | ||
40 | |||
41 | } |
1 | package com.topdraw.business.module.member.group.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.member.group.domain.Group; | ||
5 | import com.topdraw.business.module.member.group.service.dto.GroupDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author luerlong | ||
11 | * @date 2021-09-27 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface GroupMapper extends BaseMapper<GroupDTO, Group> { | ||
15 | |||
16 | } |
src/main/java/com/topdraw/business/module/member/group/service/mapper/MemberGroupMapper.java
0 → 100644
1 | package com.topdraw.business.module.member.group.service.mapper; | ||
2 | |||
3 | import com.topdraw.base.BaseMapper; | ||
4 | import com.topdraw.business.module.member.group.domain.MemberGroup; | ||
5 | import com.topdraw.business.module.member.group.service.dto.MemberGroupDTO; | ||
6 | import org.mapstruct.Mapper; | ||
7 | import org.mapstruct.ReportingPolicy; | ||
8 | |||
9 | /** | ||
10 | * @author XiangHan | ||
11 | * @date 2021-11-17 | ||
12 | */ | ||
13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
14 | public interface MemberGroupMapper extends BaseMapper<MemberGroupDTO, MemberGroup> { | ||
15 | |||
16 | } |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.level.domain; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.level.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.module.common.validated.CreateGroup; | ||
6 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 8 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 9 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -9,6 +11,8 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -9,6 +11,8 @@ import org.springframework.data.annotation.LastModifiedDate; |
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 12 | ||
11 | import javax.persistence.*; | 13 | import javax.persistence.*; |
14 | import javax.validation.constraints.Min; | ||
15 | import javax.validation.constraints.NotNull; | ||
12 | import java.io.Serializable; | 16 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | 17 | import java.sql.Timestamp; |
14 | 18 | ||
... | @@ -23,50 +27,53 @@ import java.sql.Timestamp; | ... | @@ -23,50 +27,53 @@ import java.sql.Timestamp; |
23 | @Table(name="uc_member_level") | 27 | @Table(name="uc_member_level") |
24 | public class MemberLevel implements Serializable { | 28 | public class MemberLevel implements Serializable { |
25 | 29 | ||
26 | // 主键 | 30 | /** 主键 */ |
27 | @Id | 31 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 33 | @Column(name = "id") |
34 | @NotNull(message = "id can't be null !!" , groups = {UpdateGroup.class}) | ||
30 | private Long id; | 35 | private Long id; |
31 | 36 | ||
32 | // 标识 | 37 | /** 标识 */ |
33 | @Column(name = "code", nullable = false) | 38 | @Column(name = "code", nullable = false) |
34 | private String code; | 39 | private String code; |
35 | 40 | ||
36 | // 名称 | 41 | /** 名称 */ |
37 | @Column(name = "name", nullable = false) | 42 | @Column(name = "name", nullable = false) |
38 | private String name; | 43 | private String name; |
39 | 44 | ||
40 | // 状态 0:未启用;1:启用 | 45 | /** 状态 0:未启用;1:启用 */ |
41 | @Column(name = "status", nullable = false) | 46 | @Column(name = "status", nullable = false) |
42 | private Integer status; | 47 | private Integer status; |
43 | 48 | ||
44 | // 对应成长值 | 49 | /** 对应成长值 */ |
45 | @Column(name = "exp_value", nullable = false) | 50 | @Column(name = "exp_value", nullable = false) |
46 | private Long expValue; | 51 | private Long expValue; |
47 | 52 | ||
48 | // 等级(不可重复,数字越大等级越高) | 53 | /** 等级(不可重复,数字越大等级越高) */ |
49 | @Column(name = "level", nullable = false) | 54 | @Column(name = "level", nullable = false) |
55 | @Min(message = "level can't less then 1" , value = 1) | ||
56 | @NotNull(message = "level can't be null" , groups = {CreateGroup.class,UpdateGroup.class}) | ||
50 | private Integer level; | 57 | private Integer level; |
51 | 58 | ||
52 | // 会员徽标 | 59 | /** 会员徽标 */ |
53 | @Column(name = "icon_url") | 60 | @Column(name = "icon_url") |
54 | private String iconUrl; | 61 | private String iconUrl; |
55 | 62 | ||
56 | // 描述 | 63 | /** 描述 */ |
57 | @Column(name = "description") | 64 | @Column(name = "description") |
58 | private String description; | 65 | private String description; |
59 | 66 | ||
60 | // 对应任务id,通过此字段可获得该等级所对应的权益 | 67 | /** 对应任务id,通过此字段可获得该等级所对应的权益 */ |
61 | @Column(name = "task_id") | 68 | @Column(name = "task_id") |
62 | private Long taskId; | 69 | private Long taskId; |
63 | 70 | ||
64 | // 创建时间 | 71 | /** 创建时间 */ |
65 | @CreatedDate | 72 | @CreatedDate |
66 | @Column(name = "create_time") | 73 | @Column(name = "create_time") |
67 | private Timestamp createTime; | 74 | private Timestamp createTime; |
68 | 75 | ||
69 | // 更新时间 | 76 | /** 更新时间 */ |
70 | @LastModifiedDate | 77 | @LastModifiedDate |
71 | @Column(name = "update_time") | 78 | @Column(name = "update_time") |
72 | private Timestamp updateTime; | 79 | private Timestamp updateTime; | ... | ... |
1 | package com.topdraw.business.module.member.level.service; | 1 | package com.topdraw.business.module.member.level.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.level.domain.MemberLevel; | ||
4 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; | 3 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
5 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | 4 | ||
8 | import java.util.List; | 5 | import java.util.List; |
9 | import java.util.Map; | ||
10 | 6 | ||
11 | /** | 7 | /** |
12 | * @author XiangHan | 8 | * @author XiangHan |
... | @@ -15,33 +11,12 @@ import java.util.Map; | ... | @@ -15,33 +11,12 @@ import java.util.Map; |
15 | public interface MemberLevelService { | 11 | public interface MemberLevelService { |
16 | 12 | ||
17 | /** | 13 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(MemberLevelQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<MemberLevelDTO> | ||
29 | */ | ||
30 | List<MemberLevelDTO> queryAll(MemberLevelQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 14 | * 根据ID查询 |
34 | * @param id ID | 15 | * @param id ID |
35 | * @return MemberLevelDTO | 16 | * @return MemberLevelDTO |
36 | */ | 17 | */ |
37 | MemberLevelDTO findById(Long id); | 18 | MemberLevelDTO findById(Long id); |
38 | 19 | ||
39 | void create(MemberLevel resources); | ||
40 | |||
41 | void update(MemberLevel resources); | ||
42 | |||
43 | void delete(Long id); | ||
44 | |||
45 | /** | 20 | /** |
46 | * Code校验 | 21 | * Code校验 |
47 | * @param code | 22 | * @param code |
... | @@ -49,5 +24,13 @@ public interface MemberLevelService { | ... | @@ -49,5 +24,13 @@ public interface MemberLevelService { |
49 | */ | 24 | */ |
50 | MemberLevelDTO getByCode(String code); | 25 | MemberLevelDTO getByCode(String code); |
51 | 26 | ||
27 | /** | ||
28 | * 通过等级和状态检索 | ||
29 | * @param i | ||
30 | * @param status | ||
31 | * @return | ||
32 | */ | ||
52 | List<MemberLevelDTO> findLevelAndStatus(Integer i, Integer status); | 33 | List<MemberLevelDTO> findLevelAndStatus(Integer i, Integer status); |
34 | |||
35 | |||
53 | } | 36 | } | ... | ... |
... | @@ -13,36 +13,36 @@ import java.sql.Timestamp; | ... | @@ -13,36 +13,36 @@ import java.sql.Timestamp; |
13 | @Data | 13 | @Data |
14 | public class MemberLevelDTO implements Serializable { | 14 | public class MemberLevelDTO implements Serializable { |
15 | 15 | ||
16 | // 主键 | 16 | /** 主键 */ |
17 | private Long id; | 17 | private Long id; |
18 | 18 | ||
19 | // 标识 | 19 | /** 标识 */ |
20 | private String code; | 20 | private String code; |
21 | 21 | ||
22 | // 名称 | 22 | /** 名称 */ |
23 | private String name; | 23 | private String name; |
24 | 24 | ||
25 | // 状态 0:未启用;1:启用 | 25 | /** 状态 0:未启用;1:启用 */ |
26 | private Integer status; | 26 | private Integer status; |
27 | 27 | ||
28 | // 对应成长值 | 28 | /** 对应成长值 */ |
29 | private Long expValue; | 29 | private Long expValue; |
30 | 30 | ||
31 | // 等级(不可重复,数字越大等级越高) | 31 | /** 等级(不可重复,数字越大等级越高) */ |
32 | private Integer level; | 32 | private Integer level; |
33 | 33 | ||
34 | // 会员徽标 | 34 | /** 会员徽标 */ |
35 | private String iconUrl; | 35 | private String iconUrl; |
36 | 36 | ||
37 | // 描述 | 37 | /** 描述 */ |
38 | private String description; | 38 | private String description; |
39 | 39 | ||
40 | // 对应任务id,通过此字段可获得该等级所对应的权益 | 40 | /** 对应任务id,通过此字段可获得该等级所对应的权益 */ |
41 | private Long taskId; | 41 | private Long taskId; |
42 | 42 | ||
43 | // 创建时间 | 43 | /** 创建时间 */ |
44 | private Timestamp createTime; | 44 | private Timestamp createTime; |
45 | 45 | ||
46 | // 更新时间 | 46 | /** 更新时间 */ |
47 | private Timestamp updateTime; | 47 | private Timestamp updateTime; |
48 | } | 48 | } | ... | ... |
... | @@ -4,23 +4,15 @@ import com.topdraw.business.module.member.level.domain.MemberLevel; | ... | @@ -4,23 +4,15 @@ import com.topdraw.business.module.member.level.domain.MemberLevel; |
4 | import com.topdraw.business.module.member.level.repository.MemberLevelRepository; | 4 | import com.topdraw.business.module.member.level.repository.MemberLevelRepository; |
5 | import com.topdraw.business.module.member.level.service.MemberLevelService; | 5 | import com.topdraw.business.module.member.level.service.MemberLevelService; |
6 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; | 6 | import com.topdraw.business.module.member.level.service.dto.MemberLevelDTO; |
7 | import com.topdraw.business.module.member.level.service.dto.MemberLevelQueryCriteria; | ||
8 | import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper; | 7 | import com.topdraw.business.module.member.level.service.mapper.MemberLevelMapper; |
9 | import com.topdraw.utils.PageUtil; | ||
10 | import com.topdraw.utils.QueryHelp; | ||
11 | import com.topdraw.utils.StringUtils; | 8 | import com.topdraw.utils.StringUtils; |
12 | import com.topdraw.utils.ValidationUtil; | 9 | import com.topdraw.utils.ValidationUtil; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 10 | 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; | 11 | import org.springframework.stereotype.Service; |
18 | import org.springframework.transaction.annotation.Propagation; | 12 | import org.springframework.transaction.annotation.Propagation; |
19 | import org.springframework.transaction.annotation.Transactional; | 13 | import org.springframework.transaction.annotation.Transactional; |
20 | import org.springframework.util.Assert; | ||
21 | 14 | ||
22 | import java.util.List; | 15 | import java.util.List; |
23 | import java.util.Map; | ||
24 | 16 | ||
25 | /** | 17 | /** |
26 | * @author XiangHan | 18 | * @author XiangHan |
... | @@ -31,62 +23,27 @@ import java.util.Map; | ... | @@ -31,62 +23,27 @@ import java.util.Map; |
31 | public class MemberLevelServiceImpl implements MemberLevelService { | 23 | public class MemberLevelServiceImpl implements MemberLevelService { |
32 | 24 | ||
33 | @Autowired | 25 | @Autowired |
34 | private MemberLevelRepository MemberLevelRepository; | 26 | private MemberLevelRepository memberLevelRepository; |
35 | 27 | ||
36 | @Autowired | 28 | @Autowired |
37 | private MemberLevelMapper MemberLevelMapper; | 29 | private MemberLevelMapper memberLevelMapper; |
38 | |||
39 | @Override | ||
40 | public Map<String, Object> queryAll(MemberLevelQueryCriteria criteria, Pageable pageable) { | ||
41 | Page<MemberLevel> page = MemberLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
42 | return PageUtil.toPage(page.map(MemberLevelMapper::toDto)); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public List<MemberLevelDTO> queryAll(MemberLevelQueryCriteria criteria) { | ||
47 | return MemberLevelMapper.toDto(MemberLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
48 | } | ||
49 | 30 | ||
50 | @Override | 31 | @Override |
51 | public MemberLevelDTO findById(Long id) { | 32 | public MemberLevelDTO findById(Long id) { |
52 | MemberLevel MemberLevel = MemberLevelRepository.findById(id).orElseGet(MemberLevel::new); | 33 | MemberLevel MemberLevel = this.memberLevelRepository.findById(id).orElseGet(MemberLevel::new); |
53 | ValidationUtil.isNull(MemberLevel.getId(),"MemberLevel","id",id); | 34 | ValidationUtil.isNull(MemberLevel.getId(),"MemberLevel","id",id); |
54 | return MemberLevelMapper.toDto(MemberLevel); | 35 | return this.memberLevelMapper.toDto(MemberLevel); |
55 | } | ||
56 | |||
57 | @Override | ||
58 | @Transactional(rollbackFor = Exception.class) | ||
59 | public void create(MemberLevel resources) { | ||
60 | MemberLevelRepository.save(resources); | ||
61 | } | 36 | } |
62 | 37 | ||
63 | @Override | 38 | @Override |
64 | @Transactional(rollbackFor = Exception.class) | ||
65 | public void update(MemberLevel resources) { | ||
66 | MemberLevel MemberLevel = MemberLevelRepository.findById(resources.getId()).orElseGet(MemberLevel::new); | ||
67 | ValidationUtil.isNull( MemberLevel.getId(),"MemberLevel","id",resources.getId()); | ||
68 | MemberLevel.copy(resources); | ||
69 | MemberLevelRepository.save(MemberLevel); | ||
70 | } | ||
71 | |||
72 | @Override | ||
73 | @Transactional(rollbackFor = Exception.class) | ||
74 | public void delete(Long id) { | ||
75 | Assert.notNull(id, "The given id must not be null!"); | ||
76 | MemberLevel MemberLevel = MemberLevelRepository.findById(id).orElseThrow( | ||
77 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberLevel.class, id), 1)); | ||
78 | MemberLevelRepository.delete(MemberLevel); | ||
79 | } | ||
80 | |||
81 | |||
82 | @Override | ||
83 | public MemberLevelDTO getByCode(String code) { | 39 | public MemberLevelDTO getByCode(String code) { |
84 | return StringUtils.isNotEmpty(code) ? MemberLevelMapper.toDto(MemberLevelRepository.findFirstByCode(code).orElseGet(MemberLevel::new)) | 40 | return StringUtils.isNotEmpty(code) ? this.memberLevelMapper.toDto(this.memberLevelRepository.findFirstByCode(code).orElseGet(MemberLevel::new)) |
85 | : new MemberLevelDTO(); | 41 | : new MemberLevelDTO(); |
86 | } | 42 | } |
87 | 43 | ||
88 | @Override | 44 | @Override |
89 | public List<MemberLevelDTO> findLevelAndStatus(Integer level, Integer status) { | 45 | public List<MemberLevelDTO> findLevelAndStatus(Integer level, Integer status) { |
90 | return MemberLevelMapper.toDto(MemberLevelRepository.findByLevelAndStatus(level,status)); | 46 | return this.memberLevelMapper.toDto(this.memberLevelRepository.findByLevelAndStatus(level,status)); |
91 | } | 47 | } |
48 | |||
92 | } | 49 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.profile.domain; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.profile.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.module.common.validated.CreateGroup; | ||
6 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 8 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 9 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -9,6 +11,7 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -9,6 +11,7 @@ import org.springframework.data.annotation.LastModifiedDate; |
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 12 | ||
11 | import javax.persistence.*; | 13 | import javax.persistence.*; |
14 | import javax.validation.constraints.NotNull; | ||
12 | import java.io.Serializable; | 15 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | 16 | import java.sql.Timestamp; |
14 | 17 | ||
... | @@ -23,73 +26,80 @@ import java.sql.Timestamp; | ... | @@ -23,73 +26,80 @@ import java.sql.Timestamp; |
23 | @Table(name="uc_member_profile") | 26 | @Table(name="uc_member_profile") |
24 | public class MemberProfile implements Serializable { | 27 | public class MemberProfile implements Serializable { |
25 | 28 | ||
26 | // 主键 | 29 | /** 会员code */ |
30 | @Transient | ||
31 | @NotNull(message = "memberCode not be null!!" , groups = {CreateGroup.class, UpdateGroup.class}) | ||
32 | private String memberCode; | ||
33 | |||
34 | /** 头像 */ | ||
35 | @Transient | ||
36 | private String avatarUrl; | ||
37 | |||
38 | /** 主键 */ | ||
27 | @Id | 39 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 40 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 41 | @Column(name = "id") |
42 | @NotNull(message = "id not be null!!" , groups = UpdateGroup.class) | ||
30 | private Long id; | 43 | private Long id; |
31 | 44 | ||
32 | // 手机号 | 45 | /** 会员id */ |
33 | @Column(name = "phone") | ||
34 | private String phone; | ||
35 | |||
36 | // 会员id | ||
37 | @Column(name = "member_id", nullable = false) | 46 | @Column(name = "member_id", nullable = false) |
38 | private Long memberId; | 47 | private Long memberId; |
39 | 48 | ||
40 | @Transient | 49 | /** 姓名 */ |
41 | private String memberCode; | ||
42 | |||
43 | // 姓名 | ||
44 | @Column(name = "realname") | 50 | @Column(name = "realname") |
45 | private String realname; | 51 | private String realname; |
46 | 52 | ||
47 | // 性别 0:女; 1:男 -1:未知 | 53 | /** 性别 0:女; 1:男 -1:未知 */ |
48 | @Column(name = "gender", nullable = false) | 54 | @Column(name = "gender", nullable = false) |
49 | private Integer gender; | 55 | private Integer gender; |
50 | 56 | ||
51 | // 生日 | 57 | /** 生日 */ |
52 | @Column(name = "birthday", nullable = false) | 58 | @Column(name = "birthday", nullable = false) |
53 | private Timestamp birthday; | 59 | private String birthday; |
60 | |||
61 | /** 手机号 */ | ||
62 | @Column(name = "phone") | ||
63 | private String phone; | ||
54 | 64 | ||
55 | // 星座 | 65 | /** 星座 */ |
56 | @Column(name = "constellation") | 66 | @Column(name = "constellation") |
57 | private String constellation; | 67 | private String constellation; |
58 | 68 | ||
59 | // 身份证 | 69 | /** 身份证 */ |
60 | @Column(name = "id_card", nullable = false) | 70 | @Column(name = "id_card", nullable = false) |
61 | private String idCard; | 71 | private String idCard; |
62 | 72 | ||
63 | // 电子邮件 | 73 | /** 电子邮件 */ |
64 | @Column(name = "email") | 74 | @Column(name = "email") |
65 | private String email; | 75 | private String email; |
66 | 76 | ||
67 | // 国家 | 77 | /** 国家 */ |
68 | @Column(name = "country") | 78 | @Column(name = "country") |
69 | private String country; | 79 | private String country; |
70 | 80 | ||
71 | // 省份 | 81 | /** 省份 */ |
72 | @Column(name = "province") | 82 | @Column(name = "province") |
73 | private String province; | 83 | private String province; |
74 | 84 | ||
75 | // 城市 | 85 | /** 城市 */ |
76 | @Column(name = "city") | 86 | @Column(name = "city") |
77 | private String city; | 87 | private String city; |
78 | 88 | ||
79 | // 区县 | 89 | /** 区县 */ |
80 | @Column(name = "district") | 90 | @Column(name = "district") |
81 | private String district; | 91 | private String district; |
82 | 92 | ||
83 | // 描述 | 93 | /** 描述 */ |
84 | @Column(name = "description") | 94 | @Column(name = "description") |
85 | private String description; | 95 | private String description; |
86 | 96 | ||
87 | // 创建时间 | 97 | /** 创建时间 */ |
88 | @CreatedDate | 98 | @CreatedDate |
89 | @Column(name = "create_time") | 99 | @Column(name = "create_time") |
90 | private Timestamp createTime; | 100 | private Timestamp createTime; |
91 | 101 | ||
92 | // 更新时间 | 102 | /** 更新时间 */ |
93 | @LastModifiedDate | 103 | @LastModifiedDate |
94 | @Column(name = "update_time") | 104 | @Column(name = "update_time") |
95 | private Timestamp updateTime; | 105 | private Timestamp updateTime; | ... | ... |
src/main/java/com/topdraw/business/module/member/profile/domain/MemberProfileBuilder.java
0 → 100644
1 | package com.topdraw.business.module.member.profile.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.exception.GlobeExceptionMsg; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | public class MemberProfileBuilder { | ||
9 | |||
10 | public static MemberProfile build(Member member){ | ||
11 | MemberProfile memberProfile = build(member.getId(),member.getCode(),member.getNickname(),member.getGender(),"","","","","","", | ||
12 | "","","",member.getBirthday()); | ||
13 | return memberProfile; | ||
14 | } | ||
15 | |||
16 | public static MemberProfile build(Long memberId){ | ||
17 | MemberProfile memberProfile = build(memberId,"","",-1,"","","","","","", | ||
18 | "","","",""); | ||
19 | return memberProfile; | ||
20 | } | ||
21 | |||
22 | public static MemberProfile build(Long memberId ,String memberCode, String realname , Integer gender, String birthday){ | ||
23 | MemberProfile memberProfile = build(memberId,memberCode,realname,gender,"","","","","","", | ||
24 | "","","",birthday); | ||
25 | return memberProfile; | ||
26 | } | ||
27 | |||
28 | public static MemberProfile build(Long memberId,String memberCode, String realName, Integer sex, | ||
29 | String country, String district, String city, String idCard, String province, | ||
30 | String email, String description, String phone, String constellation, | ||
31 | String birthday) { | ||
32 | |||
33 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
34 | |||
35 | MemberProfile memberProfile = new MemberProfile(); | ||
36 | memberProfile.setMemberId(memberId); | ||
37 | memberProfile.setMemberCode(memberCode); | ||
38 | memberProfile.setRealname(stringIsNull(realName)); | ||
39 | memberProfile.setGender(sex == null ? 0 : sex); | ||
40 | memberProfile.setCountry(StringUtils.isBlank(country)?"中国":birthday); | ||
41 | memberProfile.setDistrict(stringIsNull(district)); | ||
42 | memberProfile.setCity(stringIsNull(city)); | ||
43 | memberProfile.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard); | ||
44 | memberProfile.setProvince(stringIsNull(province)); | ||
45 | memberProfile.setEmail(stringIsNull(email)); | ||
46 | memberProfile.setDescription(stringIsNull(description)); | ||
47 | memberProfile.setPhone(stringIsNull(phone)); | ||
48 | memberProfile.setConstellation(stringIsNull(constellation)); | ||
49 | memberProfile.setBirthday(StringUtils.isBlank(birthday)?"1900-01-01":birthday); | ||
50 | |||
51 | return memberProfile; | ||
52 | } | ||
53 | |||
54 | private static String stringIsNull(String s){ | ||
55 | return StringUtils.isBlank(s)?"":s; | ||
56 | } | ||
57 | |||
58 | public static MemberProfile build(MemberProfile resources) { | ||
59 | if (resources.getMemberId() == null) | ||
60 | throw new NullPointerException("memberId is null"); | ||
61 | |||
62 | MemberProfile memberProfile = new MemberProfile(); | ||
63 | memberProfile.setId(resources.getId()); | ||
64 | memberProfile.setMemberId(resources.getMemberId()); | ||
65 | memberProfile.setRealname(stringIsNull(resources.getRealname())); | ||
66 | memberProfile.setGender(resources.getGender() == null ? -1 : resources.getGender()); | ||
67 | memberProfile.setCountry(stringIsNull(resources.getCountry())); | ||
68 | memberProfile.setDistrict(stringIsNull(resources.getDistrict())); | ||
69 | memberProfile.setCity(stringIsNull(resources.getCity())); | ||
70 | memberProfile.setIdCard(StringUtils.isBlank(resources.getIdCard())?"000000000000000000":resources.getIdCard()); | ||
71 | memberProfile.setProvince(stringIsNull(resources.getProvince())); | ||
72 | memberProfile.setEmail(stringIsNull(resources.getEmail())); | ||
73 | memberProfile.setDescription(stringIsNull(resources.getDescription())); | ||
74 | memberProfile.setPhone(stringIsNull(resources.getPhone())); | ||
75 | memberProfile.setConstellation(stringIsNull(resources.getConstellation())); | ||
76 | memberProfile.setBirthday(stringIsNull(resources.getBirthday())); | ||
77 | return memberProfile; | ||
78 | } | ||
79 | } |
... | @@ -12,5 +12,7 @@ import java.util.Optional; | ... | @@ -12,5 +12,7 @@ import java.util.Optional; |
12 | */ | 12 | */ |
13 | public interface MemberProfileRepository extends JpaRepository<MemberProfile, Long>, JpaSpecificationExecutor<MemberProfile> { | 13 | public interface MemberProfileRepository extends JpaRepository<MemberProfile, Long>, JpaSpecificationExecutor<MemberProfile> { |
14 | 14 | ||
15 | MemberProfile findByMemberId(Long memberId); | 15 | Optional<MemberProfile> findByMemberId(Long memberId); |
16 | |||
17 | Optional<MemberProfile> findFirstByMemberId(Long memberId); | ||
16 | } | 18 | } | ... | ... |
1 | package com.topdraw.business.module.member.profile.service; | 1 | package com.topdraw.business.module.member.profile.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | ||
3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileQueryCriteria; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 7 | ||
11 | /** | 8 | /** |
12 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -15,31 +12,69 @@ import java.util.Map; | ... | @@ -15,31 +12,69 @@ import java.util.Map; |
15 | public interface MemberProfileService { | 12 | public interface MemberProfileService { |
16 | 13 | ||
17 | /** | 14 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(MemberProfileQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<MemberProfileDTO> | ||
29 | */ | ||
30 | List<MemberProfileDTO> queryAll(MemberProfileQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 15 | * 根据ID查询 |
34 | * @param id ID | 16 | * @param id ID |
35 | * @return MemberProfileDTO | 17 | * @return MemberProfileDTO |
36 | */ | 18 | */ |
37 | MemberProfileDTO findById(Long id); | 19 | MemberProfileDTO findById(Long id); |
38 | 20 | ||
21 | /** | ||
22 | * 保存 | ||
23 | * @param resources 会员基本信息 | ||
24 | * @return | ||
25 | */ | ||
39 | MemberProfile create(MemberProfile resources); | 26 | MemberProfile create(MemberProfile resources); |
40 | 27 | ||
41 | void update(MemberProfile resources); | 28 | /** |
29 | * 默认属性 | ||
30 | * @param resources | ||
31 | * @return | ||
32 | */ | ||
33 | MemberProfile createDefault(MemberProfile resources); | ||
34 | |||
35 | /** | ||
36 | * 通过会员创建默认属性 | ||
37 | * @param resources | ||
38 | * @return | ||
39 | */ | ||
40 | MemberProfile createDefault(Member resources); | ||
41 | |||
42 | /** | ||
43 | * 通过会员id创建默认属性 | ||
44 | * @param resources | ||
45 | * @return | ||
46 | */ | ||
47 | MemberProfile createDefaultByMemberId(Long resources); | ||
48 | |||
49 | /** | ||
50 | * 修改 | ||
51 | * @param resources | ||
52 | */ | ||
53 | MemberProfileDTO update(MemberProfile resources); | ||
42 | 54 | ||
55 | /** | ||
56 | * 删除 | ||
57 | * @param id | ||
58 | */ | ||
43 | void delete(Long id); | 59 | void delete(Long id); |
44 | 60 | ||
61 | /** | ||
62 | * 通过会员id查询 | ||
63 | * @param memberId | ||
64 | * @return | ||
65 | */ | ||
66 | MemberProfileDTO findByMemberId(Long memberId); | ||
67 | |||
68 | /** | ||
69 | * 通过会员code查询 | ||
70 | * @param memberCode | ||
71 | * @return | ||
72 | */ | ||
73 | MemberProfileDTO findByMemberCode(String memberCode); | ||
74 | |||
75 | /** | ||
76 | * 修改会员属性并同步会员信息 | ||
77 | * @param resources | ||
78 | */ | ||
79 | MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources, MemberDTO memberDTO); | ||
45 | } | 80 | } | ... | ... |
... | @@ -13,51 +13,64 @@ import java.sql.Timestamp; | ... | @@ -13,51 +13,64 @@ import java.sql.Timestamp; |
13 | @Data | 13 | @Data |
14 | public class MemberProfileDTO implements Serializable { | 14 | public class MemberProfileDTO implements Serializable { |
15 | 15 | ||
16 | // 主键 | 16 | /** 会员code */ |
17 | private String memberCode; | ||
18 | |||
19 | /** 主键 */ | ||
17 | private Long id; | 20 | private Long id; |
18 | 21 | ||
19 | // 会员id | 22 | /** 会员id */ |
20 | private Long memberId; | 23 | private Long memberId; |
21 | 24 | ||
22 | // 手机号 | 25 | /** 姓名 */ |
23 | private String phone; | ||
24 | |||
25 | // 姓名 | ||
26 | private String realname; | 26 | private String realname; |
27 | 27 | ||
28 | // 性别 0:女; 1:男 -1:未知 | 28 | /** 性别 0:女; 1:男 -1:未知 */ |
29 | private Integer gender; | 29 | private Integer gender; |
30 | 30 | ||
31 | // 生日 | 31 | /** 生日 */ |
32 | private Timestamp birthday; | 32 | private String birthday; |
33 | |||
34 | /** 电话 */ | ||
35 | private String phone; | ||
33 | 36 | ||
34 | // 星座 | 37 | /** 星座 */ |
35 | private String constellation; | 38 | private String constellation; |
36 | 39 | ||
37 | // 身份证 | 40 | /** 身份证 */ |
38 | private String idCard; | 41 | private String idCard; |
39 | 42 | ||
40 | // 电子邮件 | 43 | /** 电子邮件 */ |
41 | private String email; | 44 | private String email; |
42 | 45 | ||
43 | // 国家 | 46 | /** 国家 */ |
44 | private String country; | 47 | private String country; |
45 | 48 | ||
46 | // 省份 | 49 | /** 省份 */ |
47 | private String province; | 50 | private String province; |
48 | 51 | ||
49 | // 城市 | 52 | /** 城市 */ |
50 | private String city; | 53 | private String city; |
51 | 54 | ||
52 | // 区县 | 55 | /** 区县 */ |
53 | private String district; | 56 | private String district; |
54 | 57 | ||
55 | // 描述 | 58 | /** 描述 */ |
56 | private String description; | 59 | private String description; |
57 | 60 | ||
58 | // 创建时间 | 61 | /** 创建时间 */ |
59 | private Timestamp createTime; | 62 | private Timestamp createTime; |
60 | 63 | ||
61 | // 更新时间 | 64 | /** 更新时间 */ |
62 | private Timestamp updateTime; | 65 | private Timestamp updateTime; |
66 | |||
67 | |||
68 | /** vip */ | ||
69 | private Integer vip; | ||
70 | |||
71 | /** vip过期时间 */ | ||
72 | private Long vipExpireTime; | ||
73 | |||
74 | /** 头像 */ | ||
75 | private String avatarUrl; | ||
63 | } | 76 | } | ... | ... |
1 | package com.topdraw.business.module.member.profile.service.impl; | 1 | package com.topdraw.business.module.member.profile.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | ||
3 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | 4 | import com.topdraw.business.module.member.profile.domain.MemberProfile; |
5 | import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder; | ||
4 | import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; | 6 | import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; |
5 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 7 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
6 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 8 | 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.profile.service.mapper.MemberProfileMapper; | 9 | import com.topdraw.business.module.member.profile.service.mapper.MemberProfileMapper; |
9 | import com.topdraw.business.module.member.service.MemberService; | 10 | import com.topdraw.business.module.member.service.MemberService; |
10 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 11 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.utils.PageUtil; | 12 | import com.topdraw.util.Base64Util; |
12 | import com.topdraw.utils.QueryHelp; | 13 | import com.topdraw.utils.RedisUtils; |
13 | import com.topdraw.utils.StringUtils; | 14 | import com.topdraw.utils.StringUtils; |
14 | import com.topdraw.utils.ValidationUtil; | 15 | import com.topdraw.utils.ValidationUtil; |
16 | import lombok.extern.slf4j.Slf4j; | ||
17 | import org.springframework.beans.BeanUtils; | ||
15 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
16 | import org.springframework.dao.EmptyResultDataAccessException; | 19 | import org.springframework.dao.EmptyResultDataAccessException; |
17 | import org.springframework.data.domain.Page; | ||
18 | import org.springframework.data.domain.Pageable; | ||
19 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
20 | import org.springframework.transaction.annotation.Propagation; | 21 | import org.springframework.transaction.annotation.Propagation; |
21 | import org.springframework.transaction.annotation.Transactional; | 22 | import org.springframework.transaction.annotation.Transactional; |
22 | import org.springframework.util.Assert; | 23 | import org.springframework.util.Assert; |
23 | 24 | ||
24 | import java.util.List; | ||
25 | import java.util.Map; | ||
26 | import java.util.Objects; | 25 | import java.util.Objects; |
27 | 26 | ||
27 | |||
28 | /** | 28 | /** |
29 | * @author XiangHan | 29 | * @author XiangHan |
30 | * @date 2021-10-22 | 30 | * @date 2021-10-22 |
31 | */ | 31 | */ |
32 | @Service | 32 | @Service |
33 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 33 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
34 | @Slf4j | ||
34 | public class MemberProfileServiceImpl implements MemberProfileService { | 35 | public class MemberProfileServiceImpl implements MemberProfileService { |
35 | 36 | ||
36 | @Autowired | 37 | @Autowired |
37 | private MemberProfileRepository MemberProfileRepository; | 38 | private MemberService memberService; |
38 | |||
39 | @Autowired | 39 | @Autowired |
40 | private MemberProfileMapper MemberProfileMapper; | 40 | private MemberProfileMapper memberProfileMapper; |
41 | @Autowired | 41 | @Autowired |
42 | private MemberService memberService; | 42 | private MemberProfileRepository memberProfileRepository; |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | public Map<String, Object> queryAll(MemberProfileQueryCriteria criteria, Pageable pageable) { | 45 | public MemberProfileDTO findById(Long id) { |
46 | Page<MemberProfile> page = MemberProfileRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | 46 | MemberProfile MemberProfile = this.memberProfileRepository.findById(id).orElseGet(MemberProfile::new); |
47 | return PageUtil.toPage(page.map(MemberProfileMapper::toDto)); | 47 | ValidationUtil.isNull(MemberProfile.getId(),"MemberProfile","id",id); |
48 | return this.memberProfileMapper.toDto(MemberProfile); | ||
48 | } | 49 | } |
49 | 50 | ||
50 | @Override | 51 | @Override |
51 | public List<MemberProfileDTO> queryAll(MemberProfileQueryCriteria criteria) { | 52 | public MemberProfileDTO findByMemberId(Long memberId) { |
52 | return MemberProfileMapper.toDto(MemberProfileRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | 53 | log.info("MemberProfileDTO ==>> findByMemberId ==>> resources ===>> [{}]",memberId); |
54 | MemberProfile memberProfile = this.memberProfileRepository.findByMemberId(memberId).orElseGet(MemberProfile::new); | ||
55 | return this.memberProfileMapper.toDto(memberProfile); | ||
53 | } | 56 | } |
54 | 57 | ||
55 | @Override | 58 | @Override |
56 | public MemberProfileDTO findById(Long id) { | 59 | public MemberProfileDTO findByMemberCode(String memberCode) { |
57 | MemberProfile MemberProfile = MemberProfileRepository.findById(id).orElseGet(MemberProfile::new); | 60 | log.info("MemberProfileDTO ==>> findByMemberCode ==>> resources ===>> [{}]",memberCode); |
58 | ValidationUtil.isNull(MemberProfile.getId(),"MemberProfile","id",id); | 61 | MemberDTO memberDTO = this.memberService.findByCode(memberCode); |
59 | return MemberProfileMapper.toDto(MemberProfile); | 62 | log.info("MemberProfileDTO ==>> findByMemberCode ==>> result ===>> [{}]",memberDTO); |
63 | return this.findByMemberId(memberDTO.getId()); | ||
60 | } | 64 | } |
61 | 65 | ||
62 | @Override | 66 | @Override |
63 | @Transactional(rollbackFor = Exception.class) | 67 | @Transactional(rollbackFor = Exception.class) |
64 | public MemberProfile create(MemberProfile resources) { | 68 | public MemberProfile create(MemberProfile resources) { |
65 | String memberCode = resources.getMemberCode(); | 69 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
66 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | 70 | |
67 | if (Objects.nonNull(memberDTO)) { | 71 | // 检查会员 |
68 | String code = memberDTO.getCode(); | 72 | this.checkMember(resources); |
69 | if (StringUtils.isNotEmpty(code)) { | 73 | |
70 | resources.setMemberCode(code); | 74 | this.memberProfileRepository.save(resources); |
71 | resources.setMemberId(memberDTO.getId()); | ||
72 | resources.setId(null); | ||
73 | MemberProfileRepository.save(resources); | ||
74 | } | ||
75 | } | ||
76 | 75 | ||
77 | return resources; | 76 | return resources; |
78 | } | 77 | } |
79 | 78 | ||
80 | @Override | 79 | @Override |
81 | @Transactional(rollbackFor = Exception.class) | 80 | @Transactional(rollbackFor = Exception.class) |
82 | public void update(MemberProfile resources) { | 81 | public MemberProfile createDefault(MemberProfile resources) { |
82 | MemberProfile memberProfile = MemberProfileBuilder.build(resources); | ||
83 | return this.create(memberProfile); | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | @Transactional(rollbackFor = Exception.class) | ||
88 | public MemberProfile createDefault(Member resources) { | ||
89 | MemberProfile memberProfile = MemberProfileBuilder.build(resources); | ||
90 | return this.create(memberProfile); | ||
91 | } | ||
92 | |||
93 | @Override | ||
94 | public MemberProfile createDefaultByMemberId(Long resources) { | ||
95 | MemberProfile memberProfile = MemberProfileBuilder.build(resources); | ||
96 | return this.create(memberProfile); | ||
97 | } | ||
83 | 98 | ||
99 | private MemberDTO checkMember(MemberProfile resources){ | ||
100 | Long memberId = resources.getMemberId(); | ||
84 | String memberCode = resources.getMemberCode(); | 101 | String memberCode = resources.getMemberCode(); |
85 | MemberDTO memberDTO = this.memberService.getByCode(memberCode); | 102 | log.info("checkMember ==>> memberId ==>> {} || memberCode ==>> {}", memberId, memberCode); |
86 | if (Objects.nonNull(memberDTO)) { | 103 | return this.memberService.checkMember(memberId,memberCode); |
87 | Long memberId = memberDTO.getId(); | 104 | } |
88 | 105 | ||
89 | MemberProfile memberProfile = MemberProfileRepository.findByMemberId(memberId); | 106 | @Override |
90 | if (Objects.nonNull(memberProfile)) { | 107 | @Transactional(rollbackFor = Exception.class) |
91 | ValidationUtil.isNull( memberProfile.getId(),"MemberProfile","id",memberProfile.getId()); | 108 | public MemberProfileDTO update(MemberProfile resources) { |
92 | resources.setId(memberProfile.getId()); | 109 | |
93 | } else { | 110 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); |
94 | resources.setId(null); | 111 | // 检查会员是否存在 |
95 | } | 112 | MemberDTO memberDTO = this.checkMember(resources); |
96 | 113 | ||
97 | resources.setMemberId(memberId); | 114 | MemberProfileDTO _memberProfileDTO = this.findByMemberId(memberDTO.getId()); |
98 | memberProfile.copy(resources); | 115 | |
99 | MemberProfileRepository.save(memberProfile); | 116 | if (Objects.nonNull(_memberProfileDTO.getId())) { |
117 | resources.setId(_memberProfileDTO.getId()); | ||
118 | resources.setCreateTime(_memberProfileDTO.getCreateTime()); | ||
100 | } | 119 | } |
120 | |||
121 | resources.setMemberId(memberDTO.getId()); | ||
122 | |||
123 | log.info("memberProfileServiceImpl ==>> update ==>> memberId ==>> {} || resources =>> {}", memberDTO.getId(), resources); | ||
124 | MemberProfile _memberProfile = this.memberProfileRepository.save(resources); | ||
125 | |||
126 | MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); | ||
127 | BeanUtils.copyProperties(_memberProfile, memberProfileDTO); | ||
128 | return memberProfileDTO; | ||
129 | |||
101 | } | 130 | } |
102 | 131 | ||
103 | @Override | 132 | @Override |
104 | @Transactional(rollbackFor = Exception.class) | 133 | @Transactional(rollbackFor = Exception.class) |
105 | public void delete(Long id) { | 134 | public void delete(Long id) { |
106 | Assert.notNull(id, "The given id must not be null!"); | 135 | Assert.notNull(id, "The given id must not be null!"); |
107 | MemberProfile MemberProfile = MemberProfileRepository.findById(id).orElseThrow( | 136 | MemberProfile MemberProfile = this.memberProfileRepository.findById(id).orElseThrow( |
108 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberProfile.class, id), 1)); | 137 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberProfile.class, id), 1)); |
109 | MemberProfileRepository.delete(MemberProfile); | 138 | this.memberProfileRepository.delete(MemberProfile); |
139 | } | ||
140 | |||
141 | @Override | ||
142 | @Transactional(rollbackFor = Exception.class) | ||
143 | public MemberProfileDTO updateMemberProfileAndMember(MemberProfile resources, MemberDTO memberDTO) { | ||
144 | log.info("MemberProfileServiceImpl ==>> updateMemberProfileAndMember ==>> resources ===>> [{}]",resources); | ||
145 | MemberProfileDTO memberProfileDTO = this.update(resources); | ||
146 | // 同步会员信息 | ||
147 | this.synchronizedMemberData(resources, memberDTO); | ||
148 | return memberProfileDTO; | ||
110 | } | 149 | } |
111 | 150 | ||
151 | private void synchronizedMemberData(MemberProfile resources, MemberDTO memberDTO) { | ||
112 | 152 | ||
153 | log.info("updateMemberProfileAndMember ==>> resources ==>> [{}]",resources); | ||
154 | |||
155 | memberDTO.setId(resources.getMemberId()); | ||
156 | memberDTO.setCode(resources.getMemberCode()); | ||
157 | memberDTO.setNickname(resources.getRealname()); | ||
158 | memberDTO.setGender(resources.getGender()); | ||
159 | memberDTO.setBirthday(resources.getBirthday()); | ||
160 | memberDTO.setAvatarUrl(resources.getAvatarUrl()); | ||
161 | |||
162 | Member member = new Member(); | ||
163 | BeanUtils.copyProperties(memberDTO,member); | ||
164 | |||
165 | this.memberService.update(member); | ||
166 | } | ||
113 | } | 167 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.relatedinfo.domain; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.member.relatedinfo.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.module.common.domain.AsyncMqModule; | ||
6 | import com.topdraw.business.module.common.validated.UpdateGroup; | ||
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 8 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 9 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -9,8 +11,10 @@ import org.springframework.data.annotation.LastModifiedDate; | ... | @@ -9,8 +11,10 @@ import org.springframework.data.annotation.LastModifiedDate; |
9 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
10 | 12 | ||
11 | import javax.persistence.*; | 13 | import javax.persistence.*; |
14 | import javax.validation.constraints.NotNull; | ||
12 | import java.io.Serializable; | 15 | import java.io.Serializable; |
13 | import java.sql.Timestamp; | 16 | import java.sql.Timestamp; |
17 | import java.time.LocalDate; | ||
14 | 18 | ||
15 | /** | 19 | /** |
16 | * @author XiangHan | 20 | * @author XiangHan |
... | @@ -21,47 +25,53 @@ import java.sql.Timestamp; | ... | @@ -21,47 +25,53 @@ import java.sql.Timestamp; |
21 | @EntityListeners(AuditingEntityListener.class) | 25 | @EntityListeners(AuditingEntityListener.class) |
22 | @Accessors(chain = true) | 26 | @Accessors(chain = true) |
23 | @Table(name="uc_member_related_info") | 27 | @Table(name="uc_member_related_info") |
24 | public class MemberRelatedInfo implements Serializable { | 28 | public class MemberRelatedInfo extends AsyncMqModule implements Serializable { |
25 | 29 | ||
26 | // ID | 30 | /** ID */ |
27 | @Id | 31 | @Id |
28 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 32 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
29 | @Column(name = "id") | 33 | @Column(name = "id") |
34 | @NotNull(message = "id can't be null" , groups = {UpdateGroup.class}) | ||
30 | private Long id; | 35 | private Long id; |
31 | 36 | ||
32 | // 会员id | 37 | /** 会员id */ |
33 | @Column(name = "member_id", nullable = false) | 38 | @Column(name = "member_id", nullable = false) |
34 | private Long memberId; | 39 | private Long memberId; |
35 | 40 | ||
36 | @Transient | 41 | /** 人物关系 0:子女;1:父母 */ |
37 | private String memberCode; | ||
38 | |||
39 | // 人物关系 0:子女;1:父母 | ||
40 | @Column(name = "type") | 42 | @Column(name = "type") |
41 | private Integer type; | 43 | private Integer type; |
42 | 44 | ||
43 | // 手机号 | 45 | /** 手机号 */ |
44 | @Column(name = "cellphone") | 46 | @Column(name = "cellphone") |
45 | private String cellphone; | 47 | private String cellphone; |
46 | 48 | ||
47 | // 身份证号 | 49 | /** 身份证号 */ |
48 | @Column(name = "id_card") | 50 | @Column(name = "id_card") |
49 | private String idCard; | 51 | private String idCard; |
50 | 52 | ||
51 | // 姓名 | 53 | /** 姓名 */ |
52 | @Column(name = "name") | 54 | @Column(name = "name") |
53 | private String name; | 55 | private String name; |
54 | 56 | ||
55 | // 性别 0:女;1:男;-1:未知 | 57 | /** 性别 0:女;1:男;-1:未知 */ |
56 | @Column(name = "sex") | 58 | @Column(name = "sex") |
57 | private Integer sex; | 59 | private Integer sex; |
58 | 60 | ||
59 | // 创建时间 | 61 | /** 生日 */ |
62 | @Column(name = "birthday") | ||
63 | private LocalDate birthday; | ||
64 | |||
65 | /** 头像地址 */ | ||
66 | @Column(name = "avatar_url") | ||
67 | private String avatarUrl; | ||
68 | |||
69 | /** 创建时间 */ | ||
60 | @CreatedDate | 70 | @CreatedDate |
61 | @Column(name = "create_time") | 71 | @Column(name = "create_time") |
62 | private Timestamp createTime; | 72 | private Timestamp createTime; |
63 | 73 | ||
64 | // 更新时间 | 74 | /** 更新时间 */ |
65 | @LastModifiedDate | 75 | @LastModifiedDate |
66 | @Column(name = "update_time") | 76 | @Column(name = "update_time") |
67 | private Timestamp updateTime; | 77 | private Timestamp updateTime; | ... | ... |
src/main/java/com/topdraw/business/module/member/relatedinfo/domain/MemberRelatedInfoBuilder.java
0 → 100644
1 | package com.topdraw.business.module.member.relatedinfo.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.exception.GlobeExceptionMsg; | ||
5 | import org.apache.commons.lang3.StringUtils; | ||
6 | import org.springframework.util.Assert; | ||
7 | |||
8 | import java.time.LocalDate; | ||
9 | import java.util.Objects; | ||
10 | |||
11 | /** | ||
12 | * @author : | ||
13 | * @description: | ||
14 | * @function : | ||
15 | * @date :Created in 2022/3/11 13:56 | ||
16 | * @version: : | ||
17 | * @modified By: | ||
18 | * @since : modified in 2022/3/11 13:56 | ||
19 | */ | ||
20 | public class MemberRelatedInfoBuilder { | ||
21 | |||
22 | private static final Integer DEFAULT_VALUE_ = -1; | ||
23 | private static final Integer DEFAULT_VALUE_0 = 0; | ||
24 | |||
25 | public static MemberRelatedInfo build(MemberRelatedInfo memberRelatedInfo){ | ||
26 | return build(memberRelatedInfo.getMemberId(),memberRelatedInfo.getMemberCode(),memberRelatedInfo.getId(),memberRelatedInfo.getName(),memberRelatedInfo.getSex(), | ||
27 | memberRelatedInfo.getCellphone(),memberRelatedInfo.getIdCard(),memberRelatedInfo.getBirthday(),memberRelatedInfo.getAvatarUrl(),memberRelatedInfo.getType()); | ||
28 | } | ||
29 | |||
30 | public static MemberRelatedInfo build(Member member , MemberRelatedInfo memberRelatedInfo){ | ||
31 | return build(member.getId(),member.getCode(),memberRelatedInfo.getId(),memberRelatedInfo.getName(),memberRelatedInfo.getSex(), | ||
32 | memberRelatedInfo.getCellphone(),memberRelatedInfo.getIdCard(),memberRelatedInfo.getBirthday(),memberRelatedInfo.getAvatarUrl(),memberRelatedInfo.getType()); | ||
33 | } | ||
34 | |||
35 | public static MemberRelatedInfo build(Long memberId , String memberCode , Long id , String name , Integer sex , | ||
36 | String cellphone , String idCard, LocalDate birthday , String avatarUrl , Integer type){ | ||
37 | |||
38 | Assert.notNull(memberId, GlobeExceptionMsg.MEMBER_ID_IS_NULL); | ||
39 | |||
40 | MemberRelatedInfo memberRelatedInfo = new MemberRelatedInfo(); | ||
41 | memberRelatedInfo.setMemberId(memberId); | ||
42 | memberRelatedInfo.setMemberCode(memberCode); | ||
43 | |||
44 | memberRelatedInfo.setId(id); | ||
45 | memberRelatedInfo.setName(stringIsNull(name)); | ||
46 | memberRelatedInfo.setSex(Objects.isNull(sex)?DEFAULT_VALUE_:sex); | ||
47 | memberRelatedInfo.setCellphone(stringIsNull(cellphone)); | ||
48 | memberRelatedInfo.setIdCard(StringUtils.isBlank(idCard)?"000000000000000000":idCard); | ||
49 | |||
50 | memberRelatedInfo.setBirthday(Objects.isNull(birthday)? LocalDate.of(1990,01,01):birthday); | ||
51 | memberRelatedInfo.setAvatarUrl(stringIsNull(avatarUrl)); | ||
52 | |||
53 | memberRelatedInfo.setType(Objects.isNull(type)?DEFAULT_VALUE_0:type); | ||
54 | return memberRelatedInfo; | ||
55 | } | ||
56 | |||
57 | private static String stringIsNull(String s){ | ||
58 | return StringUtils.isBlank(s)?"":s; | ||
59 | } | ||
60 | |||
61 | } |
... | @@ -4,7 +4,6 @@ import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | ... | @@ -4,7 +4,6 @@ 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 | ||
7 | import java.util.List; | ||
8 | 7 | ||
9 | /** | 8 | /** |
10 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -12,5 +11,10 @@ import java.util.List; | ... | @@ -12,5 +11,10 @@ import java.util.List; |
12 | */ | 11 | */ |
13 | public interface MemberRelatedInfoRepository extends JpaRepository<MemberRelatedInfo, Long>, JpaSpecificationExecutor<MemberRelatedInfo> { | 12 | public interface MemberRelatedInfoRepository extends JpaRepository<MemberRelatedInfo, Long>, JpaSpecificationExecutor<MemberRelatedInfo> { |
14 | 13 | ||
15 | List<MemberRelatedInfo> findByMemberIdAndIdCard(Long memberDTOId,String idCard); | 14 | MemberRelatedInfo findByIdCard(String idCard); |
15 | |||
16 | MemberRelatedInfo findByMemberIdAndIdCard(Long memberId, String idCard); | ||
17 | |||
18 | MemberRelatedInfo findByIdOrIdCard(Long id, String idCard); | ||
19 | |||
16 | } | 20 | } | ... | ... |
1 | package com.topdraw.business.module.member.relatedinfo.service; | 1 | package com.topdraw.business.module.member.relatedinfo.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | ||
3 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | 4 | import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
4 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; | 5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoDTO; |
5 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | |||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | 6 | ||
11 | /** | 7 | /** |
12 | * @author XiangHan | 8 | * @author XiangHan |
... | @@ -15,31 +11,72 @@ import java.util.Map; | ... | @@ -15,31 +11,72 @@ import java.util.Map; |
15 | public interface MemberRelatedInfoService { | 11 | public interface MemberRelatedInfoService { |
16 | 12 | ||
17 | /** | 13 | /** |
18 | * 查询数据分页 | ||
19 | * @param criteria 条件参数 | ||
20 | * @param pageable 分页参数 | ||
21 | * @return Map<String,Object> | ||
22 | */ | ||
23 | Map<String,Object> queryAll(MemberRelatedInfoQueryCriteria criteria, Pageable pageable); | ||
24 | |||
25 | /** | ||
26 | * 查询所有数据不分页 | ||
27 | * @param criteria 条件参数 | ||
28 | * @return List<MemberRelatedInfoDTO> | ||
29 | */ | ||
30 | List<MemberRelatedInfoDTO> queryAll(MemberRelatedInfoQueryCriteria criteria); | ||
31 | |||
32 | /** | ||
33 | * 根据ID查询 | 14 | * 根据ID查询 |
34 | * @param id ID | 15 | * @param id ID |
35 | * @return MemberRelatedInfoDTO | 16 | * @return MemberRelatedInfoDTO |
36 | */ | 17 | */ |
37 | MemberRelatedInfoDTO findById(Long id); | 18 | MemberRelatedInfoDTO findById(Long id); |
38 | 19 | ||
39 | void create(MemberRelatedInfo resources); | 20 | /** |
21 | * 新增 | ||
22 | * @param resources | ||
23 | */ | ||
24 | MemberRelatedInfoDTO create(MemberRelatedInfo resources); | ||
40 | 25 | ||
41 | void update(MemberRelatedInfo resources); | 26 | /** |
27 | * 修改 | ||
28 | * @param resources | ||
29 | */ | ||
30 | MemberRelatedInfoDTO update(MemberRelatedInfo resources); | ||
42 | 31 | ||
32 | /** | ||
33 | * 删除 | ||
34 | * @param id | ||
35 | */ | ||
43 | void delete(Long id); | 36 | void delete(Long id); |
44 | 37 | ||
38 | /** | ||
39 | * 通过身份证查询 | ||
40 | * @param resources | ||
41 | * @return | ||
42 | */ | ||
43 | MemberRelatedInfoDTO findByIdCard(MemberRelatedInfo resources); | ||
44 | |||
45 | /** | ||
46 | * 通过身份证查询 | ||
47 | * @param idCard 身份证 | ||
48 | * @return | ||
49 | */ | ||
50 | MemberRelatedInfoDTO findByIdCard(String idCard); | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | * @param memberId | ||
55 | * @param idCard | ||
56 | * @return | ||
57 | */ | ||
58 | MemberRelatedInfoDTO findByMemberIdAndIdCard(Long memberId, String idCard); | ||
59 | |||
60 | /** | ||
61 | * | ||
62 | * @param memberCode | ||
63 | * @param idCard | ||
64 | * @return | ||
65 | */ | ||
66 | MemberRelatedInfoDTO findByMemberCodeAndIdCard(String memberCode, String idCard); | ||
67 | |||
68 | /** | ||
69 | * | ||
70 | * @param resources | ||
71 | * @return | ||
72 | */ | ||
73 | MemberRelatedInfoDTO findByMemberIdAndIdCard(MemberRelatedInfo resources); | ||
74 | |||
75 | /** | ||
76 | * | ||
77 | * @param member | ||
78 | * @param resources | ||
79 | * @return | ||
80 | */ | ||
81 | MemberRelatedInfoDTO findByMemberIdAndIdCard(Member member, MemberRelatedInfo resources); | ||
45 | } | 82 | } | ... | ... |
... | @@ -4,6 +4,7 @@ import lombok.Data; | ... | @@ -4,6 +4,7 @@ import lombok.Data; |
4 | 4 | ||
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | import java.sql.Timestamp; | 6 | import java.sql.Timestamp; |
7 | import java.time.LocalDate; | ||
7 | 8 | ||
8 | 9 | ||
9 | /** | 10 | /** |
... | @@ -34,6 +35,12 @@ public class MemberRelatedInfoDTO implements Serializable { | ... | @@ -34,6 +35,12 @@ public class MemberRelatedInfoDTO implements Serializable { |
34 | // 性别 0:女;1:男;-1:未知 | 35 | // 性别 0:女;1:男;-1:未知 |
35 | private Integer sex; | 36 | private Integer sex; |
36 | 37 | ||
38 | // 生日 | ||
39 | private LocalDate birthday; | ||
40 | |||
41 | // 头像地址 | ||
42 | private String avatarUrl; | ||
43 | |||
37 | // 创建时间 | 44 | // 创建时间 |
38 | private Timestamp createTime; | 45 | private Timestamp createTime; |
39 | 46 | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -3,9 +3,8 @@ package com.topdraw.business.module.member.repository; | ... | @@ -3,9 +3,8 @@ package com.topdraw.business.module.member.repository; |
3 | import com.topdraw.business.module.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 | import org.springframework.data.jpa.repository.Modifying; | ||
7 | import org.springframework.data.jpa.repository.Query; | ||
8 | 6 | ||
7 | import java.util.List; | ||
9 | import java.util.Optional; | 8 | import java.util.Optional; |
10 | 9 | ||
11 | /** | 10 | /** |
... | @@ -16,10 +15,7 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif | ... | @@ -16,10 +15,7 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif |
16 | 15 | ||
17 | Optional<Member> findFirstByCode(String code); | 16 | Optional<Member> findFirstByCode(String code); |
18 | 17 | ||
19 | Optional<Member> findByCode(String code); | 18 | List<Member> findByUserIptvId(Long id); |
20 | 19 | ||
21 | 20 | Optional<Member> findByIdOrCode(Long id, String code); | |
22 | @Modifying | ||
23 | @Query(value = "update uc_member set `points` = ?2 , `due_points` = ?3 where id = ?1 ",nativeQuery = true) | ||
24 | void updateMemberPoints(Long id, Long points, Long duePoints); | ||
25 | } | 21 | } | ... | ... |
... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.member.service; | ... | @@ -2,13 +2,8 @@ package com.topdraw.business.module.member.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | 3 | import com.topdraw.business.module.member.domain.Member; |
4 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 4 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
5 | import com.topdraw.business.module.member.service.dto.MemberQueryCriteria; | ||
6 | import com.topdraw.business.module.user.iptv.domain.UserTv; | ||
7 | import org.springframework.data.domain.Pageable; | ||
8 | import org.springframework.transaction.annotation.Transactional; | ||
9 | 5 | ||
10 | import java.util.List; | 6 | import java.util.List; |
11 | import java.util.Map; | ||
12 | 7 | ||
13 | /** | 8 | /** |
14 | * @author XiangHan | 9 | * @author XiangHan |
... | @@ -16,20 +11,7 @@ import java.util.Map; | ... | @@ -16,20 +11,7 @@ import java.util.Map; |
16 | */ | 11 | */ |
17 | public interface MemberService { | 12 | public interface MemberService { |
18 | 13 | ||
19 | /** | ||
20 | * 查询数据分页 | ||
21 | * @param criteria 条件参数 | ||
22 | * @param pageable 分页参数 | ||
23 | * @return Map<String,Object> | ||
24 | */ | ||
25 | Map<String,Object> queryAll(MemberQueryCriteria criteria, Pageable pageable); | ||
26 | 14 | ||
27 | /** | ||
28 | * 查询所有数据不分页 | ||
29 | * @param criteria 条件参数 | ||
30 | * @return List<MemberDTO> | ||
31 | */ | ||
32 | List<MemberDTO> queryAll(MemberQueryCriteria criteria); | ||
33 | 15 | ||
34 | /** | 16 | /** |
35 | * 根据ID查询 | 17 | * 根据ID查询 |
... | @@ -38,24 +20,67 @@ public interface MemberService { | ... | @@ -38,24 +20,67 @@ public interface MemberService { |
38 | */ | 20 | */ |
39 | MemberDTO findById(Long id); | 21 | MemberDTO findById(Long id); |
40 | 22 | ||
41 | Long create(Member resources); | 23 | /** |
24 | * 通过code查询会员 | ||
25 | * @param code 会员编码 | ||
26 | * @return MemberDTO | ||
27 | */ | ||
28 | MemberDTO findByCode(String code); | ||
42 | 29 | ||
43 | void unbind(Member resources); | 30 | /** |
31 | * 保存 | ||
32 | * @param resources | ||
33 | * @return Long id | ||
34 | */ | ||
35 | MemberDTO create(Member resources); | ||
36 | |||
37 | /** | ||
38 | * 创建并返回会员 | ||
39 | * @param resources 会员 | ||
40 | * @return Member | ||
41 | */ | ||
42 | MemberDTO createAndReturnMember(Member resources); | ||
43 | |||
44 | /** | ||
45 | * 修改会员 | ||
46 | * @param resources | ||
47 | */ | ||
48 | MemberDTO update(Member resources); | ||
44 | 49 | ||
45 | void update(Member resources); | 50 | /** |
51 | * 修改会员积分 | ||
52 | * @param member 会员 | ||
53 | */ | ||
54 | MemberDTO doUpdateMemberPoints(Member member); | ||
46 | 55 | ||
47 | void delete(Long id); | 56 | /** |
57 | * 查询绑定了大屏会员列表 | ||
58 | * @param id 条件参数 | ||
59 | * @return Map<String,Object> | ||
60 | */ | ||
61 | List<MemberDTO> findByUserIptvId(Long id); | ||
48 | 62 | ||
49 | /** | 63 | /** |
50 | * Code校验 | 64 | * 检查会员信息 |
51 | * @param code | 65 | * @param id 会员id |
52 | * @return MemberDTO | 66 | * @param memberCode 会员编码 |
53 | */ | 67 | */ |
54 | MemberDTO getByCode(String code); | 68 | MemberDTO checkMember(Long id, String memberCode); |
55 | 69 | ||
56 | boolean createMemberByUserTv(UserTv resources); | 70 | /** |
71 | * 检查会员信息 | ||
72 | * @param member 会员 | ||
73 | */ | ||
74 | MemberDTO checkMember(Member member); | ||
75 | |||
76 | /** | ||
77 | * | ||
78 | * @param resources | ||
79 | */ | ||
80 | MemberDTO doUpdateMemberExpAndLevel(Member resources); | ||
81 | |||
82 | MemberDTO unbindUserIpTv(Member member); | ||
57 | 83 | ||
58 | void doUpdateMemberPoints(Member member); | ||
59 | 84 | ||
60 | Member createAndReturnMember(Member resources); | 85 | void unbind(Member resources); |
61 | } | 86 | } | ... | ... |
... | @@ -3,7 +3,6 @@ package com.topdraw.business.module.member.service.dto; | ... | @@ -3,7 +3,6 @@ package com.topdraw.business.module.member.service.dto; |
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | import java.sql.Timestamp; | ||
7 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
8 | 7 | ||
9 | 8 | ||
... | @@ -14,7 +13,12 @@ import java.time.LocalDateTime; | ... | @@ -14,7 +13,12 @@ import java.time.LocalDateTime; |
14 | @Data | 13 | @Data |
15 | public class MemberDTO implements Serializable { | 14 | public class MemberDTO implements Serializable { |
16 | 15 | ||
17 | // 会员过期时间 | 16 | private String platformAccount; |
17 | |||
18 | // iptv绑定的主会员 0:否 1:是 | ||
19 | private Integer iptvMajor; | ||
20 | |||
21 | // vip过期时间 | ||
18 | private LocalDateTime vipExpireTime; | 22 | private LocalDateTime vipExpireTime; |
19 | 23 | ||
20 | // 主键 | 24 | // 主键 |
... | @@ -87,5 +91,5 @@ public class MemberDTO implements Serializable { | ... | @@ -87,5 +91,5 @@ public class MemberDTO implements Serializable { |
87 | private LocalDateTime updateTime; | 91 | private LocalDateTime updateTime; |
88 | 92 | ||
89 | // 是否在黑名单 1:是;0否 | 93 | // 是否在黑名单 1:是;0否 |
90 | // private Integer blackStatus; | 94 | private Long blackStatus; |
91 | } | 95 | } | ... | ... |
src/main/java/com/topdraw/business/module/member/service/dto/MemberQueryCriteria.java
deleted
100644 → 0
1 | package com.topdraw.business.module.member.service.dto; | ||
2 | |||
3 | import com.topdraw.annotation.Query; | ||
4 | import lombok.Data; | ||
5 | |||
6 | /** | ||
7 | * @author XiangHan | ||
8 | * @date 2021-10-22 | ||
9 | */ | ||
10 | @Data | ||
11 | public class MemberQueryCriteria{ | ||
12 | |||
13 | @Query(type = Query.Type.LEFT_LIKE) | ||
14 | private String code; | ||
15 | |||
16 | // 类型 1:大屏;2:小屏 | ||
17 | @Query(type = Query.Type.EQUAL) | ||
18 | private Integer type; | ||
19 | |||
20 | // 状态 0:不可用;1:可用 | ||
21 | @Query(type = Query.Type.EQUAL) | ||
22 | private Integer status; | ||
23 | |||
24 | // 昵称 base64 | ||
25 | @Query(type = Query.Type.LEFT_LIKE) | ||
26 | private String nickname; | ||
27 | |||
28 | // 性别 0:女;1:男;-1:未知 | ||
29 | @Query(type = Query.Type.EQUAL) | ||
30 | private Integer gender; | ||
31 | |||
32 | // 分组信息 | ||
33 | @Query(type = Query.Type.EQUAL) | ||
34 | private String groups; | ||
35 | |||
36 | // 标签 | ||
37 | @Query(type = Query.Type.IN) | ||
38 | private String tags; | ||
39 | |||
40 | // 是否会员 0:非会员;1:会员 | ||
41 | @Query(type = Query.Type.EQUAL) | ||
42 | private Integer vip; | ||
43 | |||
44 | // 会员等级(对应level表的level字段,非id) | ||
45 | @Query(type = Query.Type.EQUAL) | ||
46 | private Integer level; | ||
47 | |||
48 | // iptv账号id | ||
49 | @Query(type = Query.Type.EQUAL) | ||
50 | private Long userIptvId; | ||
51 | |||
52 | // 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 | ||
53 | @Query(type = Query.Type.IN) | ||
54 | private Integer bindIptvPlatformType; | ||
55 | |||
56 | } |
This diff is collapsed.
Click to expand it.
... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.viphistory.domain; | ... | @@ -2,6 +2,7 @@ package com.topdraw.business.module.member.viphistory.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.module.common.domain.AsyncMqModule; | ||
5 | import lombok.Data; | 6 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 7 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 8 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -22,10 +23,7 @@ import java.time.LocalDateTime; | ... | @@ -22,10 +23,7 @@ import java.time.LocalDateTime; |
22 | @EntityListeners(AuditingEntityListener.class) | 23 | @EntityListeners(AuditingEntityListener.class) |
23 | @Accessors(chain = true) | 24 | @Accessors(chain = true) |
24 | @Table(name="uc_member_vip_history") | 25 | @Table(name="uc_member_vip_history") |
25 | public class MemberVipHistory implements Serializable { | 26 | public class MemberVipHistory extends AsyncMqModule implements Serializable { |
26 | |||
27 | @Transient | ||
28 | private String memberCode; | ||
29 | 27 | ||
30 | // 主键 | 28 | // 主键 |
31 | @Id | 29 | @Id | ... | ... |
src/main/java/com/topdraw/business/module/member/viphistory/domain/MemberVipHistoryBuilder.java
0 → 100644
1 | package com.topdraw.business.module.member.viphistory.domain; | ||
2 | |||
3 | import com.topdraw.business.module.member.domain.Member; | ||
4 | |||
5 | import java.time.LocalDateTime; | ||
6 | import java.util.Objects; | ||
7 | |||
8 | public class MemberVipHistoryBuilder { | ||
9 | |||
10 | public static MemberVipHistory build(Member member , Integer beforeVip) { | ||
11 | Long id = member.getId(); | ||
12 | Integer vip = member.getVip(); | ||
13 | LocalDateTime vipExpireTime = member.getVipExpireTime(); | ||
14 | |||
15 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
16 | memberVipHistory.setMemberId(Objects.isNull(id)? null:id); | ||
17 | memberVipHistory.setVip(Objects.isNull(vip)? null:vip); | ||
18 | memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip); | ||
19 | memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime); | ||
20 | return build(memberVipHistory); | ||
21 | } | ||
22 | |||
23 | public static MemberVipHistory build(Long memberId, Integer vip, Integer beforeVip, LocalDateTime vipExpireTime ) { | ||
24 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
25 | memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId); | ||
26 | memberVipHistory.setVip(Objects.isNull(vip)? null:vip); | ||
27 | memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip); | ||
28 | memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime); | ||
29 | return build(memberVipHistory); | ||
30 | } | ||
31 | |||
32 | public static MemberVipHistory build(MemberVipHistory memberVipHistory) { | ||
33 | return build(memberVipHistory.getId(), | ||
34 | memberVipHistory.getMemberId(), | ||
35 | memberVipHistory.getVip(), | ||
36 | memberVipHistory.getBeforeVip(), | ||
37 | memberVipHistory.getVipExpireTime(), | ||
38 | memberVipHistory.getStatus()); | ||
39 | } | ||
40 | |||
41 | public static MemberVipHistory build(Long id, Long memberId , Integer vip , Integer beforeVip , LocalDateTime vipExpireTime, Integer status){ | ||
42 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | ||
43 | memberVipHistory.setId(Objects.isNull(id)? null:id); | ||
44 | memberVipHistory.setMemberId(Objects.isNull(memberId)? null:memberId) ; | ||
45 | memberVipHistory.setVip(Objects.isNull(vip)? null:vip); | ||
46 | memberVipHistory.setBeforeVip(Objects.isNull(beforeVip)? null:beforeVip); | ||
47 | memberVipHistory.setVipExpireTime(Objects.isNull(vipExpireTime)? null:vipExpireTime); | ||
48 | memberVipHistory.setStatus(Objects.isNull(status)? 1:status); | ||
49 | return memberVipHistory; | ||
50 | } | ||
51 | |||
52 | } |
1 | package com.topdraw.business.module.member.viphistory.service; | 1 | package com.topdraw.business.module.member.viphistory.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.member.domain.Member; | ||
3 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 4 | 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.MemberVipHistoryDTO; |
5 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | 6 | ||
8 | import java.time.LocalDateTime; | 7 | import java.time.LocalDateTime; |
9 | import java.util.List; | ||
10 | import java.util.Map; | ||
11 | 8 | ||
12 | /** | 9 | /** |
13 | * @author luerlong | 10 | * @author luerlong |
... | @@ -16,32 +13,42 @@ import java.util.Map; | ... | @@ -16,32 +13,42 @@ import java.util.Map; |
16 | public interface MemberVipHistoryService { | 13 | public interface MemberVipHistoryService { |
17 | 14 | ||
18 | /** | 15 | /** |
19 | * 查询数据分页 | ||
20 | * @param criteria 条件参数 | ||
21 | * @param pageable 分页参数 | ||
22 | * @return Map<String,Object> | ||
23 | */ | ||
24 | Map<String,Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable); | ||
25 | |||
26 | /** | ||
27 | * 查询所有数据不分页 | ||
28 | * @param criteria 条件参数 | ||
29 | * @return List<MemberVipHistoryDTO> | ||
30 | */ | ||
31 | List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria); | ||
32 | |||
33 | /** | ||
34 | * 根据ID查询 | 16 | * 根据ID查询 |
35 | * @param id ID | 17 | * @param id ID |
36 | * @return MemberVipHistoryDTO | 18 | * @return MemberVipHistoryDTO |
37 | */ | 19 | */ |
38 | MemberVipHistoryDTO findById(Long id); | 20 | MemberVipHistoryDTO findById(Long id); |
39 | 21 | ||
22 | /** | ||
23 | * | ||
24 | * @param resources | ||
25 | */ | ||
40 | void create(MemberVipHistory resources); | 26 | void create(MemberVipHistory resources); |
41 | 27 | ||
28 | /** | ||
29 | * | ||
30 | * @param member | ||
31 | */ | ||
32 | void create(Member member, Integer beforeVip); | ||
33 | |||
34 | /** | ||
35 | * | ||
36 | * @param resources | ||
37 | */ | ||
42 | void update(MemberVipHistory resources); | 38 | void update(MemberVipHistory resources); |
43 | 39 | ||
40 | /** | ||
41 | * | ||
42 | * @param id | ||
43 | */ | ||
44 | void delete(Long id); | 44 | void delete(Long id); |
45 | 45 | ||
46 | /** | ||
47 | * | ||
48 | * @param id | ||
49 | * @param nowTime | ||
50 | * @return | ||
51 | */ | ||
46 | MemberVipHistory findByTime(Long id, LocalDateTime nowTime); | 52 | MemberVipHistory findByTime(Long id, LocalDateTime nowTime); |
53 | |||
47 | } | 54 | } | ... | ... |
1 | package com.topdraw.business.module.member.viphistory.service.impl; | 1 | package com.topdraw.business.module.member.viphistory.service.impl; |
2 | 2 | ||
3 | 3 | ||
4 | import com.topdraw.business.module.member.domain.Member; | ||
4 | import com.topdraw.business.module.member.service.MemberService; | 5 | import com.topdraw.business.module.member.service.MemberService; |
5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
6 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 7 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
8 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistoryBuilder; | ||
7 | import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; | 9 | import com.topdraw.business.module.member.viphistory.repository.MemberVipHistoryRepository; |
8 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 10 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
9 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; | 11 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO; |
10 | import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryQueryCriteria; | ||
11 | import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper; | 12 | import com.topdraw.business.module.member.viphistory.service.mapper.MemberVipHistoryMapper; |
12 | import com.topdraw.utils.PageUtil; | ||
13 | import com.topdraw.utils.QueryHelp; | ||
14 | import com.topdraw.utils.ValidationUtil; | 13 | import com.topdraw.utils.ValidationUtil; |
15 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
16 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
17 | import org.springframework.dao.EmptyResultDataAccessException; | 16 | import org.springframework.dao.EmptyResultDataAccessException; |
18 | import org.springframework.data.domain.Page; | ||
19 | import org.springframework.data.domain.Pageable; | ||
20 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
21 | import org.springframework.transaction.annotation.Propagation; | 18 | import org.springframework.transaction.annotation.Propagation; |
22 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
23 | import org.springframework.util.Assert; | 20 | import org.springframework.util.Assert; |
24 | 21 | ||
25 | import java.time.LocalDateTime; | 22 | import java.time.LocalDateTime; |
26 | import java.util.List; | ||
27 | import java.util.Map; | ||
28 | import java.util.Objects; | ||
29 | 23 | ||
30 | /** | 24 | /** |
31 | * @author luerlong | 25 | * @author luerlong |
... | @@ -37,61 +31,54 @@ import java.util.Objects; | ... | @@ -37,61 +31,54 @@ import java.util.Objects; |
37 | public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | 31 | public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
38 | 32 | ||
39 | @Autowired | 33 | @Autowired |
40 | private MemberVipHistoryRepository memberVipHistoryRepository; | 34 | private MemberService memberService; |
41 | 35 | ||
42 | @Autowired | 36 | @Autowired |
43 | private MemberVipHistoryMapper memberVipHistoryMapper; | 37 | private MemberVipHistoryMapper memberVipHistoryMapper; |
44 | @Autowired | 38 | @Autowired |
45 | private MemberService memberService; | 39 | private MemberVipHistoryRepository memberVipHistoryRepository; |
46 | |||
47 | @Override | ||
48 | public Map<String, Object> queryAll(MemberVipHistoryQueryCriteria criteria, Pageable pageable) { | ||
49 | Page<MemberVipHistory> page = memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||
50 | return PageUtil.toPage(page.map(memberVipHistoryMapper::toDto)); | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | public List<MemberVipHistoryDTO> queryAll(MemberVipHistoryQueryCriteria criteria) { | ||
55 | return memberVipHistoryMapper.toDto(memberVipHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); | ||
56 | } | ||
57 | 40 | ||
58 | @Override | 41 | @Override |
59 | public MemberVipHistoryDTO findById(Long id) { | 42 | public MemberVipHistoryDTO findById(Long id) { |
60 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new); | 43 | log.info("MemberVipHistoryServiceImpl ==>> findById ==>> param ==>> [{}]",id); |
44 | MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(id).orElseGet(MemberVipHistory::new); | ||
61 | ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id); | 45 | ValidationUtil.isNull(memberVipHistory.getId(),"MemberVipHistory","id",id); |
62 | return memberVipHistoryMapper.toDto(memberVipHistory); | 46 | log.info("MemberVipHistoryServiceImpl ==>> findById ==>> result ==>> [{}]",memberVipHistory); |
47 | return this.memberVipHistoryMapper.toDto(memberVipHistory); | ||
63 | } | 48 | } |
64 | 49 | ||
65 | @Override | 50 | @Override |
66 | @Transactional(rollbackFor = Exception.class) | 51 | @Transactional(rollbackFor = Exception.class) |
67 | public void create(MemberVipHistory resources) { | 52 | public void create(MemberVipHistory resources) { |
68 | log.info("MemberVipHistoryServiceImpl ==>> create ==>> resources ==>> [{}]",resources); | 53 | log.info("MemberVipHistoryServiceImpl ==>> MemberVipHistoryServiceImpl ==>> param ==>> [{}]",resources); |
69 | String memberCode = resources.getMemberCode(); | 54 | MemberDTO memberDTO = this.memberService.findByCode(resources.getMemberCode()); |
70 | Assert.notNull(resources.getMemberCode(),"memberCode can't be null !!"); | 55 | resources.setMemberId(memberDTO.getId()); |
71 | MemberDTO byCode = memberService.getByCode(memberCode); | 56 | this.memberVipHistoryRepository.save(resources); |
72 | if (Objects.nonNull(byCode.getCode())) { | 57 | } |
73 | Long id = byCode.getId(); | 58 | |
74 | resources.setMemberId(id); | 59 | @Override |
75 | memberVipHistoryRepository.save(resources); | 60 | public void create(Member member, Integer beforeVip) { |
76 | } | 61 | this.checkMember(member); |
62 | MemberVipHistory memberVipHistory = MemberVipHistoryBuilder.build(member, beforeVip); | ||
63 | this.memberVipHistoryRepository.save(memberVipHistory); | ||
77 | } | 64 | } |
78 | 65 | ||
79 | @Override | 66 | @Override |
80 | @Transactional(rollbackFor = Exception.class) | 67 | @Transactional(rollbackFor = Exception.class) |
81 | public void update(MemberVipHistory resources) { | 68 | public void update(MemberVipHistory resources) { |
82 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new); | 69 | MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(resources.getId()).orElseGet(MemberVipHistory::new); |
83 | ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId()); | 70 | ValidationUtil.isNull( memberVipHistory.getId(),"MemberVipHistory","id",resources.getId()); |
84 | memberVipHistory.copy(resources); | 71 | memberVipHistory.copy(resources); |
85 | memberVipHistoryRepository.save(memberVipHistory); | 72 | this.memberVipHistoryRepository.save(memberVipHistory); |
86 | } | 73 | } |
87 | 74 | ||
88 | @Override | 75 | @Override |
89 | @Transactional(rollbackFor = Exception.class) | 76 | @Transactional(rollbackFor = Exception.class) |
90 | public void delete(Long id) { | 77 | public void delete(Long id) { |
91 | Assert.notNull(id, "The given id must not be null!"); | 78 | Assert.notNull(id, "The given id must not be null!"); |
92 | MemberVipHistory memberVipHistory = memberVipHistoryRepository.findById(id).orElseThrow( | 79 | MemberVipHistory memberVipHistory = this.memberVipHistoryRepository.findById(id).orElseThrow( |
93 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1)); | 80 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", MemberVipHistory.class, id), 1)); |
94 | memberVipHistoryRepository.delete(memberVipHistory); | 81 | this.memberVipHistoryRepository.delete(memberVipHistory); |
95 | } | 82 | } |
96 | 83 | ||
97 | @Override | 84 | @Override |
... | @@ -100,5 +87,16 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { | ... | @@ -100,5 +87,16 @@ public class MemberVipHistoryServiceImpl implements MemberVipHistoryService { |
100 | return memberVipHistory; | 87 | return memberVipHistory; |
101 | } | 88 | } |
102 | 89 | ||
90 | private MemberDTO checkMember(MemberVipHistory resources){ | ||
91 | Long memberId = resources.getMemberId(); | ||
92 | String code = resources.getMemberCode(); | ||
93 | return this.memberService.checkMember(memberId, code); | ||
94 | } | ||
95 | |||
96 | private MemberDTO checkMember(Member resources){ | ||
97 | Long memberId = resources.getId(); | ||
98 | String code = resources.getCode(); | ||
99 | return this.memberService.checkMember(memberId, code); | ||
100 | } | ||
103 | 101 | ||
104 | } | 102 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.points.available.domain; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.points.available.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.fasterxml.jackson.annotation.JsonFormat; | ||
6 | import com.topdraw.business.module.common.domain.AsyncMqModule; | ||
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.experimental.Accessors; | 8 | import lombok.experimental.Accessors; |
7 | import org.springframework.data.annotation.CreatedDate; | 9 | import org.springframework.data.annotation.CreatedDate; |
... | @@ -24,53 +26,49 @@ import java.time.LocalDateTime; | ... | @@ -24,53 +26,49 @@ import java.time.LocalDateTime; |
24 | @EntityListeners(AuditingEntityListener.class) | 26 | @EntityListeners(AuditingEntityListener.class) |
25 | @Accessors(chain = true) | 27 | @Accessors(chain = true) |
26 | @Table(name="uc_points_available") | 28 | @Table(name="uc_points_available") |
27 | public class PointsAvailable implements Serializable { | 29 | public class PointsAvailable extends AsyncMqModule implements Serializable { |
28 | 30 | ||
29 | /** 会员编号 */ | 31 | /** 主键 */ |
30 | @Transient | ||
31 | private String memberCode; | ||
32 | |||
33 | // 主键 | ||
34 | @Id | 32 | @Id |
35 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 33 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
36 | @Column(name = "id") | 34 | @Column(name = "id") |
37 | private Long id; | 35 | private Long id; |
38 | 36 | ||
39 | // 标识 | 37 | /** 标识 */ |
40 | @Column(name = "code") | 38 | @Column(name = "code") |
41 | private String code; | 39 | private String code; |
42 | 40 | ||
43 | // 积分类型 0:通用型 | 41 | /** 积分类型 0:通用型 */ |
44 | @Column(name = "points_type") | 42 | @Column(name = "points_type") |
45 | private Integer pointsType; | 43 | private Integer pointsType; |
46 | 44 | ||
47 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 45 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
48 | @Column(name = "device_type") | 46 | @Column(name = "device_type") |
49 | private Integer deviceType; | 47 | private Integer deviceType; |
50 | 48 | ||
51 | // 会员id | 49 | /** 会员id */ |
52 | @Column(name = "member_id", nullable = false) | 50 | @Column(name = "member_id", nullable = false) |
53 | private Long memberId; | 51 | private Long memberId; |
54 | 52 | ||
55 | // 积分值 | 53 | /** 积分值 */ |
56 | @Column(name = "points") | 54 | @Column(name = "points") |
57 | private Long points; | 55 | private Long points; |
58 | 56 | ||
59 | // 过期时间 | 57 | /** 过期时间 */ |
60 | // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | 58 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "") |
61 | @Column(name = "expire_time") | 59 | @Column(name = "expire_time") |
62 | private LocalDateTime expireTime; | 60 | private LocalDateTime expireTime; |
63 | 61 | ||
64 | // 描述 | 62 | /** 描述 */ |
65 | @Column(name = "description") | 63 | @Column(name = "description") |
66 | private String description; | 64 | private String description; |
67 | 65 | ||
68 | // 创建时间 | 66 | /** 创建时间 */ |
69 | @CreatedDate | 67 | @CreatedDate |
70 | @Column(name = "create_time") | 68 | @Column(name = "create_time") |
71 | private Timestamp createTime; | 69 | private Timestamp createTime; |
72 | 70 | ||
73 | // 更新时间 | 71 | /** 更新时间 */ |
74 | @LastModifiedDate | 72 | @LastModifiedDate |
75 | @Column(name = "update_time") | 73 | @Column(name = "update_time") |
76 | private Timestamp updateTime; | 74 | private Timestamp updateTime; | ... | ... |
src/main/java/com/topdraw/business/module/points/available/repository/PointsAvailableRepository.java
... | @@ -25,7 +25,7 @@ public interface PointsAvailableRepository extends JpaRepository<PointsAvailable | ... | @@ -25,7 +25,7 @@ public interface PointsAvailableRepository extends JpaRepository<PointsAvailable |
25 | 25 | ||
26 | List<PointsAvailableDTO> findByMemberId(Long memberId); | 26 | List<PointsAvailableDTO> findByMemberId(Long memberId); |
27 | 27 | ||
28 | List<PointsAvailable> findByMemberIdAndExpireTimeBefore(Long memberId , LocalDateTime now); | 28 | List<PointsAvailable> findByMemberIdAndExpireTimeBefore(Long memberId, LocalDateTime now); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 即将过期的积分 | 31 | * 即将过期的积分 | ... | ... |
1 | package com.topdraw.business.module.points.available.rest; | ||
2 | |||
3 | /** | ||
4 | * @author XiangHan | ||
5 | * @date 2021-10-23 | ||
6 | */ | ||
7 | //@Api(tags = "PointsAvailable管理") | ||
8 | //@RestController | ||
9 | //@RequestMapping("/api/PointsAvailable") | ||
10 | public class PointsAvailableController { | ||
11 | |||
12 | /*@Autowired | ||
13 | private PointsAvailableService PointsAvailableService; | ||
14 | |||
15 | @GetMapping | ||
16 | @ApiOperation("查询PointsAvailable") | ||
17 | public ResultInfo getPointsAvailables(PointsAvailableQueryCriteria criteria, Pageable pageable) { | ||
18 | return ResultInfo.successPage(PointsAvailableService.queryAll(criteria,pageable)); | ||
19 | } | ||
20 | |||
21 | @GetMapping(value = "/all") | ||
22 | @ApiOperation("查询所有PointsAvailable") | ||
23 | public ResultInfo getPointsAvailables(PointsAvailableQueryCriteria criteria) { | ||
24 | return ResultInfo.success(PointsAvailableService.queryAll(criteria)); | ||
25 | } | ||
26 | |||
27 | @Log | ||
28 | @PostMapping | ||
29 | @ApiOperation("新增PointsAvailable") | ||
30 | public ResultInfo create(@Validated @RequestBody PointsAvailable resources) { | ||
31 | PointsAvailableService.create(resources); | ||
32 | return ResultInfo.success(); | ||
33 | } | ||
34 | |||
35 | @Log | ||
36 | @PutMapping | ||
37 | @ApiOperation("修改PointsAvailable") | ||
38 | public ResultInfo update(@Validated @RequestBody PointsAvailable resources) { | ||
39 | PointsAvailableService.update(resources); | ||
40 | return ResultInfo.success(); | ||
41 | } | ||
42 | |||
43 | |||
44 | @Log | ||
45 | @DeleteMapping(value = "/{id}") | ||
46 | @ApiOperation("删除PointsAvailable") | ||
47 | public ResultInfo delete(@PathVariable Long id) { | ||
48 | PointsAvailableService.delete(id); | ||
49 | return ResultInfo.success(); | ||
50 | } | ||
51 | |||
52 | @GetMapping(value = "/getByCode/{code}") | ||
53 | @ApiOperation(value = "根据标识查询") | ||
54 | public ResultInfo getByCode(@PathVariable String code) { | ||
55 | return ResultInfo.success(PointsAvailableService.getByCode(code)); | ||
56 | }*/ | ||
57 | } |
... | @@ -2,12 +2,9 @@ package com.topdraw.business.module.points.available.service; | ... | @@ -2,12 +2,9 @@ package com.topdraw.business.module.points.available.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.points.available.domain.PointsAvailable; | 3 | import com.topdraw.business.module.points.available.domain.PointsAvailable; |
4 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; | 4 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; |
5 | import com.topdraw.business.module.points.available.service.dto.PointsAvailableQueryCriteria; | ||
6 | import org.springframework.data.domain.Pageable; | ||
7 | 5 | ||
8 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
9 | import java.util.List; | 7 | import java.util.List; |
10 | import java.util.Map; | ||
11 | 8 | ||
12 | /** | 9 | /** |
13 | * @author XiangHan | 10 | * @author XiangHan |
... | @@ -16,21 +13,6 @@ import java.util.Map; | ... | @@ -16,21 +13,6 @@ import java.util.Map; |
16 | public interface PointsAvailableService { | 13 | public interface PointsAvailableService { |
17 | 14 | ||
18 | /** | 15 | /** |
19 | * 查询数据分页 | ||
20 | * @param criteria 条件参数 | ||
21 | * @param pageable 分页参数 | ||
22 | * @return Map<String,Object> | ||
23 | */ | ||
24 | Map<String,Object> queryAll(PointsAvailableQueryCriteria criteria, Pageable pageable); | ||
25 | |||
26 | /** | ||
27 | * 查询所有数据不分页 | ||
28 | * @param criteria 条件参数 | ||
29 | * @return List<PointsAvailableDTO> | ||
30 | */ | ||
31 | List<PointsAvailableDTO> queryAll(PointsAvailableQueryCriteria criteria); | ||
32 | |||
33 | /** | ||
34 | * 根据ID查询 | 16 | * 根据ID查询 |
35 | * @param id ID | 17 | * @param id ID |
36 | * @return PointsAvailableDTO | 18 | * @return PointsAvailableDTO |
... | @@ -41,13 +23,13 @@ public interface PointsAvailableService { | ... | @@ -41,13 +23,13 @@ public interface PointsAvailableService { |
41 | * | 23 | * |
42 | * @param resources | 24 | * @param resources |
43 | */ | 25 | */ |
44 | void create(PointsAvailable resources); | 26 | PointsAvailableDTO create(PointsAvailable resources); |
45 | 27 | ||
46 | /** | 28 | /** |
47 | * | 29 | * |
48 | * @param resources | 30 | * @param resources |
49 | */ | 31 | */ |
50 | void update(PointsAvailable resources); | 32 | PointsAvailableDTO update(PointsAvailable resources); |
51 | 33 | ||
52 | /** | 34 | /** |
53 | * | 35 | * |
... | @@ -55,8 +37,6 @@ public interface PointsAvailableService { | ... | @@ -55,8 +37,6 @@ public interface PointsAvailableService { |
55 | */ | 37 | */ |
56 | void delete(Long id); | 38 | void delete(Long id); |
57 | 39 | ||
58 | void delete4Custom(Long id); | ||
59 | |||
60 | /** | 40 | /** |
61 | * | 41 | * |
62 | * @param id | 42 | * @param id |
... | @@ -84,7 +64,7 @@ public interface PointsAvailableService { | ... | @@ -84,7 +64,7 @@ public interface PointsAvailableService { |
84 | * @param factor 阈值 | 64 | * @param factor 阈值 |
85 | * @return | 65 | * @return |
86 | */ | 66 | */ |
87 | Long findSoonExpireTime(Long memberId,Integer factor); | 67 | Long findSoonExpireTime(Long memberId, Integer factor); |
88 | 68 | ||
89 | /** | 69 | /** |
90 | * | 70 | * |
... | @@ -107,6 +87,15 @@ public interface PointsAvailableService { | ... | @@ -107,6 +87,15 @@ public interface PointsAvailableService { |
107 | */ | 87 | */ |
108 | long findTotalPointsByMemberId(Long memberId); | 88 | long findTotalPointsByMemberId(Long memberId); |
109 | 89 | ||
110 | void create4Custom(PointsAvailable pointsAvailable); | 90 | /** |
91 | * | ||
92 | * @param id | ||
93 | */ | ||
94 | void delete4Custom(Long id); | ||
111 | 95 | ||
96 | /** | ||
97 | * | ||
98 | * @param pointsAvailable | ||
99 | */ | ||
100 | PointsAvailableDTO create4Custom(PointsAvailable pointsAvailable); | ||
112 | } | 101 | } | ... | ... |
... | @@ -14,33 +14,33 @@ import java.time.LocalDateTime; | ... | @@ -14,33 +14,33 @@ import java.time.LocalDateTime; |
14 | @Data | 14 | @Data |
15 | public class PointsAvailableDTO implements Serializable { | 15 | public class PointsAvailableDTO implements Serializable { |
16 | 16 | ||
17 | // 主键 | 17 | /** 主键 */ |
18 | private Long id; | 18 | private Long id; |
19 | 19 | ||
20 | // 标识 | 20 | /** 标识 */ |
21 | private String code; | 21 | private String code; |
22 | 22 | ||
23 | // 积分类型 0:通用型 | 23 | /** 积分类型 0:通用型 */ |
24 | private Integer pointsType; | 24 | private Integer pointsType; |
25 | 25 | ||
26 | // 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 26 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ |
27 | private Integer deviceType; | 27 | private Integer deviceType; |
28 | 28 | ||
29 | // 会员id | 29 | /** 会员id */ |
30 | private Long memberId; | 30 | private Long memberId; |
31 | 31 | ||
32 | // 积分值 | 32 | /** 积分值 */ |
33 | private Long points; | 33 | private Long points; |
34 | 34 | ||
35 | // 过期时间 | 35 | /** 过期时间 */ |
36 | private LocalDateTime expireTime; | 36 | private LocalDateTime expireTime; |
37 | 37 | ||
38 | // 描述 | 38 | /** 描述 */ |
39 | private String description; | 39 | private String description; |
40 | 40 | ||
41 | // 创建时间 | 41 | /** 创建时间 */ |
42 | private Timestamp createTime; | 42 | private Timestamp createTime; |
43 | 43 | ||
44 | // 更新时间 | 44 | /** 更新时间 */ |
45 | private Timestamp updateTime; | 45 | private Timestamp updateTime; |
46 | } | 46 | } | ... | ... |
This diff is collapsed.
Click to expand it.
1 | package com.topdraw.business.module.points.detail.detailhistory.service.impl; | 1 | package com.topdraw.business.module.points.detail.detailhistory.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; | 3 | import com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory; |
4 | import com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository; | ||
5 | import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; | 4 | import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService; |
6 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; | 5 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryDTO; |
7 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; | 6 | import com.topdraw.business.module.points.detail.detailhistory.service.dto.PointsDetailHistoryQueryCriteria; |
8 | import com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper; | ||
9 | import com.topdraw.utils.PageUtil; | 7 | import com.topdraw.utils.PageUtil; |
10 | import com.topdraw.utils.QueryHelp; | 8 | import com.topdraw.utils.QueryHelp; |
11 | import com.topdraw.utils.StringUtils; | 9 | import com.topdraw.utils.StringUtils; |
... | @@ -31,10 +29,10 @@ import java.util.Map; | ... | @@ -31,10 +29,10 @@ import java.util.Map; |
31 | public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryService { | 29 | public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryService { |
32 | 30 | ||
33 | @Autowired | 31 | @Autowired |
34 | private PointsDetailHistoryRepository PointsDetailHistoryRepository; | 32 | private com.topdraw.business.module.points.detail.detailhistory.repository.PointsDetailHistoryRepository PointsDetailHistoryRepository; |
35 | 33 | ||
36 | @Autowired | 34 | @Autowired |
37 | private PointsDetailHistoryMapper PointsDetailHistoryMapper; | 35 | private com.topdraw.business.module.points.detail.detailhistory.service.mapper.PointsDetailHistoryMapper PointsDetailHistoryMapper; |
38 | 36 | ||
39 | @Override | 37 | @Override |
40 | public Map<String, Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable) { | 38 | public Map<String, Object> queryAll(PointsDetailHistoryQueryCriteria criteria, Pageable pageable) { |
... | @@ -49,7 +47,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic | ... | @@ -49,7 +47,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic |
49 | 47 | ||
50 | @Override | 48 | @Override |
51 | public PointsDetailHistoryDTO findById(Long id) { | 49 | public PointsDetailHistoryDTO findById(Long id) { |
52 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseGet(PointsDetailHistory::new); | 50 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseGet(com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory::new); |
53 | ValidationUtil.isNull(PointsDetailHistory.getId(),"PointsDetailHistory","id",id); | 51 | ValidationUtil.isNull(PointsDetailHistory.getId(),"PointsDetailHistory","id",id); |
54 | return PointsDetailHistoryMapper.toDto(PointsDetailHistory); | 52 | return PointsDetailHistoryMapper.toDto(PointsDetailHistory); |
55 | } | 53 | } |
... | @@ -63,7 +61,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic | ... | @@ -63,7 +61,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic |
63 | @Override | 61 | @Override |
64 | @Transactional(rollbackFor = Exception.class) | 62 | @Transactional(rollbackFor = Exception.class) |
65 | public void update(PointsDetailHistory resources) { | 63 | public void update(PointsDetailHistory resources) { |
66 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(resources.getId()).orElseGet(PointsDetailHistory::new); | 64 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(resources.getId()).orElseGet(com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory::new); |
67 | ValidationUtil.isNull( PointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId()); | 65 | ValidationUtil.isNull( PointsDetailHistory.getId(),"PointsDetailHistory","id",resources.getId()); |
68 | PointsDetailHistory.copy(resources); | 66 | PointsDetailHistory.copy(resources); |
69 | PointsDetailHistoryRepository.save(PointsDetailHistory); | 67 | PointsDetailHistoryRepository.save(PointsDetailHistory); |
... | @@ -74,7 +72,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic | ... | @@ -74,7 +72,7 @@ public class PointsDetailHistoryServiceImpl implements PointsDetailHistoryServic |
74 | public void delete(Long id) { | 72 | public void delete(Long id) { |
75 | Assert.notNull(id, "The given id must not be null!"); | 73 | Assert.notNull(id, "The given id must not be null!"); |
76 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseThrow( | 74 | PointsDetailHistory PointsDetailHistory = PointsDetailHistoryRepository.findById(id).orElseThrow( |
77 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", PointsDetailHistory.class, id), 1)); | 75 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.detail.detailhistory.domain.PointsDetailHistory.class, id), 1)); |
78 | PointsDetailHistoryRepository.delete(PointsDetailHistory); | 76 | PointsDetailHistoryRepository.delete(PointsDetailHistory); |
79 | } | 77 | } |
80 | 78 | ... | ... |
... | @@ -84,6 +84,10 @@ public class PointsDetail implements Serializable { | ... | @@ -84,6 +84,10 @@ public class PointsDetail implements Serializable { |
84 | @Column(name = "description", nullable = false) | 84 | @Column(name = "description", nullable = false) |
85 | private String description; | 85 | private String description; |
86 | 86 | ||
87 | // 商品id | ||
88 | @Column(name = "item_id") | ||
89 | private Long itemId; | ||
90 | |||
87 | // 创建时间 | 91 | // 创建时间 |
88 | @CreatedDate | 92 | @CreatedDate |
89 | @Column(name = "create_time") | 93 | @Column(name = "create_time") | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/points/service/dto/PointsQueryCriteria.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/rights/permanentrights/service/PermanentRightsService.java
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/rights/permanentrights/service/dto/PermanentRightsDTO.java
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryCriteria.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryType.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/attribute/repository/TaskAttrRepository.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/attribute/service/impl/TaskAttrServiceImpl.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/progress/repository/TrTaskProgressRepository.java
0 → 100644
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/progress/service/TrTaskProgressService.java
0 → 100644
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/progress/service/dto/TrTaskProgressDTO.java
0 → 100644
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/progress/service/impl/TrTaskProgressServiceImpl.java
0 → 100644
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/progress/service/mapper/TrTaskProgressMapper.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/task/service/dto/TaskQueryCriteria.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/module/user/iptv/service/dto/UserTvQueryCriteria.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/impl/MemberOperationServiceImpl.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/impl/RightsOperationServiceImpl.java
deleted
100644 → 0
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/impl/TaskTemplateOperationServiceImpl.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/impl/member/MemberOperationServiceImpl.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/member/MemberAddressOperationService.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/member/MemberProfileOperationService.java
0 → 100644
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/business/process/service/member/MemberRelatedInfoOperationService.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/util/FileUtil.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/util/ListUtil.java
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment